@ultraviolet/ui 3.5.0 → 3.5.1

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 (49) hide show
  1. package/dist/components/Avatar/styles.css.js +1 -0
  2. package/dist/components/Avatar/variables.css.js +0 -1
  3. package/dist/components/Chip/index.d.ts +1 -1
  4. package/dist/components/Link/styles.css.d.ts +31 -31
  5. package/dist/components/Link/styles.css.d.ts.map +1 -1
  6. package/dist/components/Link/styles.css.js +1 -1
  7. package/dist/components/List/index.d.ts +0 -3
  8. package/dist/components/List/index.d.ts.map +1 -1
  9. package/dist/components/NumberInput/index.d.ts +1 -1
  10. package/dist/components/SelectInput/components/Dropdown.d.ts +14 -1
  11. package/dist/components/SelectInput/components/Dropdown.d.ts.map +1 -1
  12. package/dist/components/SelectInput/components/Dropdown.js +304 -131
  13. package/dist/components/SelectInput/components/SearchBarDropdown.d.ts.map +1 -1
  14. package/dist/components/SelectInput/components/SearchBarDropdown.js +10 -4
  15. package/dist/components/SelectInput/components/SelectBar.d.ts.map +1 -1
  16. package/dist/components/SelectInput/components/SelectBar.js +1 -4
  17. package/dist/components/SelectInput/components/dropdown.css.d.ts +7 -5
  18. package/dist/components/SelectInput/components/dropdown.css.d.ts.map +1 -1
  19. package/dist/components/SelectInput/components/dropdown.css.js +13 -9
  20. package/dist/components/SelectInput/constants.d.ts +13 -0
  21. package/dist/components/SelectInput/constants.d.ts.map +1 -0
  22. package/dist/components/SelectInput/constants.js +18 -0
  23. package/dist/components/SelectInput/index.d.ts +11 -5
  24. package/dist/components/SelectInput/index.d.ts.map +1 -1
  25. package/dist/components/SelectInput/index.js +7 -1
  26. package/dist/components/SelectInput/types.d.ts +0 -5
  27. package/dist/components/SelectInput/types.d.ts.map +1 -1
  28. package/dist/components/Slider/components/DoubleSlider.d.ts +1 -1
  29. package/dist/components/Slider/components/DoubleSlider.d.ts.map +1 -1
  30. package/dist/components/Slider/components/DoubleSlider.js +14 -10
  31. package/dist/components/Slider/components/SingleSlider.d.ts +1 -1
  32. package/dist/components/Slider/components/SingleSlider.d.ts.map +1 -1
  33. package/dist/components/Slider/components/SingleSlider.js +9 -3
  34. package/dist/components/Slider/index.d.ts +1 -1
  35. package/dist/components/Slider/index.d.ts.map +1 -1
  36. package/dist/components/Slider/index.js +3 -0
  37. package/dist/components/Slider/types.d.ts +5 -0
  38. package/dist/components/Slider/types.d.ts.map +1 -1
  39. package/dist/components/Stack/index.d.ts +2 -3
  40. package/dist/components/Stack/index.d.ts.map +1 -1
  41. package/dist/components/Stack/index.js +67 -65
  42. package/dist/components/Tabs/index.d.ts +1 -1
  43. package/dist/components/Text/style.css.js +1 -0
  44. package/dist/components/Text/variables.css.js +0 -1
  45. package/dist/components/TextInput/index.d.ts +1 -1
  46. package/dist/components/Tooltip/index.d.ts +1 -1
  47. package/dist/ui.css +1 -1
  48. package/package.json +4 -4
  49. package/dist/components/SelectInput/types.js +0 -9
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
+ import { PlusIcon } from "@ultraviolet/icons";
3
4
  import { useTheme } from "@ultraviolet/themes";
4
5
  import { cn } from "@ultraviolet/utils";
5
6
  import { assignInlineVars } from "@vanilla-extract/dynamic";
@@ -10,12 +11,11 @@ import { Popup } from "../../Popup/index.js";
10
11
  import { Skeleton } from "../../Skeleton/index.js";
11
12
  import { Stack } from "../../Stack/index.js";
12
13
  import { Text } from "../../Text/index.js";
