@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
@@ -5,9 +5,9 @@ import { createDescendant } from "@yamada-ui/use-descendant";
|
|
5
5
|
import { createContext } from "@yamada-ui/utils";
|
6
6
|
var {
|
7
7
|
DescendantsContextProvider: AutocompleteDescendantsContextProvider,
|
8
|
-
|
8
|
+
useDescendant: useAutocompleteDescendant,
|
9
9
|
useDescendants: useAutocompleteDescendants,
|
10
|
-
|
10
|
+
useDescendantsContext: useAutocompleteDescendantsContext
|
11
11
|
} = createDescendant();
|
12
12
|
var [AutocompleteProvider, useAutocompleteContext] = createContext({
|
13
13
|
name: "AutocompleteContext",
|
@@ -16,10 +16,10 @@ var [AutocompleteProvider, useAutocompleteContext] = createContext({
|
|
16
16
|
|
17
17
|
export {
|
18
18
|
AutocompleteDescendantsContextProvider,
|
19
|
-
useAutocompleteDescendantsContext,
|
20
|
-
useAutocompleteDescendants,
|
21
19
|
useAutocompleteDescendant,
|
20
|
+
useAutocompleteDescendants,
|
21
|
+
useAutocompleteDescendantsContext,
|
22
22
|
AutocompleteProvider,
|
23
23
|
useAutocompleteContext
|
24
24
|
};
|
25
|
-
//# sourceMappingURL=chunk-
|
25
|
+
//# sourceMappingURL=chunk-WDQYM4FP.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/autocomplete-context.ts"],"sourcesContent":["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"],"mappings":";;;AAGA,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAEvB,IAAM;AAAA,EACX,4BAA4B;AAAA,EAC5B,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,uBAAuB;AACzB,IAAI,iBAAiB;AAkCd,IAAM,CAAC,sBAAsB,sBAAsB,IACxD,cAAmC;AAAA,EACjC,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;","names":[]}
|
@@ -1,34 +1,34 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
useAutocompleteOption
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-DDMSYTKO.mjs";
|
5
5
|
import {
|
6
6
|
AutocompleteItemIcon
|
7
|
-
} from "./chunk-
|
7
|
+
} from "./chunk-V6YCG642.mjs";
|
8
8
|
import {
|
9
9
|
useAutocompleteContext
|
10
|
-
} from "./chunk-
|
10
|
+
} from "./chunk-WDQYM4FP.mjs";
|
11
11
|
|
12
12
|
// src/autocomplete-option.tsx
|
13
|
-
import {
|
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 {
|
19
|
+
const { children, customIcon, isSelected, getOptionProps } = useAutocompleteOption(rest);
|
20
20
|
icon != null ? icon : icon = customIcon;
|
21
21
|
const css = {
|
22
|
-
|
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",
|
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-
|
63
|
+
//# sourceMappingURL=chunk-WFLZPB35.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>\n)\n\nAutocompleteCheckIcon.displayName = \"AutocompleteCheckIcon\"\nAutocompleteCheckIcon.__ui__ = \"AutocompleteCheckIcon\"\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,YAAY,UAAU;AAC/B,SAAS,UAAU;AAuCb,SAOe,KAPf;AAvBC,IAAM,qBAAqB;AAAA,EAChC,CAAC,EAAE,WAAW,MAAM,GAAG,KAAK,GAAG,QAAQ;AACrC,UAAM,EAAE,OAAO,IAAI,uBAAuB;AAC1C,UAAM,EAAE,UAAU,YAAY,YAAY,eAAe,IACvD,sBAAsB,IAAI;AAE5B,iCAAS;AAET,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,yBAAyB,SAAS;AAAA,QAChD,OAAO;AAAA,QACN,GAAG,eAAe,CAAC,GAAG,GAAG;AAAA,QAEzB;AAAA,mBAAS,OACR,oBAAC,wBAAqB,SAAS,aAAa,IAAI,GAC7C,kBAAQ,oBAAC,yBAAsB,GAClC,IACE;AAAA,UAEJ,oBAAC,GAAG,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,oBAAC,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":[]}
|
package/dist/index.d.mts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
export { Autocomplete, AutocompleteProps } from './autocomplete.mjs';
|
2
|
-
export { AutocompleteOptionGroup, AutocompleteOptionGroupProps } from './autocomplete-option-group.mjs';
|
3
|
-
export { AutocompleteOption, AutocompleteOptionProps } from './autocomplete-option.mjs';
|
4
2
|
export { AutocompleteCreate, AutocompleteCreateProps } from './autocomplete-create.mjs';
|
5
3
|
export { AutocompleteEmpty, AutocompleteEmptyProps } from './autocomplete-empty.mjs';
|
4
|
+
export { AutocompleteOption, AutocompleteOptionProps } from './autocomplete-option.mjs';
|
5
|
+
export { AutocompleteOptionGroup, AutocompleteOptionGroupProps } from './autocomplete-option-group.mjs';
|
6
6
|
export { MultiAutocomplete, MultiAutocompleteProps } from './multi-autocomplete.mjs';
|
7
7
|
export { AutocompleteItem } from './use-autocomplete.mjs';
|
8
8
|
import '@yamada-ui/core';
|
@@ -11,10 +11,10 @@ import '@yamada-ui/portal';
|
|
11
11
|
import 'react';
|
12
12
|
import './autocomplete-icon.mjs';
|
13
13
|
import './autocomplete-list.mjs';
|
14
|
-
import './use-autocomplete-option-group.mjs';
|
15
14
|
import './use-autocomplete-option.mjs';
|
16
|
-
import '
|
15
|
+
import './use-autocomplete-option-group.mjs';
|
17
16
|
import '@yamada-ui/use-descendant';
|
17
|
+
import 'react/jsx-runtime';
|
18
18
|
import '@yamada-ui/form-control';
|
19
19
|
import '@yamada-ui/popover';
|
20
20
|
import '@yamada-ui/utils';
|
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
export { Autocomplete, AutocompleteProps } from './autocomplete.js';
|
2
|
-
export { AutocompleteOptionGroup, AutocompleteOptionGroupProps } from './autocomplete-option-group.js';
|
3
|
-
export { AutocompleteOption, AutocompleteOptionProps } from './autocomplete-option.js';
|
4
2
|
export { AutocompleteCreate, AutocompleteCreateProps } from './autocomplete-create.js';
|
5
3
|
export { AutocompleteEmpty, AutocompleteEmptyProps } from './autocomplete-empty.js';
|
4
|
+
export { AutocompleteOption, AutocompleteOptionProps } from './autocomplete-option.js';
|
5
|
+
export { AutocompleteOptionGroup, AutocompleteOptionGroupProps } from './autocomplete-option-group.js';
|
6
6
|
export { MultiAutocomplete, MultiAutocompleteProps } from './multi-autocomplete.js';
|
7
7
|
export { AutocompleteItem } from './use-autocomplete.js';
|
8
8
|
import '@yamada-ui/core';
|
@@ -11,10 +11,10 @@ import '@yamada-ui/portal';
|
|
11
11
|
import 'react';
|
12
12
|
import './autocomplete-icon.js';
|
13
13
|
import './autocomplete-list.js';
|
14
|
-
import './use-autocomplete-option-group.js';
|
15
14
|
import './use-autocomplete-option.js';
|
16
|
-
import '
|
15
|
+
import './use-autocomplete-option-group.js';
|
17
16
|
import '@yamada-ui/use-descendant';
|
17
|
+
import 'react/jsx-runtime';
|
18
18
|
import '@yamada-ui/form-control';
|
19
19
|
import '@yamada-ui/popover';
|
20
20
|
import '@yamada-ui/utils';
|