@yamada-ui/autocomplete 1.5.4-next-20241005220055 → 1.5.4-next-20241008193728

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/dist/autocomplete-context.d.mts +115 -115
  2. package/dist/autocomplete-context.d.ts +115 -115
  3. package/dist/autocomplete-context.js +2 -2
  4. package/dist/autocomplete-context.js.map +1 -1
  5. package/dist/autocomplete-context.mjs +1 -1
  6. package/dist/autocomplete-create.d.mts +4 -4
  7. package/dist/autocomplete-create.d.ts +4 -4
  8. package/dist/autocomplete-create.js +32 -32
  9. package/dist/autocomplete-create.js.map +1 -1
  10. package/dist/autocomplete-create.mjs +4 -4
  11. package/dist/autocomplete-empty.d.mts +4 -4
  12. package/dist/autocomplete-empty.d.ts +4 -4
  13. package/dist/autocomplete-empty.js +34 -34
  14. package/dist/autocomplete-empty.js.map +1 -1
  15. package/dist/autocomplete-empty.mjs +4 -4
  16. package/dist/autocomplete-icon.js +17 -17
  17. package/dist/autocomplete-icon.js.map +1 -1
  18. package/dist/autocomplete-icon.mjs +2 -2
  19. package/dist/autocomplete-list.d.mts +2 -2
  20. package/dist/autocomplete-list.d.ts +2 -2
  21. package/dist/autocomplete-list.js +18 -18
  22. package/dist/autocomplete-list.js.map +1 -1
  23. package/dist/autocomplete-list.mjs +3 -3
  24. package/dist/autocomplete-option-group.js +10 -10
  25. package/dist/autocomplete-option-group.js.map +1 -1
  26. package/dist/autocomplete-option-group.mjs +3 -3
  27. package/dist/autocomplete-option.d.mts +1 -1
  28. package/dist/autocomplete-option.d.ts +1 -1
  29. package/dist/autocomplete-option.js +47 -47
  30. package/dist/autocomplete-option.js.map +1 -1
  31. package/dist/autocomplete-option.mjs +4 -4
  32. package/dist/autocomplete.d.mts +31 -31
  33. package/dist/autocomplete.d.ts +31 -31
  34. package/dist/autocomplete.js +294 -292
  35. package/dist/autocomplete.js.map +1 -1
  36. package/dist/autocomplete.mjs +12 -12
  37. package/dist/{chunk-6F3LT7J6.mjs → chunk-4SBNPEK7.mjs} +7 -7
  38. package/dist/{chunk-6F3LT7J6.mjs.map → chunk-4SBNPEK7.mjs.map} +1 -1
  39. package/dist/{chunk-JMX72TSD.mjs → chunk-67X7JKWL.mjs} +7 -7
  40. package/dist/{chunk-JMX72TSD.mjs.map → chunk-67X7JKWL.mjs.map} +1 -1
  41. package/dist/{chunk-HZECQUHV.mjs → chunk-AXC7ILCH.mjs} +40 -40
  42. package/dist/{chunk-HZECQUHV.mjs.map → chunk-AXC7ILCH.mjs.map} +1 -1
  43. package/dist/{chunk-OLOU5HFC.mjs → chunk-BGZIX6SN.mjs} +168 -166
  44. package/dist/chunk-BGZIX6SN.mjs.map +1 -0
  45. package/dist/{chunk-Q2HZVVOI.mjs → chunk-BKW7XJ6R.mjs} +16 -16
  46. package/dist/chunk-BKW7XJ6R.mjs.map +1 -0
  47. package/dist/{chunk-5LPWFWE6.mjs → chunk-DDMSYTKO.mjs} +34 -34
  48. package/dist/chunk-DDMSYTKO.mjs.map +1 -0
  49. package/dist/{chunk-QPIWG4ZF.mjs → chunk-EEECVCVW.mjs} +63 -61
  50. package/dist/chunk-EEECVCVW.mjs.map +1 -0
  51. package/dist/{chunk-5GKGL6BL.mjs → chunk-KLXMUIGY.mjs} +16 -16
  52. package/dist/chunk-KLXMUIGY.mjs.map +1 -0
  53. package/dist/{chunk-R76HPAN4.mjs → chunk-TR4X4EEG.mjs} +7 -7
  54. package/dist/{chunk-R76HPAN4.mjs.map → chunk-TR4X4EEG.mjs.map} +1 -1
  55. package/dist/{chunk-7SWSKLSA.mjs → chunk-V6YCG642.mjs} +18 -18
  56. package/dist/chunk-V6YCG642.mjs.map +1 -0
  57. package/dist/{chunk-S53LMDD7.mjs → chunk-VTBUO5SK.mjs} +15 -15
  58. package/dist/chunk-VTBUO5SK.mjs.map +1 -0
  59. package/dist/{chunk-JPUKYLBW.mjs → chunk-WDQYM4FP.mjs} +5 -5
  60. package/dist/chunk-WDQYM4FP.mjs.map +1 -0
  61. package/dist/{chunk-S2HFYJVI.mjs → chunk-WFLZPB35.mjs} +13 -13
  62. package/dist/chunk-WFLZPB35.mjs.map +1 -0
  63. package/dist/index.d.mts +4 -4
  64. package/dist/index.d.ts +4 -4
  65. package/dist/index.js +347 -343
  66. package/dist/index.js.map +1 -1
  67. package/dist/index.mjs +13 -13
  68. package/dist/multi-autocomplete.d.mts +51 -51
  69. package/dist/multi-autocomplete.d.ts +51 -51
  70. package/dist/multi-autocomplete.js +317 -313
  71. package/dist/multi-autocomplete.js.map +1 -1
  72. package/dist/multi-autocomplete.mjs +12 -12
  73. package/dist/use-autocomplete-list.d.mts +1 -1
  74. package/dist/use-autocomplete-list.d.ts +1 -1
  75. package/dist/use-autocomplete-list.js +7 -7
  76. package/dist/use-autocomplete-list.js.map +1 -1
  77. package/dist/use-autocomplete-list.mjs +2 -2
  78. package/dist/use-autocomplete-option-group.js +7 -7
  79. package/dist/use-autocomplete-option-group.js.map +1 -1
  80. package/dist/use-autocomplete-option-group.mjs +2 -2
  81. package/dist/use-autocomplete-option.d.mts +12 -12
  82. package/dist/use-autocomplete-option.d.ts +12 -12
  83. package/dist/use-autocomplete-option.js +34 -34
  84. package/dist/use-autocomplete-option.js.map +1 -1
  85. package/dist/use-autocomplete-option.mjs +2 -2
  86. package/dist/use-autocomplete.d.mts +86 -86
  87. package/dist/use-autocomplete.d.ts +86 -86
  88. package/dist/use-autocomplete.js +216 -214
  89. package/dist/use-autocomplete.js.map +1 -1
  90. package/dist/use-autocomplete.mjs +7 -7
  91. package/package.json +13 -13
  92. package/dist/chunk-5GKGL6BL.mjs.map +0 -1
  93. package/dist/chunk-5LPWFWE6.mjs.map +0 -1
  94. package/dist/chunk-7SWSKLSA.mjs.map +0 -1
  95. package/dist/chunk-JPUKYLBW.mjs.map +0 -1
  96. package/dist/chunk-OLOU5HFC.mjs.map +0 -1
  97. package/dist/chunk-Q2HZVVOI.mjs.map +0 -1
  98. package/dist/chunk-QPIWG4ZF.mjs.map +0 -1
  99. package/dist/chunk-S2HFYJVI.mjs.map +0 -1
  100. package/dist/chunk-S53LMDD7.mjs.map +0 -1
