@yamada-ui/autocomplete 1.6.5-next-20241119123334 → 1.6.5-next-20241123062048

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/dist/autocomplete-create.js.map +1 -1
  2. package/dist/autocomplete-create.mjs +2 -2
  3. package/dist/autocomplete-empty.js.map +1 -1
  4. package/dist/autocomplete-empty.mjs +2 -2
  5. package/dist/autocomplete-option.js +6 -10
  6. package/dist/autocomplete-option.js.map +1 -1
  7. package/dist/autocomplete-option.mjs +2 -2
  8. package/dist/autocomplete.js +8 -12
  9. package/dist/autocomplete.js.map +1 -1
  10. package/dist/autocomplete.mjs +6 -6
  11. package/dist/{chunk-7GVG5MVF.mjs → chunk-2UKLSSUA.mjs} +2 -2
  12. package/dist/{chunk-LCC3VNZV.mjs → chunk-3A2HEULI.mjs} +7 -11
  13. package/dist/chunk-3A2HEULI.mjs.map +1 -0
  14. package/dist/{chunk-6QAH2ARG.mjs → chunk-6II6KCIJ.mjs} +2 -2
  15. package/dist/{chunk-YWUT56L3.mjs → chunk-75VF5Q5W.mjs} +4 -4
  16. package/dist/chunk-75VF5Q5W.mjs.map +1 -0
  17. package/dist/{chunk-ZFWB5LCD.mjs → chunk-G6SC44LI.mjs} +2 -2
  18. package/dist/{chunk-7YDPBPBY.mjs → chunk-JYPMXZG4.mjs} +4 -4
  19. package/dist/{chunk-J3GHHVSC.mjs → chunk-NOSATNDY.mjs} +5 -7
  20. package/dist/chunk-NOSATNDY.mjs.map +1 -0
  21. package/dist/index.js +9 -15
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +7 -7
  24. package/dist/multi-autocomplete.d.mts +0 -8
  25. package/dist/multi-autocomplete.d.ts +0 -8
  26. package/dist/multi-autocomplete.js +9 -15
  27. package/dist/multi-autocomplete.js.map +1 -1
  28. package/dist/multi-autocomplete.mjs +6 -6
  29. package/dist/use-autocomplete-option.d.mts +0 -16
  30. package/dist/use-autocomplete-option.d.ts +0 -16
  31. package/dist/use-autocomplete-option.js +6 -10
  32. package/dist/use-autocomplete-option.js.map +1 -1
  33. package/dist/use-autocomplete-option.mjs +1 -1
  34. package/dist/use-autocomplete.d.mts +3 -3
  35. package/dist/use-autocomplete.d.ts +3 -3
  36. package/dist/use-autocomplete.js +8 -12
  37. package/dist/use-autocomplete.js.map +1 -1
  38. package/dist/use-autocomplete.mjs +3 -3
  39. package/package.json +4 -4
  40. package/dist/chunk-J3GHHVSC.mjs.map +0 -1
  41. package/dist/chunk-LCC3VNZV.mjs.map +0 -1
  42. package/dist/chunk-YWUT56L3.mjs.map +0 -1
  43. /package/dist/{chunk-7GVG5MVF.mjs.map → chunk-2UKLSSUA.mjs.map} +0 -0
  44. /package/dist/{chunk-6QAH2ARG.mjs.map → chunk-6II6KCIJ.mjs.map} +0 -0
  45. /package/dist/{chunk-ZFWB5LCD.mjs.map → chunk-G6SC44LI.mjs.map} +0 -0
  46. /package/dist/{chunk-7YDPBPBY.mjs.map → chunk-JYPMXZG4.mjs.map} +0 -0
@@ -17,27 +17,11 @@ interface UseAutocompleteOptionProps extends Omit<HTMLUIProps, "children" | "val
17
17
  *
18
18
  * @default false
19
19
  */
20
- disabled?: boolean;
21
- /**
22
- * If `true`, the autocomplete option will be focusable.
23
- *
24
- * @default false
25
- */
26
- focusable?: boolean;
27
- /**
28
- * If `true`, the autocomplete option will be disabled.
29
- *
30
- * @default false
31
- *
32
- * @deprecated Use `disabled` instead.
33
- */
34
20
  isDisabled?: boolean;
