@economic/taco 0.0.33-alpha.1 → 0.0.33-alpha.4

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.
@@ -3122,17 +3122,17 @@ const icons = {
3122
3122
  zoom: Zoom
3123
3123
  };
3124
3124
 
3125
- var _excluded = ["name"];
3126
- var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
3125
+ const Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
3127
3126
  var _props$className;
3128
3127
 
3129
- var name = props.name,
3130
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
3131
-
3132
- var Component = icons[name];
3128
+ const {
3129
+ name,
3130
+ ...otherProps
3131
+ } = props;
3132
+ const Component = icons[name];
3133
3133
  /* 24x24 _at the base body font_ - must be em so that they scale with font size - tailwind spacing uses rem */
3134
3134
 
3135
- var className = cn('inline-flex h-[1.715em] w-[1.715em]', props.className, {
3135
+ const className = cn('inline-flex h-[1.715em] w-[1.715em]', props.className, {
3136
3136
  'p-[3px]': (_props$className = props.className) === null || _props$className === void 0 ? void 0 : _props$className.includes('rounded-full')
3137
3137
  });
3138
3138
  return Component ? React__default.createElement(Component, Object.assign({}, otherProps, {
@@ -3144,7 +3144,7 @@ var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
3144
3144
  })) : null;
3145
3145
  });
3146
3146
 
3147
- var _excluded$1 = ["id"],
3147
+ var _excluded = ["id"],
3148
3148
  _excluded2 = ["id", "defaultId", "onChange", "as"];
