@bigbinary/neeto-atoms 1.0.104 → 1.0.105

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/{Combobox-DriZMj4f.js → Combobox-NgubHftk.js} +2 -2
  2. package/dist/{Combobox-DriZMj4f.js.map → Combobox-NgubHftk.js.map} +1 -1
  3. package/dist/{Select-N5Ten-tn.js → Select-ZWR0HFCa.js} +253 -85
  4. package/dist/Select-ZWR0HFCa.js.map +1 -0
  5. package/dist/{SelectFieldWrapper-D98IWsW5.js → SelectFieldWrapper-D370CD4o.js} +8 -1
  6. package/dist/SelectFieldWrapper-D370CD4o.js.map +1 -0
  7. package/dist/{TreeSelect-DMbr7J2H.js → TreeSelect-rrTHwY42.js} +2 -2
  8. package/dist/{TreeSelect-DMbr7J2H.js.map → TreeSelect-rrTHwY42.js.map} +1 -1
  9. package/dist/cjs/{Combobox-BE8LT4yq.js → Combobox-PAGcNUr6.js} +2 -2
  10. package/dist/cjs/{Combobox-BE8LT4yq.js.map → Combobox-PAGcNUr6.js.map} +1 -1
  11. package/dist/cjs/{Select-CGG3J9NS.js → Select-VQCROyX1.js} +252 -84
  12. package/dist/cjs/Select-VQCROyX1.js.map +1 -0
  13. package/dist/cjs/{SelectFieldWrapper-BLVvwUcK.js → SelectFieldWrapper-CIh_atln.js} +8 -1
  14. package/dist/cjs/SelectFieldWrapper-CIh_atln.js.map +1 -0
  15. package/dist/cjs/{TreeSelect-3APPRsqr.js → TreeSelect-DDQx8FPS.js} +2 -2
  16. package/dist/cjs/{TreeSelect-3APPRsqr.js.map → TreeSelect-DDQx8FPS.js.map} +1 -1
  17. package/dist/cjs/components/Select.js +4 -4
  18. package/dist/cjs/components/TreeSelect.js +2 -2
  19. package/dist/cjs/components/index.js +4 -4
  20. package/dist/cjs/formik/Select.js +4 -4
  21. package/dist/cjs/formik/TreeSelect.js +2 -2
  22. package/dist/cjs/formik/index.js +5 -5
  23. package/dist/cjs/index.js +4 -4
  24. package/dist/cjs/primitives/AlertDialog.js +6 -38
  25. package/dist/cjs/primitives/AlertDialog.js.map +1 -1
  26. package/dist/cjs/primitives/Combobox.js +2 -2
  27. package/dist/cjs/primitives/index.js +1 -1
  28. package/dist/components/Select/MultiSelectCombobox.types.d.ts +6 -0
  29. package/dist/components/Select/SelectAnchor.d.ts +19 -1
  30. package/dist/components/Select/SelectCombobox.types.d.ts +12 -2
  31. package/dist/components/Select/SelectFieldWrapper.d.ts +7 -1
  32. package/dist/components/Select/constants.d.ts +1 -0
  33. package/dist/components/Select/hooks/useCreatableItems.d.ts +3 -1
  34. package/dist/components/Select/hooks/useMultiSelectState.d.ts +7 -1
  35. package/dist/components/Select/hooks/useSelectState.d.ts +7 -1
  36. package/dist/components/Select/types.d.ts +23 -0
  37. package/dist/components/Select/utils.d.ts +13 -0
  38. package/dist/components/Select.js +4 -4
  39. package/dist/components/TreeSelect.js +2 -2
  40. package/dist/components/index.js +4 -4
  41. package/dist/formik/Select.js +4 -4
  42. package/dist/formik/TreeSelect.js +2 -2
  43. package/dist/formik/index.js +5 -5
  44. package/dist/index.js +4 -4
  45. package/dist/primitives/AlertDialog.js +6 -38
  46. package/dist/primitives/AlertDialog.js.map +1 -1
  47. package/dist/primitives/Combobox.js +2 -2
  48. package/dist/primitives/index.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/Select-N5Ten-tn.js.map +0 -1
  51. package/dist/SelectFieldWrapper-D98IWsW5.js.map +0 -1
  52. package/dist/cjs/Select-CGG3J9NS.js.map +0 -1
  53. package/dist/cjs/SelectFieldWrapper-BLVvwUcK.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import React__default, { useState, useRef, useEffect, useCallback, useMemo, useId, forwardRef } from 'react';
