@jobber/components 6.103.4-uncontroll-3a6b89f.8 → 6.103.5

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 (82) hide show
  1. package/dist/Autocomplete/Autocomplete.types.d.ts +13 -19
  2. package/dist/Autocomplete/index.cjs +10 -51
  3. package/dist/Autocomplete/index.mjs +10 -51
  4. package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +0 -17
  5. package/dist/Autocomplete/useAutocomplete.d.ts +0 -1
  6. package/dist/Card-cjs.js +1 -1
  7. package/dist/Card-es.js +1 -1
  8. package/dist/Chip/Chip.d.ts +1 -2
  9. package/dist/Chip/hooks/useChildComponent.d.ts +4 -3
  10. package/dist/Chip/index.cjs +1 -1
  11. package/dist/Chip-cjs.js +5 -4
  12. package/dist/Chip-es.js +5 -4
  13. package/dist/ChipDismissible-cjs.js +4 -4
  14. package/dist/ChipDismissible-es.js +5 -5
  15. package/dist/Chips/InternalChipDismissible/hooks/useInView.d.ts +1 -1
  16. package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +1 -1
  17. package/dist/Chips/InternalChipDismissible/hooks/useScrollToActive.d.ts +1 -1
  18. package/dist/Combobox/Combobox.d.ts +2 -1
  19. package/dist/Combobox/Combobox.types.d.ts +2 -2
  20. package/dist/Combobox/ComboboxProvider.d.ts +1 -1
  21. package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +1 -1
  22. package/dist/Combobox/components/ComboboxContent/ComboboxContent.d.ts +2 -1
  23. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/ComboboxContentHeader.d.ts +2 -1
  24. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/ComboboxContentList.d.ts +2 -1
  25. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/ComboboxContentSearch.d.ts +2 -1
  26. package/dist/Combobox/hooks/useCombobox.d.ts +1 -1
  27. package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +2 -2
  28. package/dist/Combobox/hooks/useComboboxContent.d.ts +1 -1
  29. package/dist/ComboboxActivator-cjs.js +2 -2
  30. package/dist/ComboboxActivator-es.js +3 -3
  31. package/dist/ComboboxTrigger-cjs.js +1 -1
  32. package/dist/ComboboxTrigger-es.js +2 -2
  33. package/dist/DataList/DataList.types.d.ts +2 -2
  34. package/dist/DataList/DataList.utils.d.ts +1 -1
  35. package/dist/DataList/components/DataListHeaderTile/components/DataListSortingOptions.d.ts +2 -2
  36. package/dist/DataList/components/DataListItem/DataListItemInternal.d.ts +2 -1
  37. package/dist/DataList.utils-cjs.js +2 -0
  38. package/dist/DataList.utils-es.js +2 -0
  39. package/dist/DataListActions-cjs.js +10 -3
  40. package/dist/DataListActions-es.js +10 -3
  41. package/dist/DataListItem-cjs.js +2 -0
  42. package/dist/DataListItem-es.js +2 -0
  43. package/dist/DataListSort-cjs.js +1 -1
  44. package/dist/DataListSort-es.js +2 -2
  45. package/dist/DataTable/SortIcon.d.ts +2 -1
  46. package/dist/DataTable/components/DataTableSortableHeader.d.ts +1 -1
  47. package/dist/DatePicker/useFocusOnSelectedDate.d.ts +1 -2
  48. package/dist/DatePicker-cjs.js +1 -1
  49. package/dist/DatePicker-es.js +1 -1
  50. package/dist/FormField/FormFieldAffix.d.ts +1 -1
  51. package/dist/FormField/FormFieldTypes.d.ts +3 -3
  52. package/dist/FormField/hooks/useFormFieldFocus.d.ts +1 -1
  53. package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +2 -2
  54. package/dist/FormField-cjs.js +2 -2
  55. package/dist/FormField-es.js +2 -2
  56. package/dist/InputGroup-cjs.js +1 -0
  57. package/dist/InputGroup-es.js +1 -0
  58. package/dist/InputText/InputText.d.ts +2 -2
  59. package/dist/InputText/useInputTextActions.d.ts +1 -1
  60. package/dist/InputText/useInputTextFormField.d.ts +15 -1
  61. package/dist/InputText/useTextAreaResize.d.ts +2 -2
  62. package/dist/InternalChipDismissible-cjs.js +3 -3
  63. package/dist/InternalChipDismissible-es.js +4 -4
  64. package/dist/Menu-cjs.js +2 -0
  65. package/dist/Menu-es.js +2 -0
  66. package/dist/MultiSelect-cjs.js +13 -7
  67. package/dist/MultiSelect-es.js +13 -7
  68. package/dist/RadioGroup-cjs.js +7 -1
  69. package/dist/RadioGroup-es.js +7 -1
  70. package/dist/StatusLabel/StatusLabel.d.ts +2 -1
  71. package/dist/Tabs/hooks/useTabsOverflow.d.ts +2 -2
  72. package/dist/Tabs-cjs.js +4 -2
  73. package/dist/Tabs-es.js +4 -2
  74. package/dist/Tooltip/useTooltipPositioning.d.ts +1 -1
  75. package/dist/helpers-cjs.js +1 -0
  76. package/dist/helpers-es.js +1 -0
  77. package/dist/index.cjs +1 -1
  78. package/dist/showToast-cjs.js +2 -2
  79. package/dist/showToast-es.js +2 -2
  80. package/dist/useChildComponent-cjs.js +1 -1
  81. package/dist/useChildComponent-es.js +1 -1
  82. package/package.json +2 -2
@@ -231,26 +231,18 @@ interface AutocompleteRebuiltBaseProps<Value extends OptionLike, Multiple extend
231
231
  */
