@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.
- package/dist/autocomplete-context.d.mts +115 -115
- package/dist/autocomplete-context.d.ts +115 -115
- package/dist/autocomplete-context.js +2 -2
- package/dist/autocomplete-context.js.map +1 -1
- package/dist/autocomplete-context.mjs +1 -1
- package/dist/autocomplete-create.d.mts +4 -4
- package/dist/autocomplete-create.d.ts +4 -4
- package/dist/autocomplete-create.js +32 -32
- package/dist/autocomplete-create.js.map +1 -1
- package/dist/autocomplete-create.mjs +4 -4
- package/dist/autocomplete-empty.d.mts +4 -4
- package/dist/autocomplete-empty.d.ts +4 -4
- package/dist/autocomplete-empty.js +34 -34
- package/dist/autocomplete-empty.js.map +1 -1
- package/dist/autocomplete-empty.mjs +4 -4
- package/dist/autocomplete-icon.js +17 -17
- package/dist/autocomplete-icon.js.map +1 -1
- package/dist/autocomplete-icon.mjs +2 -2
- package/dist/autocomplete-list.d.mts +2 -2
- package/dist/autocomplete-list.d.ts +2 -2
- package/dist/autocomplete-list.js +18 -18
- package/dist/autocomplete-list.js.map +1 -1
- package/dist/autocomplete-list.mjs +3 -3
- package/dist/autocomplete-option-group.js +10 -10
- package/dist/autocomplete-option-group.js.map +1 -1
- package/dist/autocomplete-option-group.mjs +3 -3
- package/dist/autocomplete-option.d.mts +1 -1
- package/dist/autocomplete-option.d.ts +1 -1
- package/dist/autocomplete-option.js +47 -47
- package/dist/autocomplete-option.js.map +1 -1
- package/dist/autocomplete-option.mjs +4 -4
- package/dist/autocomplete.d.mts +31 -31
- package/dist/autocomplete.d.ts +31 -31
- package/dist/autocomplete.js +294 -292
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.mjs +12 -12
- package/dist/{chunk-6F3LT7J6.mjs → chunk-4SBNPEK7.mjs} +7 -7
- package/dist/{chunk-6F3LT7J6.mjs.map → chunk-4SBNPEK7.mjs.map} +1 -1
- package/dist/{chunk-JMX72TSD.mjs → chunk-67X7JKWL.mjs} +7 -7
- package/dist/{chunk-JMX72TSD.mjs.map → chunk-67X7JKWL.mjs.map} +1 -1
- package/dist/{chunk-HZECQUHV.mjs → chunk-AXC7ILCH.mjs} +40 -40
- package/dist/{chunk-HZECQUHV.mjs.map → chunk-AXC7ILCH.mjs.map} +1 -1
- package/dist/{chunk-OLOU5HFC.mjs → chunk-BGZIX6SN.mjs} +168 -166
- package/dist/chunk-BGZIX6SN.mjs.map +1 -0
- package/dist/{chunk-Q2HZVVOI.mjs → chunk-BKW7XJ6R.mjs} +16 -16
- package/dist/chunk-BKW7XJ6R.mjs.map +1 -0
- package/dist/{chunk-5LPWFWE6.mjs → chunk-DDMSYTKO.mjs} +34 -34
- package/dist/chunk-DDMSYTKO.mjs.map +1 -0
- package/dist/{chunk-QPIWG4ZF.mjs → chunk-EEECVCVW.mjs} +63 -61
- package/dist/chunk-EEECVCVW.mjs.map +1 -0
- package/dist/{chunk-5GKGL6BL.mjs → chunk-KLXMUIGY.mjs} +16 -16
- package/dist/chunk-KLXMUIGY.mjs.map +1 -0
- package/dist/{chunk-R76HPAN4.mjs → chunk-TR4X4EEG.mjs} +7 -7
- package/dist/{chunk-R76HPAN4.mjs.map → chunk-TR4X4EEG.mjs.map} +1 -1
- package/dist/{chunk-7SWSKLSA.mjs → chunk-V6YCG642.mjs} +18 -18
- package/dist/chunk-V6YCG642.mjs.map +1 -0
- package/dist/{chunk-S53LMDD7.mjs → chunk-VTBUO5SK.mjs} +15 -15
- package/dist/chunk-VTBUO5SK.mjs.map +1 -0
- package/dist/{chunk-JPUKYLBW.mjs → chunk-WDQYM4FP.mjs} +5 -5
- package/dist/chunk-WDQYM4FP.mjs.map +1 -0
- package/dist/{chunk-S2HFYJVI.mjs → chunk-WFLZPB35.mjs} +13 -13
- package/dist/chunk-WFLZPB35.mjs.map +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +347 -343
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/multi-autocomplete.d.mts +51 -51
- package/dist/multi-autocomplete.d.ts +51 -51
- package/dist/multi-autocomplete.js +317 -313
- package/dist/multi-autocomplete.js.map +1 -1
- package/dist/multi-autocomplete.mjs +12 -12
- package/dist/use-autocomplete-list.d.mts +1 -1
- package/dist/use-autocomplete-list.d.ts +1 -1
- package/dist/use-autocomplete-list.js +7 -7
- package/dist/use-autocomplete-list.js.map +1 -1
- package/dist/use-autocomplete-list.mjs +2 -2
- package/dist/use-autocomplete-option-group.js +7 -7
- package/dist/use-autocomplete-option-group.js.map +1 -1
- package/dist/use-autocomplete-option-group.mjs +2 -2
- package/dist/use-autocomplete-option.d.mts +12 -12
- package/dist/use-autocomplete-option.d.ts +12 -12
- package/dist/use-autocomplete-option.js +34 -34
- package/dist/use-autocomplete-option.js.map +1 -1
- package/dist/use-autocomplete-option.mjs +2 -2
- package/dist/use-autocomplete.d.mts +86 -86
- package/dist/use-autocomplete.d.ts +86 -86
- package/dist/use-autocomplete.js +216 -214
- package/dist/use-autocomplete.js.map +1 -1
- package/dist/use-autocomplete.mjs +7 -7
- package/package.json +13 -13
- package/dist/chunk-5GKGL6BL.mjs.map +0 -1
- package/dist/chunk-5LPWFWE6.mjs.map +0 -1
- package/dist/chunk-7SWSKLSA.mjs.map +0 -1
- package/dist/chunk-JPUKYLBW.mjs.map +0 -1
- package/dist/chunk-OLOU5HFC.mjs.map +0 -1
- package/dist/chunk-Q2HZVVOI.mjs.map +0 -1
- package/dist/chunk-QPIWG4ZF.mjs.map +0 -1
- package/dist/chunk-S2HFYJVI.mjs.map +0 -1
- package/dist/chunk-S53LMDD7.mjs.map +0 -1
@@ -33,9 +33,9 @@ var import_use_descendant = require("@yamada-ui/use-descendant");
|
|
33
33
|
var import_utils = require("@yamada-ui/utils");
|
34
34
|
var {
|
35
35
|
DescendantsContextProvider: AutocompleteDescendantsContextProvider,
|
36
|
-
|
36
|
+
useDescendant: useAutocompleteDescendant,
|
37
37
|
useDescendants: useAutocompleteDescendants,
|
38
|
-
|
38
|
+
useDescendantsContext: useAutocompleteDescendantsContext
|
39
39
|
} = (0, import_use_descendant.createDescendant)();
|
40
40
|
var [AutocompleteProvider, useAutocompleteContext] = (0, import_utils.createContext)({
|
41
41
|
name: "AutocompleteContext",
|
@@ -87,20 +87,20 @@ var useAutocompleteList = () => {
|
|
87
87
|
(props = {}, ref = null) => {
|
88
88
|
var _a;
|
89
89
|
return {
|
90
|
-
|
90
|
+
id: (_a = props.id) != null ? _a : uuid,
|
91
91
|
ref: (0, import_utils2.mergeRefs)(listRef, ref),
|
92
|
+
as: "ul",
|
93
|
+
position: "relative",
|
92
94
|
role: "listbox",
|
93
95
|
tabIndex: -1,
|
94
|
-
position: "relative",
|
95
|
-
id: (_a = props.id) != null ? _a : uuid,
|
96
96
|
...props
|
97
97
|
};
|
98
98
|
},
|
99
99
|
[listRef, uuid]
|
100
100
|
);
|
101
101
|
return {
|
102
|
-
|
103
|
-
|
102
|
+
getListProps,
|
103
|
+
onAnimationComplete
|
104
104
|
};
|
105
105
|
};
|
106
106
|
|
@@ -109,21 +109,21 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
109
109
|
var AutocompleteList = (0, import_core.forwardRef)(
|
110
110
|
({
|
111
111
|
className,
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
minWidth,
|
112
|
+
children,
|
113
|
+
footer,
|
114
|
+
header,
|
116
115
|
maxW,
|
117
116
|
maxWidth,
|
117
|
+
minW,
|
118
|
+
minWidth,
|
119
|
+
w,
|
120
|
+
width,
|
118
121
|
contentProps,
|
119
|
-
header,
|
120
|
-
footer,
|
121
|
-
children,
|
122
122
|
...rest
|
123
123
|
}, ref) => {
|
124
124
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
125
125
|
const { styles } = useAutocompleteContext();
|
126
|
-
const {
|
126
|
+
const { getListProps, onAnimationComplete } = useAutocompleteList();
|
127
127
|
width != null ? width : width = w;
|
128
128
|
width != null ? width : width = (_c = (_a = styles.list) == null ? void 0 : _a.width) != null ? _c : (_b = styles.list) == null ? void 0 : _b.w;
|
129
129
|
minWidth != null ? minWidth : minWidth = minW;
|
@@ -135,10 +135,10 @@ var AutocompleteList = (0, import_core.forwardRef)(
|
|
135
135
|
{
|
136
136
|
as: "div",
|
137
137
|
className: "ui-autocomplete__popover",
|
138
|
-
width,
|
139
|
-
minWidth,
|
140
138
|
maxWidth,
|
141
|
-
|
139
|
+
minWidth,
|
140
|
+
width,
|
141
|
+
__css: { ...styles.content, maxWidth, minWidth, width },
|
142
142
|
...contentProps,
|
143
143
|
onAnimationComplete: (0, import_utils3.handlerAll)(
|
144
144
|
contentProps == null ? void 0 : contentProps.onAnimationComplete,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/autocomplete-list.tsx","../src/autocomplete-context.ts","../src/use-autocomplete-list.ts"],"sourcesContent":["import type { CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport {
|
1
|
+
{"version":3,"sources":["../src/autocomplete-list.tsx","../src/autocomplete-context.ts","../src/use-autocomplete-list.ts"],"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","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { Dispatch, DOMAttributes, RefObject, SetStateAction } from \"react\"\nimport type { ChangeOptions, UseAutocompleteProps } from \"./use-autocomplete\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\n\nexport const {\n DescendantsContextProvider: AutocompleteDescendantsContextProvider,\n useDescendant: useAutocompleteDescendant,\n useDescendants: useAutocompleteDescendants,\n useDescendantsContext: useAutocompleteDescendantsContext,\n} = createDescendant()\n\ninterface AutocompleteContext\n extends Omit<\n UseAutocompleteProps,\n \"defaultValue\" | \"onChange\" | \"onCreate\" | \"value\"\n > {\n focusedIndex: number\n inputRef: RefObject<HTMLInputElement>\n inputValue: string\n isAllSelected: boolean\n isEmpty: boolean\n isHit: boolean\n isOpen: boolean\n label: string | string[] | undefined\n listRef: RefObject<HTMLUListElement>\n pickOptions: (value: string) => void\n rebirthOptions: (runFocus?: boolean) => void\n setFocusedIndex: Dispatch<SetStateAction<number>>\n styles: { [key: string]: CSSUIObject | undefined }\n value: string | string[]\n formControlProps: { [key: string]: any }\n inputProps: DOMAttributes<HTMLInputElement>\n onChange: (newValue: string, options?: ChangeOptions) => void\n onChangeLabel: (newValue: string, options?: ChangeOptions) => void\n onClose: () => void\n onCreate: () => void\n onFocusFirst: () => void\n onFocusLast: () => void\n onFocusNext: (index?: number) => void\n onFocusPrev: (index?: number) => void\n onOpen: () => void\n}\n\nexport const [AutocompleteProvider, useAutocompleteContext] =\n createContext<AutocompleteContext>({\n name: \"AutocompleteContext\",\n errorMessage: `useAutocompleteContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Autocomplete />\" or \"<MultiAutocomplete />\"`,\n })\n","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":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA+B;AAC/B,qBAA+B;AAC/B,IAAAA,gBAA+B;;;ACF/B,4BAAiC;AACjC,mBAA8B;AAEvB,IAAM;AAAA,EACX,4BAA4B;AAAA,EAC5B,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,uBAAuB;AACzB,QAAI,wCAAiB;AAkCd,IAAM,CAAC,sBAAsB,sBAAsB,QACxD,4BAAmC;AAAA,EACjC,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;AChDH,IAAAC,gBAA2C;AAC3C,mBAAsD;AAM/C,IAAM,sBAAsB,MAAM;AACvC,QAAM,WAAO,oBAAM;AACnB,QAAM,EAAE,cAAc,QAAQ,SAAS,eAAe,IACpD,uBAAuB;AAEzB,QAAM,cAAc,kCAAkC;AAEtD,QAAM,yBAAqB,qBAAe,EAAE;AAC5C,QAAM,gBAAgB,YAAY,MAAM,YAAY;AAEpD,QAAM,0BAAsB,0BAAY,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,WAAU;AAAA,cACV,OAAO,EAAE,GAAG,OAAO,OAAO;AAAA,cAEzB;AAAA;AAAA,UACH,IACE;AAAA;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;AAC/B,iBAAiB,SAAS;","names":["import_utils","import_utils"]}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
AutocompleteList
|
4
|
-
} from "./chunk-
|
5
|
-
import "./chunk-
|
6
|
-
import "./chunk-
|
4
|
+
} from "./chunk-VTBUO5SK.mjs";
|
5
|
+
import "./chunk-TR4X4EEG.mjs";
|
6
|
+
import "./chunk-WDQYM4FP.mjs";
|
7
7
|
export {
|
8
8
|
AutocompleteList
|
9
9
|
};
|
@@ -32,9 +32,9 @@ var import_use_descendant = require("@yamada-ui/use-descendant");
|
|
32
32
|
var import_utils = require("@yamada-ui/utils");
|
33
33
|
var {
|
34
34
|
DescendantsContextProvider: AutocompleteDescendantsContextProvider,
|
35
|
-
|
35
|
+
useDescendant: useAutocompleteDescendant,
|
36
36
|
useDescendants: useAutocompleteDescendants,
|
37
|
-
|
37
|
+
useDescendantsContext: useAutocompleteDescendantsContext
|
38
38
|
} = (0, import_use_descendant.createDescendant)();
|
39
39
|
var [AutocompleteProvider, useAutocompleteContext] = (0, import_utils.createContext)({
|
40
40
|
name: "AutocompleteContext",
|
@@ -49,7 +49,7 @@ var useAutocompleteOptionGroup = ({
|
|
49
49
|
label,
|
50
50
|
...rest
|
51
51
|
}) => {
|
52
|
-
const {
|
52
|
+
const { omitSelectedValues, value } = useAutocompleteContext();
|
53
53
|
const isMulti = (0, import_utils2.isArray)(value);
|
54
54
|
const descendants = useAutocompleteDescendantsContext();
|
55
55
|
const values = descendants.values();
|
@@ -61,7 +61,7 @@ var useAutocompleteOptionGroup = ({
|
|
61
61
|
) : [];
|
62
62
|
const selectedIndexes = selectedValues.map(({ index }) => index);
|
63
63
|
const childValues = values.filter(
|
64
|
-
({
|
64
|
+
({ index, node }) => {
|
65
65
|
var _a;
|
66
66
|
return ((_a = node.parentElement) == null ? void 0 : _a.dataset.label) === label && !selectedIndexes.includes(index) && "target" in node.dataset;
|
67
67
|
}
|
@@ -74,12 +74,12 @@ var useAutocompleteOptionGroup = ({
|
|
74
74
|
border: "0px",
|
75
75
|
clip: "rect(0px, 0px, 0px, 0px)",
|
76
76
|
height: "1px",
|
77
|
-
width: "1px",
|
78
77
|
margin: "-1px",
|
79
|
-
padding: "0px",
|
80
78
|
overflow: "hidden",
|
79
|
+
padding: "0px",
|
80
|
+
position: "absolute",
|
81
81
|
whiteSpace: "nowrap",
|
82
|
-
|
82
|
+
width: "1px"
|
83
83
|
};
|
84
84
|
return {
|
85
85
|
ref,
|
@@ -114,12 +114,12 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
114
114
|
var AutocompleteOptionGroup = (0, import_core2.forwardRef)(
|
115
115
|
({
|
116
116
|
className,
|
117
|
+
children,
|
117
118
|
color,
|
118
119
|
h,
|
119
120
|
height,
|
120
121
|
minH,
|
121
122
|
minHeight,
|
122
|
-
children,
|
123
123
|
labelProps,
|
124
124
|
...rest
|
125
125
|
}, ref) => {
|
@@ -135,15 +135,15 @@ var AutocompleteOptionGroup = (0, import_core2.forwardRef)(
|
|
135
135
|
"ui-autocomplete__item--group",
|
136
136
|
className
|
137
137
|
),
|
138
|
-
__css: {
|
138
|
+
__css: { color, h: "fit-content", w: "100%" },
|
139
139
|
...getContainerProps(),
|
140
140
|
children: [
|
141
141
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
142
142
|
import_core2.ui.span,
|
143
143
|
{
|
144
144
|
className: "ui-autocomplete__item__group-label",
|
145
|
-
__css: styles.groupLabel,
|
146
145
|
lineClamp: 1,
|
146
|
+
__css: styles.groupLabel,
|
147
147
|
...labelProps,
|
148
148
|
children: label
|
149
149
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/autocomplete-option-group.tsx","../src/autocomplete-context.ts","../src/use-autocomplete-option-group.ts"],"sourcesContent":["import type { HTMLUIProps } from \"@yamada-ui/core\"\nimport {
|
1
|
+
{"version":3,"sources":["../src/autocomplete-option-group.tsx","../src/autocomplete-context.ts","../src/use-autocomplete-option-group.ts"],"sourcesContent":["import type { HTMLUIProps } from \"@yamada-ui/core\"\nimport type { UseAutocompleteOptionGroupProps } from \"./use-autocomplete-option-group\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useAutocompleteContext } from \"./autocomplete-context\"\nimport { useAutocompleteOptionGroup } from \"./use-autocomplete-option-group\"\n\ninterface AutocompleteOptionGroupOptions\n extends UseAutocompleteOptionGroupProps {\n /**\n * Props for autocomplete option group element.\n */\n labelProps?: HTMLUIProps<\"span\">\n}\n\nexport interface AutocompleteOptionGroupProps\n extends HTMLUIProps<\"ul\">,\n AutocompleteOptionGroupOptions {}\n\nexport const AutocompleteOptionGroup = forwardRef<\n AutocompleteOptionGroupProps,\n \"ul\"\n>(\n (\n {\n className,\n children,\n color,\n h,\n height,\n minH,\n minHeight,\n labelProps,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useAutocompleteContext()\n const { label, getContainerProps, getGroupProps } =\n useAutocompleteOptionGroup(rest)\n\n h ??= height\n minH ??= minHeight\n\n return (\n <ui.li\n className={cx(\n \"ui-autocomplete__item\",\n \"ui-autocomplete__item--group\",\n className,\n )}\n __css={{ color, h: \"fit-content\", w: \"100%\" }}\n {...getContainerProps()}\n >\n <ui.span\n className=\"ui-autocomplete__item__group-label\"\n lineClamp={1}\n __css={styles.groupLabel}\n {...labelProps}\n >\n {label}\n </ui.span>\n\n <ui.ul\n {...getGroupProps({}, ref)}\n className=\"ui-autocomplete__item__group\"\n __css={{ h, minH, ...styles.group }}\n >\n {children}\n </ui.ul>\n </ui.li>\n )\n },\n)\n\nAutocompleteOptionGroup.displayName = \"AutocompleteOptionGroup\"\nAutocompleteOptionGroup.__ui__ = \"AutocompleteOptionGroup\"\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { Dispatch, DOMAttributes, RefObject, SetStateAction } from \"react\"\nimport type { ChangeOptions, UseAutocompleteProps } from \"./use-autocomplete\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\n\nexport const {\n DescendantsContextProvider: AutocompleteDescendantsContextProvider,\n useDescendant: useAutocompleteDescendant,\n useDescendants: useAutocompleteDescendants,\n useDescendantsContext: useAutocompleteDescendantsContext,\n} = createDescendant()\n\ninterface AutocompleteContext\n extends Omit<\n UseAutocompleteProps,\n \"defaultValue\" | \"onChange\" | \"onCreate\" | \"value\"\n > {\n focusedIndex: number\n inputRef: RefObject<HTMLInputElement>\n inputValue: string\n isAllSelected: boolean\n isEmpty: boolean\n isHit: boolean\n isOpen: boolean\n label: string | string[] | undefined\n listRef: RefObject<HTMLUListElement>\n pickOptions: (value: string) => void\n rebirthOptions: (runFocus?: boolean) => void\n setFocusedIndex: Dispatch<SetStateAction<number>>\n styles: { [key: string]: CSSUIObject | undefined }\n value: string | string[]\n formControlProps: { [key: string]: any }\n inputProps: DOMAttributes<HTMLInputElement>\n onChange: (newValue: string, options?: ChangeOptions) => void\n onChangeLabel: (newValue: string, options?: ChangeOptions) => void\n onClose: () => void\n onCreate: () => void\n onFocusFirst: () => void\n onFocusLast: () => void\n onFocusNext: (index?: number) => void\n onFocusPrev: (index?: number) => void\n onOpen: () => void\n}\n\nexport const [AutocompleteProvider, useAutocompleteContext] =\n createContext<AutocompleteContext>({\n name: \"AutocompleteContext\",\n errorMessage: `useAutocompleteContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Autocomplete />\" or \"<MultiAutocomplete />\"`,\n })\n","import type { HTMLUIProps, PropGetter } from \"@yamada-ui/core\"\nimport type { CSSProperties } from \"react\"\nimport { layoutStyleProperties } from \"@yamada-ui/core\"\nimport { isArray, splitObject } from \"@yamada-ui/utils\"\nimport { useCallback } from \"react\"\nimport {\n useAutocompleteContext,\n useAutocompleteDescendantsContext,\n} from \"./autocomplete-context\"\n\nexport interface UseAutocompleteOptionGroupProps extends HTMLUIProps<\"ul\"> {\n /**\n * The label of the autocomplete option group.\n */\n label: string\n}\n\nexport const useAutocompleteOptionGroup = ({\n label,\n ...rest\n}: UseAutocompleteOptionGroupProps) => {\n const { omitSelectedValues, value } = useAutocompleteContext()\n\n const isMulti = isArray(value)\n\n const descendants = useAutocompleteDescendantsContext()\n\n const values = descendants.values()\n const selectedValues =\n isMulti && omitSelectedValues\n ? descendants.values(({ node }) =>\n value.includes(node.dataset.value ?? \"\"),\n )\n : []\n const selectedIndexes = selectedValues.map(({ index }) => index)\n const childValues = values.filter(\n ({ index, node }) =>\n node.parentElement?.dataset.label === label &&\n !selectedIndexes.includes(index) &&\n \"target\" in node.dataset,\n )\n\n const isEmpty = !childValues.length\n\n const [containerProps, groupProps] = splitObject(rest, layoutStyleProperties)\n\n const getContainerProps: PropGetter<\"li\"> = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n ref,\n ...props,\n ...containerProps,\n style: isEmpty ? style : undefined,\n \"data-label\": label,\n role: \"autocomplete-group-container\",\n }\n },\n [containerProps, isEmpty, label],\n )\n\n const getGroupProps: PropGetter<\"ul\"> = useCallback(\n (props = {}, ref = null) => ({\n ref,\n ...props,\n ...groupProps,\n \"data-label\": label,\n role: \"autocomplete-group\",\n }),\n [groupProps, label],\n )\n\n return {\n label,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseAutocompleteOptionGroupReturn = ReturnType<\n typeof useAutocompleteOptionGroup\n>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,eAA+B;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AAAA,cACzB,WAAU;AAAA,cACV,OAAO,EAAE,GAAG,MAAM,GAAG,OAAO,MAAM;AAAA,cAEjC;AAAA;AAAA,UACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,wBAAwB,cAAc;AACtC,wBAAwB,SAAS;","names":["import_core","import_utils","import_utils"]}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
AutocompleteOptionGroup
|
4
|
-
} from "./chunk-
|
5
|
-
import "./chunk-
|
6
|
-
import "./chunk-
|
4
|
+
} from "./chunk-4SBNPEK7.mjs";
|
5
|
+
import "./chunk-67X7JKWL.mjs";
|
6
|
+
import "./chunk-WDQYM4FP.mjs";
|
7
7
|
export {
|
8
8
|
AutocompleteOptionGroup
|
9
9
|
};
|
@@ -32,9 +32,9 @@ var import_use_descendant = require("@yamada-ui/use-descendant");
|
|
32
32
|
var import_utils = require("@yamada-ui/utils");
|
33
33
|
var {
|
34
34
|
DescendantsContextProvider: AutocompleteDescendantsContextProvider,
|
35
|
-
|
35
|
+
useDescendant: useAutocompleteDescendant,
|
36
36
|
useDescendants: useAutocompleteDescendants,
|
37
|
-
|
37
|
+
useDescendantsContext: useAutocompleteDescendantsContext
|
38
38
|
} = (0, import_use_descendant.createDescendant)();
|
39
39
|
var [AutocompleteProvider, useAutocompleteContext] = (0, import_utils.createContext)({
|
40
40
|
name: "AutocompleteContext",
|
@@ -52,27 +52,27 @@ var AutocompleteIcon = (0, import_core.forwardRef)(
|
|
52
52
|
({ className, children, __css, ...rest }, ref) => {
|
53
53
|
const { styles } = useAutocompleteContext();
|
54
54
|
const css = {
|
55
|
-
position: "absolute",
|
56
|
-
top: "50%",
|
57
|
-
transform: "translateY(-50%)",
|
58
|
-
display: "inline-flex",
|
59
55
|
alignItems: "center",
|
56
|
+
cursor: "pointer",
|
57
|
+
display: "inline-flex",
|
60
58
|
justifyContent: "center",
|
61
59
|
pointerEvents: "none",
|
62
|
-
|
60
|
+
position: "absolute",
|
61
|
+
top: "50%",
|
62
|
+
transform: "translateY(-50%)",
|
63
63
|
...styles.icon,
|
64
64
|
...__css
|
65
65
|
};
|
66
66
|
const validChildren = (0, import_utils2.getValidChildren)(children);
|
67
67
|
const cloneChildren = validChildren.map(
|
68
68
|
(child) => (0, import_react.cloneElement)(child, {
|
69
|
-
focusable: false,
|
70
|
-
"aria-hidden": true,
|
71
69
|
style: {
|
72
|
-
|
70
|
+
color: "currentColor",
|
73
71
|
maxHeight: "1em",
|
74
|
-
|
75
|
-
}
|
72
|
+
maxWidth: "1em"
|
73
|
+
},
|
74
|
+
"aria-hidden": true,
|
75
|
+
focusable: false
|
76
76
|
})
|
77
77
|
);
|
78
78
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
@@ -105,11 +105,11 @@ var AutocompleteClearIcon = ({
|
|
105
105
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
106
106
|
AutocompleteIcon,
|
107
107
|
{
|
108
|
-
"aria-label": "Clear value",
|
109
108
|
className: (0, import_utils2.cx)("ui-autocomplete__icon--clear", className),
|
109
|
+
"aria-label": "Clear value",
|
110
110
|
__css: styles.clearIcon,
|
111
111
|
...rest,
|
112
|
-
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.CloseIcon, {
|
112
|
+
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.CloseIcon, { h: "0.5em", w: "0.5em" })
|
113
113
|
}
|
114
114
|
);
|
115
115
|
};
|
@@ -118,11 +118,11 @@ AutocompleteClearIcon.__ui__ = "AutocompleteClearIcon";
|
|
118
118
|
var AutocompleteItemIcon = (0, import_core.forwardRef)(({ className, ...rest }, ref) => {
|
119
119
|
const { styles } = useAutocompleteContext();
|
120
120
|
const css = {
|
121
|
-
flexShrink: 0,
|
122
|
-
display: "inline-flex",
|
123
|
-
justifyContent: "center",
|
124
121
|
alignItems: "center",
|
122
|
+
display: "inline-flex",
|
123
|
+
flexShrink: 0,
|
125
124
|
fontSize: "0.85em",
|
125
|
+
justifyContent: "center",
|
126
126
|
...styles.itemIcon
|
127
127
|
};
|
128
128
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
@@ -143,36 +143,36 @@ var import_utils3 = require("@yamada-ui/utils");
|
|
143
143
|
var import_react2 = require("react");
|
144
144
|
var isTargetOption = (target) => {
|
145
145
|
var _a;
|
146
|
-
return (0, import_utils3.isHTMLElement)(target) && !!((_a = target
|
146
|
+
return (0, import_utils3.isHTMLElement)(target) && !!((_a = target.getAttribute("role")) == null ? void 0 : _a.startsWith("option"));
|
147
147
|
};
|
148
148
|
var useAutocompleteOption = (props) => {
|
149
149
|
var _a, _b;
|
150
150
|
const {
|
151
|
-
|
151
|
+
closeOnSelect: generalCloseOnSelect,
|
152
|
+
focusedIndex,
|
153
|
+
inputRef,
|
152
154
|
omitSelectedValues,
|
155
|
+
setFocusedIndex,
|
156
|
+
value,
|
157
|
+
optionProps,
|
153
158
|
onChange,
|
154
159
|
onChangeLabel,
|
155
|
-
focusedIndex,
|
156
|
-
setFocusedIndex,
|
157
160
|
onClose,
|
158
|
-
closeOnSelect: generalCloseOnSelect,
|
159
|
-
optionProps,
|
160
|
-
inputRef,
|
161
161
|
onFocusNext
|
162
162
|
} = useAutocompleteContext();
|
163
163
|
const id = (0, import_react2.useId)();
|
164
164
|
let {
|
165
|
+
children,
|
166
|
+
closeOnSelect: customCloseOnSelect,
|
165
167
|
icon: customIcon,
|
166
168
|
isDisabled,
|
167
169
|
isFocusable,
|
168
|
-
closeOnSelect: customCloseOnSelect,
|
169
|
-
children,
|
170
170
|
value: optionValue,
|
171
171
|
...computedProps
|
172
172
|
} = { ...optionProps, ...props };
|
173
173
|
const trulyDisabled = !!isDisabled && !isFocusable;
|
174
174
|
const itemRef = (0, import_react2.useRef)(null);
|
175
|
-
const { index, register
|
175
|
+
const { descendants, index, register } = useAutocompleteDescendant({
|
176
176
|
disabled: trulyDisabled
|
177
177
|
});
|
178
178
|
const values = descendants.values();
|
@@ -222,27 +222,27 @@ var useAutocompleteOption = (props) => {
|
|
222
222
|
border: "0px",
|
223
223
|
clip: "rect(0px, 0px, 0px, 0px)",
|
224
224
|
height: "1px",
|
225
|
-
width: "1px",
|
226
225
|
margin: "-1px",
|
227
|
-
padding: "0px",
|
228
226
|
overflow: "hidden",
|
227
|
+
padding: "0px",
|
228
|
+
position: "absolute",
|
229
229
|
whiteSpace: "nowrap",
|
230
|
-
|
230
|
+
width: "1px"
|
231
231
|
};
|
232
232
|
return {
|
233
|
-
ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
|
234
233
|
id,
|
234
|
+
ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
|
235
235
|
role: "option",
|
236
236
|
...computedProps,
|
237
237
|
...props2,
|
238
|
-
tabIndex: -1,
|
239
238
|
style: !isTarget || omitSelectedValues && isSelected ? style : void 0,
|
240
|
-
"data-target": (0, import_utils3.dataAttr)(true),
|
241
|
-
"data-value": optionValue != null ? optionValue : "",
|
242
|
-
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
243
|
-
"data-disabled": (0, import_utils3.dataAttr)(isDisabled),
|
244
239
|
"aria-checked": isSelected,
|
245
240
|
"aria-disabled": (0, import_utils3.ariaAttr)(isDisabled),
|
241
|
+
"data-disabled": (0, import_utils3.dataAttr)(isDisabled),
|
242
|
+
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
243
|
+
"data-target": (0, import_utils3.dataAttr)(true),
|
244
|
+
"data-value": optionValue != null ? optionValue : "",
|
245
|
+
tabIndex: -1,
|
246
246
|
onClick: (0, import_utils3.handlerAll)(computedProps.onClick, props2.onClick, onClick)
|
247
247
|
};
|
248
248
|
},
|
@@ -260,10 +260,10 @@ var useAutocompleteOption = (props) => {
|
|
260
260
|
]
|
261
261
|
);
|
262
262
|
return {
|
263
|
-
isSelected,
|
264
|
-
isFocused,
|
265
|
-
customIcon,
|
266
263
|
children,
|
264
|
+
customIcon,
|
265
|
+
isFocused,
|
266
|
+
isSelected,
|
267
267
|
getOptionProps
|
268
268
|
};
|
269
269
|
};
|
@@ -273,19 +273,19 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
273
273
|
var AutocompleteOption = (0, import_core2.forwardRef)(
|
274
274
|
({ className, icon, ...rest }, ref) => {
|
275
275
|
const { styles } = useAutocompleteContext();
|
276
|
-
const {
|
276
|
+
const { children, customIcon, isSelected, getOptionProps } = useAutocompleteOption(rest);
|
277
277
|
icon != null ? icon : icon = customIcon;
|
278
278
|
const css = {
|
279
|
-
|
279
|
+
alignItems: "center",
|
280
280
|
color: "inherit",
|
281
|
-
userSelect: "none",
|
282
281
|
display: "flex",
|
283
|
-
width: "100%",
|
284
|
-
alignItems: "center",
|
285
|
-
textAlign: "start",
|
286
282
|
flex: "0 0 auto",
|
287
|
-
outline: 0,
|
288
283
|
gap: "0.75rem",
|
284
|
+
outline: 0,
|
285
|
+
textAlign: "start",
|
286
|
+
textDecoration: "none",
|
287
|
+
userSelect: "none",
|
288
|
+
width: "100%",
|
289
289
|
...styles.item
|
290
290
|
};
|
291
291
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
@@ -304,7 +304,7 @@ var AutocompleteOption = (0, import_core2.forwardRef)(
|
|
304
304
|
);
|
305
305
|
AutocompleteOption.displayName = "AutocompleteOption";
|
306
306
|
AutocompleteOption.__ui__ = "AutocompleteOption";
|
307
|
-
var AutocompleteCheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 14 14", width: "1em",
|
307
|
+
var AutocompleteCheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { height: "1em", viewBox: "0 0 14 14", width: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
308
308
|
"polygon",
|
309
309
|
{
|
310
310
|
fill: "currentColor",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/autocomplete-option.tsx","../src/autocomplete-context.ts","../src/autocomplete-icon.tsx","../src/use-autocomplete-option.ts"],"sourcesContent":["import type { CSSUIObject, FC } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ReactElement } from \"react\"\nimport { useAutocompleteContext } from \"./autocomplete-context\"\nimport { AutocompleteItemIcon } from \"./autocomplete-icon\"\nimport type { UseAutocompleteOptionProps } from \"./use-autocomplete-option\"\nimport { useAutocompleteOption } from \"./use-autocomplete-option\"\n\ninterface AutocompleteOptionOptions {\n /**\n * The autocomplete option icon to use.\n */\n icon?: 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 { isSelected, customIcon, children, getOptionProps } =\n useAutocompleteOption(rest)\n\n icon ??= customIcon\n\n const css: CSSUIObject = {\n textDecoration: \"none\",\n color: \"inherit\",\n userSelect: \"none\",\n display: \"flex\",\n width: \"100%\",\n alignItems: \"center\",\n textAlign: \"start\",\n flex: \"0 0 auto\",\n outline: 0,\n gap: \"0.75rem\",\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 viewBox=\"0 0 14 14\" width=\"1em\" height=\"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>\n)\n\nAutocompleteCheckIcon.displayName = \"AutocompleteCheckIcon\"\nAutocompleteCheckIcon.__ui__ = \"AutocompleteCheckIcon\"\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\nimport type { Dispatch, DOMAttributes, RefObject, SetStateAction } from \"react\"\nimport type { ChangeOptions, UseAutocompleteProps } from \"./use-autocomplete\"\n\nexport const {\n DescendantsContextProvider: AutocompleteDescendantsContextProvider,\n useDescendantsContext: useAutocompleteDescendantsContext,\n useDescendants: useAutocompleteDescendants,\n useDescendant: useAutocompleteDescendant,\n} = createDescendant()\n\ninterface AutocompleteContext\n extends Omit<\n UseAutocompleteProps,\n \"value\" | \"defaultValue\" | \"onChange\" | \"onCreate\"\n > {\n value: string | string[]\n label: string | string[] | undefined\n inputValue: string\n isHit: boolean\n isEmpty: boolean\n isAllSelected: boolean\n onChange: (newValue: string, options?: ChangeOptions) => void\n onChangeLabel: (newValue: string, options?: ChangeOptions) => void\n pickOptions: (value: string) => void\n rebirthOptions: (runFocus?: boolean) => void\n inputProps: DOMAttributes<HTMLInputElement>\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onCreate: () => void\n onFocusFirst: () => void\n onFocusLast: () => void\n onFocusNext: (index?: number) => void\n onFocusPrev: (index?: number) => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n listRef: RefObject<HTMLUListElement>\n inputRef: RefObject<HTMLInputElement>\n formControlProps: { [key: string]: any }\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [AutocompleteProvider, useAutocompleteContext] =\n createContext<AutocompleteContext>({\n name: \"AutocompleteContext\",\n errorMessage: `useAutocompleteContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Autocomplete />\" or \"<MultiAutocomplete />\"`,\n })\n","import type { CSSUIObject, FC, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } 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 type { HTMLAttributes } from \"react\"\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 position: \"absolute\",\n top: \"50%\",\n transform: \"translateY(-50%)\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n pointerEvents: \"none\",\n cursor: \"pointer\",\n ...styles.icon,\n ...__css,\n }\n\n const validChildren = getValidChildren(children)\n\n const cloneChildren = validChildren.map((child) =>\n cloneElement(child, {\n focusable: false,\n \"aria-hidden\": true,\n style: {\n maxWidth: \"1em\",\n maxHeight: \"1em\",\n color: \"currentColor\",\n },\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 aria-label=\"Clear value\"\n className={cx(\"ui-autocomplete__icon--clear\", className)}\n __css={styles.clearIcon}\n {...rest}\n >\n {children ?? <CloseIcon w=\"0.5em\" h=\"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 flexShrink: 0,\n display: \"inline-flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n fontSize: \"0.85em\",\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","import type { HTMLUIProps, PropGetter } from \"@yamada-ui/core\"\nimport {\n ariaAttr,\n dataAttr,\n handlerAll,\n isArray,\n isHTMLElement,\n mergeRefs,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport type { CSSProperties, MouseEvent } from \"react\"\nimport { useCallback, useId, useRef } from \"react\"\nimport {\n useAutocompleteContext,\n useAutocompleteDescendant,\n} from \"./autocomplete-context\"\n\nconst isTargetOption = (target: EventTarget | null): boolean =>\n isHTMLElement(target) && !!target?.getAttribute(\"role\")?.startsWith(\"option\")\n\nexport interface UseAutocompleteOptionProps\n extends Omit<HTMLUIProps<\"li\">, \"value\" | \"children\"> {\n /**\n * The value of the autocomplete option.\n */\n value?: string\n /**\n * The label of the autocomplete option.\n */\n children?: string\n /**\n * If `true`, the autocomplete option will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * If `true`, the autocomplete option will be focusable.\n *\n * @default false\n */\n isFocusable?: boolean\n /**\n * If `true`, the list element will be closed when selected.\n *\n * @default false\n */\n closeOnSelect?: boolean\n}\n\nexport const useAutocompleteOption = (props: UseAutocompleteOptionProps) => {\n const {\n value,\n omitSelectedValues,\n onChange,\n onChangeLabel,\n focusedIndex,\n setFocusedIndex,\n onClose,\n closeOnSelect: generalCloseOnSelect,\n optionProps,\n inputRef,\n onFocusNext,\n } = useAutocompleteContext()\n const id = useId()\n\n let {\n icon: customIcon,\n isDisabled,\n isFocusable,\n closeOnSelect: customCloseOnSelect,\n children,\n value: optionValue,\n ...computedProps\n } = { ...optionProps, ...props }\n\n const trulyDisabled = !!isDisabled && !isFocusable\n\n const itemRef = useRef<HTMLLIElement>(null)\n\n const { index, register, descendants } = useAutocompleteDescendant({\n disabled: trulyDisabled,\n })\n\n const values = descendants.values()\n const frontValues = values.slice(0, index)\n\n const isMulti = isArray(value)\n const isDuplicated = !isMulti\n ? frontValues.some(({ node }) => node.dataset.value === (optionValue ?? \"\"))\n : false\n\n const isSelected =\n !isDuplicated &&\n (!isMulti\n ? (optionValue ?? \"\") === value\n : value.includes(optionValue ?? \"\"))\n const isTarget = \"target\" in (itemRef.current?.dataset ?? {})\n const isFocused = index === focusedIndex\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLLIElement>) => {\n ev.stopPropagation()\n\n if (isDisabled) {\n if (inputRef.current) inputRef.current.focus()\n\n return\n }\n\n if (!isTargetOption(ev.currentTarget)) {\n if (inputRef.current) inputRef.current.focus()\n\n return\n }\n\n setFocusedIndex(index)\n\n onChange(optionValue ?? \"\")\n\n if (inputRef.current) inputRef.current.focus()\n\n if (customCloseOnSelect ?? generalCloseOnSelect) onClose()\n\n if (omitSelectedValues) onFocusNext(index)\n },\n [\n onFocusNext,\n omitSelectedValues,\n isDisabled,\n optionValue,\n setFocusedIndex,\n index,\n onChange,\n customCloseOnSelect,\n generalCloseOnSelect,\n onClose,\n inputRef,\n ],\n )\n\n useUpdateEffect(() => {\n if (isSelected) onChangeLabel(optionValue ?? \"\", { runOmit: false })\n }, [optionValue])\n\n const getOptionProps: PropGetter<\"li\"> = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n width: \"1px\",\n margin: \"-1px\",\n padding: \"0px\",\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n position: \"absolute\",\n }\n\n return {\n ref: mergeRefs(itemRef, ref, register),\n id,\n role: \"option\",\n ...computedProps,\n ...props,\n tabIndex: -1,\n style:\n !isTarget || (omitSelectedValues && isSelected) ? style : undefined,\n \"data-target\": dataAttr(true),\n \"data-value\": optionValue ?? \"\",\n \"data-focus\": dataAttr(isFocused),\n \"data-disabled\": dataAttr(isDisabled),\n \"aria-checked\": isSelected,\n \"aria-disabled\": ariaAttr(isDisabled),\n onClick: handlerAll(computedProps.onClick, props.onClick, onClick),\n }\n },\n [\n id,\n optionValue,\n computedProps,\n isDisabled,\n isFocused,\n isSelected,\n isTarget,\n omitSelectedValues,\n onClick,\n register,\n ],\n )\n\n return {\n isSelected,\n isFocused,\n customIcon,\n children,\n getOptionProps,\n }\n}\n\nexport type UseAutocompleteOptionReturn = ReturnType<\n typeof useAutocompleteOption\n>\n\nexport const useAutocompleteCreate = () => {\n const { isHit, onCreate } = useAutocompleteContext()\n\n const getCreateProps: PropGetter<\"li\"> = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n width: \"1px\",\n margin: \"-1px\",\n padding: \"0px\",\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n position: \"absolute\",\n }\n\n return {\n ref,\n ...props,\n tabIndex: -1,\n style: isHit ? style : undefined,\n \"data-focus\": dataAttr(!isHit),\n onClick: handlerAll(props.onClick, onCreate),\n }\n },\n [isHit, onCreate],\n )\n\n return { getCreateProps }\n}\n\nexport type UseAutocompleteCreateReturn = ReturnType<\n typeof useAutocompleteCreate\n>\n\nexport const useAutocompleteEmpty = () => {\n const { isHit, isEmpty } = useAutocompleteContext()\n\n const getEmptyProps: PropGetter<\"li\"> = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n width: \"1px\",\n margin: \"-1px\",\n padding: \"0px\",\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n position: \"absolute\",\n }\n\n return {\n ref,\n ...props,\n tabIndex: -1,\n style: isHit && !isEmpty ? style : undefined,\n }\n },\n [isHit, isEmpty],\n )\n\n return { getEmptyProps }\n}\n\nexport type UseAutocompleteEmptyReturn = ReturnType<typeof useAutocompleteEmpty>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAAmB;;;ACDnB,4BAAiC;AACjC,mBAA8B;AAIvB,IAAM;AAAA,EACX,4BAA4B;AAAA,EAC5B,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,eAAe;AACjB,QAAI,wCAAiB;AAkCd,IAAM,CAAC,sBAAsB,sBAAsB,QACxD,4BAAmC;AAAA,EACjC,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;AChDH,kBAA+B;AAC/B,kBAAuC;AACvC,2BAA6B;AAC7B,IAAAC,gBAAqD;AAErD,mBAAqC;AA2Ce;AAtC7C,IAAM,uBAAmB;AAAA,EAC9B,CAAC,EAAE,WAAW,UAAU,OAAO,GAAG,KAAK,GAAG,QAAQ;AAChD,UAAM,EAAE,OAAO,IAAI,uBAAuB;AAE1C,UAAM,MAAmB;AAAA,MACvB,UAAU;AAAA,MACV,KAAK;AAAA,MACL,WAAW;AAAA,MACX,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,QAAQ;AAAA,MACR,GAAG,OAAO;AAAA,MACV,GAAG;AAAA,IACL;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gBAAG,MAAH,EAAQ,OAAO,EAAE,MAAM,EAAE,GAAG,cAAU,MACpC,UACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;AAE5B,IAAM,wBAA4B,MAChC,6CAAC,SAAI,SAAQ,aAAY,OAAM,OAAM,QAAO,OAC1C;AAAA,EAAC;AAAA;AAAA,IACC,MAAK;AAAA,IACL,QAAO;AAAA;AACT,GACF;AAGF,sBAAsB,cAAc;AACpC,sBAAsB,SAAS;","names":["import_core","import_utils","import_utils","import_utils","import_react","props","import_jsx_runtime"]}
|
1
|
+
{"version":3,"sources":["../src/autocomplete-option.tsx","../src/autocomplete-context.ts","../src/autocomplete-icon.tsx","../src/use-autocomplete-option.ts"],"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>\n)\n\nAutocompleteCheckIcon.displayName = \"AutocompleteCheckIcon\"\nAutocompleteCheckIcon.__ui__ = \"AutocompleteCheckIcon\"\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { Dispatch, DOMAttributes, RefObject, SetStateAction } from \"react\"\nimport type { ChangeOptions, UseAutocompleteProps } from \"./use-autocomplete\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\n\nexport const {\n DescendantsContextProvider: AutocompleteDescendantsContextProvider,\n useDescendant: useAutocompleteDescendant,\n useDescendants: useAutocompleteDescendants,\n useDescendantsContext: useAutocompleteDescendantsContext,\n} = createDescendant()\n\ninterface AutocompleteContext\n extends Omit<\n UseAutocompleteProps,\n \"defaultValue\" | \"onChange\" | \"onCreate\" | \"value\"\n > {\n focusedIndex: number\n inputRef: RefObject<HTMLInputElement>\n inputValue: string\n isAllSelected: boolean\n isEmpty: boolean\n isHit: boolean\n isOpen: boolean\n label: string | string[] | undefined\n listRef: RefObject<HTMLUListElement>\n pickOptions: (value: string) => void\n rebirthOptions: (runFocus?: boolean) => void\n setFocusedIndex: Dispatch<SetStateAction<number>>\n styles: { [key: string]: CSSUIObject | undefined }\n value: string | string[]\n formControlProps: { [key: string]: any }\n inputProps: DOMAttributes<HTMLInputElement>\n onChange: (newValue: string, options?: ChangeOptions) => void\n onChangeLabel: (newValue: string, options?: ChangeOptions) => void\n onClose: () => void\n onCreate: () => void\n onFocusFirst: () => void\n onFocusLast: () => void\n onFocusNext: (index?: number) => void\n onFocusPrev: (index?: number) => void\n onOpen: () => void\n}\n\nexport const [AutocompleteProvider, useAutocompleteContext] =\n createContext<AutocompleteContext>({\n name: \"AutocompleteContext\",\n errorMessage: `useAutocompleteContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Autocomplete />\" or \"<MultiAutocomplete />\"`,\n })\n","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","import type { HTMLUIProps, PropGetter } from \"@yamada-ui/core\"\nimport type { CSSProperties, MouseEvent } from \"react\"\nimport {\n ariaAttr,\n dataAttr,\n handlerAll,\n isArray,\n isHTMLElement,\n mergeRefs,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useId, useRef } from \"react\"\nimport {\n useAutocompleteContext,\n useAutocompleteDescendant,\n} from \"./autocomplete-context\"\n\nconst isTargetOption = (target: EventTarget | null): boolean =>\n isHTMLElement(target) && !!target.getAttribute(\"role\")?.startsWith(\"option\")\n\nexport interface UseAutocompleteOptionProps\n extends Omit<HTMLUIProps<\"li\">, \"children\" | \"value\"> {\n /**\n * The label of the autocomplete option.\n */\n children?: string\n /**\n * If `true`, the list element will be closed when selected.\n *\n * @default false\n */\n closeOnSelect?: boolean\n /**\n * If `true`, the autocomplete option will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * If `true`, the autocomplete option will be focusable.\n *\n * @default false\n */\n isFocusable?: boolean\n /**\n * The value of the autocomplete option.\n */\n value?: string\n}\n\nexport const useAutocompleteOption = (props: UseAutocompleteOptionProps) => {\n const {\n closeOnSelect: generalCloseOnSelect,\n focusedIndex,\n inputRef,\n omitSelectedValues,\n setFocusedIndex,\n value,\n optionProps,\n onChange,\n onChangeLabel,\n onClose,\n onFocusNext,\n } = useAutocompleteContext()\n const id = useId()\n\n let {\n children,\n closeOnSelect: customCloseOnSelect,\n icon: customIcon,\n isDisabled,\n isFocusable,\n value: optionValue,\n ...computedProps\n } = { ...optionProps, ...props }\n\n const trulyDisabled = !!isDisabled && !isFocusable\n\n const itemRef = useRef<HTMLLIElement>(null)\n\n const { descendants, index, register } = useAutocompleteDescendant({\n disabled: trulyDisabled,\n })\n\n const values = descendants.values()\n const frontValues = values.slice(0, index)\n\n const isMulti = isArray(value)\n const isDuplicated = !isMulti\n ? frontValues.some(({ node }) => node.dataset.value === (optionValue ?? \"\"))\n : false\n\n const isSelected =\n !isDuplicated &&\n (!isMulti\n ? (optionValue ?? \"\") === value\n : value.includes(optionValue ?? \"\"))\n const isTarget = \"target\" in (itemRef.current?.dataset ?? {})\n const isFocused = index === focusedIndex\n\n const onClick = useCallback(\n (ev: MouseEvent<HTMLLIElement>) => {\n ev.stopPropagation()\n\n if (isDisabled) {\n if (inputRef.current) inputRef.current.focus()\n\n return\n }\n\n if (!isTargetOption(ev.currentTarget)) {\n if (inputRef.current) inputRef.current.focus()\n\n return\n }\n\n setFocusedIndex(index)\n\n onChange(optionValue ?? \"\")\n\n if (inputRef.current) inputRef.current.focus()\n\n if (customCloseOnSelect ?? generalCloseOnSelect) onClose()\n\n if (omitSelectedValues) onFocusNext(index)\n },\n [\n onFocusNext,\n omitSelectedValues,\n isDisabled,\n optionValue,\n setFocusedIndex,\n index,\n onChange,\n customCloseOnSelect,\n generalCloseOnSelect,\n onClose,\n inputRef,\n ],\n )\n\n useUpdateEffect(() => {\n if (isSelected) onChangeLabel(optionValue ?? \"\", { runOmit: false })\n }, [optionValue])\n\n const getOptionProps: PropGetter<\"li\"> = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n id,\n ref: mergeRefs(itemRef, ref, register),\n role: \"option\",\n ...computedProps,\n ...props,\n style:\n !isTarget || (omitSelectedValues && isSelected) ? style : undefined,\n \"aria-checked\": isSelected,\n \"aria-disabled\": ariaAttr(isDisabled),\n \"data-disabled\": dataAttr(isDisabled),\n \"data-focus\": dataAttr(isFocused),\n \"data-target\": dataAttr(true),\n \"data-value\": optionValue ?? \"\",\n tabIndex: -1,\n onClick: handlerAll(computedProps.onClick, props.onClick, onClick),\n }\n },\n [\n id,\n optionValue,\n computedProps,\n isDisabled,\n isFocused,\n isSelected,\n isTarget,\n omitSelectedValues,\n onClick,\n register,\n ],\n )\n\n return {\n children,\n customIcon,\n isFocused,\n isSelected,\n getOptionProps,\n }\n}\n\nexport type UseAutocompleteOptionReturn = ReturnType<\n typeof useAutocompleteOption\n>\n\nexport const useAutocompleteCreate = () => {\n const { isHit, onCreate } = useAutocompleteContext()\n\n const getCreateProps: PropGetter<\"li\"> = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n ref,\n ...props,\n style: isHit ? style : undefined,\n \"data-focus\": dataAttr(!isHit),\n tabIndex: -1,\n onClick: handlerAll(props.onClick, onCreate),\n }\n },\n [isHit, onCreate],\n )\n\n return { getCreateProps }\n}\n\nexport type UseAutocompleteCreateReturn = ReturnType<\n typeof useAutocompleteCreate\n>\n\nexport const useAutocompleteEmpty = () => {\n const { isEmpty, isHit } = useAutocompleteContext()\n\n const getEmptyProps: PropGetter<\"li\"> = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n border: \"0px\",\n clip: \"rect(0px, 0px, 0px, 0px)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0px\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n }\n\n return {\n ref,\n ...props,\n style: isHit && !isEmpty ? style : undefined,\n tabIndex: -1,\n }\n },\n [isHit, isEmpty],\n )\n\n return { getEmptyProps }\n}\n\nexport type UseAutocompleteEmptyReturn = ReturnType<typeof useAutocompleteEmpty>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,eAA+B;AAC/B,IAAAC,gBAAmB;;;ACDnB,4BAAiC;AACjC,mBAA8B;AAEvB,IAAM;AAAA,EACX,4BAA4B;AAAA,EAC5B,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,uBAAuB;AACzB,QAAI,wCAAiB;AAkCd,IAAM,CAAC,sBAAsB,sBAAsB,QACxD,4BAAmC;AAAA,EACjC,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;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AA,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,gBAAG;AAAA,MAAH;AAAA,QACC,eAAW,kBAAG,yBAAyB,SAAS;AAAA,QAChD,OAAO;AAAA,QACN,GAAG,eAAe,CAAC,GAAG,GAAG;AAAA,QAEzB;AAAA,mBAAS,OACR,6CAAC,wBAAqB,SAAS,aAAa,IAAI,GAC7C,kBAAQ,6CAAC,yBAAsB,GAClC,IACE;AAAA,UAEJ,6CAAC,gBAAG,MAAH,EAAQ,OAAO,EAAE,MAAM,EAAE,GAAG,cAAU,MACpC,UACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;AAE5B,IAAM,wBAA4B,MAChC,6CAAC,SAAI,QAAO,OAAM,SAAQ,aAAY,OAAM,OAC1C;AAAA,EAAC;AAAA;AAAA,IACC,MAAK;AAAA,IACL,QAAO;AAAA;AACT,GACF;AAGF,sBAAsB,cAAc;AACpC,sBAAsB,SAAS;","names":["import_core","import_utils","import_utils","import_utils","import_react","props","import_jsx_runtime"]}
|