@coinbase/cds-mobile 8.25.0 → 8.26.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 (77) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dts/alpha/select/DefaultSelectControl.d.ts +2 -8
  3. package/dts/alpha/select/DefaultSelectControl.d.ts.map +1 -1
  4. package/dts/alpha/select/DefaultSelectDropdown.d.ts.map +1 -1
  5. package/dts/alpha/select/DefaultSelectOptionGroup.d.ts +8 -0
  6. package/dts/alpha/select/DefaultSelectOptionGroup.d.ts.map +1 -0
  7. package/dts/alpha/select/Select.d.ts +23 -366
  8. package/dts/alpha/select/Select.d.ts.map +1 -1
  9. package/dts/alpha/select/index.d.ts +2 -0
  10. package/dts/alpha/select/index.d.ts.map +1 -1
  11. package/dts/alpha/select/types.d.ts +486 -0
  12. package/dts/alpha/select/types.d.ts.map +1 -0
  13. package/dts/alpha/select-chip/SelectChip.d.ts +26 -0
  14. package/dts/alpha/select-chip/SelectChip.d.ts.map +1 -0
  15. package/dts/alpha/select-chip/SelectChipControl.d.ts +14 -0
  16. package/dts/alpha/select-chip/SelectChipControl.d.ts.map +1 -0
  17. package/dts/alpha/select-chip/index.d.ts +3 -0
  18. package/dts/alpha/select-chip/index.d.ts.map +1 -0
  19. package/dts/chips/Chip.d.ts.map +1 -1
  20. package/dts/chips/SelectChip.d.ts +8 -0
  21. package/dts/chips/SelectChip.d.ts.map +1 -1
  22. package/dts/examples/ExampleScreen.d.ts +26 -1
  23. package/dts/examples/ExampleScreen.d.ts.map +1 -1
  24. package/esm/alpha/select/DefaultSelectControl.js +46 -8
  25. package/esm/alpha/select/DefaultSelectDropdown.js +100 -31
  26. package/esm/alpha/select/DefaultSelectOption.js +1 -1
  27. package/esm/alpha/select/DefaultSelectOptionGroup.js +90 -0
  28. package/esm/alpha/select/Select.js +10 -26
  29. package/esm/alpha/select/index.js +3 -1
  30. package/esm/alpha/select/types.js +50 -0
  31. package/esm/alpha/select-chip/SelectChip.js +31 -0
  32. package/esm/alpha/select-chip/SelectChipControl.js +111 -0
  33. package/esm/alpha/select-chip/__stories__/SelectChip.stories.js +538 -0
  34. package/esm/alpha/select-chip/index.js +2 -0
  35. package/esm/banner/__stories__/Banner.stories.js +133 -294
  36. package/esm/banner/__stories__/BannerActions.stories.js +276 -0
  37. package/esm/banner/__stories__/BannerLayout.stories.js +329 -0
  38. package/esm/cells/__stories__/ListCell.stories.js +1 -17
  39. package/esm/cells/__stories__/ListCellFallback.stories.js +1 -0
  40. package/esm/chips/Chip.js +4 -1
  41. package/esm/chips/SelectChip.js +9 -0
  42. package/esm/examples/ExampleScreen.js +79 -58
  43. package/esm/icons/__stories__/IconSheet.js +35 -13
  44. package/esm/illustrations/__stories__/HeroSquare.stories.js +70 -2
  45. package/esm/illustrations/__stories__/Pictogram.stories.js +70 -2
  46. package/esm/illustrations/__stories__/SpotIcon.stories.js +70 -2
  47. package/esm/illustrations/__stories__/SpotRectangle.stories.js +68 -2
  48. package/esm/illustrations/__stories__/SpotSquare.stories.js +68 -2
  49. package/esm/media/__stories__/CarouselMedia.stories.js +2 -5
  50. package/esm/numpad/__stories__/Numpad.stories.js +8 -5
  51. package/esm/page/__stories__/PageFooter.stories.js +5 -4
  52. package/esm/page/__stories__/PageFooterInPage.stories.js +20 -19
  53. package/esm/page/__stories__/PageHeader.stories.js +4 -4
  54. package/esm/page/__stories__/PageHeaderInErrorEmptyState.stories.js +6 -4
  55. package/esm/page/__stories__/PageHeaderInPage.stories.js +20 -18
  56. package/esm/section-header/__stories__/SectionHeader.stories.js +4 -4
  57. package/esm/sticky-footer/__stories__/StickyFooter.stories.js +6 -8
  58. package/esm/tour/__stories__/Tour.stories.js +13 -166
  59. package/esm/typography/__stories__/TextBody.stories.js +2 -0
  60. package/esm/typography/__stories__/TextCaption.stories.js +2 -0
  61. package/esm/typography/__stories__/TextCore.stories.js +2 -0
  62. package/esm/typography/__stories__/TextDisplay1.stories.js +2 -0
  63. package/esm/typography/__stories__/TextDisplay2.stories.js +2 -0
  64. package/esm/typography/__stories__/TextDisplay3.stories.js +2 -0
  65. package/esm/typography/__stories__/TextHeadline.stories.js +2 -0
  66. package/esm/typography/__stories__/TextLabel1.stories.js +2 -0
  67. package/esm/typography/__stories__/TextLabel2.stories.js +2 -0
  68. package/esm/typography/__stories__/TextLegal.stories.js +2 -0
  69. package/esm/typography/__stories__/TextTitle1.stories.js +2 -0
  70. package/esm/typography/__stories__/TextTitle2.stories.js +2 -0
  71. package/esm/typography/__stories__/TextTitle3.stories.js +2 -0
  72. package/esm/typography/__stories__/TextTitle4.stories.js +2 -0
  73. package/package.json +2 -2
  74. package/esm/icons/__stories__/Icon.stories.js +0 -98
  75. package/esm/illustrations/__stories__/getIllustrationSheet.js +0 -164
  76. /package/esm/alpha/select/__stories__/{Select.stories.js → AlphaSelect.stories.js} +0 -0
  77. /package/esm/alpha/tabbed-chips/__stories__/{TabbedChips.stories.js → AlphaTabbedChips.stories.js} +0 -0
