@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
|
@@ -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
|
|
|
@@ -6,62 +6,63 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var _A4GDJCZBcjs = require('./A4GDJCZB.cjs');
|
|
10
9
|
|
|
10
|
+
var _OASSVCYRcjs = require('./OASSVCYR.cjs');
|
|
11
11
|
|
|
12
|
-
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
13
12
|
|
|
13
|
+
var _LMT335NJcjs = require('./LMT335NJ.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
var _WYXAWBLEcjs = require('./WYXAWBLE.cjs');
|
|
17
18
|
|
|
18
19
|
// src/disclosure/disclosure-store.ts
|
|
19
20
|
function createDisclosureStore(props = {}) {
|
|
20
|
-
const store =
|
|
21
|
+
const store = _OASSVCYRcjs.mergeStore.call(void 0,
|
|
21
22
|
props.store,
|
|
22
|
-
|
|
23
|
+
_OASSVCYRcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
23
24
|
);
|
|
24
|
-
|
|
25
|
+
_OASSVCYRcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
25
26
|
const syncState = store == null ? void 0 : store.getState();
|
|
26
|
-
const open =
|
|
27
|
+
const open = _LMT335NJcjs.defaultValue.call(void 0,
|
|
27
28
|
props.open,
|
|
28
29
|
syncState == null ? void 0 : syncState.open,
|
|
29
30
|
props.defaultOpen,
|
|
30
31
|
false
|
|
31
32
|
);
|
|
32
|
-
const animated =
|
|
33
|
+
const animated = _LMT335NJcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
|
|
33
34
|
const initialState = {
|
|
34
35
|
open,
|
|
35
36
|
animated,
|
|
36
37
|
animating: !!animated && open,
|
|
37
38
|
mounted: open,
|
|
38
|
-
contentElement:
|
|
39
|
-
disclosureElement:
|
|
39
|
+
contentElement: _LMT335NJcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
40
|
+
disclosureElement: _LMT335NJcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
40
41
|
};
|
|
41
|
-
const disclosure =
|
|
42
|
-
|
|
42
|
+
const disclosure = _OASSVCYRcjs.createStore.call(void 0, initialState, store);
|
|
43
|
+
_OASSVCYRcjs.setup.call(void 0,
|
|
43
44
|
disclosure,
|
|
44
|
-
() =>
|
|
45
|
+
() => _OASSVCYRcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
45
46
|
if (state.animated)
|
|
46
47
|
return;
|
|
47
48
|
disclosure.setState("animating", false);
|
|
48
49
|
})
|
|
49
50
|
);
|
|
50
|
-
|
|
51
|
+
_OASSVCYRcjs.setup.call(void 0,
|
|
51
52
|
disclosure,
|
|
52
|
-
() =>
|
|
53
|
+
() => _OASSVCYRcjs.subscribe.call(void 0, disclosure, ["open"], () => {
|
|
53
54
|
if (!disclosure.getState().animated)
|
|
54
55
|
return;
|
|
55
56
|
disclosure.setState("animating", true);
|
|
56
57
|
})
|
|
57
58
|
);
|
|
58
|
-
|
|
59
|
+
_OASSVCYRcjs.setup.call(void 0,
|
|
59
60
|
disclosure,
|
|
60
|
-
() =>
|
|
61
|
+
() => _OASSVCYRcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
61
62
|
disclosure.setState("mounted", state.open || state.animating);
|
|
62
63
|
})
|
|
63
64
|
);
|
|
64
|
-
return
|
|
65
|
+
return _WYXAWBLEcjs.__spreadProps.call(void 0, _WYXAWBLEcjs.__spreadValues.call(void 0, {}, disclosure), {
|
|
65
66
|
setOpen: (value) => disclosure.setState("open", value),
|
|
66
67
|
show: () => disclosure.setState("open", true),
|
|
67
68
|
hide: () => disclosure.setState("open", false),
|
|
@@ -1,30 +1,31 @@
|
|
|
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
|
-
var _A4GDJCZBcjs = require('../__chunks/A4GDJCZB.cjs');
|
|
5
4
|
|
|
5
|
+
var _OASSVCYRcjs = require('../__chunks/OASSVCYR.cjs');
|
|
6
6
|
|
|
7
|
-
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
8
7
|
|
|
8
|
+
var _LMT335NJcjs = require('../__chunks/LMT335NJ.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
var _WYXAWBLEcjs = require('../__chunks/WYXAWBLE.cjs');
|
|
12
13
|
|
|
13
14
|
// src/checkbox/checkbox-store.ts
|
|
14
15
|
function createCheckboxStore(props = {}) {
|
|
15
16
|
var _a;
|
|
16
|
-
|
|
17
|
+
_OASSVCYRcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
17
18
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
18
19
|
const initialState = {
|
|
19
|
-
value:
|
|
20
|
+
value: _LMT335NJcjs.defaultValue.call(void 0,
|
|
20
21
|
props.value,
|
|
21
22
|
syncState == null ? void 0 : syncState.value,
|
|
22
23
|
props.defaultValue,
|
|
23
24
|
false
|
|
24
25
|
)
|
|
25
26
|
};
|
|
26
|
-
const checkbox =
|
|
27
|
-
return
|
|
27
|
+
const checkbox = _OASSVCYRcjs.createStore.call(void 0, initialState, props.store);
|
|
28
|
+
return _WYXAWBLEcjs.__spreadProps.call(void 0, _WYXAWBLEcjs.__spreadValues.call(void 0, {}, checkbox), {
|
|
28
29
|
setValue: (value) => checkbox.setState("value", value)
|
|
29
30
|
});
|
|
30
31
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
|
+
import type { PickRequired, SetState, ToPrimitive } from "../utils/types.js";
|
|
3
|
+
type Value = boolean | string | number | Array<string | number>;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a checkbox store.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createCheckboxStore<T extends Value = Value>(props: PickRequired<CheckboxStoreProps<T>, "value" | "defaultValue">): CheckboxStore<T>;
|
|
8
|
+
export declare function createCheckboxStore(props?: CheckboxStoreProps): CheckboxStore;
|
|
9
|
+
export type CheckboxStoreValue = Value;
|
|
10
|
+
export interface CheckboxStoreState<T extends Value = Value> {
|
|
11
|
+
/**
|
|
12
|
+
* The checked state of the checkbox.
|
|
13
|
+
*
|
|
14
|
+
* Live examples:
|
|
15
|
+
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
|
|
16
|
+
*/
|
|
17
|
+
value: ToPrimitive<T>;
|
|
18
|
+
}
|
|
19
|
+
export interface CheckboxStoreFunctions<T extends Value = Value> {
|
|
20
|
+
/**
|
|
21
|
+
* Sets the `value` state.
|
|
22
|
+
* @example
|
|
23
|
+
* store.setValue(true);
|
|
24
|
+
* store.setValue((value) => !value);
|
|
25
|
+
*/
|
|
26
|
+
setValue: SetState<CheckboxStoreState<T>["value"]>;
|
|
27
|
+
}
|
|
28
|
+
export interface CheckboxStoreOptions<T extends Value = Value> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
29
|
+
/**
|
|
30
|
+
* The default value of the checkbox.
|
|
31
|
+
*
|
|
32
|
+
* Live examples:
|
|
33
|
+
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
|
|
34
|
+
* - [Checkbox group](https://ariakit.org/examples/checkbox-group)
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
defaultValue?: CheckboxStoreState<T>["value"];
|
|
38
|
+
}
|
|
39
|
+
export type CheckboxStoreProps<T extends Value = Value> = CheckboxStoreOptions<T> & StoreProps<CheckboxStoreState<T>>;
|
|
40
|
+
export type CheckboxStore<T extends Value = Value> = CheckboxStoreFunctions<T> & Store<CheckboxStoreState<T>>;
|
|
41
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
|
-
var _W5IQT6Z2cjs = require('../__chunks/W5IQT6Z2.cjs');
|
|
4
|
-
require('../__chunks/A4GDJCZB.cjs');
|
|
5
|
-
require('../__chunks/RCYVACJO.cjs');
|
|
6
|
-
require('../__chunks/EXM2AW52.cjs');
|
|
7
|
-
require('../__chunks/72I2GWXF.cjs');
|
|
8
3
|
|
|
4
|
+
var _25WWT2VOcjs = require('../__chunks/25WWT2VO.cjs');
|
|
5
|
+
require('../__chunks/OASSVCYR.cjs');
|
|
6
|
+
require('../__chunks/LMT335NJ.cjs');
|
|
7
|
+
require('../__chunks/FTB5CXVB.cjs');
|
|
8
|
+
require('../__chunks/WYXAWBLE.cjs');
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
exports.createCollectionStore = _25WWT2VOcjs.createCollectionStore;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
|
+
import type { BivariantCallback } from "../utils/types.js";
|
|
3
|
+
type Item = {
|
|
4
|
+
id: string;
|
|
5
|
+
element?: HTMLElement | null;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Creates a collection store.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createCollectionStore<T extends Item = Item>(props?: CollectionStoreProps<T>): CollectionStore<T>;
|
|
11
|
+
export type CollectionStoreItem = Item;
|
|
12
|
+
export interface CollectionStoreState<T extends Item = Item> {
|
|
13
|
+
/**
|
|
14
|
+
* Lists all the items with their meta data. This state is automatically
|
|
15
|
+
* updated when an item is registered or unregistered with the `registerItem`
|
|
16
|
+
* function.
|
|
17
|
+
*/
|
|
18
|
+
items: T[];
|
|
19
|
+
/**
|
|
20
|
+
* Lists all the items that are currently rendered. This state is
|
|
21
|
+
* automatically updated when an item is rendered or unrendered with the
|
|
22
|
+
* `renderItem` function. This state is also automatically sorted based on
|
|
23
|
+
* their DOM position.
|
|
24
|
+
*/
|
|
25
|
+
renderedItems: T[];
|
|
26
|
+
}
|
|
27
|
+
export interface CollectionStoreFunctions<T extends Item = Item> {
|
|
28
|
+
/**
|
|
29
|
+
* Registers an item in the collection. This function returns a cleanup
|
|
30
|
+
* function that unregisters the item.
|
|
31
|
+
* @param item The item to register.
|
|
32
|
+
* @example
|
|
33
|
+
* const unregisterItem = store.registerItem({ id: "item-1" });
|
|
34
|
+
* // on cleanup
|
|
35
|
+
* unregisterItem();
|
|
36
|
+
*/
|
|
37
|
+
registerItem: BivariantCallback<(item: T) => () => void>;
|
|
38
|
+
/**
|
|
39
|
+
* Renders an item in the collection. This function returns a cleanup function
|
|
40
|
+
* that unrenders the item.
|
|
41
|
+
* @param item The item to render.
|
|
42
|
+
* @example
|
|
43
|
+
* const unrenderItem = store.renderItem({ id: "item-1" });
|
|
44
|
+
* // on cleanup
|
|
45
|
+
* unrenderItem();
|
|
46
|
+
*/
|
|
47
|
+
renderItem: BivariantCallback<(item: T) => () => void>;
|
|
48
|
+
/**
|
|
49
|
+
* Gets an item by its id.
|
|
50
|
+
* @param id The id of the item.
|
|
51
|
+
* @example
|
|
52
|
+
* const item = store.item("item-1");
|
|
53
|
+
*/
|
|
54
|
+
item: (id: string | null | undefined) => T | null;
|
|
55
|
+
}
|
|
56
|
+
export interface CollectionStoreOptions<T extends Item = Item> extends StoreOptions<CollectionStoreState<T>, "items"> {
|
|
57
|
+
/**
|
|
58
|
+
* The defaut value for the `items` state.
|
|
59
|
+
* @default []
|
|
60
|
+
*/
|
|
61
|
+
defaultItems?: CollectionStoreState<T>["items"];
|
|
62
|
+
}
|
|
63
|
+
export type CollectionStoreProps<T extends Item = Item> = CollectionStoreOptions<T> & StoreProps<CollectionStoreState<T>>;
|
|
64
|
+
export type CollectionStore<T extends Item = Item> = CollectionStoreFunctions<T> & Store<CollectionStoreState<T>>;
|
|
65
|
+
export {};
|
|
@@ -1,91 +1,92 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
|
-
var _ZYIEFAMBcjs = require('../__chunks/ZYIEFAMB.cjs');
|
|
4
|
-
require('../__chunks/DFFIYGBS.cjs');
|
|
5
|
-
require('../__chunks/A7K3KZJL.cjs');
|
|
6
3
|
|
|
4
|
+
var _ROX3MRGOcjs = require('../__chunks/ROX3MRGO.cjs');
|
|
5
|
+
require('../__chunks/MLPOXRDT.cjs');
|
|
6
|
+
require('../__chunks/YXSGST3H.cjs');
|
|
7
7
|
|
|
8
|
-
var _TTWS4MDCcjs = require('../__chunks/TTWS4MDC.cjs');
|
|
9
|
-
require('../__chunks/W5IQT6Z2.cjs');
|
|
10
8
|
|
|
9
|
+
var _M44E4T5Acjs = require('../__chunks/M44E4T5A.cjs');
|
|
10
|
+
require('../__chunks/25WWT2VO.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var _A4GDJCZBcjs = require('../__chunks/A4GDJCZB.cjs');
|
|
17
16
|
|
|
17
|
+
var _OASSVCYRcjs = require('../__chunks/OASSVCYR.cjs');
|
|
18
18
|
|
|
19
|
-
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
20
19
|
|
|
20
|
+
var _LMT335NJcjs = require('../__chunks/LMT335NJ.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var _EIRIJC7Tcjs = require('../__chunks/EIRIJC7T.cjs');
|
|
24
|
-
require('../__chunks/EXM2AW52.cjs');
|
|
25
|
-
require('../__chunks/GDZQUFNP.cjs');
|
|
26
23
|
|
|
24
|
+
var _G5EW4WEDcjs = require('../__chunks/G5EW4WED.cjs');
|
|
25
|
+
require('../__chunks/FTB5CXVB.cjs');
|
|
26
|
+
require('../__chunks/ULSPM3Y3.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
var _WYXAWBLEcjs = require('../__chunks/WYXAWBLE.cjs');
|
|
30
31
|
|
|
31
32
|
// src/combobox/combobox-store.ts
|
|
32
|
-
var isSafariOnMobile =
|
|
33
|
+
var isSafariOnMobile = _G5EW4WEDcjs.isSafari.call(void 0, ) && _G5EW4WEDcjs.isTouchDevice.call(void 0, );
|
|
33
34
|
function createComboboxStore(props = {}) {
|
|
34
35
|
var _a;
|
|
35
|
-
|
|
36
|
+
_OASSVCYRcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
36
37
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
37
|
-
const activeId =
|
|
38
|
+
const activeId = _LMT335NJcjs.defaultValue.call(void 0,
|
|
38
39
|
props.activeId,
|
|
39
40
|
syncState == null ? void 0 : syncState.activeId,
|
|
40
41
|
props.defaultActiveId,
|
|
41
42
|
null
|
|
42
43
|
);
|
|
43
|
-
const composite =
|
|
44
|
+
const composite = _M44E4T5Acjs.createCompositeStore.call(void 0, _WYXAWBLEcjs.__spreadProps.call(void 0, _WYXAWBLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
44
45
|
activeId,
|
|
45
|
-
includesBaseElement:
|
|
46
|
+
includesBaseElement: _LMT335NJcjs.defaultValue.call(void 0,
|
|
46
47
|
props.includesBaseElement,
|
|
47
48
|
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
48
49
|
true
|
|
49
50
|
),
|
|
50
|
-
orientation:
|
|
51
|
+
orientation: _LMT335NJcjs.defaultValue.call(void 0,
|
|
51
52
|
props.orientation,
|
|
52
53
|
syncState == null ? void 0 : syncState.orientation,
|
|
53
54
|
"vertical"
|
|
54
55
|
),
|
|
55
|
-
focusLoop:
|
|
56
|
-
focusWrap:
|
|
57
|
-
virtualFocus:
|
|
56
|
+
focusLoop: _LMT335NJcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
|
|
57
|
+
focusWrap: _LMT335NJcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
|
|
58
|
+
virtualFocus: _LMT335NJcjs.defaultValue.call(void 0,
|
|
58
59
|
props.virtualFocus,
|
|
59
60
|
syncState == null ? void 0 : syncState.virtualFocus,
|
|
60
61
|
!isSafariOnMobile
|
|
61
62
|
)
|
|
62
63
|
}));
|
|
63
|
-
const popover =
|
|
64
|
-
placement:
|
|
64
|
+
const popover = _ROX3MRGOcjs.createPopoverStore.call(void 0, _WYXAWBLEcjs.__spreadProps.call(void 0, _WYXAWBLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
65
|
+
placement: _LMT335NJcjs.defaultValue.call(void 0,
|
|
65
66
|
props.placement,
|
|
66
67
|
syncState == null ? void 0 : syncState.placement,
|
|
67
68
|
"bottom-start"
|
|
68
69
|
)
|
|
69
70
|
}));
|
|
70
|
-
const initialValue =
|
|
71
|
+
const initialValue = _LMT335NJcjs.defaultValue.call(void 0,
|
|
71
72
|
props.value,
|
|
72
73
|
syncState == null ? void 0 : syncState.value,
|
|
73
74
|
props.defaultValue,
|
|
74
75
|
""
|
|
75
76
|
);
|
|
76
|
-
const initialState =
|
|
77
|
+
const initialState = _WYXAWBLEcjs.__spreadProps.call(void 0, _WYXAWBLEcjs.__spreadValues.call(void 0, _WYXAWBLEcjs.__spreadValues.call(void 0, {}, composite.getState()), popover.getState()), {
|
|
77
78
|
value: initialValue,
|
|
78
|
-
resetValueOnHide:
|
|
79
|
+
resetValueOnHide: _LMT335NJcjs.defaultValue.call(void 0,
|
|
79
80
|
props.resetValueOnHide,
|
|
80
81
|
syncState == null ? void 0 : syncState.resetValueOnHide,
|
|
81
82
|
false
|
|
82
83
|
),
|
|
83
84
|
activeValue: syncState == null ? void 0 : syncState.activeValue
|
|
84
85
|
});
|
|
85
|
-
const combobox =
|
|
86
|
-
|
|
86
|
+
const combobox = _OASSVCYRcjs.createStore.call(void 0, initialState, composite, popover, props.store);
|
|
87
|
+
_OASSVCYRcjs.setup.call(void 0,
|
|
87
88
|
combobox,
|
|
88
|
-
() =>
|
|
89
|
+
() => _OASSVCYRcjs.sync.call(void 0, combobox, ["resetValueOnHide", "mounted"], (state) => {
|
|
89
90
|
if (!state.resetValueOnHide)
|
|
90
91
|
return;
|
|
91
92
|
if (state.mounted)
|
|
@@ -93,26 +94,26 @@ function createComboboxStore(props = {}) {
|
|
|
93
94
|
combobox.setState("value", initialValue);
|
|
94
95
|
})
|
|
95
96
|
);
|
|
96
|
-
|
|
97
|
+
_OASSVCYRcjs.setup.call(void 0,
|
|
97
98
|
combobox,
|
|
98
|
-
() =>
|
|
99
|
+
() => _OASSVCYRcjs.batch.call(void 0, combobox, ["mounted"], (state) => {
|
|
99
100
|
if (state.mounted)
|
|
100
101
|
return;
|
|
101
102
|
combobox.setState("activeId", activeId);
|
|
102
103
|
combobox.setState("moves", 0);
|
|
103
104
|
})
|
|
104
105
|
);
|
|
105
|
-
|
|
106
|
+
_OASSVCYRcjs.setup.call(void 0,
|
|
106
107
|
combobox,
|
|
107
|
-
() =>
|
|
108
|
+
() => _OASSVCYRcjs.sync.call(void 0, combobox, ["moves", "activeId"], (state, prevState) => {
|
|
108
109
|
if (state.moves === prevState.moves) {
|
|
109
110
|
combobox.setState("activeValue", void 0);
|
|
110
111
|
}
|
|
111
112
|
})
|
|
112
113
|
);
|
|
113
|
-
|
|
114
|
+
_OASSVCYRcjs.setup.call(void 0,
|
|
114
115
|
combobox,
|
|
115
|
-
() =>
|
|
116
|
+
() => _OASSVCYRcjs.batch.call(void 0, combobox, ["moves", "renderedItems"], (state, prev) => {
|
|
116
117
|
if (state.moves === prev.moves)
|
|
117
118
|
return;
|
|
118
119
|
const { activeId: activeId2 } = combobox.getState();
|
|
@@ -120,7 +121,7 @@ function createComboboxStore(props = {}) {
|
|
|
120
121
|
combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
|
|
121
122
|
})
|
|
122
123
|
);
|
|
123
|
-
return
|
|
124
|
+
return _WYXAWBLEcjs.__spreadProps.call(void 0, _WYXAWBLEcjs.__spreadValues.call(void 0, _WYXAWBLEcjs.__spreadValues.call(void 0, _WYXAWBLEcjs.__spreadValues.call(void 0, {}, popover), composite), combobox), {
|
|
124
125
|
setValue: (value) => combobox.setState("value", value)
|
|
125
126
|
});
|
|
126
127
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
|
+
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
3
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
|
+
import type { SetState } from "../utils/types.js";
|
|
5
|
+
type Item = CompositeStoreItem & {
|
|
6
|
+
value?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Creates a combobox store.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createComboboxStore(props?: ComboboxStoreProps): ComboboxStore;
|
|
12
|
+
export type ComboboxStoreItem = Item;
|
|
13
|
+
export interface ComboboxStoreState extends CompositeStoreState<Item>, PopoverStoreState {
|
|
14
|
+
/**
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
includesBaseElement: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The input value.
|
|
20
|
+
*
|
|
21
|
+
* Live examples:
|
|
22
|
+
* - [ComboboxGroup](https://ariakit.org/examples/combobox-group)
|
|
23
|
+
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
|
|
24
|
+
* - [Combobox filtering](https://ariakit.org/examples/combobox-filtering)
|
|
25
|
+
* - [Multi-selectable
|
|
26
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
27
|
+
* - [Textarea with inline
|
|
28
|
+
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
29
|
+
*/
|
|
30
|
+
value: string;
|
|
31
|
+
/**
|
|
32
|
+
* The value of the current active item.
|
|
33
|
+
*/
|
|
34
|
+
activeValue: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to reset the value when the combobox popover is hidden.
|
|
37
|
+
*
|
|
38
|
+
* Live examples:
|
|
39
|
+
* - [Multi-selectable
|
|
40
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
resetValueOnHide: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface ComboboxStoreFunctions extends CompositeStoreFunctions<Item>, PopoverStoreFunctions {
|
|
46
|
+
/**
|
|
47
|
+
* Sets the `value` state.
|
|
48
|
+
*
|
|
49
|
+
* Live examples:
|
|
50
|
+
* - [Multi-selectable
|
|
51
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
52
|
+
* - [Textarea with inline
|
|
53
|
+
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
54
|
+
* @example
|
|
55
|
+
* store.setValue("Hello world");
|
|
56
|
+
* store.setValue((value) => value + "!");
|
|
57
|
+
*/
|
|
58
|
+
setValue: SetState<ComboboxStoreState["value"]>;
|
|
59
|
+
}
|
|
60
|
+
export interface ComboboxStoreOptions extends StoreOptions<ComboboxStoreState, "includesBaseElement" | "value" | "resetValueOnHide">, CompositeStoreOptions<Item>, PopoverStoreOptions {
|
|
61
|
+
/**
|
|
62
|
+
* @default null
|
|
63
|
+
*/
|
|
64
|
+
defaultActiveId?: CompositeStoreOptions<Item>["activeId"];
|
|
65
|
+
/**
|
|
66
|
+
* The combobox initial value.
|
|
67
|
+
*
|
|
68
|
+
* Live examples:
|
|
69
|
+
* - [Multi-selectable
|
|
70
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
71
|
+
* @default ""
|
|
72
|
+
*/
|
|
73
|
+
defaultValue?: ComboboxStoreState["value"];
|
|
74
|
+
}
|
|
75
|
+
export type ComboboxStoreProps = ComboboxStoreOptions & StoreProps<ComboboxStoreState>;
|
|
76
|
+
export type ComboboxStore = ComboboxStoreFunctions & Store<ComboboxStoreState>;
|
|
77
|
+
export {};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
8
|
-
require('../__chunks/
|
|
3
|
+
|
|
4
|
+
var _ROX3MRGOcjs = require('../__chunks/ROX3MRGO.cjs');
|
|
5
|
+
require('../__chunks/MLPOXRDT.cjs');
|
|
6
|
+
require('../__chunks/YXSGST3H.cjs');
|
|
7
|
+
require('../__chunks/OASSVCYR.cjs');
|
|
8
|
+
require('../__chunks/LMT335NJ.cjs');
|
|
9
|
+
require('../__chunks/WYXAWBLE.cjs');
|
|
9
10
|
|
|
10
11
|
// src/composite/composite-overflow-store.ts
|
|
11
12
|
function createCompositeOverflowStore(props = {}) {
|
|
12
|
-
return
|
|
13
|
+
return _ROX3MRGOcjs.createPopoverStore.call(void 0, props);
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PopoverStore, PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreProps, PopoverStoreState } from "../popover/popover-store.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a composite overflow store.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createCompositeOverflowStore(props?: CompositeOverflowStoreProps): CompositeOverflowStore;
|
|
6
|
+
export type CompositeOverflowStoreState = PopoverStoreState;
|
|
7
|
+
export type CompositeOverflowStoreFunctions = PopoverStoreFunctions;
|
|
8
|
+
export type CompositeOverflowStoreOptions = PopoverStoreOptions;
|
|
9
|
+
export type CompositeOverflowStoreProps = PopoverStoreProps;
|
|
10
|
+
export type CompositeOverflowStore = PopoverStore;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
|
-
var _TTWS4MDCcjs = require('../__chunks/TTWS4MDC.cjs');
|
|
4
|
-
require('../__chunks/W5IQT6Z2.cjs');
|
|
5
|
-
require('../__chunks/A4GDJCZB.cjs');
|
|
6
|
-
require('../__chunks/RCYVACJO.cjs');
|
|
7
|
-
require('../__chunks/EXM2AW52.cjs');
|
|
8
|
-
require('../__chunks/GDZQUFNP.cjs');
|
|
9
|
-
require('../__chunks/72I2GWXF.cjs');
|
|
10
3
|
|
|
4
|
+
var _M44E4T5Acjs = require('../__chunks/M44E4T5A.cjs');
|
|
5
|
+
require('../__chunks/25WWT2VO.cjs');
|
|
6
|
+
require('../__chunks/OASSVCYR.cjs');
|
|
7
|
+
require('../__chunks/LMT335NJ.cjs');
|
|
8
|
+
require('../__chunks/FTB5CXVB.cjs');
|
|
9
|
+
require('../__chunks/ULSPM3Y3.cjs');
|
|
10
|
+
require('../__chunks/WYXAWBLE.cjs');
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
exports.createCompositeStore = _M44E4T5Acjs.createCompositeStore;
|