3149
3149
  var AccordionContext = /*#__PURE__*/React__default.createContext({
3150
3150
  as: 'h2'
@@ -3182,7 +3182,7 @@ var Content = /*#__PURE__*/React__default.forwardRef(function AccordionContent(p
3182
3182
 
3183
3183
  var Item = function Item(props) {
3184
3184
  var id = props.id,
3185
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
3185
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
3186
3186
 
3187
3187
  return React__default.createElement(AccordionPrimitive.Item, Object.assign({}, otherProps, {
3188
3188
  value: id
@@ -3283,7 +3283,7 @@ const getOutlineClasses = state => {
3283
3283
  }
3284
3284
  };
3285
3285
 
3286
- var _excluded$2 = ["children", "compact", "outline", "state"];
3286
+ var _excluded$1 = ["children", "compact", "outline", "state"];
3287
3287
  var Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
3288
3288
  var _cn;
3289
3289
 
@@ -3293,7 +3293,7 @@ var Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
3293
3293
  _props$outline = props.outline,
3294
3294
  outline = _props$outline === void 0 ? false : _props$outline,
3295
3295
  state = props.state,
3296
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
3296
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
3297
3297
 
3298
3298
  var className = cn('rounded-full border font-bold text-xs uppercase overflow-hidden whitespace-nowrap inline-flex items-center justify-center h-5', (_cn = {}, _cn[getOutlineClasses(state)] = outline, _cn["border-transparent " + getStateClasses(state)] = !outline, _cn['h-2 w-2 min-w-0'] = compact, _cn['h-5 py-0 px-[0.354rem]'] = !compact, _cn), props.className);
3299
3299
  return React.createElement("span", Object.assign({}, otherProps, {
@@ -3453,14 +3453,13 @@ const createButton = (props, className, ref) => {
3453
3453
  return button;
3454
3454
  };
3455
3455
 
3456
- var _excluded$3 = ["icon", "rounded"];
3457
- var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
3458
- var icon = props.icon,
3459
- _props$rounded = props.rounded,
3460
- rounded = _props$rounded === void 0 ? false : _props$rounded,
3461
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$3);
3462
-
3463
- var className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
3456
+ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
3457
+ const {
3458
+ icon,
3459
+ rounded = false,
3460
+ ...otherProps
3461
+ } = props;
3462
+ const className = cn('w-8', getButtonClasses(), getAppearanceClasses(otherProps.appearance, true), {
3464
3463
  'rounded-full': rounded,
3465
3464
  rounded: !rounded,
3466
3465
  'cursor-not-allowed opacity-50': props.disabled,
@@ -3471,13 +3470,13 @@ var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
3471
3470
  return null;
3472
3471
  }
3473
3472
 
3474
- return createButton(_extends({}, otherProps, {
3473
+ return createButton({ ...otherProps,
3475
3474
  children: React.createElement(Icon, {
3476
3475
  name: icon,
3477
3476
  className: "m-0 p-0"
3478
3477
  }),
3479
3478
  'data-taco': 'icon-button'
3480
- }), className, ref);
3479
+ }, className, ref);
3481
3480
  });
3482
3481
 
3483
3482
  var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
@@ -3497,10 +3496,10 @@ var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
3497
3496
  }) : null);
3498
3497
  });
3499
3498
 
3500
- var _excluded$4 = ["fluid"];
3499
+ var _excluded$2 = ["fluid"];
3501
3500
  var Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
3502
3501
  var fluid = props.fluid,
3503
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$4);
3502
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
3504
3503
 
3505
3504
  var className = cn(getButtonClasses(), getAppearanceClasses(otherProps.appearance), 'rounded px-3', {
3506
3505
  'cursor-not-allowed opacity-50': props.disabled,
@@ -3978,7 +3977,7 @@ const Provider = props => {
3978
3977
  const useTaco = () => React.useContext(Context);
3979
3978
  const useLocalization = () => useTaco().localization;
3980
3979
 
3981
- var _excluded$5 = ["onChange", "value"];
3980
+ var _excluded$3 = ["onChange", "value"];
3982
3981
 
3983
3982
  var renderDay = function renderDay(day, modifiers) {
3984
3983
  return modifiers.disabled ? React.createElement("span", {
@@ -4057,7 +4056,7 @@ var Navbar = /*#__PURE__*/React.memo(function (_ref) {
4057
4056
  var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
4058
4057
  var handleChange = props.onChange,
4059
4058
  value = props.value,
4060
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$5);
4059
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$3);
4061
4060
 
4062
4061
  var _useLocalization2 = useLocalization(),
4063
4062
  locale = _useLocalization2.locale,
@@ -4121,7 +4120,7 @@ var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
4121
4120
  })));
4122
4121
  });
4123
4122
 
4124
- var _excluded$6 = ["checked", "highlighted", "indeterminate", "invalid", "label", "onChange"];
4123
+ var _excluded$4 = ["checked", "highlighted", "indeterminate", "invalid", "label", "onChange"];
4125
4124
  var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
4126
4125
  var checked = props.checked,
4127
4126
  highlighted = props.highlighted,
@@ -4129,7 +4128,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
4129
4128
  invalid = props.invalid,
4130
4129
  label = props.label,
4131
4130
  onChange = props.onChange,
4132
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$6);
4131
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$4);
4133
4132
 
4134
4133
  var className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem]', {
4135
4134
  'mr-2': !!label,
@@ -4580,12 +4579,11 @@ const setInputValueByRef = (input, value, event = 'change') => {
4580
4579
  input.dispatchEvent(createCustomEvent(event));
4581
4580
  };
4582
4581
 
4582
+ const getValue = value => String(value !== null && value !== void 0 ? value : '');
4583
+
4583
4584
  const setInputValueByRef$1 = (input, value, event = 'change') => {
4584
- setInputValueByRef(input, value !== undefined && value !== null ? String(value) : '', event);
4585
+ setInputValueByRef(input, getValue(value), event);
4585
4586
  };
4586
-
4587
- const getValue = value => value === undefined || value === null ? '' : String(value);
4588
-
4589
4587
  const getIndexFromValue = (data, value) => {
4590
4588
  const index = data.findIndex(option => getValue(option.value) === getValue(value));
4591
4589
  return index > -1 ? index : undefined;
@@ -4610,9 +4608,7 @@ const searchForString = (child, value, strategy = 'includes') => {
4610
4608
 
4611
4609
  return searchForString((_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.children, value, strategy);
4612
4610
  } else {
4613
- var _String;
4614
-
4615
- return child.toString().toLowerCase()[strategy]((_String = String(value)) === null || _String === void 0 ? void 0 : _String.toLowerCase());
4611
+ return child.toString().toLowerCase()[strategy](String(value).toLowerCase());
4616
4612
  }
4617
4613
  } catch {
4618
4614
  return false;
@@ -5046,12 +5042,12 @@ var useBoundingClientRectListener = function useBoundingClientRectListener(ref)
5046
5042
  return dimensions;
5047
5043
  };
5048
5044
 
5049
- var _excluded$7 = ["className", "dialog", "style"];
5045
+ var _excluded$5 = ["className", "dialog", "style"];
5050
5046
  var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5051
5047
  var externalClassName = props.className,
5052
5048
  dialog = props.dialog,
5053
5049
  style = props.style,
5054
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$7);
5050
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$5);
5055
5051
 
