@ariakit/react-core 0.4.2 → 0.4.4
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 +52 -0
- package/cjs/__chunks/{2ZW7KXDM.cjs → 4XVTH6OR.cjs} +2 -2
- package/cjs/__chunks/{33HTKI7L.cjs → 54YZYOPA.cjs} +2 -2
- package/cjs/__chunks/{DCTXNU2X.cjs → COWKMNMZ.cjs} +3 -3
- package/cjs/__chunks/{HFNM6QV4.cjs → DAOFDKV2.cjs} +1 -1
- package/cjs/__chunks/{3C4RFBCG.cjs → EYZZO5IT.cjs} +1 -1
- package/cjs/__chunks/{3MKOUH5M.cjs → HPNCFYQJ.cjs} +4 -4
- 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/{LEU3BIGC.cjs → QUHFOHHT.cjs} +36 -3
- package/cjs/__chunks/{OGH323OW.cjs → YO7LLGVA.cjs} +2 -2
- package/cjs/__chunks/{RKBJS357.cjs → YOQXFS4U.cjs} +11 -6
- package/cjs/__chunks/{3XXW4Y4D.cjs → Z2VL7JHX.cjs} +2 -2
- package/cjs/__chunks/{CWS5RZSU.cjs → ZTAE5B6W.cjs} +9 -1
- package/cjs/checkbox/checkbox-check.cjs +2 -2
- package/cjs/collection/collection-renderer.d.cts +3 -3
- package/cjs/collection/collection-renderer.d.ts +3 -3
- package/cjs/combobox/combobox-cancel.cjs +2 -2
- package/cjs/combobox/combobox-disclosure.cjs +2 -2
- package/cjs/combobox/combobox-item-check.cjs +2 -2
- package/cjs/combobox/combobox-item.cjs +4 -4
- package/cjs/combobox/combobox-popover.cjs +23 -5
- package/cjs/combobox/combobox-row.cjs +2 -2
- package/cjs/combobox/combobox.cjs +14 -11
- 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 +2 -2
- package/cjs/composite/composite-overflow-disclosure.cjs +2 -2
- package/cjs/composite/composite-overflow.cjs +3 -3
- package/cjs/composite/composite-renderer.d.cts +3 -3
- package/cjs/composite/composite-renderer.d.ts +3 -3
- package/cjs/dialog/dialog-dismiss.cjs +2 -2
- package/cjs/dialog/dialog.cjs +2 -2
- package/cjs/form/form-radio.cjs +3 -3
- package/cjs/hovercard/hovercard-disclosure.cjs +1 -1
- package/cjs/hovercard/hovercard-dismiss.cjs +4 -4
- package/cjs/hovercard/hovercard.cjs +4 -4
- 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 +3 -3
- package/cjs/menu/menu-item-radio.cjs +5 -5
- package/cjs/menu/menu-item.cjs +3 -3
- package/cjs/menu/menu.cjs +5 -5
- package/cjs/popover/popover-disclosure-arrow.cjs +2 -2
- package/cjs/popover/popover-dismiss.cjs +3 -3
- package/cjs/popover/popover.cjs +3 -3
- package/cjs/radio/radio.cjs +3 -3
- 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 +4 -4
- package/cjs/select/select.cjs +4 -4
- package/cjs/tab/tab-panel.cjs +3 -13
- package/cjs/tab/tab-provider.cjs +7 -2
- package/cjs/tab/tab-store.cjs +7 -2
- package/cjs/tab/tab-store.d.cts +22 -7
- package/cjs/tab/tab-store.d.ts +22 -7
- package/cjs/tab/tab.cjs +12 -9
- package/cjs/toolbar/toolbar-container.cjs +3 -3
- package/cjs/toolbar/toolbar-input.cjs +3 -7
- package/cjs/toolbar/toolbar-input.d.cts +3 -2
- package/cjs/toolbar/toolbar-input.d.ts +3 -2
- package/cjs/toolbar/toolbar-item.cjs +3 -3
- package/cjs/tooltip/tooltip.cjs +5 -5
- package/cjs/utils/misc.d.cts +5 -3
- package/cjs/utils/misc.d.ts +5 -3
- package/cjs/utils/types.d.cts +3 -1
- package/cjs/utils/types.d.ts +3 -1
- package/esm/__chunks/{LABIXQLW.js → 44PDY2W5.js} +1 -1
- package/esm/__chunks/{FYNSL2D5.js → 5H3YXAUC.js} +1 -1
- package/esm/__chunks/{DGR3GYOB.js → APFOINTZ.js} +12 -7
- package/esm/__chunks/{JCOBPKEI.js → BY6P32UK.js} +1 -1
- package/esm/__chunks/{QDVOJENT.js → DSUHLHLE.js} +1 -1
- package/esm/__chunks/{NN4HLGKS.js → F2RFUFO2.js} +1 -1
- package/esm/__chunks/{2VWKZYYT.js → H5N72W37.js} +1 -1
- package/esm/__chunks/{NQ4PTILT.js → IOUGWXY5.js} +9 -1
- package/esm/__chunks/{X3V2DT2U.js → LTYEFENI.js} +1 -1
- package/esm/__chunks/{H4YBNKTY.js → NFPDVAAW.js} +1 -1
- package/esm/__chunks/{DCFMDHRW.js → NHVUMSP7.js} +1 -1
- package/esm/__chunks/{RAKW656I.js → Q4PZFBSW.js} +1 -1
- package/esm/__chunks/{VGL3CETR.js → R33ISPJY.js} +37 -4
- package/esm/__chunks/{6VDNHSLX.js → XEJ23EM6.js} +2 -2
- package/esm/checkbox/checkbox-check.js +1 -1
- package/esm/collection/collection-renderer.d.ts +3 -3
- package/esm/combobox/combobox-cancel.js +2 -2
- package/esm/combobox/combobox-disclosure.js +2 -2
- package/esm/combobox/combobox-item-check.js +1 -1
- package/esm/combobox/combobox-item.js +4 -4
- package/esm/combobox/combobox-popover.js +22 -4
- package/esm/combobox/combobox-row.js +3 -3
- package/esm/combobox/combobox.d.ts +20 -0
- package/esm/combobox/combobox.js +14 -11
- package/esm/composite/composite-input.d.ts +2 -0
- package/esm/composite/composite-input.js +92 -7
- package/esm/composite/composite-item.js +1 -1
- package/esm/composite/composite-overflow-disclosure.js +1 -1
- package/esm/composite/composite-overflow.js +2 -2
- package/esm/composite/composite-renderer.d.ts +3 -3
- package/esm/dialog/dialog-dismiss.js +1 -1
- package/esm/dialog/dialog.js +1 -1
- package/esm/form/form-radio.js +2 -2
- package/esm/hovercard/hovercard-disclosure.js +1 -1
- package/esm/hovercard/hovercard-dismiss.js +3 -3
- package/esm/hovercard/hovercard.js +3 -3
- 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 +2 -2
- package/esm/menu/menu-item-radio.js +3 -3
- package/esm/menu/menu-item.js +2 -2
- package/esm/menu/menu.js +3 -3
- package/esm/popover/popover-disclosure-arrow.js +1 -1
- package/esm/popover/popover-dismiss.js +2 -2
- package/esm/popover/popover.js +2 -2
- package/esm/radio/radio.js +2 -2
- 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 +2 -2
- package/esm/select/select.js +3 -3
- package/esm/tab/tab-panel.js +4 -14
- package/esm/tab/tab-provider.js +6 -1
- package/esm/tab/tab-store.d.ts +22 -7
- package/esm/tab/tab-store.js +6 -1
- package/esm/tab/tab.js +10 -7
- package/esm/toolbar/toolbar-container.js +2 -2
- package/esm/toolbar/toolbar-input.d.ts +3 -2
- package/esm/toolbar/toolbar-input.js +2 -6
- package/esm/toolbar/toolbar-item.js +2 -2
- package/esm/tooltip/tooltip.js +3 -3
- package/esm/utils/misc.d.ts +5 -3
- package/esm/utils/types.d.ts +3 -1
- package/package.json +2 -2
- package/cjs/__chunks/WGZQRLXV.cjs +0 -84
- package/esm/__chunks/RPGNBKKU.js +0 -84
package/esm/tab/tab-store.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Core from "@ariakit/core/tab/tab-store";
|
|
2
|
+
import type { ComboboxStore } from "../combobox/combobox-store.js";
|
|
2
3
|
import type { CompositeStore, CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
4
|
import type { Store } from "../utils/store.js";
|
|
4
5
|
export declare function useTabStoreProps<T extends Core.TabStore>(store: T, update: () => void, props: TabStoreProps): T & {
|
|
@@ -11,6 +12,7 @@ export declare function useTabStoreProps<T extends Core.TabStore>(store: T, upda
|
|
|
11
12
|
};
|
|
12
13
|
} & {
|
|
13
14
|
composite: CompositeStore<import("../composite/composite-store.js").CompositeStoreItem> | null | undefined;
|
|
15
|
+
combobox: ComboboxStore<import("@ariakit/core/combobox/combobox-store").ComboboxStoreSelectedValue> | null | undefined;
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
18
|
* Creates a tab store to control the state of
|
|
@@ -33,10 +35,10 @@ export interface TabStoreItem extends Core.TabStoreItem {
|
|
|
33
35
|
}
|
|
34
36
|
export interface TabStoreState extends Core.TabStoreState, CompositeStoreState<TabStoreItem> {
|
|
35
37
|
}
|
|
36
|
-
export interface TabStoreFunctions extends Pick<TabStoreOptions, "composite">, Omit<Core.TabStoreFunctions, "panels" | "composite">, CompositeStoreFunctions<TabStoreItem> {
|
|
38
|
+
export interface TabStoreFunctions extends Pick<TabStoreOptions, "composite" | "combobox">, Omit<Core.TabStoreFunctions, "panels" | "composite" | "combobox">, CompositeStoreFunctions<TabStoreItem> {
|
|
37
39
|
panels: Store<Core.TabStoreFunctions["panels"]>;
|
|
38
40
|
}
|
|
39
|
-
export interface TabStoreOptions extends Omit<Core.TabStoreOptions, "composite">, CompositeStoreOptions<TabStoreItem> {
|
|
41
|
+
export interface TabStoreOptions extends Omit<Core.TabStoreOptions, "composite" | "combobox">, CompositeStoreOptions<TabStoreItem> {
|
|
40
42
|
/**
|
|
41
43
|
* Function that will be called when the
|
|
42
44
|
* [`selectedId`](https://ariakit.org/reference/tab-provider#selectedid) state
|
|
@@ -48,14 +50,27 @@ export interface TabStoreOptions extends Omit<Core.TabStoreOptions, "composite">
|
|
|
48
50
|
setSelectedId?: (selectedId: TabStoreState["selectedId"]) => void;
|
|
49
51
|
/**
|
|
50
52
|
* A reference to another [composite
|
|
51
|
-
* store](https://ariakit.org/reference/use-composite-store).
|
|
52
|
-
* automatically set when rendering tabs
|
|
53
|
-
* [Combobox](https://ariakit.org/components/combobox) or
|
|
53
|
+
* store](https://ariakit.org/reference/use-composite-store). This is
|
|
54
|
+
* automatically set when rendering tabs as part of another composite widget,
|
|
55
|
+
* such as [Combobox](https://ariakit.org/components/combobox) or
|
|
54
56
|
* [Select](https://ariakit.org/components/select).
|
|
57
|
+
*
|
|
58
|
+
* Live examples:
|
|
59
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
55
60
|
*/
|
|
56
61
|
composite?: CompositeStore | null;
|
|
62
|
+
/**
|
|
63
|
+
* A reference to a [combobox
|
|
64
|
+
* store](https://ariakit.org/reference/use-combobox-store). This is
|
|
65
|
+
* automatically set when rendering tabs inside a
|
|
66
|
+
* [Combobox](https://ariakit.org/components/combobox).
|
|
67
|
+
*
|
|
68
|
+
* Live examples:
|
|
69
|
+
* - [Combobox with tabs](https://ariakit.org/examples/combobox-tabs)
|
|
70
|
+
*/
|
|
71
|
+
combobox?: ComboboxStore | null;
|
|
57
72
|
}
|
|
58
|
-
export interface TabStoreProps extends TabStoreOptions, Omit<Core.TabStoreProps, "composite"> {
|
|
73
|
+
export interface TabStoreProps extends TabStoreOptions, Omit<Core.TabStoreProps, "composite" | "combobox"> {
|
|
59
74
|
}
|
|
60
|
-
export interface TabStore extends TabStoreFunctions, Omit<Store<Core.TabStore>, "panels" | "composite"> {
|
|
75
|
+
export interface TabStore extends TabStoreFunctions, Omit<Store<Core.TabStore>, "panels" | "composite" | "combobox"> {
|
|
61
76
|
}
|
package/esm/tab/tab-store.js
CHANGED
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
import {
|
|
3
3
|
useTabStore,
|
|
4
4
|
useTabStoreProps
|
|
5
|
-
} from "../__chunks/
|
|
5
|
+
} from "../__chunks/APFOINTZ.js";
|
|
6
|
+
import "../__chunks/N4X7J4OQ.js";
|
|
7
|
+
import "../__chunks/SYZHUNAU.js";
|
|
6
8
|
import "../__chunks/ZR5N62ZV.js";
|
|
7
9
|
import "../__chunks/LGWSZOP2.js";
|
|
8
10
|
import "../__chunks/QFI3MCMR.js";
|
|
9
11
|
import "../__chunks/6LTHW2TQ.js";
|
|
12
|
+
import "../__chunks/5B3U64HV.js";
|
|
13
|
+
import "../__chunks/IWHI6Y45.js";
|
|
14
|
+
import "../__chunks/RG6J4TID.js";
|
|
10
15
|
import "../__chunks/GUCZNEAD.js";
|
|
11
16
|
import "../__chunks/PWUXK5IM.js";
|
|
12
17
|
import "../__chunks/WOWUAP42.js";
|
package/esm/tab/tab.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CompositeItem,
|
|
4
4
|
useCompositeItem
|
|
5
|
-
} from "../__chunks/
|
|
5
|
+
} from "../__chunks/R33ISPJY.js";
|
|
6
6
|
import "../__chunks/PJ7ERAIM.js";
|
|
7
7
|
import "../__chunks/IFMAUEA7.js";
|
|
8
8
|
import {
|
|
@@ -86,14 +86,17 @@ var useTab = createHook(function useTab2(_a) {
|
|
|
86
86
|
(element) => {
|
|
87
87
|
if (!(store == null ? void 0 : store.composite))
|
|
88
88
|
return element;
|
|
89
|
+
const defaultProps = {
|
|
90
|
+
id,
|
|
91
|
+
store: store.composite,
|
|
92
|
+
shouldRegisterItem: selected && shouldRegisterItem,
|
|
93
|
+
render: element
|
|
94
|
+
};
|
|
89
95
|
return /* @__PURE__ */ jsx(
|
|
90
96
|
CompositeItem,
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
store: store.composite,
|
|
95
|
-
shouldRegisterItem: selected && shouldRegisterItem
|
|
96
|
-
}
|
|
97
|
+
__spreadProps(__spreadValues({}, defaultProps), {
|
|
98
|
+
render: store.combobox && store.composite !== store.combobox ? /* @__PURE__ */ jsx(CompositeItem, __spreadProps(__spreadValues({}, defaultProps), { store: store.combobox })) : element
|
|
99
|
+
})
|
|
97
100
|
);
|
|
98
101
|
},
|
|
99
102
|
[store, id, selected, shouldRegisterItem]
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../__chunks/LQCUPYIB.js";
|
|
5
5
|
import {
|
|
6
6
|
useToolbarItem
|
|
7
|
-
} from "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
7
|
+
} from "../__chunks/NHVUMSP7.js";
|
|
8
|
+
import "../__chunks/R33ISPJY.js";
|
|
9
9
|
import "../__chunks/PJ7ERAIM.js";
|
|
10
10
|
import "../__chunks/IFMAUEA7.js";
|
|
11
11
|
import "../__chunks/3IEDWLST.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ElementType } from "react";
|
|
2
|
-
import type { CompositeInputOptions } from "../composite/composite-input.js";
|
|
3
2
|
import type { Props } from "../utils/types.js";
|
|
4
3
|
import type { ToolbarItemOptions } from "./toolbar-item.js";
|
|
5
4
|
declare const TagName = "input";
|
|
@@ -7,6 +6,7 @@ type TagName = typeof TagName;
|
|
|
7
6
|
/**
|
|
8
7
|
* Returns props to create a `ToolbarInput` component.
|
|
9
8
|
* @see https://ariakit.org/components/toolbar
|
|
9
|
+
* @deprecated Use `useToolbarItem` instead.
|
|
10
10
|
* @example
|
|
11
11
|
* ```jsx
|
|
12
12
|
* const store = useToolbarStore();
|
|
@@ -21,6 +21,7 @@ export declare const useToolbarInput: import("../utils/types.js").Hook<"input",
|
|
|
21
21
|
* Renders a text input as a toolbar item, maintaining arrow key navigation on
|
|
22
22
|
* the toolbar.
|
|
23
23
|
* @see https://ariakit.org/components/toolbar
|
|
24
|
+
* @deprecated Use `<ToolbarItem render={<input />}>` instead.
|
|
24
25
|
* @example
|
|
25
26
|
* ```jsx {2}
|
|
26
27
|
* <Toolbar>
|
|
@@ -29,7 +30,7 @@ export declare const useToolbarInput: import("../utils/types.js").Hook<"input",
|
|
|
29
30
|
* ```
|
|
30
31
|
*/
|
|
31
32
|
export declare const ToolbarInput: (props: ToolbarInputProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
32
|
-
export interface ToolbarInputOptions<T extends ElementType = TagName> extends ToolbarItemOptions<T
|
|
33
|
+
export interface ToolbarInputOptions<T extends ElementType = TagName> extends ToolbarItemOptions<T> {
|
|
33
34
|
}
|
|
34
35
|
export type ToolbarInputProps<T extends ElementType = TagName> = Props<T, ToolbarInputOptions<T>>;
|
|
35
36
|
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
useCompositeInput
|
|
4
|
-
} from "../__chunks/RPGNBKKU.js";
|
|
5
2
|
import {
|
|
6
3
|
useToolbarItem
|
|
7
|
-
} from "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/NHVUMSP7.js";
|
|
5
|
+
import "../__chunks/R33ISPJY.js";
|
|
9
6
|
import "../__chunks/PJ7ERAIM.js";
|
|
10
7
|
import "../__chunks/IFMAUEA7.js";
|
|
11
8
|
import "../__chunks/3IEDWLST.js";
|
|
@@ -37,7 +34,6 @@ var useToolbarInput = createHook(
|
|
|
37
34
|
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
|
|
38
35
|
const context = useToolbarContext();
|
|
39
36
|
store = store || context;
|
|
40
|
-
props = useCompositeInput(__spreadValues({ store }, props));
|
|
41
37
|
props = useToolbarItem(__spreadValues({ store }, props));
|
|
42
38
|
return props;
|
|
43
39
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ToolbarItem,
|
|
4
4
|
useToolbarItem
|
|
5
|
-
} from "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
5
|
+
} from "../__chunks/NHVUMSP7.js";
|
|
6
|
+
import "../__chunks/R33ISPJY.js";
|
|
7
7
|
import "../__chunks/PJ7ERAIM.js";
|
|
8
8
|
import "../__chunks/IFMAUEA7.js";
|
|
9
9
|
import "../__chunks/3IEDWLST.js";
|
package/esm/tooltip/tooltip.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
useHovercard
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/XEJ23EM6.js";
|
|
5
5
|
import "../__chunks/YMV43K4F.js";
|
|
6
|
-
import "../__chunks/
|
|
6
|
+
import "../__chunks/LTYEFENI.js";
|
|
7
7
|
import {
|
|
8
8
|
createDialogComponent
|
|
9
|
-
} from "../__chunks/
|
|
9
|
+
} from "../__chunks/IOUGWXY5.js";
|
|
10
10
|
import "../__chunks/GOXKZAQI.js";
|
|
11
11
|
import "../__chunks/6GXEOXGT.js";
|
|
12
12
|
import "../__chunks/PTPUIM7N.js";
|
package/esm/utils/misc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HTMLAttributes, MutableRefObject, ReactElement,
|
|
1
|
+
import type { HTMLAttributes, MutableRefObject, ReactElement, Ref, RefCallback } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* Sets both a function and object React ref.
|
|
4
4
|
*/
|
|
@@ -6,11 +6,13 @@ export declare function setRef<T>(ref: RefCallback<T> | MutableRefObject<T> | nu
|
|
|
6
6
|
/**
|
|
7
7
|
* Checks if an element is a valid React element with a ref.
|
|
8
8
|
*/
|
|
9
|
-
export declare function isValidElementWithRef<P>(element: unknown): element is ReactElement<P> &
|
|
9
|
+
export declare function isValidElementWithRef<P>(element: unknown): element is ReactElement<P> & {
|
|
10
|
+
ref?: Ref<any>;
|
|
11
|
+
};
|
|
10
12
|
/**
|
|
11
13
|
* Gets the ref property from a React element.
|
|
12
14
|
*/
|
|
13
|
-
export declare function getRefProperty(element: unknown):
|
|
15
|
+
export declare function getRefProperty(element: unknown): Ref<any> | undefined;
|
|
14
16
|
/**
|
|
15
17
|
* Merges two sets of props.
|
|
16
18
|
*/
|
package/esm/utils/types.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ import type { AnyObject, EmptyObject } from "@ariakit/core/utils/types";
|
|
|
6
6
|
* @example
|
|
7
7
|
* const children: RenderProp = (props) => <div {...props} />;
|
|
8
8
|
*/
|
|
9
|
-
export type RenderProp<P = React.HTMLAttributes<any> &
|
|
9
|
+
export type RenderProp<P = React.HTMLAttributes<any> & {
|
|
10
|
+
ref?: React.Ref<any>;
|
|
11
|
+
}> = (props: P) => React.ReactNode;
|
|
10
12
|
/**
|
|
11
13
|
* The `wrapElement` prop.
|
|
12
14
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ariakit/react-core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Ariakit React core",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"core"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@ariakit/core": "0.4.
|
|
33
|
+
"@ariakit/core": "0.4.4",
|
|
34
34
|
"@floating-ui/dom": "^1.0.0",
|
|
35
35
|
"use-sync-external-store": "^1.2.0"
|
|
36
36
|
},
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _6ZZYUFPWcjs = require('./6ZZYUFPW.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _NGD3IQDBcjs = require('./NGD3IQDB.cjs');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _TW3SFX4Ccjs = require('./TW3SFX4C.cjs');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
19
|
-
|
|
20
|
-
// src/composite/composite-input.ts
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var _dom = require('@ariakit/core/utils/dom');
|
|
26
|
-
var _misc = require('@ariakit/core/utils/misc');
|
|
27
|
-
var TagName = "input";
|
|
28
|
-
function getValueLength(element) {
|
|
29
|
-
if (_dom.isTextField.call(void 0, element)) {
|
|
30
|
-
return element.value.length;
|
|
31
|
-
} else if (element.isContentEditable) {
|
|
32
|
-
const range = _dom.getDocument.call(void 0, element).createRange();
|
|
33
|
-
range.selectNodeContents(element);
|
|
34
|
-
return range.toString().length;
|
|
35
|
-
}
|
|
36
|
-
return 0;
|
|
37
|
-
}
|
|
38
|
-
var useCompositeInput = _NGD3IQDBcjs.createHook.call(void 0,
|
|
39
|
-
function useCompositeInput2(_a) {
|
|
40
|
-
var _b = _a, { store } = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, ["store"]);
|
|
41
|
-
const onKeyDownCaptureProp = props.onKeyDownCapture;
|
|
42
|
-
const onKeyDownCapture = _TW3SFX4Ccjs.useEvent.call(void 0, (event) => {
|
|
43
|
-
onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
|
|
44
|
-
if (event.defaultPrevented)
|
|
45
|
-
return;
|
|
46
|
-
const element = event.currentTarget;
|
|
47
|
-
if (!element.isContentEditable && !_dom.isTextField.call(void 0, element))
|
|
48
|
-
return;
|
|
49
|
-
const selection = _dom.getTextboxSelection.call(void 0, element);
|
|
50
|
-
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
51
|
-
if (selection.end !== getValueLength(element)) {
|
|
52
|
-
event.stopPropagation();
|
|
53
|
-
}
|
|
54
|
-
} else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
55
|
-
if (selection.start !== 0) {
|
|
56
|
-
event.stopPropagation();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
const onFocusProp = props.onFocus;
|
|
61
|
-
const onFocus = _TW3SFX4Ccjs.useEvent.call(void 0, (event) => {
|
|
62
|
-
onFocusProp == null ? void 0 : onFocusProp(event);
|
|
63
|
-
if (event.defaultPrevented)
|
|
64
|
-
return;
|
|
65
|
-
_6ZZYUFPWcjs.selectTextField.call(void 0, event.currentTarget);
|
|
66
|
-
});
|
|
67
|
-
props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
68
|
-
onKeyDownCapture,
|
|
69
|
-
onFocus
|
|
70
|
-
});
|
|
71
|
-
return _misc.removeUndefinedValues.call(void 0, props);
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
var CompositeInput = _NGD3IQDBcjs.memo.call(void 0,
|
|
75
|
-
_NGD3IQDBcjs.forwardRef.call(void 0, function CompositeInput2(props) {
|
|
76
|
-
const htmlProps = useCompositeInput(props);
|
|
77
|
-
return _NGD3IQDBcjs.createElement.call(void 0, TagName, htmlProps);
|
|
78
|
-
})
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
exports.useCompositeInput = useCompositeInput; exports.CompositeInput = CompositeInput;
|
package/esm/__chunks/RPGNBKKU.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
selectTextField
|
|
4
|
-
} from "./3IEDWLST.js";
|
|
5
|
-
import {
|
|
6
|
-
createElement,
|
|
7
|
-
createHook,
|
|
8
|
-
forwardRef,
|
|
9
|
-
memo
|
|
10
|
-
} from "./GUCZNEAD.js";
|
|
11
|
-
import {
|
|
12
|
-
useEvent
|
|
13
|
-
} from "./WOWUAP42.js";
|
|
14
|
-
import {
|
|
15
|
-
__objRest,
|
|
16
|
-
__spreadProps,
|
|
17
|
-
__spreadValues
|
|
18
|
-
} from "./4R3V3JGP.js";
|
|
19
|
-
|
|
20
|
-
// src/composite/composite-input.ts
|
|
21
|
-
import {
|
|
22
|
-
getDocument,
|
|
23
|
-
getTextboxSelection,
|
|
24
|
-
isTextField
|
|
25
|
-
} from "@ariakit/core/utils/dom";
|
|
26
|
-
import { removeUndefinedValues } from "@ariakit/core/utils/misc";
|
|
27
|
-
var TagName = "input";
|
|
28
|
-
function getValueLength(element) {
|
|
29
|
-
if (isTextField(element)) {
|
|
30
|
-
return element.value.length;
|
|
31
|
-
} else if (element.isContentEditable) {
|
|
32
|
-
const range = getDocument(element).createRange();
|
|
33
|
-
range.selectNodeContents(element);
|
|
34
|
-
return range.toString().length;
|
|
35
|
-
}
|
|
36
|
-
return 0;
|
|
37
|
-
}
|
|
38
|
-
var useCompositeInput = createHook(
|
|
39
|
-
function useCompositeInput2(_a) {
|
|
40
|
-
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
|
|
41
|
-
const onKeyDownCaptureProp = props.onKeyDownCapture;
|
|
42
|
-
const onKeyDownCapture = useEvent((event) => {
|
|
43
|
-
onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
|
|
44
|
-
if (event.defaultPrevented)
|
|
45
|
-
return;
|
|
46
|
-
const element = event.currentTarget;
|
|
47
|
-
if (!element.isContentEditable && !isTextField(element))
|
|
48
|
-
return;
|
|
49
|
-
const selection = getTextboxSelection(element);
|
|
50
|
-
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
51
|
-
if (selection.end !== getValueLength(element)) {
|
|
52
|
-
event.stopPropagation();
|
|
53
|
-
}
|
|
54
|
-
} else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
55
|
-
if (selection.start !== 0) {
|
|
56
|
-
event.stopPropagation();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
const onFocusProp = props.onFocus;
|
|
61
|
-
const onFocus = useEvent((event) => {
|
|
62
|
-
onFocusProp == null ? void 0 : onFocusProp(event);
|
|
63
|
-
if (event.defaultPrevented)
|
|
64
|
-
return;
|
|
65
|
-
selectTextField(event.currentTarget);
|
|
66
|
-
});
|
|
67
|
-
props = __spreadProps(__spreadValues({}, props), {
|
|
68
|
-
onKeyDownCapture,
|
|
69
|
-
onFocus
|
|
70
|
-
});
|
|
71
|
-
return removeUndefinedValues(props);
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
var CompositeInput = memo(
|
|
75
|
-
forwardRef(function CompositeInput2(props) {
|
|
76
|
-
const htmlProps = useCompositeInput(props);
|
|
77
|
-
return createElement(TagName, htmlProps);
|
|
78
|
-
})
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
export {
|
|
82
|
-
useCompositeInput,
|
|
83
|
-
CompositeInput
|
|
84
|
-
};
|