232
232
  readonly multiple?: Multiple;
233
233
  /**
234
- * The currently selected value of the Autocomplete (controlled mode).
235
- * Single-select: undefined indicates no selection.
236
- * If omitted, the component manages its own value state (uncontrolled mode).
234
+ * The currently selected value of the Autocomplete.
235
+ * Single-select: undefined indicates no selection
237
236
  */
238
- readonly value?: AutocompleteValue<Value, Multiple>;
237
+ readonly value: AutocompleteValue<Value, Multiple>;
239
238
  /**
240
- * The initial value for uncontrolled mode.
241
- * Only used when value is not provided.
239
+ * The current input value of the Autocomplete.
242
240
  */
243
- readonly defaultValue?: AutocompleteValue<Value, Multiple>;
244
- /**
245
- * The current input value of the Autocomplete (controlled mode).
246
- * If omitted, the component manages its own input state based on the selected value.
247
- */
248
- readonly inputValue?: string;
241
+ readonly inputValue: string;
249
242
  /**
250
243
  * Callback invoked when the input value changes.
251
- * If omitted, the component manages its own input state based on the selected value.
252
244
  */
253
- readonly onInputChange?: (value: string) => void;
245
+ readonly onInputChange: (value: string) => void;
254
246
  /**
255
247
  * Callback invoked when the input is blurred.
256
248
  */
@@ -462,17 +454,20 @@ interface FreeFormOff<Value extends OptionLike, Multiple extends boolean> {
462
454
  readonly allowFreeForm?: false;
463
455
  /**
464
456
  * Callback invoked when the selection value changes.
465
- * Optional when value is not provided (uncontrolled mode).
466
457
  */
467
- readonly onChange?: (value: AutocompleteValue<Value, Multiple>) => void;
458
+ readonly onChange: (value: AutocompleteValue<Value, Multiple>) => void;
468
459
  }
469
460
  interface FreeFormOn<Value extends OptionLike, Multiple extends boolean> {
470
461
  /**
462
+ * Whether the autocomplete allows free-form input.
463
+ * When true, the input value is not restricted to the options * in the menu. Input can be used to create a new value.
464
+ * When false, the input value must match an option in the menu.
465
+ * Input value will be cleared if no selection is made and
471
466
  * Whether the autocomplete allows free-form input.
472
467
  * When true, the input value is not restricted to the options in the menu. Input can be used to create a new value.
473
468
  * When false, the input value must match an option in the menu.
474
469
  * Input value will be cleared if no selection is made and focus is lost.
475
- */
470
+ * */
476
471
  readonly allowFreeForm: true;
477
472
  /**
478
473
  * Factory used to create a Value from free-form input when committing. Necessary with complex option values. The only value the input can produce is a string.
@@ -489,9 +484,8 @@ interface FreeFormOn<Value extends OptionLike, Multiple extends boolean> {
489
484
  * - The user selects an option with click or enter
490
485
  * - The user types a value that matches an option
491
486
  * - The user types a value that does not match an option and allowFreeForm is true
492
- * Optional when value is not provided (uncontrolled mode).
493
487
  */
494
- readonly onChange?: (value: AutocompleteValue<Value, Multiple>) => void;
488
+ readonly onChange: (value: AutocompleteValue<Value, Multiple>) => void;
495
489
  }
496
490
  export type ActionOrigin = "menu" | "empty";
497
491
  export type AutocompleteRebuiltProps<Value extends OptionLike = OptionLike, Multiple extends boolean = false, SectionExtra extends object = ExtraProps, ActionExtra extends object = ExtraProps> = AutocompleteRebuiltBaseProps<Value, Multiple, SectionExtra, ActionExtra> & (FreeFormOn<Value, Multiple> | FreeFormOff<Value, Multiple>);
@@ -224,50 +224,13 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
224
224
  // interactions and state transitions.
225
225
  // eslint-disable-next-line max-statements