5056
5052
  var _useCombobox = useCombobox(otherProps, ref),
5057
5053
  combobox = _useCombobox.combobox,
@@ -5419,7 +5415,7 @@ Popover.Trigger = Trigger$1;
5419
5415
  Popover.Content = Content$1;
5420
5416
  Popover.Close = Close$1;
5421
5417
 
5422
- var _excluded$8 = ["className", "onReset", "style", "shortcuts", "shortcutsText"];
5418
+ var _excluded$6 = ["className", "onReset", "style", "shortcuts", "shortcutsText"];
5423
5419
  var Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
5424
5420
  var _input$disabled;
5425
5421
 
@@ -5428,7 +5424,7 @@ var Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
5428
5424
  style = props.style,
5429
5425
  shortcuts = props.shortcuts,
5430
5426
  shortcutsText = props.shortcutsText,
5431
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$8);
5427
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$6);
5432
5428
 
5433
5429
  var _useDatepicker = useDatepicker(otherProps, ref),
5434
5430
  calendar = _useDatepicker.calendar,
@@ -5723,7 +5719,7 @@ const Extra = /*#__PURE__*/React.forwardRef(function DialogExtra(props, ref) {
5723
5719
  });
5724
5720
  Extra.displayName = 'DialogExtra';
5725
5721
 
5726
- var _excluded$9 = ["children", "closeOnEscape", "defaultOpen", "draggable", "onChange", "onClose", "open", "showCloseButton", "size", "trigger"];
5722
+ var _excluded$7 = ["children", "closeOnEscape", "defaultOpen", "draggable", "onChange", "onClose", "open", "showCloseButton", "size", "trigger"];
5727
5723
 
5728
5724
  var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
5729
5725
  return React.useMemo(function () {
@@ -5760,7 +5756,7 @@ var Dialog = /*#__PURE__*/React.forwardRef(function Dialog(props, ref) {
5760
5756
  _props$size = props.size,
5761
5757
  size = _props$size === void 0 ? 'sm' : _props$size,
5762
5758
  trigger = props.trigger,
5763
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$9);
5759
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$7);
5764
5760
 
5765
5761
  var _useSeparatedChildren = useSeparatedChildren(initialChildren),
5766
5762
  children = _useSeparatedChildren[0],
@@ -5810,14 +5806,14 @@ Dialog.Extra = Extra;
5810
5806
  Dialog.Drawer = Drawer;
5811
5807
  Dialog.Close = Close$2;
5812
5808
 
5813
- var _excluded$a = ["disabled", "children", "invalid", "message"];
5809
+ var _excluded$8 = ["disabled", "children", "invalid", "message"];
5814
5810
  var Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
5815
5811
  var disabled = props.disabled,
5816
5812
  children = props.children,
5817
5813
  _props$invalid = props.invalid,
5818
5814
  invalid = _props$invalid === void 0 ? false : _props$invalid,
5819
5815
  message = props.message,
5820
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$a);
5816
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded$8);
5821
5817
 
5822
5818
  var className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
5823
5819
  'text-grey-dark': disabled
@@ -5837,13 +5833,12 @@ var Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
5837
5833
  }, message));
5838
5834
  });
5839
5835
 
