@ariakit/react-core 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/cjs/__chunks/{QUHFOHHT.cjs → 3HMQOCLF.cjs} +10 -27
- package/cjs/__chunks/{YO7LLGVA.cjs → AY5J25V7.cjs} +2 -2
- package/cjs/__chunks/{4XVTH6OR.cjs → DFXPO2ED.cjs} +2 -2
- package/cjs/__chunks/{HPNCFYQJ.cjs → GZ2NNSLV.cjs} +4 -4
- package/cjs/__chunks/ISJGSS4S.cjs +16 -0
- package/cjs/__chunks/{COWKMNMZ.cjs → N43E53E6.cjs} +3 -3
- package/cjs/__chunks/{54YZYOPA.cjs → NRPEUNJB.cjs} +2 -2
- package/cjs/__chunks/PVLZGFP6.cjs +34 -0
- package/cjs/__chunks/{ZTAE5B6W.cjs → QJDA4LG6.cjs} +19 -16
- package/cjs/__chunks/{NDVZ37O3.cjs → RG6U7KAS.cjs} +22 -4
- package/cjs/__chunks/YWAHOWYE.cjs +25 -0
- package/cjs/combobox/combobox-cancel.cjs +3 -3
- package/cjs/combobox/combobox-disclosure.cjs +3 -3
- package/cjs/combobox/combobox-item.cjs +19 -9
- package/cjs/combobox/combobox-item.d.cts +22 -12
- package/cjs/combobox/combobox-item.d.ts +22 -12
- package/cjs/combobox/combobox-popover.cjs +22 -15
- package/cjs/combobox/combobox-provider.cjs +3 -2
- package/cjs/combobox/combobox-store.cjs +6 -2
- package/cjs/combobox/combobox-store.d.cts +12 -4
- package/cjs/combobox/combobox-store.d.ts +12 -4
- package/cjs/combobox/combobox-value.cjs +32 -0
- package/cjs/combobox/combobox-value.d.cts +41 -0
- package/cjs/combobox/combobox-value.d.ts +41 -0
- package/cjs/combobox/combobox.cjs +66 -22
- package/cjs/composite/composite-item.cjs +3 -3
- package/cjs/composite/composite-overflow-disclosure.cjs +3 -3
- package/cjs/composite/composite-overflow.cjs +12 -12
- package/cjs/dialog/dialog-backdrop.cjs +3 -3
- package/cjs/dialog/dialog.cjs +11 -11
- package/cjs/dialog/dialog.d.cts +4 -0
- package/cjs/dialog/dialog.d.ts +4 -0
- package/cjs/dialog/utils/disable-tree.cjs +3 -3
- package/cjs/dialog/utils/use-prevent-body-scroll.cjs +3 -3
- package/cjs/form/form-checkbox.cjs +1 -1
- package/cjs/form/form-push.cjs +1 -1
- package/cjs/form/form-radio.cjs +4 -4
- package/cjs/hovercard/hovercard.cjs +13 -13
- package/cjs/menu/menu-item-checkbox.cjs +4 -4
- package/cjs/menu/menu-item-radio.cjs +7 -7
- package/cjs/menu/menu-item.cjs +4 -4
- package/cjs/menu/menu.cjs +14 -14
- package/cjs/popover/popover.cjs +12 -12
- package/cjs/radio/radio.cjs +4 -4
- package/cjs/select/select-item.cjs +4 -4
- package/cjs/select/select-popover.cjs +13 -13
- package/cjs/select/select-value.d.cts +8 -7
- package/cjs/select/select-value.d.ts +8 -7
- package/cjs/select/select.cjs +1 -1
- package/cjs/tab/tab-panel.cjs +2 -2
- package/cjs/tab/tab.cjs +7 -7
- package/cjs/tag/tag-context.cjs +25 -0
- package/cjs/tag/tag-context.d.cts +21 -0
- package/cjs/tag/tag-context.d.ts +21 -0
- package/cjs/tag/tag-input.cjs +191 -0
- package/cjs/tag/tag-input.d.cts +122 -0
- package/cjs/tag/tag-input.d.ts +122 -0
- package/cjs/tag/tag-list-label.cjs +56 -0
- package/cjs/tag/tag-list-label.d.cts +55 -0
- package/cjs/tag/tag-list-label.d.ts +55 -0
- package/cjs/tag/tag-list.cjs +141 -0
- package/cjs/tag/tag-list.d.cts +58 -0
- package/cjs/tag/tag-list.d.ts +58 -0
- package/cjs/tag/tag-provider.cjs +26 -0
- package/cjs/tag/tag-provider.d.cts +29 -0
- package/cjs/tag/tag-provider.d.ts +29 -0
- package/cjs/tag/tag-remove.cjs +119 -0
- package/cjs/tag/tag-remove.d.cts +67 -0
- package/cjs/tag/tag-remove.d.ts +67 -0
- package/cjs/tag/tag-store.cjs +15 -0
- package/cjs/tag/tag-store.d.cts +49 -0
- package/cjs/tag/tag-store.d.ts +49 -0
- package/cjs/tag/tag-value.cjs +29 -0
- package/cjs/tag/tag-value.d.cts +41 -0
- package/cjs/tag/tag-value.d.ts +41 -0
- package/cjs/tag/tag-values.cjs +29 -0
- package/cjs/tag/tag-values.d.cts +52 -0
- package/cjs/tag/tag-values.d.ts +52 -0
- package/cjs/tag/tag.cjs +130 -0
- package/cjs/tag/tag.d.cts +74 -0
- package/cjs/tag/tag.d.ts +74 -0
- package/cjs/tag/utils.cjs +8 -0
- package/cjs/tag/utils.d.cts +1 -0
- package/cjs/tag/utils.d.ts +1 -0
- package/cjs/toolbar/toolbar-container.cjs +4 -4
- package/cjs/toolbar/toolbar-input.cjs +4 -4
- package/cjs/toolbar/toolbar-item.cjs +4 -4
- package/cjs/tooltip/tooltip.cjs +14 -14
- package/combobox/combobox-value/package.json +8 -0
- package/esm/__chunks/{XEJ23EM6.js → 65LF6MEO.js} +2 -2
- package/esm/__chunks/{LTYEFENI.js → 6YVAEELE.js} +1 -1
- package/esm/__chunks/{ZFEEEZVE.js → DLLQM6DZ.js} +22 -4
- package/esm/__chunks/{IOUGWXY5.js → FGHVVLPU.js} +20 -17
- package/esm/__chunks/L7IM35RU.js +16 -0
- package/esm/__chunks/{NFPDVAAW.js → M354SEUF.js} +1 -1
- package/esm/__chunks/QNNHZL3W.js +25 -0
- package/esm/__chunks/{DSUHLHLE.js → QZJOXZKA.js} +1 -1
- package/esm/__chunks/{NHVUMSP7.js → UKDZLPKH.js} +1 -1
- package/esm/__chunks/{R33ISPJY.js → VGORKDMQ.js} +11 -28
- package/esm/__chunks/WYDDZRWN.js +34 -0
- package/esm/combobox/combobox-cancel.js +3 -3
- package/esm/combobox/combobox-disclosure.js +3 -3
- package/esm/combobox/combobox-item.d.ts +22 -12
- package/esm/combobox/combobox-item.js +19 -9
- package/esm/combobox/combobox-popover.js +20 -13
- package/esm/combobox/combobox-provider.js +2 -1
- package/esm/combobox/combobox-store.d.ts +12 -4
- package/esm/combobox/combobox-store.js +5 -1
- package/esm/combobox/combobox-value.d.ts +41 -0
- package/esm/combobox/combobox-value.js +32 -0
- package/esm/combobox/combobox.js +67 -23
- package/esm/composite/composite-item.js +2 -2
- package/esm/composite/composite-overflow-disclosure.js +2 -2
- package/esm/composite/composite-overflow.js +11 -11
- package/esm/dialog/dialog-backdrop.js +2 -2
- package/esm/dialog/dialog.d.ts +4 -0
- package/esm/dialog/dialog.js +10 -10
- package/esm/dialog/utils/disable-tree.js +2 -2
- package/esm/dialog/utils/use-prevent-body-scroll.js +2 -2
- package/esm/form/form-checkbox.js +1 -1
- package/esm/form/form-push.js +1 -1
- package/esm/form/form-radio.js +3 -3
- package/esm/hovercard/hovercard.js +12 -12
- package/esm/menu/menu-item-checkbox.js +3 -3
- package/esm/menu/menu-item-radio.js +5 -5
- package/esm/menu/menu-item.js +3 -3
- package/esm/menu/menu.js +12 -12
- package/esm/popover/popover.js +11 -11
- package/esm/radio/radio.js +3 -3
- package/esm/select/select-item.js +4 -4
- package/esm/select/select-popover.js +11 -11
- package/esm/select/select-value.d.ts +8 -7
- package/esm/select/select.js +1 -1
- package/esm/tab/tab-panel.js +3 -3
- package/esm/tab/tab.js +5 -5
- package/esm/tag/tag-context.d.ts +21 -0
- package/esm/tag/tag-context.js +25 -0
- package/esm/tag/tag-input.d.ts +122 -0
- package/esm/tag/tag-input.js +191 -0
- package/esm/tag/tag-list-label.d.ts +55 -0
- package/esm/tag/tag-list-label.js +56 -0
- package/esm/tag/tag-list.d.ts +58 -0
- package/esm/tag/tag-list.js +141 -0
- package/esm/tag/tag-provider.d.ts +29 -0
- package/esm/tag/tag-provider.js +26 -0
- package/esm/tag/tag-remove.d.ts +67 -0
- package/esm/tag/tag-remove.js +119 -0
- package/esm/tag/tag-store.d.ts +49 -0
- package/esm/tag/tag-store.js +15 -0
- package/esm/tag/tag-value.d.ts +41 -0
- package/esm/tag/tag-value.js +29 -0
- package/esm/tag/tag-values.d.ts +52 -0
- package/esm/tag/tag-values.js +29 -0
- package/esm/tag/tag.d.ts +74 -0
- package/esm/tag/tag.js +130 -0
- package/esm/tag/utils.d.ts +1 -0
- package/esm/tag/utils.js +8 -0
- package/esm/toolbar/toolbar-container.js +3 -3
- package/esm/toolbar/toolbar-input.js +3 -3
- package/esm/toolbar/toolbar-item.js +3 -3
- package/esm/tooltip/tooltip.js +12 -12
- package/package.json +86 -2
- package/tag/tag/package.json +8 -0
- package/tag/tag-context/package.json +8 -0
- package/tag/tag-input/package.json +8 -0
- package/tag/tag-list/package.json +8 -0
- package/tag/tag-list-label/package.json +8 -0
- package/tag/tag-provider/package.json +8 -0
- package/tag/tag-remove/package.json +8 -0
- package/tag/tag-store/package.json +8 -0
- package/tag/tag-value/package.json +8 -0
- package/tag/tag-values/package.json +8 -0
- package/tag/utils/package.json +8 -0
- package/cjs/__chunks/{37BRXQN7.cjs → BX2QEIBH.cjs} +3 -3
- package/cjs/__chunks/{PVYTX5U5.cjs → SL55T4ZB.cjs} +2 -2
- package/cjs/__chunks/{TSEXNK3K.cjs → VR6GCLOV.cjs} +2 -2
- package/esm/__chunks/{PTPUIM7N.js → 3TEK3C5Q.js} +3 -3
- package/esm/__chunks/{U2L67A6K.js → BC72XE6E.js} +3 -3
- package/esm/__chunks/{GOXKZAQI.js → CMFBAHKI.js} +3 -3
|
@@ -7,16 +7,17 @@ type Value = SelectStoreValue;
|
|
|
7
7
|
* [`value`](https://ariakit.org/reference/use-select-store#value) state in the
|
|
8
8
|
* [select store](https://ariakit.org/reference/use-select-store).
|
|
9
9
|
*
|
|
10
|
-
* As a
|
|
11
|
-
*
|
|
10
|
+
* As a value component, it doesn't render any DOM elements and therefore
|
|
11
|
+
* doesn't accept HTML props. It can optionally accept a
|
|
12
12
|
* [`fallback`](https://ariakit.org/reference/select-value#fallback) prop to use
|
|
13
13
|
* as a default value if the store's
|
|
14
14
|
* [`value`](https://ariakit.org/reference/use-select-store#value) is
|
|
15
15
|
* `undefined`.
|
|
16
16
|
*
|
|
17
|
-
* Additionally, it takes a
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* Additionally, it takes a
|
|
18
|
+
* [`children`](https://ariakit.org/reference/select-value#children) function
|
|
19
|
+
* that gets called with the current value as an argument. This is handy for
|
|
20
|
+
* rendering the value in a custom way.
|
|
20
21
|
* @see https://ariakit.org/components/select
|
|
21
22
|
* @example
|
|
22
23
|
* ```jsx {3}
|
|
@@ -71,8 +72,8 @@ export interface SelectValueProps<T extends Value = Value> {
|
|
|
71
72
|
*/
|
|
72
73
|
fallback?: T;
|
|
73
74
|
/**
|
|
74
|
-
* A function that gets called with the current value as an argument. This
|
|
75
|
-
*
|
|
75
|
+
* A function that gets called with the current value as an argument. This is
|
|
76
|
+
* handy for rendering the value in a custom way.
|
|
76
77
|
*/
|
|
77
78
|
children?: (value: ToPrimitive<T>) => ReactNode;
|
|
78
79
|
}
|
package/cjs/select/select.cjs
CHANGED
|
@@ -13,11 +13,11 @@ require('../__chunks/EYZZO5IT.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _4LPJTV22cjs = require('../__chunks/4LPJTV22.cjs');
|
|
16
|
-
require('../__chunks/U4NXCMZ3.cjs');
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
var _HZDOLHROcjs = require('../__chunks/HZDOLHRO.cjs');
|
|
20
|
+
require('../__chunks/U4NXCMZ3.cjs');
|
|
21
21
|
require('../__chunks/6ZZYUFPW.cjs');
|
|
22
22
|
require('../__chunks/VPI3EKVY.cjs');
|
|
23
23
|
require('../__chunks/NEK2UEJN.cjs');
|
package/cjs/tab/tab-panel.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var _HD5AHCRIcjs = require('../__chunks/HD5AHCRI.cjs');
|
|
5
4
|
|
|
5
|
+
var _5CAFC273cjs = require('../__chunks/5CAFC273.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _HD5AHCRIcjs = require('../__chunks/HD5AHCRI.cjs');
|
|
9
9
|
require('../__chunks/VPI3EKVY.cjs');
|
|
10
10
|
require('../__chunks/NEK2UEJN.cjs');
|
|
11
11
|
|
package/cjs/tab/tab.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _5CAFC273cjs = require('../__chunks/5CAFC273.cjs');
|
|
4
5
|
|
|
5
|
-
var _QUHFOHHTcjs = require('../__chunks/QUHFOHHT.cjs');
|
|
6
|
-
require('../__chunks/U4NXCMZ3.cjs');
|
|
7
|
-
require('../__chunks/HD5AHCRI.cjs');
|
|
8
6
|
|
|
9
7
|
|
|
10
|
-
var
|
|
8
|
+
var _3HMQOCLFcjs = require('../__chunks/3HMQOCLF.cjs');
|
|
9
|
+
require('../__chunks/HD5AHCRI.cjs');
|
|
10
|
+
require('../__chunks/U4NXCMZ3.cjs');
|
|
11
11
|
require('../__chunks/6ZZYUFPW.cjs');
|
|
12
12
|
require('../__chunks/VPI3EKVY.cjs');
|
|
13
13
|
require('../__chunks/NEK2UEJN.cjs');
|
|
@@ -93,9 +93,9 @@ var useTab = _NGD3IQDBcjs.createHook.call(void 0, function useTab2(_a) {
|
|
|
93
93
|
render: element
|
|
94
94
|
};
|
|
95
95
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
96
|
-
|
|
96
|
+
_3HMQOCLFcjs.CompositeItem,
|
|
97
97
|
_AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, defaultProps), {
|
|
98
|
-
render: store.combobox && store.composite !== store.combobox ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
98
|
+
render: store.combobox && store.composite !== store.combobox ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _3HMQOCLFcjs.CompositeItem, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, defaultProps), { store: store.combobox })) : element
|
|
99
99
|
})
|
|
100
100
|
);
|
|
101
101
|
},
|
|
@@ -109,7 +109,7 @@ var useTab = _NGD3IQDBcjs.createHook.call(void 0, function useTab2(_a) {
|
|
|
109
109
|
}, props), {
|
|
110
110
|
onClick
|
|
111
111
|
});
|
|
112
|
-
props =
|
|
112
|
+
props = _3HMQOCLFcjs.useCompositeItem.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
113
113
|
store
|
|
114
114
|
}, props), {
|
|
115
115
|
accessibleWhenDisabled,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _PVLZGFP6cjs = require('../__chunks/PVLZGFP6.cjs');
|
|
11
|
+
require('../__chunks/VPI3EKVY.cjs');
|
|
12
|
+
require('../__chunks/NEK2UEJN.cjs');
|
|
13
|
+
require('../__chunks/NGD3IQDB.cjs');
|
|
14
|
+
require('../__chunks/TW3SFX4C.cjs');
|
|
15
|
+
require('../__chunks/CJDHQUBR.cjs');
|
|
16
|
+
require('../__chunks/AV6KTKLE.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
exports.TagContextProvider = _PVLZGFP6cjs.TagContextProvider; exports.TagRemoveIdContext = _PVLZGFP6cjs.TagRemoveIdContext; exports.TagScopedContextProvider = _PVLZGFP6cjs.TagScopedContextProvider; exports.TagValueContext = _PVLZGFP6cjs.TagValueContext; exports.useTagContext = _PVLZGFP6cjs.useTagContext; exports.useTagProviderContext = _PVLZGFP6cjs.useTagProviderContext; exports.useTagScopedContext = _PVLZGFP6cjs.useTagScopedContext;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TagStore } from "./tag-store.js";
|
|
2
|
+
export declare const TagValueContext: import("react").Context<string | null>;
|
|
3
|
+
export declare const TagRemoveIdContext: import("react").Context<((id?: string) => void) | null>;
|
|
4
|
+
/**
|
|
5
|
+
* Returns the tag store from the nearest tag container.
|
|
6
|
+
* @example
|
|
7
|
+
* function Tag() {
|
|
8
|
+
* const store = useTagContext();
|
|
9
|
+
*
|
|
10
|
+
* if (!store) {
|
|
11
|
+
* throw new Error("Tag must be wrapped in TagProvider");
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* // Use the store...
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
export declare const useTagContext: () => TagStore | undefined;
|
|
18
|
+
export declare const useTagScopedContext: (onlyScoped?: boolean) => TagStore | undefined;
|
|
19
|
+
export declare const useTagProviderContext: () => TagStore | undefined;
|
|
20
|
+
export declare const TagContextProvider: (props: import("react").ProviderProps<TagStore | undefined>) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const TagScopedContextProvider: (props: import("react").ProviderProps<TagStore | undefined>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TagStore } from "./tag-store.js";
|
|
2
|
+
export declare const TagValueContext: import("react").Context<string | null>;
|
|
3
|
+
export declare const TagRemoveIdContext: import("react").Context<((id?: string) => void) | null>;
|
|
4
|
+
/**
|
|
5
|
+
* Returns the tag store from the nearest tag container.
|
|
6
|
+
* @example
|
|
7
|
+
* function Tag() {
|
|
8
|
+
* const store = useTagContext();
|
|
9
|
+
*
|
|
10
|
+
* if (!store) {
|
|
11
|
+
* throw new Error("Tag must be wrapped in TagProvider");
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* // Use the store...
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
export declare const useTagContext: () => TagStore | undefined;
|
|
18
|
+
export declare const useTagScopedContext: (onlyScoped?: boolean) => TagStore | undefined;
|
|
19
|
+
export declare const useTagProviderContext: () => TagStore | undefined;
|
|
20
|
+
export declare const TagContextProvider: (props: import("react").ProviderProps<TagStore | undefined>) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const TagScopedContextProvider: (props: import("react").ProviderProps<TagStore | undefined>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _3HMQOCLFcjs = require('../__chunks/3HMQOCLF.cjs');
|
|
5
|
+
require('../__chunks/HD5AHCRI.cjs');
|
|
6
|
+
require('../__chunks/U4NXCMZ3.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _PVLZGFP6cjs = require('../__chunks/PVLZGFP6.cjs');
|
|
10
|
+
require('../__chunks/6ZZYUFPW.cjs');
|
|
11
|
+
require('../__chunks/VPI3EKVY.cjs');
|
|
12
|
+
require('../__chunks/NEK2UEJN.cjs');
|
|
13
|
+
require('../__chunks/FHRIPOYF.cjs');
|
|
14
|
+
require('../__chunks/75KXQZJX.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _NGD3IQDBcjs = require('../__chunks/NGD3IQDB.cjs');
|
|
20
|
+
require('../__chunks/GXMZA6DT.cjs');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _TW3SFX4Ccjs = require('../__chunks/TW3SFX4C.cjs');
|
|
26
|
+
require('../__chunks/CJDHQUBR.cjs');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
32
|
+
|
|
33
|
+
// src/tag/tag-input.tsx
|
|
34
|
+
var _array = require('@ariakit/core/utils/array');
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
var _dom = require('@ariakit/core/utils/dom');
|
|
39
|
+
var _events = require('@ariakit/core/utils/events');
|
|
40
|
+
var _misc = require('@ariakit/core/utils/misc');
|
|
41
|
+
var _undo = require('@ariakit/core/utils/undo');
|
|
42
|
+
var TagName = "input";
|
|
43
|
+
var DEFAULT_DELIMITER = ["\n", ";", ",", /\s/];
|
|
44
|
+
function getDelimiters(delimiter, defaultDelimiter = DEFAULT_DELIMITER) {
|
|
45
|
+
const finalDelimiter = delimiter === void 0 ? defaultDelimiter : delimiter;
|
|
46
|
+
if (!finalDelimiter)
|
|
47
|
+
return [];
|
|
48
|
+
return _array.toArray.call(void 0, finalDelimiter);
|
|
49
|
+
}
|
|
50
|
+
function splitValueByDelimiter(value, delimiters) {
|
|
51
|
+
for (const delimiter of delimiters) {
|
|
52
|
+
let match = value.match(delimiter);
|
|
53
|
+
while ((match == null ? void 0 : match.index) === 0) {
|
|
54
|
+
value = value.slice(match[0].length);
|
|
55
|
+
match = value.match(delimiter);
|
|
56
|
+
}
|
|
57
|
+
if (!match)
|
|
58
|
+
continue;
|
|
59
|
+
return value.split(delimiter);
|
|
60
|
+
}
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
var useTagInput = _NGD3IQDBcjs.createHook.call(void 0,
|
|
64
|
+
function useTagInput2(_a) {
|
|
65
|
+
var _b = _a, {
|
|
66
|
+
store,
|
|
67
|
+
tabbable = true,
|
|
68
|
+
delimiter,
|
|
69
|
+
addValueOnPaste = true,
|
|
70
|
+
addValueOnChange = true,
|
|
71
|
+
setValueOnChange = true,
|
|
72
|
+
removeOnBackspace = true
|
|
73
|
+
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
74
|
+
"store",
|
|
75
|
+
"tabbable",
|
|
76
|
+
"delimiter",
|
|
77
|
+
"addValueOnPaste",
|
|
78
|
+
"addValueOnChange",
|
|
79
|
+
"setValueOnChange",
|
|
80
|
+
"removeOnBackspace"
|
|
81
|
+
]);
|
|
82
|
+
const context = _PVLZGFP6cjs.useTagContext.call(void 0, );
|
|
83
|
+
store = store || context;
|
|
84
|
+
_misc.invariant.call(void 0,
|
|
85
|
+
store,
|
|
86
|
+
process.env.NODE_ENV !== "production" && "TagInput must receive a `store` prop or be wrapped in a TagProvider component."
|
|
87
|
+
);
|
|
88
|
+
const value = store.useState("value");
|
|
89
|
+
const onPasteProp = props.onPaste;
|
|
90
|
+
const addValueOnPasteProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0, addValueOnPaste);
|
|
91
|
+
const onPaste = _TW3SFX4Ccjs.useEvent.call(void 0, (event) => {
|
|
92
|
+
onPasteProp == null ? void 0 : onPasteProp(event);
|
|
93
|
+
if (event.defaultPrevented)
|
|
94
|
+
return;
|
|
95
|
+
const text = event.clipboardData.getData("text");
|
|
96
|
+
const delimiters = getDelimiters(delimiter);
|
|
97
|
+
const values = splitValueByDelimiter(text, delimiters).map((value2) => value2.trim()).filter((value2) => value2 !== "");
|
|
98
|
+
const eventWithValues = Object.assign(event, { values });
|
|
99
|
+
if (!addValueOnPasteProp(eventWithValues))
|
|
100
|
+
return;
|
|
101
|
+
if (!values.length)
|
|
102
|
+
return;
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
for (const tagValue of values) {
|
|
105
|
+
store.addValue(tagValue);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const onChangeProp = props.onChange;
|
|
109
|
+
const setValueOnChangeProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0, setValueOnChange);
|
|
110
|
+
const addValueOnChangeProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0, addValueOnChange);
|
|
111
|
+
const onChange = _TW3SFX4Ccjs.useEvent.call(void 0, (event) => {
|
|
112
|
+
onChangeProp == null ? void 0 : onChangeProp(event);
|
|
113
|
+
if (event.defaultPrevented)
|
|
114
|
+
return;
|
|
115
|
+
if (!store)
|
|
116
|
+
return;
|
|
117
|
+
const { value: prevValue } = store.getState();
|
|
118
|
+
const inputType = _events.getInputType.call(void 0, event);
|
|
119
|
+
const currentTarget = event.currentTarget;
|
|
120
|
+
const { start, end } = _dom.getTextboxSelection.call(void 0, currentTarget);
|
|
121
|
+
const { value: value2 } = currentTarget;
|
|
122
|
+
if (setValueOnChangeProp(event)) {
|
|
123
|
+
_undo.UndoManager.execute(() => {
|
|
124
|
+
store.setValue(value2);
|
|
125
|
+
queueMicrotask(() => {
|
|
126
|
+
_dom.setSelectionRange.call(void 0, currentTarget, start, end);
|
|
127
|
+
});
|
|
128
|
+
if (value2 === prevValue)
|
|
129
|
+
return;
|
|
130
|
+
return () => store.setValue(prevValue);
|
|
131
|
+
}, inputType);
|
|
132
|
+
}
|
|
133
|
+
const isTrailingCaret = start === end && start === value2.length;
|
|
134
|
+
if (isTrailingCaret) {
|
|
135
|
+
const delimiters = getDelimiters(delimiter);
|
|
136
|
+
let values = splitValueByDelimiter(value2, delimiters);
|
|
137
|
+
const trailingvalue = values.pop() || "";
|
|
138
|
+
values = values.map((value3) => value3.trim()).filter((value3) => value3 !== "");
|
|
139
|
+
const eventWithValues = Object.assign(event, { values });
|
|
140
|
+
if (values.length && addValueOnChangeProp(eventWithValues)) {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
for (const tagValue of values) {
|
|
143
|
+
store.addValue(tagValue);
|
|
144
|
+
}
|
|
145
|
+
_undo.UndoManager.execute(() => {
|
|
146
|
+
store.setValue(trailingvalue);
|
|
147
|
+
if (trailingvalue === prevValue)
|
|
148
|
+
return;
|
|
149
|
+
return () => store.setValue(prevValue);
|
|
150
|
+
}, inputType);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
const onKeyDownProp = props.onKeyDown;
|
|
155
|
+
const removeOnBackspaceProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0, removeOnBackspace);
|
|
156
|
+
const onKeyDown = _TW3SFX4Ccjs.useEvent.call(void 0, (event) => {
|
|
157
|
+
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
|
|
158
|
+
if (event.defaultPrevented)
|
|
159
|
+
return;
|
|
160
|
+
if (event.key === "Backspace" && removeOnBackspaceProp(event)) {
|
|
161
|
+
const { start, end } = _dom.getTextboxSelection.call(void 0, event.currentTarget);
|
|
162
|
+
const isLeadingCaret = start === end && start === 0;
|
|
163
|
+
if (!isLeadingCaret)
|
|
164
|
+
return;
|
|
165
|
+
store.setValues((values) => {
|
|
166
|
+
if (!values.length)
|
|
167
|
+
return values;
|
|
168
|
+
return values.slice(0, -1);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
173
|
+
value
|
|
174
|
+
}, props), {
|
|
175
|
+
ref: _TW3SFX4Ccjs.useMergeRefs.call(void 0, store.setInputElement, props.ref),
|
|
176
|
+
onPaste,
|
|
177
|
+
onChange,
|
|
178
|
+
onKeyDown
|
|
179
|
+
});
|
|
180
|
+
props = _3HMQOCLFcjs.useCompositeItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, tabbable }, props));
|
|
181
|
+
return props;
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
var TagInput = _NGD3IQDBcjs.forwardRef.call(void 0, function TagInput2(props) {
|
|
185
|
+
const htmlProps = useTagInput(props);
|
|
186
|
+
return _NGD3IQDBcjs.createElement.call(void 0, TagName, htmlProps);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
exports.TagInput = TagInput; exports.useTagInput = useTagInput;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { ChangeEvent, ClipboardEvent, ElementType, KeyboardEvent, SyntheticEvent } from "react";
|
|
2
|
+
import type { BooleanOrCallback } from "@ariakit/core/utils/types";
|
|
3
|
+
import type { CompositeItemOptions } from "../composite/composite-item.js";
|
|
4
|
+
import type { Props } from "../utils/types.js";
|
|
5
|
+
import type { TagStore } from "./tag-store.js";
|
|
6
|
+
declare const TagName = "input";
|
|
7
|
+
type TagName = typeof TagName;
|
|
8
|
+
type EventWithValues<T extends SyntheticEvent> = T & {
|
|
9
|
+
values: string[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Returns props to create a `TagInput` component.
|
|
13
|
+
* @see https://ariakit.org/components/tag
|
|
14
|
+
* @example
|
|
15
|
+
* ```jsx
|
|
16
|
+
* const props = useTagInput();
|
|
17
|
+
* <Role.input {...props} />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const useTagInput: import("../utils/types.js").Hook<"input", TagInputOptions<"input">>;
|
|
21
|
+
/**
|
|
22
|
+
* Renders an input element within a
|
|
23
|
+
* [`TagList`](https://ariakit.org/reference/tag-list) component. This component
|
|
24
|
+
* lets users input tag values that are added to the store when the input value
|
|
25
|
+
* changes or when the user pastes text into the input element, based on the
|
|
26
|
+
* [`delimiter`](https://ariakit.org/reference/tag-input#delimiter) prop.
|
|
27
|
+
*
|
|
28
|
+
* This component can be combined with a
|
|
29
|
+
* [`Combobox`](https://ariakit.org/reference/combobox) component using the
|
|
30
|
+
* [`render`](https://ariakit.org/reference/tag-input#render) prop to create a
|
|
31
|
+
* tag input with suggestions.
|
|
32
|
+
* @see https://ariakit.org/components/tag
|
|
33
|
+
* @example
|
|
34
|
+
* ```jsx {14}
|
|
35
|
+
* <TagProvider>
|
|
36
|
+
* <TagListLabel>Invitees</TagListLabel>
|
|
37
|
+
* <TagList>
|
|
38
|
+
* <TagValues>
|
|
39
|
+
* {(values) =>
|
|
40
|
+
* values.map((value) => (
|
|
41
|
+
* <Tag key={value} value={value}>
|
|
42
|
+
* {value}
|
|
43
|
+
* <TagRemove />
|
|
44
|
+
* </Tag>
|
|
45
|
+
* ))
|
|
46
|
+
* }
|
|
47
|
+
* </TagValues>
|
|
48
|
+
* <TagInput />
|
|
49
|
+
* </TagList>
|
|
50
|
+
* </TagProvider>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare const TagInput: (props: TagInputProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
54
|
+
export interface TagInputOptions<T extends ElementType = TagName> extends CompositeItemOptions<T> {
|
|
55
|
+
/**
|
|
56
|
+
* Object returned by the
|
|
57
|
+
* [`useTagStore`](https://ariakit.org/reference/use-tag-store) hook. If not
|
|
58
|
+
* provided, the closest
|
|
59
|
+
* [`TagProvider`](https://ariakit.org/reference/tag-provider) component's
|
|
60
|
+
* context will be used.
|
|
61
|
+
*/
|
|
62
|
+
store?: TagStore;
|
|
63
|
+
/**
|
|
64
|
+
* The string or pattern employed to break the input value into multiple tags.
|
|
65
|
+
* This could be a string, a regular expression, an array of strings and
|
|
66
|
+
* regular expressions, or `null` to prevent splitting on input.
|
|
67
|
+
*
|
|
68
|
+
* When an array is given, the input value is split by the first matching
|
|
69
|
+
* delimiter. All other delimiters are disregarded for the same input event.
|
|
70
|
+
* For example, if the delimiters are `["\n", ","]` and the user pastes text
|
|
71
|
+
* containing commas and newlines, the text will be split solely by newlines.
|
|
72
|
+
* The commas will be preserved in the tag values. If you want to split by
|
|
73
|
+
* both commas and newlines, you should use a regular expression that matches
|
|
74
|
+
* both characters (e.g., `/[\n,]/`).
|
|
75
|
+
* @default ["\n", ";", ",", /\s/]
|
|
76
|
+
*/
|
|
77
|
+
delimiter?: string | RegExp | null | (string | RegExp)[];
|
|
78
|
+
/**
|
|
79
|
+
* Determines if tag values should be added to the store when the input value
|
|
80
|
+
* is pasted. The values are extracted from the clipboard text and
|
|
81
|
+
* automatically processed with the
|
|
82
|
+
* [`delimiter`](https://ariakit.org/reference/tag-input#delimiter) prop.
|
|
83
|
+
*
|
|
84
|
+
* This can be either a boolean or a callback that receives an event with an
|
|
85
|
+
* extra `values` property and should return a boolean.
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
addValueOnPaste?: BooleanOrCallback<EventWithValues<ClipboardEvent<HTMLElement>>>;
|
|
89
|
+
/**
|
|
90
|
+
* Determines if the tag value should be added to the store when the input
|
|
91
|
+
* value changes. The tag value is automatically processed with the
|
|
92
|
+
* [`delimiter`](https://ariakit.org/reference/tag-input#delimiter) prop.
|
|
93
|
+
*
|
|
94
|
+
* This can be either a boolean or a callback that receives an event with an
|
|
95
|
+
* extra `values` property and should return a boolean.
|
|
96
|
+
* @default true
|
|
97
|
+
*/
|
|
98
|
+
addValueOnChange?: BooleanOrCallback<EventWithValues<ChangeEvent<HTMLElement>>>;
|
|
99
|
+
/**
|
|
100
|
+
* Whether the tag
|
|
101
|
+
* [`value`](https://ariakit.org/reference/tag-provider#value) state
|
|
102
|
+
* should be updated when the input value changes. This is useful if you want
|
|
103
|
+
* to customize how the store
|
|
104
|
+
* [`value`](https://ariakit.org/reference/tag-provider#value) is updated
|
|
105
|
+
* based on the input element's value.
|
|
106
|
+
* @default true
|
|
107
|
+
*/
|
|
108
|
+
setValueOnChange?: BooleanOrCallback<ChangeEvent<HTMLElement>>;
|
|
109
|
+
/**
|
|
110
|
+
* Determines whether the last tag value should be removed from the store when
|
|
111
|
+
* the `Backspace` key is pressed and the cursor is at the start of the input
|
|
112
|
+
* value.
|
|
113
|
+
* @default true
|
|
114
|
+
*/
|
|
115
|
+
removeOnBackspace?: BooleanOrCallback<KeyboardEvent<HTMLElement>>;
|
|
116
|
+
/**
|
|
117
|
+
* @default true
|
|
118
|
+
*/
|
|
119
|
+
tabbable?: CompositeItemOptions<T>["tabbable"];
|
|
120
|
+
}
|
|
121
|
+
export type TagInputProps<T extends ElementType = TagName> = Props<T, TagInputOptions<T>>;
|
|
122
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { ChangeEvent, ClipboardEvent, ElementType, KeyboardEvent, SyntheticEvent } from "react";
|
|
2
|
+
import type { BooleanOrCallback } from "@ariakit/core/utils/types";
|
|
3
|
+
import type { CompositeItemOptions } from "../composite/composite-item.js";
|
|
4
|
+
import type { Props } from "../utils/types.js";
|
|
5
|
+
import type { TagStore } from "./tag-store.js";
|
|
6
|
+
declare const TagName = "input";
|
|
7
|
+
type TagName = typeof TagName;
|
|
8
|
+
type EventWithValues<T extends SyntheticEvent> = T & {
|
|
9
|
+
values: string[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Returns props to create a `TagInput` component.
|
|
13
|
+
* @see https://ariakit.org/components/tag
|
|
14
|
+
* @example
|
|
15
|
+
* ```jsx
|
|
16
|
+
* const props = useTagInput();
|
|
17
|
+
* <Role.input {...props} />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const useTagInput: import("../utils/types.js").Hook<"input", TagInputOptions<"input">>;
|
|
21
|
+
/**
|
|
22
|
+
* Renders an input element within a
|
|
23
|
+
* [`TagList`](https://ariakit.org/reference/tag-list) component. This component
|
|
24
|
+
* lets users input tag values that are added to the store when the input value
|
|
25
|
+
* changes or when the user pastes text into the input element, based on the
|
|
26
|
+
* [`delimiter`](https://ariakit.org/reference/tag-input#delimiter) prop.
|
|
27
|
+
*
|
|
28
|
+
* This component can be combined with a
|
|
29
|
+
* [`Combobox`](https://ariakit.org/reference/combobox) component using the
|
|
30
|
+
* [`render`](https://ariakit.org/reference/tag-input#render) prop to create a
|
|
31
|
+
* tag input with suggestions.
|
|
32
|
+
* @see https://ariakit.org/components/tag
|
|
33
|
+
* @example
|
|
34
|
+
* ```jsx {14}
|
|
35
|
+
* <TagProvider>
|
|
36
|
+
* <TagListLabel>Invitees</TagListLabel>
|
|
37
|
+
* <TagList>
|
|
38
|
+
* <TagValues>
|
|
39
|
+
* {(values) =>
|
|
40
|
+
* values.map((value) => (
|
|
41
|
+
* <Tag key={value} value={value}>
|
|
42
|
+
* {value}
|
|
43
|
+
* <TagRemove />
|
|
44
|
+
* </Tag>
|
|
45
|
+
* ))
|
|
46
|
+
* }
|
|
47
|
+
* </TagValues>
|
|
48
|
+
* <TagInput />
|
|
49
|
+
* </TagList>
|
|
50
|
+
* </TagProvider>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare const TagInput: (props: TagInputProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
54
|
+
export interface TagInputOptions<T extends ElementType = TagName> extends CompositeItemOptions<T> {
|
|
55
|
+
/**
|
|
56
|
+
* Object returned by the
|
|
57
|
+
* [`useTagStore`](https://ariakit.org/reference/use-tag-store) hook. If not
|
|
58
|
+
* provided, the closest
|
|
59
|
+
* [`TagProvider`](https://ariakit.org/reference/tag-provider) component's
|
|
60
|
+
* context will be used.
|
|
61
|
+
*/
|
|
62
|
+
store?: TagStore;
|
|
63
|
+
/**
|
|
64
|
+
* The string or pattern employed to break the input value into multiple tags.
|
|
65
|
+
* This could be a string, a regular expression, an array of strings and
|
|
66
|
+
* regular expressions, or `null` to prevent splitting on input.
|
|
67
|
+
*
|
|
68
|
+
* When an array is given, the input value is split by the first matching
|
|
69
|
+
* delimiter. All other delimiters are disregarded for the same input event.
|
|
70
|
+
* For example, if the delimiters are `["\n", ","]` and the user pastes text
|
|
71
|
+
* containing commas and newlines, the text will be split solely by newlines.
|
|
72
|
+
* The commas will be preserved in the tag values. If you want to split by
|
|
73
|
+
* both commas and newlines, you should use a regular expression that matches
|
|
74
|
+
* both characters (e.g., `/[\n,]/`).
|
|
75
|
+
* @default ["\n", ";", ",", /\s/]
|
|
76
|
+
*/
|
|
77
|
+
delimiter?: string | RegExp | null | (string | RegExp)[];
|
|
78
|
+
/**
|
|
79
|
+
* Determines if tag values should be added to the store when the input value
|
|
80
|
+
* is pasted. The values are extracted from the clipboard text and
|
|
81
|
+
* automatically processed with the
|
|
82
|
+
* [`delimiter`](https://ariakit.org/reference/tag-input#delimiter) prop.
|
|
83
|
+
*
|
|
84
|
+
* This can be either a boolean or a callback that receives an event with an
|
|
85
|
+
* extra `values` property and should return a boolean.
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
addValueOnPaste?: BooleanOrCallback<EventWithValues<ClipboardEvent<HTMLElement>>>;
|
|
89
|
+
/**
|
|
90
|
+
* Determines if the tag value should be added to the store when the input
|
|
91
|
+
* value changes. The tag value is automatically processed with the
|
|
92
|
+
* [`delimiter`](https://ariakit.org/reference/tag-input#delimiter) prop.
|
|
93
|
+
*
|
|
94
|
+
* This can be either a boolean or a callback that receives an event with an
|
|
95
|
+
* extra `values` property and should return a boolean.
|
|
96
|
+
* @default true
|
|
97
|
+
*/
|
|
98
|
+
addValueOnChange?: BooleanOrCallback<EventWithValues<ChangeEvent<HTMLElement>>>;
|
|
99
|
+
/**
|
|
100
|
+
* Whether the tag
|
|
101
|
+
* [`value`](https://ariakit.org/reference/tag-provider#value) state
|
|
102
|
+
* should be updated when the input value changes. This is useful if you want
|
|
103
|
+
* to customize how the store
|
|
104
|
+
* [`value`](https://ariakit.org/reference/tag-provider#value) is updated
|
|
105
|
+
* based on the input element's value.
|
|
106
|
+
* @default true
|
|
107
|
+
*/
|
|
108
|
+
setValueOnChange?: BooleanOrCallback<ChangeEvent<HTMLElement>>;
|
|
109
|
+
/**
|
|
110
|
+
* Determines whether the last tag value should be removed from the store when
|
|
111
|
+
* the `Backspace` key is pressed and the cursor is at the start of the input
|
|
112
|
+
* value.
|
|
113
|
+
* @default true
|
|
114
|
+
*/
|
|
115
|
+
removeOnBackspace?: BooleanOrCallback<KeyboardEvent<HTMLElement>>;
|
|
116
|
+
/**
|
|
117
|
+
* @default true
|
|
118
|
+
*/
|
|
119
|
+
tabbable?: CompositeItemOptions<T>["tabbable"];
|
|
120
|
+
}
|
|
121
|
+
export type TagInputProps<T extends ElementType = TagName> = Props<T, TagInputOptions<T>>;
|
|
122
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _PVLZGFP6cjs = require('../__chunks/PVLZGFP6.cjs');
|
|
5
|
+
require('../__chunks/VPI3EKVY.cjs');
|
|
6
|
+
require('../__chunks/NEK2UEJN.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _NGD3IQDBcjs = require('../__chunks/NGD3IQDB.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _TW3SFX4Ccjs = require('../__chunks/TW3SFX4C.cjs');
|
|
16
|
+
require('../__chunks/CJDHQUBR.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
22
|
+
|
|
23
|
+
// src/tag/tag-list-label.tsx
|
|
24
|
+
var _misc = require('@ariakit/core/utils/misc');
|
|
25
|
+
var TagName = "label";
|
|
26
|
+
var useTagListLabel = _NGD3IQDBcjs.createHook.call(void 0,
|
|
27
|
+
function useTagListLabel2(_a) {
|
|
28
|
+
var _b = _a, { store } = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, ["store"]);
|
|
29
|
+
const context = _PVLZGFP6cjs.useTagContext.call(void 0, );
|
|
30
|
+
store = store || context;
|
|
31
|
+
_misc.invariant.call(void 0,
|
|
32
|
+
store,
|
|
33
|
+
process.env.NODE_ENV !== "production" && "TagListLabel must receive a `store` prop or be wrapped in a TagProvider component."
|
|
34
|
+
);
|
|
35
|
+
const id = _TW3SFX4Ccjs.useId.call(void 0, props.id);
|
|
36
|
+
const htmlFor = store.useState((state) => {
|
|
37
|
+
var _a2;
|
|
38
|
+
return (_a2 = state.inputElement) == null ? void 0 : _a2.id;
|
|
39
|
+
});
|
|
40
|
+
props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
41
|
+
id,
|
|
42
|
+
htmlFor
|
|
43
|
+
}, props), {
|
|
44
|
+
ref: _TW3SFX4Ccjs.useMergeRefs.call(void 0, store.setLabelElement, props.ref)
|
|
45
|
+
});
|
|
46
|
+
return props;
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
var TagListLabel = _NGD3IQDBcjs.forwardRef.call(void 0, function TagListLabel2(props) {
|
|
50
|
+
const htmlProps = useTagListLabel(props);
|
|
51
|
+
return _NGD3IQDBcjs.createElement.call(void 0, TagName, htmlProps);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
exports.TagListLabel = TagListLabel; exports.useTagListLabel = useTagListLabel;
|