14
+ import { DROPDOWN_MAX_HEIGHT, INPUT_SIZE_HEIGHT, OPTION_SELECTOR } from "../constants.js";
13
15
  import { useSelectInput } from "../SelectInputProvider.js";
14
- import { INPUT_SIZE_HEIGHT } from "../types.js";
15
16
  import { DisplayOption } from "./DropdownOption.js";
16
- import { footer, dropdown, dropdownWidth, dropdownEmptyState, dropdownCheckbox, dropdownItem, dropdownLoadMore, dropdownContainer, dropdownContainerUnGrouped, dropdownGroupWrapper, dropdownGroupSelectable, dropdownGroup } from "./dropdown.css.js";
17
+ import { footer, dropdown, dropdownWidth, dropdownEmptyState, comboboxCreate, dropdownCheckbox, dropdownItem, dropdownLoadMore, dropdownContainer, dropdownContainerUnGrouped, dropdownGroupWrapper, dropdownGroupSelectable, dropdownGroup, emptyStateGroupStyle } from "./dropdown.css.js";
17
18
  import { SearchBarDropdown } from "./SearchBarDropdown.js";
18
- const DROPDOWN_MAX_HEIGHT = 256;
19
19
  const NON_SEARCHABLE_KEYS = [
20
20
  "Tab",
21
21
  " ",
@@ -29,9 +29,7 @@ const NON_SEARCHABLE_KEYS = [
29
29
  "Escape"
30
30
  ];
31
31
  const moveFocusDown = () => {
32
- const options = document.querySelectorAll(
33
- '#items > div[role="option"]:not([disabled])'
34
- );
32
+ const options = document.querySelectorAll(OPTION_SELECTOR);
35
33
  const activeItem = document.activeElement;
36
34
  if (options) {
37
35
  for (let i = 0; i < options?.length; i += 1) {
@@ -43,9 +41,7 @@ const moveFocusDown = () => {
43
41
  }
44
42
  };
45
43
  const moveFocusUp = () => {
46
- const options = document.querySelectorAll(
47
- '#items > div[role="option"]:not([disabled])'
48
- );
44
+ const options = document.querySelectorAll(OPTION_SELECTOR);
49
45
  const activeItem = document.activeElement;
50
46
  if (options) {
51
47
  for (let i = 0; i < options.length; i += 1) {
@@ -106,7 +102,11 @@ const CreateDropdown = ({
106
102
  loadMore,
107
103
  optionalInfoPlacement,
108
104
  defaultSearchValue,
109
- isLoading
105
+ isLoading,
106
+ groupEmptyState,
107
+ groupError,
108
+ addOption,
109
+ searchable
110
110
  }) => {
111
111
  const {
112
112
  setIsDropdownVisible,
@@ -116,8 +116,11 @@ const CreateDropdown = ({
116
116
  selectAll,
117
117
  selectAllGroup,
118
118
  displayedOptions,
119
+ onSearch,
119
120
  setSelectedData,
120
- selectedData
121
+ selectedData,
122
+ searchInput,
123
+ setSearchInput
121
124
  } = useSelectInput();
122
125
  const focusedItemRef = useRef(null);
123
126
  useEffect(() => {
@@ -125,9 +128,56 @@ const CreateDropdown = ({
125
128
  focusedItemRef.current.focus();
126
129
  }
127
130
  }, [defaultSearchValue]);
128
- if (isEmpty) {
131
+ const handleClickCustomValue = () => {
132
+ const newOption = { label: searchInput, value: searchInput };
133
+ addOption?.onClick(searchInput);
134
+ onSearch([newOption]);
135
+ setIsDropdownVisible(multiselect);
136
+ setSearchInput("");
137
+ };
138
+ if (isEmpty && !addOption) {
129
139
  return /* @__PURE__ */ jsx(Stack, { alignItems: "center", className: dropdownEmptyState, gap: 2, children: emptyState ?? /* @__PURE__ */ jsx(Text, { as: "p", variant: "bodyStrong", children: "No options" }) });
130
140
  }
141
+ if (isEmpty && addOption && searchable) {
142
+ const text = /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: "1", children: [
143
+ /* @__PURE__ */ jsx(PlusIcon, { sentiment: "primary", size: "small" }),
144
+ /* @__PURE__ */ jsxs(Text, { as: "span", sentiment: "primary", variant: "bodySmallStrong", children: [
145
+ addOption.text,
146
+ " ",
147
+ searchInput
148
+ ] })
149
+ ] });
150
+ const option = {
151
+ label: text,
152
+ searchText: searchInput,
153
+ value: `${addOption.text} ${searchInput}`
154
+ };
155
+ return /* @__PURE__ */ jsx(
156
+ "div",
157
+ {
158
+ "aria-selected": "false",
159
+ className: comboboxCreate,
160
+ "data-testid": "add-option",
161
+ id: "add-option",
162
+ onClick: handleClickCustomValue,
163
+ onKeyDown: (event) => {
164
+ if (["Enter", " "].includes(event.key)) {
165
+ handleClickCustomValue();
166
+ }
167
+ },
168
+ role: "option",
169
+ tabIndex: -1,
170
+ children: /* @__PURE__ */ jsx(
171
+ DisplayOption,
172
+ {
173
+ descriptionDirection: "row",
174
+ option,
175
+ optionalInfoPlacement: "left"
176
+ }
177
+ )
178
+ }
179
+ );
180
+ }
131
181
  const handleClick = ({
132
182
  clickedOption,
133
183
  group,
@@ -201,6 +251,42 @@ const CreateDropdown = ({
201
251
  onKeyDown: handleKeyDownSelect,
202
252
  role: "listbox",
203
253
  children: [
254
+ addOption && searchInput && searchable ? /* @__PURE__ */ jsx(
255
+ "div",
256
+ {
257
+ "aria-selected": "false",
258
+ className: comboboxCreate,
259
+ "data-testid": "add-option",
260
+ id: "add-option",
261
+ onClick: handleClickCustomValue,
262
+ onKeyDown: (event) => {
263
+ if (["Enter", " "].includes(event.key)) {
264
+ handleClickCustomValue();
265
+ }
266
+ },
267
+ role: "option",
268
+ tabIndex: -1,
269
+ children: /* @__PURE__ */ jsx(
270
+ DisplayOption,
271
+ {
272
+ descriptionDirection: "row",
273
+ option: {
274
+ label: /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: "1", children: [
275
+ /* @__PURE__ */ jsx(PlusIcon, { sentiment: "primary", size: "small" }),
276
+ /* @__PURE__ */ jsxs(Text, { as: "span", sentiment: "primary", variant: "bodySmallStrong", children: [
277
+ addOption.text,
278
+ " ",
279
+ searchInput
280
+ ] })
281
+ ] }),
282
+ searchText: searchInput,
283
+ value: `${addOption.text} ${searchInput}`
284
+ },
285
+ optionalInfoPlacement: "left"
286
+ }
287
+ )
288
+ }
289
+ ) : null,
204
290
  selectAll && multiselect ? /* @__PURE__ */ jsx(Stack, { gap: 0.25, id: "items", tabIndex: -1, children: /* @__PURE__ */ jsx(
205
291
  "div",
206
292
  {
@@ -326,6 +412,50 @@ const CreateDropdown = ({
326
412
  role: "listbox",
327
413
  children: [
328
414
  isLoading ? /* @__PURE__ */ jsx(Skeleton, { variant: "block" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
415
+ addOption && searchInput && searchable ? /* @__PURE__ */ jsx(
416
+ "div",
417
+ {
418
+ "aria-selected": "false",
419
+ className: comboboxCreate,
420
+ "data-testid": "add-option",
421
+ id: "add-option",
422
+ onClick: handleClickCustomValue,
423
+ onKeyDown: (event) => {
424
+ if (["Enter", " "].includes(event.key)) {
425
+ handleClickCustomValue();
426
+ }
427
+ },
428
+ role: "option",
429
+ tabIndex: -1,
430
+ children: /* @__PURE__ */ jsx(
431
+ DisplayOption,
432
+ {
433
+ descriptionDirection: "row",
434
+ option: {
435
+ label: /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: "1", children: [
436
+ /* @__PURE__ */ jsx(PlusIcon, { sentiment: "primary", size: "small" }),
437
+ /* @__PURE__ */ jsxs(
438
+ Text,
439
+ {
440
+ as: "span",
441
+ sentiment: "primary",
442
+ variant: "bodySmallStrong",
443
+ children: [
444
+ addOption.text,
445
+ " ",
446
+ searchInput
447
+ ]
448
+ }
449
+ )
450
+ ] }),
451
+ searchText: searchInput,
452
+ value: `${addOption.text} ${searchInput}`
453
+ },
454
+ optionalInfoPlacement: "left"
455
+ }
456
+ )
457
+ }
458
+ ) : null,
329
459
  selectAll && multiselect ? /* @__PURE__ */ jsx(Stack, { id: "items", children: /* @__PURE__ */ jsx(
330
460
  "div",
331
461
  {
@@ -370,144 +500,180 @@ const CreateDropdown = ({
370
500
  )
371
501
  }
372
502
  ) }) : null,
373
- Object.keys(displayedOptions).map((group, index) => /* @__PURE__ */ jsxs(Stack, { gap: 0.25, children: [
374
- displayedOptions[group].length > 0 ? /* @__PURE__ */ jsx(
375
- "div",
376
- {
377
- className: dropdownGroupWrapper,
378
- id: selectAllGroup ? "items" : void 0,
379
- children: group ? (
380
- // biome-ignore lint/a11y/noInteractiveElementToNoninteractiveRole: to fix
381
- /* @__PURE__ */ jsx(
382
- "button",
503
+ Object.keys(displayedOptions).map((group, index) => {
504
+ const hasElements = displayedOptions[group].length > 0;
505
+ const emptyStateGroup = groupEmptyState?.[group] ?? null;
506
+ const errorGroup = groupError?.[group] ?? null;
507
+ return /* @__PURE__ */ jsxs(Stack, { gap: 0.25, children: [
508
+ hasElements || emptyStateGroup ? /* @__PURE__ */ jsx(
509
+ "div",
510
+ {
511
+ className: dropdownGroupWrapper,
512
+ id: selectAllGroup ? "items" : void 0,
513
+ children: group ? (
514
+ // biome-ignore lint/a11y/noInteractiveElementToNoninteractiveRole: to fix
515
+ /* @__PURE__ */ jsx(
516
+ "button",
517
+ {
518
+ className: cn(
519
+ selectAllGroup ? dropdownGroupSelectable : "",
520
+ dropdownGroup
521
+ ),
522
+ "data-selectgroup": selectAllGroup,
523
+ "data-testid": `group-${index}`,
524
+ onClick: () => selectAllGroup ? handleSelectGroup(group) : null,
525
+ onKeyDown: (event) => {
526
+ if ([" ", "Enter"].includes(event.key)) {
527
+ event.preventDefault();
528
+ handleSelectGroup(group);
529
+ }
530
+ },
531
+ role: "group",
532
+ tabIndex: selectAllGroup ? 0 : -1,
533
+ type: "button",
534
+ children: selectAllGroup ? /* @__PURE__ */ jsx(
535
+ Checkbox,
536
+ {
537
+ checked: selectedData.selectedGroups.includes(
538
+ group
539
+ ),
540
+ className: dropdownCheckbox,
541
+ "data-testid": "select-group",
542
+ disabled: false,
543
+ onChange: () => selectAllGroup ? handleSelectGroup(group) : null,
544
+ tabIndex: -1,
545
+ value: group,
546
+ children: /* @__PURE__ */ jsx(
547
+ Text,
548
+ {
549
+ as: "span",
550
+ placement: "left",
551
+ sentiment: "neutral",
552
+ variant: "caption",
553
+ children: group.toUpperCase()
554
+ }
555
+ )
556
+ }
557
+ ) : /* @__PURE__ */ jsx(
558
+ Text,
559
+ {
560
+ as: "span",
561
+ placement: "left",
562
+ sentiment: "neutral",
563
+ variant: "caption",
564
+ children: group.toUpperCase()
565
+ }
566
+ )
567
+ },
568
+ group
569
+ )
570
+ ) : null
571
+ }
572
+ ) : null,
573
+ /* @__PURE__ */ jsxs(Stack, { gap: "0.25", id: "items", children: [
574
+ hasElements ? null : /* @__PURE__ */ jsx(
575
+ Text,
576
+ {
577
+ as: "span",
578
+ className: emptyStateGroupStyle,
579
+ prominence: "weak",
580
+ sentiment: "neutral",
581
+ variant: "body",
582
+ children: emptyStateGroup
583
+ }
584
+ ),
585
+ errorGroup ? /* @__PURE__ */ jsx(
586
+ Text,
587
+ {
588
+ as: "span",
589
+ className: emptyStateGroupStyle,
590
+ sentiment: "danger",
591
+ variant: "body",
592
+ children: errorGroup
593
+ }
594
+ ) : null,
595
+ displayedOptions[group].map(
596
+ (option, indexOption) => errorGroup ? null : /* @__PURE__ */ jsx(
597
+ "div",
383
598
  {
599
+ "aria-disabled": !!option.disabled,
600
+ "aria-label": option.value,
601
+ "aria-selected": selectedData.selectedValues.includes(option.value) && !option.disabled,
384
602
  className: cn(
385
- selectAllGroup ? dropdownGroupSelectable : "",
386
- dropdownGroup
603
+ dropdownItem({
604
+ disabled: !!option.disabled,
605
+ selected: selectedData.selectedValues.includes(
606
+ option.value
607
+ ) && !option.disabled
608
+ })
387
609
  ),
388
- "data-selectgroup": selectAllGroup,
389
- "data-testid": `group-${index}`,
390
- onClick: () => selectAllGroup ? handleSelectGroup(group) : null,
610
+ "data-testid": `option-${option.value}`,
611
+ id: `option-${indexOption}`,
612
+ onClick: (event) => {
613
+ if (!option.disabled) {
614
+ handleClick({
615
+ clickedOption: option,
616
+ event,
617
+ group
618
+ });
619
+ }
620
+ },
391
621
  onKeyDown: (event) => {
392
- if ([" ", "Enter"].includes(event.key)) {
393
- event.preventDefault();
394
- handleSelectGroup(group);
622
+ const shouldClick = [" ", "Enter"].includes(event.key);
623
+ if (shouldClick) {
624
+ handleClick({
625
+ clickedOption: option,
626
+ event,
627
+ group
628
+ });
395
629
  }
396
630
  },
397
- role: "group",
398
- tabIndex: selectAllGroup ? 0 : -1,
399
- type: "button",
400
- children: selectAllGroup ? /* @__PURE__ */ jsx(
631
+ ref: option.value === defaultSearchValue || option.searchText === defaultSearchValue ? focusedItemRef : null,
632
+ role: "option",
633
+ tabIndex: option.disabled ? -1 : 0,
634
+ children: multiselect ? /* @__PURE__ */ jsx(
401
635
  Checkbox,
402
636
  {
403
- checked: selectedData.selectedGroups.includes(group),
637
+ checked: selectedData.selectedValues.includes(
638
+ option.value
639
+ ) && !option.disabled,
404
640
  className: dropdownCheckbox,
405
- "data-testid": "select-group",
406
- disabled: false,
407
- onChange: () => selectAllGroup ? handleSelectGroup(group) : null,
641
+ disabled: option.disabled,
642
+ onChange: (event) => {
643
+ if (!option.disabled) {
644
+ handleClick({
645
+ clickedOption: option,
646
+ event,
647
+ group
648
+ });
649
+ }
650
+ },
408
651
  tabIndex: -1,
409
- value: group,
652
+ value: option.value,
410
653
  children: /* @__PURE__ */ jsx(
411
- Text,
654
+ DisplayOption,
412
655
  {
413
- as: "span",
414
- placement: "left",
415
- sentiment: "neutral",
416
- variant: "caption",
417
- children: group.toUpperCase()
656
+ descriptionDirection,
657
+ option,
658
+ optionalInfoPlacement
418
659
  }
419
660
  )
420
661
  }
421
662
  ) : /* @__PURE__ */ jsx(
422
- Text,
663
+ DisplayOption,
423
664
  {
424
- as: "span",
425
- placement: "left",
426
- sentiment: "neutral",
427
- variant: "caption",
428
- children: group.toUpperCase()
665
+ descriptionDirection,
666
+ option,
667
+ optionalInfoPlacement
429
668
  }
430
669
  )
431
670
  },
432
- group
671
+ option.value
433
672
  )
434
- ) : null
435
- }
436
- ) : null,
437
- /* @__PURE__ */ jsx(Stack, { gap: "0.25", id: "items", children: displayedOptions[group].map((option, indexOption) => /* @__PURE__ */ jsx(
438
- "div",
439
- {
440
- "aria-disabled": !!option.disabled,
441
- "aria-label": option.value,
442
- "aria-selected": selectedData.selectedValues.includes(option.value) && !option.disabled,
443
- className: cn(
444
- dropdownItem({
445
- disabled: !!option.disabled,
446
- selected: selectedData.selectedValues.includes(option.value) && !option.disabled
447
- })
448
- ),
449
- "data-testid": `option-${option.value}`,
450
- id: `option-${indexOption}`,
451
- onClick: (event) => {
452
- if (!option.disabled) {
453
- handleClick({
454
- clickedOption: option,
455
- event,
456
- group
457
- });
458
- }
459
- },
460
- onKeyDown: (event) => {
461
- const shouldClick = [" ", "Enter"].includes(event.key);
462
- if (shouldClick) {
463
- handleClick({
464
- clickedOption: option,
465
- event,
466
- group
467
- });
468
- }
469
- },
470
- ref: option.value === defaultSearchValue || option.searchText === defaultSearchValue ? focusedItemRef : null,
471
- role: "option",
472
- tabIndex: option.disabled ? -1 : 0,
473
- children: multiselect ? /* @__PURE__ */ jsx(
474
- Checkbox,
475
- {
476
- checked: selectedData.selectedValues.includes(option.value) && !option.disabled,
477
- className: dropdownCheckbox,
478
- disabled: option.disabled,
479
- onChange: (event) => {
480
- if (!option.disabled) {
481
- handleClick({
482
- clickedOption: option,
483
- event,
484
- group
485
- });
486
- }
487
- },
488
- tabIndex: -1,
489
- value: option.value,
490
- children: /* @__PURE__ */ jsx(
491
- DisplayOption,
492
- {
493
- descriptionDirection,
494
- option,
495
- optionalInfoPlacement
496
- }
497
- )
498
- }
499
- ) : /* @__PURE__ */ jsx(
500
- DisplayOption,
501
- {
502
- descriptionDirection,
503
- option,
504
- optionalInfoPlacement
505
- }
506
673
  )
507
- },
508
- option.value
509
- )) })
510
- ] }, group))
674
+ ] })
675
+ ] }, group);
676
+ })
511
677
  ] }),
512
678
  loadMore ? /* @__PURE__ */ jsx(Stack, { className: dropdownLoadMore, children: loadMore }) : null
513
679
  ]
@@ -528,7 +694,10 @@ const Dropdown = ({
528
694
  size,
529
695
  dropdownAlign,
530
696
  portalTarget,
531
- id
697
+ id,
698
+ groupError,
699
+ groupEmptyState,
700
+ addOption
532
701
  }) => {
533
702
  const {
534
703
  setIsDropdownVisible,
@@ -669,7 +838,7 @@ const Dropdown = ({
669
838
  }),
670
839
  tabIndex: -1,
671
840
  text: /* @__PURE__ */ jsxs(Stack, { children: [
672
- searchable && !isLoading && numberOfOptions >= 6 ? /* @__PURE__ */ jsx(
841
+ searchable && !isLoading && (numberOfOptions >= 6 || addOption) ? /* @__PURE__ */ jsx(
673
842
  SearchBarDropdown,
674
843
  {
675
844
  displayedOptions,
@@ -680,13 +849,17 @@ const Dropdown = ({
680
849
  /* @__PURE__ */ jsx(
681
850
  CreateDropdown,
682
851
  {
852
+ addOption,
683
853
  defaultSearchValue,
684
854
  descriptionDirection,
685
855
  emptyState,
856
+ groupEmptyState,
857
+ groupError,
686
858
  isEmpty,
687
859
  isLoading,
688
860
  loadMore,
689
- optionalInfoPlacement
861
+ optionalInfoPlacement,
862
+ searchable
690
863
  }
691
864
  ),
692
865
  computedFooter
@@ -1 +1 @@
1
- {"version":3,"file":"SearchBarDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectInput/components/SearchBarDropdown.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,UAAU,CAAA;AAGpD,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,QAAQ,CAAA;IAC1B,kBAAkB,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;CACtD,CAAA;AAqED,eAAO,MAAM,iBAAiB,GAAI,wDAI/B,cAAc,4CAqGhB,CAAA"}
1
+ {"version":3,"file":"SearchBarDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectInput/components/SearchBarDropdown.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAiB,cAAc,EAAE,MAAM,OAAO,CAAA;AAKpE,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,UAAU,CAAA;AAGpD,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,QAAQ,CAAA;IAC1B,kBAAkB,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;CACtD,CAAA;AAqED,eAAO,MAAM,iBAAiB,GAAI,wDAI/B,cAAc,4CA6GhB,CAAA"}
@@ -4,6 +4,7 @@ import { isFuzzyMatch, normalizeString } from "@scaleway/fuzzy-search";
4
4
  import { SearchIcon } from "@ultraviolet/icons";
5
5
  import { useRef, useEffect } from "react";
6
6
  import { TextInput } from "../../TextInput/index.js";
7
+ import { OPTION_SELECTOR } from "../constants.js";
7
8
  import { useSelectInput } from "../SelectInputProvider.js";
8
9
  import { searchBar } from "./dropdown.css.js";
9
10
  const getReferenceText = (option) => {
@@ -86,7 +87,8 @@ const SearchBarDropdown = ({
86
87
  }
87
88
  setSearchInput(search);
88
89
  };
89
- const handleKeyDown = (key, search) => {
90
+ const handleKeyDown = (event, search) => {
91
+ const { key } = event;
90
92
  if (key === "Enter") {
91
93
  const closestOption = findClosestOption(displayedOptions, search);
92
94
  if (closestOption) {
@@ -109,8 +111,12 @@ const SearchBarDropdown = ({
109
111
  onChange?.(selectedData.selectedValues[0] ?? "");
110
112
  }
111
113
  }
112
- } else if (key === "Tab") {
113
- searchInputRef.current?.blur();
114
+ } else if (key === "Tab" || key === "ArrowDown") {
115
+ event?.preventDefault();
116
+ const optionsDropdown = document.querySelectorAll(OPTION_SELECTOR);
117
+ if (optionsDropdown && optionsDropdown.length > 0) {
118
+ optionsDropdown[0].focus();
119
+ }
114
120
  }
115
121
  };
116
122
  useEffect(() => {
@@ -132,7 +138,7 @@ const SearchBarDropdown = ({
132
138
  onBlur: () => setSearchBarActive(false),
133
139
  onChange: (event) => handleChange(event.target.value),
134
140
  onFocus: () => setSearchBarActive(true),
135
- onKeyDown: (event) => handleKeyDown(event.key, searchInput),
141
+ onKeyDown: (event) => handleKeyDown(event, searchInput),
136
142
  placeholder,
137
143
  prefix: /* @__PURE__ */ jsx(SearchIcon, { sentiment: "neutral", size: "small" }),
138
144
  ref: searchInputRef,
@@ -1 +1 @@
1
- {"version":3,"file":"SelectBar.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectInput/components/SelectBar.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,OAAO,CAAA;AAmCjD,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IAClC,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAmID,QAAA,MAAM,SAAS,GAAI,uJAehB,cAAc,4CA8UhB,CAAA;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"SelectBar.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectInput/components/SelectBar.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,OAAO,CAAA;AA8BjD,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IAClC,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAmID,QAAA,MAAM,SAAS,GAAI,uJAehB,cAAc,4CA8UhB,CAAA;AAED,OAAO,EAAE,SAAS,EAAE,CAAA"}
@@ -9,13 +9,10 @@ import { Stack } from "../../Stack/index.js";
9
9
  import { Tag } from "../../Tag/index.js";
10
10
  import { Text } from "../../Text/index.js";
11
11
  import { Tooltip } from "../../Tooltip/index.js";
12
+ import { SIZES_TAG } from "../constants.js";
12
13
  import { findOptionInOptions } from "../findOptionInOptions.js";
13
14
  import { useSelectInput } from "../SelectInputProvider.js";
14
15
  import { selectBar, selectinputPlaceholder, selectbarState, multiselectStack, selectBarTags, maxWidthTag, minWidthTag, plusTag, selectedValues } from "./selectBar.css.js";
15
- const SIZES_TAG = {
16
- gap: 8,
17
- paddings: 16
18
- };
19
16
  const DisplayValues = ({
20
17
  refTag,
21
18
  nonOverflowedValues,
@@ -5,8 +5,14 @@ export declare const dropdownContainerUnGrouped: string;
5
5
  export declare const dropdownGroup: string;
6
6
  export declare const dropdownGroupSelectable: string;
7
7
  export declare const dropdownGroupWrapper: string;
8
+ export declare const emptyStateGroupStyle: string;
8
9
  export declare const dropdownItemBase: string;
9
10
  export declare const dropdownItem: import("@vanilla-extract/recipes").RuntimeFn<{
11
+ selected: {
12
+ true: {
13
+ backgroundColor: `var(--${string})`;
14
+ };
15
+ };
10
16
  disabled: {
11
17
  true: {
12
18
  backgroundColor: `var(--${string})`;
@@ -21,11 +27,6 @@ export declare const dropdownItem: import("@vanilla-extract/recipes").RuntimeFn<
21
27
  };
22
28
  };
23
29
  };
24
- selected: {
25
- true: {
26
- backgroundColor: `var(--${string})`;
27
- };
28
- };
29
30
  }>;
30
31
  export declare const footer: string;
31
32
  export declare const dropdownCheckbox: string;
@@ -35,4 +36,5 @@ export declare const dropdownInfo: string;
35
36
  export declare const dropdownInfoTextItem: string;
36
37
  export declare const dropdownInfoContainer: string;
37
38
  export declare const searchBar: string;
39
+ export declare const comboboxCreate: string;
38
40
  //# sourceMappingURL=dropdown.css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown.css.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectInput/components/dropdown.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,oBAAc,CAAA;AAExC,eAAO,MAAM,QAAQ,QASnB,CAAA;AAEF,eAAO,MAAM,iBAAiB,QAK5B,CAAA;AAEF,eAAO,MAAM,0BAA0B,QAErC,CAAA;AAEF,eAAO,MAAM,aAAa,QAmBxB,CAAA;AAEF,eAAO,MAAM,uBAAuB,QAQlC,CAAA;AAEF,eAAO,MAAM,oBAAoB,QAG/B,CAAA;AAEF,eAAO,MAAM,gBAAgB,QAgB3B,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;EA2BvB,CAAA;AAEF,eAAO,MAAM,MAAM,QAKjB,CAAA;AAEF,eAAO,MAAM,gBAAgB,QAM3B,CAAA;AAEF,eAAO,MAAM,kBAAkB,QAAqC,CAAA;AAEpE,eAAO,MAAM,gBAAgB,QAAyC,CAAA;AAEtE,eAAO,MAAM,YAAY,QAEvB,CAAA;AAEF,eAAO,MAAM,oBAAoB,QAM/B,CAAA;AAEF,eAAO,MAAM,qBAAqB,QAAgC,CAAA;AAElE,eAAO,MAAM,SAAS,QAGpB,CAAA"}
1
+ {"version":3,"file":"dropdown.css.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectInput/components/dropdown.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,oBAAc,CAAA;AAExC,eAAO,MAAM,QAAQ,QASnB,CAAA;AAEF,eAAO,MAAM,iBAAiB,QAK5B,CAAA;AAEF,eAAO,MAAM,0BAA0B,QAErC,CAAA;AAEF,eAAO,MAAM,aAAa,QAmBxB,CAAA;AAEF,eAAO,MAAM,uBAAuB,QAQlC,CAAA;AAEF,eAAO,MAAM,oBAAoB,QAG/B,CAAA;AAEF,eAAO,MAAM,oBAAoB,QAO/B,CAAA;AAEF,eAAO,MAAM,gBAAgB,QAK3B,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;EAsCvB,CAAA;AAEF,eAAO,MAAM,MAAM,QAKjB,CAAA;AAEF,eAAO,MAAM,gBAAgB,QAM3B,CAAA;AAEF,eAAO,MAAM,kBAAkB,QAAqC,CAAA;AAEpE,eAAO,MAAM,gBAAgB,QAAyC,CAAA;AAEtE,eAAO,MAAM,YAAY,QAEvB,CAAA;AAEF,eAAO,MAAM,oBAAoB,QAM/B,CAAA;AAEF,eAAO,MAAM,qBAAqB,QAAgC,CAAA;AAElE,eAAO,MAAM,SAAS,QAGpB,CAAA;AAEF,eAAO,MAAM,cAAc,QAWzB,CAAA"}