@@ -2,32 +2,32 @@
2
2
  import {
3
3
  useAutocomplete,
4
4
  useAutocompleteInput
5
- } from "./chunk-OLOU5HFC.mjs";
5
+ } from "./chunk-BGZIX6SN.mjs";
6
6
  import {
7
7
  AutocompleteCreate
8
- } from "./chunk-Q2HZVVOI.mjs";
8
+ } from "./chunk-BKW7XJ6R.mjs";
9
9
  import {
10
10
  AutocompleteEmpty
11
- } from "./chunk-5GKGL6BL.mjs";
11
+ } from "./chunk-KLXMUIGY.mjs";
12
12
  import {
13
13
  AutocompleteList
14
- } from "./chunk-S53LMDD7.mjs";
14
+ } from "./chunk-VTBUO5SK.mjs";
15
15
  import {
16
16
  AutocompleteClearIcon,
17
17
  AutocompleteIcon
18
- } from "./chunk-7SWSKLSA.mjs";
18
+ } from "./chunk-V6YCG642.mjs";
19
19
  import {
20
20
  AutocompleteDescendantsContextProvider,
21
21
  AutocompleteProvider,
22
22
  useAutocompleteContext
23
- } from "./chunk-JPUKYLBW.mjs";
23
+ } from "./chunk-WDQYM4FP.mjs";
24
24
 
25
25
  // src/multi-autocomplete.tsx
26
26
  import {
27
- ui,
28
27
  forwardRef,
29
- useComponentMultiStyle,
30
- omitThemeProps
28
+ omitThemeProps,
29
+ ui,
30
+ useComponentMultiStyle
31
31
  } from "@yamada-ui/core";
32
32
  import { Popover, PopoverTrigger } from "@yamada-ui/popover";
33
33
  import { Portal } from "@yamada-ui/portal";
@@ -42,58 +42,58 @@ var MultiAutocomplete = forwardRef(
42
42
  );
43
43
  let {
44
44
  className,
45
- defaultValue = [],
46
- component,
47
- separator,
48
- isClearable = true,
45
+ children,
46
+ closeOnSelect = false,
49
47
  color,
48
+ component,
49
+ defaultValue = [],
50
+ footer,
50
51
  h,
52
+ header,
51
53
  height,
54
+ isClearable = true,
55
+ keepPlaceholder = false,
52
56
  minH,
53
57
  minHeight,
54
- closeOnSelect = false,
55
- keepPlaceholder = false,
58
+ separator,
59
+ clearIconProps,
56
60
  containerProps,
57
61
  contentProps,
58
- listProps,
62
+ createProps,
63
+ emptyProps,
59
64
  fieldProps,
60
- inputProps,
61
65
  iconProps,
62
- clearIconProps,
66
+ inputProps,
67
+ listProps,
63
68
  portalProps = { isDisabled: true },
64
- createProps,
65
- emptyProps,
66
- header,
67
- footer,
68
- children,
69
69
  ...computedProps
70
70
  } = omitThemeProps(mergedProps);
71
71
  const {
72
- value,
73
- onClose,
72
+ allowCreate,
73
+ computedChildren,
74
74
  descendants,
75
+ inputValue,
76
+ isEmpty,
77
+ value,
75
78
  formControlProps,
76
- getPopoverProps,
77
79
  getContainerProps,
78
80
  getFieldProps,
79
- allowCreate,
80
- isEmpty,
81
- inputValue,
82
- computedChildren,
81
+ getPopoverProps,
83
82
  onClear,
83
+ onClose,
84
84
  ...rest
85
85
  } = useAutocomplete({
86
86
  ...computedProps,
87
- defaultValue,
87
+ children,
88
88
  closeOnSelect,
89
- children
89
+ defaultValue
90
90
  });
91
91
  h != null ? h : h = height;
92
92
  minH != null ? minH : minH = minHeight;
93
93
  const css = {
94
- w: "100%",
95
- h: "fit-content",
96
94
  color,
95
+ h: "fit-content",
96
+ w: "100%",
97
97
  ...styles.container
98
98
  };
