@ariakit/core 0.1.4 → 0.2.0
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 +66 -0
- package/cjs/__chunks/{QYB6XH64.cjs → 27ZAGOYG.cjs} +17 -13
- package/cjs/__chunks/6455U47T.cjs +37 -0
- package/cjs/__chunks/{ZPOXPO2L.cjs → 6SPJEESB.cjs} +33 -21
- package/cjs/__chunks/CNODBYSG.cjs +58 -0
- package/cjs/__chunks/{2YFRPUZP.cjs → DBHIHK7C.cjs} +6 -6
- package/cjs/__chunks/{W5IHD6VG.cjs → EUJ6NNA6.cjs} +56 -43
- package/cjs/__chunks/{4DQ3OTE7.cjs → FXEBKN6G.cjs} +22 -17
- package/cjs/__chunks/{ZJEEK57E.cjs → HEFJPUYD.cjs} +2 -2
- package/cjs/__chunks/{QNEPGQLL.cjs → M6ZA7XUP.cjs} +6 -2
- package/cjs/__chunks/RD3S4VKY.cjs +60 -0
- package/cjs/__chunks/{OFNGELMA.cjs → ZNW4LSWU.cjs} +8 -6
- package/cjs/checkbox/checkbox-store.cjs +14 -10
- package/cjs/collection/collection-store.cjs +6 -5
- package/cjs/combobox/combobox-store.cjs +49 -48
- package/cjs/composite/composite-overflow-store.cjs +7 -6
- package/cjs/composite/composite-store.cjs +7 -6
- package/cjs/dialog/dialog-store.cjs +6 -5
- package/cjs/disclosure/disclosure-store.cjs +5 -4
- package/cjs/disclosure/disclosure-store.d.ts +8 -0
- package/cjs/form/form-store.cjs +38 -35
- package/cjs/hovercard/hovercard-store.cjs +8 -7
- package/cjs/hovercard/hovercard-store.d.ts +3 -2
- package/cjs/index.cjs +3 -1
- package/cjs/menu/menu-bar-store.cjs +17 -13
- package/cjs/menu/menu-store.cjs +41 -43
- package/cjs/popover/popover-store.cjs +7 -6
- package/cjs/popover/popover-store.d.ts +8 -89
- package/cjs/radio/radio-store.cjs +25 -24
- package/cjs/select/select-store.cjs +42 -42
- package/cjs/tab/tab-store.cjs +29 -28
- package/cjs/tab/tab-store.d.ts +9 -0
- package/cjs/toolbar/toolbar-store.cjs +17 -13
- package/cjs/tooltip/tooltip-store.cjs +31 -79
- package/cjs/tooltip/tooltip-store.d.ts +20 -15
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/cjs/utils/array.cjs +1 -0
- package/cjs/utils/dom.cjs +3 -2
- package/cjs/utils/events.cjs +14 -9
- package/cjs/utils/focus.cjs +24 -14
- package/cjs/utils/misc.cjs +3 -2
- package/cjs/utils/platform.cjs +4 -3
- package/cjs/utils/store.cjs +4 -3
- package/esm/__chunks/3BAGFTL5.js +58 -0
- package/esm/__chunks/4BKCJXBM.js +37 -0
- package/esm/__chunks/{NA5BK7DD.js → BOKMNDR7.js} +22 -10
- package/esm/__chunks/{WFGVC6LE.js → EWHSN7GO.js} +17 -12
- package/esm/__chunks/{4T5RHRE5.js → MNNKHNLW.js} +1 -1
- package/esm/__chunks/{UVCATTRC.js → N6JW4ITM.js} +7 -5
- package/esm/__chunks/{RMD7SNCC.js → NWU4GBZ6.js} +5 -1
- package/esm/__chunks/{X7MJ3FB5.js → R6VHFWTV.js} +49 -36
- package/esm/__chunks/{DXA3K2FY.js → TFBCK4JB.js} +1 -1
- package/esm/__chunks/Z5IDQSMV.js +60 -0
- package/esm/__chunks/{IOAGNCXX.js → ZV2GEGPL.js} +14 -10
- package/esm/checkbox/checkbox-store.js +11 -7
- package/esm/collection/collection-store.js +5 -4
- package/esm/combobox/combobox-store.js +34 -33
- package/esm/composite/composite-overflow-store.js +6 -5
- package/esm/composite/composite-store.js +6 -5
- package/esm/dialog/dialog-store.js +5 -4
- package/esm/disclosure/disclosure-store.d.ts +8 -0
- package/esm/disclosure/disclosure-store.js +4 -3
- package/esm/form/form-store.js +24 -21
- package/esm/hovercard/hovercard-store.d.ts +3 -2
- package/esm/hovercard/hovercard-store.js +7 -6
- package/esm/index.js +2 -0
- package/esm/menu/menu-bar-store.js +15 -11
- package/esm/menu/menu-store.js +31 -33
- package/esm/popover/popover-store.d.ts +8 -89
- package/esm/popover/popover-store.js +6 -5
- package/esm/radio/radio-store.js +22 -21
- package/esm/select/select-store.js +29 -29
- package/esm/tab/tab-store.d.ts +9 -0
- package/esm/tab/tab-store.js +23 -22
- package/esm/toolbar/toolbar-store.js +15 -11
- package/esm/tooltip/tooltip-store.d.ts +20 -15
- package/esm/tooltip/tooltip-store.js +32 -80
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/esm/utils/array.js +1 -0
- package/esm/utils/dom.js +2 -1
- package/esm/utils/events.js +10 -5
- package/esm/utils/focus.js +14 -4
- package/esm/utils/misc.js +2 -1
- package/esm/utils/platform.js +3 -2
- package/esm/utils/store.js +3 -2
- package/package.json +1 -1
- package/cjs/__chunks/DQHU5K4Q.cjs +0 -57
- package/cjs/__chunks/HLVPXX7H.cjs +0 -1491
- package/esm/__chunks/6HMPWUDT.js +0 -57
- package/esm/__chunks/6PEWNRTN.js +0 -1491
|
@@ -3,27 +3,10 @@ import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
|
3
3
|
import type { SetState } from "../utils/types.js";
|
|
4
4
|
type BasePlacement = "top" | "bottom" | "left" | "right";
|
|
5
5
|
type Placement = BasePlacement | `${BasePlacement}-start` | `${BasePlacement}-end`;
|
|
6
|
-
type AnchorRect = {
|
|
7
|
-
x?: number;
|
|
8
|
-
y?: number;
|
|
9
|
-
width?: number;
|
|
10
|
-
height?: number;
|
|
11
|
-
};
|
|
12
6
|
/**
|
|
13
7
|
* Creates a popover store.
|
|
14
8
|
*/
|
|
15
|
-
export declare function createPopoverStore({
|
|
16
|
-
export interface PopoverStoreRenderCallbackProps extends Pick<PopoverStoreState, "anchorElement" | "popoverElement" | "arrowElement" | "mounted" | "placement" | "fixed" | "gutter" | "shift" | "overlap" | "flip" | "sameWidth" | "fitViewport" | "arrowPadding" | "overflowPadding"> {
|
|
17
|
-
/**
|
|
18
|
-
* A method that updates the `currentPlacement` state.
|
|
19
|
-
*/
|
|
20
|
-
setPlacement: SetState<Placement>;
|
|
21
|
-
/**
|
|
22
|
-
* The default render callback that will be called when the `renderCallback`
|
|
23
|
-
* prop is not provided.
|
|
24
|
-
*/
|
|
25
|
-
defaultRenderCallback: () => () => void;
|
|
26
|
-
}
|
|
9
|
+
export declare function createPopoverStore({ popover: otherPopover, ...props }?: PopoverStoreProps): PopoverStore;
|
|
27
10
|
export interface PopoverStoreState extends DialogStoreState {
|
|
28
11
|
/**
|
|
29
12
|
* The anchor element.
|
|
@@ -49,64 +32,10 @@ export interface PopoverStoreState extends DialogStoreState {
|
|
|
49
32
|
*/
|
|
50
33
|
placement: Placement;
|
|
51
34
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
fixed: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* The distance between the popover and the anchor element. By default, it's 0
|
|
58
|
-
* plus half of the arrow offset, if it exists.
|
|
35
|
+
* A symbol that's used to recompute the popover position when the `render`
|
|
36
|
+
* method is called.
|
|
59
37
|
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The skidding of the popover along the anchor element.
|
|
63
|
-
* @default 0
|
|
64
|
-
*/
|
|
65
|
-
shift: number;
|
|
66
|
-
/**
|
|
67
|
-
* Controls the behavior of the popover when it overflows the viewport:
|
|
68
|
-
* - If a `boolean`, specifies whether the popover should flip to the
|
|
69
|
-
* opposite side when it overflows.
|
|
70
|
-
* - If a `string`, indicates the preferred fallback placements when it
|
|
71
|
-
* overflows. The placements must be spaced-delimited, e.g. "top left".
|
|
72
|
-
* @default true
|
|
73
|
-
*/
|
|
74
|
-
flip: boolean | string;
|
|
75
|
-
/**
|
|
76
|
-
* Whether the popover should slide when it overflows.
|
|
77
|
-
* @default true
|
|
78
|
-
*/
|
|
79
|
-
slide: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Whether the popover can overlap the anchor element when it overflows.
|
|
82
|
-
* @default false
|
|
83
|
-
*/
|
|
84
|
-
overlap: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Whether the popover should have the same width as the anchor element. This
|
|
87
|
-
* will be exposed to CSS as `--popover-anchor-width`.
|
|
88
|
-
* @default false
|
|
89
|
-
*/
|
|
90
|
-
sameWidth: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Whether the popover should fit the viewport. If this is set to true, the
|
|
93
|
-
* popover wrapper will have `maxWidth` and `maxHeight` set to the viewport
|
|
94
|
-
* size. This will be exposed to CSS as `--popover-available-width` and
|
|
95
|
-
* `--popover-available-height`.
|
|
96
|
-
* @default false
|
|
97
|
-
*/
|
|
98
|
-
fitViewport: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* The minimum padding between the arrow and the popover corner.
|
|
101
|
-
* @default 4
|
|
102
|
-
*/
|
|
103
|
-
arrowPadding: number;
|
|
104
|
-
/**
|
|
105
|
-
* The minimum padding between the popover and the viewport edge. This will be
|
|
106
|
-
* exposed to CSS as `--popover-overflow-padding`.
|
|
107
|
-
* @default 8
|
|
108
|
-
*/
|
|
109
|
-
overflowPadding: number;
|
|
38
|
+
rendered: symbol;
|
|
110
39
|
}
|
|
111
40
|
export interface PopoverStoreFunctions extends DialogStoreFunctions {
|
|
112
41
|
/**
|
|
@@ -122,23 +51,13 @@ export interface PopoverStoreFunctions extends DialogStoreFunctions {
|
|
|
122
51
|
*/
|
|
123
52
|
setArrowElement: SetState<PopoverStoreState["arrowElement"]>;
|
|
124
53
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*/
|
|
129
|
-
getAnchorRect?: (anchor: HTMLElement | null) => AnchorRect | null;
|
|
130
|
-
/**
|
|
131
|
-
* A function that will be called when the popover needs to calculate its
|
|
132
|
-
* styles. It will override the internal behavior.
|
|
133
|
-
*/
|
|
134
|
-
renderCallback?: (props: PopoverStoreRenderCallbackProps) => void | (() => void);
|
|
135
|
-
/**
|
|
136
|
-
* A function that can be used to recompute the popover styles. This is useful
|
|
137
|
-
* when the popover anchor changes in a way that affects the popover position.
|
|
54
|
+
* A function that can be used to recompute the popover position. This is
|
|
55
|
+
* useful when the popover anchor changes in a way that affects the popover
|
|
56
|
+
* position.
|
|
138
57
|
*/
|
|
139
58
|
render: () => void;
|
|
140
59
|
}
|
|
141
|
-
export interface PopoverStoreOptions extends StoreOptions<PopoverStoreState, "placement"
|
|
60
|
+
export interface PopoverStoreOptions extends StoreOptions<PopoverStoreState, "placement">, DialogStoreOptions {
|
|
142
61
|
/**
|
|
143
62
|
* A reference to another popover store that's controlling another popover to
|
|
144
63
|
* keep them in sync.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPopoverStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/Z5IDQSMV.js";
|
|
4
|
+
import "../__chunks/MNNKHNLW.js";
|
|
5
|
+
import "../__chunks/ZV2GEGPL.js";
|
|
6
|
+
import "../__chunks/BOKMNDR7.js";
|
|
7
|
+
import "../__chunks/NWU4GBZ6.js";
|
|
8
|
+
import "../__chunks/4BKCJXBM.js";
|
|
8
9
|
export {
|
|
9
10
|
createPopoverStore
|
|
10
11
|
};
|
package/esm/radio/radio-store.js
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompositeStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/R6VHFWTV.js";
|
|
4
|
+
import "../__chunks/EWHSN7GO.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore
|
|
7
|
-
} from "../__chunks/
|
|
7
|
+
} from "../__chunks/BOKMNDR7.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultValue
|
|
10
|
-
} from "../__chunks/
|
|
11
|
-
import "../__chunks/
|
|
10
|
+
} from "../__chunks/NWU4GBZ6.js";
|
|
11
|
+
import "../__chunks/N6JW4ITM.js";
|
|
12
12
|
import "../__chunks/5XEKIOCW.js";
|
|
13
|
+
import {
|
|
14
|
+
__objRest,
|
|
15
|
+
__spreadProps,
|
|
16
|
+
__spreadValues
|
|
17
|
+
} from "../__chunks/4BKCJXBM.js";
|
|
13
18
|
|
|
14
19
|
// src/radio/radio-store.ts
|
|
15
|
-
function createRadioStore({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const syncState = props.store
|
|
19
|
-
const composite = createCompositeStore({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
const initialState = {
|
|
24
|
-
...composite.getState(),
|
|
20
|
+
function createRadioStore(_a = {}) {
|
|
21
|
+
var props = __objRest(_a, []);
|
|
22
|
+
var _a2;
|
|
23
|
+
const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
|
|
24
|
+
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
|
|
25
|
+
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
26
|
+
}));
|
|
27
|
+
const initialState = __spreadProps(__spreadValues({}, composite.getState()), {
|
|
25
28
|
value: defaultValue(
|
|
26
29
|
props.value,
|
|
27
|
-
syncState
|
|
30
|
+
syncState == null ? void 0 : syncState.value,
|
|
28
31
|
props.defaultValue,
|
|
29
32
|
null
|
|
30
33
|
)
|
|
31
|
-
};
|
|
34
|
+
});
|
|
32
35
|
const radio = createStore(initialState, composite, props.store);
|
|
33
|
-
return {
|
|
34
|
-
...composite,
|
|
35
|
-
...radio,
|
|
36
|
+
return __spreadProps(__spreadValues(__spreadValues({}, composite), radio), {
|
|
36
37
|
setValue: (value) => radio.setState("value", value)
|
|
37
|
-
};
|
|
38
|
+
});
|
|
38
39
|
}
|
|
39
40
|
export {
|
|
40
41
|
createRadioStore
|
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPopoverStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/Z5IDQSMV.js";
|
|
4
|
+
import "../__chunks/MNNKHNLW.js";
|
|
5
|
+
import "../__chunks/ZV2GEGPL.js";
|
|
6
6
|
import {
|
|
7
7
|
createCompositeStore
|
|
8
|
-
} from "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
8
|
+
} from "../__chunks/R6VHFWTV.js";
|
|
9
|
+
import "../__chunks/EWHSN7GO.js";
|
|
10
10
|
import {
|
|
11
11
|
createStore,
|
|
12
12
|
mergeStore
|
|
13
|
-
} from "../__chunks/
|
|
13
|
+
} from "../__chunks/BOKMNDR7.js";
|
|
14
14
|
import {
|
|
15
15
|
defaultValue
|
|
16
|
-
} from "../__chunks/
|
|
17
|
-
import "../__chunks/
|
|
16
|
+
} from "../__chunks/NWU4GBZ6.js";
|
|
17
|
+
import "../__chunks/N6JW4ITM.js";
|
|
18
18
|
import {
|
|
19
19
|
toArray
|
|
20
20
|
} from "../__chunks/5XEKIOCW.js";
|
|
21
|
+
import {
|
|
22
|
+
__objRest,
|
|
23
|
+
__spreadProps,
|
|
24
|
+
__spreadValues
|
|
25
|
+
} from "../__chunks/4BKCJXBM.js";
|
|
21
26
|
|
|
22
27
|
// src/select/select-store.ts
|
|
23
|
-
function createSelectStore({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} =
|
|
28
|
+
function createSelectStore(_a = {}) {
|
|
29
|
+
var _b = _a, {
|
|
30
|
+
combobox
|
|
31
|
+
} = _b, props = __objRest(_b, [
|
|
32
|
+
"combobox"
|
|
33
|
+
]);
|
|
27
34
|
const store = mergeStore(
|
|
28
35
|
props.store,
|
|
29
|
-
combobox
|
|
36
|
+
combobox == null ? void 0 : combobox.omit(
|
|
30
37
|
"value",
|
|
31
38
|
"items",
|
|
32
39
|
"renderedItems",
|
|
@@ -39,8 +46,7 @@ function createSelectStore({
|
|
|
39
46
|
)
|
|
40
47
|
);
|
|
41
48
|
const syncState = store.getState();
|
|
42
|
-
const composite = createCompositeStore({
|
|
43
|
-
...props,
|
|
49
|
+
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
|
|
44
50
|
store,
|
|
45
51
|
virtualFocus: defaultValue(
|
|
46
52
|
props.virtualFocus,
|
|
@@ -63,20 +69,17 @@ function createSelectStore({
|
|
|
63
69
|
syncState.orientation,
|
|
64
70
|
"vertical"
|
|
65
71
|
)
|
|
66
|
-
});
|
|
67
|
-
const popover = createPopoverStore({
|
|
68
|
-
...props,
|
|
72
|
+
}));
|
|
73
|
+
const popover = createPopoverStore(__spreadProps(__spreadValues({}, props), {
|
|
69
74
|
store,
|
|
70
75
|
placement: defaultValue(
|
|
71
76
|
props.placement,
|
|
72
77
|
syncState.placement,
|
|
73
78
|
"bottom-start"
|
|
74
79
|
)
|
|
75
|
-
});
|
|
80
|
+
}));
|
|
76
81
|
const initialValue = new String("");
|
|
77
|
-
const initialState = {
|
|
78
|
-
...composite.getState(),
|
|
79
|
-
...popover.getState(),
|
|
82
|
+
const initialState = __spreadProps(__spreadValues(__spreadValues({}, composite.getState()), popover.getState()), {
|
|
80
83
|
value: defaultValue(
|
|
81
84
|
props.value,
|
|
82
85
|
syncState.value,
|
|
@@ -90,7 +93,7 @@ function createSelectStore({
|
|
|
90
93
|
),
|
|
91
94
|
selectElement: defaultValue(syncState.selectElement, null),
|
|
92
95
|
labelElement: defaultValue(syncState.labelElement, null)
|
|
93
|
-
};
|
|
96
|
+
});
|
|
94
97
|
const select = createStore(initialState, composite, popover, store);
|
|
95
98
|
select.setup(
|
|
96
99
|
() => select.sync(
|
|
@@ -102,7 +105,7 @@ function createSelectStore({
|
|
|
102
105
|
const item = state.items.find(
|
|
103
106
|
(item2) => !item2.disabled && item2.value != null
|
|
104
107
|
);
|
|
105
|
-
if (item
|
|
108
|
+
if ((item == null ? void 0 : item.value) == null)
|
|
106
109
|
return;
|
|
107
110
|
select.setState("value", item.value);
|
|
108
111
|
},
|
|
@@ -150,14 +153,11 @@ function createSelectStore({
|
|
|
150
153
|
["setValueOnMove", "moves"]
|
|
151
154
|
)
|
|
152
155
|
);
|
|
153
|
-
return {
|
|
154
|
-
...composite,
|
|
155
|
-
...popover,
|
|
156
|
-
...select,
|
|
156
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, composite), popover), select), {
|
|
157
157
|
setValue: (value) => select.setState("value", value),
|
|
158
158
|
setSelectElement: (element) => select.setState("selectElement", element),
|
|
159
159
|
setLabelElement: (element) => select.setState("labelElement", element)
|
|
160
|
-
};
|
|
160
|
+
});
|
|
161
161
|
}
|
|
162
162
|
export {
|
|
163
163
|
createSelectStore
|
package/esm/tab/tab-store.d.ts
CHANGED
|
@@ -23,11 +23,17 @@ export interface TabStoreState extends CompositeStoreState<Item> {
|
|
|
23
23
|
/**
|
|
24
24
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
25
25
|
* will be automatically set to the first enabled tab.
|
|
26
|
+
*
|
|
27
|
+
* Live examples:
|
|
28
|
+
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
26
29
|
*/
|
|
27
30
|
selectedId: TabStoreState["activeId"];
|
|
28
31
|
/**
|
|
29
32
|
* Whether the tab should be selected when it receives focus. If it's set to
|
|
30
33
|
* `false`, the tab will be selected only when it's clicked.
|
|
34
|
+
*
|
|
35
|
+
* Live examples:
|
|
36
|
+
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
31
37
|
* @default true
|
|
32
38
|
*/
|
|
33
39
|
selectOnMove?: boolean;
|
|
@@ -36,6 +42,9 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<Item> {
|
|
|
36
42
|
/**
|
|
37
43
|
* Sets the `selectedId` state without moving focus. If you want to move focus,
|
|
38
44
|
* use the `select` function instead.
|
|
45
|
+
*
|
|
46
|
+
* Live examples:
|
|
47
|
+
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
39
48
|
* @example
|
|
40
49
|
* // Selects the tab with id "tab-1"
|
|
41
50
|
* store.setSelectedId("tab-1");
|
package/esm/tab/tab-store.js
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompositeStore
|
|
3
|
-
} from "../__chunks/
|
|
3
|
+
} from "../__chunks/R6VHFWTV.js";
|
|
4
4
|
import {
|
|
5
5
|
createCollectionStore
|
|
6
|
-
} from "../__chunks/
|
|
6
|
+
} from "../__chunks/EWHSN7GO.js";
|
|
7
7
|
import {
|
|
8
8
|
createStore
|
|
9
|
-
} from "../__chunks/
|
|
9
|
+
} from "../__chunks/BOKMNDR7.js";
|
|
10
10
|
import {
|
|
11
11
|
defaultValue
|
|
12
|
-
} from "../__chunks/
|
|
13
|
-
import "../__chunks/
|
|
12
|
+
} from "../__chunks/NWU4GBZ6.js";
|
|
13
|
+
import "../__chunks/N6JW4ITM.js";
|
|
14
14
|
import "../__chunks/5XEKIOCW.js";
|
|
15
|
+
import {
|
|
16
|
+
__spreadProps,
|
|
17
|
+
__spreadValues
|
|
18
|
+
} from "../__chunks/4BKCJXBM.js";
|
|
15
19
|
|
|
16
20
|
// src/tab/tab-store.ts
|
|
17
21
|
function createTabStore(props = {}) {
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
22
|
+
var _a;
|
|
23
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
24
|
+
const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
|
|
21
25
|
orientation: defaultValue(
|
|
22
26
|
props.orientation,
|
|
23
|
-
syncState
|
|
27
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
24
28
|
"horizontal"
|
|
25
29
|
),
|
|
26
|
-
focusLoop: defaultValue(props.focusLoop, syncState
|
|
27
|
-
});
|
|
30
|
+
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
31
|
+
}));
|
|
28
32
|
const panels = createCollectionStore();
|
|
29
|
-
const initialState = {
|
|
30
|
-
...composite.getState(),
|
|
33
|
+
const initialState = __spreadProps(__spreadValues({}, composite.getState()), {
|
|
31
34
|
selectedId: defaultValue(
|
|
32
35
|
props.selectedId,
|
|
33
|
-
syncState
|
|
36
|
+
syncState == null ? void 0 : syncState.selectedId,
|
|
34
37
|
props.defaultSelectedId,
|
|
35
38
|
void 0
|
|
36
39
|
),
|
|
37
40
|
selectOnMove: defaultValue(
|
|
38
41
|
props.selectOnMove,
|
|
39
|
-
syncState
|
|
42
|
+
syncState == null ? void 0 : syncState.selectOnMove,
|
|
40
43
|
true
|
|
41
44
|
)
|
|
42
|
-
};
|
|
45
|
+
});
|
|
43
46
|
const tab = createStore(initialState, composite, props.store);
|
|
44
47
|
tab.setup(
|
|
45
48
|
() => tab.sync(() => {
|
|
@@ -77,7 +80,7 @@ function createTabStore(props = {}) {
|
|
|
77
80
|
const tabItem2 = renderedItems.find(
|
|
78
81
|
(item) => !item.disabled && !item.dimmed
|
|
79
82
|
);
|
|
80
|
-
tab.setState("selectedId", tabItem2
|
|
83
|
+
tab.setState("selectedId", tabItem2 == null ? void 0 : tabItem2.id);
|
|
81
84
|
}
|
|
82
85
|
},
|
|
83
86
|
["selectedId", "renderedItems"]
|
|
@@ -101,7 +104,7 @@ function createTabStore(props = {}) {
|
|
|
101
104
|
const tabItem = tabs[i];
|
|
102
105
|
if (!tabItem)
|
|
103
106
|
return;
|
|
104
|
-
panels.renderItem({
|
|
107
|
+
panels.renderItem(__spreadProps(__spreadValues({}, panel), { tabId: tabItem.id }));
|
|
105
108
|
});
|
|
106
109
|
},
|
|
107
110
|
["renderedItems"]
|
|
@@ -110,16 +113,14 @@ function createTabStore(props = {}) {
|
|
|
110
113
|
["renderedItems"]
|
|
111
114
|
)
|
|
112
115
|
);
|
|
113
|
-
return {
|
|
114
|
-
...composite,
|
|
115
|
-
...tab,
|
|
116
|
+
return __spreadProps(__spreadValues(__spreadValues({}, composite), tab), {
|
|
116
117
|
panels,
|
|
117
118
|
setSelectedId: (id) => tab.setState("selectedId", id),
|
|
118
119
|
select: (id) => {
|
|
119
120
|
tab.setState("selectedId", id);
|
|
120
121
|
composite.move(id);
|
|
121
122
|
}
|
|
122
|
-
};
|
|
123
|
+
});
|
|
123
124
|
}
|
|
124
125
|
export {
|
|
125
126
|
createTabStore
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompositeStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/R6VHFWTV.js";
|
|
4
|
+
import "../__chunks/EWHSN7GO.js";
|
|
5
|
+
import "../__chunks/BOKMNDR7.js";
|
|
6
6
|
import {
|
|
7
7
|
defaultValue
|
|
8
|
-
} from "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
8
|
+
} from "../__chunks/NWU4GBZ6.js";
|
|
9
|
+
import "../__chunks/N6JW4ITM.js";
|
|
10
10
|
import "../__chunks/5XEKIOCW.js";
|
|
11
|
+
import {
|
|
12
|
+
__spreadProps,
|
|
13
|
+
__spreadValues
|
|
14
|
+
} from "../__chunks/4BKCJXBM.js";
|
|
11
15
|
|
|
12
16
|
// src/toolbar/toolbar-store.ts
|
|
13
17
|
function createToolbarStore(props = {}) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
var _a;
|
|
19
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
+
return createCompositeStore(__spreadProps(__spreadValues({}, props), {
|
|
17
21
|
orientation: defaultValue(
|
|
18
22
|
props.orientation,
|
|
19
|
-
syncState
|
|
23
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
20
24
|
"horizontal"
|
|
21
25
|
),
|
|
22
|
-
focusLoop: defaultValue(props.focusLoop, syncState
|
|
23
|
-
});
|
|
26
|
+
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
27
|
+
}));
|
|
24
28
|
}
|
|
25
29
|
export {
|
|
26
30
|
createToolbarStore
|
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
|
|
2
2
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a tooltip store.
|
|
5
5
|
*/
|
|
6
6
|
export declare function createTooltipStore(props?: TooltipStoreProps): TooltipStore;
|
|
7
|
-
export interface TooltipStoreState extends
|
|
7
|
+
export interface TooltipStoreState extends HovercardStoreState {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Determines whether the tooltip is being used as a label or a description
|
|
10
|
+
* for the anchor element.
|
|
11
|
+
* @default "description"
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
type: "label" | "description";
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
15
|
+
* The amount of time after a tooltip is hidden while all tooltips on the
|
|
16
|
+
* page can be shown immediately, without waiting for the show timeout.
|
|
17
|
+
* @default 300
|
|
14
18
|
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
skipTimeout: number;
|
|
20
|
+
/** @default "top" */
|
|
21
|
+
placement: HovercardStoreState["placement"];
|
|
22
|
+
/** @default 0 */
|
|
23
|
+
timeout: HovercardStoreState["timeout"];
|
|
24
|
+
/** @default 500 */
|
|
25
|
+
showTimeout: HovercardStoreState["showTimeout"];
|
|
26
|
+
/** @default 0 */
|
|
27
|
+
hideTimeout: HovercardStoreState["hideTimeout"];
|
|
23
28
|
}
|
|
24
|
-
export type TooltipStoreFunctions =
|
|
25
|
-
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "
|
|
29
|
+
export type TooltipStoreFunctions = HovercardStoreFunctions;
|
|
30
|
+
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout">, HovercardStoreOptions {
|
|
26
31
|
}
|
|
27
32
|
export type TooltipStoreProps = TooltipStoreOptions & StoreProps<TooltipStoreState>;
|
|
28
33
|
export type TooltipStore = TooltipStoreFunctions & Store<TooltipStoreState>;
|