@vibe/core 4.4.0-alpha-26200.0 → 4.4.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 (53) hide show
  1. package/dist/components/Dropdown/Dropdown.types.d.ts +0 -12
  2. package/dist/components/Dropdown/components/MultiSelectedValues/MultiSelectedValues.d.ts +1 -5
  3. package/dist/components/Dropdown/components/Trigger/DropdownInput.d.ts +2 -4
  4. package/dist/components/Dropdown/context/DropdownContext.types.d.ts +0 -6
  5. package/dist/components/Dropdown/hooks/useDropdownMultiCombobox.d.ts +1 -1
  6. package/dist/components/Modal/Modal/Modal.types.d.ts +6 -0
  7. package/dist/metadata/components.json +11 -18
  8. package/dist/metadata.json +11 -18
  9. package/dist/mocked_classnames/components/Dropdown/Dropdown.types.d.ts +0 -12
  10. package/dist/mocked_classnames/components/Dropdown/components/MultiSelectedValues/MultiSelectedValues.d.ts +1 -5
  11. package/dist/mocked_classnames/components/Dropdown/components/Trigger/DropdownInput.d.ts +2 -4
  12. package/dist/mocked_classnames/components/Dropdown/context/DropdownContext.types.d.ts +0 -6
  13. package/dist/mocked_classnames/components/Dropdown/hooks/useDropdownMultiCombobox.d.ts +1 -1
  14. package/dist/mocked_classnames/components/Modal/Modal/Modal.types.d.ts +6 -0
  15. package/dist/mocked_classnames/src/components/Dropdown/components/MultiSelectedValues/MultiSelectedValues.js +1 -1
  16. package/dist/mocked_classnames/src/components/Dropdown/components/MultiSelectedValues/MultiSelectedValues.js.map +1 -1
  17. package/dist/mocked_classnames/src/components/Dropdown/components/Trigger/DropdownInput.js +1 -1
  18. package/dist/mocked_classnames/src/components/Dropdown/components/Trigger/DropdownInput.js.map +1 -1
  19. package/dist/mocked_classnames/src/components/Dropdown/components/Trigger/MultiSelectTrigger.js +1 -1
  20. package/dist/mocked_classnames/src/components/Dropdown/components/Trigger/MultiSelectTrigger.js.map +1 -1
  21. package/dist/mocked_classnames/src/components/Dropdown/components/Trigger/SingleSelectTrigger.js +1 -1
  22. package/dist/mocked_classnames/src/components/Dropdown/components/Trigger/SingleSelectTrigger.js.map +1 -1
  23. package/dist/mocked_classnames/src/components/Dropdown/components/Trigger/Trigger.module.scss.js +1 -1
  24. package/dist/mocked_classnames/src/components/Dropdown/hooks/useDropdownCombobox.js +1 -1
  25. package/dist/mocked_classnames/src/components/Dropdown/hooks/useDropdownCombobox.js.map +1 -1
  26. package/dist/mocked_classnames/src/components/Dropdown/hooks/useDropdownMultiCombobox.js +1 -1
  27. package/dist/mocked_classnames/src/components/Dropdown/hooks/useDropdownMultiCombobox.js.map +1 -1
  28. package/dist/mocked_classnames/src/components/Dropdown/modes/DropdownMultiComboboxController.js +1 -1
  29. package/dist/mocked_classnames/src/components/Dropdown/modes/DropdownMultiComboboxController.js.map +1 -1
  30. package/dist/mocked_classnames/src/components/Modal/Modal/Modal.js +1 -1
  31. package/dist/mocked_classnames/src/components/Modal/Modal/Modal.js.map +1 -1
  32. package/dist/mocked_classnames/src/components/Modal/Modal/Modal.module.scss.js +1 -1
  33. package/dist/src/components/Dropdown/components/MultiSelectedValues/MultiSelectedValues.js +1 -1
  34. package/dist/src/components/Dropdown/components/MultiSelectedValues/MultiSelectedValues.js.map +1 -1
  35. package/dist/src/components/Dropdown/components/Trigger/DropdownInput.js +1 -1
  36. package/dist/src/components/Dropdown/components/Trigger/DropdownInput.js.map +1 -1
  37. package/dist/src/components/Dropdown/components/Trigger/MultiSelectTrigger.js +1 -1
  38. package/dist/src/components/Dropdown/components/Trigger/MultiSelectTrigger.js.map +1 -1
  39. package/dist/src/components/Dropdown/components/Trigger/SingleSelectTrigger.js +1 -1
  40. package/dist/src/components/Dropdown/components/Trigger/SingleSelectTrigger.js.map +1 -1
  41. package/dist/src/components/Dropdown/components/Trigger/Trigger.module.scss.js +1 -1
  42. package/dist/src/components/Dropdown/hooks/useDropdownCombobox.js +1 -1
  43. package/dist/src/components/Dropdown/hooks/useDropdownCombobox.js.map +1 -1
  44. package/dist/src/components/Dropdown/hooks/useDropdownMultiCombobox.js +1 -1
  45. package/dist/src/components/Dropdown/hooks/useDropdownMultiCombobox.js.map +1 -1
  46. package/dist/src/components/Dropdown/modes/DropdownMultiComboboxController.js +1 -1
  47. package/dist/src/components/Dropdown/modes/DropdownMultiComboboxController.js.map +1 -1
  48. package/dist/src/components/Modal/Modal/Modal.js +1 -1
  49. package/dist/src/components/Modal/Modal/Modal.js.map +1 -1
  50. package/dist/src/components/Modal/Modal/Modal.module.scss.js +1 -1
  51. package/package.json +2 -2
  52. package/dist/metadata/examples/DropdownMultiSelectA11y.md +0 -50
  53. package/dist/metadata/examples/DropdownSearchableSingleSelect.md +0 -379