99
99
  return /* @__PURE__ */ jsx(AutocompleteDescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ jsx(
@@ -101,13 +101,13 @@ var MultiAutocomplete = forwardRef(
101
101
  {
102
102
  value: {
103
103
  ...rest,
104
- value,
105
- onClose,
106
- formControlProps,
107
- inputValue,
108
104
  allowCreate,
105
+ inputValue,
109
106
  isEmpty,
110
- styles
107
+ styles,
108
+ value,
109
+ formControlProps,
110
+ onClose
111
111
  },
112
112
  children: /* @__PURE__ */ jsx(Popover, { ...getPopoverProps(), children: /* @__PURE__ */ jsxs(
113
113
  ui.div,
@@ -126,10 +126,10 @@ var MultiAutocomplete = forwardRef(
126
126
  MultiAutocompleteField,
127
127
  {
128
128
  component,
129
- separator,
130
- keepPlaceholder,
131
129
  h,
130
+ keepPlaceholder,
132
131
  minH,
132
+ separator,
133
133
  inputProps,
134
134
  ...getFieldProps(fieldProps, ref)
135
135
  }
@@ -148,8 +148,8 @@ var MultiAutocomplete = forwardRef(
148
148
  !isEmpty ? /* @__PURE__ */ jsx(Portal, { ...portalProps, children: /* @__PURE__ */ jsxs(
149
149
  AutocompleteList,
150
150
  {
151
- header: runIfFunc(header, { value, onClose }),
152
151
  footer: runIfFunc(footer, { value, onClose }),
152
+ header: runIfFunc(header, { value, onClose }),
153
153
  contentProps,
154
154
  ...listProps,
155
155
  children: [
@@ -160,8 +160,8 @@ var MultiAutocomplete = forwardRef(
160
160
  ) }) : /* @__PURE__ */ jsx(Portal, { ...portalProps, children: /* @__PURE__ */ jsx(
161
161
  AutocompleteList,
162
162
  {
163
- header: runIfFunc(header, { value, onClose }),
164
163
  footer: runIfFunc(footer, { value, onClose }),
164
+ header: runIfFunc(header, { value, onClose }),
165
165
  contentProps,
166
166
  ...listProps,
167
167
  children: allowCreate && inputValue ? /* @__PURE__ */ jsx(AutocompleteCreate, { ...createProps }) : /* @__PURE__ */ jsx(AutocompleteEmpty, { ...emptyProps })
@@ -180,34 +180,36 @@ var MultiAutocompleteField = forwardRef(
180
180
  ({
181
181
  className,
182
182
  component,
183
- separator = ",",
184
- keepPlaceholder,
185
183
  h,
184
+ keepPlaceholder,
186
185
  minH,
187
186
  placeholder,
187
+ separator = ",",
188
188
  inputProps,
189
189
  ...rest
190
190
  }, ref) => {
191
- const { value, label, inputValue, onChange, isOpen, inputRef, styles } = useAutocompleteContext();
191
+ const { inputRef, inputValue, isOpen, label, styles, value, onChange } = useAutocompleteContext();
192
192
  const { getInputProps } = useAutocompleteInput();
193
193
  const cloneChildren = useMemo(() => {
194
194
  if (!(label == null ? void 0 : label.length)) return null;
195
195
  if (component) {
196
196
  return label.map((label2, index) => {
197
+ if (!value[index]) return null;
197
198
  const onRemove = (ev) => {
199
+ if (!value[index]) return;
198
200
  ev.stopPropagation();
199
201
  onChange(value[index]);
200
202
  if (inputRef.current) inputRef.current.focus();
201
203
  };
202
204
  const el = component({
203
- value: value[index],
204
- label: label2,
205
205
  index,
206
+ label: label2,
207
+ value: value[index],
206
208
  onRemove
207
209
  });
208
210
  const style = {
209
- marginBlockStart: "0.125rem",
210
211
  marginBlockEnd: "0.125rem",
212
+ marginBlockStart: "0.125rem",
211
213
  marginInlineEnd: "0.25rem"
212
214
  };
213
215
  return el ? cloneElement(el, { key: index, style }) : null;
@@ -223,12 +225,12 @@ var MultiAutocompleteField = forwardRef(
223
225
  }
224
226
  }, [label, component, value, onChange, isOpen, inputRef, separator]);
225
227
  const css = {
226
- pe: "2rem",
227
- h,
228
- minH,
228
+ alignItems: "center",
229
229
  display: "flex",
230
230
  flexWrap: "wrap",
231
- alignItems: "center",
231
+ h,
232
+ minH,
233
+ pe: "2rem",
232
234
  ...styles.field,
233
235
  cursor: "text"
234
236
  };
@@ -236,25 +238,25 @@ var MultiAutocompleteField = forwardRef(
236
238
  ui.div,
237
239
  {
238
240
  className: cx("ui-multi-autocomplete__field", className),
239
- __css: css,
240
241
  py: (label == null ? void 0 : label.length) && component ? "0.125rem" : void 0,
242
+ __css: css,
241
243
  ...rest,
242
244
  children: [
243
245
  cloneChildren,
244
246
  /* @__PURE__ */ jsx(
245
247
  ui.input,
246
248
  {
247
- "aria-label": "Input value",
248
249
  className: "ui-multi-autocomplete__field__input",
250
+ "aria-label": "Input value",
251
+ "aria-multiselectable": "true",
249
252
  display: "inline-block",
250
253
  flex: "1",
254
+ marginBlockEnd: "0.125rem",
255
+ marginBlockStart: "0.125rem",
251
256
  minW: "0px",
252
257
  overflow: "hidden",
253
- marginBlockStart: "0.125rem",
254
- marginBlockEnd: "0.125rem",
255
- "aria-multiselectable": "true",
256
- placeholder: !label || !(label == null ? void 0 : label.length) || keepPlaceholder && isOpen ? placeholder : void 0,
257
- ...getInputProps({ ...inputProps, value: inputValue != null ? inputValue : "" }, ref)
258
+ placeholder: !(label == null ? void 0 : label.length) || keepPlaceholder && isOpen ? placeholder : void 0,
259
+ ...getInputProps({ ...inputProps, value: inputValue }, ref)
258
260
  }
259
261
  )
260
262
  ]
@@ -268,4 +270,4 @@ MultiAutocompleteField.__ui__ = "MultiAutocompleteField";
268
270
  export {
269
271
  MultiAutocomplete
270
272
  };
271
- //# sourceMappingURL=chunk-QPIWG4ZF.mjs.map
273
+ //# sourceMappingURL=chunk-EEECVCVW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/multi-autocomplete.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { MotionProps } from \"@yamada-ui/motion\"\nimport type { PortalProps } from \"@yamada-ui/portal\"\nimport type {\n CSSProperties,\n FC,\n MouseEventHandler,\n ReactElement,\n ReactNode,\n} from \"react\"\nimport type { AutocompleteCreateProps } from \"./autocomplete-create\"\nimport type { AutocompleteEmptyProps } from \"./autocomplete-empty\"\nimport type { AutocompleteIconProps } from \"./autocomplete-icon\"\nimport type { AutocompleteListProps } from \"./autocomplete-list\"\nimport type { UseAutocompleteProps } from \"./use-autocomplete\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { Popover, PopoverTrigger } from \"@yamada-ui/popover\"\nimport { Portal } from \"@yamada-ui/portal\"\nimport { cx, handlerAll, runIfFunc } from \"@yamada-ui/utils\"\nimport { cloneElement, useMemo } from \"react\"\nimport {\n AutocompleteDescendantsContextProvider,\n AutocompleteProvider,\n useAutocompleteContext,\n} from \"./autocomplete-context\"\nimport { AutocompleteCreate } from \"./autocomplete-create\"\nimport { AutocompleteEmpty } from \"./autocomplete-empty\"\nimport { AutocompleteClearIcon, AutocompleteIcon } from \"./autocomplete-icon\"\nimport { AutocompleteList } from \"./autocomplete-list\"\nimport { useAutocomplete, useAutocompleteInput } from \"./use-autocomplete\"\n\ninterface MultiAutocompleteOptions {\n /**\n * If `true`, the list element will be closed when value is selected.\n *\n * @default false\n */\n closeOnSelect?: boolean\n /**\n * The custom display value to use.\n */\n component?: FC<{\n index: number\n label: string\n value: number | string\n onRemove: MouseEventHandler<HTMLElement>\n }>\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: string\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: string\n /**\n * The footer of the autocomplete content element.\n */\n footer?: FC<{ value: string[] | undefined; onClose: () => void }> | ReactNode\n /**\n * The header of the autocomplete content element.\n */\n header?: FC<{ value: string[] | undefined; onClose: () => void }> | ReactNode\n /**\n * If `true`, display the select clear icon.\n *\n * @default true\n */\n isClearable?: boolean\n /**\n * If `true`, keep the placeholder.\n *\n * @default false\n */\n keepPlaceholder?: boolean\n /**\n * The visual separator between each value.\n *\n * @default ','\n */\n separator?: string\n /**\n * Props for multi autocomplete clear icon element.\n */\n clearIconProps?: AutocompleteIconProps\n /**\n * Props for multi autocomplete container element.\n */\n containerProps?: Omit<HTMLUIProps, \"children\">\n /**\n * Props for multi autocomplete content element.\n */\n contentProps?: Omit<MotionProps, \"children\">\n /**\n * Props for autocomplete create element.\n */\n createProps?: Omit<AutocompleteCreateProps, \"children\">\n /**\n * Props for autocomplete empty element.\n */\n emptyProps?: Omit<AutocompleteEmptyProps, \"children\">\n /**\n * Props for multi autocomplete field element.\n */\n fieldProps?: Omit<\n MultiAutocompleteFieldProps,\n \"children\" | \"component\" | \"inputProps\" | \"keepPlaceholder\" | \"separator\"\n >\n /**\n * Props for multi autocomplete icon element.\n */\n iconProps?: AutocompleteIconProps\n /**\n * Props for multi autocomplete input element.\n */\n inputProps?: HTMLUIProps<\"input\">\n /**\n * Props for multi autocomplete list element.\n */\n listProps?: Omit<AutocompleteListProps, \"children\">\n /**\n * Props to be forwarded to the portal component.\n *\n * @default '{ isDisabled: true }'\n *\n */\n portalProps?: Omit<PortalProps, \"children\">\n}\n\nexport interface MultiAutocompleteProps\n extends ThemeProps<\"MultiAutocomplete\">,\n Omit<UseAutocompleteProps<string[]>, \"closeOnSelect\">,\n MultiAutocompleteOptions {}\n\n/**\n * `MultiAutocomplete` is a component used to display suggestions based on user text input and to obtain multiple values.\n *\n * @see Docs https://yamada-ui.com/components/forms/multi-autocomplete\n */\nexport const MultiAutocomplete = forwardRef<MultiAutocompleteProps, \"input\">(\n (props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\n \"MultiAutocomplete\",\n props,\n )\n let {\n className,\n children,\n closeOnSelect = false,\n color,\n component,\n defaultValue = [],\n footer,\n h,\n header,\n height,\n isClearable = true,\n keepPlaceholder = false,\n minH,\n minHeight,\n separator,\n clearIconProps,\n containerProps,\n contentProps,\n createProps,\n emptyProps,\n fieldProps,\n iconProps,\n inputProps,\n listProps,\n portalProps = { isDisabled: true },\n ...computedProps\n } = omitThemeProps(mergedProps)\n\n const {\n allowCreate,\n computedChildren,\n descendants,\n inputValue,\n isEmpty,\n value,\n formControlProps,\n getContainerProps,\n getFieldProps,\n getPopoverProps,\n onClear,\n onClose,\n ...rest\n } = useAutocomplete<string[]>({\n ...computedProps,\n children,\n closeOnSelect,\n defaultValue,\n })\n\n h ??= height\n minH ??= minHeight\n\n const css: CSSUIObject = {\n color,\n h: \"fit-content\",\n w: \"100%\",\n ...styles.container,\n }\n\n return (\n <AutocompleteDescendantsContextProvider value={descendants}>\n <AutocompleteProvider\n value={{\n ...rest,\n allowCreate,\n inputValue,\n isEmpty,\n styles,\n value,\n formControlProps,\n onClose,\n }}\n >\n <Popover {...getPopoverProps()}>\n <ui.div\n className={cx(\"ui-multi-autocomplete\", className)}\n __css={css}\n {...getContainerProps(containerProps)}\n >\n <ui.div\n className=\"ui-multi-autocomplete__inner\"\n __css={{ position: \"relative\", ...styles.inner }}\n >\n <MultiAutocompleteField\n component={component}\n h={h}\n keepPlaceholder={keepPlaceholder}\n minH={minH}\n separator={separator}\n inputProps={inputProps}\n {...getFieldProps(fieldProps, ref)}\n />\n\n {isClearable && value.length ? (\n <AutocompleteClearIcon\n {...clearIconProps}\n onClick={handlerAll(clearIconProps?.onClick, onClear)}\n {...formControlProps}\n />\n ) : (\n <AutocompleteIcon {...iconProps} {...formControlProps} />\n )}\n </ui.div>\n\n {!isEmpty ? (\n <Portal {...portalProps}>\n <AutocompleteList\n footer={runIfFunc(footer, { value, onClose })}\n header={runIfFunc(header, { value, onClose })}\n contentProps={contentProps}\n {...listProps}\n >\n {allowCreate ? (\n <AutocompleteCreate {...createProps} />\n ) : (\n <AutocompleteEmpty {...emptyProps} />\n )}\n\n {children ?? computedChildren}\n </AutocompleteList>\n </Portal>\n ) : (\n <Portal {...portalProps}>\n <AutocompleteList\n footer={runIfFunc(footer, { value, onClose })}\n header={runIfFunc(header, { value, onClose })}\n contentProps={contentProps}\n {...listProps}\n >\n {allowCreate && inputValue ? (\n <AutocompleteCreate {...createProps} />\n ) : (\n <AutocompleteEmpty {...emptyProps} />\n )}\n </AutocompleteList>\n </Portal>\n )}\n </ui.div>\n </Popover>\n </AutocompleteProvider>\n </AutocompleteDescendantsContextProvider>\n )\n },\n)\n\nMultiAutocomplete.displayName = \"MultiAutocomplete\"\nMultiAutocomplete.__ui__ = \"MultiAutocomplete\"\n\ninterface MultiAutocompleteFieldProps\n extends HTMLUIProps,\n Pick<\n MultiAutocompleteProps,\n \"component\" | \"inputProps\" | \"keepPlaceholder\" | \"separator\"\n > {}\n\nconst MultiAutocompleteField = forwardRef<MultiAutocompleteFieldProps, \"input\">(\n (\n {\n className,\n component,\n h,\n keepPlaceholder,\n minH,\n placeholder,\n separator = \",\",\n inputProps,\n ...rest\n },\n ref,\n ) => {\n const { inputRef, inputValue, isOpen, label, styles, value, onChange } =\n useAutocompleteContext()\n\n const { getInputProps } = useAutocompleteInput()\n\n const cloneChildren = useMemo(() => {\n if (!label?.length) return null\n\n if (component) {\n return (label as string[]).map((label, index) => {\n if (!value[index]) return null\n\n const onRemove: MouseEventHandler<HTMLElement> = (ev) => {\n if (!value[index]) return\n\n ev.stopPropagation()\n\n onChange(value[index])\n\n if (inputRef.current) inputRef.current.focus()\n }\n\n const el = component({\n index,\n label,\n value: value[index],\n onRemove,\n })\n\n const style: CSSProperties = {\n marginBlockEnd: \"0.125rem\",\n marginBlockStart: \"0.125rem\",\n marginInlineEnd: \"0.25rem\",\n }\n\n return el\n ? cloneElement(el as ReactElement, { key: index, style })\n : null\n })\n } else {\n return (label as string[]).map((value, index) => {\n const isLast = label.length === index + 1\n\n return (\n <ui.span key={index} display=\"inline-block\" me=\"0.25rem\">\n {value}\n {!isLast || isOpen ? separator : null}\n </ui.span>\n )\n })\n }\n }, [label, component, value, onChange, isOpen, inputRef, separator])\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n flexWrap: \"wrap\",\n h,\n minH,\n pe: \"2rem\",\n ...styles.field,\n cursor: \"text\",\n }\n\n return (\n <PopoverTrigger>\n <ui.div\n className={cx(\"ui-multi-autocomplete__field\", className)}\n py={label?.length && component ? \"0.125rem\" : undefined}\n __css={css}\n {...rest}\n >\n {cloneChildren}\n\n <ui.input\n className=\"ui-multi-autocomplete__field__input\"\n aria-label=\"Input value\"\n aria-multiselectable=\"true\"\n display=\"inline-block\"\n flex=\"1\"\n marginBlockEnd=\"0.125rem\"\n marginBlockStart=\"0.125rem\"\n minW=\"0px\"\n overflow=\"hidden\"\n placeholder={\n !label?.length || (keepPlaceholder && isOpen)\n ? placeholder\n : undefined\n }\n {...getInputProps({ ...inputProps, value: inputValue }, ref)}\n />\n </ui.div>\n </PopoverTrigger>\n )\n },\n)\n\nMultiAutocompleteField.displayName = \"MultiAutocompleteField\"\nMultiAutocompleteField.__ui__ = \"MultiAutocompleteField\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAeA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,sBAAsB;AACxC,SAAS,cAAc;AACvB,SAAS,IAAI,YAAY,iBAAiB;AAC1C,SAAS,cAAc,eAAe;AA8MxB,SAIE,KAJF;AAtFP,I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A,QAEJ,CAAC;AAAA,MACH;AAAA,IACF,GAAG,CAAC,OAAO,WAAW,OAAO,UAAU,QAAQ,UAAU,SAAS,CAAC;AAEnE,UAAM,MAAmB;AAAA,MACvB,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA,IAAI;AAAA,MACJ,GAAG,OAAO;AAAA,MACV,QAAQ;AAAA,IACV;AAEA,WACE,oBAAC,kBACC;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC,WAAW,GAAG,gCAAgC,SAAS;AAAA,QACvD,KAAI,+BAAO,WAAU,YAAY,aAAa;AAAA,QAC9C,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA;AAAA,UAED;AAAA,YAAC,GAAG;AAAA,YAAH;AAAA,cACC,WAAU;AAAA,cACV,cAAW;AAAA,cACX,wBAAqB;AAAA,cACrB,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,gBAAe;AAAA,cACf,kBAAiB;AAAA,cACjB,MAAK;AAAA,cACL,UAAS;AAAA,cACT,aACE,EAAC,+BAAO,WAAW,mBAAmB,SAClC,cACA;AAAA,cAEL,GAAG,cAAc,EAAE,GAAG,YAAY,OAAO,WAAW,GAAG,GAAG;AAAA;AAAA,UAC7D;AAAA;AAAA;AAAA,IACF,GACF;AAAA,EAEJ;AACF;AAEA,uBAAuB,cAAc;AACrC,uBAAuB,SAAS;","names":["label","value"]}
@@ -1,35 +1,35 @@
1
1
  "use client"
2
2
  import {
3
3
  useAutocompleteEmpty
4
- } from "./chunk-5LPWFWE6.mjs";
4
+ } from "./chunk-DDMSYTKO.mjs";
5
5
  import {
6
6
  AutocompleteItemIcon
7
- } from "./chunk-7SWSKLSA.mjs";
7
+ } from "./chunk-V6YCG642.mjs";
8
8
  import {
9
9
  useAutocompleteContext
10
- } from "./chunk-JPUKYLBW.mjs";
10
+ } from "./chunk-WDQYM4FP.mjs";
11
11
 
12
12
  // src/autocomplete-empty.tsx
13
- import { ui, forwardRef } from "@yamada-ui/core";
13
+ import { forwardRef, ui } from "@yamada-ui/core";
14
14
  import { cx } from "@yamada-ui/utils";
15
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
16
  var AutocompleteEmpty = forwardRef(
17
- ({ className, icon, children, ...rest }, ref) => {
17
+ ({ className, children, icon, ...rest }, ref) => {
18
18
  const { emptyMessage, styles } = useAutocompleteContext();
19
19
  const { getEmptyProps } = useAutocompleteEmpty();
20
20
  children != null ? children : children = emptyMessage;
21
21
  const css = {
22
- textDecoration: "none",
22
+ alignItems: "center",
23
23
  color: "inherit",
24
- userSelect: "none",
25
24
  display: "flex",
26
- width: "100%",
27
- alignItems: "center",
28
- textAlign: "start",
29
25
  flex: "0 0 auto",
30
- outline: 0,
31
26
  gap: "0.75rem",
27
+ outline: 0,
32
28
  pointerEvents: "none",
29
+ textAlign: "start",
30
+ textDecoration: "none",
31
+ userSelect: "none",
32
+ width: "100%",
33
33
  ...styles.item
34
34
  };
35
35
  return /* @__PURE__ */ jsxs(
@@ -40,7 +40,7 @@ var AutocompleteEmpty = forwardRef(
40
40
  ...getEmptyProps(rest, ref),
41
41
  children: [
42
42
  icon !== null ? /* @__PURE__ */ jsx(AutocompleteItemIcon, { children: icon || /* @__PURE__ */ jsx(AutocompleteMinusIcon, {}) }) : null,
43
- icon ? /* @__PURE__ */ jsx(ui.span, { style: { pointerEvents: "none", flex: 1 }, lineClamp: 1, children }) : children
43
+ icon ? /* @__PURE__ */ jsx(ui.span, { style: { flex: 1, pointerEvents: "none" }, lineClamp: 1, children }) : children
44
44
  ]
45
45
  }
46
46
  );
@@ -48,11 +48,11 @@ var AutocompleteEmpty = forwardRef(
48
48
  );
49
49
  AutocompleteEmpty.displayName = "AutocompleteEmpty";
50
50
  AutocompleteEmpty.__ui__ = "AutocompleteEmpty";
51
- var AutocompleteMinusIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 448 512", width: "1em", height: "1em", children: /* @__PURE__ */ jsx(
51
+ var AutocompleteMinusIcon = () => /* @__PURE__ */ jsx("svg", { height: "1em", viewBox: "0 0 448 512", width: "1em", children: /* @__PURE__ */ jsx(
52
52
  "path",
53
53
  {
54
- fill: "currentColor",
55
- d: "M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z"
54
+ d: "M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z",
55
+ fill: "currentColor"
56
56
  }
57
57
  ) });
58
58
  AutocompleteMinusIcon.displayName = "AutocompleteMinusIcon";
@@ -61,4 +61,4 @@ AutocompleteMinusIcon.__ui__ = "AutocompleteMinusIcon";
61
61
  export {
62
62
  AutocompleteEmpty
63
63
  };
64
- //# sourceMappingURL=chunk-5GKGL6BL.mjs.map
64
+ //# sourceMappingURL=chunk-KLXMUIGY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/autocomplete-empty.tsx"],"sourcesContent":["import type { CSSUIObject, FC, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { ReactElement } from \"react\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useAutocompleteContext } from \"./autocomplete-context\"\nimport { AutocompleteItemIcon } from \"./autocomplete-icon\"\nimport { useAutocompleteEmpty } from \"./use-autocomplete-option\"\n\ninterface AutocompleteEmptyOptions {\n /**\n * The label of the autocomplete empty option.\n */\n children?: string\n /**\n * The autocomplete empty option icon to use.\n */\n icon?: null | ReactElement\n}\n\nexport interface AutocompleteEmptyProps\n extends Omit<HTMLUIProps<\"li\">, \"children\">,\n AutocompleteEmptyOptions {}\n\nexport const AutocompleteEmpty = forwardRef<AutocompleteEmptyProps, \"li\">(\n ({ className, children, icon, ...rest }, ref) => {\n const { emptyMessage, styles } = useAutocompleteContext()\n const { getEmptyProps } = useAutocompleteEmpty()\n\n children ??= emptyMessage\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n color: \"inherit\",\n display: \"flex\",\n flex: \"0 0 auto\",\n gap: \"0.75rem\",\n outline: 0,\n pointerEvents: \"none\",\n textAlign: \"start\",\n textDecoration: \"none\",\n userSelect: \"none\",\n width: \"100%\",\n ...styles.item,\n }\n\n return (\n <ui.li\n className={cx(\"ui-autocomplete__item--empty\", className)}\n __css={css}\n {...getEmptyProps(rest, ref)}\n >\n {icon !== null ? (\n <AutocompleteItemIcon>\n {icon || <AutocompleteMinusIcon />}\n </AutocompleteItemIcon>\n ) : null}\n\n {icon ? (\n <ui.span style={{ flex: 1, pointerEvents: \"none\" }} lineClamp={1}>\n {children}\n </ui.span>\n ) : (\n children\n )}\n </ui.li>\n )\n },\n)\n\nAutocompleteEmpty.displayName = \"AutocompleteEmpty\"\nAutocompleteEmpty.__ui__ = \"AutocompleteEmpty\"\n\nconst AutocompleteMinusIcon: FC = () => (\n <svg height=\"1em\" viewBox=\"0 0 448 512\" width=\"1em\">\n <path\n d=\"M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n\nAutocompleteMinusIcon.displayName = \"AutocompleteMinusIcon\"\nAutocompleteMinusIcon.__ui__ = \"AutocompleteMinusIcon\"\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,YAAY,UAAU;AAC/B,SAAS,UAAU;AA2Cb,SAOe,KAPf;AAvBC,IAAM,oBAAoB;AAAA,EAC/B,CAAC,EAAE,WAAW,UAAU,MAAM,GAAG,KAAK,GAAG,QAAQ;AAC/C,UAAM,EAAE,cAAc,OAAO,IAAI,uBAAuB;AACxD,UAAM,EAAE,cAAc,IAAI,qBAAqB;AAE/C,6CAAa;AAEb,UAAM,MAAmB;AAAA,MACvB,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,MACN,KAAK;AAAA,MACL,SAAS;AAAA,MACT,eAAe;AAAA,MACf,WAAW;AAAA,MACX,gBAAgB;AAAA,MAChB,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC,WAAW,GAAG,gCAAgC,SAAS;AAAA,QACvD,OAAO;AAAA,QACN,GAAG,cAAc,MAAM,GAAG;AAAA,QAE1B;AAAA,mBAAS,OACR,oBAAC,wBACE,kBAAQ,oBAAC,yBAAsB,GAClC,IACE;AAAA,UAEH,OACC,oBAAC,GAAG,MAAH,EAAQ,OAAO,EAAE,MAAM,GAAG,eAAe,OAAO,GAAG,WAAW,GAC5D,UACH,IAEA;AAAA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,kBAAkB,cAAc;AAChC,kBAAkB,SAAS;AAE3B,IAAM,wBAA4B,MAChC,oBAAC,SAAI,QAAO,OAAM,SAAQ,eAAc,OAAM,OAC5C;AAAA,EAAC;AAAA;AAAA,IACC,GAAE;AAAA,IACF,MAAK;AAAA;AACP,GACF;AAGF,sBAAsB,cAAc;AACpC,sBAAsB,SAAS;","names":[]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  useAutocompleteContext,
4
4
  useAutocompleteDescendantsContext
5
- } from "./chunk-JPUKYLBW.mjs";
5
+ } from "./chunk-WDQYM4FP.mjs";
6
6
 
7
7
  // src/use-autocomplete-list.ts
8
8
  import { mergeRefs, useUpdateEffect } from "@yamada-ui/utils";
@@ -49,24 +49,24 @@ var useAutocompleteList = () => {
49
49
  (props = {}, ref = null) => {
50
50
  var _a;
51
51
  return {
52
- as: "ul",
52
+ id: (_a = props.id) != null ? _a : uuid,
53
53
  ref: mergeRefs(listRef, ref),
54
+ as: "ul",
55
+ position: "relative",
54
56
  role: "listbox",
55
57
  tabIndex: -1,
56
- position: "relative",
57
- id: (_a = props.id) != null ? _a : uuid,
58
58
  ...props
59
59
  };
60
60
  },
61
61
  [listRef, uuid]
62
62
  );
63
63
  return {
64
- onAnimationComplete,
65
- getListProps
64
+ getListProps,
65
+ onAnimationComplete
66
66
  };
67
67
  };
68
68
 
69
69
  export {
70
70
  useAutocompleteList
71
71
  };
72
- //# sourceMappingURL=chunk-R76HPAN4.mjs.map
72
+ //# sourceMappingURL=chunk-TR4X4EEG.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-autocomplete-list.ts"],"sourcesContent":["import type { PropGetter } from \"@yamada-ui/core\"\nimport { mergeRefs, useUpdateEffect } from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\nimport {\n useAutocompleteContext,\n useAutocompleteDescendantsContext,\n} from \"./autocomplete-context\"\n\nexport const useAutocompleteList = () => {\n const uuid = useId()\n const { focusedIndex, isOpen, listRef, rebirthOptions } =\n useAutocompleteContext()\n\n const descendants = useAutocompleteDescendantsContext()\n\n const beforeFocusedIndex = useRef<number>(-1)\n const selectedValue = descendants.value(focusedIndex)\n\n const onAnimationComplete = useCallback(() => {\n if (!isOpen) rebirthOptions(false)\n }, [isOpen, rebirthOptions])\n\n useEffect(() => {\n if (!listRef.current || !selectedValue) return\n\n if (beforeFocusedIndex.current === selectedValue.index) return\n\n const parent = listRef.current\n const child = selectedValue.node\n\n const parentHeight = parent.clientHeight\n const viewTop = parent.scrollTop\n const viewBottom = viewTop + parentHeight\n\n const childHeight = child.clientHeight\n const childTop = child.offsetTop\n const childBottom = childTop + childHeight\n\n const isInView = viewTop <= childTop && childBottom <= viewBottom\n\n const isScrollBottom = beforeFocusedIndex.current < selectedValue.index\n\n if (!isInView) {\n if (childBottom <= parentHeight) {\n listRef.current.scrollTo({ top: 0 })\n } else {\n if (!isScrollBottom) {\n listRef.current.scrollTo({ top: childTop + 1 })\n } else {\n listRef.current.scrollTo({ top: childBottom - parentHeight })\n }\n }\n }\n\n beforeFocusedIndex.current = selectedValue.index\n }, [listRef, selectedValue])\n\n useUpdateEffect(() => {\n if (!isOpen) beforeFocusedIndex.current = -1\n }, [isOpen])\n\n const getListProps: PropGetter<\"ul\"> = useCallback(\n (props = {}, ref = null) => ({\n as: \"ul\",\n ref: mergeRefs(listRef, ref),\n role: \"listbox\",\n tabIndex: -1,\n position: \"relative\",\n id: props.id ?? uuid,\n ...props,\n }),\n [listRef, uuid],\n )\n\n return {\n onAnimationComplete,\n getListProps,\n }\n}\n"],"mappings":";;;;;;;AACA,SAAS,WAAW,uBAAuB;AAC3C,SAAS,aAAa,WAAW,OAAO,cAAc;AAM/C,IAAM,sBAAsB,MAAM;AACvC,QAAM,OAAO,MAAM;AACnB,QAAM,EAAE,cAAc,QAAQ,SAAS,eAAe,IACpD,uBAAuB;AAEzB,QAAM,cAAc,kCAAkC;AAEtD,QAAM,qBAAqB,OAAe,EAAE;AAC5C,QAAM,gBAAgB,YAAY,MAAM,YAAY;AAEpD,QAAM,sBAAsB,YAAY,MAAM;AAC5C,QAAI,CAAC,OAAQ,gBAAe,KAAK;AAAA,EACnC,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,YAAU,MAAM;AACd,QAAI,CAAC,QAAQ,WAAW,CAAC,cAAe;AAExC,QAAI,mBAAmB,YAAY,cAAc,MAAO;AAExD,UAAM,SAAS,QAAQ;AACvB,UAAM,QAAQ,cAAc;AAE5B,UAAM,eAAe,OAAO;AAC5B,UAAM,UAAU,OAAO;AACvB,UAAM,aAAa,UAAU;AAE7B,UAAM,cAAc,MAAM;AAC1B,UAAM,WAAW,MAAM;AACvB,UAAM,cAAc,WAAW;AAE/B,UAAM,WAAW,WAAW,YAAY,eAAe;AAEvD,UAAM,iBAAiB,mBAAmB,UAAU,cAAc;AAElE,QAAI,CAAC,UAAU;AACb,UAAI,eAAe,cAAc;AAC/B,gBAAQ,QAAQ,SAAS,EAAE,KAAK,EAAE,CAAC;AAAA,MACrC,OAAO;AACL,YAAI,CAAC,gBAAgB;AACnB,kBAAQ,QAAQ,SAAS,EAAE,KAAK,WAAW,EAAE,CAAC;AAAA,QAChD,OAAO;AACL,kBAAQ,QAAQ,SAAS,EAAE,KAAK,cAAc,aAAa,CAAC;AAAA,QAC9D;AAAA,MACF;AAAA,IACF;AAEA,uBAAmB,UAAU,cAAc;AAAA,EAC7C,GAAG,CAAC,SAAS,aAAa,CAAC;AAE3B,kBAAgB,MAAM;AACpB,QAAI,CAAC,OAAQ,oBAAmB,UAAU;AAAA,EAC5C,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,eAAiC;AAAA,IACrC,CAAC,QAAQ,CAAC,GAAG,MAAM,SAAM;AA9D7B;AA8DiC;AAAA,QAC3B,IAAI;AAAA,QACJ,KAAK,UAAU,SAAS,GAAG;AAAA,QAC3B,MAAM;AAAA,QACN,UAAU;AAAA,QACV,UAAU;AAAA,QACV,KAAI,WAAM,OAAN,YAAY;AAAA,QAChB,GAAG;AAAA,MACL;AAAA;AAAA,IACA,CAAC,SAAS,IAAI;AAAA,EAChB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/use-autocomplete-list.ts"],"sourcesContent":["import type { PropGetter } from \"@yamada-ui/core\"\nimport { mergeRefs, useUpdateEffect } from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\nimport {\n useAutocompleteContext,\n useAutocompleteDescendantsContext,\n} from \"./autocomplete-context\"\n\nexport const useAutocompleteList = () => {\n const uuid = useId()\n const { focusedIndex, isOpen, listRef, rebirthOptions } =\n useAutocompleteContext()\n\n const descendants = useAutocompleteDescendantsContext()\n\n const beforeFocusedIndex = useRef<number>(-1)\n const selectedValue = descendants.value(focusedIndex)\n\n const onAnimationComplete = useCallback(() => {\n if (!isOpen) rebirthOptions(false)\n }, [isOpen, rebirthOptions])\n\n useEffect(() => {\n if (!listRef.current || !selectedValue) return\n\n if (beforeFocusedIndex.current === selectedValue.index) return\n\n const parent = listRef.current\n const child = selectedValue.node\n\n const parentHeight = parent.clientHeight\n const viewTop = parent.scrollTop\n const viewBottom = viewTop + parentHeight\n\n const childHeight = child.clientHeight\n const childTop = child.offsetTop\n const childBottom = childTop + childHeight\n\n const isInView = viewTop <= childTop && childBottom <= viewBottom\n\n const isScrollBottom = beforeFocusedIndex.current < selectedValue.index\n\n if (!isInView) {\n if (childBottom <= parentHeight) {\n listRef.current.scrollTo({ top: 0 })\n } else {\n if (!isScrollBottom) {\n listRef.current.scrollTo({ top: childTop + 1 })\n } else {\n listRef.current.scrollTo({ top: childBottom - parentHeight })\n }\n }\n }\n\n beforeFocusedIndex.current = selectedValue.index\n }, [listRef, selectedValue])\n\n useUpdateEffect(() => {\n if (!isOpen) beforeFocusedIndex.current = -1\n }, [isOpen])\n\n const getListProps: PropGetter<\"ul\"> = useCallback(\n (props = {}, ref = null) => ({\n id: props.id ?? uuid,\n ref: mergeRefs(listRef, ref),\n as: \"ul\",\n position: \"relative\",\n role: \"listbox\",\n tabIndex: -1,\n ...props,\n }),\n [listRef, uuid],\n )\n\n return {\n getListProps,\n onAnimationComplete,\n }\n}\n"],"mappings":";;;;;;;AACA,SAAS,WAAW,uBAAuB;AAC3C,SAAS,aAAa,WAAW,OAAO,cAAc;AAM/C,IAAM,sBAAsB,MAAM;AACvC,QAAM,OAAO,MAAM;AACnB,QAAM,EAAE,cAAc,QAAQ,SAAS,eAAe,IACpD,uBAAuB;AAEzB,QAAM,cAAc,kCAAkC;AAEtD,QAAM,qBAAqB,OAAe,EAAE;AAC5C,QAAM,gBAAgB,YAAY,MAAM,YAAY;AAEpD,QAAM,sBAAsB,YAAY,MAAM;AAC5C,QAAI,CAAC,OAAQ,gBAAe,KAAK;AAAA,EACnC,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,YAAU,MAAM;AACd,QAAI,CAAC,QAAQ,WAAW,CAAC,cAAe;AAExC,QAAI,mBAAmB,YAAY,cAAc,MAAO;AAExD,UAAM,SAAS,QAAQ;AACvB,UAAM,QAAQ,cAAc;AAE5B,UAAM,eAAe,OAAO;AAC5B,UAAM,UAAU,OAAO;AACvB,UAAM,aAAa,UAAU;AAE7B,UAAM,cAAc,MAAM;AAC1B,UAAM,WAAW,MAAM;AACvB,UAAM,cAAc,WAAW;AAE/B,UAAM,WAAW,WAAW,YAAY,eAAe;AAEvD,UAAM,iBAAiB,mBAAmB,UAAU,cAAc;AAElE,QAAI,CAAC,UAAU;AACb,UAAI,eAAe,cAAc;AAC/B,gBAAQ,QAAQ,SAAS,EAAE,KAAK,EAAE,CAAC;AAAA,MACrC,OAAO;AACL,YAAI,CAAC,gBAAgB;AACnB,kBAAQ,QAAQ,SAAS,EAAE,KAAK,WAAW,EAAE,CAAC;AAAA,QAChD,OAAO;AACL,kBAAQ,QAAQ,SAAS,EAAE,KAAK,cAAc,aAAa,CAAC;AAAA,QAC9D;AAAA,MACF;AAAA,IACF;AAEA,uBAAmB,UAAU,cAAc;AAAA,EAC7C,GAAG,CAAC,SAAS,aAAa,CAAC;AAE3B,kBAAgB,MAAM;AACpB,QAAI,CAAC,OAAQ,oBAAmB,UAAU;AAAA,EAC5C,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,eAAiC;AAAA,IACrC,CAAC,QAAQ,CAAC,GAAG,MAAM,SAAM;AA9D7B;AA8DiC;AAAA,QAC3B,KAAI,WAAM,OAAN,YAAY;AAAA,QAChB,KAAK,UAAU,SAAS,GAAG;AAAA,QAC3B,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,MAAM;AAAA,QACN,UAAU;AAAA,QACV,GAAG;AAAA,MACL;AAAA;AAAA,IACA,CAAC,SAAS,IAAI;AAAA,EAChB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1,10 +1,10 @@
1
1
  "use client"
2
2
  import {
3
3
  useAutocompleteContext
4
- } from "./chunk-JPUKYLBW.mjs";
4
+ } from "./chunk-WDQYM4FP.mjs";
5
5
 
6
6
  // src/autocomplete-icon.tsx
7
- import { ui, forwardRef } from "@yamada-ui/core";
7
+ import { forwardRef, ui } from "@yamada-ui/core";
8
8
  import { ChevronIcon, CloseIcon } from "@yamada-ui/icon";
9
9
  import { useClickable } from "@yamada-ui/use-clickable";
10
10
  import { cx, getValidChildren, isValidElement } from "@yamada-ui/utils";
@@ -14,27 +14,27 @@ var AutocompleteIcon = forwardRef(
14
14
  ({ className, children, __css, ...rest }, ref) => {
15
15
  const { styles } = useAutocompleteContext();
16
16
  const css = {
17
- position: "absolute",
18
- top: "50%",
19
- transform: "translateY(-50%)",
20
- display: "inline-flex",
21
17
  alignItems: "center",
18
+ cursor: "pointer",
19
+ display: "inline-flex",
22
20
  justifyContent: "center",
23
21
  pointerEvents: "none",
24
- cursor: "pointer",
22
+ position: "absolute",
23
+ top: "50%",
24
+ transform: "translateY(-50%)",
25
25
  ...styles.icon,
26
26
  ...__css
27
27
  };
28
28
  const validChildren = getValidChildren(children);
29
29
  const cloneChildren = validChildren.map(
30
30
  (child) => cloneElement(child, {
31
- focusable: false,
32
- "aria-hidden": true,
33
31
  style: {
34
- maxWidth: "1em",
32
+ color: "currentColor",
35
33
  maxHeight: "1em",
36
- color: "currentColor"
37
- }
34
+ maxWidth: "1em"
35
+ },
36
+ "aria-hidden": true,
37
+ focusable: false
38
38
  })
39
39
  );
40
40
  return /* @__PURE__ */ jsx(
@@ -67,11 +67,11 @@ var AutocompleteClearIcon = ({
67
67
  return /* @__PURE__ */ jsx(
68
68
  AutocompleteIcon,
69
69
  {
70
- "aria-label": "Clear value",
71
70
  className: cx("ui-autocomplete__icon--clear", className),
71
+ "aria-label": "Clear value",
72
72
  __css: styles.clearIcon,
73
73
  ...rest,
74
- children: children != null ? children : /* @__PURE__ */ jsx(CloseIcon, { w: "0.5em", h: "0.5em" })
74
+ children: children != null ? children : /* @__PURE__ */ jsx(CloseIcon, { h: "0.5em", w: "0.5em" })
75
75
  }
76
76
  );
77
77
  };
@@ -80,11 +80,11 @@ AutocompleteClearIcon.__ui__ = "AutocompleteClearIcon";
80
80
  var AutocompleteItemIcon = forwardRef(({ className, ...rest }, ref) => {
81
81
  const { styles } = useAutocompleteContext();
82
82
  const css = {
83
- flexShrink: 0,
84
- display: "inline-flex",
85
- justifyContent: "center",
86
83
  alignItems: "center",
84
+ display: "inline-flex",
85
+ flexShrink: 0,
87
86
  fontSize: "0.85em",
87
+ justifyContent: "center",
88
88
  ...styles.itemIcon
89
89
  };
90
90
  return /* @__PURE__ */ jsx(
@@ -105,4 +105,4 @@ export {
105
105
  AutocompleteClearIcon,
106
106
  AutocompleteItemIcon
107
107
  };
108
- //# sourceMappingURL=chunk-7SWSKLSA.mjs.map
108
+ //# sourceMappingURL=chunk-V6YCG642.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/autocomplete-icon.tsx"],"sourcesContent":["import type { CSSUIObject, FC, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { HTMLAttributes } from \"react\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { ChevronIcon, CloseIcon } from \"@yamada-ui/icon\"\nimport { useClickable } from \"@yamada-ui/use-clickable\"\nimport { cx, getValidChildren, isValidElement } from \"@yamada-ui/utils\"\nimport { cloneElement, useRef } from \"react\"\nimport { useAutocompleteContext } from \"./autocomplete-context\"\n\nexport interface AutocompleteIconProps extends HTMLUIProps {}\n\nexport const AutocompleteIcon = forwardRef<AutocompleteIconProps, \"div\">(\n ({ className, children, __css, ...rest }, ref) => {\n const { styles } = useAutocompleteContext()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n cursor: \"pointer\",\n display: \"inline-flex\",\n justifyContent: \"center\",\n pointerEvents: \"none\",\n position: \"absolute\",\n top: \"50%\",\n transform: \"translateY(-50%)\",\n ...styles.icon,\n ...__css,\n }\n\n const validChildren = getValidChildren(children)\n\n const cloneChildren = validChildren.map((child) =>\n cloneElement(child, {\n style: {\n color: \"currentColor\",\n maxHeight: \"1em\",\n maxWidth: \"1em\",\n },\n \"aria-hidden\": true,\n focusable: false,\n }),\n )\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-autocomplete__icon\", className)}\n __css={css}\n {...rest}\n >\n {isValidElement(children) ? cloneChildren : <ChevronIcon />}\n </ui.div>\n )\n },\n)\n\nAutocompleteIcon.displayName = \"AutocompleteIcon\"\nAutocompleteIcon.__ui__ = \"AutocompleteIcon\"\n\nexport interface AutocompleteClearIconProps extends AutocompleteIconProps {\n disabled?: boolean\n}\n\nexport const AutocompleteClearIcon: FC<AutocompleteClearIconProps> = ({\n className,\n children,\n ...props\n}) => {\n const ref = useRef<HTMLDivElement>(null)\n const { styles } = useAutocompleteContext()\n\n const isDisabled = props.disabled\n\n const rest = useClickable({\n ref,\n isDisabled,\n ...(props as HTMLAttributes<HTMLElement>),\n })\n\n return (\n <AutocompleteIcon\n className={cx(\"ui-autocomplete__icon--clear\", className)}\n aria-label=\"Clear value\"\n __css={styles.clearIcon}\n {...rest}\n >\n {children ?? <CloseIcon h=\"0.5em\" w=\"0.5em\" />}\n </AutocompleteIcon>\n )\n}\n\nAutocompleteClearIcon.displayName = \"AutocompleteClearIcon\"\nAutocompleteClearIcon.__ui__ = \"AutocompleteClearIcon\"\n\nexport interface AutocompleteItemIconProps extends HTMLUIProps<\"span\"> {}\n\nexport const AutocompleteItemIcon = forwardRef<\n AutocompleteItemIconProps,\n \"span\"\n>(({ className, ...rest }, ref) => {\n const { styles } = useAutocompleteContext()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n flexShrink: 0,\n fontSize: \"0.85em\",\n justifyContent: \"center\",\n ...styles.itemIcon,\n }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-autocomplete__item__icon\", className)}\n __css={css}\n {...rest}\n />\n )\n})\n\nAutocompleteItemIcon.displayName = \"AutocompleteItemIcon\"\nAutocompleteItemIcon.__ui__ = \"AutocompleteItemIcon\"\n"],"mappings":";;;;;;AAEA,SAAS,YAAY,UAAU;AAC/B,SAAS,aAAa,iBAAiB;AACvC,SAAS,oBAAoB;AAC7B,SAAS,IAAI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AAA,MACX,OAAO,OAAO;AAAA,MACb,GAAG;AAAA,MAEH,wCAAY,oBAAC,aAAU,GAAE,SAAQ,GAAE,SAAQ;AAAA;AAAA,EAC9C;AAEJ;AAEA,sBAAsB,cAAc;AACpC,sBAAsB,SAAS;AAIxB,IAAM,uBAAuB,WAGlC,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AACjC,QAAM,EAAE,OAAO,IAAI,uBAAuB;AAE1C,QAAM,MAAmB;AAAA,IACvB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,GAAG,OAAO;AAAA,EACZ;AAEA,SACE;AAAA,IAAC,GAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,WAAW,GAAG,+BAA+B,SAAS;AAAA,MACtD,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AAED,qBAAqB,cAAc;AACnC,qBAAqB,SAAS;","names":[]}
@@ -1,34 +1,34 @@
1
1
  "use client"
2
2
  import {
3
3
  useAutocompleteList
4
- } from "./chunk-R76HPAN4.mjs";
4
+ } from "./chunk-TR4X4EEG.mjs";
5
5
  import {
6
6
  useAutocompleteContext
7
- } from "./chunk-JPUKYLBW.mjs";
7
+ } from "./chunk-WDQYM4FP.mjs";
8
8
 
9
9
  // src/autocomplete-list.tsx
10
- import { ui, forwardRef } from "@yamada-ui/core";
10
+ import { forwardRef, ui } from "@yamada-ui/core";
11
11
  import { PopoverContent } from "@yamada-ui/popover";
12
12
  import { cx, handlerAll } from "@yamada-ui/utils";
13
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
14
  var AutocompleteList = forwardRef(
15
15
  ({
16
16
  className,
17
- w,
18
- width,
19
- minW,
20
- minWidth,
17
+ children,
18
+ footer,
19
+ header,
21
20
  maxW,
22
21
  maxWidth,
22
+ minW,
23
+ minWidth,
24
+ w,
25
+ width,
23
26
  contentProps,
24
- header,
25
- footer,
26
- children,
27
27
  ...rest
28
28
  }, ref) => {
29
29
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
30
30
  const { styles } = useAutocompleteContext();
31
- const { onAnimationComplete, getListProps } = useAutocompleteList();
31
+ const { getListProps, onAnimationComplete } = useAutocompleteList();
32
32
  width != null ? width : width = w;
33
33
  width != null ? width : width = (_c = (_a = styles.list) == null ? void 0 : _a.width) != null ? _c : (_b = styles.list) == null ? void 0 : _b.w;
34
34
  minWidth != null ? minWidth : minWidth = minW;
@@ -40,10 +40,10 @@ var AutocompleteList = forwardRef(
40
40
  {
41
41
  as: "div",
42
42
  className: "ui-autocomplete__popover",
43
- width,
44
- minWidth,
45
43
  maxWidth,
46
- __css: { ...styles.content, width, minWidth, maxWidth },
44
+ minWidth,
45
+ width,
46
+ __css: { ...styles.content, maxWidth, minWidth, width },
47
47
  ...contentProps,
48
48
  onAnimationComplete: handlerAll(
49
49
  contentProps == null ? void 0 : contentProps.onAnimationComplete,
@@ -86,4 +86,4 @@ AutocompleteList.__ui__ = "AutocompleteList";
86
86
  export {
87
87
  AutocompleteList
88
88
  };
89
- //# sourceMappingURL=chunk-S53LMDD7.mjs.map
89
+ //# sourceMappingURL=chunk-VTBUO5SK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/autocomplete-list.tsx"],"sourcesContent":["import type { CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { MotionPropsWithoutChildren } from \"@yamada-ui/motion\"\nimport type { ReactNode } from \"react\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { PopoverContent } from \"@yamada-ui/popover\"\nimport { cx, handlerAll } from \"@yamada-ui/utils\"\nimport { useAutocompleteContext } from \"./autocomplete-context\"\nimport { useAutocompleteList } from \"./use-autocomplete-list\"\n\nexport interface AutocompleteListProps extends HTMLUIProps<\"ul\"> {\n footer?: ReactNode\n header?: ReactNode\n contentProps?: MotionPropsWithoutChildren\n}\n\nexport const AutocompleteList = forwardRef<AutocompleteListProps, \"ul\">(\n (\n {\n className,\n children,\n footer,\n header,\n maxW,\n maxWidth,\n minW,\n minWidth,\n w,\n width,\n contentProps,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useAutocompleteContext()\n const { getListProps, onAnimationComplete } = useAutocompleteList()\n\n width ??= w\n width ??= (styles.list?.width ?? styles.list?.w) as CSSUIProps[\"width\"]\n minWidth ??= minW\n minWidth ??= (styles.list?.minWidth ??\n styles.list?.minW) as CSSUIProps[\"minWidth\"]\n maxWidth ??= maxW\n maxWidth ??= (styles.list?.maxWidth ??\n styles.list?.maxW) as CSSUIProps[\"maxWidth\"]\n\n return (\n <PopoverContent\n as=\"div\"\n className=\"ui-autocomplete__popover\"\n maxWidth={maxWidth}\n minWidth={minWidth}\n width={width}\n __css={{ ...styles.content, maxWidth, minWidth, width }}\n {...contentProps}\n onAnimationComplete={handlerAll(\n contentProps?.onAnimationComplete,\n onAnimationComplete,\n )}\n >\n {header ? (\n <ui.div\n className=\"ui-autocomplete__header\"\n __css={{ ...styles.header }}\n >\n {header}\n </ui.div>\n ) : null}\n\n <ui.ul\n className={cx(\"ui-autocomplete__list\", className)}\n __css={{ ...styles.list }}\n {...getListProps(rest, ref)}\n >\n {children}\n </ui.ul>\n\n {footer ? (\n <ui.div\n className=\"ui-autocomplete__footer\"\n __css={{ ...styles.footer }}\n >\n {footer}\n </ui.div>\n ) : null}\n </PopoverContent>\n )\n },\n)\n\nAutocompleteList.displayName = \"AutocompleteList\"\nAutocompleteList.__ui__ = \"AutocompleteList\"\n"],"mappings":";;;;;;;;;AAGA,SAAS,YAAY,UAAU;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,IAAI,kBAAkB;AAyCzB,SAcI,KAdJ;AA/BC,IAAM,mBAAmB;AAAA,EAC9B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,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