5840
- var _excluded$b = ["horizontal"];
5841
- var Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
5842
- var _props$horizontal = props.horizontal,
5843
- horizontal = _props$horizontal === void 0 ? false : _props$horizontal,
5844
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$b);
5845
-
5846
- var className = cn('yt-form', {
5836
+ const Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
5837
+ const {
5838
+ horizontal = false,
5839
+ ...otherProps
5840
+ } = props;
5841
+ const className = cn('yt-form', {
5847
5842
  'yt-form--horizontal flex flex-wrap': horizontal
5848
5843
  }, props.className);
5849
5844
  return React.createElement("form", Object.assign({}, otherProps, {
@@ -5853,13 +5848,12 @@ var Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
5853
5848
  }));
5854
5849
  });
5855
5850
 
5856
- var _excluded$c = ["as"];
5857
- var Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
5858
- var _props$as = props.as,
5859
- Tag = _props$as === void 0 ? 'span' : _props$as,
5860
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$c);
5861
-
5862
- var className = cn('flex ', props.className);
5851
+ const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
5852
+ const {
5853
+ as: Tag = 'span',
5854
+ ...otherProps
5855
+ } = props;
5856
+ const className = cn('flex ', props.className);
5863
5857
  return React.createElement(Tag, Object.assign({}, otherProps, {
5864
5858
  className: className,
5865
5859
  "data-taco": "group",
@@ -5867,19 +5861,18 @@ var Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
5867
5861
  }));
5868
5862
  });
5869
5863
 
5870
- var _excluded$d = ["anchor", "children", "defaultOpen"];
5871
- var HangerContext = /*#__PURE__*/React.createContext({
5864
+ const HangerContext = /*#__PURE__*/React.createContext({
5872
5865
  props: {},
5873
5866
  ref: null
5874
5867
  });
5875
- var Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
5868
+ const Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
5876
5869
  var _props$children;
5877
5870
 
5878
- var context = React.useContext(HangerContext);
5879
- var children = props.children;
5871
+ const context = React.useContext(HangerContext);
5872
+ let children = props.children;
5880
5873
 
5881
5874
  if (React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
5882
- console.warn("Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '" + props.children.type.name + "' in React.forwardRef()? Taco has wrapped '" + props.children.type.name + "' in a 'span' to maintain functionality, but this may cause unintended behaviour");
5875
+ console.warn(`Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`);
5883
5876
  children = React.createElement("span", null, props.children);
5884
5877
  }
5885
5878
 
@@ -5889,15 +5882,14 @@ var Anchor = /*#__PURE__*/React.forwardRef(function HangerAnchor(props, ref) {
5889
5882
  asChild: true
5890
5883
  }));
5891
5884
  });
5892
- var Content$3 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
5893
- var context = React.useContext(HangerContext);
5894
-
5895
- var _useLocalization = useLocalization(),
5896
- texts = _useLocalization.texts;
5897
-
5898
- var className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent', props.className);
5885
+ const Content$3 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
5886
+ const context = React.useContext(HangerContext);
5887
+ const {
5888
+ texts
5889
+ } = useLocalization();
5890
+ const className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent', props.className);
5899
5891
 
5900
- var handleInteractOutside = function handleInteractOutside(event) {
5892
+ const handleInteractOutside = event => {
5901
5893
  event.preventDefault();
5902
5894
  };
5903
5895
 
@@ -5919,25 +5911,20 @@ var Content$3 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref)
5919
5911
  onClick: context.props.onClose
5920
5912
  })));
5921
5913
  });
