@yamada-ui/autocomplete 1.5.4-next-20241005220055 → 1.6.0-dev-20241011151311

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 +56 -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 +303 -292
  35. package/dist/autocomplete.js.map +1 -1
  36. package/dist/autocomplete.mjs +12 -12
  37. package/dist/{chunk-5GKGL6BL.mjs → chunk-2HJUFFCU.mjs} +16 -16
  38. package/dist/chunk-2HJUFFCU.mjs.map +1 -0
  39. package/dist/{chunk-6F3LT7J6.mjs → chunk-4SBNPEK7.mjs} +7 -7
  40. package/dist/{chunk-6F3LT7J6.mjs.map → chunk-4SBNPEK7.mjs.map} +1 -1
  41. package/dist/{chunk-JMX72TSD.mjs → chunk-67X7JKWL.mjs} +7 -7
  42. package/dist/{chunk-JMX72TSD.mjs.map → chunk-67X7JKWL.mjs.map} +1 -1
  43. package/dist/{chunk-5LPWFWE6.mjs → chunk-6OLHNK7O.mjs} +46 -34
  44. package/dist/chunk-6OLHNK7O.mjs.map +1 -0
  45. package/dist/{chunk-QPIWG4ZF.mjs → chunk-7LZUXESV.mjs} +63 -61
  46. package/dist/chunk-7LZUXESV.mjs.map +1 -0
  47. package/dist/{chunk-S2HFYJVI.mjs → chunk-AIBJWPRA.mjs} +13 -13
  48. package/dist/chunk-AIBJWPRA.mjs.map +1 -0
  49. package/dist/{chunk-Q2HZVVOI.mjs → chunk-K5HCHHCJ.mjs} +16 -16
  50. package/dist/chunk-K5HCHHCJ.mjs.map +1 -0
  51. package/dist/{chunk-HZECQUHV.mjs → chunk-Q33EMTO2.mjs} +40 -40
  52. package/dist/{chunk-HZECQUHV.mjs.map → chunk-Q33EMTO2.mjs.map} +1 -1
  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-OLOU5HFC.mjs → chunk-WERCEZNJ.mjs} +168 -166
  62. package/dist/chunk-WERCEZNJ.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 +356 -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 +326 -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 +43 -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 +225 -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-WERCEZNJ.mjs";
6
6
  import {
7
7
  AutocompleteCreate
8
- } from "./chunk-Q2HZVVOI.mjs";
8
+ } from "./chunk-K5HCHHCJ.mjs";
9
9
  import {
10
10
  AutocompleteEmpty
11
- } from "./chunk-5GKGL6BL.mjs";
11
+ } from "./chunk-2HJUFFCU.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-7LZUXESV.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;AAtF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AAAA,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,34 +1,34 @@
1
1
  "use client"
2
2
  import {
3
3
  useAutocompleteOption
4
- } from "./chunk-5LPWFWE6.mjs";
4
+ } from "./chunk-6OLHNK7O.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-option.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 AutocompleteOption = forwardRef(
17
17
  ({ className, icon, ...rest }, ref) => {
18
18
  const { styles } = useAutocompleteContext();
19
- const { isSelected, customIcon, children, getOptionProps } = useAutocompleteOption(rest);
19
+ const { children, customIcon, isSelected, getOptionProps } = useAutocompleteOption(rest);
20
20
  icon != null ? icon : icon = customIcon;
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,
28
+ textAlign: "start",
29
+ textDecoration: "none",
30
+ userSelect: "none",
31
+ width: "100%",
32
32
  ...styles.item
33
33
  };
