@coinbase/cds-mcp-server 8.25.1 → 8.27.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.
@@ -0,0 +1,354 @@
1
+ # SelectChipAlpha
2
+
3
+ A chip-styled Select control built on top of the Alpha Select component. Supports both single and multi selection.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { SelectChip } from '@coinbase/cds-web/alpha/select-chip/SelectChip'
9
+ ```
10
+
11
+ ## Examples
12
+
13
+ SelectChip is built on top of the [Alpha Select](/components/inputs/SelectAlpha/) component. It provides a chip-styled interface while maintaining all the functionality of Select, including support for single and multi-selection, option groups, and custom components.
14
+
15
+ :::note Duplicate Values
16
+ Avoid using options with duplicate values. Each option's `value` should be unique within the options array to ensure proper selection behavior.
17
+ :::
18
+
19
+ ### Basic usage
20
+
21
+ ```jsx live
22
+ function ExampleDefault() {
23
+ const exampleOptions = [
24
+ { value: null, label: 'Clear selection' },
25
+ { value: '1', label: 'Option 1' },
26
+ { value: '2', label: 'Option 2' },
27
+ { value: '3', label: 'Option 3' },
28
+ { value: '4', label: 'Option 4' },
29
+ ];
30
+ const [value, setValue] = useState(null);
31
+ return (
32
+ <SelectChip
33
+ accessibilityLabel="Select a value"
34
+ onChange={setValue}
35
+ options={exampleOptions}
36
+ placeholder="Choose an option"
37
+ value={value}
38
+ />
39
+ );
40
+ }
41
+ ```
42
+
43
+ ### Single select with groups
44
+
45
+ ```jsx live
46
+ function ExampleSingleGroups() {
47
+ const exampleOptions = [
48
+ {
49
+ label: 'Group A',
50
+ options: [
51
+ { value: '1', label: 'Option 1' },
52
+ { value: '2', label: 'Option 2' },
53
+ { value: '3', label: 'Option 3' },
54
+ ],
55
+ },
56
+ {
57
+ label: 'Group B',
58
+ options: [
59
+ { value: '4', label: 'Option 4' },
60
+ { value: '5', label: 'Option 5' },
61
+ ],
62
+ },
63
+ {
64
+ label: 'Group C',
65
+ options: [{ value: '6', label: 'Option 6' }],
66
+ },
67
+ ];
68
+ const [value, setValue] = useState(null);
69
+ return (
70
+ <SelectChip
71
+ accessibilityLabel="Select a value"
72
+ onChange={setValue}
73
+ options={exampleOptions}
74
+ placeholder="Choose an option"
75
+ value={value}
76
+ />
77
+ );
78
+ }
79
+ ```
80
+
81
+ ### With disabled option group
82
+
83
+ ```jsx live
84
+ function ExampleDisabledGroup() {
85
+ const exampleOptions = [
86
+ {
87
+ label: 'Group A',
88
+ options: [
89
+ { value: '1', label: 'Option 1' },
90
+ { value: '2', label: 'Option 2' },
91
+ { value: '3', label: 'Option 3' },
92
+ ],
93
+ },
94
+ {
95
+ label: 'Group B',
96
+ disabled: true,
97
+ options: [
98
+ { value: '4', label: 'Option 4' },
99
+ { value: '5', label: 'Option 5' },
100
+ ],
101
+ },
102
+ {
103
+ label: 'Group C',
104
+ options: [{ value: '6', label: 'Option 6' }],
105
+ },
106
+ ];
107
+ const [value, setValue] = useState(null);
108
+ return (
109
+ <SelectChip
110
+ accessibilityLabel="Select a value"
111
+ onChange={setValue}
112
+ options={exampleOptions}
113
+ placeholder="Choose an option"
114
+ value={value}
115
+ />
116
+ );
117
+ }
118
+ ```
119
+
120
+ ### Multi-select
121
+
122
+ :::note Disabled Options and Select All
123
+ Disabled options and options inside disabled groups will be skipped when "Select all" is pressed. Only enabled options will be selected.
124
+ :::
125
+
126
+ ```jsx live
127
+ function ExampleMulti() {
128
+ const exampleOptions = [
129
+ { value: '1', label: 'Option 1' },
130
+ { value: '2', label: 'Option 2', disabled: true },
131
+ { value: '3', label: 'Option 3' },
132
+ { value: '4', label: 'Option 4' },
133
+ { value: '5', label: 'Option 5' },
134
+ ];
135
+ const { value, onChange } = useMultiSelect({ initialValue: [] });
136
+ return (
137
+ <SelectChip
138
+ controlAccessibilityLabel="Select multiple values"
139
+ onChange={onChange}
140
+ options={exampleOptions}
141
+ placeholder="Choose options"
142
+ type="multi"
143
+ value={value}
144
+ />
145
+ );
146
+ }
147
+ ```
148
+
149
+ ### Multi-select with groups
150
+
151
+ ```jsx live
152
+ function ExampleMultiGroups() {
153
+ const exampleOptions = [
154
+ {
155
+ label: 'Group A',
156
+ options: [
157
+ { value: '1', label: 'Option 1' },
158
+ { value: '2', label: 'Option 2' },
159
+ { value: '3', label: 'Option 3' },
160
+ ],
161
+ },
162
+ {
163
+ label: 'Group B',
164
+ options: [
165
+ { value: '4', label: 'Option 4' },
166
+ { value: '5', label: 'Option 5' },
167
+ ],
168
+ },
169
+ {
170
+ label: 'Group C',
171
+ options: [{ value: '6', label: 'Option 6' }],
172
+ },
173
+ ];
174
+ const { value, onChange } = useMultiSelect({ initialValue: [] });
175
+ return (
176
+ <SelectChip
177
+ controlAccessibilityLabel="Select multiple values"
178
+ onChange={onChange}
179
+ options={exampleOptions}
180
+ placeholder="Choose options"
181
+ type="multi"
182
+ value={value}
183
+ />
184
+ );
185
+ }
186
+ ```
187
+
188
+ ### Compact
189
+
190
+ ```jsx live
191
+ function ExampleCompact() {
192
+ const exampleOptions = [
193
+ { value: '1', label: 'Option 1' },
194
+ { value: '2', label: 'Option 2' },
195
+ { value: '3', label: 'Option 3' },
196
+ { value: '4', label: 'Option 4' },
197
+ ];
198
+ const [value, setValue] = useState('1');
199
+ return (
200
+ <SelectChip
201
+ compact
202
+ onChange={setValue}
203
+ options={exampleOptions}
204
+ placeholder="Choose an option"
205
+ value={value}
206
+ />
207
+ );
208
+ }
209
+ ```
210
+
211
+ ### With start and end nodes
212
+
213
+ ```jsx live
214
+ function ExampleWithNodes() {
215
+ const exampleOptions = [
216
+ { value: 'btc', label: assets.btc.name },
217
+ { value: 'eth', label: assets.eth.name },
218
+ { value: 'dai', label: assets.dai.name },
219
+ ];
220
+ const [value, setValue] = useState('eth');
221
+ const getStartNode = (selectedValue) => {
222
+ if (!selectedValue) return null;
223
+ const assetMap = {
224
+ btc: assets.btc.imageUrl,
225
+ eth: assets.eth.imageUrl,
226
+ dai: assets.dai.imageUrl,
227
+ };
228
+ const imageUrl = assetMap[selectedValue];
229
+ if (!imageUrl) return null;
230
+ return <RemoteImage height={24} shape="circle" source={imageUrl} width={24} />;
231
+ };
232
+ return (
233
+ <SelectChip
234
+ onChange={setValue}
235
+ options={exampleOptions}
236
+ placeholder="Choose an asset"
237
+ startNode={getStartNode(value)}
238
+ value={value}
239
+ />
240
+ );
241
+ }
242
+ ```
243
+
244
+ ### Empty options
245
+
246
+ ```jsx live
247
+ function ExampleEmptyOptions() {
248
+ const [value, setValue] = useState(null);
249
+ return <SelectChip onChange={setValue} options={[]} placeholder="Select ..." value={value} />;
250
+ }
251
+ ```
252
+
253
+ ### Options with descriptions
254
+
255
+ ```jsx live
256
+ function ExampleDescriptions() {
257
+ const exampleOptions = [
258
+ { value: '1', label: 'Option 1', description: 'First option description' },
259
+ { value: '2', label: 'Option 2', description: 'Second option description' },
260
+ { value: '3', label: 'Option 3', description: 'Third option description' },
261
+ { value: '4', label: 'Option 4', description: 'Fourth option description' },
262
+ ];
263
+ const [value, setValue] = useState(null);
264
+ return (
265
+ <SelectChip
266
+ accessibilityLabel="Select a value"
267
+ onChange={setValue}
268
+ options={exampleOptions}
269
+ placeholder="Choose an option"
270
+ value={value}
271
+ />
272
+ );
273
+ }
274
+ ```
275
+
276
+ ### Disabled
277
+
278
+ ```jsx live
279
+ function ExampleDisabled() {
280
+ const exampleOptions = [
281
+ { value: '1', label: 'Option 1' },
282
+ { value: '2', label: 'Option 2' },
283
+ { value: '3', label: 'Option 3' },
284
+ { value: '4', label: 'Option 4' },
285
+ ];
286
+ const [value, setValue] = useState('1');
287
+ return (
288
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
289
+ <SelectChip
290
+ disabled
291
+ accessibilityLabel="Select a value"
292
+ onChange={setValue}
293
+ options={exampleOptions}
294
+ placeholder="Choose an option"
295
+ value={null}
296
+ />
297
+ <SelectChip
298
+ disabled
299
+ accessibilityLabel="Select a value"
300
+ onChange={setValue}
301
+ options={exampleOptions}
302
+ placeholder="Choose an option"
303
+ value={value}
304
+ />
305
+ </div>
306
+ );
307
+ }
308
+ ```
309
+
310
+ ## Props
311
+
312
+ | Prop | Type | Required | Default | Description |
313
+ | --- | --- | --- | --- | --- |
314
+ | `onChange` | `(value: Type extends multi ? SelectOptionValue \| SelectOptionValue[] \| null : SelectOptionValue \| null) => void` | Yes | `-` | - |
315
+ | `options` | `SelectOptionList<Type, SelectOptionValue>` | Yes | `-` | Array of options to display in the select dropdown. Can be individual options or groups with label and options |
316
+ | `value` | `string \| SelectOptionValue[] \| null` | Yes | `-` | - |
317
+ | `SelectAllOptionComponent` | `SelectOptionComponent<Type, SelectOptionValue>` | No | `-` | Custom component to render the Select All option |
318
+ | `SelectDropdownComponent` | `SelectDropdownComponent<Type, SelectOptionValue>` | No | `-` | Custom component to render the dropdown container |
319
+ | `SelectEmptyDropdownContentsComponent` | `SelectEmptyDropdownContentComponent` | No | `-` | Custom component to render when no options are available |
320
+ | `SelectOptionComponent` | `SelectOptionComponent<Type, SelectOptionValue>` | No | `-` | Custom component to render individual options |
321
+ | `SelectOptionGroupComponent` | `SelectOptionGroupComponent<Type, SelectOptionValue>` | No | `-` | Custom component to render group headers |
322
+ | `accessibilityRoles` | `{ dropdown?: AriaHasPopupType; option?: string \| undefined; } \| undefined` | No | `-` | Accessibility roles for dropdown and option elements |
323
+ | `accessory` | `ReactElement<CellAccessoryProps, string \| JSXElementConstructor<any>>` | No | `-` | Accessory element rendered at the end of the cell (e.g., chevron). |
324
+ | `className` | `string` | No | `-` | CSS class name for the root element |
325
+ | `classNames` | `{ root?: string; control?: string \| undefined; controlStartNode?: string \| undefined; controlInputNode?: string \| undefined; controlValueNode?: string \| undefined; controlLabelNode?: string \| undefined; controlHelperTextNode?: string \| undefined; controlEndNode?: string \| undefined; dropdown?: string \| undefined; option?: string \| undefined; optionCell?: string \| undefined; optionContent?: string \| undefined; optionLabel?: string \| undefined; optionDescription?: string \| undefined; selectAllDivider?: string \| undefined; emptyContentsContainer?: string \| undefined; emptyContentsText?: string \| undefined; optionGroup?: string \| undefined; } \| undefined` | No | `-` | Custom class names for different parts of the select |
326
+ | `clearAllLabel` | `string` | No | `-` | Label for the Clear All option in multi-select mode |
327
+ | `compact` | `boolean` | No | `-` | Whether to use compact styling for the select |
328
+ | `controlAccessibilityLabel` | `string` | No | `-` | Accessibility label for the control |
329
+ | `defaultOpen` | `boolean` | No | `-` | Initial open state when component mounts (uncontrolled mode) |
330
+ | `disableClickOutsideClose` | `boolean` | No | `-` | Whether clicking outside the dropdown should close it |
331
+ | `disabled` | `boolean` | No | `false` | Toggles input interactability and opacity |
332
+ | `emptyOptionsLabel` | `string` | No | `-` | Label displayed when there are no options available |
333
+ | `end` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | End-aligned content (e.g., value, status). Replaces the deprecated detail prop. |
334
+ | `endNode` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Adds content to the end of the inner input. Refer to diagram for location of endNode in InputStack component |
335
+ | `hiddenSelectedOptionsLabel` | `string` | No | `-` | Label to show for showcasing count of hidden selected options |
336
+ | `hideSelectAll` | `boolean` | No | `-` | Whether to hide the Select All option in multi-select mode |
337
+ | `invertColorScheme` | `boolean` | No | `false` | Invert the foreground and background colors to emphasize the Chip. Depending on your theme, it may be dangerous to use this prop in conjunction with transparentWhileInactive. |
338
+ | `label` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Label displayed above the control |
339
+ | `maxSelectedOptionsToShow` | `number` | No | `-` | Maximum number of selected options to show before truncating |
340
+ | `media` | `ReactElement` | No | `-` | Media rendered at the start of the cell (icon, avatar, image, etc). |
341
+ | `numberOfLines` | `number` | No | `1` | How many lines the text in the chip will be broken into. |
342
+ | `open` | `boolean` | No | `-` | Controlled open state of the dropdown |
343
+ | `placeholder` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Placeholder text displayed when no option is selected |
344
+ | `ref` | `null \| (instance: SelectRef \| null) => void \| RefObject<SelectRef>` | No | `-` | - |
345
+ | `removeSelectedOptionAccessibilityLabel` | `string` | No | `-` | Accessibility label for each chip in a multi-select |
346
+ | `selectAllLabel` | `string` | No | `-` | Label for the Select All option in multi-select mode |
347
+ | `setOpen` | `((open: boolean \| ((open: boolean) => boolean)) => void)` | No | `-` | Callback to update the open state |
348
+ | `startNode` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Adds content to the start of the inner input. Refer to diagram for location of startNode in InputStack component |
349
+ | `style` | `CSSProperties` | No | `-` | Inline styles for the root element |
350
+ | `styles` | `{ root?: CSSProperties; control?: CSSProperties \| undefined; controlStartNode?: CSSProperties \| undefined; controlInputNode?: CSSProperties \| undefined; controlValueNode?: CSSProperties \| undefined; controlLabelNode?: CSSProperties \| undefined; controlHelperTextNode?: CSSProperties \| undefined; controlEndNode?: CSSProperties \| undefined; controlBlendStyles?: InteractableBlendStyles \| undefined; dropdown?: CSSProperties \| undefined; option?: CSSProperties \| undefined; optionCell?: CSSProperties \| undefined; optionContent?: CSSProperties \| undefined; optionLabel?: CSSProperties \| undefined; optionDescription?: CSSProperties \| undefined; optionBlendStyles?: InteractableBlendStyles \| undefined; selectAllDivider?: CSSProperties \| undefined; emptyContentsContainer?: CSSProperties \| undefined; emptyContentsText?: CSSProperties \| undefined; optionGroup?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for different parts of the select |
351
+ | `testID` | `string` | No | `-` | Test ID for the root element |
352
+ | `type` | `single \| multi` | No | `-` | Whether the select allows single or multiple selections |
353
+
354
+
@@ -89,6 +89,7 @@
89
89
  - [TextInput](web/components/TextInput.txt): A control for entering text.
90
90
  - [Switch](web/components/Switch.txt): A control for toggling between on and off.
91
91
  - [SelectOption](web/components/SelectOption.txt): A single option of a Select component.
92
+ - [SelectChipAlpha](web/components/SelectChipAlpha.txt): A chip-styled Select control built on top of the Alpha Select component. Supports both single and multi selection.
92
93
  - [SelectChip](web/components/SelectChip.txt): A Chip and Select control for selecting from a list of options.
93
94
  - [SelectAlpha](web/components/SelectAlpha.txt): A flexible select component for both single and multi-selection, built for web applications with comprehensive accessibility support.
94
95
  - [Select](web/components/Select.txt): A Dropdown control for selecting from a list of options.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mcp-server",
3
- "version": "8.25.1",
3
+ "version": "8.27.0",
4
4
  "description": "Coinbase Design System - MCP Server",
5
5
  "repository": {
6
6
  "type": "git",