3
3
  import { b as buildTestIdPrefix, a as buildAriaDescribedBy } from './fieldIds-VpluAAMl.js';
4
- import { S as SelectFieldWrapper } from './SelectFieldWrapper-D98IWsW5.js';
4
+ import { S as SelectFieldWrapper } from './SelectFieldWrapper-D370CD4o.js';
5
5
  import { c as cn } from './utils-BJnb9o5c.js';
6
- import { i as ComboboxItem, k as ComboboxList, f as ComboboxEmpty, d as ComboboxCollection, g as ComboboxGroup, j as ComboboxLabel, o as ComboboxTrigger, C as Combobox, b as ComboboxChips, c as ComboboxChipsInput, m as ComboboxTrigger$1, e as ComboboxContent, a as ComboboxChip } from './Combobox-DriZMj4f.js';
6
+ import { i as ComboboxItem, k as ComboboxList, f as ComboboxEmpty, d as ComboboxCollection, g as ComboboxGroup, j as ComboboxLabel, o as ComboboxTrigger, C as Combobox, b as ComboboxChips, c as ComboboxChipsInput, m as ComboboxTrigger$1, e as ComboboxContent, h as ComboboxInput, a as ComboboxChip } from './Combobox-NgubHftk.js';
7
7
  import { Spinner } from './primitives/Spinner.js';
8
8
  import { X } from './x-_o2T3n6D.js';
9
9
  import { C as ChevronDown } from './chevron-down-BNi0ntys.js';