34
34
  return /* @__PURE__ */ jsxs(
@@ -47,7 +47,7 @@ var AutocompleteOption = forwardRef(
47
47
  );
48
48
  AutocompleteOption.displayName = "AutocompleteOption";
49
49
  AutocompleteOption.__ui__ = "AutocompleteOption";
50
- var AutocompleteCheckIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 14 14", width: "1em", height: "1em", children: /* @__PURE__ */ jsx(
50
+ var AutocompleteCheckIcon = () => /* @__PURE__ */ jsx("svg", { height: "1em", viewBox: "0 0 14 14", width: "1em", children: /* @__PURE__ */ jsx(
51
51
  "polygon",
52
52
  {
53
53
  fill: "currentColor",
@@ -60,4 +60,4 @@ AutocompleteCheckIcon.__ui__ = "AutocompleteCheckIcon";
60
60
  export {
61
61
  AutocompleteOption
62
62
  };
63
- //# sourceMappingURL=chunk-S2HFYJVI.mjs.map
63
+ //# sourceMappingURL=chunk-AIBJWPRA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/autocomplete-option.tsx"],"sourcesContent":["import type { CSSUIObject, FC } from \"@yamada-ui/core\"\nimport type { ReactElement } from \"react\"\nimport type { UseAutocompleteOptionProps } from \"./use-autocomplete-option\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useAutocompleteContext } from \"./autocomplete-context\"\nimport { AutocompleteItemIcon } from \"./autocomplete-icon\"\nimport { useAutocompleteOption } from \"./use-autocomplete-option\"\n\ninterface AutocompleteOptionOptions {\n /**\n * The autocomplete option icon to use.\n */\n icon?: null | ReactElement\n}\n\nexport interface AutocompleteOptionProps\n extends UseAutocompleteOptionProps,\n AutocompleteOptionOptions {}\n\nexport const AutocompleteOption = forwardRef<AutocompleteOptionProps, \"li\">(\n ({ className, icon, ...rest }, ref) => {\n const { styles } = useAutocompleteContext()\n const { children, customIcon, isSelected, getOptionProps } =\n useAutocompleteOption(rest)\n\n icon ??= customIcon\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 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\", className)}\n __css={css}\n {...getOptionProps({}, ref)}\n >\n {icon !== null ? (\n <AutocompleteItemIcon opacity={isSelected ? 1 : 0}>\n {icon || <AutocompleteCheckIcon />}\n </AutocompleteItemIcon>\n ) : null}\n\n <ui.span style={{ flex: 1 }} data-label>\n {children}\n </ui.span>\n </ui.li>\n )\n },\n)\n\nAutocompleteOption.displayName = \"AutocompleteOption\"\nAutocompleteOption.__ui__ = \"AutocompleteOption\"\n\nconst AutocompleteCheckIcon: FC = () => (\n <svg height=\"1em\" viewBox=\"0 0 14 14\" width=\"1em\">\n <polygon\n fill=\"currentColor\"\n points=\"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039\"\n />\n </svg>\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@@
1
1
  "use client"
2
2
  import {
3
3
  useAutocompleteCreate
4
- } from "./chunk-5LPWFWE6.mjs";
4
+ } from "./chunk-6OLHNK7O.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-create.tsx
13
- import { ui, forwardRef } from "@yamada-ui/core";
13
+ import { forwardRef, ui } from "@yamada-ui/core";
14
14
  import { cx, runIfFunc } from "@yamada-ui/utils";
15
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
16
  var AutocompleteCreate = forwardRef(
17
- ({ className, icon, children, ...rest }, ref) => {
17
+ ({ className, children, icon, ...rest }, ref) => {
18
18
  const { inputValue, styles } = useAutocompleteContext();
19
19
  const { getCreateProps } = useAutocompleteCreate();
20
20
  children != null ? children : children = inputValue;
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,
28
+ textAlign: "start",
29
+ textDecoration: "none",
30
+ userSelect: "none",
31
+ width: "100%",
32
32
  ...styles.item
33
33
  };
34
34
  return /* @__PURE__ */ jsxs(
@@ -39,7 +39,7 @@ var AutocompleteCreate = forwardRef(
39
39
  ...getCreateProps(rest, ref),
40
40
  children: [
41
41
  icon !== null ? /* @__PURE__ */ jsx(AutocompleteItemIcon, { children: icon || /* @__PURE__ */ jsx(AutocompletePlusIcon, {}) }) : null,
42
- icon ? /* @__PURE__ */ jsx(ui.span, { style: { pointerEvents: "none", flex: 1 }, lineClamp: 1, children: runIfFunc(children, inputValue) }) : runIfFunc(children, inputValue)
42
+ icon ? /* @__PURE__ */ jsx(ui.span, { style: { flex: 1, pointerEvents: "none" }, lineClamp: 1, children: runIfFunc(children, inputValue) }) : runIfFunc(children, inputValue)
43
43
  ]
44
44
  }
45
45
  );
@@ -47,11 +47,11 @@ var AutocompleteCreate = forwardRef(
47
47
  );
48
48
  AutocompleteCreate.displayName = "AutocompleteCreate";
49
49
  AutocompleteCreate.__ui__ = "AutocompleteCreate";
50
- var AutocompletePlusIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 45.402 45.402", width: "1em", height: "1em", children: /* @__PURE__ */ jsx(
50
+ var AutocompletePlusIcon = () => /* @__PURE__ */ jsx("svg", { height: "1em", viewBox: "0 0 45.402 45.402", width: "1em", children: /* @__PURE__ */ jsx(
51
51
  "path",
52
52
  {
53
- fill: "currentColor",
54
- d: "M41.267,18.557H26.832V4.134C26.832,1.851,24.99,0,22.707,0c-2.283,0-4.124,1.851-4.124,4.135v14.432H4.141 c-2.283,0-4.139,1.851-4.138,4.135c-0.001,1.141,0.46,2.187,1.207,2.934c0.748,0.749,1.78,1.222,2.92,1.222h14.453V41.27 c0,1.142,0.453,2.176,1.201,2.922c0.748,0.748,1.777,1.211,2.919,1.211c2.282,0,4.129-1.851,4.129-4.133V26.857h14.435 c2.283,0,4.134-1.867,4.133-4.15C45.399,20.425,43.548,18.557,41.267,18.557z"
53
+ d: "M41.267,18.557H26.832V4.134C26.832,1.851,24.99,0,22.707,0c-2.283,0-4.124,1.851-4.124,4.135v14.432H4.141 c-2.283,0-4.139,1.851-4.138,4.135c-0.001,1.141,0.46,2.187,1.207,2.934c0.748,0.749,1.78,1.222,2.92,1.222h14.453V41.27 c0,1.142,0.453,2.176,1.201,2.922c0.748,0.748,1.777,1.211,2.919,1.211c2.282,0,4.129-1.851,4.129-4.133V26.857h14.435 c2.283,0,4.134-1.867,4.133-4.15C45.399,20.425,43.548,18.557,41.267,18.557z",
54
+ fill: "currentColor"
55
55
  }
56
56
  ) });
57
57
  AutocompletePlusIcon.displayName = "AutocompletePlusIcon";
@@ -60,4 +60,4 @@ AutocompletePlusIcon.__ui__ = "AutocompletePlusIcon";
60
60
  export {
61
61
  AutocompleteCreate
62
62
  };
63
- //# sourceMappingURL=chunk-Q2HZVVOI.mjs.map
63
+ //# sourceMappingURL=chunk-K5HCHHCJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/autocomplete-create.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, runIfFunc } from \"@yamada-ui/utils\"\nimport { useAutocompleteContext } from \"./autocomplete-context\"\nimport { AutocompleteItemIcon } from \"./autocomplete-icon\"\nimport { useAutocompleteCreate } from \"./use-autocomplete-option\"\n\ninterface AutocompleteCreateOptions {\n /**\n * The label of the autocomplete create option.\n */\n children?: ((inputValue: string) => string) | string\n /**\n * The autocomplete create option icon to use.\n */\n icon?: null | ReactElement\n}\n\nexport interface AutocompleteCreateProps\n extends Omit<HTMLUIProps<\"li\">, \"children\">,\n AutocompleteCreateOptions {}\n\nexport const AutocompleteCreate = forwardRef<AutocompleteCreateProps, \"li\">(\n ({ className, children, icon, ...rest }, ref) => {\n const { inputValue, styles } = useAutocompleteContext()\n const { getCreateProps } = useAutocompleteCreate()\n\n children ??= inputValue\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 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--create\", className)}\n __css={css}\n {...getCreateProps(rest, ref)}\n >\n {icon !== null ? (\n <AutocompleteItemIcon>\n {icon || <AutocompletePlusIcon />}\n </AutocompleteItemIcon>\n ) : null}\n {icon ? (\n <ui.span style={{ flex: 1, pointerEvents: \"none\" }} lineClamp={1}>\n {runIfFunc(children, inputValue)}\n </ui.span>\n ) : (\n runIfFunc(children, inputValue)\n )}\n </ui.li>\n )\n },\n)\n\nAutocompleteCreate.displayName = \"AutocompleteCreate\"\nAutocompleteCreate.__ui__ = \"AutocompleteCreate\"\n\nconst AutocompletePlusIcon: FC = () => (\n <svg height=\"1em\" viewBox=\"0 0 45.402 45.402\" width=\"1em\">\n <path\n d=\"M41.267,18.557H26.832V4.134C26.832,1.851,24.99,0,22.707,0c-2.283,0-4.124,1.851-4.124,4.135v14.432H4.141 c-2.283,0-4.139,1.851-4.138,4.135c-0.001,1.141,0.46,2.187,1.207,2.934c0.748,0.749,1.78,1.222,2.92,1.222h14.453V41.27 c0,1.142,0.453,2.176,1.201,2.922c0.748,0.748,1.777,1.211,2.919,1.211c2.282,0,4.129-1.851,4.129-4.133V26.857h14.435 c2.283,0,4.134-1.867,4.133-4.15C45.399,20.425,43.548,18.557,41.267,18.557z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n\nAutocompletePlusIcon.displayName = \"AutocompletePlusIcon\"\nAutocompletePlusIcon.__ui__ = \"AutocompletePlusIcon\"\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,YAAY,UAAU;AAC/B,SAAS,IAAI,iBAAiB;AA0CxB,SAOe,KAPf;AAtBC,IAAM,qBAAqB;AAAA,EAChC,CAAC,EAAE,WAAW,UAAU,MAAM,GAAG,KAAK,GAAG,QAAQ;AAC/C,UAAM,EAAE,YAAY,OAAO,IAAI,uBAAuB;AACtD,UAAM,EAAE,eAAe,IAAI,sBAAsB;AAEjD,6CAAa;AAEb,UAAM,MAAmB;AAAA,MACvB,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,SAAS;AAAA,MACT,MAAM;AAAA,MACN,KAAK;AAAA,MACL,SAAS;AAAA,MACT,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,iCAAiC,SAAS;AAAA,QACxD,OAAO;AAAA,QACN,GAAG,eAAe,MAAM,GAAG;AAAA,QAE3B;AAAA,mBAAS,OACR,oBAAC,wBACE,kBAAQ,oBAAC,wBAAqB,GACjC,IACE;AAAA,UACH,OACC,oBAAC,GAAG,MAAH,EAAQ,OAAO,EAAE,MAAM,GAAG,eAAe,OAAO,GAAG,WAAW,GAC5D,oBAAU,UAAU,UAAU,GACjC,IAEA,UAAU,UAAU,UAAU;AAAA;AAAA;AAAA,IAElC;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;AAE5B,IAAM,uBAA2B,MAC/B,oBAAC,SAAI,QAAO,OAAM,SAAQ,qBAAoB,OAAM,OAClD;AAAA,EAAC;AAAA;AAAA,IACC,GAAE;AAAA,IACF,MAAK;AAAA;AACP,GACF;AAGF,qBAAqB,cAAc;AACnC,qBAAqB,SAAS;","names":[]}
@@ -2,31 +2,31 @@
2
2
  import {
3
3
  useAutocomplete,
4
4
  useAutocompleteInput
5
- } from "./chunk-OLOU5HFC.mjs";
5
+ } from "./chunk-WERCEZNJ.mjs";
6
6
  import {
7
7
  AutocompleteCreate
8
- } from "./chunk-Q2HZVVOI.mjs";
8
+ } from "./chunk-K5HCHHCJ.mjs";
9
9
  import {
10
10
  AutocompleteEmpty
11
- } from "./chunk-5GKGL6BL.mjs";
11
+ } from "./chunk-2HJUFFCU.mjs";
12
12
  import {
13
13
  AutocompleteList
14
- } from "./chunk-S53LMDD7.mjs";
14
+ } from "./chunk-VTBUO5SK.mjs";
15
15
  import {
16
16
  AutocompleteIcon
17
- } from "./chunk-7SWSKLSA.mjs";
17
+ } from "./chunk-V6YCG642.mjs";
18
18
  import {
19
19
  AutocompleteDescendantsContextProvider,
20
20
  AutocompleteProvider,
21
21
  useAutocompleteContext
22
- } from "./chunk-JPUKYLBW.mjs";
22
+ } from "./chunk-WDQYM4FP.mjs";
23
23
 
