@bacon-pos/ui 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/lib/commonjs/components/CodeField/CodeField.js +10 -2
  2. package/lib/commonjs/components/CodeField/CodeField.js.map +1 -1
  3. package/lib/commonjs/components/CodeField/CodeField.stories.js +15 -2
  4. package/lib/commonjs/components/CodeField/CodeField.stories.js.map +1 -1
  5. package/lib/commonjs/components/Dropdown/Dropdown.js +282 -0
  6. package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -0
  7. package/lib/commonjs/components/Dropdown/Dropdown.stories.js +421 -0
  8. package/lib/commonjs/components/Dropdown/Dropdown.stories.js.map +1 -0
  9. package/lib/commonjs/components/Dropdown/Dropdown.test.js +113 -0
  10. package/lib/commonjs/components/Dropdown/Dropdown.test.js.map +1 -0
  11. package/lib/commonjs/components/Dropdown/index.js +19 -0
  12. package/lib/commonjs/components/Dropdown/index.js.map +1 -0
  13. package/lib/commonjs/components/Menu/Menu.js +214 -0
  14. package/lib/commonjs/components/Menu/Menu.js.map +1 -0
  15. package/lib/commonjs/components/Menu/Menu.test.js +71 -0
  16. package/lib/commonjs/components/Menu/Menu.test.js.map +1 -0
  17. package/lib/commonjs/components/Menu/MenuButton.js +73 -0
  18. package/lib/commonjs/components/Menu/MenuButton.js.map +1 -0
  19. package/lib/commonjs/components/Menu/MenuButton.stories.js +166 -0
  20. package/lib/commonjs/components/Menu/MenuButton.stories.js.map +1 -0
  21. package/lib/commonjs/components/Menu/SelectButton.js +143 -0
  22. package/lib/commonjs/components/Menu/SelectButton.js.map +1 -0
  23. package/lib/commonjs/components/Menu/SelectButton.stories.js +116 -0
  24. package/lib/commonjs/components/Menu/SelectButton.stories.js.map +1 -0
  25. package/lib/commonjs/components/Menu/SelectButton.test.js +80 -0
  26. package/lib/commonjs/components/Menu/SelectButton.test.js.map +1 -0
  27. package/lib/commonjs/components/Menu/index.js +27 -0
  28. package/lib/commonjs/components/Menu/index.js.map +1 -0
  29. package/lib/commonjs/components/Select/Select.js +246 -0
  30. package/lib/commonjs/components/Select/Select.js.map +1 -0
  31. package/lib/commonjs/components/Select/Select.stories.js +221 -0
  32. package/lib/commonjs/components/Select/Select.stories.js.map +1 -0
  33. package/lib/commonjs/components/Select/Select.test.js +165 -0
  34. package/lib/commonjs/components/Select/Select.test.js.map +1 -0
  35. package/lib/commonjs/components/Select/index.js +13 -0
  36. package/lib/commonjs/components/Select/index.js.map +1 -0
  37. package/lib/commonjs/components/UserChip/UserChip.js +121 -0
  38. package/lib/commonjs/components/UserChip/UserChip.js.map +1 -0
  39. package/lib/commonjs/components/UserChip/UserChip.stories.js +153 -0
  40. package/lib/commonjs/components/UserChip/UserChip.stories.js.map +1 -0
  41. package/lib/commonjs/components/UserChip/UserChip.test.js +59 -0
  42. package/lib/commonjs/components/UserChip/UserChip.test.js.map +1 -0
  43. package/lib/commonjs/components/UserChip/index.js +13 -0
  44. package/lib/commonjs/components/UserChip/index.js.map +1 -0
  45. package/lib/commonjs/components/index.js +57 -13
  46. package/lib/commonjs/components/index.js.map +1 -1
  47. package/lib/module/components/CodeField/CodeField.js +10 -2
  48. package/lib/module/components/CodeField/CodeField.js.map +1 -1
  49. package/lib/module/components/CodeField/CodeField.stories.js +14 -1
  50. package/lib/module/components/CodeField/CodeField.stories.js.map +1 -1
  51. package/lib/module/components/Dropdown/Dropdown.js +277 -0
  52. package/lib/module/components/Dropdown/Dropdown.js.map +1 -0
  53. package/lib/module/components/Dropdown/Dropdown.stories.js +417 -0
  54. package/lib/module/components/Dropdown/Dropdown.stories.js.map +1 -0
  55. package/lib/module/components/Dropdown/Dropdown.test.js +113 -0
  56. package/lib/module/components/Dropdown/Dropdown.test.js.map +1 -0
  57. package/lib/module/components/Dropdown/index.js +4 -0
  58. package/lib/module/components/Dropdown/index.js.map +1 -0
  59. package/lib/module/components/Menu/Menu.js +210 -0
  60. package/lib/module/components/Menu/Menu.js.map +1 -0
  61. package/lib/module/components/Menu/Menu.test.js +71 -0
  62. package/lib/module/components/Menu/Menu.test.js.map +1 -0
  63. package/lib/module/components/Menu/MenuButton.js +69 -0
  64. package/lib/module/components/Menu/MenuButton.js.map +1 -0
  65. package/lib/module/components/Menu/MenuButton.stories.js +162 -0
  66. package/lib/module/components/Menu/MenuButton.stories.js.map +1 -0
  67. package/lib/module/components/Menu/SelectButton.js +139 -0
  68. package/lib/module/components/Menu/SelectButton.js.map +1 -0
  69. package/lib/module/components/Menu/SelectButton.stories.js +112 -0
  70. package/lib/module/components/Menu/SelectButton.stories.js.map +1 -0
  71. package/lib/module/components/Menu/SelectButton.test.js +80 -0
  72. package/lib/module/components/Menu/SelectButton.test.js.map +1 -0
  73. package/lib/module/components/Menu/index.js +6 -0
  74. package/lib/module/components/Menu/index.js.map +1 -0
  75. package/lib/module/components/Select/Select.js +244 -0
  76. package/lib/module/components/Select/Select.js.map +1 -0
  77. package/lib/module/components/Select/Select.stories.js +217 -0
  78. package/lib/module/components/Select/Select.stories.js.map +1 -0
  79. package/lib/module/components/Select/Select.test.js +165 -0
  80. package/lib/module/components/Select/Select.test.js.map +1 -0
  81. package/lib/module/components/Select/index.js +4 -0
  82. package/lib/module/components/Select/index.js.map +1 -0
  83. package/lib/module/components/UserChip/UserChip.js +117 -0
  84. package/lib/module/components/UserChip/UserChip.js.map +1 -0
  85. package/lib/module/components/UserChip/UserChip.stories.js +149 -0
  86. package/lib/module/components/UserChip/UserChip.stories.js.map +1 -0
  87. package/lib/module/components/UserChip/UserChip.test.js +59 -0
  88. package/lib/module/components/UserChip/UserChip.test.js.map +1 -0
  89. package/lib/module/components/UserChip/index.js +4 -0
  90. package/lib/module/components/UserChip/index.js.map +1 -0
  91. package/lib/module/components/index.js +4 -0
  92. package/lib/module/components/index.js.map +1 -1
  93. package/lib/typescript/commonjs/components/CodeField/CodeField.d.ts +4 -2
  94. package/lib/typescript/commonjs/components/CodeField/CodeField.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/components/Dropdown/Dropdown.d.ts +105 -0
  96. package/lib/typescript/commonjs/components/Dropdown/Dropdown.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/components/Dropdown/index.d.ts +3 -0
  98. package/lib/typescript/commonjs/components/Dropdown/index.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/components/Menu/Menu.d.ts +66 -0
  100. package/lib/typescript/commonjs/components/Menu/Menu.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/components/Menu/MenuButton.d.ts +46 -0
  102. package/lib/typescript/commonjs/components/Menu/MenuButton.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/components/Menu/SelectButton.d.ts +60 -0
  104. package/lib/typescript/commonjs/components/Menu/SelectButton.d.ts.map +1 -0
  105. package/lib/typescript/commonjs/components/Menu/index.d.ts +7 -0
  106. package/lib/typescript/commonjs/components/Menu/index.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/components/Select/Select.d.ts +73 -0
  108. package/lib/typescript/commonjs/components/Select/Select.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/components/Select/index.d.ts +3 -0
  110. package/lib/typescript/commonjs/components/Select/index.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/components/UserChip/UserChip.d.ts +33 -0
  112. package/lib/typescript/commonjs/components/UserChip/UserChip.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/components/UserChip/index.d.ts +3 -0
  114. package/lib/typescript/commonjs/components/UserChip/index.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/components/index.d.ts +4 -0
  116. package/lib/typescript/commonjs/components/index.d.ts.map +1 -1
  117. package/lib/typescript/module/components/CodeField/CodeField.d.ts +4 -2
  118. package/lib/typescript/module/components/CodeField/CodeField.d.ts.map +1 -1
  119. package/lib/typescript/module/components/Dropdown/Dropdown.d.ts +105 -0
  120. package/lib/typescript/module/components/Dropdown/Dropdown.d.ts.map +1 -0
  121. package/lib/typescript/module/components/Dropdown/index.d.ts +3 -0
  122. package/lib/typescript/module/components/Dropdown/index.d.ts.map +1 -0
  123. package/lib/typescript/module/components/Menu/Menu.d.ts +66 -0
  124. package/lib/typescript/module/components/Menu/Menu.d.ts.map +1 -0
  125. package/lib/typescript/module/components/Menu/MenuButton.d.ts +46 -0
  126. package/lib/typescript/module/components/Menu/MenuButton.d.ts.map +1 -0
  127. package/lib/typescript/module/components/Menu/SelectButton.d.ts +60 -0
  128. package/lib/typescript/module/components/Menu/SelectButton.d.ts.map +1 -0
  129. package/lib/typescript/module/components/Menu/index.d.ts +7 -0
  130. package/lib/typescript/module/components/Menu/index.d.ts.map +1 -0
  131. package/lib/typescript/module/components/Select/Select.d.ts +73 -0
  132. package/lib/typescript/module/components/Select/Select.d.ts.map +1 -0
  133. package/lib/typescript/module/components/Select/index.d.ts +3 -0
  134. package/lib/typescript/module/components/Select/index.d.ts.map +1 -0
  135. package/lib/typescript/module/components/UserChip/UserChip.d.ts +33 -0
  136. package/lib/typescript/module/components/UserChip/UserChip.d.ts.map +1 -0
  137. package/lib/typescript/module/components/UserChip/index.d.ts +3 -0
  138. package/lib/typescript/module/components/UserChip/index.d.ts.map +1 -0
  139. package/lib/typescript/module/components/index.d.ts +4 -0
  140. package/lib/typescript/module/components/index.d.ts.map +1 -1
  141. package/package.json +1 -1
  142. package/src/components/CodeField/CodeField.tsx +6 -3
  143. package/src/components/Dropdown/Dropdown.tsx +319 -0
  144. package/src/components/Dropdown/index.ts +2 -0
  145. package/src/components/Menu/Menu.tsx +249 -0
  146. package/src/components/Menu/MenuButton.tsx +98 -0
  147. package/src/components/Menu/SelectButton.tsx +171 -0
  148. package/src/components/Menu/index.ts +12 -0
  149. package/src/components/Select/Select.tsx +323 -0
  150. package/src/components/Select/index.ts +2 -0
  151. package/src/components/UserChip/UserChip.tsx +138 -0
  152. package/src/components/UserChip/index.ts +2 -0
  153. package/src/components/index.ts +4 -0
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.SingleSelect = exports.Scrollable = exports.MultiSelect = exports.InsideDialog = exports.FixedMenuWidth = exports.Error = exports.Disabled = exports.Default = exports.CustomWidth = void 0;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _Select = require("./Select.js");
10
+ var _Button = require("../Button/Button.js");
11
+ var _Dialog = require("../Dialog/Dialog.js");
12
+ var _Text = require("../Text/Text.js");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ const meta = {
15
+ title: 'Components/Select',
16
+ component: _Select.Select
17
+ };
18
+ var _default = exports.default = meta;
19
+ const OPTIONS = [{
20
+ key: 'dine-in',
21
+ label: 'Dine in',
22
+ icon: 'dish'
23
+ }, {
24
+ key: 'take-out',
25
+ label: 'Take out',
26
+ icon: 'shopping-bag'
27
+ }, {
28
+ key: 'delivery',
29
+ label: 'Delivery',
30
+ icon: 'truck-delivery'
31
+ }, {
32
+ key: 'pickup',
33
+ label: 'Pickup',
34
+ icon: 'shopping-bag'
35
+ }];
36
+ function Frame({
37
+ children
38
+ }) {
39
+ // Height gives the open menu room in the Storybook canvas.
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
41
+ style: {
42
+ padding: 24,
43
+ width: 360,
44
+ height: 420
45
+ },
46
+ children: children
47
+ });
48
+ }
49
+
50
+ /** Default field (matches Figma "Default"). */
51
+ const Default = exports.Default = {
52
+ render: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(Frame, {
53
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
54
+ options: OPTIONS,
55
+ label: "Label",
56
+ helperText: "Helper text",
57
+ leftIcon: "shopping-bag",
58
+ onChange: () => {}
59
+ })
60
+ })
61
+ };
62
+
63
+ /** Single select — the current option is marked with a check. */
64
+ const SingleSelect = exports.SingleSelect = {
65
+ render: () => {
66
+ const [value, setValue] = (0, _react.useState)('dine-in');
67
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Frame, {
68
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
69
+ options: OPTIONS,
70
+ label: "Order type",
71
+ helperText: "Helper text",
72
+ leftIcon: "shopping-bag",
73
+ value: value,
74
+ onChange: setValue
75
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Text.Text, {
76
+ variant: "caption",
77
+ color: "secondary",
78
+ style: {
79
+ marginTop: 12
80
+ },
81
+ children: ["value: ", String(value)]
82
+ })]
83
+ });
84
+ }
85
+ };
86
+
87
+ /** Multi select — rows become checkboxes; the menu stays open while picking. */
88
+ const MultiSelect = exports.MultiSelect = {
89
+ render: () => {
90
+ const [value, setValue] = (0, _react.useState)(['dine-in', 'delivery']);
91
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Frame, {
92
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
93
+ options: OPTIONS,
94
+ multiple: true,
95
+ label: "Order types",
96
+ helperText: "Choose one or more",
97
+ value: value,
98
+ onChange: setValue
99
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Text.Text, {
100
+ variant: "caption",
101
+ color: "secondary",
102
+ style: {
103
+ marginTop: 12
104
+ },
105
+ children: ["value: ", Array.isArray(value) ? value.join(', ') : value]
106
+ })]
107
+ });
108
+ }
109
+ };
110
+
111
+ /** Error state — red border, red ring on open, red helper text. */
112
+ const Error = exports.Error = {
113
+ render: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(Frame, {
114
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
115
+ options: OPTIONS,
116
+ label: "Order type",
117
+ error: "Please choose an option",
118
+ leftIcon: "shopping-bag",
119
+ onChange: () => {}
120
+ })
121
+ })
122
+ };
123
+
124
+ /** Disabled. */
125
+ const Disabled = exports.Disabled = {
126
+ render: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(Frame, {
127
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
128
+ options: OPTIONS,
129
+ label: "Label",
130
+ helperText: "Helper text",
131
+ leftIcon: "shopping-bag",
132
+ disabled: true,
133
+ defaultValue: "dine-in"
134
+ })
135
+ })
136
+ };
137
+
138
+ /** Long list — the menu scrolls past maxHeight. */
139
+ const Scrollable = exports.Scrollable = {
140
+ render: () => {
141
+ const many = Array.from({
142
+ length: 20
143
+ }).map((_, i) => ({
144
+ key: String(i),
145
+ label: `Option ${i + 1}`
146
+ }));
147
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Frame, {
148
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
149
+ options: many,
150
+ label: "Pick one",
151
+ maxHeight: 260,
152
+ onChange: () => {}
153
+ })
154
+ });
155
+ }
156
+ };
157
+
158
+ /** Fixed menu width instead of matching the field. */
159
+ const FixedMenuWidth = exports.FixedMenuWidth = {
160
+ render: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(Frame, {
161
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
162
+ options: OPTIONS,
163
+ label: "Order type",
164
+ matchTriggerWidth: false,
165
+ menuWidth: 300,
166
+ onChange: () => {}
167
+ })
168
+ })
169
+ };
170
+
171
+ /** Fixed field width (default is full width, the Figma behavior). */
172
+ const CustomWidth = exports.CustomWidth = {
173
+ render: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(Frame, {
174
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
175
+ options: OPTIONS,
176
+ label: "Order type",
177
+ width: 260,
178
+ leftIcon: "shopping-bag",
179
+ onChange: () => {}
180
+ })
181
+ })
182
+ };
183
+
184
+ /**
185
+ * Inside a Dialog — the two modals coexist: the menu positions over the dialog,
186
+ * tapping outside the menu closes only the menu (not the dialog), and back closes
187
+ * the menu first.
188
+ */
189
+ const InsideDialog = exports.InsideDialog = {
190
+ render: () => {
191
+ const [open, setOpen] = (0, _react.useState)(false);
192
+ const [value, setValue] = (0, _react.useState)('dine-in');
193
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
194
+ style: {
195
+ padding: 24
196
+ },
197
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
198
+ label: "Open dialog",
199
+ onPress: () => setOpen(true)
200
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.Dialog, {
201
+ visible: open,
202
+ onClose: () => setOpen(false),
203
+ title: "Order details",
204
+ subtitle: "Pick the order type",
205
+ cancel: {},
206
+ actions: [{
207
+ label: 'Save',
208
+ onPress: () => setOpen(false)
209
+ }],
210
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
211
+ options: OPTIONS,
212
+ label: "Order type",
213
+ leftIcon: "shopping-bag",
214
+ value: value,
215
+ onChange: setValue
216
+ })
217
+ })]
218
+ });
219
+ }
220
+ };
221
+ //# sourceMappingURL=Select.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_Select","_Button","_Dialog","_Text","_jsxRuntime","meta","title","component","Select","_default","exports","default","OPTIONS","key","label","icon","Frame","children","jsx","View","style","padding","width","height","Default","render","options","helperText","leftIcon","onChange","SingleSelect","value","setValue","useState","jsxs","Text","variant","color","marginTop","String","MultiSelect","multiple","Array","isArray","join","Error","error","Disabled","disabled","defaultValue","Scrollable","many","from","length","map","_","i","maxHeight","FixedMenuWidth","matchTriggerWidth","menuWidth","CustomWidth","InsideDialog","open","setOpen","Button","onPress","Dialog","visible","onClose","subtitle","cancel","actions"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/Select/Select.stories.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAAoC,IAAAM,WAAA,GAAAN,OAAA;AAEpC,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 +1,165 @@
1
+ "use strict";
2
+
3
+ var _react = require("react");
4
+ var _reactNative = require("@testing-library/react-native");
5
+ var _index = require("../../theme/index.js");
6
+ var _Select = require("./Select.js");
7
+ var _Dialog = require("../Dialog/Dialog.js");
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ function wrap(ui) {
10
+ return (0, _reactNative.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ThemeProvider, {
11
+ children: ui
12
+ }));
13
+ }
14
+ const OPTIONS = [{
15
+ key: 'dine-in',
16
+ label: 'Dine in'
17
+ }, {
18
+ key: 'take-out',
19
+ label: 'Take out'
20
+ }, {
21
+ key: 'delivery',
22
+ label: 'Delivery'
23
+ }];
24
+ describe('Select (single)', () => {
25
+ it('shows the placeholder when empty', () => {
26
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
27
+ options: OPTIONS,
28
+ placeholder: "Select option"
29
+ }));
30
+ expect(_reactNative.screen.getByText('Select option')).toBeTruthy();
31
+ });
32
+ it('shows the selected label', () => {
33
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
34
+ options: OPTIONS,
35
+ value: "take-out"
36
+ }));
37
+ expect(_reactNative.screen.getByText('Take out')).toBeTruthy();
38
+ });
39
+ it('opens, selects an option, calls onChange and closes', () => {
40
+ const onChange = jest.fn();
41
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
42
+ options: OPTIONS,
43
+ placeholder: "Select option",
44
+ onChange: onChange
45
+ }));
46
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Select option'));
47
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Delivery'));
48
+ expect(onChange).toHaveBeenCalledWith('delivery');
49
+ // Menu closed → the other option is gone.
50
+ expect(_reactNative.screen.queryByText('Take out')).toBeNull();
51
+ });
52
+ it('renders the error message', () => {
53
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
54
+ options: OPTIONS,
55
+ error: "Required"
56
+ }));
57
+ expect(_reactNative.screen.getByText('Required')).toBeTruthy();
58
+ });
59
+ it('does not open when disabled', () => {
60
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
61
+ options: OPTIONS,
62
+ placeholder: "Select option",
63
+ disabled: true
64
+ }));
65
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Select option'));
66
+ expect(_reactNative.screen.queryByText('Delivery')).toBeNull();
67
+ });
68
+ });
69
+ describe('Select (multiple)', () => {
70
+ function MultiControlled() {
71
+ const [value, setValue] = (0, _react.useState)([]);
72
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
73
+ options: OPTIONS,
74
+ multiple: true,
75
+ value: value,
76
+ onChange: setValue,
77
+ placeholder: "Pick"
78
+ });
79
+ }
80
+ it('adds keys to the array and stays open', () => {
81
+ const onChange = jest.fn();
82
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
83
+ options: OPTIONS,
84
+ multiple: true,
85
+ value: [],
86
+ onChange: onChange,
87
+ placeholder: "Pick"
88
+ }));
89
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Pick'));
90
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Dine in'));
91
+ expect(onChange).toHaveBeenCalledWith(['dine-in']);
92
+ // Still open — other rows remain visible.
93
+ expect(_reactNative.screen.getByText('Delivery')).toBeTruthy();
94
+ });
95
+ it('toggles selected keys off', () => {
96
+ const onChange = jest.fn();
97
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
98
+ options: OPTIONS,
99
+ multiple: true,
100
+ value: ['dine-in'],
101
+ onChange: onChange,
102
+ placeholder: "Pick"
103
+ }));
104
+ // Before opening, only the trigger shows "Dine in".
105
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Dine in')); // opens the menu
106
+ // Now there are two: trigger + row. Press the row (last).
107
+ const matches = _reactNative.screen.getAllByText('Dine in');
108
+ _reactNative.fireEvent.press(matches[matches.length - 1]);
109
+ expect(onChange).toHaveBeenCalledWith([]);
110
+ });
111
+ it('joins multiple labels in the trigger', () => {
112
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
113
+ options: OPTIONS,
114
+ multiple: true,
115
+ value: ['dine-in', 'delivery']
116
+ }));
117
+ expect(_reactNative.screen.getByText('Dine in, Delivery')).toBeTruthy();
118
+ });
119
+ it('reflects new picks (controlled loop)', () => {
120
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(MultiControlled, {}));
121
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Pick'));
122
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Take out'));
123
+ // Menu stays open, so the label now appears on both the trigger and the row.
124
+ expect(_reactNative.screen.getAllByText('Take out').length).toBe(2);
125
+ });
126
+ });
127
+ describe('Select inside Dialog', () => {
128
+ function DialogWithSelect() {
129
+ const [value, setValue] = (0, _react.useState)('dine-in');
130
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.Dialog, {
131
+ visible: true,
132
+ onClose: () => {},
133
+ title: "Order",
134
+ actions: [{
135
+ label: 'Save'
136
+ }],
137
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.Select, {
138
+ options: OPTIONS,
139
+ label: "Order type",
140
+ value: value,
141
+ onChange: setValue
142
+ })
143
+ });
144
+ }
145
+ it('opens the select menu over the dialog without closing it', () => {
146
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(DialogWithSelect, {}));
147
+ // Dialog is visible.
148
+ expect(_reactNative.screen.getByText('Order')).toBeTruthy();
149
+ // Open the select (trigger shows "Dine in").
150
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Dine in'));
151
+ // Menu rows appear...
152
+ expect(_reactNative.screen.getByText('Delivery')).toBeTruthy();
153
+ // ...and the dialog is still there.
154
+ expect(_reactNative.screen.getByText('Order')).toBeTruthy();
155
+ });
156
+ it('selecting in the menu updates the field and keeps the dialog open', () => {
157
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(DialogWithSelect, {}));
158
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Dine in'));
159
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Delivery'));
160
+ // Field now shows Delivery; dialog title still present.
161
+ expect(_reactNative.screen.getByText('Delivery')).toBeTruthy();
162
+ expect(_reactNative.screen.getByText('Order')).toBeTruthy();
163
+ });
164
+ });
165
+ //# sourceMappingURL=Select.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_index","_Select","_Dialog","_jsxRuntime","wrap","ui","render","jsx","ThemeProvider","children","OPTIONS","key","label","describe","it","Select","options","placeholder","expect","screen","getByText","toBeTruthy","value","onChange","jest","fn","fireEvent","press","toHaveBeenCalledWith","queryByText","toBeNull","error","disabled","MultiControlled","setValue","useState","multiple","matches","getAllByText","length","toBe","DialogWithSelect","Dialog","visible","onClose","title","actions"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/Select/Select.test.tsx"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAA0C,IAAAK,WAAA,GAAAL,OAAA;AAE1C,SAASM,IAAIA,CAACC,EAAsB,EAAE;EACpC,OAAO,IAAAC,mBAAM,eAAC,IAAAH,WAAA,CAAAI,GAAA,EAACP,MAAA,CAAAQ,aAAa;IAAAC,QAAA,EAAEJ;EAAE,CAAgB,CAAC,CAAC;AACpD;AAEA,MAAMK,OAAuB,GAAG,CAC9B;EAAEC,GAAG,EAAE,SAAS;EAAEC,KAAK,EAAE;AAAU,CAAC,EACpC;EAAED,GAAG,EAAE,UAAU;EAAEC,KAAK,EAAE;AAAW,CAAC,EACtC;EAAED,GAAG,EAAE,UAAU;EAAEC,KAAK,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C,0DAA0D,EAAE,MAAM;IACnEV,IAAI,cAAC,IAAAD,WAAA,CAAAI,GAAA,EAACkC,gBAAgB,IAAE,CAAC,CAAC;IAC1B;IACAvB,MAAM,CAACC,mBAAM,CAACC,SAAS,CAAC,OAAO,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC;IAC9C;IACAK,sBAAS,CAACC,KAAK,CAACR,mBAAM,CAACC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5C;IACAF,MAAM,CAACC,mBAAM,CAACC,SAAS,CAAC,UAAU,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC;IACjD;IACAH,MAAM,CAACC,mBAAM,CAACC,SAAS,CAAC,OAAO,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC;EAChD,CAAC,CAAC;EAEFP,EAAE,CAAC,mEAAmE,EAAE,MAAM;IAC5EV,IAAI,cAAC,IAAAD,WAAA,CAAAI,GAAA,EAACkC,gBAAgB,IAAE,CAAC,CAAC;IAC1Bf,sBAAS,CAACC,KAAK,CAACR,mBAAM,CAACC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5CM,sBAAS,CAACC,KAAK,CAACR,mBAAM,CAACC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C;IACAF,MAAM,CAACC,mBAAM,CAACC,SAAS,CAAC,UAAU,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC;IACjDH,MAAM,CAACC,mBAAM,CAACC,SAAS,CAAC,OAAO,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC;EAChD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Select", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Select.Select;
10
+ }
11
+ });
12
+ var _Select = require("./Select.js");
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Select","require"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/Select/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UserChip = UserChip;
7
+ var _reactNative = require("react-native");
8
+ var _index = require("../../theme/index.js");
9
+ var _Avatar = require("../Avatar/Avatar.js");
10
+ var _Text = require("../Text/Text.js");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ /**
13
+ * Per-size config. `width` is the fixed total pill width (the chip never grows or
14
+ * shrinks with the text — long names truncate). Avatar diameter equals the pill
15
+ * height, so it sits flush in the left circle.
16
+ */
17
+ const SIZES = {
18
+ sm: {
19
+ diameter: 40,
20
+ gap: 8,
21
+ paddingRight: 16,
22
+ width: 160,
23
+ textVariant: 'bodyMedium'
24
+ },
25
+ md: {
26
+ diameter: 48,
27
+ gap: 10,
28
+ paddingRight: 20,
29
+ width: 188,
30
+ textVariant: 'bodyLarge'
31
+ },
32
+ lg: {
33
+ diameter: 58,
34
+ gap: 12,
35
+ paddingRight: 24,
36
+ width: 212,
37
+ textVariant: 'bodyLarge'
38
+ }
39
+ };
40
+
41
+ /**
42
+ * User chip — an `Avatar` with an optional name. With a `name` it renders the
43
+ * lime pill from Figma "User": the avatar flush on the left and the name in a
44
+ * fixed-width box that is centered when short and truncates with an ellipsis when
45
+ * long. Without a `name` it is just the avatar. The pill width is fixed per size.
46
+ */
47
+ function UserChip({
48
+ source,
49
+ name,
50
+ initials,
51
+ size = 'md',
52
+ backgroundColor,
53
+ color,
54
+ onPress,
55
+ style,
56
+ accessibilityLabel
57
+ }) {
58
+ const theme = (0, _index.useTheme)();
59
+ const cfg = SIZES[size];
60
+ const hasName = Boolean(name && name.trim());
61
+ const avatar = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.Avatar, {
62
+ source: source,
63
+ name: name,
64
+ initials: initials,
65
+ diameter: cfg.diameter,
66
+ accessibilityLabel: accessibilityLabel ?? name
67
+ });
68
+
69
+ // No name → just the avatar, exactly like using <Avatar> directly.
70
+ if (!hasName) {
71
+ if (!onPress) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
72
+ style: style,
73
+ children: avatar
74
+ });
75
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
76
+ onPress: onPress,
77
+ accessibilityRole: "button",
78
+ accessibilityLabel: accessibilityLabel,
79
+ style: style,
80
+ children: avatar
81
+ });
82
+ }
83
+ const pillStyle = {
84
+ flexDirection: 'row',
85
+ alignItems: 'center',
86
+ gap: cfg.gap,
87
+ width: cfg.width,
88
+ height: cfg.diameter,
89
+ borderRadius: cfg.diameter / 2,
90
+ paddingRight: cfg.paddingRight,
91
+ backgroundColor: backgroundColor ?? theme.colors.action.primary
92
+ };
93
+ const inner = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
94
+ children: [avatar, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
95
+ variant: cfg.textVariant,
96
+ weight: "medium",
97
+ align: "center",
98
+ color: color ?? theme.colors.action.secondaryForeground,
99
+ numberOfLines: 1,
100
+ style: {
101
+ flex: 1
102
+ },
103
+ children: name
104
+ })]
105
+ });
106
+ if (!onPress) {
107
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
108
+ accessibilityLabel: accessibilityLabel ?? name,
109
+ style: [pillStyle, style],
110
+ children: inner
111
+ });
112
+ }
113
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
114
+ onPress: onPress,
115
+ accessibilityRole: "button",
116
+ accessibilityLabel: accessibilityLabel ?? name,
117
+ style: [pillStyle, style],
118
+ children: inner
119
+ });
120
+ }
121
+ //# sourceMappingURL=UserChip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_index","_Avatar","_Text","_jsxRuntime","SIZES","sm","diameter","gap","paddingRight","width","textVariant","md","lg","UserChip","source","name","initials","size","backgroundColor","color","onPress","style","accessibilityLabel","theme","useTheme","cfg","hasName","Boolean","trim","avatar","jsx","Avatar","View","children","Pressable","accessibilityRole","pillStyle","flexDirection","alignItems","height","borderRadius","colors","action","primary","inner","jsxs","Fragment","Text","variant","weight","align","secondaryForeground","numberOfLines","flex"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/UserChip/UserChip.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAAoC,IAAAI,WAAA,GAAAJ,OAAA;AA4BpC;AACA;AACA;AACA;AACA;AACA,MAAMK,KAGL,GAAG;EACFC,EAAE,EAAE;IAAEC,QAAQ,EAAE,EAAE;IAAEC,GAAG,EAAE,CAAC;IAAEC,YAAY,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,WAAW,EAAE;EAAa,CAAC;EACrFC,EAAE,EAAE;IAAEL,QAAQ,EAAE,EAAE;IAAEC,GAAG,EAAE,EAAE;IAAEC,YAAY,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,WAAW,EAAE;EAAY,CAAC;EACrFE,EAAE,EAAE;IAAEN,QAAQ,EAAE,EAAE;IAAEC,GAAG,EAAE,EAAE;IAAEC,YAAY,EAAE,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,WAAW,EAAE;EAAY;AACtF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,QAAQA,CAAC;EACvBC,MAAM;EACNC,IAAI;EACJC,QAAQ;EACRC,IAAI,GAAG,IAAI;EACXC,eAAe;EACfC,KAAK;EACLC,OAAO;EACPC,KAAK;EACLC;AACa,CAAC,EAAE;EAChB,MAAMC,KAAK,GAAG,IAAAC,eAAQ,EAAC,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