@ariakit/react-core 0.4.3 → 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 +58 -0
- package/cjs/__chunks/{7DQ2LBH2.cjs → 3HMQOCLF.cjs} +23 -5
- package/cjs/__chunks/{AJF5DT5A.cjs → AY5J25V7.cjs} +2 -2
- package/cjs/__chunks/{HFNM6QV4.cjs → DAOFDKV2.cjs} +1 -1
- package/cjs/__chunks/{GYHP7IYG.cjs → DFXPO2ED.cjs} +2 -2
- package/cjs/__chunks/{3C4RFBCG.cjs → EYZZO5IT.cjs} +1 -1
- package/cjs/__chunks/{3MKOUH5M.cjs → GZ2NNSLV.cjs} +4 -4
- package/cjs/__chunks/ISJGSS4S.cjs +16 -0
- package/cjs/__chunks/{A356CGND.cjs → JDCTLYQ4.cjs} +1 -1
- package/cjs/__chunks/{T5BWR4CB.cjs → KDTFHBKU.cjs} +2 -2
- package/cjs/__chunks/{NZSB7HSZ.cjs → LY4LCJM6.cjs} +2 -2
- package/cjs/__chunks/{DCTXNU2X.cjs → N43E53E6.cjs} +3 -3
- package/cjs/__chunks/{IHFGURUM.cjs → NRPEUNJB.cjs} +2 -2
- package/cjs/__chunks/PVLZGFP6.cjs +34 -0
- package/cjs/__chunks/{CWS5RZSU.cjs → QJDA4LG6.cjs} +28 -17
- package/cjs/__chunks/{NDVZ37O3.cjs → RG6U7KAS.cjs} +22 -4
- package/cjs/__chunks/YWAHOWYE.cjs +25 -0
- package/cjs/__chunks/{3XXW4Y4D.cjs → Z2VL7JHX.cjs} +2 -2
- package/cjs/checkbox/checkbox-check.cjs +2 -2
- package/cjs/collection/collection-renderer.d.cts +0 -2
- package/cjs/collection/collection-renderer.d.ts +0 -2
- package/cjs/combobox/combobox-cancel.cjs +4 -4
- package/cjs/combobox/combobox-disclosure.cjs +4 -4
- package/cjs/combobox/combobox-item-check.cjs +2 -2
- 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 +41 -16
- 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 +79 -32
- package/cjs/combobox/combobox.d.cts +20 -0
- package/cjs/combobox/combobox.d.ts +20 -0
- package/cjs/composite/composite-input.cjs +91 -6
- package/cjs/composite/composite-input.d.cts +2 -0
- package/cjs/composite/composite-input.d.ts +2 -0
- 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/composite/composite-renderer.d.cts +0 -2
- package/cjs/composite/composite-renderer.d.ts +0 -2
- package/cjs/dialog/dialog-backdrop.cjs +3 -3
- package/cjs/dialog/dialog-dismiss.cjs +2 -2
- 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-disclosure.cjs +1 -1
- package/cjs/hovercard/hovercard-dismiss.cjs +4 -4
- package/cjs/hovercard/hovercard.cjs +13 -13
- package/cjs/menu/menu-button-arrow.cjs +2 -2
- package/cjs/menu/menu-dismiss.cjs +4 -4
- package/cjs/menu/menu-item-check.cjs +2 -2
- 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-disclosure-arrow.cjs +2 -2
- package/cjs/popover/popover-dismiss.cjs +3 -3
- package/cjs/popover/popover.cjs +12 -12
- package/cjs/radio/radio.cjs +4 -4
- package/cjs/select/select-arrow.cjs +3 -3
- package/cjs/select/select-item-check.cjs +2 -2
- 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 +4 -4
- 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 -8
- package/cjs/toolbar/toolbar-input.d.cts +3 -2
- package/cjs/toolbar/toolbar-input.d.ts +3 -2
- 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/{LABIXQLW.js → 44PDY2W5.js} +1 -1
- package/esm/__chunks/{FYNSL2D5.js → 5H3YXAUC.js} +1 -1
- package/esm/__chunks/{6VDNHSLX.js → 65LF6MEO.js} +2 -2
- package/esm/__chunks/{X3V2DT2U.js → 6YVAEELE.js} +1 -1
- package/esm/__chunks/{JCOBPKEI.js → BY6P32UK.js} +1 -1
- package/esm/__chunks/{ZFEEEZVE.js → DLLQM6DZ.js} +22 -4
- package/esm/__chunks/{NN4HLGKS.js → F2RFUFO2.js} +1 -1
- package/esm/__chunks/{NQ4PTILT.js → FGHVVLPU.js} +29 -18
- package/esm/__chunks/{2VWKZYYT.js → H5N72W37.js} +1 -1
- package/esm/__chunks/L7IM35RU.js +16 -0
- package/esm/__chunks/{HW63KLP5.js → M354SEUF.js} +1 -1
- package/esm/__chunks/{RAKW656I.js → Q4PZFBSW.js} +1 -1
- package/esm/__chunks/QNNHZL3W.js +25 -0
- package/esm/__chunks/{C5HA76JU.js → QZJOXZKA.js} +1 -1
- package/esm/__chunks/{XK6CE2M5.js → UKDZLPKH.js} +1 -1
- package/esm/__chunks/{ONUY4D7O.js → VGORKDMQ.js} +26 -8
- package/esm/__chunks/WYDDZRWN.js +34 -0
- package/esm/checkbox/checkbox-check.js +1 -1
- package/esm/collection/collection-renderer.d.ts +0 -2
- package/esm/combobox/combobox-cancel.js +4 -4
- package/esm/combobox/combobox-disclosure.js +4 -4
- package/esm/combobox/combobox-item-check.js +1 -1
- package/esm/combobox/combobox-item.d.ts +22 -12
- package/esm/combobox/combobox-item.js +19 -9
- package/esm/combobox/combobox-popover.js +40 -15
- 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.d.ts +20 -0
- package/esm/combobox/combobox.js +80 -33
- package/esm/composite/composite-input.d.ts +2 -0
- package/esm/composite/composite-input.js +92 -7
- 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/composite/composite-renderer.d.ts +0 -2
- package/esm/dialog/dialog-backdrop.js +2 -2
- package/esm/dialog/dialog-dismiss.js +1 -1
- 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-disclosure.js +1 -1
- package/esm/hovercard/hovercard-dismiss.js +3 -3
- package/esm/hovercard/hovercard.js +12 -12
- package/esm/menu/menu-button-arrow.js +1 -1
- package/esm/menu/menu-dismiss.js +3 -3
- package/esm/menu/menu-item-check.js +1 -1
- 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-disclosure-arrow.js +1 -1
- package/esm/popover/popover-dismiss.js +2 -2
- package/esm/popover/popover.js +11 -11
- package/esm/radio/radio.js +3 -3
- package/esm/select/select-arrow.js +2 -2
- package/esm/select/select-item-check.js +1 -1
- 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 +3 -3
- 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.d.ts +3 -2
- package/esm/toolbar/toolbar-input.js +3 -7
- 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/WGZQRLXV.cjs +0 -84
- package/esm/__chunks/RPGNBKKU.js +0 -84
- 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
|
@@ -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;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ElementType } from "react";
|
|
2
|
+
import type { CompositeOptions } from "../composite/composite.jsx";
|
|
3
|
+
import type { Props } from "../utils/types.js";
|
|
4
|
+
import type { TagStore } from "./tag-store.js";
|
|
5
|
+
declare const TagName = "label";
|
|
6
|
+
type TagName = typeof TagName;
|
|
7
|
+
/**
|
|
8
|
+
* Returns props to create a `TagListLabel` component.
|
|
9
|
+
* @see https://ariakit.org/components/tag
|
|
10
|
+
* @example
|
|
11
|
+
* ```jsx
|
|
12
|
+
* const props = useTagListLabel();
|
|
13
|
+
* <Role.label {...props} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const useTagListLabel: import("../utils/types.js").Hook<"label", TagListLabelOptions<"label">>;
|
|
17
|
+
/**
|
|
18
|
+
* Renders a label element for the
|
|
19
|
+
* [`TagInput`](https://ariakit.org/reference/tag-input) and also acts as the
|
|
20
|
+
* accessible name for the listbox element rendered by
|
|
21
|
+
* [`TagList`](https://ariakit.org/reference/tag-list).
|
|
22
|
+
* @see https://ariakit.org/components/tag
|
|
23
|
+
* @example
|
|
24
|
+
* ```jsx {2}
|
|
25
|
+
* <TagProvider>
|
|
26
|
+
* <TagListLabel>Invitees</TagListLabel>
|
|
27
|
+
* <TagList>
|
|
28
|
+
* <TagValues>
|
|
29
|
+
* {(values) =>
|
|
30
|
+
* values.map((value) => (
|
|
31
|
+
* <Tag key={value} value={value}>
|
|
32
|
+
* {value}
|
|
33
|
+
* <TagRemove />
|
|
34
|
+
* </Tag>
|
|
35
|
+
* ))
|
|
36
|
+
* }
|
|
37
|
+
* </TagValues>
|
|
38
|
+
* <TagInput />
|
|
39
|
+
* </TagList>
|
|
40
|
+
* </TagProvider>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const TagListLabel: (props: TagListLabelProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
44
|
+
export interface TagListLabelOptions<T extends ElementType = TagName> extends CompositeOptions<T> {
|
|
45
|
+
/**
|
|
46
|
+
* Object returned by the
|
|
47
|
+
* [`useTagStore`](https://ariakit.org/reference/use-tag-store) hook. If not
|
|
48
|
+
* provided, the closest
|
|
49
|
+
* [`TagProvider`](https://ariakit.org/reference/tag-provider) component's
|
|
50
|
+
* context will be used.
|
|
51
|
+
*/
|
|
52
|
+
store?: TagStore;
|
|
53
|
+
}
|
|
54
|
+
export type TagListLabelProps<T extends ElementType = TagName> = Props<T, TagListLabelOptions<T>>;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ElementType } from "react";
|
|
2
|
+
import type { CompositeOptions } from "../composite/composite.jsx";
|
|
3
|
+
import type { Props } from "../utils/types.js";
|
|
4
|
+
import type { TagStore } from "./tag-store.js";
|
|
5
|
+
declare const TagName = "label";
|
|
6
|
+
type TagName = typeof TagName;
|
|
7
|
+
/**
|
|
8
|
+
* Returns props to create a `TagListLabel` component.
|
|
9
|
+
* @see https://ariakit.org/components/tag
|
|
10
|
+
* @example
|
|
11
|
+
* ```jsx
|
|
12
|
+
* const props = useTagListLabel();
|
|
13
|
+
* <Role.label {...props} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const useTagListLabel: import("../utils/types.js").Hook<"label", TagListLabelOptions<"label">>;
|
|
17
|
+
/**
|
|
18
|
+
* Renders a label element for the
|
|
19
|
+
* [`TagInput`](https://ariakit.org/reference/tag-input) and also acts as the
|
|
20
|
+
* accessible name for the listbox element rendered by
|
|
21
|
+
* [`TagList`](https://ariakit.org/reference/tag-list).
|
|
22
|
+
* @see https://ariakit.org/components/tag
|
|
23
|
+
* @example
|
|
24
|
+
* ```jsx {2}
|
|
25
|
+
* <TagProvider>
|
|
26
|
+
* <TagListLabel>Invitees</TagListLabel>
|
|
27
|
+
* <TagList>
|
|
28
|
+
* <TagValues>
|
|
29
|
+
* {(values) =>
|
|
30
|
+
* values.map((value) => (
|
|
31
|
+
* <Tag key={value} value={value}>
|
|
32
|
+
* {value}
|
|
33
|
+
* <TagRemove />
|
|
34
|
+
* </Tag>
|
|
35
|
+
* ))
|
|
36
|
+
* }
|
|
37
|
+
* </TagValues>
|
|
38
|
+
* <TagInput />
|
|
39
|
+
* </TagList>
|
|
40
|
+
* </TagProvider>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const TagListLabel: (props: TagListLabelProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
44
|
+
export interface TagListLabelOptions<T extends ElementType = TagName> extends CompositeOptions<T> {
|
|
45
|
+
/**
|
|
46
|
+
* Object returned by the
|
|
47
|
+
* [`useTagStore`](https://ariakit.org/reference/use-tag-store) hook. If not
|
|
48
|
+
* provided, the closest
|
|
49
|
+
* [`TagProvider`](https://ariakit.org/reference/tag-provider) component's
|
|
50
|
+
* context will be used.
|
|
51
|
+
*/
|
|
52
|
+
store?: TagStore;
|
|
53
|
+
}
|
|
54
|
+
export type TagListLabelProps<T extends ElementType = TagName> = Props<T, TagListLabelOptions<T>>;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _ISJGSS4Scjs = require('../__chunks/ISJGSS4S.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _PVLZGFP6cjs = require('../__chunks/PVLZGFP6.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _EKW5CERCcjs = require('../__chunks/EKW5CERC.cjs');
|
|
12
|
+
require('../__chunks/6ZZYUFPW.cjs');
|
|
13
|
+
require('../__chunks/VPI3EKVY.cjs');
|
|
14
|
+
require('../__chunks/NEK2UEJN.cjs');
|
|
15
|
+
require('../__chunks/FHRIPOYF.cjs');
|
|
16
|
+
require('../__chunks/75KXQZJX.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _NGD3IQDBcjs = require('../__chunks/NGD3IQDB.cjs');
|
|
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-list.tsx
|
|
34
|
+
var _events = require('@ariakit/core/utils/events');
|
|
35
|
+
var _focus = require('@ariakit/core/utils/focus');
|
|
36
|
+
var _misc = require('@ariakit/core/utils/misc');
|
|
37
|
+
var _platform = require('@ariakit/core/utils/platform');
|
|
38
|
+
var _undo = require('@ariakit/core/utils/undo');
|
|
39
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
40
|
+
var TagName = "div";
|
|
41
|
+
var useTagList = _NGD3IQDBcjs.createHook.call(void 0,
|
|
42
|
+
function useTagList2(_a) {
|
|
43
|
+
var _b = _a, { store } = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, ["store"]);
|
|
44
|
+
const context = _PVLZGFP6cjs.useTagProviderContext.call(void 0, );
|
|
45
|
+
store = store || context;
|
|
46
|
+
_misc.invariant.call(void 0,
|
|
47
|
+
store,
|
|
48
|
+
process.env.NODE_ENV !== "production" && "TagList must receive a `store` prop or be wrapped in a TagProvider component."
|
|
49
|
+
);
|
|
50
|
+
const onMouseDownProp = props.onMouseDown;
|
|
51
|
+
const onMouseDown = _TW3SFX4Ccjs.useEvent.call(void 0, (event) => {
|
|
52
|
+
onMouseDownProp == null ? void 0 : onMouseDownProp(event);
|
|
53
|
+
if (event.defaultPrevented)
|
|
54
|
+
return;
|
|
55
|
+
const target = event.target;
|
|
56
|
+
const currentTarget = event.currentTarget;
|
|
57
|
+
const focusableTarget = _focus.getClosestFocusable.call(void 0, target);
|
|
58
|
+
const isSelfFocusable = focusableTarget === currentTarget;
|
|
59
|
+
if (!isSelfFocusable && currentTarget.contains(focusableTarget))
|
|
60
|
+
return;
|
|
61
|
+
const { inputElement } = store.getState();
|
|
62
|
+
_events.queueBeforeEvent.call(void 0, event.currentTarget, "mouseup", () => {
|
|
63
|
+
inputElement == null ? void 0 : inputElement.focus();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const onKeyDownProp = props.onKeyDown;
|
|
67
|
+
const onKeyDown = _TW3SFX4Ccjs.useEvent.call(void 0, (event) => {
|
|
68
|
+
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
|
|
69
|
+
if (event.defaultPrevented)
|
|
70
|
+
return;
|
|
71
|
+
const pc = !_platform.isApple.call(void 0, );
|
|
72
|
+
const z = event.key === "z" || event.key === "Z";
|
|
73
|
+
const mod = pc ? event.ctrlKey : event.metaKey;
|
|
74
|
+
const shiftZ = event.shiftKey && z || pc && event.key === "y";
|
|
75
|
+
if (mod && shiftZ) {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
_undo.UndoManager.redo();
|
|
78
|
+
} else if (mod && z) {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
_undo.UndoManager.undo();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
props = _TW3SFX4Ccjs.useWrapElement.call(void 0,
|
|
84
|
+
props,
|
|
85
|
+
(element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _PVLZGFP6cjs.TagScopedContextProvider, { value: store, children: element }),
|
|
86
|
+
[store]
|
|
87
|
+
);
|
|
88
|
+
props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
89
|
+
onMouseDown,
|
|
90
|
+
onKeyDown
|
|
91
|
+
});
|
|
92
|
+
props = _EKW5CERCcjs.useComposite.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store }, props));
|
|
93
|
+
const orientation = store.useState(
|
|
94
|
+
(state) => state.orientation === "both" ? void 0 : state.orientation
|
|
95
|
+
);
|
|
96
|
+
const items = store.useState((state) => state.renderedItems);
|
|
97
|
+
const itemIds = items.filter((item) => !!item.value).map((item) => item.id);
|
|
98
|
+
const labelId = store.useState((state) => {
|
|
99
|
+
var _a2;
|
|
100
|
+
return (_a2 = state.labelElement) == null ? void 0 : _a2.id;
|
|
101
|
+
});
|
|
102
|
+
const listboxProps = {};
|
|
103
|
+
for (const key in props) {
|
|
104
|
+
if (key === "role" || key.startsWith("aria-")) {
|
|
105
|
+
const prop = key;
|
|
106
|
+
listboxProps[prop] = props[prop];
|
|
107
|
+
delete props[prop];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const touchDevice = _ISJGSS4Scjs.useTouchDevice.call(void 0, );
|
|
111
|
+
const children = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
112
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
113
|
+
"div",
|
|
114
|
+
_AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
115
|
+
role: touchDevice ? "list" : "listbox",
|
|
116
|
+
"aria-live": "polite",
|
|
117
|
+
"aria-relevant": "all",
|
|
118
|
+
"aria-atomic": true,
|
|
119
|
+
"aria-labelledby": labelId,
|
|
120
|
+
"aria-orientation": orientation,
|
|
121
|
+
"aria-owns": itemIds.join(" ")
|
|
122
|
+
}, listboxProps), {
|
|
123
|
+
style: { position: "fixed" }
|
|
124
|
+
})
|
|
125
|
+
),
|
|
126
|
+
props.children
|
|
127
|
+
] });
|
|
128
|
+
props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
129
|
+
children
|
|
130
|
+
});
|
|
131
|
+
return props;
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
var TagList = _NGD3IQDBcjs.forwardRef.call(void 0, function TagList2(props) {
|
|
135
|
+
const htmlProps = useTagList(props);
|
|
136
|
+
return _NGD3IQDBcjs.createElement.call(void 0, TagName, htmlProps);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
exports.TagList = TagList; exports.useTagList = useTagList;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ElementType } from "react";
|
|
2
|
+
import type { CompositeOptions } from "../composite/composite.js";
|
|
3
|
+
import type { Props } from "../utils/types.js";
|
|
4
|
+
import type { TagStore } from "./tag-store.js";
|
|
5
|
+
declare const TagName = "div";
|
|
6
|
+
type TagName = typeof TagName;
|
|
7
|
+
/**
|
|
8
|
+
* Returns props to create a `TagList` component.
|
|
9
|
+
* @see https://ariakit.org/components/tag
|
|
10
|
+
* @example
|
|
11
|
+
* ```jsx
|
|
12
|
+
* const props = useTagList();
|
|
13
|
+
* <Role.div {...props} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const useTagList: import("../utils/types.js").Hook<"div", TagListOptions<"div">>;
|
|
17
|
+
/**
|
|
18
|
+
* Renders a wrapper for [`Tag`](https://ariakit.org/reference/tag) and
|
|
19
|
+
* [`TagInput`](https://ariakit.org/reference/tag-input) components. This
|
|
20
|
+
* component is typically styled as an input field.
|
|
21
|
+
*
|
|
22
|
+
* The [`TagListLabel`](https://ariakit.org/reference/tag-list-label) component
|
|
23
|
+
* can be used to provide an accessible name for the listbox element that owns
|
|
24
|
+
* the tags.
|
|
25
|
+
* @see https://ariakit.org/components/tag
|
|
26
|
+
* @example
|
|
27
|
+
* ```jsx {3-15}
|
|
28
|
+
* <TagProvider>
|
|
29
|
+
* <TagListLabel>Invitees</TagListLabel>
|
|
30
|
+
* <TagList>
|
|
31
|
+
* <TagValues>
|
|
32
|
+
* {(values) =>
|
|
33
|
+
* values.map((value) => (
|
|
34
|
+
* <Tag key={value} value={value}>
|
|
35
|
+
* {value}
|
|
36
|
+
* <TagRemove />
|
|
37
|
+
* </Tag>
|
|
38
|
+
* ))
|
|
39
|
+
* }
|
|
40
|
+
* </TagValues>
|
|
41
|
+
* <TagInput />
|
|
42
|
+
* </TagList>
|
|
43
|
+
* </TagProvider>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const TagList: (props: TagListProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
47
|
+
export interface TagListOptions<T extends ElementType = TagName> extends CompositeOptions<T> {
|
|
48
|
+
/**
|
|
49
|
+
* Object returned by the
|
|
50
|
+
* [`useTagStore`](https://ariakit.org/reference/use-tag-store) hook. If not
|
|
51
|
+
* provided, the closest
|
|
52
|
+
* [`TagProvider`](https://ariakit.org/reference/tag-provider) component's
|
|
53
|
+
* context will be used.
|
|
54
|
+
*/
|
|
55
|
+
store?: TagStore;
|
|
56
|
+
}
|
|
57
|
+
export type TagListProps<T extends ElementType = TagName> = Props<T, TagListOptions<T>>;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ElementType } from "react";
|
|
2
|
+
import type { CompositeOptions } from "../composite/composite.js";
|
|
3
|
+
import type { Props } from "../utils/types.js";
|
|
4
|
+
import type { TagStore } from "./tag-store.js";
|
|
5
|
+
declare const TagName = "div";
|
|
6
|
+
type TagName = typeof TagName;
|
|
7
|
+
/**
|
|
8
|
+
* Returns props to create a `TagList` component.
|
|
9
|
+
* @see https://ariakit.org/components/tag
|
|
10
|
+
* @example
|
|
11
|
+
* ```jsx
|
|
12
|
+
* const props = useTagList();
|
|
13
|
+
* <Role.div {...props} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const useTagList: import("../utils/types.js").Hook<"div", TagListOptions<"div">>;
|
|
17
|
+
/**
|
|
18
|
+
* Renders a wrapper for [`Tag`](https://ariakit.org/reference/tag) and
|
|
19
|
+
* [`TagInput`](https://ariakit.org/reference/tag-input) components. This
|
|
20
|
+
* component is typically styled as an input field.
|
|
21
|
+
*
|
|
22
|
+
* The [`TagListLabel`](https://ariakit.org/reference/tag-list-label) component
|
|
23
|
+
* can be used to provide an accessible name for the listbox element that owns
|
|
24
|
+
* the tags.
|
|
25
|
+
* @see https://ariakit.org/components/tag
|
|
26
|
+
* @example
|
|
27
|
+
* ```jsx {3-15}
|
|
28
|
+
* <TagProvider>
|
|
29
|
+
* <TagListLabel>Invitees</TagListLabel>
|
|
30
|
+
* <TagList>
|
|
31
|
+
* <TagValues>
|
|
32
|
+
* {(values) =>
|
|
33
|
+
* values.map((value) => (
|
|
34
|
+
* <Tag key={value} value={value}>
|
|
35
|
+
* {value}
|
|
36
|
+
* <TagRemove />
|
|
37
|
+
* </Tag>
|
|
38
|
+
* ))
|
|
39
|
+
* }
|
|
40
|
+
* </TagValues>
|
|
41
|
+
* <TagInput />
|
|
42
|
+
* </TagList>
|
|
43
|
+
* </TagProvider>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const TagList: (props: TagListProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
47
|
+
export interface TagListOptions<T extends ElementType = TagName> extends CompositeOptions<T> {
|
|
48
|
+
/**
|
|
49
|
+
* Object returned by the
|
|
50
|
+
* [`useTagStore`](https://ariakit.org/reference/use-tag-store) hook. If not
|
|
51
|
+
* provided, the closest
|
|
52
|
+
* [`TagProvider`](https://ariakit.org/reference/tag-provider) component's
|
|
53
|
+
* context will be used.
|
|
54
|
+
*/
|
|
55
|
+
store?: TagStore;
|
|
56
|
+
}
|
|
57
|
+
export type TagListProps<T extends ElementType = TagName> = Props<T, TagListOptions<T>>;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _YWAHOWYEcjs = require('../__chunks/YWAHOWYE.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _PVLZGFP6cjs = require('../__chunks/PVLZGFP6.cjs');
|
|
8
|
+
require('../__chunks/4H5ZMMOI.cjs');
|
|
9
|
+
require('../__chunks/Q7DU7FP7.cjs');
|
|
10
|
+
require('../__chunks/VPI3EKVY.cjs');
|
|
11
|
+
require('../__chunks/NEK2UEJN.cjs');
|
|
12
|
+
require('../__chunks/NGD3IQDB.cjs');
|
|
13
|
+
require('../__chunks/GXMZA6DT.cjs');
|
|
14
|
+
require('../__chunks/TW3SFX4C.cjs');
|
|
15
|
+
require('../__chunks/CJDHQUBR.cjs');
|
|
16
|
+
require('../__chunks/AV6KTKLE.cjs');
|
|
17
|
+
|
|
18
|
+
// src/tag/tag-provider.tsx
|
|
19
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
20
|
+
function TagProvider(props = {}) {
|
|
21
|
+
const store = _YWAHOWYEcjs.useTagStore.call(void 0, props);
|
|
22
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _PVLZGFP6cjs.TagContextProvider, { value: store, children: props.children });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
exports.TagProvider = TagProvider;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { TagStoreProps } from "./tag-store.js";
|
|
3
|
+
/**
|
|
4
|
+
* Provides a tag store to [Tag](https://ariakit.org/components/tag) components.
|
|
5
|
+
* @see https://ariakit.org/components/tag
|
|
6
|
+
* @example
|
|
7
|
+
* ```jsx
|
|
8
|
+
* <TagProvider>
|
|
9
|
+
* <TagListLabel>Invitees</TagListLabel>
|
|
10
|
+
* <TagList>
|
|
11
|
+
* <TagValues>
|
|
12
|
+
* {(values) =>
|
|
13
|
+
* values.map((value) => (
|
|
14
|
+
* <Tag key={value} value={value}>
|
|
15
|
+
* {value}
|
|
16
|
+
* <TagRemove />
|
|
17
|
+
* </Tag>
|
|
18
|
+
* ))
|
|
19
|
+
* }
|
|
20
|
+
* </TagValues>
|
|
21
|
+
* <TagInput />
|
|
22
|
+
* </TagList>
|
|
23
|
+
* </TagProvider>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function TagProvider(props?: TagProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export interface TagProviderProps extends TagStoreProps {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { TagStoreProps } from "./tag-store.js";
|
|
3
|
+
/**
|
|
4
|
+
* Provides a tag store to [Tag](https://ariakit.org/components/tag) components.
|
|
5
|
+
* @see https://ariakit.org/components/tag
|
|
6
|
+
* @example
|
|
7
|
+
* ```jsx
|
|
8
|
+
* <TagProvider>
|
|
9
|
+
* <TagListLabel>Invitees</TagListLabel>
|
|
10
|
+
* <TagList>
|
|
11
|
+
* <TagValues>
|
|
12
|
+
* {(values) =>
|
|
13
|
+
* values.map((value) => (
|
|
14
|
+
* <Tag key={value} value={value}>
|
|
15
|
+
* {value}
|
|
16
|
+
* <TagRemove />
|
|
17
|
+
* </Tag>
|
|
18
|
+
* ))
|
|
19
|
+
* }
|
|
20
|
+
* </TagValues>
|
|
21
|
+
* <TagInput />
|
|
22
|
+
* </TagList>
|
|
23
|
+
* </TagProvider>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function TagProvider(props?: TagProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export interface TagProviderProps extends TagStoreProps {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _ISJGSS4Scjs = require('../__chunks/ISJGSS4S.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _PVLZGFP6cjs = require('../__chunks/PVLZGFP6.cjs');
|
|
10
|
+
require('../__chunks/VPI3EKVY.cjs');
|
|
11
|
+
require('../__chunks/NEK2UEJN.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _R6M66EKZcjs = require('../__chunks/R6M66EKZ.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _NGD3IQDBcjs = require('../__chunks/NGD3IQDB.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _TW3SFX4Ccjs = require('../__chunks/TW3SFX4C.cjs');
|
|
25
|
+
require('../__chunks/CJDHQUBR.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
31
|
+
|
|
32
|
+
// src/tag/tag-remove.tsx
|
|
33
|
+
var _react = require('react');
|
|
34
|
+
var _misc = require('@ariakit/core/utils/misc');
|
|
35
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
36
|
+
var TagName = "button";
|
|
37
|
+
var useTagRemove = _NGD3IQDBcjs.createHook.call(void 0,
|
|
38
|
+
function useTagRemove2(_a) {
|
|
39
|
+
var _b = _a, {
|
|
40
|
+
store,
|
|
41
|
+
value: valueProp,
|
|
42
|
+
removeOnClick = true
|
|
43
|
+
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
44
|
+
"store",
|
|
45
|
+
"value",
|
|
46
|
+
"removeOnClick"
|
|
47
|
+
]);
|
|
48
|
+
const context = _PVLZGFP6cjs.useTagContext.call(void 0, );
|
|
49
|
+
store = store || context;
|
|
50
|
+
_misc.invariant.call(void 0,
|
|
51
|
+
store,
|
|
52
|
+
process.env.NODE_ENV !== "production" && "TagRemove must receive a `store` prop or be wrapped in a TagProvider component."
|
|
53
|
+
);
|
|
54
|
+
const id = _TW3SFX4Ccjs.useId.call(void 0, props.id);
|
|
55
|
+
const setRemoveId = _react.useContext.call(void 0, _PVLZGFP6cjs.TagRemoveIdContext);
|
|
56
|
+
const valueFromContext = _react.useContext.call(void 0, _PVLZGFP6cjs.TagValueContext);
|
|
57
|
+
const withinTag = valueFromContext !== null;
|
|
58
|
+
const value = valueProp != null ? valueProp : valueFromContext;
|
|
59
|
+
_react.useEffect.call(void 0, () => {
|
|
60
|
+
setRemoveId == null ? void 0 : setRemoveId(id);
|
|
61
|
+
return () => setRemoveId == null ? void 0 : setRemoveId();
|
|
62
|
+
}, [id, setRemoveId]);
|
|
63
|
+
const onClickProp = props.onClick;
|
|
64
|
+
const removeOnClickProp = _TW3SFX4Ccjs.useBooleanEvent.call(void 0, removeOnClick);
|
|
65
|
+
const onClick = _TW3SFX4Ccjs.useEvent.call(void 0, (event) => {
|
|
66
|
+
onClickProp == null ? void 0 : onClickProp(event);
|
|
67
|
+
if (event.defaultPrevented)
|
|
68
|
+
return;
|
|
69
|
+
if (!store)
|
|
70
|
+
return;
|
|
71
|
+
if (!value)
|
|
72
|
+
return;
|
|
73
|
+
if (!removeOnClickProp(event))
|
|
74
|
+
return;
|
|
75
|
+
const { inputElement } = store.getState();
|
|
76
|
+
store.removeValue(value);
|
|
77
|
+
inputElement == null ? void 0 : inputElement.focus();
|
|
78
|
+
});
|
|
79
|
+
const children = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
80
|
+
"svg",
|
|
81
|
+
{
|
|
82
|
+
display: "block",
|
|
83
|
+
viewBox: "0 0 24 24",
|
|
84
|
+
fill: "none",
|
|
85
|
+
stroke: "currentColor",
|
|
86
|
+
strokeWidth: 1.5,
|
|
87
|
+
strokeLinecap: "round",
|
|
88
|
+
strokeLinejoin: "round",
|
|
89
|
+
height: "1em",
|
|
90
|
+
width: "1em",
|
|
91
|
+
"aria-hidden": true,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M7.28782 5.46243C7.80963 4.92308 8.07054 4.65341 8.37751 4.46038C8.64963 4.28926 8.94749 4.16299 9.25969 4.0864C9.61186 4 9.98709 4 10.7375 4H16.8C17.9201 4 18.4802 4 18.908 4.21799C19.2843 4.40973 19.5903 4.71569 19.782 5.09202C20 5.51984 20 6.0799 20 7.2V16.8C20 17.9201 20 18.4802 19.782 18.908C19.5903 19.2843 19.2843 19.5903 18.908 19.782C18.4802 20 17.9201 20 16.8 20H10.7512C9.99584 20 9.61818 20 9.264 19.9126C8.95004 19.8351 8.65067 19.7073 8.37748 19.5342C8.06931 19.339 7.80802 19.0663 7.28544 18.521L2.59879 13.63C2.03714 13.0439 1.75631 12.7508 1.65115 12.4158C1.55859 12.121 1.55935 11.8048 1.65332 11.5104C1.7601 11.1759 2.04233 10.8842 2.60679 10.3008L7.28782 5.46243Z" }),
|
|
94
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10.052 9L16 15M15.948 9L10 15" })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
const touchDevice = _ISJGSS4Scjs.useTouchDevice.call(void 0, ) && withinTag;
|
|
99
|
+
props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
100
|
+
id,
|
|
101
|
+
children,
|
|
102
|
+
role: touchDevice ? "button" : void 0,
|
|
103
|
+
"aria-hidden": !touchDevice,
|
|
104
|
+
"aria-label": touchDevice ? `Remove ${value}` : withinTag ? "Press Delete or Backspace to remove" : void 0
|
|
105
|
+
}, props), {
|
|
106
|
+
onClick,
|
|
107
|
+
render: withinTag ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _R6M66EKZcjs.Role.span, { render: props.render }) : props.render
|
|
108
|
+
});
|
|
109
|
+
return props;
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
var TagRemove = _NGD3IQDBcjs.forwardRef.call(void 0, function TagRemove2(props) {
|
|
113
|
+
const htmlProps = useTagRemove(props);
|
|
114
|
+
return _NGD3IQDBcjs.createElement.call(void 0, TagName, htmlProps);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
exports.TagRemove = TagRemove; exports.useTagRemove = useTagRemove;
|