24
24
  // src/autocomplete.tsx
25
25
  import {
26
- ui,
27
26
  forwardRef,
28
- useComponentMultiStyle,
29
- omitThemeProps
27
+ omitThemeProps,
28
+ ui,
29
+ useComponentMultiStyle
30
30
  } from "@yamada-ui/core";
31
31
  import { Popover, PopoverTrigger } from "@yamada-ui/popover";
32
32
  import { Portal } from "@yamada-ui/portal";
@@ -37,46 +37,46 @@ var Autocomplete = forwardRef(
37
37
  const [styles, mergedProps] = useComponentMultiStyle("Autocomplete", props);
38
38
  let {
39
39
  className,
40
- defaultValue = "",
40
+ children,
41
41
  color,
42
+ defaultValue = "",
43
+ footer,
42
44
  h,
45
+ header,
43
46
  height,
44
47
  minH,
45
48
  minHeight,
46
49
  containerProps,
47
50
  contentProps,
48
- listProps,
51
+ createProps,
52
+ emptyProps,
49
53
  fieldProps,
50
- inputProps,
51
54
  iconProps,
55
+ inputProps,
56
+ listProps,
52
57
  portalProps = { isDisabled: true },
53
- createProps,
54
- emptyProps,
55
- header,
56
- footer,
57
- children,
58
58
  ...computedProps
59
59
  } = omitThemeProps(mergedProps);
60
60
  const {
61
- value,
62
- onClose,
61
+ allowCreate,
62
+ computedChildren,
63
63
  descendants,
64
+ inputValue,
65
+ isEmpty,
66
+ value,
64
67
  formControlProps,
65
- getPopoverProps,
66
68
  getContainerProps,
67
69
  getFieldProps,
68
- allowCreate,
69
- isEmpty,
70
- inputValue,
71
- computedChildren,
70
+ getPopoverProps,
71
+ onClose,
72
72
  ...rest
73
- } = useAutocomplete({ ...computedProps, defaultValue, children });
73
+ } = useAutocomplete({ ...computedProps, children, defaultValue });
74
74
  h != null ? h : h = height;