@@ -0,0 +1,111 @@
1
+ import React, { forwardRef, memo, useMemo } from 'react';
2
+ import { MediaChip } from '../../chips/MediaChip';
3
+ import { AnimatedCaret } from '../../motion/AnimatedCaret';
4
+ import { isSelectOptionGroup } from '../select/types';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const SelectChipControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
7
+ let {
8
+ type,
9
+ options,
10
+ value,
11
+ placeholder,
12
+ setOpen,
13
+ startNode,
14
+ endNode: customEndNode,
15
+ open,
16
+ accessibilityLabel,
17
+ accessibilityHint,
18
+ disabled,
19
+ maxSelectedOptionsToShow = 2,
20
+ hiddenSelectedOptionsLabel = 'more',
21
+ label,
22
+ compact,
23
+ invertColorScheme,
24
+ numberOfLines
25
+ } = _ref;
26
+ const isMultiSelect = type === 'multi';
27
+ const hasValue = value !== null && !(Array.isArray(value) && value.length === 0);
28
+
29
+ // Map of options to their values
30
+ // If multiple options share the same value, the first occurrence wins (matches native HTML select behavior)
31
+ const optionsMap = useMemo(() => {
32
+ const map = new Map();
33
+ const isDev = process.env.NODE_ENV !== 'production';
34
+ options.forEach((option, optionIndex) => {
35
+ if (isSelectOptionGroup(option)) {
36
+ option.options.forEach((groupOption, groupOptionIndex) => {
37
+ if (groupOption.value !== null) {
38
+ const optionValue = groupOption.value;
39
+ // Only set if not already present (first wins)
40
+ if (!map.has(optionValue)) {
41
+ map.set(optionValue, groupOption);
42
+ } else if (isDev) {
43
+ console.warn("[Select] Duplicate option value detected: \"" + optionValue + "\". " + "The first occurrence will be used for display. " + ("Found duplicate in group \"" + option.label + "\" at index " + groupOptionIndex + ". ") + ("First occurrence was at option index " + optionIndex + "."));
44
+ }
45
+ }
46
+ });
47
+ } else {
48
+ const singleOption = option;
49
+ if (singleOption.value !== null) {
50
+ const optionValue = singleOption.value;
51
+ // Only set if not already present (first wins)
52
+ if (!map.has(optionValue)) {
53
+ map.set(optionValue, singleOption);
54
+ } else if (isDev) {
55
+ var _ref2, _existingOption$label;
56
+ const existingOption = map.get(optionValue);
57
+ console.warn("[Select] Duplicate option value detected: \"" + optionValue + "\". " + "The first occurrence will be used for display. " + ("Found duplicate at option index " + optionIndex + ". ") + ("First occurrence label: \"" + ((_ref2 = (_existingOption$label = existingOption == null ? void 0 : existingOption.label) != null ? _existingOption$label : existingOption == null ? void 0 : existingOption.value) != null ? _ref2 : 'unknown') + "\"."));
58
+ }
59
+ }
60
+ }
61
+ });
62
+ return map;
63
+ }, [options]);
64
+ const labelContent = useMemo(() => {
65
+ var _ref3, _ref6, _ref7, _ref8, _opt$label2;
66
+ if (!hasValue) return (_ref3 = label != null ? label : placeholder) != null ? _ref3 : null;
67
+ if (isMultiSelect) {
68
+ const values = value;
69
+ const visible = values.slice(0, maxSelectedOptionsToShow);
70
+ const labels = visible.map(v => {
71
+ var _ref4, _ref5, _opt$label;
72
+ const opt = optionsMap.get(v);
73
+ return (_ref4 = (_ref5 = (_opt$label = opt == null ? void 0 : opt.label) != null ? _opt$label : opt == null ? void 0 : opt.description) != null ? _ref5 : opt == null ? void 0 : opt.value) != null ? _ref4 : '';
74
+ }).filter(Boolean);
75
+ const hiddenCount = values.length - visible.length;
76
+ return hiddenCount > 0 ? labels.join(', ') + " +" + hiddenCount + " " + hiddenSelectedOptionsLabel : labels.join(', ');
77
+ }
78
+ const opt = optionsMap.get(value);
79
+ return (_ref6 = (_ref7 = (_ref8 = (_opt$label2 = opt == null ? void 0 : opt.label) != null ? _opt$label2 : opt == null ? void 0 : opt.description) != null ? _ref8 : opt == null ? void 0 : opt.value) != null ? _ref7 : placeholder) != null ? _ref6 : null;
80
+ }, [hasValue, label, placeholder, isMultiSelect, optionsMap, value, maxSelectedOptionsToShow, hiddenSelectedOptionsLabel]);
81
+ const endNode = useMemo(() => {
82
+ return customEndNode != null ? customEndNode : /*#__PURE__*/_jsx(AnimatedCaret, {
83
+ active: true,
84
+ color: hasValue ? 'fgInverse' : 'fg',
85
+ rotate: open ? 0 : 180,
86
+ size: "xs"
87
+ });
88
+ }, [customEndNode, open, hasValue]);
89
+ const color = useMemo(() => {
90
+ return hasValue ? 'fgInverse' : 'fg';
91
+ }, [hasValue]);
92
+ const background = useMemo(() => {
93
+ return hasValue ? 'bgInverse' : 'bgSecondary';
94
+ }, [hasValue]);
95
+ return /*#__PURE__*/_jsx(MediaChip, {
96
+ ref: ref,
97
+ accessibilityHint: accessibilityHint,
98
+ accessibilityLabel: accessibilityLabel,
99
+ background: background,
100
+ color: color,
101
+ compact: compact,
102
+ disabled: disabled,
103
+ end: endNode,
104
+ invertColorScheme: invertColorScheme,
105
+ numberOfLines: numberOfLines,
106
+ onPress: () => setOpen(s => !s),
107
+ start: startNode,
108
+ children: labelContent
109
+ });
110
+ }));
111
+ export const SelectChipControl = SelectChipControlComponent;
@@ -0,0 +1,538 @@
1
+ import { useState } from 'react';
2
+ import { assets } from '@coinbase/cds-common/internal/data/assets';
3
+ import { useMultiSelect } from '@coinbase/cds-common/select/useMultiSelect';
4
+ import { Example, ExampleScreen } from '../../../examples/ExampleScreen';
5
+ import { HStack } from '../../../layout/HStack';
6
+ import { VStack } from '../../../layout/VStack';
7
+ import { RemoteImage } from '../../../media';
8
+ import { Text } from '../../../typography/Text';
9
+ import { SelectChip } from '../SelectChip';
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ export const DefaultSingle = () => {
12
+ const exampleOptions = [{
13
+ value: null,
14
+ label: 'Clear selection'
15
+ }, {
16
+ value: '1',
17
+ label: 'Option 1'
18
+ }, {
19
+ value: '2',
20
+ label: 'Option 2'
21
+ }, {
22
+ value: '3',
23
+ label: 'Option 3'
24
+ }, {
25
+ value: '4',
26
+ label: 'Option 4'
27
+ }];
28
+ const [value, setValue] = useState(null);
29
+ return /*#__PURE__*/_jsx(SelectChip, {
30
+ accessibilityLabel: "Select a value",
31
+ label: "Select a value",
32
+ onChange: setValue,
33
+ options: exampleOptions,
34
+ placeholder: "Choose an option",
35
+ value: value
36
+ });
37
+ };
38
+ export const DefaultMulti = () => {
39
+ const exampleOptions = [{
40
+ value: '1',
41
+ label: 'Option 1'
42
+ }, {
43
+ value: '2',
44
+ label: 'Option 2'
45
+ }, {
46
+ value: '3',
47
+ label: 'Option 3'
48
+ }, {
49
+ value: '4',
50
+ label: 'Option 4'
51
+ }, {
52
+ value: '5',
53
+ label: 'Option 5'
54
+ }];
55
+ const {
56
+ value,
57
+ onChange
58
+ } = useMultiSelect({
59
+ initialValue: []
60
+ });
61
+ return /*#__PURE__*/_jsx(SelectChip, {
62
+ accessibilityLabel: "Select multiple values",
63
+ label: "Select multiple values",
64
+ onChange: onChange,
65
+ options: exampleOptions,
66
+ placeholder: "Choose options",
67
+ type: "multi",
68
+ value: value
69
+ });
70
+ };
71
+ export const Compact = () => {
72
+ const exampleOptions = [{
73
+ value: '1',
74
+ label: 'Option 1'
75
+ }, {
76
+ value: '2',
77
+ label: 'Option 2'
78
+ }, {
79
+ value: '3',
80
+ label: 'Option 3'
81
+ }, {
82
+ value: '4',
83
+ label: 'Option 4'
84
+ }];
85
+ const [value, setValue] = useState('1');
86
+ return /*#__PURE__*/_jsx(SelectChip, {
87
+ compact: true,
88
+ onChange: setValue,
89
+ options: exampleOptions,
90
+ placeholder: "Choose an option",
91
+ value: value
92
+ });
93
+ };
94
+ export const WithStartEndNodes = () => {
95
+ const exampleOptions = [{
96
+ value: 'btc',
97
+ label: assets.btc.name
98
+ }, {
99
+ value: 'eth',
100
+ label: assets.eth.name
101
+ }, {
102
+ value: 'dai',
103
+ label: assets.dai.name
104
+ }];
105
+ const [value, setValue] = useState('eth');
106
+
107
+ // Map each option value to a different asset
108
+ const getStartNode = selectedValue => {
109
+ if (!selectedValue) return null;
110
+ const assetMap = {
111
+ btc: assets.btc.imageUrl,
112
+ eth: assets.eth.imageUrl,
113
+ dai: assets.dai.imageUrl
114
+ };
115
+ const imageUrl = assetMap[selectedValue];
116
+ if (!imageUrl) return null;
117
+ return /*#__PURE__*/_jsx(RemoteImage, {
118
+ height: 24,
119
+ shape: "circle",
120
+ source: imageUrl,
121
+ width: 24
122
+ });
123
+ };
124
+ return /*#__PURE__*/_jsx(SelectChip, {
125
+ onChange: setValue,
126
+ options: exampleOptions,
127
+ placeholder: "Choose an asset",
128
+ startNode: getStartNode(value),
129
+ value: value
130
+ });
131
+ };
132
+
133
+ // Map asset symbols to their image URLs
134
+ const assetImageMap = {
135
+ btc: assets.btc.imageUrl,
136
+ eth: assets.eth.imageUrl,
137
+ dai: assets.dai.imageUrl,
138
+ ltc: assets.ltc.imageUrl,
139
+ xrp: assets.xrp.imageUrl
140
+ };
141
+
142
+ // TODO: Add multi-select with assets story when RemoteImageGroup is fixed
143
+ // export const MultiSelectWithAssets = () => {
144
+ // const exampleOptions = [
145
+ // { value: 'btc', label: assets.btc.name },
146
+ // { value: 'eth', label: assets.eth.name },
147
+ // { value: 'dai', label: assets.dai.name },
148
+ // { value: 'ltc', label: assets.ltc.name },
149
+ // { value: 'xrp', label: assets.xrp.name },
150
+ // ];
151
+ // const { value, onChange } = useMultiSelect({
152
+ // initialValue: ['eth', 'btc'],
153
+ // });
154
+
155
+ // // Get startNode based on selected assets
156
+ // const startNode = useMemo(() => {
157
+ // if (value.length === 0) return null;
158
+
159
+ // // Multiple assets selected - use RemoteImageGroup
160
+ // return (
161
+ // <RemoteImageGroup shape="circle" size={24}>
162
+ // {value.map((assetValue) => {
163
+ // const imageUrl = assetImageMap[assetValue];
164
+ // if (!imageUrl) return null;
165
+ // return <RemoteImage key={assetValue} source={imageUrl} />;
166
+ // })}
167
+ // </RemoteImageGroup>
168
+ // );
169
+ // }, [value]);
170
+
171
+ // return (
172
+ // <SelectChip
173
+ // accessibilityLabel="Select multiple assets"
174
+ // onChange={onChange}
175
+ // options={exampleOptions}
176
+ // placeholder="Choose assets"
177
+ // startNode={startNode}
178
+ // type="multi"
179
+ // value={value}
180
+ // />
181
+ // );
182
+ // };
183
+
184
+ export const InvertColorScheme = () => {
185
+ const exampleOptions = [{
186
+ value: '1',
187
+ label: 'Option 1'
188
+ }, {
189
+ value: '2',
190
+ label: 'Option 2'
191
+ }];
192
+ const [value, setValue] = useState('1');
193
+ return /*#__PURE__*/_jsx(VStack, {
194
+ background: "bgAlternate",
195
+ borderRadius: 200,
196
+ padding: 2,
197
+ children: /*#__PURE__*/_jsx(SelectChip, {
198
+ invertColorScheme: true,
199
+ onChange: setValue,
200
+ options: exampleOptions,
201
+ placeholder: "Choose an option",
202
+ value: value
203
+ })
204
+ });
205
+ };
206
+ export const EmptyOptions = () => {
207
+ const [value, setValue] = useState(null);
208
+ return /*#__PURE__*/_jsx(SelectChip, {
209
+ onChange: setValue,
210
+ options: [],
211
+ placeholder: "No options available",
212
+ value: value
213
+ });
214
+ };
215
+ export const WithGroups = () => {
216
+ const exampleOptions = [{
217
+ label: 'Group A',
218
+ options: [{
219
+ value: '1',
220
+ label: 'Option 1'
221
+ }, {
222
+ value: '2',
223
+ label: 'Option 2'
224
+ }, {
225
+ value: '3',
226
+ label: 'Option 3'
227
+ }]
228
+ }, {
229
+ label: 'Group B',
230
+ options: [{
231
+ value: '4',
232
+ label: 'Option 4'
233
+ }, {
234
+ value: '5',
235
+ label: 'Option 5'
236
+ }]
237
+ }, {
238
+ label: 'Group C',
239
+ options: [{
240
+ value: '6',
241
+ label: 'Option 6'
242
+ }]
243
+ }];
244
+ const [value, setValue] = useState(null);
245
+ return /*#__PURE__*/_jsx(SelectChip, {
246
+ accessibilityLabel: "Select a value",
247
+ onChange: setValue,
248
+ options: exampleOptions,
249
+ placeholder: "Choose an option",
250
+ value: value
251
+ });
252
+ };
253
+ export const MultiWithGroups = () => {
254
+ const exampleOptions = [{
255
+ label: 'Group A',
256
+ options: [{
257
+ value: '1',
258
+ label: 'Option 1'
259
+ }, {
260
+ value: '2',
261
+ label: 'Option 2'
262
+ }, {
263
+ value: '3',
264
+ label: 'Option 3'
265
+ }]
266
+ }, {
267
+ label: 'Group B',
268
+ options: [{
269
+ value: '4',
270
+ label: 'Option 4'
271
+ }, {
272
+ value: '5',
273
+ label: 'Option 5'
274
+ }]
275
+ }, {
276
+ label: 'Group C',
277
+ options: [{
278
+ value: '6',
279
+ label: 'Option 6'
280
+ }]
281
+ }];
282
+ const {
283
+ value,
284
+ onChange
285
+ } = useMultiSelect({
286
+ initialValue: []
287
+ });
288
+ return /*#__PURE__*/_jsx(SelectChip, {
289
+ accessibilityLabel: "Select multiple values",
290
+ onChange: onChange,
291
+ options: exampleOptions,
292
+ placeholder: "Choose options",
293
+ type: "multi",
294
+ value: value
295
+ });
296
+ };
297
+ export const WithDisabledGroup = () => {
298
+ const exampleOptions = [{
299
+ label: 'Available Options',
300
+ options: [{
301
+ value: '1',
302
+ label: 'Option 1'
303
+ }, {
304
+ value: '2',
305
+ label: 'Option 2'
306
+ }, {
307
+ value: '3',
308
+ label: 'Option 3'
309
+ }]
310
+ }, {
311
+ label: 'Unavailable Options (Group Disabled)',
312
+ disabled: true,
313
+ options: [{
314
+ value: '4',
315
+ label: 'Option 4'
316
+ }, {
317
+ value: '5',
318
+ label: 'Option 5'
319
+ }, {
320
+ value: '6',
321
+ label: 'Option 6'
322
+ }]
323
+ }, {
324
+ label: 'More Available Options',
325
+ options: [{
326
+ value: '7',
327
+ label: 'Option 7'
328
+ }, {
329
+ value: '8',
330
+ label: 'Option 8'
331
+ }]
332
+ }];
333
+ const [value, setValue] = useState(null);
334
+ return /*#__PURE__*/_jsx(SelectChip, {
335
+ accessibilityLabel: "Select a value",
336
+ onChange: setValue,
337
+ options: exampleOptions,
338
+ placeholder: "Choose an option",
339
+ value: value
340
+ });
341
+ };
342
+ export const MultiWithDisabledGroup = () => {
343
+ const exampleOptions = [{
344
+ label: 'Available Options',
345
+ options: [{
346
+ value: '1',
347
+ label: 'Option 1'
348
+ }, {
349
+ value: '2',
350
+ label: 'Option 2'
351
+ }, {
352
+ value: '3',
353
+ label: 'Option 3'
354
+ }]
355
+ }, {
356
+ label: 'Unavailable Options (Group Disabled)',
357
+ disabled: true,
358
+ options: [{
359
+ value: '4',
360
+ label: 'Option 4'
361
+ }, {
362
+ value: '5',
363
+ label: 'Option 5'
364
+ }, {
365
+ value: '6',
366
+ label: 'Option 6'
367
+ }]
368
+ }, {
369
+ label: 'More Available Options',
370
+ options: [{
371
+ value: '7',
372
+ label: 'Option 7'
373
+ }, {
374
+ value: '8',
375
+ label: 'Option 8'
376
+ }]
377
+ }];
378
+ const {
379
+ value,
380
+ onChange
381
+ } = useMultiSelect({
382
+ initialValue: []
383
+ });
384
+ return /*#__PURE__*/_jsx(SelectChip, {
385
+ accessibilityLabel: "Select multiple values",
386
+ onChange: onChange,
387
+ options: exampleOptions,
388
+ placeholder: "Choose options",
389
+ type: "multi",
390
+ value: value
391
+ });
392
+ };
393
+ export const FullyDisabled = () => {
394
+ const exampleOptions = [{
395
+ value: '1',
396
+ label: 'Option 1'
397
+ }, {
398
+ value: '2',
399
+ label: 'Option 2'
400
+ }, {
401
+ value: '3',
402
+ label: 'Option 3'
403
+ }, {
404
+ value: '4',
405
+ label: 'Option 4'
406
+ }];
407
+ const [value, setValue] = useState('1');
408
+ return /*#__PURE__*/_jsxs(VStack, {
409
+ gap: 2,
410
+ children: [/*#__PURE__*/_jsx(Text, {
411
+ children: "Disabled select chip:"
412
+ }), /*#__PURE__*/_jsxs(HStack, {
413
+ gap: 2,
414
+ children: [/*#__PURE__*/_jsx(SelectChip, {
415
+ disabled: true,
416
+ accessibilityLabel: "Select a value",
417
+ onChange: setValue,
418
+ options: exampleOptions,
419
+ placeholder: "Choose an option",
420
+ value: null
421
+ }), /*#__PURE__*/_jsx(SelectChip, {
422
+ disabled: true,
423
+ accessibilityLabel: "Select a value",
424
+ onChange: setValue,
425
+ options: exampleOptions,
426
+ placeholder: "Choose an option",
427
+ value: value
428
+ })]
429
+ })]
430
+ });
431
+ };
432
+ export const WithDisabledOptions = () => {
433
+ const exampleOptions = [{
434
+ value: '1',
435
+ label: 'Option 1'
436
+ }, {
437
+ value: '2',
438
+ label: 'Option 2',
439
+ disabled: true
440
+ }, {
441
+ value: '3',
442
+ label: 'Option 3'
443
+ }, {
444
+ value: '4',
445
+ label: 'Option 4',
446
+ disabled: true
447
+ }];
448
+ const [value, setValue] = useState(null);
449
+ return /*#__PURE__*/_jsxs(VStack, {
450
+ gap: 2,
451
+ children: [/*#__PURE__*/_jsx(Text, {
452
+ children: "Select with disabled options:"
453
+ }), /*#__PURE__*/_jsx(SelectChip, {
454
+ accessibilityLabel: "Select a value",
455
+ onChange: setValue,
456
+ options: exampleOptions,
457
+ placeholder: "Choose an option",
458
+ value: value
459
+ })]
460
+ });
461
+ };
462
+ export const WithDescriptions = () => {
463
+ const exampleOptions = [{
464
+ value: '1',
465
+ label: 'Option 1',
466
+ description: 'First option description'
467
+ }, {
468
+ value: '2',
469
+ label: 'Option 2',
470
+ description: 'Second option description'
471
+ }, {
472
+ value: '3',
473
+ label: 'Option 3',
474
+ description: 'Third option description'
475
+ }, {
476
+ value: '4',
477
+ label: 'Option 4',
478
+ description: 'Fourth option description'
479
+ }];
480
+ const [value, setValue] = useState(null);
481
+ return /*#__PURE__*/_jsxs(VStack, {
482
+ gap: 2,
483
+ children: [/*#__PURE__*/_jsx(Text, {
484
+ children: "Select with option descriptions:"
485
+ }), /*#__PURE__*/_jsx(SelectChip, {
486
+ accessibilityLabel: "Select a value",
487
+ onChange: setValue,
488
+ options: exampleOptions,
489
+ placeholder: "Choose an option",
490
+ value: value
491
+ })]
492
+ });
493
+ };
494
+ const SelectChipScreen = () => {
495
+ return /*#__PURE__*/_jsxs(ExampleScreen, {
496
+ children: [/*#__PURE__*/_jsx(Example, {
497
+ title: "Default",
498
+ children: /*#__PURE__*/_jsx(DefaultSingle, {})
499
+ }), /*#__PURE__*/_jsx(Example, {
500
+ title: "Default Multi",
501
+ children: /*#__PURE__*/_jsx(DefaultMulti, {})
502
+ }), /*#__PURE__*/_jsx(Example, {
503
+ title: "Compact",
504
+ children: /*#__PURE__*/_jsx(Compact, {})
505
+ }), /*#__PURE__*/_jsx(Example, {
506
+ title: "With Start End Nodes",
507
+ children: /*#__PURE__*/_jsx(WithStartEndNodes, {})
508
+ }), /*#__PURE__*/_jsx(Example, {
509
+ title: "Invert Color Scheme",
510
+ children: /*#__PURE__*/_jsx(InvertColorScheme, {})
511
+ }), /*#__PURE__*/_jsx(Example, {
512
+ title: "Empty Options",
513
+ children: /*#__PURE__*/_jsx(EmptyOptions, {})
514
+ }), /*#__PURE__*/_jsx(Example, {
515
+ title: "With Groups",
516
+ children: /*#__PURE__*/_jsx(WithGroups, {})
517
+ }), /*#__PURE__*/_jsx(Example, {
518
+ title: "Multi With Groups",
519
+ children: /*#__PURE__*/_jsx(MultiWithGroups, {})
520
+ }), /*#__PURE__*/_jsx(Example, {
521
+ title: "With Disabled Group",
522
+ children: /*#__PURE__*/_jsx(WithDisabledGroup, {})
523
+ }), /*#__PURE__*/_jsx(Example, {
524
+ title: "Multi With Disabled Group",
525
+ children: /*#__PURE__*/_jsx(MultiWithDisabledGroup, {})
526
+ }), /*#__PURE__*/_jsx(Example, {
527
+ title: "Fully Disabled",
528
+ children: /*#__PURE__*/_jsx(FullyDisabled, {})
529
+ }), /*#__PURE__*/_jsx(Example, {
530
+ title: "With Disabled Options",
531
+ children: /*#__PURE__*/_jsx(WithDisabledOptions, {})
532
+ }), /*#__PURE__*/_jsx(Example, {
533
+ title: "With Descriptions",
534
+ children: /*#__PURE__*/_jsx(WithDescriptions, {})
535
+ })]
536
+ });
537
+ };
538
+ export default SelectChipScreen;
@@ -0,0 +1,2 @@
1
+ export * from './SelectChip';
2
+ export * from './SelectChipControl';