35
21
  /**
36
22
  * If `true`, the autocomplete option will be focusable.
37
23
  *
38
24
  * @default false
39
- *
40
- * @deprecated Use `focusable` instead.
41
25
  */
42
26
  isFocusable?: boolean;
43
27
  /**
@@ -68,17 +68,13 @@ var useAutocompleteOption = (props) => {
68
68
  id,
69
69
  children,
70
70
  closeOnSelect: customCloseOnSelect,
71
- disabled,
72
- focusable,
73
71
  icon: customIcon,
74
72
  isDisabled,
75
73
  isFocusable,
76
74
  value: optionValue,
77
75
  ...computedProps
78
76
  } = { ...optionProps, ...props };
79
- disabled != null ? disabled : disabled = isDisabled;
80
- focusable != null ? focusable : focusable = isFocusable;
81
- const trulyDisabled = !!disabled && !focusable;
77
+ const trulyDisabled = !!isDisabled && !isFocusable;
82
78
  const { descendants, index, register } = useAutocompleteDescendant({
83
79
  disabled: trulyDisabled
84
80
  });
@@ -104,7 +100,7 @@ var useAutocompleteOption = (props) => {
104
100
  const onClick = (0, import_react.useCallback)(
105
101
  (ev) => {
106
102
  ev.stopPropagation();
107
- if (disabled || !isTargetOption(ev.currentTarget)) {
103
+ if (isDisabled || !isTargetOption(ev.currentTarget)) {
108
104
  if (inputRef.current) inputRef.current.focus();
109
105
  return;
110
106
  }
@@ -118,7 +114,7 @@ var useAutocompleteOption = (props) => {
118
114
  isDuplicated,
119
115
  onFocusNext,
120
116
  omitSelectedValues,
121
- disabled,
117
+ isDisabled,
122
118
  optionValue,
123
119
  setFocusedIndex,
124
120
  index,
@@ -150,10 +146,10 @@ var useAutocompleteOption = (props) => {
150
146
  ...props2,
151
147
  id,
152
148
  style: isHidden ? style : void 0,
153
- "aria-disabled": (0, import_utils2.ariaAttr)(disabled),
149
+ "aria-disabled": (0, import_utils2.ariaAttr)(isDisabled),
154
150
  "aria-hidden": (0, import_utils2.ariaAttr)(isHidden),
155
151
  "aria-selected": isSelected,
156
- "data-disabled": (0, import_utils2.dataAttr)(disabled),
152
+ "data-disabled": (0, import_utils2.dataAttr)(isDisabled),
157
153
  "data-duplicated": (0, import_utils2.dataAttr)(isDuplicated),
158
154
  "data-focus": (0, import_utils2.dataAttr)(isFocused),
159
155
  "data-target": (0, import_utils2.dataAttr)(true),
@@ -167,7 +163,7 @@ var useAutocompleteOption = (props) => {
167
163
  isDuplicated,
168
164
  optionValue,
169
165
  computedProps,
170
- disabled,
166
+ isDisabled,
171
167
  isFocused,
172
168
  isSelected,
173
169
  isTarget,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-autocomplete-option.ts","../src/autocomplete-context.ts"],"sourcesContent":["import type { HTMLUIProps, PropGetter } from \"@yamada-ui/core\"\nimport type { CSSProperties, MouseEvent } from \"react\"\nimport {\n ariaAttr,\n dataAttr,\n handlerAll,\n isArray,\n isHTMLElement,\n isNumber,\n isString,\n isUndefined,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useId, useRef } from \"react\"\nimport {\n useAutocompleteContext,\n useAutocompleteDescendant,\n} from \"./autocomplete-context\"\n\nconst isTargetOption = (target: EventTarget | null): boolean =>\n isHTMLElement(target) && !!target.getAttribute(\"role\")?.startsWith(\"option\")\n\nexport interface UseAutocompleteOptionProps\n extends Omit<HTMLUIProps, \"children\" | \"value\"> {\n /**\n * The label of the autocomplete option.\n */\n children?: string\n /**\n * If `true`, the list element will be closed when selected.\n *\n * @default false\n */\n closeOnSelect?: boolean\n /**\n * If `true`, the autocomplete option will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the autocomplete option will be focusable.\n *\n * @default false\n */\n focusable?: boolean\n /**\n * If `true`, the autocomplete option will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean\n /**\n * If `true`, the autocomplete option will be focusable.\n *\n * @default false\n *\n * @deprecated Use `focusable` instead.\n */\n isFocusable?: boolean\n /**\n * The value of the autocomplete option.\n */\n value?: string\n}\n\nexport const useAutocompleteOption = (props: UseAutocompleteOptionProps) => {\n const {\n closeOnSelect,\n focusedIndex,\n inputRef,\n omitSelectedValues,\n setFocusedIndex,\n value,\n optionProps,\n onChange,\n onClose,\n onFocusNext,\n } = useAutocompleteContext()\n const uuid = useId()\n const itemRef = useRef<HTMLLIElement>(null)\n let {\n id,\n children,\n closeOnSelect: customCloseOnSelect,\n disabled,\n focusable,\n icon: customIcon,\n isDisabled,\n isFocusable,\n value: optionValue,\n ...computedProps\n } = { ...optionProps, ...props }\n disabled ??= isDisabled\n focusable ??= isFocusable\n const trulyDisabled = !!disabled && !focusable\n const { descendants, index, register } = useAutocompleteDescendant({\n disabled: trulyDisabled,\n })\n const values = descendants.values()\n const frontValues = values.slice(0, index)\n const isMulti = isArray(value)\n const isDuplicated = frontValues.some(\n ({ node }) => node.dataset.value === (optionValue ?? \"\"),\n )\n const isSelected =\n !isDuplicated &&\n (!isMulti\n ? (optionValue ?? \"\") === value\n : value.includes(optionValue ?? \"\"))\n const isTarget = \"target\" in (itemRef.current?.dataset ?? {})\n const isFocused = index === focusedIndex\n\n id ??= uuid\n\n if (isUndefined(optionValue)) {\n if (isString(children) || isNumber(children)) {\n optionValue = children.toString()\n } else {\n console.warn(\n `${\n !isMulti ? \"Autocomplete\" : \"MultiAutocomplete\"\n }: Cannot infer the option value of complex children. Pass a \\`value\\` prop or use a plain string as children to <Option>.`,\n )\n }\n }\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.stopPropagation()\n\n if (disabled || !isTargetOption(ev.currentTarget)) {\n if (inputRef.current) inputRef.current.focus()\n\n return\n }\n\n if (!isDuplicated) setFocusedIndex(index)\n\n onChange(optionValue ?? \"\")\n\n if (inputRef.current) inputRef.current.focus()\n\n if (customCloseOnSelect ?? closeOnSelect) onClose()\n\n if (omitSelectedValues) onFocusNext(index)\n },\n [\n isDuplicated,\n onFocusNext,\n omitSelectedValues,\n disabled,\n optionValue,\n setFocusedIndex,\n index,\n onChange,\n customCloseOnSelect,\n closeOnSelect,\n onClose,\n inputRef,\n ],\n )\n\n const getOptionProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const isHidden = !isTarget || (omitSelectedValues && isSelected)\n\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n ref: mergeRefs(itemRef, ref, register),\n role: \"option\",\n ...computedProps,\n ...props,\n id,\n style: isHidden ? style : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-hidden\": ariaAttr(isHidden),\n \"aria-selected\": isSelected,\n \"data-disabled\": dataAttr(disabled),\n \"data-duplicated\": dataAttr(isDuplicated),\n \"data-focus\": dataAttr(isFocused),\n \"data-target\": dataAttr(true),\n \"data-value\": optionValue ?? \"\",\n tabIndex: -1,\n onClick: handlerAll(computedProps.onClick, props.onClick, onClick),\n }\n },\n [\n id,\n isDuplicated,\n optionValue,\n computedProps,\n disabled,\n isFocused,\n isSelected,\n isTarget,\n omitSelectedValues,\n onClick,\n register,\n ],\n )\n\n return {\n children,\n customIcon,\n isFocused,\n isSelected,\n isTarget,\n omitSelectedValues,\n getOptionProps,\n }\n}\n\nexport type UseAutocompleteOptionReturn = ReturnType<\n typeof useAutocompleteOption\n>\n\nexport const useAutocompleteCreate = () => {\n const { isHit, onCreate } = useAutocompleteContext()\n\n const getCreateProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n ref,\n role: \"option\",\n ...props,\n style: isHit ? style : undefined,\n \"aria-hidden\": ariaAttr(isHit),\n \"data-focus\": dataAttr(!isHit),\n tabIndex: -1,\n onClick: handlerAll(props.onClick, onCreate),\n }\n },\n [isHit, onCreate],\n )\n\n return { getCreateProps }\n}\n\nexport type UseAutocompleteCreateReturn = ReturnType<\n typeof useAutocompleteCreate\n>\n\nexport const useAutocompleteEmpty = () => {\n const { isEmpty, isHit } = useAutocompleteContext()\n\n const getEmptyProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const isHidden = isHit && !isEmpty\n\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n ref,\n role: \"presentation\",\n ...props,\n style: isHidden ? style : undefined,\n \"aria-hidden\": ariaAttr(isHidden),\n tabIndex: -1,\n }\n },\n [isHit, isEmpty],\n )\n\n return { getEmptyProps }\n}\n\nexport type UseAutocompleteEmptyReturn = ReturnType<typeof useAutocompleteEmpty>\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { Dispatch, DOMAttributes, RefObject, SetStateAction } from \"react\"\nimport type { UseAutocompleteProps } from \"./use-autocomplete\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\n\nexport const {\n DescendantsContextProvider: AutocompleteDescendantsContextProvider,\n useDescendant: useAutocompleteDescendant,\n useDescendants: useAutocompleteDescendants,\n useDescendantsContext: useAutocompleteDescendantsContext,\n} = createDescendant()\n\ninterface AutocompleteContext\n extends Omit<\n UseAutocompleteProps,\n \"defaultValue\" | \"onChange\" | \"onCreate\" | \"value\"\n > {\n focusedIndex: number\n inputRef: RefObject<HTMLInputElement>\n inputValue: string\n isAllSelected: boolean\n isEmpty: boolean\n isHit: boolean\n isOpen: boolean\n label: string | string[] | undefined\n listRef: RefObject<HTMLUListElement>\n pickOptions: (value: string) => void\n rebirthOptions: (runFocus?: boolean) => void\n setFocusedIndex: Dispatch<SetStateAction<number>>\n styles: { [key: string]: CSSUIObject | undefined }\n value: string | string[]\n formControlProps: { [key: string]: any }\n inputProps: DOMAttributes<HTMLInputElement>\n onChange: (newValue: string, runRebirth?: boolean) => void\n onClose: () => void\n onCreate: () => void\n onFocusFirst: () => void\n onFocusLast: () => void\n onFocusNext: (index?: number) => void\n onFocusPrev: (index?: number) => void\n onOpen: () => void\n}\n\nexport const [AutocompleteProvider, useAutocompleteContext] =\n createContext<AutocompleteContext>({\n name: \"AutocompleteContext\",\n errorMessage: `useAutocompleteContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Autocomplete />\" or \"<MultiAutocomplete />\"`,\n })\n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QACvB,mBAAe,wBAAS,KAAK;AAAA,QAC7B,kBAAc,wBAAS,CAAC,KAAK;AAAA,QAC7B,UAAU;AAAA,QACV,aAAS,0BAAW,MAAM,SAAS,QAAQ;AAAA,MAC7C;AAAA,IACF;AAAA,IACA,CAAC,OAAO,QAAQ;AAAA,EAClB;AAEA,SAAO,EAAE,eAAe;AAC1B;AAMO,IAAM,uBAAuB,MAAM;AACxC,QAAM,EAAE,SAAS,MAAM,IAAI,uBAAuB;AAElD,QAAM,oBAA4B;AAAA,IAChC,CAAC,QAAQ,CAAC,GAAG,MAAM,SAAS;AAC1B,YAAM,WAAW,SAAS,CAAC;AAE3B,YAAM,QAAuB;AAAA,QAC3B,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,OAAO;AAAA,MACT;AAEA,aAAO;AAAA,QACL;AAAA,QACA,MAAM;AAAA,QACN,GAAG;AAAA,QACH,OAAO,WAAW,QAAQ;AAAA,QAC1B,mBAAe,wBAAS,QAAQ;AAAA,QAChC,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,CAAC,OAAO,OAAO;AAAA,EACjB;AAEA,SAAO,EAAE,cAAc;AACzB;","names":["import_utils","props"]}
1
+ {"version":3,"sources":["../src/use-autocomplete-option.ts","../src/autocomplete-context.ts"],"sourcesContent":["import type { HTMLUIProps, PropGetter } from \"@yamada-ui/core\"\nimport type { CSSProperties, MouseEvent } from \"react\"\nimport {\n ariaAttr,\n dataAttr,\n handlerAll,\n isArray,\n isHTMLElement,\n isNumber,\n isString,\n isUndefined,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useId, useRef } from \"react\"\nimport {\n useAutocompleteContext,\n useAutocompleteDescendant,\n} from \"./autocomplete-context\"\n\nconst isTargetOption = (target: EventTarget | null): boolean =>\n isHTMLElement(target) && !!target.getAttribute(\"role\")?.startsWith(\"option\")\n\nexport interface UseAutocompleteOptionProps\n extends Omit<HTMLUIProps, \"children\" | \"value\"> {\n /**\n * The label of the autocomplete option.\n */\n children?: string\n /**\n * If `true`, the list element will be closed when selected.\n *\n * @default false\n */\n closeOnSelect?: boolean\n /**\n * If `true`, the autocomplete option will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * If `true`, the autocomplete option will be focusable.\n *\n * @default false\n */\n isFocusable?: boolean\n /**\n * The value of the autocomplete option.\n */\n value?: string\n}\n\nexport const useAutocompleteOption = (props: UseAutocompleteOptionProps) => {\n const {\n closeOnSelect,\n focusedIndex,\n inputRef,\n omitSelectedValues,\n setFocusedIndex,\n value,\n optionProps,\n onChange,\n onClose,\n onFocusNext,\n } = useAutocompleteContext()\n const uuid = useId()\n const itemRef = useRef<HTMLLIElement>(null)\n let {\n id,\n children,\n closeOnSelect: customCloseOnSelect,\n icon: customIcon,\n isDisabled,\n isFocusable,\n value: optionValue,\n ...computedProps\n } = { ...optionProps, ...props }\n const trulyDisabled = !!isDisabled && !isFocusable\n const { descendants, index, register } = useAutocompleteDescendant({\n disabled: trulyDisabled,\n })\n const values = descendants.values()\n const frontValues = values.slice(0, index)\n const isMulti = isArray(value)\n const isDuplicated = frontValues.some(\n ({ node }) => node.dataset.value === (optionValue ?? \"\"),\n )\n const isSelected =\n !isDuplicated &&\n (!isMulti\n ? (optionValue ?? \"\") === value\n : value.includes(optionValue ?? \"\"))\n const isTarget = \"target\" in (itemRef.current?.dataset ?? {})\n const isFocused = index === focusedIndex\n\n id ??= uuid\n\n if (isUndefined(optionValue)) {\n if (isString(children) || isNumber(children)) {\n optionValue = children.toString()\n } else {\n console.warn(\n `${\n !isMulti ? \"Autocomplete\" : \"MultiAutocomplete\"\n }: Cannot infer the option value of complex children. Pass a \\`value\\` prop or use a plain string as children to <Option>.`,\n )\n }\n }\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.stopPropagation()\n\n if (isDisabled || !isTargetOption(ev.currentTarget)) {\n if (inputRef.current) inputRef.current.focus()\n\n return\n }\n\n if (!isDuplicated) setFocusedIndex(index)\n\n onChange(optionValue ?? \"\")\n\n if (inputRef.current) inputRef.current.focus()\n\n if (customCloseOnSelect ?? closeOnSelect) onClose()\n\n if (omitSelectedValues) onFocusNext(index)\n },\n [\n isDuplicated,\n onFocusNext,\n omitSelectedValues,\n isDisabled,\n optionValue,\n setFocusedIndex,\n index,\n onChange,\n customCloseOnSelect,\n closeOnSelect,\n onClose,\n inputRef,\n ],\n )\n\n const getOptionProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const isHidden = !isTarget || (omitSelectedValues && isSelected)\n\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n ref: mergeRefs(itemRef, ref, register),\n role: \"option\",\n ...computedProps,\n ...props,\n id,\n style: isHidden ? style : undefined,\n \"aria-disabled\": ariaAttr(isDisabled),\n \"aria-hidden\": ariaAttr(isHidden),\n \"aria-selected\": isSelected,\n \"data-disabled\": dataAttr(isDisabled),\n \"data-duplicated\": dataAttr(isDuplicated),\n \"data-focus\": dataAttr(isFocused),\n \"data-target\": dataAttr(true),\n \"data-value\": optionValue ?? \"\",\n tabIndex: -1,\n onClick: handlerAll(computedProps.onClick, props.onClick, onClick),\n }\n },\n [\n id,\n isDuplicated,\n optionValue,\n computedProps,\n isDisabled,\n isFocused,\n isSelected,\n isTarget,\n omitSelectedValues,\n onClick,\n register,\n ],\n )\n\n return {\n children,\n customIcon,\n isFocused,\n isSelected,\n isTarget,\n omitSelectedValues,\n getOptionProps,\n }\n}\n\nexport type UseAutocompleteOptionReturn = ReturnType<\n typeof useAutocompleteOption\n>\n\nexport const useAutocompleteCreate = () => {\n const { isHit, onCreate } = useAutocompleteContext()\n\n const getCreateProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n ref,\n role: \"option\",\n ...props,\n style: isHit ? style : undefined,\n \"aria-hidden\": ariaAttr(isHit),\n \"data-focus\": dataAttr(!isHit),\n tabIndex: -1,\n onClick: handlerAll(props.onClick, onCreate),\n }\n },\n [isHit, onCreate],\n )\n\n return { getCreateProps }\n}\n\nexport type UseAutocompleteCreateReturn = ReturnType<\n typeof useAutocompleteCreate\n>\n\nexport const useAutocompleteEmpty = () => {\n const { isEmpty, isHit } = useAutocompleteContext()\n\n const getEmptyProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const isHidden = isHit && !isEmpty\n\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n ref,\n role: \"presentation\",\n ...props,\n style: isHidden ? style : undefined,\n \"aria-hidden\": ariaAttr(isHidden),\n tabIndex: -1,\n }\n },\n [isHit, isEmpty],\n )\n\n return { getEmptyProps }\n}\n\nexport type UseAutocompleteEmptyReturn = ReturnType<typeof useAutocompleteEmpty>\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { Dispatch, DOMAttributes, RefObject, SetStateAction } from \"react\"\nimport type { UseAutocompleteProps } from \"./use-autocomplete\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\n\nexport const {\n DescendantsContextProvider: AutocompleteDescendantsContextProvider,\n useDescendant: useAutocompleteDescendant,\n useDescendants: useAutocompleteDescendants,\n useDescendantsContext: useAutocompleteDescendantsContext,\n} = createDescendant()\n\ninterface AutocompleteContext\n extends Omit<\n UseAutocompleteProps,\n \"defaultValue\" | \"onChange\" | \"onCreate\" | \"value\"\n > {\n focusedIndex: number\n inputRef: RefObject<HTMLInputElement>\n inputValue: string\n isAllSelected: boolean\n isEmpty: boolean\n isHit: boolean\n isOpen: boolean\n label: string | string[] | undefined\n listRef: RefObject<HTMLUListElement>\n pickOptions: (value: string) => void\n rebirthOptions: (runFocus?: boolean) => void\n setFocusedIndex: Dispatch<SetStateAction<number>>\n styles: { [key: string]: CSSUIObject | undefined }\n value: string | string[]\n formControlProps: { [key: string]: any }\n inputProps: DOMAttributes<HTMLInputElement>\n onChange: (newValue: string, runRebirth?: boolean) => void\n onClose: () => void\n onCreate: () => void\n onFocusFirst: () => void\n onFocusLast: () => void\n onFocusNext: (index?: number) => void\n onFocusPrev: (index?: number) => void\n onOpen: () => void\n}\n\nexport const [AutocompleteProvider, useAutocompleteContext] =\n createContext<AutocompleteContext>({\n name: \"AutocompleteContext\",\n errorMessage: `useAutocompleteContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Autocomplete />\" or \"<MultiAutocomplete />\"`,\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAUO;AACP,mBAA2C;;;ACV3C,4BAAiC;AACjC,mBAA8B;AAEvB,IAAM;AAAA,EACX,4BAA4B;AAAA,EAC5B,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,uBAAuB;AACzB,QAAI,wCAAiB;AAiCd,IAAM,CAAC,sBAAsB,sBAAsB,QACxD,4BAAmC;AAAA,EACjC,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;AD7BH,IAAM,iBAAiB,CAAC,WAAqC;AAnB7D;AAoBE,0CAAc,MAAM,KAAK,CAAC,GAAC,YAAO,aAAa,MAAM,MAA1B,mBAA6B,WAAW;AAAA;AAgC9D,IAAM,wBAA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QACV,YAAY;AAAA,QACZ,OAAO;AAAA,MACT;AAEA,aAAO;AAAA,QACL;AAAA,QACA,MAAM;AAAA,QACN,GAAG;AAAA,QACH,OAAO,WAAW,QAAQ;AAAA,QAC1B,mBAAe,wBAAS,QAAQ;AAAA,QAChC,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,CAAC,OAAO,OAAO;AAAA,EACjB;AAEA,SAAO,EAAE,cAAc;AACzB;","names":["import_utils","props"]}
@@ -3,7 +3,7 @@ import {
3
3
  useAutocompleteCreate,
4
4
  useAutocompleteEmpty,
5
5
  useAutocompleteOption
6
- } from "./chunk-LCC3VNZV.mjs";
6
+ } from "./chunk-3A2HEULI.mjs";
7
7
  import "./chunk-ZNO5RUVT.mjs";
8
8
  export {
9
9
  useAutocompleteCreate,
@@ -2,9 +2,9 @@ import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { HTMLUIProps, PropGetter } from '@yamada-ui/core';
3
3
  import * as _yamada_ui_use_descendant from '@yamada-ui/use-descendant';
4
4
  import * as react from 'react';
5
- import { ReactElement, FocusEvent, DOMAttributes, MouseEvent, ChangeEvent } from 'react';
5
+ import { ChangeEvent, ReactElement, FocusEvent, DOMAttributes, MouseEvent } from 'react';
6
6
  import { FormControlOptions } from '@yamada-ui/form-control';
7
- import { PopoverProps, ComboBoxProps } from '@yamada-ui/popover';
7
+ import { ComboBoxProps, PopoverProps } from '@yamada-ui/popover';
8
8
  import { Union } from '@yamada-ui/utils';
9
9
  import { AutocompleteOptionProps } from './autocomplete-option.mjs';
10
10
  import { AutocompleteOptionGroupProps } from './autocomplete-option-group.mjs';
@@ -15,7 +15,7 @@ interface AutocompleteItemWithValue extends AutocompleteOptionProps {
15
15
  label?: string;
16
16
  value?: string;
17
17
  }
18
- interface AutocompleteItemWithItems extends AutocompleteOptionGroupProps, Pick<AutocompleteOptionProps, "disabled" | "focusable" | "isDisabled" | "isFocusable"> {
18
+ interface AutocompleteItemWithItems extends AutocompleteOptionGroupProps, Pick<AutocompleteOptionProps, "isDisabled" | "isFocusable"> {
19
19
  items?: AutocompleteItemWithValue[];
20
20
  }
21
21
  type AutocompleteItem = AutocompleteItemWithItems | AutocompleteItemWithValue;
@@ -2,9 +2,9 @@ import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { HTMLUIProps, PropGetter } from '@yamada-ui/core';
3
3
  import * as _yamada_ui_use_descendant from '@yamada-ui/use-descendant';
4
4
  import * as react from 'react';
5
- import { ReactElement, FocusEvent, DOMAttributes, MouseEvent, ChangeEvent } from 'react';
5
+ import { ChangeEvent, ReactElement, FocusEvent, DOMAttributes, MouseEvent } from 'react';
6
6
  import { FormControlOptions } from '@yamada-ui/form-control';
7
- import { PopoverProps, ComboBoxProps } from '@yamada-ui/popover';
7
+ import { ComboBoxProps, PopoverProps } from '@yamada-ui/popover';
8
8
  import { Union } from '@yamada-ui/utils';
9
9
  import { AutocompleteOptionProps } from './autocomplete-option.js';
10
10
  import { AutocompleteOptionGroupProps } from './autocomplete-option-group.js';
@@ -15,7 +15,7 @@ interface AutocompleteItemWithValue extends AutocompleteOptionProps {
15
15
  label?: string;
16
16
  value?: string;
17
17
  }
18
- interface AutocompleteItemWithItems extends AutocompleteOptionGroupProps, Pick<AutocompleteOptionProps, "disabled" | "focusable" | "isDisabled" | "isFocusable"> {
18
+ interface AutocompleteItemWithItems extends AutocompleteOptionGroupProps, Pick<AutocompleteOptionProps, "isDisabled" | "isFocusable"> {
19
19
  items?: AutocompleteItemWithValue[];
20
20
  }
21
21
  type AutocompleteItem = AutocompleteItemWithItems | AutocompleteItemWithValue;
@@ -175,17 +175,13 @@ var useAutocompleteOption = (props) => {
175
175
  id,
176
176
  children,
177
177
  closeOnSelect: customCloseOnSelect,
178
- disabled,
179
- focusable,
180
178
  icon: customIcon,
181
179
  isDisabled,
182
180
  isFocusable,
183
181
  value: optionValue,
184
182
  ...computedProps
185
183
  } = { ...optionProps, ...props };
186
- disabled != null ? disabled : disabled = isDisabled;
187
- focusable != null ? focusable : focusable = isFocusable;
188
- const trulyDisabled = !!disabled && !focusable;
184
+ const trulyDisabled = !!isDisabled && !isFocusable;
189
185
  const { descendants, index, register } = useAutocompleteDescendant({
190
186
  disabled: trulyDisabled
191
187
  });
@@ -211,7 +207,7 @@ var useAutocompleteOption = (props) => {
211
207
  const onClick = (0, import_react2.useCallback)(
212
208
  (ev) => {
213
209
  ev.stopPropagation();
214
- if (disabled || !isTargetOption(ev.currentTarget)) {
210
+ if (isDisabled || !isTargetOption(ev.currentTarget)) {
215
211
  if (inputRef.current) inputRef.current.focus();
216
212
  return;
217
213
  }
@@ -225,7 +221,7 @@ var useAutocompleteOption = (props) => {
225
221
  isDuplicated,
226
222
  onFocusNext,
227
223
  omitSelectedValues,
228
- disabled,
224
+ isDisabled,
229
225
  optionValue,
230
226
  setFocusedIndex,
231
227
  index,
@@ -257,10 +253,10 @@ var useAutocompleteOption = (props) => {
257
253
  ...props2,
258
254
  id,
259
255
  style: isHidden ? style : void 0,
260
- "aria-disabled": (0, import_utils3.ariaAttr)(disabled),
256
+ "aria-disabled": (0, import_utils3.ariaAttr)(isDisabled),
261
257
  "aria-hidden": (0, import_utils3.ariaAttr)(isHidden),
262
258
  "aria-selected": isSelected,
263
- "data-disabled": (0, import_utils3.dataAttr)(disabled),
259
+ "data-disabled": (0, import_utils3.dataAttr)(isDisabled),
264
260
  "data-duplicated": (0, import_utils3.dataAttr)(isDuplicated),
265
261
  "data-focus": (0, import_utils3.dataAttr)(isFocused),
266
262
  "data-target": (0, import_utils3.dataAttr)(true),
@@ -274,7 +270,7 @@ var useAutocompleteOption = (props) => {
274
270
  isDuplicated,
275
271
  optionValue,
276
272
  computedProps,
277
- disabled,
273
+ isDisabled,
278
274
  isFocused,
279
275
  isSelected,
280
276
  isTarget,
@@ -588,8 +584,8 @@ var defaultFormat = (value) => {
588
584
  var flattenItems = (items) => {
589
585
  const filterItems = (items2) => items2.map((item) => {
590
586
  var _a;
591
- const { disabled, focusable } = item;
592
- const trulyDisabled = !!disabled && !focusable;
587
+ const { isDisabled, isFocusable } = item;
588
+ const trulyDisabled = !!isDisabled && !isFocusable;
593
589
  if (trulyDisabled) return;
594
590
  if ("items" in item) {
595
591
  return filterItems((_a = item.items) != null ? _a : []);