75
75
  minH != null ? minH : minH = minHeight;
76
76
  const css = {
77
- w: "100%",
78
- h: "fit-content",
79
77
  color,
78
+ h: "fit-content",
79
+ w: "100%",
80
80
  ...styles.container
81
81
  };
82
82
  return /* @__PURE__ */ jsx(AutocompleteDescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ jsx(
@@ -84,13 +84,13 @@ var Autocomplete = forwardRef(
84
84
  {
85
85
  value: {
86
86
  ...rest,
87
- value,
88
- onClose,
89
- formControlProps,
90
- inputValue,
91
87
  allowCreate,
88
+ inputValue,
92
89
  isEmpty,
93
- styles
90
+ styles,
91
+ value,
92
+ formControlProps,
93
+ onClose
94
94
  },
95
95
  children: /* @__PURE__ */ jsx(Popover, { ...getPopoverProps(), children: /* @__PURE__ */ jsxs(
96
96
  ui.div,
@@ -121,8 +121,8 @@ var Autocomplete = forwardRef(
121
121
  !isEmpty ? /* @__PURE__ */ jsx(Portal, { ...portalProps, children: /* @__PURE__ */ jsxs(
122
122
  AutocompleteList,
123
123
  {
124
- header: runIfFunc(header, { value, onClose }),
125
124
  footer: runIfFunc(footer, { value, onClose }),
125
+ header: runIfFunc(header, { value, onClose }),
126
126
  contentProps,
127
127
  ...listProps,
128
128
  children: [
@@ -133,8 +133,8 @@ var Autocomplete = forwardRef(
133
133
  ) }) : /* @__PURE__ */ jsx(Portal, { ...portalProps, children: /* @__PURE__ */ jsx(
134
134
  AutocompleteList,
135
135
  {
136
- header: runIfFunc(header, { value, onClose }),
137
136
  footer: runIfFunc(footer, { value, onClose }),
137
+ header: runIfFunc(header, { value, onClose }),
138
138
  contentProps,
139
139
  ...listProps,
140
140
  children: allowCreate && inputValue ? /* @__PURE__ */ jsx(AutocompleteCreate, { ...createProps }) : /* @__PURE__ */ jsx(AutocompleteEmpty, { ...emptyProps })
@@ -151,14 +151,14 @@ Autocomplete.displayName = "Autocomplete";
151
151
  Autocomplete.__ui__ = "Autocomplete";
152
152
  var AutocompleteField = forwardRef(
153
153
  ({ className, h, minH, placeholder, inputProps, ...rest }, ref) => {
154
- const { label, inputValue, styles } = useAutocompleteContext();
154
+ const { inputValue, label, styles } = useAutocompleteContext();
155
155
  const { getInputProps } = useAutocompleteInput();
156
156
  const css = {
157
- pe: "2rem",
157
+ alignItems: "center",
158
+ display: "flex",
158
159
  h,
159
160
  minH,
160
- display: "flex",
161
- alignItems: "center",
161
+ pe: "2rem",
162
162
  ...styles.field,
163
163
  cursor: "text"
164
164
  };
@@ -173,8 +173,8 @@ var AutocompleteField = forwardRef(
173
173
  {
174
174
  className: "ui-autocomplete__field__input",
175
175
  display: "inline-block",
176
- w: "100%",
177
176
  placeholder,
177
+ w: "100%",
178
178
  ...getInputProps(
179
179
  { ...inputProps, value: inputValue || label || "" },
180
180
  ref
@@ -191,4 +191,4 @@ AutocompleteField.__ui__ = "AutocompleteField";
191
191
  export {
192
192
  Autocomplete
193
193
  };
194
- //# sourceMappingURL=chunk-HZECQUHV.mjs.map
194
+ //# sourceMappingURL=chunk-Q33EMTO2.mjs.map