226
226
  function useAutocomplete(props) {
227
- const { menu, emptyActions, getOptionLabel: getOptionLabelProp, isOptionEqualToValue, inputValue: inputValueProp, onInputChange: onInputChangeProp, value: valueProp, defaultValue, onChange: onChangeProp, multiple, openOnFocus = true, readOnly = false, debounce: debounceMs = 300, } = props;
228
- // Internal state for uncontrolled value
229
- const [internalValue, setInternalValue] = React.useState(defaultValue);
230
- // Use controlled value if provided, otherwise use internal state
231
- const value = valueProp !== undefined ? valueProp : internalValue;
232
- const onChange = onChangeProp !== null && onChangeProp !== void 0 ? onChangeProp : setInternalValue;
227
+ const { menu, emptyActions, getOptionLabel: getOptionLabelProp, isOptionEqualToValue, inputValue, onInputChange, value, onChange, multiple, openOnFocus = true, readOnly = false, debounce: debounceMs = 300, } = props;
233
228
  // TODO: Clean up the types in these refs by enhancing the type system in useCallbackRef
234
229
  const getOptionLabelPropRef = jobberHooks.useCallbackRef((opt) => getOptionLabelProp === null || getOptionLabelProp === void 0 ? void 0 : getOptionLabelProp(opt));
235
230
  const getOptionLabel = React.useCallback((opt) => {
236
231
  const maybe = getOptionLabelPropRef(opt);
237
232
  return maybe !== null && maybe !== void 0 ? maybe : opt.label;
238
233
  }, [getOptionLabelPropRef]);
239
- // Initialize internal input value from defaultValue
240
- const [internalInputValue, setInternalInputValue] = React.useState(() => {
241
- if (multiple)
242
- return "";
243
- const initialValue = (defaultValue !== null && defaultValue !== void 0 ? defaultValue : valueProp);
244
- if (!initialValue)
245
- return "";
246
- // Call getOptionLabelProp directly if provided, otherwise use label
247
- const customLabel = getOptionLabelProp === null || getOptionLabelProp === void 0 ? void 0 : getOptionLabelProp(initialValue);
248
- return customLabel !== null && customLabel !== void 0 ? customLabel : initialValue.label;
249
- });
250
- // Track previous value to detect when it changes
251
- const prevValueRef = React.useRef(value);
252
- // Sync internal input value with selected value only when value changes (not on user input)
253
- React.useEffect(() => {
254
- const isInputControlled = inputValueProp !== undefined;
255
- if (isInputControlled || multiple)
256
- return;
257
- // Only update if the value actually changed
258
- if (prevValueRef.current !== value) {
259
- prevValueRef.current = value;
260
- const currentValue = value;
261
- // Mark this as a programmatic change, not user input
262
- // This prevents onChange from being called when we sync from prop changes
263
- lastInputWasUser.current = false;
264
- setInternalInputValue(currentValue ? getOptionLabel(currentValue) : "");
265
- }
266
- }, [value, inputValueProp, multiple, getOptionLabel]);
267
- // Use controlled inputValue if provided, otherwise use internal state
268
- const isInputControlled = inputValueProp !== undefined;
269
- const inputValue = isInputControlled ? inputValueProp : internalInputValue;
270
- const onInputChange = onInputChangeProp !== null && onInputChangeProp !== void 0 ? onInputChangeProp : setInternalInputValue;
271
234
  const isOptionEqualToValueRef = jobberHooks.useCallbackRef((a, b) => isOptionEqualToValue === null || isOptionEqualToValue === void 0 ? void 0 : isOptionEqualToValue(a, b));
272
235
  const equals = React.useCallback((a, b) => {
273
236
  const custom = isOptionEqualToValueRef(a, b);
@@ -359,8 +322,9 @@ function useAutocomplete(props) {
359
322
  // This is only options
360
323
  const optionCount = renderable.reduce((count, item) => count + (item.kind === "option" ? 1 : 0), 0);
361
324
  const hasSelection = React.useMemo(() => {
325
+ var _a;
362
326
  if (multiple) {
363
- const current = value !== null && value !== void 0 ? value : [];
327
+ const current = (_a = value) !== null && _a !== void 0 ? _a : [];
364
328
  return Array.isArray(current) && current.length > 0;
365
329
  }
366
330
  return value != null;
@@ -415,15 +379,11 @@ function useAutocomplete(props) {
415
379
  // In multiple mode, clearing the input should NOT clear the selection
416
380
  if (multiple)
417
381
  return;
418
- // Only clear the selection if the user actually cleared the input
419
- // (not from internal state sync when parent changes the value prop)
420
- // This prevents calling onChange when we're syncing state from a controlled value prop,
421
- // but still allows onChange to fire when the user deletes the input text
422
- const currentlyHasSelection = value != null;
423
- if (lastInputWasUser.current && currentlyHasSelection) {
382
+ // For single-select, treat clearing input as clearing the selection
383
+ if (hasSelection) {
424
384
  onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
425
385
  }
426
- }, [inputValue, multiple, setActiveIndex, onChange, open, value]);
386
+ }, [inputValue, multiple, hasSelection, setActiveIndex, onChange, open]);
427
387
  function selectOption(option) {
428
388
  var _a;
429
389
  if (multiple) {
@@ -526,7 +486,7 @@ function useAutocomplete(props) {
526
486
  const freeFormCreated = (_a = props.createFreeFormValue) === null || _a === void 0 ? void 0 : _a.call(props, inputText);
527
487
  if (!freeFormCreated)
528
488
  return false;
529
- onChange(freeFormCreated);
489
+ props.onChange(freeFormCreated);
530
490
  return true;
531
491
  }
532
492
  const tryRestoreInputToSelectedLabel = React.useCallback(() => {
@@ -706,7 +666,6 @@ function useAutocomplete(props) {
706
666
  activeIndex,
707
667
  setActiveIndex,
708
668
  listRef,
709
- inputValue,
710
669
  // actions
711
670
  onSelection,
712
671
  onAction,
@@ -944,8 +903,8 @@ const AutocompleteRebuilt = React.forwardRef(AutocompleteRebuiltInternal);
944
903
  // eslint-disable-next-line max-statements
945
904
  function AutocompleteRebuiltInternal(props, forwardedRef) {
946
905
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
947
- const { placeholder, disabled, error, invalid, description, size: sizeProp, loading = false, } = props;
948
- const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef, inputValue, onSelection, onAction, onInputChangeFromUser, onInputBlur, onInputFocus, onInputKeyDown, setReferenceElement, } = useAutocomplete(props);
906
+ const { inputValue, placeholder, disabled, error, invalid, description, size: sizeProp, loading = false, } = props;
907
+ const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef, onSelection, onAction, onInputChangeFromUser, onInputBlur, onInputFocus, onInputKeyDown, setReferenceElement, } = useAutocomplete(props);
949
908
  const listboxId = React.useId();
950
909
  // Provides mount/unmount-aware transition styles for the floating element
951
910
  const { isMounted, styles: transitionStyles } = floatingUi_react.useTransitionStyles(context, {
@@ -961,7 +920,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
961
920
  onFocus: onInputFocus,
962
921
  onBlur: onInputBlur,
963
922
  });
964
- const inputProps = Object.assign(Object.assign(Object.assign(Object.assign({ version: 2, value: inputValue !== null && inputValue !== void 0 ? inputValue : "", onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
923
+ const inputProps = Object.assign(Object.assign(Object.assign(Object.assign({ version: 2, value: inputValue, onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
965
924
  disabled, readOnly: props.readOnly, error: error !== null && error !== void 0 ? error : undefined, name: props.name, invalid, autoComplete: "off", description, size: sizeProp ? sizeProp : undefined, prefix: props.prefix, suffix: props.suffix }), (props.readOnly ? {} : composedReferenceProps)), { role: "combobox", "aria-autocomplete": "list", "aria-expanded": open ? true : false, "aria-controls": listboxId, "aria-activedescendant": open && activeIndex != null
966
925
  ? `${listboxId}-item-${activeIndex}`
967
926
  : undefined });
@@ -222,50 +222,13 @@ function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose,
222
222
  // interactions and state transitions.
223
223
  // eslint-disable-next-line max-statements
224
224
  function useAutocomplete(props) {
225
- const { menu, emptyActions, getOptionLabel: getOptionLabelProp, isOptionEqualToValue, inputValue: inputValueProp, onInputChange: onInputChangeProp, value: valueProp, defaultValue, onChange: onChangeProp, multiple, openOnFocus = true, readOnly = false, debounce: debounceMs = 300, } = props;
226
- // Internal state for uncontrolled value
227
- const [internalValue, setInternalValue] = useState(defaultValue);
228
- // Use controlled value if provided, otherwise use internal state
229
- const value = valueProp !== undefined ? valueProp : internalValue;
230
- const onChange = onChangeProp !== null && onChangeProp !== void 0 ? onChangeProp : setInternalValue;
225
+ const { menu, emptyActions, getOptionLabel: getOptionLabelProp, isOptionEqualToValue, inputValue, onInputChange, value, onChange, multiple, openOnFocus = true, readOnly = false, debounce: debounceMs = 300, } = props;
231
226
  // TODO: Clean up the types in these refs by enhancing the type system in useCallbackRef
232
227
  const getOptionLabelPropRef = useCallbackRef((opt) => getOptionLabelProp === null || getOptionLabelProp === void 0 ? void 0 : getOptionLabelProp(opt));
233
228
  const getOptionLabel = useCallback((opt) => {
234
229
  const maybe = getOptionLabelPropRef(opt);
235
230
  return maybe !== null && maybe !== void 0 ? maybe : opt.label;
236
231
  }, [getOptionLabelPropRef]);
237
- // Initialize internal input value from defaultValue
238
- const [internalInputValue, setInternalInputValue] = useState(() => {
239
- if (multiple)
240
- return "";
241
- const initialValue = (defaultValue !== null && defaultValue !== void 0 ? defaultValue : valueProp);
242
- if (!initialValue)
243
- return "";
244
- // Call getOptionLabelProp directly if provided, otherwise use label
245
- const customLabel = getOptionLabelProp === null || getOptionLabelProp === void 0 ? void 0 : getOptionLabelProp(initialValue);
246
- return customLabel !== null && customLabel !== void 0 ? customLabel : initialValue.label;
247
- });
248
- // Track previous value to detect when it changes
249
- const prevValueRef = useRef(value);
250
- // Sync internal input value with selected value only when value changes (not on user input)
251
- useEffect(() => {
252
- const isInputControlled = inputValueProp !== undefined;
253
- if (isInputControlled || multiple)
254
- return;
255
- // Only update if the value actually changed
256
- if (prevValueRef.current !== value) {
257
- prevValueRef.current = value;
258
- const currentValue = value;
259
- // Mark this as a programmatic change, not user input
260
- // This prevents onChange from being called when we sync from prop changes
261
- lastInputWasUser.current = false;
262
- setInternalInputValue(currentValue ? getOptionLabel(currentValue) : "");
263
- }
264
- }, [value, inputValueProp, multiple, getOptionLabel]);
265
- // Use controlled inputValue if provided, otherwise use internal state
266
- const isInputControlled = inputValueProp !== undefined;
267
- const inputValue = isInputControlled ? inputValueProp : internalInputValue;
268
- const onInputChange = onInputChangeProp !== null && onInputChangeProp !== void 0 ? onInputChangeProp : setInternalInputValue;
269
232
  const isOptionEqualToValueRef = useCallbackRef((a, b) => isOptionEqualToValue === null || isOptionEqualToValue === void 0 ? void 0 : isOptionEqualToValue(a, b));
270
233
  const equals = useCallback((a, b) => {
271
234
  const custom = isOptionEqualToValueRef(a, b);
@@ -357,8 +320,9 @@ function useAutocomplete(props) {
357
320
  // This is only options
358
321
  const optionCount = renderable.reduce((count, item) => count + (item.kind === "option" ? 1 : 0), 0);
359
322
  const hasSelection = useMemo(() => {
323
+ var _a;
360
324
  if (multiple) {
361
- const current = value !== null && value !== void 0 ? value : [];
325
+ const current = (_a = value) !== null && _a !== void 0 ? _a : [];
362
326
  return Array.isArray(current) && current.length > 0;
363
327
  }
364
328
  return value != null;
@@ -413,15 +377,11 @@ function useAutocomplete(props) {
413
377
  // In multiple mode, clearing the input should NOT clear the selection
414
378
  if (multiple)
415
379
  return;
416
- // Only clear the selection if the user actually cleared the input
417
- // (not from internal state sync when parent changes the value prop)
418
- // This prevents calling onChange when we're syncing state from a controlled value prop,
419
- // but still allows onChange to fire when the user deletes the input text
420
- const currentlyHasSelection = value != null;
421
- if (lastInputWasUser.current && currentlyHasSelection) {
380
+ // For single-select, treat clearing input as clearing the selection
381
+ if (hasSelection) {
422
382
  onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
423
383
  }
424
- }, [inputValue, multiple, setActiveIndex, onChange, open, value]);
384
+ }, [inputValue, multiple, hasSelection, setActiveIndex, onChange, open]);
425
385
  function selectOption(option) {
426
386
  var _a;
427
387
  if (multiple) {
@@ -524,7 +484,7 @@ function useAutocomplete(props) {
524
484
  const freeFormCreated = (_a = props.createFreeFormValue) === null || _a === void 0 ? void 0 : _a.call(props, inputText);
525
485
  if (!freeFormCreated)
526
486
  return false;
527
- onChange(freeFormCreated);
487
+ props.onChange(freeFormCreated);
528
488
  return true;
529
489
  }
530
490
  const tryRestoreInputToSelectedLabel = useCallback(() => {
@@ -704,7 +664,6 @@ function useAutocomplete(props) {
704
664
  activeIndex,
705
665
  setActiveIndex,
706
666
  listRef,
707
- inputValue,
708
667
  // actions
709
668
  onSelection,
710
669
  onAction,
@@ -942,8 +901,8 @@ const AutocompleteRebuilt = forwardRef(AutocompleteRebuiltInternal);
942
901
  // eslint-disable-next-line max-statements
943
902
  function AutocompleteRebuiltInternal(props, forwardedRef) {
944
903
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
945
- const { placeholder, disabled, error, invalid, description, size: sizeProp, loading = false, } = props;
946
- const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef, inputValue, onSelection, onAction, onInputChangeFromUser, onInputBlur, onInputFocus, onInputKeyDown, setReferenceElement, } = useAutocomplete(props);
904
+ const { inputValue, placeholder, disabled, error, invalid, description, size: sizeProp, loading = false, } = props;
905
+ const { renderable, optionCount, persistentsHeaders, persistentsFooters, headerInteractiveCount, middleNavigableCount, getOptionLabel, isOptionSelected, refs, floatingStyles, context, getReferenceProps, getFloatingProps, getItemProps, activeIndex, open, listRef, onSelection, onAction, onInputChangeFromUser, onInputBlur, onInputFocus, onInputKeyDown, setReferenceElement, } = useAutocomplete(props);
947
906
  const listboxId = React__default.useId();
948
907
  // Provides mount/unmount-aware transition styles for the floating element
949
908
  const { isMounted, styles: transitionStyles } = useTransitionStyles(context, {
@@ -959,7 +918,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
959
918
  onFocus: onInputFocus,
960
919
  onBlur: onInputBlur,
961
920
  });
962
- const inputProps = Object.assign(Object.assign(Object.assign(Object.assign({ version: 2, value: inputValue !== null && inputValue !== void 0 ? inputValue : "", onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
921
+ const inputProps = Object.assign(Object.assign(Object.assign(Object.assign({ version: 2, value: inputValue, onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
963
922
  disabled, readOnly: props.readOnly, error: error !== null && error !== void 0 ? error : undefined, name: props.name, invalid, autoComplete: "off", description, size: sizeProp ? sizeProp : undefined, prefix: props.prefix, suffix: props.suffix }), (props.readOnly ? {} : composedReferenceProps)), { role: "combobox", "aria-autocomplete": "list", "aria-expanded": open ? true : false, "aria-controls": listboxId, "aria-activedescendant": open && activeIndex != null
964
923
  ? `${listboxId}-item-${activeIndex}`
965
924
  : undefined });
@@ -36,20 +36,3 @@ export declare function FreeFormWrapper({ initialValue, initialInputValue, onCha
36
36
  readonly inputEqualsOption?: (input: string, option: OptionLike) => boolean;
37
37
  readonly debounce?: number;
38
38
  }): React.JSX.Element;
39
- export declare function UncontrolledWrapper<T extends OptionLike>({ defaultValue, menu, placeholder, }: {
40
- readonly defaultValue?: T;
41
- readonly menu: MenuItem<T>[];
42
- readonly placeholder?: string;
43
- }): React.JSX.Element;
44
- export declare function SemiControlledWrapper<T extends OptionLike>({ initialValue, onChange, menu, placeholder, }: {
45
- readonly initialValue?: T;
46
- readonly onChange?: (v: T | undefined) => void;
47
- readonly menu: MenuItem<T>[];
48
- readonly placeholder?: string;
49
- }): React.JSX.Element;
50
- export declare function ControlledValueWrapper<T extends OptionLike>({ value, onChange, menu, placeholder, }: {
51
- readonly value: T | undefined;
52
- readonly onChange: (v: T | undefined) => void;
53
- readonly menu: MenuItem<T>[];
54
- readonly placeholder?: string;
55
- }): React.JSX.Element;
@@ -56,7 +56,6 @@ export declare function useAutocomplete<Value extends OptionLike, Multiple exten
56
56
  activeIndex: number | null;
57
57
  setActiveIndex: (index: number | null) => void;
58
58
  listRef: React.MutableRefObject<(HTMLElement | null)[]>;
59
- inputValue: string;
60
59
  onSelection: (option: Value) => void;
61
60
  onAction: (action: ActionConfig) => void;
62
61
  onInputChangeFromUser: (val: string) => void;
package/dist/Card-cjs.js CHANGED
@@ -19,7 +19,7 @@ const SPACEBAR_KEY = " ";
19
19
  * Please use `<Card onClick={onClick} />` component instead.
20
20
  */
21
21
  function CardClickable({ className, onClick, children, UNSAFE_style = {}, }) {
22
- const cardRef = React.useRef();
22
+ const cardRef = React.useRef(null);
23
23
  return (React.createElement("div", { ref: cardRef, "data-testid": "clickable-card", className: className, style: UNSAFE_style, onClick: onClick, onKeyUp: handleKeyup, onKeyDown: handleKeyDown, role: "button", tabIndex: 0 }, children));
24
24
  function isCardFocused() {
25
25
  return document.activeElement === cardRef.current;
package/dist/Card-es.js CHANGED
@@ -17,7 +17,7 @@ const SPACEBAR_KEY = " ";
17
17
  * Please use `<Card onClick={onClick} />` component instead.
18
18
  */
19
19
  function CardClickable({ className, onClick, children, UNSAFE_style = {}, }) {
20
- const cardRef = useRef();
20
+ const cardRef = useRef(null);
21
21
  return (React__default.createElement("div", { ref: cardRef, "data-testid": "clickable-card", className: className, style: UNSAFE_style, onClick: onClick, onKeyUp: handleKeyup, onKeyDown: handleKeyDown, role: "button", tabIndex: 0 }, children));
22
22
  function isCardFocused() {
23
23
  return document.activeElement === cardRef.current;
@@ -2,8 +2,7 @@ import React from "react";
2
2
  import { ChipPrefix } from "./components/ChipPrefix/Chip.Prefix";
3
3
  import { ChipSuffix } from "./components/ChipSuffix/Chip.Suffix";
4
4
  import type { ChipProps } from "./Chip.types";
5
- declare const ChipNamespace: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLDivElement | HTMLButtonElement>> & {
5
+ export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLDivElement | HTMLButtonElement>> & {
6
6
  Prefix: typeof ChipPrefix;
7
7
  Suffix: typeof ChipSuffix;
8
8
  };
9
- export { ChipNamespace as Chip };
@@ -1,8 +1,9 @@
1
- import type { ReactNode } from "react";
1
+ import type { ReactElement, ReactNode } from "react";
2
+ import React from "react";
2
3
  /**
3
4
  * Returns the first React Child that receives `true` from isCorrectComponent
4
5
  * @param children React Children
5
- * @param isCorrectComponent a function that accepts a JSX Element and returns a boolean.
6
+ * @param isCorrectComponent a function that accepts a ReactElement and returns a boolean.
6
7
  * @returns The first child component that returns true on isCorrectComponent
7
8
  */
8
- export declare function useChildComponent(children: ReactNode | undefined, isCorrectComponent: (toCheck: JSX.Element) => boolean): JSX.Element | undefined;
9
+ export declare function useChildComponent(children: ReactNode | undefined, isCorrectComponent: (toCheck: ReactElement) => boolean): ReactElement<unknown, string | React.JSXElementConstructor<any>> | undefined;
@@ -20,6 +20,6 @@ require('../tslib.es6-cjs.js');
20
20
 
21
21
 
22
22
 
23
- exports.Chip = Chip.ChipNamespace;
23
+ exports.Chip = Chip.Chip;
24
24
  exports.ChipDismissible = ChipDismissible.ChipDismissible;
25
25
  exports.ChipSelectable = ChipDismissible.ChipSelectable;
package/dist/Chip-cjs.js CHANGED
@@ -21,14 +21,15 @@ function ChipPrefix({ children }) {
21
21
  var styles = {"wrapper":"NLNJBhRffp4-","input":"ulLzwMsQL3U-","inactive":"_3LLjp8oIxJ0-","invalid":"H7VZzUBkgjk-","disabled":"-yQxZSnxBBU-","button":"ngKOY8l4BG4-","icon":"rzbiB2nz36Q-","spinning":"X7Bx5CDPfDs-"};
22
22
 
23
23
  function InternalChipButton({ icon, invalid, disabled, label, onClick, }) {
24
- const buttonRef = React.useRef();
24
+ const buttonRef = React.useRef(null);
25
25
  return (React.createElement("div", { ref: buttonRef, className: styles.button, tabIndex: 0, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onClick: handleClick, role: "button", "aria-label": `Remove ${label}`, "aria-hidden": disabled, "aria-disabled": disabled, "data-testid": "remove-chip-button" },
26
26
  React.createElement(Icon.Icon, { size: "small", name: icon, color: getColor() })));
27
27
  function handleKeyUp(event) {
28
+ var _a;
28
29
  if (document.activeElement === buttonRef.current &&
29
30
  (event.key === " " || event.key === "Enter")) {
30
31
  event.stopPropagation();
31
- buttonRef.current.click();
32
+ (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.click();
32
33
  }
33
34
  }
34
35
  function handleKeyDown(event) {
@@ -124,12 +125,12 @@ function getTooltipMessage(labelFullyVisible, headingFullyVisible, label, headin
124
125
  return message;
125
126
  }
126
127
  ChipComponent.displayName = "Chip";
127
- const ChipNamespace = Object.assign(ChipComponent, {
128
+ const Chip = Object.assign(ChipComponent, {
128
129
  Prefix: ChipPrefix,
129
130
  Suffix: ChipSuffix,
130
131
  });
131
132
 
132
- exports.ChipNamespace = ChipNamespace;
133
+ exports.Chip = Chip;
133
134
  exports.InternalChipButton = InternalChipButton;
134
135
  exports.styles = styles$1;
135
136
  exports.styles$1 = styles;
package/dist/Chip-es.js CHANGED
@@ -19,14 +19,15 @@ function ChipPrefix({ children }) {
19
19
  var styles = {"wrapper":"NLNJBhRffp4-","input":"ulLzwMsQL3U-","inactive":"_3LLjp8oIxJ0-","invalid":"H7VZzUBkgjk-","disabled":"-yQxZSnxBBU-","button":"ngKOY8l4BG4-","icon":"rzbiB2nz36Q-","spinning":"X7Bx5CDPfDs-"};
20
20
 
21
21
  function InternalChipButton({ icon, invalid, disabled, label, onClick, }) {
22
- const buttonRef = useRef();
22
+ const buttonRef = useRef(null);
23
23
  return (React__default.createElement("div", { ref: buttonRef, className: styles.button, tabIndex: 0, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onClick: handleClick, role: "button", "aria-label": `Remove ${label}`, "aria-hidden": disabled, "aria-disabled": disabled, "data-testid": "remove-chip-button" },
24
24
  React__default.createElement(Icon, { size: "small", name: icon, color: getColor() })));
25
25
  function handleKeyUp(event) {
26
+ var _a;
26
27
  if (document.activeElement === buttonRef.current &&
27
28
  (event.key === " " || event.key === "Enter")) {
28
29
  event.stopPropagation();
29
- buttonRef.current.click();
30
+ (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.click();
30
31
  }
31
32
  }
32
33
  function handleKeyDown(event) {
@@ -122,9 +123,9 @@ function getTooltipMessage(labelFullyVisible, headingFullyVisible, label, headin
122
123
  return message;
123
124
  }
124
125
  ChipComponent.displayName = "Chip";
125
- const ChipNamespace = Object.assign(ChipComponent, {
126
+ const Chip = Object.assign(ChipComponent, {
126
127
  Prefix: ChipPrefix,
127
128
  Suffix: ChipSuffix,
128
129
  });
129
130
 
130
- export { ChipNamespace as C, InternalChipButton as I, styles as a, styles$1 as s };
131
+ export { Chip as C, InternalChipButton as I, styles as a, styles$1 as s };
@@ -7,14 +7,14 @@ var Chip = require('./Chip-cjs.js');
7
7
 
8
8
  function ChipSelectable(_a) {
9
9
  var { selected } = _a, rest = tslib_es6.__rest(_a, ["selected"]);
10
- return (React.createElement(Chip.ChipNamespace, Object.assign({}, rest),
11
- React.createElement(Chip.ChipNamespace.Suffix, { className: selected ? Chip.styles.selected : "" },
10
+ return (React.createElement(Chip.Chip, Object.assign({}, rest),
11
+ React.createElement(Chip.Chip.Suffix, { className: selected ? Chip.styles.selected : "" },
12
12
  React.createElement(Icon.Icon, { name: selected ? "checkmark" : "add", size: "small", color: "interactiveSubtle" }))));
13
13
  }
14
14
 
15
15
  function ChipDismissible(props) {
16
- return (React.createElement(Chip.ChipNamespace, Object.assign({}, props),
17
- React.createElement(Chip.ChipNamespace.Suffix, null,
16
+ return (React.createElement(Chip.Chip, Object.assign({}, props),
17
+ React.createElement(Chip.Chip.Suffix, null,
18
18
  React.createElement(Icon.Icon, { name: "cross", size: "small", color: "interactiveSubtle" }))));
19
19
  }
20
20
 
@@ -1,18 +1,18 @@
1
1
  import { _ as __rest } from './tslib.es6-es.js';
2
2
  import React__default from 'react';
3
3
  import { I as Icon } from './Icon-es.js';
4
- import { C as ChipNamespace, s as styles } from './Chip-es.js';
4
+ import { C as Chip, s as styles } from './Chip-es.js';
5
5
 
6
6
  function ChipSelectable(_a) {
7
7
  var { selected } = _a, rest = __rest(_a, ["selected"]);
8
- return (React__default.createElement(ChipNamespace, Object.assign({}, rest),
9
- React__default.createElement(ChipNamespace.Suffix, { className: selected ? styles.selected : "" },
8
+ return (React__default.createElement(Chip, Object.assign({}, rest),
9
+ React__default.createElement(Chip.Suffix, { className: selected ? styles.selected : "" },
10
10
  React__default.createElement(Icon, { name: selected ? "checkmark" : "add", size: "small", color: "interactiveSubtle" }))));
11
11
  }
12
12
 
13
13
  function ChipDismissible(props) {
14
- return (React__default.createElement(ChipNamespace, Object.assign({}, props),
15
- React__default.createElement(ChipNamespace.Suffix, null,
14
+ return (React__default.createElement(Chip, Object.assign({}, props),
15
+ React__default.createElement(Chip.Suffix, null,
16
16
  React__default.createElement(Icon, { name: "cross", size: "small", color: "interactiveSubtle" }))));
17
17
  }
18
18
 
@@ -1,4 +1,4 @@
1
1
  export declare function useInView<T extends Element>(): {
2
- ref: import("react").RefObject<T>;
2
+ ref: import("react").RefObject<T | null>;
3
3
  isInView: boolean;
4
4
  };
@@ -8,7 +8,7 @@ export declare function useInternalChipDismissibleInput({ options, isLoadingMore
8
8
  searchValue: string;
9
9
  shouldCancelBlur: boolean;
10
10
  menuId: string;
11
- inputRef: React.RefObject<HTMLInputElement>;
11
+ inputRef: React.RefObject<HTMLInputElement | null>;
12
12
  activeOption: ChipDismissibleInputOptionProps;
13
13
  hasAvailableOptions: boolean;
14
14
  nextOptionIndex: number;
@@ -1 +1 @@
1
- export declare function useScrollToActive(index: number): import("react").MutableRefObject<HTMLDivElement | null>;
1
+ export declare function useScrollToActive(index: number): import("react").RefObject<HTMLDivElement | null>;
@@ -1,8 +1,9 @@
1
+ import React from "react";
1
2
  import type { ComboboxProps } from "./Combobox.types";
2
3
  import { ComboboxAction } from "./components/ComboboxAction";
3
4
  import { ComboboxOption as ComboboxOptionComponent } from "./components/ComboboxOption/ComboboxOption";
4
5
  import { ComboboxActivator } from "./components/ComboboxActivator";
5
- export declare function Combobox(props: ComboboxProps): JSX.Element;
6
+ export declare function Combobox(props: ComboboxProps): React.JSX.Element;
6
7
  export declare namespace Combobox {
7
8
  var Activator: typeof ComboboxActivator;
8
9
  var Action: typeof ComboboxAction;
@@ -165,7 +165,7 @@ export interface ComboboxContentProps {
165
165
  /**
166
166
  * Reference to the wrapping div element of all the Combobox pieces
167
167
  */
168
- readonly wrapperRef: React.RefObject<HTMLDivElement>;
168
+ readonly wrapperRef: React.RefObject<HTMLDivElement | null>;
169
169
  /**
170
170
  * Is the Combobox open
171
171
  */
@@ -235,7 +235,7 @@ export interface ComboboxListProps {
235
235
  /**
236
236
  * A ref to the list element.
237
237
  */
238
- readonly optionsListRef: React.RefObject<HTMLUListElement>;
238
+ readonly optionsListRef: React.RefObject<HTMLUListElement | null>;
239
239
  /**
240
240
  * The current search term. Used in the no results message.
241
241
  */
@@ -15,4 +15,4 @@ export interface ComboboxProviderProps {
15
15
  readonly onSelectAll?: (selection: ComboboxOption[]) => void;
16
16
  }
17
17
  export declare const ComboboxContext: React.Context<Omit<ComboboxProviderProps, "children">>;
18
- export declare function ComboboxContextProvider({ children, ...props }: ComboboxProviderProps): JSX.Element;
18
+ export declare function ComboboxContextProvider({ children, ...props }: ComboboxProviderProps): React.JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import type { ComboboxActivatorProps } from "../../Combobox.types";
3
- export declare function ComboboxActivator(props: ComboboxActivatorProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
3
+ export declare function ComboboxActivator(props: ComboboxActivatorProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
@@ -1,2 +1,3 @@
1
+ import React from "react";
1
2
  import type { ComboboxContentProps } from "../../Combobox.types";
2
- export declare function ComboboxContent(props: ComboboxContentProps): JSX.Element;
3
+ export declare function ComboboxContent(props: ComboboxContentProps): React.JSX.Element;
@@ -1,2 +1,3 @@
1
+ import React from "react";
1
2
  import type { ComboboxHeaderProps } from "../../../Combobox.types";
2
- export declare function ComboboxContentHeader(props: ComboboxHeaderProps): JSX.Element;
3
+ export declare function ComboboxContentHeader(props: ComboboxHeaderProps): React.JSX.Element;
@@ -1,2 +1,3 @@
1
+ import React from "react";
1
2
  import type { ComboboxListProps } from "../../../Combobox.types";
2
- export declare function ComboboxContentList(props: ComboboxListProps): JSX.Element;
3
+ export declare function ComboboxContentList(props: ComboboxListProps): React.JSX.Element;
@@ -1,2 +1,3 @@
1
+ import React from "react";
1
2
  import type { ComboboxSearchProps } from "../../../Combobox.types";
2
- export declare function ComboboxContentSearch(props: ComboboxSearchProps): JSX.Element;
3
+ export declare function ComboboxContentSearch(props: ComboboxSearchProps): React.JSX.Element;
@@ -3,7 +3,7 @@ import type React from "react";
3
3
  import type { UseMakeComboboxHandlersReturn } from "./useMakeComboboxHandlers";
4
4
  import { type ComboboxOption } from "../Combobox.types";
5
5
  type UseComboboxReturn = {
6
- wrapperRef: React.RefObject<HTMLDivElement>;
6
+ wrapperRef: React.RefObject<HTMLDivElement | null>;
7
7
  searchValue: string;
8
8
  setSearchValue: Dispatch<React.SetStateAction<string>>;
9
9
  open: boolean;
@@ -1,7 +1,7 @@
1
1
  import type { UseInteractionsReturn } from "@floating-ui/react";
2
2
  import { type ComboboxOption } from "../Combobox.types";
3
- export declare function useComboboxAccessibility(selectionCallback: (selection: ComboboxOption) => void, filteredOptions: ComboboxOption[], optionsListRef: React.RefObject<HTMLUListElement>, open: boolean, wrapperRef: React.RefObject<HTMLDivElement>): {
4
- floatingRef: React.RefObject<HTMLDivElement>;
3
+ export declare function useComboboxAccessibility(selectionCallback: (selection: ComboboxOption) => void, filteredOptions: ComboboxOption[], optionsListRef: React.RefObject<HTMLUListElement | null>, open: boolean, wrapperRef: React.RefObject<HTMLDivElement | null>): {
4
+ floatingRef: React.RefObject<HTMLDivElement | null>;
5
5
  floatingStyles: React.CSSProperties;
6
6
  floatingProps: ReturnType<UseInteractionsReturn["getFloatingProps"]>;
7
7
  nodeId?: string;
@@ -1,6 +1,6 @@
1
1
  import { type ComboboxOption } from "../Combobox.types";
2
2
  interface useComboboxContent {
3
- optionsListRef: React.RefObject<HTMLUListElement>;
3
+ optionsListRef: React.RefObject<HTMLUListElement | null>;
4
4
  onClear?: () => void;
5
5
  onSelectAll?: (selection: ComboboxOption[]) => void;
6
6
  }