@ariakit/core 0.3.3 → 0.3.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 +12 -0
- package/cjs/__chunks/{W5IQT6Z2.cjs → 25WWT2VO.cjs} +17 -16
- package/cjs/__chunks/{EXM2AW52.cjs → FTB5CXVB.cjs} +3 -1
- package/cjs/__chunks/{EIRIJC7T.cjs → G5EW4WED.cjs} +8 -7
- package/cjs/__chunks/{RCYVACJO.cjs → LMT335NJ.cjs} +9 -4
- package/cjs/__chunks/LUOEAZGU.cjs +42 -0
- package/cjs/__chunks/{TTWS4MDC.cjs → M44E4T5A.cjs} +30 -29
- package/cjs/__chunks/{DFFIYGBS.cjs → MLPOXRDT.cjs} +4 -3
- package/cjs/__chunks/{A4GDJCZB.cjs → OASSVCYR.cjs} +18 -17
- package/cjs/__chunks/{ZYIEFAMB.cjs → ROX3MRGO.cjs} +18 -17
- package/cjs/__chunks/{GDZQUFNP.cjs → ULSPM3Y3.cjs} +3 -1
- package/cjs/__chunks/{72I2GWXF.cjs → WYXAWBLE.cjs} +2 -1
- package/cjs/__chunks/{A7K3KZJL.cjs → YXSGST3H.cjs} +20 -19
- package/cjs/checkbox/checkbox-store.cjs +9 -8
- package/cjs/checkbox/checkbox-store.d.cts +41 -0
- package/cjs/collection/collection-store.cjs +8 -7
- package/cjs/collection/collection-store.d.cts +65 -0
- package/cjs/combobox/combobox-store.cjs +37 -36
- package/cjs/combobox/combobox-store.d.cts +77 -0
- package/cjs/composite/composite-overflow-store.cjs +9 -8
- package/cjs/composite/composite-overflow-store.d.cts +10 -0
- package/cjs/composite/composite-store.cjs +10 -9
- package/cjs/composite/composite-store.d.cts +206 -0
- package/cjs/dialog/dialog-store.cjs +8 -7
- package/cjs/dialog/dialog-store.d.cts +10 -0
- package/cjs/disclosure/disclosure-store.cjs +7 -6
- package/cjs/disclosure/disclosure-store.d.cts +125 -0
- package/cjs/form/form-store.cjs +30 -29
- package/cjs/form/form-store.d.cts +236 -0
- package/cjs/form/types.cjs +1 -1
- package/cjs/form/types.d.cts +38 -0
- package/cjs/hovercard/hovercard-store.cjs +10 -9
- package/cjs/hovercard/hovercard-store.d.cts +46 -0
- package/cjs/index.cjs +2 -1
- package/cjs/index.d.cts +2 -0
- package/cjs/menu/menu-bar-store.cjs +12 -11
- package/cjs/menu/menu-bar-store.d.cts +10 -0
- package/cjs/menu/menu-store.cjs +35 -34
- package/cjs/menu/menu-store.d.cts +78 -0
- package/cjs/popover/popover-store.cjs +9 -8
- package/cjs/popover/popover-store.d.cts +69 -0
- package/cjs/radio/radio-store.cjs +16 -15
- package/cjs/radio/radio-store.d.cts +36 -0
- package/cjs/select/select-store.cjs +37 -36
- package/cjs/select/select-store.d.cts +93 -0
- package/cjs/tab/tab-store.cjs +28 -27
- package/cjs/tab/tab-store.d.cts +87 -0
- package/cjs/toolbar/toolbar-store.cjs +12 -11
- package/cjs/toolbar/toolbar-store.d.cts +21 -0
- package/cjs/tooltip/tooltip-store.cjs +17 -16
- package/cjs/tooltip/tooltip-store.d.cts +29 -0
- package/cjs/utils/array.cjs +5 -4
- package/cjs/utils/array.d.cts +29 -0
- package/cjs/utils/dom.cjs +5 -4
- package/cjs/utils/dom.d.cts +105 -0
- package/cjs/utils/events.cjs +10 -9
- package/cjs/utils/events.d.cts +70 -0
- package/cjs/utils/focus.cjs +17 -16
- package/cjs/utils/focus.d.cts +117 -0
- package/cjs/utils/misc.cjs +7 -4
- package/cjs/utils/misc.d.cts +124 -0
- package/cjs/utils/misc.d.ts +7 -0
- package/cjs/utils/platform.cjs +6 -5
- package/cjs/utils/platform.d.cts +20 -0
- package/cjs/utils/store.cjs +6 -5
- package/cjs/utils/store.d.cts +71 -0
- package/cjs/utils/types.cjs +1 -1
- package/cjs/utils/types.d.cts +74 -0
- package/esm/__chunks/{PNRLI7OV.js → 2SMRF6AD.js} +1 -0
- package/esm/__chunks/{UCFCIHEU.js → 5UJPJ37G.js} +2 -1
- package/esm/__chunks/{5XEKIOCW.js → 7PRQYBBV.js} +2 -0
- package/esm/__chunks/{WVTCK5PV.js → D23ES3Z4.js} +6 -1
- package/esm/__chunks/{E6THWJ7N.js → FGW7QUD2.js} +6 -5
- package/esm/__chunks/{Y5SJEQQJ.js → GME4NYXR.js} +3 -2
- package/esm/__chunks/{HN27WCTM.js → I7YGHQ4Z.js} +2 -1
- package/esm/__chunks/{L4QLJSLG.js → LWQU4J4N.js} +5 -4
- package/esm/__chunks/{O35LWD4W.js → NIF7E7VE.js} +2 -0
- package/esm/__chunks/{C57Q2UMF.js → Q332EHXG.js} +5 -4
- package/esm/__chunks/{A2MHRHOV.js → TEJLMP2M.js} +4 -3
- package/esm/__chunks/{JLNC5RR2.js → VEWADM34.js} +5 -4
- package/esm/checkbox/checkbox-store.js +4 -3
- package/esm/collection/collection-store.js +6 -5
- package/esm/combobox/combobox-store.js +12 -11
- package/esm/composite/composite-overflow-store.js +7 -6
- package/esm/composite/composite-store.js +8 -7
- package/esm/dialog/dialog-store.js +6 -5
- package/esm/disclosure/disclosure-store.js +5 -4
- package/esm/form/form-store.js +6 -5
- package/esm/form/types.js +1 -0
- package/esm/hovercard/hovercard-store.js +8 -7
- package/esm/index.js +2 -1
- package/esm/menu/menu-bar-store.js +8 -7
- package/esm/menu/menu-store.js +12 -11
- package/esm/popover/popover-store.js +7 -6
- package/esm/radio/radio-store.js +8 -7
- package/esm/select/select-store.js +11 -10
- package/esm/tab/tab-store.js +8 -7
- package/esm/toolbar/toolbar-store.js +8 -7
- package/esm/tooltip/tooltip-store.js +8 -7
- package/esm/utils/array.js +3 -2
- package/esm/utils/dom.js +3 -2
- package/esm/utils/events.js +4 -3
- package/esm/utils/focus.js +3 -2
- package/esm/utils/misc.d.ts +7 -0
- package/esm/utils/misc.js +5 -2
- package/esm/utils/platform.js +4 -3
- package/esm/utils/store.js +4 -3
- package/esm/utils/types.js +1 -0
- package/package.json +109 -28
- package/cjs/__chunks/NEBQQIUX.cjs +0 -41
- package/cjs/tsconfig.build.tsbuildinfo +0 -1
- package/esm/tsconfig.build.tsbuildinfo +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether `element` is focusable or not.
|
|
3
|
+
* @example
|
|
4
|
+
* isFocusable(document.querySelector("input")); // true
|
|
5
|
+
* isFocusable(document.querySelector("input[tabindex='-1']")); // true
|
|
6
|
+
* isFocusable(document.querySelector("input[hidden]")); // false
|
|
7
|
+
* isFocusable(document.querySelector("input:disabled")); // false
|
|
8
|
+
*/
|
|
9
|
+
export declare function isFocusable(element: Element): element is HTMLElement;
|
|
10
|
+
/**
|
|
11
|
+
* Checks whether `element` is tabbable or not.
|
|
12
|
+
* @example
|
|
13
|
+
* isTabbable(document.querySelector("input")); // true
|
|
14
|
+
* isTabbable(document.querySelector("input[tabindex='-1']")); // false
|
|
15
|
+
* isTabbable(document.querySelector("input[hidden]")); // false
|
|
16
|
+
* isTabbable(document.querySelector("input:disabled")); // false
|
|
17
|
+
*/
|
|
18
|
+
export declare function isTabbable(element: Element | HTMLElement | HTMLInputElement): element is HTMLElement;
|
|
19
|
+
/**
|
|
20
|
+
* Returns all the focusable elements in `container`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAllFocusableIn(container: HTMLElement, includeContainer?: boolean): HTMLElement[];
|
|
23
|
+
/**
|
|
24
|
+
* Returns all the focusable elements in the document.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getAllFocusable(includeBody?: boolean): HTMLElement[];
|
|
27
|
+
/**
|
|
28
|
+
* Returns the first focusable element in `container`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getFirstFocusableIn(container: HTMLElement, includeContainer?: boolean): HTMLElement | null;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the first focusable element in the document.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getFirstFocusable(includeBody?: boolean): HTMLElement | null;
|
|
35
|
+
/**
|
|
36
|
+
* Returns all the tabbable elements in `container`, including the container
|
|
37
|
+
* itself.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getAllTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFocusable?: boolean): HTMLElement[];
|
|
40
|
+
/**
|
|
41
|
+
* Returns all the tabbable elements in the document.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAllTabbable(fallbackToFocusable?: boolean): HTMLElement[];
|
|
44
|
+
/**
|
|
45
|
+
* Returns the first tabbable element in `container`, including the container
|
|
46
|
+
* itself if it's tabbable.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getFirstTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the first tabbable element in the document.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getFirstTabbable(fallbackToFocusable?: boolean): HTMLElement | null;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the last tabbable element in `container`, including the container
|
|
55
|
+
* itself if it's tabbable.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getLastTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the last tabbable element in the document.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getLastTabbable(fallbackToFocusable?: boolean): HTMLElement | null;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the next tabbable element in `container`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function getNextTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToFirst?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
|
|
66
|
+
/**
|
|
67
|
+
* Returns the next tabbable element in the document.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getNextTabbable(fallbackToFirst?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the previous tabbable element in `container`.
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
export declare function getPreviousTabbableIn(container: HTMLElement, includeContainer?: boolean, fallbackToLast?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the previous tabbable element in the document.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getPreviousTabbable(fallbackToFirst?: boolean, fallbackToFocusable?: boolean): HTMLElement | null;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the closest focusable element.
|
|
81
|
+
*/
|
|
82
|
+
export declare function getClosestFocusable(element?: HTMLElement | null): HTMLElement | null;
|
|
83
|
+
/**
|
|
84
|
+
* Checks if `element` has focus. Elements that are referenced by
|
|
85
|
+
* `aria-activedescendant` are also considered.
|
|
86
|
+
* @example
|
|
87
|
+
* hasFocus(document.getElementById("id"));
|
|
88
|
+
*/
|
|
89
|
+
export declare function hasFocus(element: Element): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Checks if `element` has focus within. Elements that are referenced by
|
|
92
|
+
* `aria-activedescendant` are also considered.
|
|
93
|
+
* @example
|
|
94
|
+
* hasFocusWithin(document.getElementById("id"));
|
|
95
|
+
*/
|
|
96
|
+
export declare function hasFocusWithin(element: Node | Element): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Focus on an element only if it's not already focused.
|
|
99
|
+
*/
|
|
100
|
+
export declare function focusIfNeeded(element: HTMLElement): void;
|
|
101
|
+
/**
|
|
102
|
+
* Disable focus on `element`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function disableFocus(element: HTMLElement): void;
|
|
105
|
+
/**
|
|
106
|
+
* Makes elements inside container not tabbable.
|
|
107
|
+
*/
|
|
108
|
+
export declare function disableFocusIn(container: HTMLElement, includeContainer?: boolean): void;
|
|
109
|
+
/**
|
|
110
|
+
* Restores tabbable elements inside container that were affected by
|
|
111
|
+
* disableFocusIn.
|
|
112
|
+
*/
|
|
113
|
+
export declare function restoreFocusIn(container: HTMLElement): void;
|
|
114
|
+
/**
|
|
115
|
+
* Focus on element and scroll into view.
|
|
116
|
+
*/
|
|
117
|
+
export declare function focusIntoView(element: HTMLElement, options?: ScrollIntoViewOptions): void;
|
package/cjs/utils/misc.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
22
|
-
require('../__chunks/72I2GWXF.cjs');
|
|
23
21
|
|
|
24
22
|
|
|
23
|
+
var _LMT335NJcjs = require('../__chunks/LMT335NJ.cjs');
|
|
24
|
+
require('../__chunks/WYXAWBLE.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -40,4 +40,7 @@ require('../__chunks/72I2GWXF.cjs');
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
exports.afterPaint = _LMT335NJcjs.afterPaint; exports.applyState = _LMT335NJcjs.applyState; exports.beforePaint = _LMT335NJcjs.beforePaint; exports.chain = _LMT335NJcjs.chain; exports.cx = _LMT335NJcjs.cx; exports.defaultValue = _LMT335NJcjs.defaultValue; exports.disabledFromProps = _LMT335NJcjs.disabledFromProps; exports.getKeys = _LMT335NJcjs.getKeys; exports.hasOwnProperty = _LMT335NJcjs.hasOwnProperty; exports.identity = _LMT335NJcjs.identity; exports.invariant = _LMT335NJcjs.invariant; exports.isEmpty = _LMT335NJcjs.isEmpty; exports.isFalsyBooleanCallback = _LMT335NJcjs.isFalsyBooleanCallback; exports.isInteger = _LMT335NJcjs.isInteger; exports.isObject = _LMT335NJcjs.isObject; exports.noop = _LMT335NJcjs.noop; exports.normalizeString = _LMT335NJcjs.normalizeString; exports.omit = _LMT335NJcjs.omit; exports.pick = _LMT335NJcjs.pick; exports.shallowEqual = _LMT335NJcjs.shallowEqual;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { AnyFunction, AnyObject, SetStateAction } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Empty function.
|
|
4
|
+
*/
|
|
5
|
+
export declare function noop(..._: any[]): any;
|
|
6
|
+
/**
|
|
7
|
+
* Compares two objects.
|
|
8
|
+
* @example
|
|
9
|
+
* shallowEqual({ a: "a" }, {}); // false
|
|
10
|
+
* shallowEqual({ a: "a" }, { b: "b" }); // false
|
|
11
|
+
* shallowEqual({ a: "a" }, { a: "a" }); // true
|
|
12
|
+
* shallowEqual({ a: "a" }, { a: "a", b: "b" }); // false
|
|
13
|
+
*/
|
|
14
|
+
export declare function shallowEqual(a?: AnyObject, b?: AnyObject): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Receives a `setState` argument and calls it with `currentValue` if it's a
|
|
17
|
+
* function. Otherwise return the argument as the new value.
|
|
18
|
+
* @example
|
|
19
|
+
* applyState((value) => value + 1, 1); // 2
|
|
20
|
+
* applyState(2, 1); // 2
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyState<T>(argument: SetStateAction<T>, currentValue: T | (() => T)): T;
|
|
23
|
+
/**
|
|
24
|
+
* Checks whether `arg` is an object or not.
|
|
25
|
+
* @returns {boolean}
|
|
26
|
+
*/
|
|
27
|
+
export declare function isObject(arg: any): arg is Record<any, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* Checks whether `arg` is empty or not.
|
|
30
|
+
* @example
|
|
31
|
+
* isEmpty([]); // true
|
|
32
|
+
* isEmpty(["a"]); // false
|
|
33
|
+
* isEmpty({}); // true
|
|
34
|
+
* isEmpty({ a: "a" }); // false
|
|
35
|
+
* isEmpty(); // true
|
|
36
|
+
* isEmpty(null); // true
|
|
37
|
+
* isEmpty(undefined); // true
|
|
38
|
+
* isEmpty(""); // true
|
|
39
|
+
*/
|
|
40
|
+
export declare function isEmpty(arg: any): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Checks whether `arg` is an integer or not.
|
|
43
|
+
* @example
|
|
44
|
+
* isInteger(1); // true
|
|
45
|
+
* isInteger(1.5); // false
|
|
46
|
+
* isInteger("1"); // true
|
|
47
|
+
* isInteger("1.5"); // false
|
|
48
|
+
*/
|
|
49
|
+
export declare function isInteger(arg: any): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Checks whether `prop` is an own property of `obj` or not.
|
|
52
|
+
*/
|
|
53
|
+
export declare function hasOwnProperty<T extends AnyObject>(object: T, prop: keyof any): prop is keyof T;
|
|
54
|
+
/**
|
|
55
|
+
* Receives functions as arguments and returns a new function that calls all.
|
|
56
|
+
*/
|
|
57
|
+
export declare function chain<T>(...fns: T[]): (...args: T extends AnyFunction ? Parameters<T> : never) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Returns a string with the truthy values of `args` separated by space.
|
|
60
|
+
*/
|
|
61
|
+
export declare function cx(...args: Array<string | null | false | 0 | undefined>): string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Removes diatrics from a string.
|
|
64
|
+
*/
|
|
65
|
+
export declare function normalizeString(str: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Omits specific keys from an object.
|
|
68
|
+
* @example
|
|
69
|
+
* omit({ a: "a", b: "b" }, ["a"]); // { b: "b" }
|
|
70
|
+
*/
|
|
71
|
+
export declare function omit<T extends AnyObject, K extends keyof T>(object: T, keys: ReadonlyArray<K> | K[]): Omit<T, K>;
|
|
72
|
+
/**
|
|
73
|
+
* Picks specific keys from an object.
|
|
74
|
+
* @example
|
|
75
|
+
* pick({ a: "a", b: "b" }, ["a"]); // { a: "a" }
|
|
76
|
+
*/
|
|
77
|
+
export declare function pick<T extends AnyObject, K extends keyof T>(object: T, paths: ReadonlyArray<K> | K[]): Pick<T, K>;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the same argument.
|
|
80
|
+
*/
|
|
81
|
+
export declare function identity<T>(value: T): T;
|
|
82
|
+
/**
|
|
83
|
+
* Runs right before the next paint.
|
|
84
|
+
*/
|
|
85
|
+
export declare function beforePaint(cb?: () => void): () => void;
|
|
86
|
+
/**
|
|
87
|
+
* Runs after the next paint.
|
|
88
|
+
*/
|
|
89
|
+
export declare function afterPaint(cb?: () => void): () => void;
|
|
90
|
+
/**
|
|
91
|
+
* Asserts that a condition is true, otherwise throws an error.
|
|
92
|
+
* @example
|
|
93
|
+
* invariant(
|
|
94
|
+
* condition,
|
|
95
|
+
* process.env.NODE_ENV !== "production" && "Invariant failed"
|
|
96
|
+
* );
|
|
97
|
+
*/
|
|
98
|
+
export declare function invariant(condition: any, message?: string | boolean): asserts condition;
|
|
99
|
+
/**
|
|
100
|
+
* Similar to `Object.keys` but returns a type-safe array of keys.
|
|
101
|
+
*/
|
|
102
|
+
export declare function getKeys<T extends object>(obj: T): (keyof T)[];
|
|
103
|
+
/**
|
|
104
|
+
* Checks whether a boolean event prop (e.g., hideOnInteractOutside) was
|
|
105
|
+
* intentionally set to false, either with a boolean value or a callback that
|
|
106
|
+
* returns false.
|
|
107
|
+
*/
|
|
108
|
+
export declare function isFalsyBooleanCallback<T extends unknown[]>(booleanOrCallback?: boolean | ((...args: T) => boolean), ...args: T): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Checks whether something is disabled or not based on its props.
|
|
111
|
+
*/
|
|
112
|
+
export declare function disabledFromProps(props: {
|
|
113
|
+
disabled?: boolean;
|
|
114
|
+
"aria-disabled"?: boolean | "true" | "false";
|
|
115
|
+
}): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Returns the first value that is not `undefined`.
|
|
118
|
+
*/
|
|
119
|
+
export declare function defaultValue<T extends readonly any[]>(...values: T): DefaultValue<T>;
|
|
120
|
+
type DefinedArray<T extends readonly any[]> = {
|
|
121
|
+
[K in keyof T as undefined extends T[K] ? never : K]: undefined extends T[K] ? [Exclude<T[K], undefined>, never] : [T[K]];
|
|
122
|
+
};
|
|
123
|
+
type DefaultValue<T extends readonly any[]> = DefinedArray<T>[keyof DefinedArray<T>] extends [any, never] ? T[number] : DefinedArray<T>[keyof DefinedArray<T>][0];
|
|
124
|
+
export {};
|
package/cjs/utils/misc.d.ts
CHANGED
|
@@ -106,6 +106,13 @@ export declare function getKeys<T extends object>(obj: T): (keyof T)[];
|
|
|
106
106
|
* returns false.
|
|
107
107
|
*/
|
|
108
108
|
export declare function isFalsyBooleanCallback<T extends unknown[]>(booleanOrCallback?: boolean | ((...args: T) => boolean), ...args: T): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Checks whether something is disabled or not based on its props.
|
|
111
|
+
*/
|
|
112
|
+
export declare function disabledFromProps(props: {
|
|
113
|
+
disabled?: boolean;
|
|
114
|
+
"aria-disabled"?: boolean | "true" | "false";
|
|
115
|
+
}): boolean;
|
|
109
116
|
/**
|
|
110
117
|
* Returns the first value that is not `undefined`.
|
|
111
118
|
*/
|
package/cjs/utils/platform.cjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var _EIRIJC7Tcjs = require('../__chunks/EIRIJC7T.cjs');
|
|
8
|
-
require('../__chunks/EXM2AW52.cjs');
|
|
9
|
-
require('../__chunks/72I2GWXF.cjs');
|
|
10
7
|
|
|
8
|
+
var _G5EW4WEDcjs = require('../__chunks/G5EW4WED.cjs');
|
|
9
|
+
require('../__chunks/FTB5CXVB.cjs');
|
|
10
|
+
require('../__chunks/WYXAWBLE.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
exports.isApple = _G5EW4WEDcjs.isApple; exports.isFirefox = _G5EW4WEDcjs.isFirefox; exports.isMac = _G5EW4WEDcjs.isMac; exports.isSafari = _G5EW4WEDcjs.isSafari; exports.isTouchDevice = _G5EW4WEDcjs.isTouchDevice;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects if the device has touch capabilities.
|
|
3
|
+
*/
|
|
4
|
+
export declare function isTouchDevice(): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Detects Apple device.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isApple(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Detects Safari browser.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isSafari(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Detects Firefox browser.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isFirefox(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Detects Mac computer.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isMac(): boolean;
|
package/cjs/utils/store.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var _A4GDJCZBcjs = require('../__chunks/A4GDJCZB.cjs');
|
|
13
|
-
require('../__chunks/RCYVACJO.cjs');
|
|
14
|
-
require('../__chunks/72I2GWXF.cjs');
|
|
15
12
|
|
|
13
|
+
var _OASSVCYRcjs = require('../__chunks/OASSVCYR.cjs');
|
|
14
|
+
require('../__chunks/LMT335NJ.cjs');
|
|
15
|
+
require('../__chunks/WYXAWBLE.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -23,4 +23,5 @@ require('../__chunks/72I2GWXF.cjs');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
exports.batch = _OASSVCYRcjs.batch; exports.createStore = _OASSVCYRcjs.createStore; exports.init = _OASSVCYRcjs.init; exports.mergeStore = _OASSVCYRcjs.mergeStore; exports.omit = _OASSVCYRcjs.omit; exports.pick = _OASSVCYRcjs.pick; exports.setup = _OASSVCYRcjs.setup; exports.subscribe = _OASSVCYRcjs.subscribe; exports.sync = _OASSVCYRcjs.sync; exports.throwOnConflictingProps = _OASSVCYRcjs.throwOnConflictingProps;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { AnyObject, SetStateAction } from "./types.js";
|
|
2
|
+
type Listener<S> = (state: S, prevState: S) => void | (() => void);
|
|
3
|
+
type Sync<S, K extends keyof S> = (keys: K[] | null, listener: Listener<Pick<S, K>>) => () => void;
|
|
4
|
+
type StoreSetup = (callback: () => void | (() => void)) => () => void;
|
|
5
|
+
type StoreInit = () => () => void;
|
|
6
|
+
type StoreSubscribe<S = State, K extends keyof S = keyof S> = Sync<S, K>;
|
|
7
|
+
type StoreSync<S = State, K extends keyof S = keyof S> = Sync<S, K>;
|
|
8
|
+
type StoreBatch<S = State, K extends keyof S = keyof S> = Sync<S, K>;
|
|
9
|
+
type StorePick<S = State, K extends ReadonlyArray<keyof S> = ReadonlyArray<keyof S>> = (keys: K) => Store<Pick<S, K[number]>>;
|
|
10
|
+
type StoreOmit<S = State, K extends ReadonlyArray<keyof S> = ReadonlyArray<keyof S>> = (keys: K) => Store<Omit<S, K[number]>>;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a store.
|
|
13
|
+
* @param initialState Initial state.
|
|
14
|
+
* @param stores Stores to extend.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createStore<S extends State>(initialState: S, ...stores: Array<Store<Partial<S>> | undefined>): Store<S>;
|
|
17
|
+
export declare function setup<T extends Store>(store?: T | null, ...args: Parameters<StoreSetup>): T extends Store ? ReturnType<StoreSetup> : void;
|
|
18
|
+
export declare function init<T extends Store>(store?: T | null, ...args: Parameters<StoreInit>): T extends Store ? ReturnType<StoreInit> : void;
|
|
19
|
+
export declare function subscribe<T extends Store, K extends keyof StoreState<T>>(store?: T | null, ...args: Parameters<StoreSubscribe<StoreState<T>, K>>): T extends Store ? ReturnType<StoreSubscribe<StoreState<T>, K>> : void;
|
|
20
|
+
export declare function sync<T extends Store, K extends keyof StoreState<T>>(store?: T | null, ...args: Parameters<StoreSync<StoreState<T>, K>>): T extends Store ? ReturnType<StoreSync<StoreState<T>, K>> : void;
|
|
21
|
+
export declare function batch<T extends Store, K extends keyof StoreState<T>>(store?: T | null, ...args: Parameters<StoreBatch<StoreState<T>, K>>): T extends Store ? ReturnType<StoreBatch<StoreState<T>, K>> : void;
|
|
22
|
+
export declare function omit<T extends Store, K extends ReadonlyArray<keyof StoreState<T>>>(store?: T | null, ...args: Parameters<StoreOmit<StoreState<T>, K>>): T extends Store ? ReturnType<StoreOmit<StoreState<T>, K>> : void;
|
|
23
|
+
export declare function pick<T extends Store, K extends ReadonlyArray<keyof StoreState<T>>>(store?: T | null, ...args: Parameters<StorePick<StoreState<T>, K>>): T extends Store ? ReturnType<StorePick<StoreState<T>, K>> : void;
|
|
24
|
+
/**
|
|
25
|
+
* Merges multiple stores into a single store.
|
|
26
|
+
*/
|
|
27
|
+
export declare function mergeStore<S extends State>(...stores: Array<Store<S> | undefined>): Store<S>;
|
|
28
|
+
/**
|
|
29
|
+
* Throws when a store prop is passed in conjunction with a default state.
|
|
30
|
+
*/
|
|
31
|
+
export declare function throwOnConflictingProps(props: AnyObject, store?: Store): void;
|
|
32
|
+
/**
|
|
33
|
+
* Store state type.
|
|
34
|
+
*/
|
|
35
|
+
export type State = AnyObject;
|
|
36
|
+
/**
|
|
37
|
+
* Initial state that can be passed to a store creator function.
|
|
38
|
+
* @template S State type.
|
|
39
|
+
* @template K Key type.
|
|
40
|
+
*/
|
|
41
|
+
export type StoreOptions<S extends State, K extends keyof S> = Partial<Pick<S, K>>;
|
|
42
|
+
/**
|
|
43
|
+
* Props that can be passed to a store creator function.
|
|
44
|
+
* @template S State type.
|
|
45
|
+
*/
|
|
46
|
+
export type StoreProps<S extends State = State> = {
|
|
47
|
+
/**
|
|
48
|
+
* Another store object that will be kept in sync with the original store.
|
|
49
|
+
*/
|
|
50
|
+
store?: Store<Partial<S>>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Extracts the state type from a store type.
|
|
54
|
+
* @template T Store type.
|
|
55
|
+
*/
|
|
56
|
+
export type StoreState<T> = T extends Store<infer S> ? S : never;
|
|
57
|
+
/**
|
|
58
|
+
* Store.
|
|
59
|
+
* @template S State type.
|
|
60
|
+
*/
|
|
61
|
+
export interface Store<S = State> {
|
|
62
|
+
/**
|
|
63
|
+
* Returns the current store state.
|
|
64
|
+
*/
|
|
65
|
+
getState(): S;
|
|
66
|
+
/**
|
|
67
|
+
* Sets a state value.
|
|
68
|
+
*/
|
|
69
|
+
setState<K extends keyof S>(key: K, value: SetStateAction<S[K]>): void;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
package/cjs/utils/types.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";"use client";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Any object.
|
|
3
|
+
*/
|
|
4
|
+
export type AnyObject = Record<string, any>;
|
|
5
|
+
/**
|
|
6
|
+
* Empty object.
|
|
7
|
+
*/
|
|
8
|
+
export type EmptyObject = Record<keyof any, never>;
|
|
9
|
+
/**
|
|
10
|
+
* Any function.
|
|
11
|
+
*/
|
|
12
|
+
export type AnyFunction = (...args: any) => any;
|
|
13
|
+
/**
|
|
14
|
+
* Workaround for variance issues.
|
|
15
|
+
* @template T The type of the callback.
|
|
16
|
+
*/
|
|
17
|
+
export type BivariantCallback<T extends AnyFunction> = {
|
|
18
|
+
bivarianceHack(...args: Parameters<T>): ReturnType<T>;
|
|
19
|
+
}["bivarianceHack"];
|
|
20
|
+
/**
|
|
21
|
+
* @template T The state type.
|
|
22
|
+
*/
|
|
23
|
+
export type SetStateAction<T> = T | BivariantCallback<(prevState: T) => T>;
|
|
24
|
+
/**
|
|
25
|
+
* The type of the `setState` function in `[state, setState] = useState()`.
|
|
26
|
+
* @template T The type of the state.
|
|
27
|
+
*/
|
|
28
|
+
export type SetState<T> = BivariantCallback<(value: SetStateAction<T>) => void>;
|
|
29
|
+
/**
|
|
30
|
+
* A boolean value or a callback that returns a boolean value.
|
|
31
|
+
* @template T The type of the callback parameter.
|
|
32
|
+
*/
|
|
33
|
+
export type BooleanOrCallback<T> = boolean | BivariantCallback<(arg: T) => boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* A string that will provide autocomplete for specific strings.
|
|
36
|
+
* @template T The specific strings.
|
|
37
|
+
*/
|
|
38
|
+
export type StringWithValue<T extends string> = T | (string & Record<never, never>);
|
|
39
|
+
/**
|
|
40
|
+
* Transforms a type into a primitive type.
|
|
41
|
+
* @template T The type to transform.
|
|
42
|
+
* @example
|
|
43
|
+
* // string
|
|
44
|
+
* ToPrimitive<"a">;
|
|
45
|
+
* // number
|
|
46
|
+
* ToPrimitive<1>;
|
|
47
|
+
*/
|
|
48
|
+
export type ToPrimitive<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends AnyFunction ? (...args: Parameters<T>) => ReturnType<T> : T;
|
|
49
|
+
/**
|
|
50
|
+
* Picks only the properties from a type that have a specific value.
|
|
51
|
+
* @template T The type to pick from.
|
|
52
|
+
* @template Value The value to pick.
|
|
53
|
+
*/
|
|
54
|
+
export type PickByValue<T, Value> = {
|
|
55
|
+
[K in keyof T as [Value] extends [T[K]] ? T[K] extends Value | undefined ? K : never : never]: T[K];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Picks only the required properties from a type.
|
|
59
|
+
* @template T The type to pick from.
|
|
60
|
+
* @template P The properties to pick.
|
|
61
|
+
*/
|
|
62
|
+
export type PickRequired<T, P extends keyof T> = T & {
|
|
63
|
+
[K in keyof T]: Pick<Required<T>, K>;
|
|
64
|
+
}[P];
|
|
65
|
+
/**
|
|
66
|
+
* Indicates the availability and type of interactive popup element, such as
|
|
67
|
+
* menu or dialog, that can be triggered by an element.
|
|
68
|
+
*/
|
|
69
|
+
export type AriaHasPopup = boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* All the WAI-ARIA 1.1 role attribute values from
|
|
72
|
+
* https://www.w3.org/TR/wai-aria-1.1/#role_definitions
|
|
73
|
+
*/
|
|
74
|
+
export type AriaRole = "alert" | "alertdialog" | "application" | "article" | "banner" | "button" | "cell" | "checkbox" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "dialog" | "directory" | "document" | "feed" | "figure" | "form" | "grid" | "gridcell" | "group" | "heading" | "img" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "marquee" | "math" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "navigation" | "none" | "note" | "option" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem" | (string & {});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
__spreadValues
|
|
3
|
-
} from "./
|
|
4
|
+
} from "./2SMRF6AD.js";
|
|
4
5
|
|
|
5
6
|
// src/utils/misc.ts
|
|
6
7
|
function noop(..._) {
|
|
@@ -126,6 +127,9 @@ function isFalsyBooleanCallback(booleanOrCallback, ...args) {
|
|
|
126
127
|
return false;
|
|
127
128
|
return !result;
|
|
128
129
|
}
|
|
130
|
+
function disabledFromProps(props) {
|
|
131
|
+
return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
|
|
132
|
+
}
|
|
129
133
|
function defaultValue(...values) {
|
|
130
134
|
for (const value of values) {
|
|
131
135
|
if (value !== void 0)
|
|
@@ -153,5 +157,6 @@ export {
|
|
|
153
157
|
invariant,
|
|
154
158
|
getKeys,
|
|
155
159
|
isFalsyBooleanCallback,
|
|
160
|
+
disabledFromProps,
|
|
156
161
|
defaultValue
|
|
157
162
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
createCollectionStore
|
|
3
|
-
} from "./
|
|
4
|
+
} from "./Q332EHXG.js";
|
|
4
5
|
import {
|
|
5
6
|
createStore,
|
|
6
7
|
setup,
|
|
7
8
|
sync
|
|
8
|
-
} from "./
|
|
9
|
+
} from "./GME4NYXR.js";
|
|
9
10
|
import {
|
|
10
11
|
defaultValue
|
|
11
|
-
} from "./
|
|
12
|
+
} from "./D23ES3Z4.js";
|
|
12
13
|
import {
|
|
13
14
|
flatten2DArray,
|
|
14
15
|
reverseArray
|
|
15
|
-
} from "./
|
|
16
|
+
} from "./7PRQYBBV.js";
|
|
16
17
|
import {
|
|
17
18
|
__spreadProps,
|
|
18
19
|
__spreadValues
|
|
19
|
-
} from "./
|
|
20
|
+
} from "./2SMRF6AD.js";
|
|
20
21
|
|
|
21
22
|
// src/composite/composite-store.ts
|
|
22
23
|
var NULL_ITEM = { id: null };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
applyState,
|
|
3
4
|
chain,
|
|
@@ -7,11 +8,11 @@ import {
|
|
|
7
8
|
noop,
|
|
8
9
|
omit,
|
|
9
10
|
pick
|
|
10
|
-
} from "./
|
|
11
|
+
} from "./D23ES3Z4.js";
|
|
11
12
|
import {
|
|
12
13
|
__spreadProps,
|
|
13
14
|
__spreadValues
|
|
14
|
-
} from "./
|
|
15
|
+
} from "./2SMRF6AD.js";
|
|
15
16
|
|
|
16
17
|
// src/utils/store.ts
|
|
17
18
|
function getInternal(store, key) {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
createPopoverStore
|
|
3
|
-
} from "./
|
|
4
|
+
} from "./VEWADM34.js";
|
|
4
5
|
import {
|
|
5
6
|
createStore
|
|
6
|
-
} from "./
|
|
7
|
+
} from "./GME4NYXR.js";
|
|
7
8
|
import {
|
|
8
9
|
defaultValue
|
|
9
|
-
} from "./
|
|
10
|
+
} from "./D23ES3Z4.js";
|
|
10
11
|
import {
|
|
11
12
|
__spreadProps,
|
|
12
13
|
__spreadValues
|
|
13
|
-
} from "./
|
|
14
|
+
} from "./2SMRF6AD.js";
|
|
14
15
|
|
|
15
16
|
// src/hovercard/hovercard-store.ts
|
|
16
17
|
function createHovercardStore(props = {}) {
|