@ariakit/core 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -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/{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/LBTLD2RB.cjs +58 -0
- package/cjs/__chunks/{QNEPGQLL.cjs → M6ZA7XUP.cjs} +6 -2
- package/cjs/__chunks/{HLVPXX7H.cjs → SDBF6KIY.cjs} +107 -107
- package/cjs/__chunks/{OFNGELMA.cjs → ZNW4LSWU.cjs} +8 -6
- package/cjs/checkbox/checkbox-store.cjs +14 -10
- package/cjs/checkbox/checkbox-store.d.ts +7 -0
- package/cjs/collection/collection-store.cjs +6 -5
- package/cjs/combobox/combobox-store.cjs +49 -48
- package/cjs/combobox/combobox-store.d.ts +24 -0
- package/cjs/composite/composite-overflow-store.cjs +7 -6
- package/cjs/composite/composite-store.cjs +7 -6
- package/cjs/composite/composite-store.d.ts +38 -34
- package/cjs/dialog/dialog-store.cjs +6 -5
- package/cjs/disclosure/disclosure-store.cjs +5 -4
- package/cjs/disclosure/disclosure-store.d.ts +36 -6
- package/cjs/form/form-store.cjs +38 -35
- package/cjs/hovercard/hovercard-store.cjs +8 -7
- 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/radio/radio-store.cjs +25 -24
- package/cjs/select/select-store.cjs +42 -42
- package/cjs/select/select-store.d.ts +16 -0
- 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 +24 -25
- 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/4BKCJXBM.js +37 -0
- package/esm/__chunks/AHZW5LR4.js +58 -0
- package/esm/__chunks/{NA5BK7DD.js → BOKMNDR7.js} +22 -10
- package/esm/__chunks/{6PEWNRTN.js → CUW3E24J.js} +100 -100
- 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/{IOAGNCXX.js → ZV2GEGPL.js} +14 -10
- package/esm/checkbox/checkbox-store.d.ts +7 -0
- package/esm/checkbox/checkbox-store.js +11 -7
- package/esm/collection/collection-store.js +5 -4
- package/esm/combobox/combobox-store.d.ts +24 -0
- package/esm/combobox/combobox-store.js +34 -33
- package/esm/composite/composite-overflow-store.js +6 -5
- package/esm/composite/composite-store.d.ts +38 -34
- package/esm/composite/composite-store.js +6 -5
- package/esm/dialog/dialog-store.js +5 -4
- package/esm/disclosure/disclosure-store.d.ts +36 -6
- package/esm/disclosure/disclosure-store.js +4 -3
- package/esm/form/form-store.js +24 -21
- 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.js +6 -5
- package/esm/radio/radio-store.js +22 -21
- package/esm/select/select-store.d.ts +16 -0
- 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.js +20 -21
- 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/esm/__chunks/6HMPWUDT.js +0 -57
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _SDBF6KIYcjs = require('./SDBF6KIY.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _6SPJEESBcjs = require('./6SPJEESB.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _6455U47Tcjs = require('./6455U47T.cjs');
|
|
14
|
+
|
|
15
|
+
// src/hovercard/hovercard-store.ts
|
|
16
|
+
function createHovercardStore(props = {}) {
|
|
17
|
+
var _a;
|
|
18
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
19
|
+
const timeout = _M6ZA7XUPcjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
|
|
20
|
+
const popover = _SDBF6KIYcjs.createPopoverStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
|
+
placement: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
22
|
+
props.placement,
|
|
23
|
+
syncState == null ? void 0 : syncState.placement,
|
|
24
|
+
"bottom"
|
|
25
|
+
)
|
|
26
|
+
}));
|
|
27
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, popover.getState()), {
|
|
28
|
+
timeout,
|
|
29
|
+
showTimeout: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
30
|
+
props.showTimeout,
|
|
31
|
+
syncState == null ? void 0 : syncState.showTimeout,
|
|
32
|
+
timeout
|
|
33
|
+
),
|
|
34
|
+
hideTimeout: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
35
|
+
props.hideTimeout,
|
|
36
|
+
syncState == null ? void 0 : syncState.hideTimeout,
|
|
37
|
+
timeout
|
|
38
|
+
),
|
|
39
|
+
autoFocusOnShow: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
40
|
+
});
|
|
41
|
+
const hovercard = _6SPJEESBcjs.createStore.call(void 0, initialState, popover, props.store);
|
|
42
|
+
hovercard.setup(
|
|
43
|
+
() => hovercard.sync(
|
|
44
|
+
(state) => {
|
|
45
|
+
hovercard.setState("showTimeout", (value) => value != null ? value : state.timeout);
|
|
46
|
+
hovercard.setState("hideTimeout", (value) => value != null ? value : state.timeout);
|
|
47
|
+
},
|
|
48
|
+
["timeout"]
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
|
|
52
|
+
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
exports.createHovercardStore = createHovercardStore;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _6455U47Tcjs = require('./6455U47T.cjs');
|
|
4
|
+
|
|
5
|
+
// src/utils/misc.ts
|
|
2
6
|
function noop(..._) {
|
|
3
7
|
}
|
|
4
8
|
function shallowEqual(a, b) {
|
|
@@ -76,7 +80,7 @@ function normalizeString(str) {
|
|
|
76
80
|
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
77
81
|
}
|
|
78
82
|
function omit(object, keys) {
|
|
79
|
-
const result = {
|
|
83
|
+
const result = _6455U47Tcjs.__spreadValues.call(void 0, {}, object);
|
|
80
84
|
for (const key of keys) {
|
|
81
85
|
if (hasOwnProperty(result, key)) {
|
|
82
86
|
delete result[key];
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _HEFJPUYDcjs = require('./HEFJPUYD.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _6SPJEESBcjs = require('./6SPJEESB.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _6455U47Tcjs = require('./6455U47T.cjs');
|
|
11
16
|
|
|
12
17
|
// ../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
13
18
|
function getAlignment(placement) {
|
|
@@ -123,13 +128,9 @@ var computePosition = async (reference, floating, config) => {
|
|
|
123
128
|
});
|
|
124
129
|
x = nextX != null ? nextX : x;
|
|
125
130
|
y = nextY != null ? nextY : y;
|
|
126
|
-
middlewareData = {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
...middlewareData[name],
|
|
130
|
-
...data
|
|
131
|
-
}
|
|
132
|
-
};
|
|
131
|
+
middlewareData = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, middlewareData), {
|
|
132
|
+
[name]: _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, middlewareData[name]), data)
|
|
133
|
+
});
|
|
133
134
|
if (reset && resetCount <= 50) {
|
|
134
135
|
resetCount++;
|
|
135
136
|
if (typeof reset === "object") {
|
|
@@ -161,13 +162,12 @@ var computePosition = async (reference, floating, config) => {
|
|
|
161
162
|
};
|
|
162
163
|
};
|
|
163
164
|
function expandPaddingObject(padding) {
|
|
164
|
-
return {
|
|
165
|
+
return _6455U47Tcjs.__spreadValues.call(void 0, {
|
|
165
166
|
top: 0,
|
|
166
167
|
right: 0,
|
|
167
168
|
bottom: 0,
|
|
168
|
-
left: 0
|
|
169
|
-
|
|
170
|
-
};
|
|
169
|
+
left: 0
|
|
170
|
+
}, padding);
|
|
171
171
|
}
|
|
172
172
|
function getSideObjectFromPadding(padding) {
|
|
173
173
|
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
@@ -178,13 +178,12 @@ function getSideObjectFromPadding(padding) {
|
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
function rectToClientRect(rect) {
|
|
181
|
-
return {
|
|
182
|
-
...rect,
|
|
181
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, rect), {
|
|
183
182
|
top: rect.y,
|
|
184
183
|
left: rect.x,
|
|
185
184
|
right: rect.x + rect.width,
|
|
186
185
|
bottom: rect.y + rect.height
|
|
187
|
-
};
|
|
186
|
+
});
|
|
188
187
|
}
|
|
189
188
|
async function detectOverflow(state, options) {
|
|
190
189
|
var _await$platform$isEle;
|
|
@@ -215,11 +214,10 @@ async function detectOverflow(state, options) {
|
|
|
215
214
|
rootBoundary,
|
|
216
215
|
strategy
|
|
217
216
|
}));
|
|
218
|
-
const rect = elementContext === "floating" ? {
|
|
219
|
-
...rects.floating,
|
|
217
|
+
const rect = elementContext === "floating" ? _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, rects.floating), {
|
|
220
218
|
x,
|
|
221
219
|
y
|
|
222
|
-
} : rects.reference;
|
|
220
|
+
}) : rects.reference;
|
|
223
221
|
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
224
222
|
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
225
223
|
x: 1,
|
|
@@ -381,15 +379,21 @@ var flip = function(options) {
|
|
|
381
379
|
platform: platform2,
|
|
382
380
|
elements
|
|
383
381
|
} = state;
|
|
384
|
-
const {
|
|
382
|
+
const _a = options, {
|
|
385
383
|
mainAxis: checkMainAxis = true,
|
|
386
384
|
crossAxis: checkCrossAxis = true,
|
|
387
385
|
fallbackPlacements: specifiedFallbackPlacements,
|
|
388
386
|
fallbackStrategy = "bestFit",
|
|
389
387
|
fallbackAxisSideDirection = "none",
|
|
390
|
-
flipAlignment = true
|
|
391
|
-
|
|
392
|
-
|
|
388
|
+
flipAlignment = true
|
|
389
|
+
} = _a, detectOverflowOptions = _6455U47Tcjs.__objRest.call(void 0, _a, [
|
|
390
|
+
"mainAxis",
|
|
391
|
+
"crossAxis",
|
|
392
|
+
"fallbackPlacements",
|
|
393
|
+
"fallbackStrategy",
|
|
394
|
+
"fallbackAxisSideDirection",
|
|
395
|
+
"flipAlignment"
|
|
396
|
+
]);
|
|
393
397
|
const side = getSide(placement);
|
|
394
398
|
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
395
399
|
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
@@ -479,12 +483,11 @@ async function convertValueToCoords(state, value) {
|
|
|
479
483
|
mainAxis: rawValue,
|
|
480
484
|
crossAxis: 0,
|
|
481
485
|
alignmentAxis: null
|
|
482
|
-
} : {
|
|
486
|
+
} : _6455U47Tcjs.__spreadValues.call(void 0, {
|
|
483
487
|
mainAxis: 0,
|
|
484
488
|
crossAxis: 0,
|
|
485
|
-
alignmentAxis: null
|
|
486
|
-
|
|
487
|
-
};
|
|
489
|
+
alignmentAxis: null
|
|
490
|
+
}, rawValue);
|
|
488
491
|
if (alignment && typeof alignmentAxis === "number") {
|
|
489
492
|
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
490
493
|
}
|
|
@@ -533,7 +536,7 @@ var shift = function(options) {
|
|
|
533
536
|
y,
|
|
534
537
|
placement
|
|
535
538
|
} = state;
|
|
536
|
-
const {
|
|
539
|
+
const _a = options, {
|
|
537
540
|
mainAxis: checkMainAxis = true,
|
|
538
541
|
crossAxis: checkCrossAxis = false,
|
|
539
542
|
limiter = {
|
|
@@ -547,9 +550,12 @@ var shift = function(options) {
|
|
|
547
550
|
y: y2
|
|
548
551
|
};
|
|
549
552
|
}
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
+
}
|
|
554
|
+
} = _a, detectOverflowOptions = _6455U47Tcjs.__objRest.call(void 0, _a, [
|
|
555
|
+
"mainAxis",
|
|
556
|
+
"crossAxis",
|
|
557
|
+
"limiter"
|
|
558
|
+
]);
|
|
553
559
|
const coords = {
|
|
554
560
|
x,
|
|
555
561
|
y
|
|
@@ -573,18 +579,16 @@ var shift = function(options) {
|
|
|
573
579
|
const max3 = crossAxisCoord - overflow[maxSide];
|
|
574
580
|
crossAxisCoord = within(min3, crossAxisCoord, max3);
|
|
575
581
|
}
|
|
576
|
-
const limitedCoords = limiter.fn({
|
|
577
|
-
...state,
|
|
582
|
+
const limitedCoords = limiter.fn(_6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, state), {
|
|
578
583
|
[mainAxis]: mainAxisCoord,
|
|
579
584
|
[crossAxis]: crossAxisCoord
|
|
580
|
-
});
|
|
581
|
-
return {
|
|
582
|
-
...limitedCoords,
|
|
585
|
+
}));
|
|
586
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, limitedCoords), {
|
|
583
587
|
data: {
|
|
584
588
|
x: limitedCoords.x - x,
|
|
585
589
|
y: limitedCoords.y - y
|
|
586
590
|
}
|
|
587
|
-
};
|
|
591
|
+
});
|
|
588
592
|
}
|
|
589
593
|
};
|
|
590
594
|
};
|
|
@@ -602,11 +606,12 @@ var size = function(options) {
|
|
|
602
606
|
platform: platform2,
|
|
603
607
|
elements
|
|
604
608
|
} = state;
|
|
605
|
-
const {
|
|
609
|
+
const _a = options, {
|
|
606
610
|
apply = () => {
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
|
|
611
|
+
}
|
|
612
|
+
} = _a, detectOverflowOptions = _6455U47Tcjs.__objRest.call(void 0, _a, [
|
|
613
|
+
"apply"
|
|
614
|
+
]);
|
|
610
615
|
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
611
616
|
const side = getSide(placement);
|
|
612
617
|
const alignment = getAlignment(placement);
|
|
@@ -648,11 +653,10 @@ var size = function(options) {
|
|
|
648
653
|
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
649
654
|
}
|
|
650
655
|
}
|
|
651
|
-
await apply({
|
|
652
|
-
...state,
|
|
656
|
+
await apply(_6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, state), {
|
|
653
657
|
availableWidth,
|
|
654
658
|
availableHeight
|
|
655
|
-
});
|
|
659
|
+
}));
|
|
656
660
|
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
657
661
|
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
658
662
|
return {
|
|
@@ -1001,9 +1005,7 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1001
1005
|
} else if (isElement(clippingAncestor)) {
|
|
1002
1006
|
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1003
1007
|
} else {
|
|
1004
|
-
const mutableRect = {
|
|
1005
|
-
...clippingAncestor
|
|
1006
|
-
};
|
|
1008
|
+
const mutableRect = _6455U47Tcjs.__spreadValues.call(void 0, {}, clippingAncestor);
|
|
1007
1009
|
if (isClientRectVisualViewportBased()) {
|
|
1008
1010
|
var _win$visualViewport, _win$visualViewport2;
|
|
1009
1011
|
const win = getWindow(element);
|
|
@@ -1151,11 +1153,10 @@ var platform = {
|
|
|
1151
1153
|
const getDimensionsFn = this.getDimensions;
|
|
1152
1154
|
return {
|
|
1153
1155
|
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
1154
|
-
floating: {
|
|
1156
|
+
floating: _6455U47Tcjs.__spreadValues.call(void 0, {
|
|
1155
1157
|
x: 0,
|
|
1156
|
-
y: 0
|
|
1157
|
-
|
|
1158
|
-
}
|
|
1158
|
+
y: 0
|
|
1159
|
+
}, await getDimensionsFn(floating))
|
|
1159
1160
|
};
|
|
1160
1161
|
},
|
|
1161
1162
|
getClientRects: (element) => Array.from(element.getClientRects()),
|
|
@@ -1219,18 +1220,15 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1219
1220
|
}
|
|
1220
1221
|
var computePosition2 = (reference, floating, options) => {
|
|
1221
1222
|
const cache = /* @__PURE__ */ new Map();
|
|
1222
|
-
const mergedOptions = {
|
|
1223
|
-
platform
|
|
1224
|
-
|
|
1225
|
-
}
|
|
1226
|
-
const platformWithCache = {
|
|
1227
|
-
...mergedOptions.platform,
|
|
1223
|
+
const mergedOptions = _6455U47Tcjs.__spreadValues.call(void 0, {
|
|
1224
|
+
platform
|
|
1225
|
+
}, options);
|
|
1226
|
+
const platformWithCache = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, mergedOptions.platform), {
|
|
1228
1227
|
_c: cache
|
|
1229
|
-
};
|
|
1230
|
-
return computePosition(reference, floating, {
|
|
1231
|
-
...mergedOptions,
|
|
1232
|
-
platform: platformWithCache
|
|
1233
1228
|
});
|
|
1229
|
+
return computePosition(reference, floating, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, mergedOptions), {
|
|
1230
|
+
platform: platformWithCache
|
|
1231
|
+
}));
|
|
1234
1232
|
};
|
|
1235
1233
|
|
|
1236
1234
|
// src/popover/popover-store.ts
|
|
@@ -1249,7 +1247,7 @@ function createDOMRect(x = 0, y = 0, width = 0, height = 0) {
|
|
|
1249
1247
|
bottom: y + height,
|
|
1250
1248
|
left: x
|
|
1251
1249
|
};
|
|
1252
|
-
return {
|
|
1250
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, rect), { toJSON: () => rect });
|
|
1253
1251
|
}
|
|
1254
1252
|
function getDOMRect(anchorRect) {
|
|
1255
1253
|
if (!anchorRect)
|
|
@@ -1263,7 +1261,7 @@ function getAnchorElement(anchorElement, getAnchorRect) {
|
|
|
1263
1261
|
contextElement,
|
|
1264
1262
|
getBoundingClientRect: () => {
|
|
1265
1263
|
const anchor = anchorElement;
|
|
1266
|
-
const anchorRect =
|
|
1264
|
+
const anchorRect = getAnchorRect == null ? void 0 : getAnchorRect(anchor);
|
|
1267
1265
|
if (anchorRect || !anchor) {
|
|
1268
1266
|
return getDOMRect(anchorRect);
|
|
1269
1267
|
}
|
|
@@ -1274,53 +1272,56 @@ function getAnchorElement(anchorElement, getAnchorRect) {
|
|
|
1274
1272
|
function isValidPlacement(flip2) {
|
|
1275
1273
|
return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(flip2);
|
|
1276
1274
|
}
|
|
1277
|
-
function createPopoverStore({
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
} =
|
|
1283
|
-
|
|
1275
|
+
function createPopoverStore(_a = {}) {
|
|
1276
|
+
var _b = _a, {
|
|
1277
|
+
getAnchorRect,
|
|
1278
|
+
renderCallback,
|
|
1279
|
+
popover: otherPopover
|
|
1280
|
+
} = _b, props = _6455U47Tcjs.__objRest.call(void 0, _b, [
|
|
1281
|
+
"getAnchorRect",
|
|
1282
|
+
"renderCallback",
|
|
1283
|
+
"popover"
|
|
1284
|
+
]);
|
|
1285
|
+
const store = _6SPJEESBcjs.mergeStore.call(void 0,
|
|
1284
1286
|
props.store,
|
|
1285
|
-
|
|
1287
|
+
otherPopover == null ? void 0 : otherPopover.omit(
|
|
1286
1288
|
"arrowElement",
|
|
1287
1289
|
"anchorElement",
|
|
1288
1290
|
"contentElement",
|
|
1289
1291
|
"popoverElement",
|
|
1290
1292
|
"disclosureElement"
|
|
1291
|
-
)
|
|
1293
|
+
)
|
|
1292
1294
|
);
|
|
1293
|
-
const syncState =
|
|
1294
|
-
const rendered =
|
|
1295
|
-
const dialog =
|
|
1296
|
-
const placement =
|
|
1295
|
+
const syncState = store == null ? void 0 : store.getState();
|
|
1296
|
+
const rendered = _6SPJEESBcjs.createStore.call(void 0, { rendered: [] });
|
|
1297
|
+
const dialog = _HEFJPUYDcjs.createDialogStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), { store }));
|
|
1298
|
+
const placement = _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
1297
1299
|
props.placement,
|
|
1298
|
-
|
|
1300
|
+
syncState == null ? void 0 : syncState.placement,
|
|
1299
1301
|
"bottom"
|
|
1300
1302
|
);
|
|
1301
|
-
const initialState = {
|
|
1302
|
-
...dialog.getState(),
|
|
1303
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
|
|
1303
1304
|
placement,
|
|
1304
1305
|
currentPlacement: placement,
|
|
1305
|
-
fixed:
|
|
1306
|
-
gutter:
|
|
1307
|
-
flip:
|
|
1308
|
-
shift:
|
|
1309
|
-
slide:
|
|
1310
|
-
overlap:
|
|
1311
|
-
sameWidth:
|
|
1312
|
-
fitViewport:
|
|
1313
|
-
arrowPadding:
|
|
1314
|
-
overflowPadding:
|
|
1306
|
+
fixed: _M6ZA7XUPcjs.defaultValue.call(void 0, props.fixed, syncState == null ? void 0 : syncState.fixed, false),
|
|
1307
|
+
gutter: _M6ZA7XUPcjs.defaultValue.call(void 0, props.gutter, syncState == null ? void 0 : syncState.gutter),
|
|
1308
|
+
flip: _M6ZA7XUPcjs.defaultValue.call(void 0, props.flip, syncState == null ? void 0 : syncState.flip, true),
|
|
1309
|
+
shift: _M6ZA7XUPcjs.defaultValue.call(void 0, props.shift, syncState == null ? void 0 : syncState.shift, 0),
|
|
1310
|
+
slide: _M6ZA7XUPcjs.defaultValue.call(void 0, props.slide, syncState == null ? void 0 : syncState.slide, true),
|
|
1311
|
+
overlap: _M6ZA7XUPcjs.defaultValue.call(void 0, props.overlap, syncState == null ? void 0 : syncState.overlap, false),
|
|
1312
|
+
sameWidth: _M6ZA7XUPcjs.defaultValue.call(void 0, props.sameWidth, syncState == null ? void 0 : syncState.sameWidth, false),
|
|
1313
|
+
fitViewport: _M6ZA7XUPcjs.defaultValue.call(void 0, props.fitViewport, syncState == null ? void 0 : syncState.fitViewport, false),
|
|
1314
|
+
arrowPadding: _M6ZA7XUPcjs.defaultValue.call(void 0, props.arrowPadding, syncState == null ? void 0 : syncState.arrowPadding, 4),
|
|
1315
|
+
overflowPadding: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
1315
1316
|
props.overflowPadding,
|
|
1316
|
-
|
|
1317
|
+
syncState == null ? void 0 : syncState.overflowPadding,
|
|
1317
1318
|
8
|
|
1318
1319
|
),
|
|
1319
|
-
anchorElement:
|
|
1320
|
-
popoverElement:
|
|
1321
|
-
arrowElement:
|
|
1322
|
-
};
|
|
1323
|
-
const popover =
|
|
1320
|
+
anchorElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
|
|
1321
|
+
popoverElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
|
|
1322
|
+
arrowElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null)
|
|
1323
|
+
});
|
|
1324
|
+
const popover = _6SPJEESBcjs.createStore.call(void 0, initialState, dialog, store);
|
|
1324
1325
|
const setCurrentPlacement = (placement2) => {
|
|
1325
1326
|
popover.setState("currentPlacement", placement2);
|
|
1326
1327
|
};
|
|
@@ -1328,7 +1329,8 @@ function createPopoverStore({
|
|
|
1328
1329
|
() => rendered.sync(
|
|
1329
1330
|
() => popover.syncBatch(
|
|
1330
1331
|
(state) => {
|
|
1331
|
-
|
|
1332
|
+
var _a2;
|
|
1333
|
+
if (!((_a2 = state.contentElement) == null ? void 0 : _a2.isConnected))
|
|
1332
1334
|
return;
|
|
1333
1335
|
const popover2 = state.popoverElement;
|
|
1334
1336
|
if (!popover2)
|
|
@@ -1346,8 +1348,9 @@ function createPopoverStore({
|
|
|
1346
1348
|
const middleware = [
|
|
1347
1349
|
// https://floating-ui.com/docs/offset
|
|
1348
1350
|
middlewares.offset(({ placement: placement2 }) => {
|
|
1349
|
-
|
|
1350
|
-
const
|
|
1351
|
+
var _a3;
|
|
1352
|
+
const arrowOffset = ((arrow2 == null ? void 0 : arrow2.clientHeight) || 0) / 2;
|
|
1353
|
+
const finalGutter = typeof state.gutter === "number" ? state.gutter + arrowOffset : (_a3 = state.gutter) != null ? _a3 : arrowOffset;
|
|
1351
1354
|
const hasAlignment = !!placement2.split("-")[1];
|
|
1352
1355
|
return {
|
|
1353
1356
|
crossAxis: !hasAlignment ? state.shift : void 0,
|
|
@@ -1445,11 +1448,10 @@ function createPopoverStore({
|
|
|
1445
1448
|
});
|
|
1446
1449
|
};
|
|
1447
1450
|
if (renderCallback) {
|
|
1448
|
-
return renderCallback({
|
|
1449
|
-
...state,
|
|
1451
|
+
return renderCallback(_6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, state), {
|
|
1450
1452
|
setPlacement: setCurrentPlacement,
|
|
1451
1453
|
defaultRenderCallback
|
|
1452
|
-
});
|
|
1454
|
+
}));
|
|
1453
1455
|
}
|
|
1454
1456
|
return defaultRenderCallback();
|
|
1455
1457
|
},
|
|
@@ -1474,16 +1476,14 @@ function createPopoverStore({
|
|
|
1474
1476
|
)
|
|
1475
1477
|
)
|
|
1476
1478
|
);
|
|
1477
|
-
return {
|
|
1478
|
-
...dialog,
|
|
1479
|
-
...popover,
|
|
1479
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, dialog), popover), {
|
|
1480
1480
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
1481
1481
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
1482
1482
|
setArrowElement: (element) => popover.setState("arrowElement", element),
|
|
1483
1483
|
render: () => rendered.setState("rendered", []),
|
|
1484
1484
|
getAnchorRect,
|
|
1485
1485
|
renderCallback
|
|
1486
|
-
};
|
|
1486
|
+
});
|
|
1487
1487
|
}
|
|
1488
1488
|
|
|
1489
1489
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/dom.ts
|
|
2
2
|
var canUseDOM = checkIsBrowser();
|
|
3
3
|
function checkIsBrowser() {
|
|
4
|
-
|
|
4
|
+
var _a;
|
|
5
|
+
return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
|
|
5
6
|
}
|
|
6
7
|
function getDocument(node) {
|
|
7
8
|
return node ? node.ownerDocument || node : document;
|
|
@@ -11,7 +12,7 @@ function getWindow(node) {
|
|
|
11
12
|
}
|
|
12
13
|
function getActiveElement(node, activeDescendant = false) {
|
|
13
14
|
const { activeElement } = getDocument(node);
|
|
14
|
-
if (!
|
|
15
|
+
if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
|
|
15
16
|
return null;
|
|
16
17
|
}
|
|
17
18
|
if (isFrame(activeElement) && activeElement.contentDocument) {
|
|
@@ -88,13 +89,14 @@ function isTextField(element) {
|
|
|
88
89
|
}
|
|
89
90
|
function getPopupRole(element, fallback) {
|
|
90
91
|
const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
|
|
91
|
-
const role =
|
|
92
|
+
const role = element == null ? void 0 : element.getAttribute("role");
|
|
92
93
|
if (role && allowedPopupRoles.indexOf(role) !== -1) {
|
|
93
94
|
return role;
|
|
94
95
|
}
|
|
95
96
|
return fallback;
|
|
96
97
|
}
|
|
97
98
|
function getPopupItemRole(element, fallback) {
|
|
99
|
+
var _a;
|
|
98
100
|
const itemRoleByPopupRole = {
|
|
99
101
|
menu: "menuitem",
|
|
100
102
|
listbox: "option",
|
|
@@ -105,7 +107,7 @@ function getPopupItemRole(element, fallback) {
|
|
|
105
107
|
if (!popupRole)
|
|
106
108
|
return fallback;
|
|
107
109
|
const key = popupRole;
|
|
108
|
-
return
|
|
110
|
+
return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
|
|
109
111
|
}
|
|
110
112
|
function getTextboxSelection(element) {
|
|
111
113
|
let start = 0;
|
|
@@ -115,7 +117,7 @@ function getTextboxSelection(element) {
|
|
|
115
117
|
end = element.selectionEnd || 0;
|
|
116
118
|
} else if (element.isContentEditable) {
|
|
117
119
|
const selection = getDocument(element).getSelection();
|
|
118
|
-
if (
|
|
120
|
+
if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
|
|
119
121
|
const range = selection.getRangeAt(0);
|
|
120
122
|
const nextRange = range.cloneRange();
|
|
121
123
|
nextRange.selectNodeContents(element);
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
|
|
7
11
|
|
|
8
12
|
// src/checkbox/checkbox-store.ts
|
|
9
13
|
function createCheckboxStore(props = {}) {
|
|
10
|
-
|
|
14
|
+
var _a;
|
|
15
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
11
16
|
const initialState = {
|
|
12
|
-
value:
|
|
17
|
+
value: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
13
18
|
props.value,
|
|
14
|
-
|
|
19
|
+
syncState == null ? void 0 : syncState.value,
|
|
15
20
|
props.defaultValue,
|
|
16
21
|
false
|
|
17
22
|
)
|
|
18
23
|
};
|
|
19
|
-
const checkbox =
|
|
20
|
-
return {
|
|
21
|
-
...checkbox,
|
|
24
|
+
const checkbox = _6SPJEESBcjs.createStore.call(void 0, initialState, props.store);
|
|
25
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, checkbox), {
|
|
22
26
|
setValue: (value) => checkbox.setState("value", value)
|
|
23
|
-
};
|
|
27
|
+
});
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
|
|
@@ -10,6 +10,9 @@ export type CheckboxStoreValue = Value;
|
|
|
10
10
|
export interface CheckboxStoreState<T extends Value = Value> {
|
|
11
11
|
/**
|
|
12
12
|
* The checked state of the checkbox.
|
|
13
|
+
*
|
|
14
|
+
* Live examples:
|
|
15
|
+
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
|
|
13
16
|
*/
|
|
14
17
|
value: ToPrimitive<T>;
|
|
15
18
|
}
|
|
@@ -25,6 +28,10 @@ export interface CheckboxStoreFunctions<T extends Value = Value> {
|
|
|
25
28
|
export interface CheckboxStoreOptions<T extends Value = Value> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
26
29
|
/**
|
|
27
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)
|
|
28
35
|
* @default false
|
|
29
36
|
*/
|
|
30
37
|
defaultValue?: CheckboxStoreState<T>["value"];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
3
|
+
var _FXEBKN6Gcjs = require('../__chunks/FXEBKN6G.cjs');
|
|
4
|
+
require('../__chunks/6SPJEESB.cjs');
|
|
5
|
+
require('../__chunks/M6ZA7XUP.cjs');
|
|
6
|
+
require('../__chunks/ZNW4LSWU.cjs');
|
|
7
|
+
require('../__chunks/6455U47T.cjs');
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
exports.createCollectionStore =
|
|
10
|
+
exports.createCollectionStore = _FXEBKN6Gcjs.createCollectionStore;
|