@@ -104,6 +104,28 @@ function useLazyLoadSentinel({
104
104
  return sentinelRef;
105
105
  }
106
106
 
107
+ const INPUT_CHANGE_REASON = "input-change";
108
+ const SIZE_CONFIG = {
109
+ small: {
110
+ chips: "min-h-8 md:min-h-7 text-base md:text-xs gap-0.5 px-1 py-0.5",
111
+ input: "text-base md:text-xs",
112
+ chip: "h-4.5 text-[0.6875rem] px-1",
113
+ icon: "size-3.5"
114
+ },
115
+ medium: {
116
+ chips: "min-h-8 text-base md:text-sm gap-1 px-2.5 py-1",
117
+ input: "text-base md:text-sm",
118
+ chip: "h-5.25 text-xs px-1.5",
119
+ icon: "size-4"
120
+ },
121
+ large: {
122
+ chips: "min-h-10 text-base md:text-sm gap-1 px-2.5 py-1.5",
123
+ input: "text-base md:text-sm",
124
+ chip: "h-6 text-xs px-2",
125
+ icon: "size-5"
126
+ }
127
+ };
128
+
107
129
  const CREATE_PREFIX = "__create__:";
108
130
  const isCreateValue = (val) => typeof val === "string" && val.startsWith(CREATE_PREFIX);
109
131
  function useCreatableItems({
@@ -119,9 +141,11 @@ function useCreatableItems({
119
141
  }) {
120
142
  const [inputValue, setInputValue] = useState("");
121
143
  const handleInputValueChange = useCallback(
122
- (value) => {
123
- setInputValue(value);
124
- onAsyncInputChange?.(value);
144
+ (value, details) => {
145
+ const isTyping = details?.reason === INPUT_CHANGE_REASON;
146
+ const nextValue = isTyping ? value : "";
147
+ setInputValue(nextValue);
148
+ if (isTyping) onAsyncInputChange?.(nextValue);
125
149
  },
126
150
  [onAsyncInputChange]
127
151
  );
@@ -180,6 +204,13 @@ function isOptionGroup(opt) {
180
204
  return "options" in opt && Array.isArray(opt.options);
181
205
  }
182
206
 
207
+ function assignRef(ref, element) {
208
+ if (typeof ref === "function") {
209
+ ref(element);
210
+ } else if (ref) {
211
+ ref.current = element;
212
+ }
213
+ }
183
214
  function normalizeOption(option, getValue, getLabel) {
184
215
  if (!getValue && !getLabel) return option;
185
216
  return {
@@ -215,6 +246,16 @@ function toBaseUiItems(options) {
215
246
  }
216
247
  return options.map((o) => o.value);
217
248
  }
249
+ function resolveIsSearchable({
250
+ isSearchable,
251
+ searchThreshold,
252
+ optionCount,
253
+ isCountKnown
254
+ }) {
255
+ if (!isSearchable) return false;
256
+ if (searchThreshold === void 0 || !isCountKnown) return true;
257
+ return optionCount >= searchThreshold;
258
+ }
218
259
  function computeEffectiveItems(children, baseUiItems, showCreateOption, isGrouped, trimmedInput) {
219
260
  if (children) return void 0;
220
261
  const createValue = showCreateOption ? `${CREATE_PREFIX}${trimmedInput}` : null;
@@ -262,27 +303,6 @@ function useMultiSelectOptions(props) {
262
303
  };
263
304
  }
264
305
 
265
- const SIZE_CONFIG = {
266
- small: {
267
- chips: "min-h-8 md:min-h-7 text-base md:text-xs gap-0.5 px-1 py-0.5",
268
- input: "text-base md:text-xs",
269
- chip: "h-4.5 text-[0.6875rem] px-1",
270
- icon: "size-3.5"
271
- },
272
- medium: {
273
- chips: "min-h-8 text-base md:text-sm gap-1 px-2.5 py-1",
274
- input: "text-base md:text-sm",
275
- chip: "h-5.25 text-xs px-1.5",
276
- icon: "size-4"
277
- },
278
- large: {
279
- chips: "min-h-10 text-base md:text-sm gap-1 px-2.5 py-1.5",
280
- input: "text-base md:text-sm",
281
- chip: "h-6 text-xs px-2",
282
- icon: "size-5"
283
- }
284
- };
285
-
286
306
  const defaultFormatCreateLabel$1 = (v) => `Create "${v}"`;
287
307
  function useSelectState(props) {
288
308
  const {
@@ -303,7 +323,11 @@ function useSelectState(props) {
303
323
  isClearable = false,
304
324
  isDisabled = false,
305
325
  required = false,
306
- isSearchable = true,
326
+ isSearchable: isSearchableProp = true,
327
+ searchPosition = "trigger",
328
+ searchPlaceholder = "Search...",
329
+ searchThreshold,
330
+ isAsyncLoadOptionEnabled = false,
307
331
  autoHighlight = true,
308
332
  onOpenChange,
309
333
  children
@@ -313,6 +337,7 @@ function useSelectState(props) {
313
337
  const id = idProp ?? generatedId;
314
338
  const errorId = `error_${id}`;
315
339
  const helpTextId = `helpText_${id}`;
340
+ const labelId = `label_${id}`;
316
341
  const sizeConfig = SIZE_CONFIG[size];
317
342
  const isControlled = valueProp !== void 0;
318
343
  const [internalValue, setInternalValue] = useState(
@@ -342,9 +367,11 @@ function useSelectState(props) {
342
367
  const [inputValue, setInputValueState] = useState("");
343
368
  const trimmedInput = inputValue.trim();
344
369
  const combinedHandleInputValueChange = useCallback(
345
- (value) => {
346
- setInputValueState(value);
347
- if (opt.isAsync) opt.handleAsyncInputChange(value);
370
+ (value, details) => {
371
+ const isTyping = details?.reason === INPUT_CHANGE_REASON;
372
+ const nextValue = isTyping ? value : "";
373
+ setInputValueState(nextValue);
374
+ if (isTyping && opt.isAsync) opt.handleAsyncInputChange(nextValue);
348
375
  },
349
376
  [opt.isAsync, opt.handleAsyncInputChange]
350
377
  );
@@ -394,6 +421,12 @@ function useSelectState(props) {
394
421
  );
395
422
  const testIdPrefix = buildTestIdPrefix(dataTestId, label);
396
423
  const showClearButton = isClearable && !!currentValue && !isDisabled;
424
+ const isSearchable = resolveIsSearchable({
425
+ isSearchable: isSearchableProp,
426
+ searchThreshold,
427
+ optionCount: opt.flatOptions.length,
428
+ isCountKnown: !opt.isAsync && !isCreatable && !isAsyncLoadOptionEnabled
429
+ });
397
430
  const flatOptionsMap = useMemo(
398
431
  () => new Map(opt.flatOptions.map((o) => [o.value, o])),
399
432
  [opt.flatOptions]
@@ -432,6 +465,7 @@ function useSelectState(props) {
432
465
  id,
433
466
  errorId,
434
467
  helpTextId,
468
+ labelId,
435
469
  sizeConfig,
436
470
  isControlled,
437
471
  currentValue,
@@ -454,6 +488,9 @@ function useSelectState(props) {
454
488
  isDisabled,
455
489
  required,
456
490
  isSearchable,
491
+ searchPosition,
492
+ searchPlaceholder,
493
+ inputValue,
457
494
  autoHighlight,
458
495
  onOpenChange,
459
496
  isClearable
@@ -476,6 +513,11 @@ function useMultiSelectState(props) {
476
513
  onCreateOption,
477
514
  formatCreateLabel = defaultFormatCreateLabel,
478
515
  formatOptionLabel,
516
+ isSearchable: isSearchableProp = true,
517
+ searchPosition = "trigger",
518
+ searchPlaceholder = "Search...",
519
+ searchThreshold,
520
+ isAsyncLoadOptionEnabled = false,
479
521
  children
480
522
  } = props;
481
523
  const opt = useMultiSelectOptions(props);
@@ -483,7 +525,14 @@ function useMultiSelectState(props) {
483
525
  const id = idProp ?? generatedId;
484
526
  const errorId = `error_${id}`;
485
527
  const helpTextId = `helpText_${id}`;
528
+ const labelId = `label_${id}`;
486
529
  const sizeConfig = SIZE_CONFIG[size];
530
+ const isSearchable = resolveIsSearchable({
531
+ isSearchable: isSearchableProp,
532
+ searchThreshold,
533
+ optionCount: opt.flatOptions.length,
534
+ isCountKnown: !opt.isAsync && !isCreatable && !isAsyncLoadOptionEnabled
535
+ });
487
536
  const isControlled = valueProp !== void 0;
488
537
  const [internalValue, setInternalValue] = useState(
489
538
  defaultValue ?? []
@@ -548,9 +597,13 @@ function useMultiSelectState(props) {
548
597
  id,
549
598
  errorId,
550
599
  helpTextId,
600
+ labelId,
551
601
  sizeConfig,
552
602
  isControlled,
553
603
  selectedValues,
604
+ isSearchable,
605
+ searchPosition,
606
+ searchPlaceholder,
554
607
  effectiveItems,
555
608
  creatableFilter,
556
609
  handleInputValueChange,
@@ -651,9 +704,12 @@ function MultiSelectDropdown({
651
704
  );
652
705
  }
653
706
 
707
+ const omitUndefined = (props) => Object.fromEntries(
708
+ Object.entries(props).filter(([, value]) => value !== void 0)
709
+ );
654
710
  const SelectAnchor = forwardRef(
655
- ({ isSearchable, className, dataTestId, children }, ref) => {
656
- if (isSearchable) {
711
+ ({ renderAsTrigger, className, dataTestId, triggerFieldProps, children }, ref) => {
712
+ if (!renderAsTrigger) {
657
713
  return /* @__PURE__ */ jsx(
658
714
  "div",
659
715
  {
@@ -664,15 +720,21 @@ const SelectAnchor = forwardRef(
664
720
  }
665
721
  );
666
722
  }
723
+ const { id, ...ariaProps } = triggerFieldProps ?? {};
667
724
  return /* @__PURE__ */ jsx(
668
725
  ComboboxTrigger,
669
726
  {
670
727
  nativeButton: false,
671
- render: (props) => /* @__PURE__ */ jsx(
728
+ ...id ? { id } : {},
729
+ render: ({ ref: baseUiRef, ...props }) => /* @__PURE__ */ jsx(
672
730
  "div",
673
731
  {
674
732
  ...props,
675
- ref,
733
+ ...omitUndefined(ariaProps),
734
+ ref: (element) => {
735
+ assignRef(baseUiRef, element);
736
+ assignRef(ref, element);
737
+ },
676
738
  className,
677
739
  ...dataTestId ? { "data-testid": dataTestId } : {}
678
740
  }
@@ -688,11 +750,15 @@ const SelectCombobox = forwardRef(
688
750
  ({
689
751
  name,
690
752
  id,
753
+ labelId,
691
754
  effectiveItems,
692
755
  labelForValue,
693
756
  renderOption,
694
757
  renderTrigger,
695
758
  isSearchable,
759
+ searchPosition,
760
+ searchPlaceholder,
761
+ inputValue,
696
762
  isAsync,
697
763
  isCreatable,
698
764
  creatableFilter,
@@ -716,6 +782,20 @@ const SelectCombobox = forwardRef(
716
782
  children
717
783
  }, ref) => {
718
784
  const [anchorEl, setAnchorEl] = useState(null);
785
+ const isContentSearch = isSearchable && searchPosition === "content";
786
+ const renderTriggerInput = searchPosition !== "content";
787
+ const isTriggerSearch = isSearchable && renderTriggerInput;
788
+ const useTriggerAnchor = !isTriggerSearch;
789
+ const showValue = !!currentValue && (!isTriggerSearch || inputValue === "");
790
+ const showPlaceholder = !currentValue && !isTriggerSearch;
791
+ const setTriggerEl = useCallback(
792
+ (element) => {
793
+ setAnchorEl(element);
794
+ if (renderTriggerInput) return;
795
+ assignRef(ref, element);
796
+ },
797
+ [ref, renderTriggerInput]
798
+ );
719
799
  const handleClearClick = useCallback(
720
800
  (event) => {
721
801
  event.stopPropagation();
@@ -737,7 +817,8 @@ const SelectCombobox = forwardRef(
737
817
  } : {},
738
818
  value: currentValue,
739
819
  onValueChange: handleValueChange,
740
- ...isCreatable || isAsync ? { onInputValueChange: handleInputValueChange } : {},
820
+ inputValue,
821
+ onInputValueChange: handleInputValueChange,
741
822
  onOpenChange,
742
823
  disabled: isDisabled,
743
824
  autoHighlight,
@@ -745,10 +826,17 @@ const SelectCombobox = forwardRef(
745
826
  /* @__PURE__ */ jsx(
746
827
  SelectAnchor,
747
828
  {
748
- ref: setAnchorEl,
749
- isSearchable,
829
+ ref: setTriggerEl,
750
830
  dataTestId: testIdPrefix,
751
- className: !isSearchable ? "cursor-pointer" : void 0,
831
+ renderAsTrigger: useTriggerAnchor,
832
+ className: useTriggerAnchor ? "cursor-pointer" : void 0,
833
+ triggerFieldProps: renderTriggerInput ? void 0 : {
834
+ id,
835
+ "aria-labelledby": labelId,
836
+ "aria-describedby": ariaDescribedBy,
837
+ "aria-required": required || void 0,
838
+ "aria-invalid": !!error || void 0
839
+ },
752
840
  children: /* @__PURE__ */ jsxs(
753
841
  ComboboxChips,
754
842
  {
@@ -759,24 +847,28 @@ const SelectCombobox = forwardRef(
759
847
  ),
760
848
  ...testIdPrefix ? { "data-testid": `${testIdPrefix}-select-container` } : {},
761
849
  children: [
762
- !isSearchable && (currentValue ? /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: renderTrigger(currentValue) }) : /* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-muted-foreground", children: placeholder })),
763
- /* @__PURE__ */ jsx(
764
- ComboboxChipsInput,
765
- {
766
- ref,
767
- id,
768
- placeholder: isSearchable && !currentValue ? placeholder : void 0,
769
- "aria-invalid": !!error || void 0,
770
- "aria-describedby": ariaDescribedBy,
771
- "aria-required": required || void 0,
772
- className: cn(
773
- sizeConfig.input,
774
- !isSearchable && "w-0 min-w-0 overflow-hidden p-0 opacity-0"
775
- ),
776
- disabled: isDisabled,
777
- ...testIdPrefix ? { "data-testid": `${testIdPrefix}-select-input` } : {}
778
- }
779
- ),
850
+ /* @__PURE__ */ jsxs("div", { className: "grid min-w-0 flex-1 items-center [&>*]:col-start-1 [&>*]:row-start-1", children: [
851
+ showValue && /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: renderTrigger(currentValue) }),
852
+ showPlaceholder && /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-muted-foreground", children: placeholder }),
853
+ renderTriggerInput && /* @__PURE__ */ jsx(
854
+ ComboboxChipsInput,
855
+ {
856
+ ref,
857
+ id,
858
+ placeholder: isTriggerSearch && !currentValue ? placeholder : void 0,
859
+ "aria-invalid": !!error || void 0,
860
+ "aria-describedby": ariaDescribedBy,
861
+ "aria-required": required || void 0,
862
+ className: cn(
863
+ sizeConfig.input,
864
+ "w-full min-w-0",
865
+ !isSearchable && "w-0 overflow-hidden p-0 opacity-0"
866
+ ),
867
+ disabled: isDisabled,
868
+ ...testIdPrefix ? { "data-testid": `${testIdPrefix}-select-input` } : {}
869
+ }
870
+ )
871
+ ] }),
780
872
  showClearButton && /* @__PURE__ */ jsx(
781
873
  "button",
782
874
  {
@@ -788,7 +880,7 @@ const SelectCombobox = forwardRef(
788
880
  children: /* @__PURE__ */ jsx(X, { className: sizeConfig.icon })
789
881
  }
790
882
  ),
791
- isSearchable ? /* @__PURE__ */ jsx(
883
+ isTriggerSearch ? /* @__PURE__ */ jsx(
792
884
  ComboboxTrigger$1,
793
885
  {
794
886
  className: cn(
@@ -811,15 +903,26 @@ const SelectCombobox = forwardRef(
811
903
  )
812
904
  }
813
905
  ),
814
- /* @__PURE__ */ jsx(ComboboxContent, { anchor: anchorEl, ...contentProps, children: /* @__PURE__ */ jsx(
815
- MultiSelectDropdown,
816
- {
817
- ...dropdownProps,
818
- renderOption,
819
- testIdPrefix,
820
- children
821
- }
822
- ) })
906
+ /* @__PURE__ */ jsxs(ComboboxContent, { anchor: anchorEl, ...contentProps, children: [
907
+ isContentSearch && /* @__PURE__ */ jsx(
908
+ ComboboxInput,
909
+ {
910
+ showTrigger: false,
911
+ placeholder: searchPlaceholder,
912
+ ...labelId ? { "aria-labelledby": labelId } : { "aria-label": searchPlaceholder },
913
+ ...testIdPrefix ? { "data-testid": `${testIdPrefix}-select-input` } : {}
914
+ }
915
+ ),
916
+ /* @__PURE__ */ jsx(
917
+ MultiSelectDropdown,
918
+ {
919
+ ...dropdownProps,
920
+ renderOption,
921
+ testIdPrefix,
922
+ children
923
+ }
924
+ )
925
+ ] })
823
926
  ]
824
927
  }
825
928
  )
@@ -832,10 +935,13 @@ const MultiSelectCombobox = forwardRef(
832
935
  ({
833
936
  name,
834
937
  id,
938
+ labelId,
835
939
  effectiveItems,
836
940
  labelForValue,
837
941
  renderOption,
838
942
  isSearchable,
943
+ searchPosition,
944
+ searchPlaceholder,
839
945
  isAsync,
840
946
  isCreatable,
841
947
  creatableFilter,
@@ -862,6 +968,18 @@ const MultiSelectCombobox = forwardRef(
862
968
  children
863
969
  }, ref) => {
864
970
  const [anchorEl, setAnchorEl] = useState(null);
971
+ const isContentSearch = isSearchable && searchPosition === "content";
972
+ const renderTriggerInput = searchPosition !== "content";
973
+ const isTriggerSearch = isSearchable && renderTriggerInput;
974
+ const useTriggerAnchor = !isTriggerSearch;
975
+ const setTriggerEl = useCallback(
976
+ (element) => {
977
+ setAnchorEl(element);
978
+ if (renderTriggerInput) return;
979
+ assignRef(ref, element);
980
+ },
981
+ [ref, renderTriggerInput]
982
+ );
865
983
  return (
866
984
  // @ts-expect-error — conditional spread creates a union that TS cannot narrow to the Combobox discriminated-union props
867
985
  /* @__PURE__ */ jsxs(
@@ -884,9 +1002,16 @@ const MultiSelectCombobox = forwardRef(
884
1002
  /* @__PURE__ */ jsx(
885
1003
  SelectAnchor,
886
1004
  {
887
- ref: setAnchorEl,
888
- isSearchable,
889
- className: !isSearchable ? "cursor-pointer" : void 0,
1005
+ ref: setTriggerEl,
1006
+ renderAsTrigger: useTriggerAnchor,
1007
+ className: useTriggerAnchor ? "cursor-pointer" : void 0,
1008
+ triggerFieldProps: renderTriggerInput ? void 0 : {
1009
+ id,
1010
+ "aria-labelledby": labelId,
1011
+ "aria-describedby": ariaDescribedBy,
1012
+ "aria-required": required || void 0,
1013
+ "aria-invalid": !!error || void 0
1014
+ },
890
1015
  children: /* @__PURE__ */ jsxs(
891
1016
  ComboboxChips,
892
1017
  {
@@ -898,22 +1023,23 @@ const MultiSelectCombobox = forwardRef(
898
1023
  ),
899
1024
  ...testIdPrefix ? { "data-testid": `${testIdPrefix}-select-container` } : {},
900
1025
  children: [
901
- selectedValues.map((val) => /* @__PURE__ */ jsx(
1026
+ selectedValues.map((val, index) => /* @__PURE__ */ jsx(
902
1027
  ComboboxChip,
903
1028
  {
904
1029
  className: sizeConfig.chip,
905
1030
  showRemove: !hideChipRemove,
1031
+ ...renderTriggerInput || isDisabled ? {} : { tabIndex: index === 0 ? 0 : -1 },
906
1032
  ...testIdPrefix ? { "data-testid": `${testIdPrefix}-chip` } : {},
907
1033
  children: renderOption(val)
908
1034
  },
909
1035
  val
910
1036
  )),
911
- /* @__PURE__ */ jsx(
1037
+ renderTriggerInput ? /* @__PURE__ */ jsx(
912
1038
  ComboboxChipsInput,
913
1039
  {
914
1040
  ref,
915
1041
  id,
916
- placeholder: isSearchable && selectedValues.length === 0 ? placeholder : void 0,
1042
+ placeholder: isTriggerSearch && selectedValues.length === 0 ? placeholder : void 0,
917
1043
  "aria-invalid": !!error || void 0,
918
1044
  "aria-describedby": ariaDescribedBy,
919
1045
  "aria-required": required || void 0,
@@ -924,21 +1050,44 @@ const MultiSelectCombobox = forwardRef(
924
1050
  disabled: isDisabled,
925
1051
  ...testIdPrefix ? { "data-testid": `${testIdPrefix}-select-input` } : {}
926
1052
  }
927
- )
1053
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
1054
+ selectedValues.length === 0 && /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", children: placeholder }),
1055
+ /* @__PURE__ */ jsx(
1056
+ ChevronDown,
1057
+ {
1058
+ "aria-hidden": true,
1059
+ className: cn(
1060
+ "pointer-events-none ms-auto shrink-0 text-muted-foreground",
1061
+ sizeConfig.icon
1062
+ )
1063
+ }
1064
+ )
1065
+ ] })
928
1066
  ]
929
1067
  }
930
1068
  )
931
1069
  }
932
1070
  ),
933
- /* @__PURE__ */ jsx(ComboboxContent, { anchor: anchorEl, ...contentProps, children: /* @__PURE__ */ jsx(
934
- MultiSelectDropdown,
935
- {
936
- ...dropdownProps,
937
- renderOption,
938
- testIdPrefix,
939
- children
940
- }
941
- ) })
1071
+ /* @__PURE__ */ jsxs(ComboboxContent, { anchor: anchorEl, ...contentProps, children: [
1072
+ isContentSearch && /* @__PURE__ */ jsx(
1073
+ ComboboxInput,
1074
+ {
1075
+ showTrigger: false,
1076
+ placeholder: searchPlaceholder,
1077
+ ...labelId ? { "aria-labelledby": labelId } : { "aria-label": searchPlaceholder },
1078
+ ...testIdPrefix ? { "data-testid": `${testIdPrefix}-select-input` } : {}
1079
+ }
1080
+ ),
1081
+ /* @__PURE__ */ jsx(
1082
+ MultiSelectDropdown,
1083
+ {
1084
+ ...dropdownProps,
1085
+ renderOption,
1086
+ testIdPrefix,
1087
+ children
1088
+ }
1089
+ )
1090
+ ] })
942
1091
  ]
943
1092
  }
944
1093
  )
@@ -956,6 +1105,7 @@ const SingleSelectInner = forwardRef(
956
1105
  helpText,
957
1106
  errorId,
958
1107
  helpTextId,
1108
+ labelId,
959
1109
  isDisabled,
960
1110
  required,
961
1111
  testIdPrefix,
@@ -964,6 +1114,9 @@ const SingleSelectInner = forwardRef(
964
1114
  renderOption,
965
1115
  renderTrigger,
966
1116
  isSearchable,
1117
+ searchPosition,
1118
+ searchPlaceholder,
1119
+ inputValue,
967
1120
  isAsync,
968
1121
  creatableFilter,
969
1122
  isControlled,
@@ -997,17 +1150,23 @@ const SingleSelectInner = forwardRef(
997
1150
  testIdPrefix,
998
1151
  labelProps: props.labelProps,
999
1152
  className: props.className,
1153
+ labelId,
1154
+ focusTargetOnLabelClick: searchPosition === "content",
1000
1155
  children: /* @__PURE__ */ jsx(
1001
1156
  SelectCombobox,
1002
1157
  {
1003
1158
  ref,
1004
1159
  name: props.name,
1005
1160
  id,
1161
+ labelId: label ? labelId : void 0,
1006
1162
  effectiveItems,
1007
1163
  labelForValue,
1008
1164
  renderOption,
1009
1165
  renderTrigger,
1010
1166
  isSearchable,
1167
+ searchPosition,
1168
+ searchPlaceholder,
1169
+ inputValue,
1011
1170
  isAsync,
1012
1171
  isCreatable: props.isCreatable ?? false,
1013
1172
  creatableFilter,
@@ -1059,10 +1218,14 @@ const MultiSelectInner = forwardRef(
1059
1218
  helpText,
1060
1219
  errorId,
1061
1220
  helpTextId,
1221
+ labelId,
1062
1222
  testIdPrefix,
1063
1223
  effectiveItems,
1064
1224
  labelForValue,
1065
1225
  renderOption,
1226
+ isSearchable,
1227
+ searchPosition,
1228
+ searchPlaceholder,
1066
1229
  isAsync,
1067
1230
  creatableFilter,
1068
1231
  isControlled,
@@ -1094,16 +1257,21 @@ const MultiSelectInner = forwardRef(
1094
1257
  testIdPrefix,
1095
1258
  labelProps: props.labelProps,
1096
1259
  className: props.className,
1260
+ labelId,
1261
+ focusTargetOnLabelClick: searchPosition === "content",
1097
1262
  children: /* @__PURE__ */ jsx(
1098
1263
  MultiSelectCombobox,
1099
1264
  {
1100
1265
  ref,
1101
1266
  name: props.name,
1102
1267
  id,
1268
+ labelId: label ? labelId : void 0,
1103
1269
  effectiveItems,
1104
1270
  labelForValue,
1105
1271
  renderOption,
1106
- isSearchable: props.isSearchable ?? true,
1272
+ isSearchable,
1273
+ searchPosition,
1274
+ searchPlaceholder,
1107
1275
  isAsync,
1108
1276
  isCreatable: props.isCreatable ?? false,
1109
1277
  creatableFilter,
@@ -1190,4 +1358,4 @@ const Select = forwardRef((props, ref) => {
1190
1358
  Select.displayName = "Select";
1191
1359
 
1192
1360
  export { Select as S };
1193
- //# sourceMappingURL=Select-N5Ten-tn.js.map
1361
+ //# sourceMappingURL=Select-ZWR0HFCa.js.map