Repository Public License
1{2 "entrypoint": "calculator",3 "id": "app_tip_calculator",4 "name": "Tip Calculator",5 "objects": [6 {7 "children": [8 "root"9 ],10 "id": "calculator",11 "name": "Tip Calculator",12 "props": {13 "icon": "percent"14 },15 "provenance": {16 "source": "agent"17 },18 "schemaVersion": 1,19 "type": "prism.page",20 "version": 121 },22 {23 "children": [24 "inputs",25 "results"26 ],27 "id": "root",28 "props": {29 "align": "stretch",30 "grow": true,31 "padding": 20,32 "spacing": 1633 },34 "provenance": {35 "source": "agent"36 },37 "schemaVersion": 1,38 "type": "prism.stack",39 "version": 140 },41 {42 "children": [43 "billField",44 "tipField",45 "peopleField"46 ],47 "id": "inputs",48 "props": {49 "title": "Bill"50 },51 "provenance": {52 "source": "agent"53 },54 "schemaVersion": 1,55 "type": "prism.formSection",56 "version": 157 },58 {59 "id": "billField",60 "props": {61 "currencyCode": "USD",62 "label": "Bill amount",63 "value": {64 "$bind": "bill"65 }66 },67 "provenance": {68 "source": "agent"69 },70 "schemaVersion": 1,71 "type": "prism.currencyField",72 "version": 173 },74 {75 "id": "tipField",76 "props": {77 "label": "Tip percent",78 "max": 100,79 "min": 0,80 "step": 1,81 "value": {82 "$bind": "tipPercent"83 }84 },85 "provenance": {86 "source": "agent"87 },88 "schemaVersion": 1,89 "type": "prism.numberField",90 "version": 191 },92 {93 "id": "peopleField",94 "props": {95 "label": "Number of people",96 "max": 100,97 "min": 1,98 "step": 1,99 "value": {100 "$bind": "people"101 }102 },103 "provenance": {104 "source": "agent"105 },106 "schemaVersion": 1,107 "type": "prism.numberField",108 "version": 1109 },110 {111 "children": [112 "tipAmount",113 "totalAmount",114 "perPerson"115 ],116 "id": "results",117 "props": {118 "columns": 3,119 "spacing": 12120 },121 "provenance": {122 "source": "agent"123 },124 "schemaVersion": 1,125 "type": "prism.grid",126 "version": 1127 },128 {129 "id": "tipAmount",130 "props": {131 "format": "currency",132 "icon": "percent",133 "label": "Tip",134 "value": {135 "$expr": "state.bill * state.tipPercent / 100"136 }137 },138 "provenance": {139 "source": "agent"140 },141 "schemaVersion": 1,142 "type": "prism.aggregation",143 "version": 1144 },145 {146 "id": "totalAmount",147 "props": {148 "format": "currency",149 "icon": "sum",150 "label": "Total with tip",151 "value": {152 "$expr": "state.bill * (1 + state.tipPercent / 100)"153 }154 },155 "provenance": {156 "source": "agent"157 },158 "schemaVersion": 1,159 "type": "prism.aggregation",160 "version": 1161 },162 {163 "id": "perPerson",164 "props": {165 "format": "currency",166 "icon": "person.2",167 "label": "Each person pays",168 "tone": "accent",169 "value": {170 "$expr": "state.bill * (1 + state.tipPercent / 100) / max(state.people, 1)"171 }172 },173 "provenance": {174 "source": "agent"175 },176 "schemaVersion": 1,177 "type": "prism.aggregation",178 "version": 1179 }180 ],181 "permissions": [],182 "schemaVersion": 1,183 "state": {184 "bill": 0,185 "people": 1,186 "tipPercent": 15187 },188 "summary": "Works out the tip, the total and each person's share from a bill amount, a tip percent and the number of people.",189 "version": 1190}