5922
- var Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
5923
- var anchor = props.anchor,
5924
- children = props.children,
5925
- _props$defaultOpen = props.defaultOpen,
5926
- defaultOpen = _props$defaultOpen === void 0 ? true : _props$defaultOpen,
5927
- otherProps = _objectWithoutPropertiesLoose(props, _excluded$d);
5928
-
5929
- var context = React.useMemo(function () {
5930
- return {
5931
- props: otherProps,
5932
- ref: ref
5933
- };
5934
- }, [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
5935
-
5936
- var _React$useState = React.useState(false),
5937
- open = _React$useState[0],
5938
- setOpen = _React$useState[1];
5914
+ const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
5915
+ const {
5916
+ anchor,
5917
+ children,
5918
+ defaultOpen = true,
5919
+ ...otherProps
5920
+ } = props;
5921
+ const context = React.useMemo(() => ({
5922
+ props: otherProps,
5923
+ ref
5924
+ }), [otherProps]); // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal
5939
5925
 
5940
- React.useEffect(function () {
5926
+ const [open, setOpen] = React.useState(false);
5927
+ React.useEffect(() => {
5941
5928
  if (defaultOpen) {
5942
5929
  setOpen(defaultOpen);
5943
5930
  }
@@ -6103,7 +6090,7 @@ const useListbox = ({
6103
6090
  onChange: handleInputChange,
6104
6091
  ref: inputRef,
6105
6092
  tabIndex: -1,
6106
- value: value === undefined || value === null ? '' : value
6093
+ value: value !== null && value !== void 0 ? value : ''
6107
6094
  };
6108
6095
  return {
6109
6096
  list,
@@ -7108,20 +7095,21 @@ const useSelect = ({
7108
7095
  emptyValue,
7109
7096
  id: nativeId,
7110
7097
  multiselect,
7098
+ onBlur,
7111
7099
  onClick,
7112
7100
  onChange,
7113
7101
  readOnly,
7114
- value = emptyValue,
7102
+ value,
7115
7103
  ...otherProps
7116
7104
  }, ref) => {
7117
7105
  const {
7118
7106
  texts
7119
7107
  } = useLocalization();
7120
- const searchData = useFlattenedData(data);
7121
- const inputRef = useProxiedRef(ref);
7108
+ const flattenedData = useFlattenedData(data);
7109
+ const listboxInputRef = useProxiedRef(ref);
7122
7110
  const [open, setOpen] = React.useState(false);
7123
7111
  const id = React.useMemo(() => nativeId || `select_${uuid.v4()}`, [nativeId]);
7124
- const internalInputRef = React.useRef(null);
7112
+ const inputRef = React.useRef(null);
7125
7113
  const buttonId = `${id}-button`; // support 'escape' resetting to the value that was set when the listbox opened
7126
7114
 
7127
7115
  const [lastValue, setLastValue] = React.useState(value);
@@ -7129,15 +7117,24 @@ const useSelect = ({
7129
7117
  setLastValue(value);
7130
7118
  }, [open]);
7131
7119
  React.useEffect(() => {
7132
- // If emptyValue is defined, then set emptyValue
7133
- if (emptyValue !== undefined && value === emptyValue) {
7134
- setInputValueByRef$1(internalInputRef.current, value);
7135
- } else if (value !== undefined && data.some(option => option.value === value)) {
7136
- setInputValueByRef$1(internalInputRef.current, value);
7137
- } else if (value === undefined && defaultValue !== undefined && data.some(option => option.value === defaultValue)) {
7138
- setInputValueByRef$1(internalInputRef.current, defaultValue);
7139
- } else if (value === undefined && data.length && defaultValue === undefined) {
7140
- setInputValueByRef$1(internalInputRef.current, data[0].value);
7120
+ if (value === undefined) {
7121
+ if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {
7122
+ setInputValueByRef$1(inputRef.current, defaultValue);
7123
+ } else {
7124
+ if (emptyValue !== undefined) {
7125
+ setInputValueByRef$1(inputRef.current, emptyValue);
7126
+ } else if (data.length > 0) {
7127
+ setInputValueByRef$1(inputRef.current, data[0].value);
7128
+ }
7129
+ }
7130
+ } else {
7131
+ if (!findByValue(flattenedData, value)) {
7132
+ if (emptyValue !== undefined) {
7133
+ setInputValueByRef$1(inputRef.current, emptyValue);
7134
+ } else if (data.length > 0) {
7135
+ setInputValueByRef$1(inputRef.current, data[0].value);
7136
+ }
7137
+ }
7141
7138
  }
7142
7139
  }, []); // event handlers
7143
7140
 
@@ -7155,7 +7152,7 @@ const useSelect = ({
7155
7152
  event.preventDefault();
7156
7153
 
7157
7154
  if (lastValue !== undefined) {
7158
- setInputValueByRef$1(inputRef.current, lastValue);
7155
+ setInputValueByRef$1(listboxInputRef.current, lastValue);
7159
7156
  }
7160
7157
 
7161
7158
  setOpen(false);
@@ -7184,6 +7181,10 @@ const useSelect = ({
7184
7181
 
7185
7182
  if (!multiselect) {
7186
7183
  setOpen(false);
7184
+
7185
+ if (onBlur) {
7186
+ onBlur(createCustomEvent('blur'));
7187
+ }
7187
7188
  }
7188
7189
  };
7189
7190
 
@@ -7194,16 +7195,16 @@ const useSelect = ({
7194
7195
  if (multiselect) {
7195
7196
  const selectedValues = (value === null || value === void 0 ? void 0 : value.toString().split(',')) || [];
7196
7197
 
7197
- if (selectedValues.length === searchData.filter(item => !item.disabled).length) {
7198
+ if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {
7198
7199
  text = texts.select.allOptionsSelected;
7199
7200
  } else {
7200
7201
  var _findByValue$text, _findByValue;
7201
7202
 
7202
- text = (_findByValue$text = (_findByValue = findByValue(searchData, selectedValues[0])) === null || _findByValue === void 0 ? void 0 : _findByValue.text) !== null && _findByValue$text !== void 0 ? _findByValue$text : '';
7203
+ text = (_findByValue$text = (_findByValue = findByValue(flattenedData, selectedValues[0])) === null || _findByValue === void 0 ? void 0 : _findByValue.text) !== null && _findByValue$text !== void 0 ? _findByValue$text : '';
7203
7204
  more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
7204
7205
  }
7205
7206
  } else {
7206
- const item = findByValue(searchData, value);
7207
+ const item = findByValue(flattenedData, value);
7207
7208
 
7208
7209
  if (item) {
7209
7210
  text = item.icon ? React.createElement(React.Fragment, null, React.cloneElement(item.icon, {
@@ -7219,7 +7220,7 @@ const useSelect = ({
7219
7220
  if (onChange) {
7220
7221
  var _item$path$split, _item$path;
7221
7222
 
7222
- const item = findByValue(searchData, event.target.value);
7223
+ const item = findByValue(flattenedData, event.target.value);
7223
7224
  event.detail = sanitizeItem(item);
7224
7225
  const indexes = (_item$path$split = item === null || item === void 0 ? void 0 : (_item$path = item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
7225
7226
 
@@ -7230,7 +7231,7 @@ const useSelect = ({
7230
7231
  let lastPath;
7231
7232
  event.detail.parents = indexes.map(i => {
7232
7233
  lastPath = lastPath ? [lastPath, i].join('.') : i;
7233
- return sanitizeItem(searchData.find(i => i.path === lastPath));
7234
+ return sanitizeItem(flattenedData.find(i => i.path === lastPath));
7234
7235
  });
7235
7236
  }
7236
7237
 
@@ -7253,21 +7254,19 @@ const useSelect = ({
7253
7254
  data,
7254
7255
  disabled,
7255
7256
  emptyValue,
7257
+ onBlur,
7256
7258
  onClick: handleListboxClick,
7257
7259
  onChange: event => {
7258
- var _event$target;
7259
-
7260
- setInputValueByRef$1(internalInputRef.current, (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value);
7260
+ setInputValueByRef$1(inputRef.current, event.target.value);
7261
7261
  },
7262
7262
  onKeyDown: handleListboxKeyDown,
7263
- ref: inputRef,
7264
- value,
7265
- multiselect
7263
+ ref: listboxInputRef,
7264
+ value
7266
7265
  };
7267
7266
  const input = {
7268
7267
  onChange: handleInputChange,
7269
- ref: internalInputRef,
7270
- value: value !== null && value !== void 0 ? value : ''
7268
+ ref: inputRef,
7269
+ value: String(value !== null && value !== void 0 ? value : '')
7271
7270
  };
7272
7271
  return {
7273
7272
  button,
@@ -7275,7 +7274,13 @@ const useSelect = ({
7275
7274
  input,
7276
7275
  popover: {
7277
7276
  open,
7278
- onOpenChange: setOpen
7277
+ onOpenChange: open => {
7278
+ if (!open && onBlur) {
7279
+ onBlur(createCustomEvent('blur'));
7280
+ }
7281
+
7282
+ setOpen(open);
7283
+ }
7279
7284
  },
7280
7285
  text,
7281
7286
  more