@@ -1,379 +0,0 @@
1
- # Storybook Code Examples
2
-
3
- ## Overview
4
-
5
- ```tsx
6
- const dropdownTemplate = (props: BaseDropdownProps<any>) => {
7
- const options = useMemo(() => basicOptions, []);
8
- return <div style={{
9
- height: "260px",
10
- width: "300px"
11
- }}>
12
- <Dropdown options={options} searchable label="Team" helperText="Search and pick a team" {...props} />
13
- </div>;
14
- }
15
- ```
16
-
17
- ## Sizes
18
-
19
- ```tsx
20
- const options = useMemo(() => basicOptions, []);
21
- return <Flex gap="medium" align="start">
22
- <div style={{
23
- width: "300px"
24
- }}>
25
- <Dropdown id="searchable-single-large" options={options} searchable size="large" label="Large" placeholder="Search a team" clearAriaLabel="Clear" />
26
- </div>
27
- <div style={{
28
- width: "300px"
29
- }}>
30
- <Dropdown id="searchable-single-medium" options={options} searchable size="medium" label="Medium" placeholder="Search a team" clearAriaLabel="Clear" />
31
- </div>
32
- <div style={{
33
- width: "300px"
34
- }}>
35
- <Dropdown id="searchable-single-small" options={options} searchable size="small" label="Small" placeholder="Search a team" clearAriaLabel="Clear" />
36
- </div>
37
- </Flex>;
38
- ```
39
-
40
- ## States
41
-
42
- ```tsx
43
- const options = useMemo(() => basicOptions, []);
44
- return <Flex gap="large" align="start">
45
- <Flex direction="column" gap="medium">
46
- <div style={{
47
- width: "300px"
48
- }}>
49
- <Dropdown id="searchable-single-default" options={options} searchable label="Default" placeholder="Search a team" clearAriaLabel="Clear" />
50
- </div>
51
- <div style={{
52
- width: "300px"
53
- }}>
54
- <Dropdown id="searchable-single-disabled" options={options} searchable label="Disabled" placeholder="Search a team" disabled clearAriaLabel="Clear" />
55
- </div>
56
- </Flex>
57
- <Flex direction="column" gap="medium">
58
- <div style={{
59
- width: "300px"
60
- }}>
61
- <Dropdown id="searchable-single-error" options={options} searchable label="Error" placeholder="Search a team" error clearAriaLabel="Clear" />
62
- </div>
63
- <div style={{
64
- width: "300px"
65
- }}>
66
- <Dropdown id="searchable-single-readonly" options={options} searchable label="Read only" placeholder="Search a team" defaultValue={options[0]} readOnly clearAriaLabel="Clear" />
67
- </div>
68
- </Flex>
69
- </Flex>;
70
- ```
71
-
72
- ## WithDefaultValue
73
-
74
- ```tsx
75
- const options = useMemo(() => basicOptions, []);
76
- return <div style={{
77
- height: "260px",
78
- width: "300px"
79
- }}>
80
- <Text type="text2" color="secondary">
81
- The selected value lives inside the input, so it is exposed to screen readers on mount.
82
- </Text>
83
- <Dropdown id="searchable-single-default-value" options={options} searchable label="Team" defaultValue={options[2]} placeholder="Search a team" clearAriaLabel="Clear" />
84
- </div>;
85
- ```
86
-
87
- ## Controlled
88
-
89
- ```tsx
90
- const options = useMemo(() => basicOptions, []);
91
- const [value, setValue] = useState<DropdownOption | null | undefined>(options[1]);
92
- return <Flex direction="column" gap="medium" align="start" style={{
93
- width: "300px"
94
- }}>
95
- <Text type="text2">Selected: {value?.label ?? "none"}</Text>
96
- <Dropdown id="searchable-single-controlled" options={options} searchable label="Team" placeholder="Search a team" value={value} onChange={(option: DropdownOption) => setValue(option)} onClear={() => setValue(null)} clearAriaLabel="Clear" />
97
- </Flex>;
98
- ```
99
-
100
- ## WithIconsAndAvatars
101
-
102
- ```tsx
103
- const iconOptions = useMemo(() => [{
104
- value: "email",
105
- label: "Email",
106
- startElement: {
107
- type: "icon",
108
- value: Email
109
- }
110
- }, {
111
- value: "attach",
112
- label: "Attach",
113
- startElement: {
114
- type: "icon",
115
- value: Attach
116
- }
117
- }], []);
118
- const avatarOptions = useMemo(() => [{
119
- value: "julia",
120
- label: "Julia Martinez",
121
- startElement: {
122
- type: "avatar",
123
- value: person1
124
- }
125
- }, {
126
- value: "sophia",
127
- label: "Sophia Johnson",
128
- startElement: {
129
- type: "avatar",
130
- value: person2
131
- }
132
- }, {
133
- value: "marco",
134
- label: "Marco DiAngelo",
135
- startElement: {
136
- type: "avatar",
137
- value: person3
138
- }
139
- }], []);
140
- return <Flex direction="column" gap="medium">
141
- <Text type="text2" color="secondary">
142
- Each option is preselected. The icon / avatar shows in the option list, but the collapsed selected value
143
- inside the input is text-only — a native input can only hold a string.
144
- </Text>
145
- <Flex gap="large" align="start">
146
- <div style={{
147
- width: "300px"
148
- }}>
149
- <Dropdown id="searchable-single-icons" options={iconOptions as any} defaultValue={iconOptions[0] as any} searchable label="With icons" placeholder="Search an action" clearAriaLabel="Clear" />
150
- </div>
151
- <div style={{
152
- width: "300px"
153
- }}>
154
- <Dropdown id="searchable-single-avatars" options={avatarOptions as any} defaultValue={avatarOptions[0] as any} searchable label="With avatars" placeholder="Search a person" clearAriaLabel="Clear" />
155
- </div>
156
- </Flex>
157
- </Flex>;
158
- ```
159
-
160
- ## WithEndElements
161
-
162
- ```tsx
163
- const endIconOptions = useMemo(() => [{
164
- value: "email",
165
- label: "Email",
166
- endElement: {
167
- type: "icon",
168
- value: Email
169
- }
170
- }, {
171
- value: "attach",
172
- label: "Attach",
173
- endElement: {
174
- type: "icon",
175
- value: Attach
176
- }
177
- }], []);
178
- const suffixOptions = useMemo(() => [{
179
- value: "copy",
180
- label: "Copy",
181
- endElement: {
182
- type: "suffix",
183
- value: "⌘C"
184
- }
185
- }, {
186
- value: "paste",
187
- label: "Paste",
188
- endElement: {
189
- type: "suffix",
190
- value: "⌘V"
191
- }
192
- }], []);
193
- return <Flex direction="column" gap="medium">
194
- <Text type="text2" color="secondary">
195
- Trailing icons and suffix / hint text appear in the option list, but are dropped from the collapsed selected
196
- value (text-only).
197
- </Text>
198
- <Flex gap="large" align="start">
199
- <div style={{
200
- width: "300px"
201
- }}>
202
- <Dropdown id="searchable-single-end-icon" options={endIconOptions as any} defaultValue={endIconOptions[0] as any} searchable label="With end icon" placeholder="Search an action" clearAriaLabel="Clear" />
203
- </div>
204
- <div style={{
205
- width: "300px"
206
- }}>
207
- <Dropdown id="searchable-single-suffix" options={suffixOptions as any} defaultValue={suffixOptions[0] as any} searchable label="With suffix / hint" placeholder="Search an action" clearAriaLabel="Clear" />
208
- </div>
209
- </Flex>
210
- </Flex>;
211
- ```
212
-
213
- ## WithValueRenderer
214
-
215
- ```tsx
216
- const options = useMemo(() => [{
217
- value: "julia",
218
- label: "Julia Martinez",
219
- startElement: {
220
- type: "avatar",
221
- value: person1
222
- }
223
- }, {
224
- value: "sophia",
225
- label: "Sophia Johnson",
226
- startElement: {
227
- type: "avatar",
228
- value: person2
229
- }
230
- }], []);
231
- const valueRenderer = (option: DropdownOption) => <Flex gap="small" align="center">
232
- <Email />
233
- <Text type="text2">Custom: {option.label}</Text>
234
- </Flex>;
235
- return <Flex direction="column" gap="medium">
236
- <Text type="text2" color="secondary">
237
- A custom <code>valueRenderer</code> is provided and the value is preselected. For searchable single select it
238
- is <strong>not</strong> applied to the collapsed selected value — the input shows the plain label text only.
239
- (<code>valueRenderer</code> still applies to non-searchable single select.)
240
- </Text>
241
- <div style={{
242
- width: "300px"
243
- }}>
244
- <Dropdown id="searchable-single-value-renderer" options={options as any} defaultValue={options[0] as any} valueRenderer={valueRenderer} searchable label="With valueRenderer" placeholder="Search a person" clearAriaLabel="Clear" />
245
- </div>
246
- </Flex>;
247
- ```
248
-
249
- ## WithGroups
250
-
251
- ```tsx
252
- const groupedOptions = useMemo(() => [{
253
- label: "Engineering",
254
- options: [{
255
- value: "frontend",
256
- label: "Frontend"
257
- }, {
258
- value: "backend",
259
- label: "Backend"
260
- }, {
261
- value: "infra",
262
- label: "Infrastructure"
263
- }]
264
- }, {
265
- label: "Business",
266
- options: [{
267
- value: "marketing",
268
- label: "Marketing"
269
- }, {
270
- value: "sales",
271
- label: "Sales"
272
- }]
273
- }], []);
274
- return <Flex gap="large" align="start">
275
- <Flex direction="column" gap="small">
276
- <Text type="text2">Grouped by category</Text>
277
- <div style={{
278
- width: "300px"
279
- }}>
280
- <Dropdown id="searchable-single-groups" options={groupedOptions} searchable placeholder="Search a team" maxMenuHeight={200} clearAriaLabel="Clear" />
281
- </div>
282
- </Flex>
283
- <Flex direction="column" gap="small">
284
- <Text type="text2">Sticky group titles</Text>
285
- <div style={{
286
- width: "300px"
287
- }}>
288
- <Dropdown id="searchable-single-groups-sticky" options={groupedOptions} searchable stickyGroupTitle placeholder="Search a team" maxMenuHeight={200} clearAriaLabel="Clear" />
289
- </div>
290
- </Flex>
291
- <Flex direction="column" gap="small">
292
- <Text type="text2">Group by divider</Text>
293
- <div style={{
294
- width: "300px"
295
- }}>
296
- <Dropdown id="searchable-single-groups-divider" options={groupedOptions} searchable withGroupDivider placeholder="Search a team" maxMenuHeight={200} clearAriaLabel="Clear" />
297
- </div>
298
- </Flex>
299
- </Flex>;
300
- ```
301
-
302
- ## WithTooltips
303
-
304
- ```tsx
305
- const options = useMemo(() => [{
306
- value: "marketing",
307
- label: "Marketing",
308
- tooltipProps: {
309
- content: "Campaigns, content and brand."
310
- }
311
- }, {
312
- value: "design",
313
- label: "Design",
314
- tooltipProps: {
315
- content: "Product and brand design."
316
- }
317
- }, {
318
- value: "engineering",
319
- label: "Engineering"
320
- }], []);
321
- return <div style={{
322
- height: "220px",
323
- width: "300px"
324
- }}>
325
- <Dropdown id="searchable-single-tooltips" options={options as any} searchable label="Team" placeholder="Search a team" clearAriaLabel="Clear" />
326
- </div>;
327
- ```
328
-
329
- ## ClearableAndMaxHeight
330
-
331
- ```tsx
332
- const options = useMemo(() => Array.from({
333
- length: 30
334
- }, (_, index) => ({
335
- value: `option-${index + 1}`,
336
- label: `Option ${index + 1}`
337
- })), []);
338
- return <Flex gap="large" align="start">
339
- <div style={{
340
- width: "300px"
341
- }}>
342
- <Dropdown id="searchable-single-not-clearable" options={options} searchable clearable={false} label="Not clearable" defaultValue={options[0]} placeholder="Search an option" clearAriaLabel="Clear" />
343
- </div>
344
- <div style={{
345
- width: "300px"
346
- }}>
347
- <Dropdown id="searchable-single-max-height" options={options} searchable maxMenuHeight={170} label="Limited menu height" placeholder="Search an option" clearAriaLabel="Clear" />
348
- </div>
349
- </Flex>;
350
- ```
351
-
352
- ## CustomFilterAndNoOptions
353
-
354
- ```tsx
355
- const options = useMemo(() => basicOptions, []);
356
-
357
- // Match only from the start of the label instead of the default substring match.
358
- // Match only from the start of the label instead of the default substring match.
359
- const startsWithFilter = (option: DropdownOption, inputValue: string) => option.label.toLowerCase().startsWith(inputValue.toLowerCase());
360
- return <Flex gap="large" align="start">
361
- <Flex direction="column" gap="small">
362
- <Text type="text2">Custom "starts with" filter</Text>
363
- <div style={{
364
- width: "300px"
365
- }}>
366
- <Dropdown id="searchable-single-custom-filter" options={options} searchable filterOption={startsWithFilter} placeholder="Search a team" clearAriaLabel="Clear" />
367
- </div>
368
- </Flex>
369
- <Flex direction="column" gap="small">
370
- <Text type="text2">Custom empty message</Text>
371
- <div style={{
372
- width: "300px"
373
- }}>
374
- <Dropdown id="searchable-single-no-options" options={[]} searchable noOptionsMessage="No teams found" placeholder="Search a team" clearAriaLabel="Clear" />
375
- </div>
376
- </Flex>
377
- </Flex>;
378
- ```
379
-