@samline/drawer 2.0.6 → 2.0.7
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/dist/browser/{components-client-CJuQ5vtW.js → components-client-B8ZDZqhE.js} +25 -16
- package/dist/{svelte/components-client-tfLTRxPH.mjs → browser/components-client-LPOAyYIW.mjs} +25 -16
- package/dist/browser/index.cjs +21 -14
- package/dist/browser/index.js +21 -14
- package/dist/browser/index.mjs +21 -14
- package/dist/{svelte/components-client-CJuQ5vtW.js → components-client-B8ZDZqhE.js} +25 -16
- package/dist/{browser/components-client-tfLTRxPH.mjs → components-client-LPOAyYIW.mjs} +25 -16
- package/dist/index.js +21 -14
- package/dist/index.mjs +21 -14
- package/dist/react/index.js +25 -16
- package/dist/react/index.mjs +25 -16
- package/dist/{components-client-CJuQ5vtW.js → svelte/components-client-B8ZDZqhE.js} +25 -16
- package/dist/{components-client-tfLTRxPH.mjs → svelte/components-client-LPOAyYIW.mjs} +25 -16
- package/dist/svelte/index.js +21 -14
- package/dist/svelte/index.mjs +21 -14
- package/dist/vue/{components-client-CJuQ5vtW.js → components-client-B8ZDZqhE.js} +25 -16
- package/dist/vue/{components-client-DSM2G8ef.mjs → components-client-BlpMZJqu.mjs} +25 -16
- package/dist/vue/index.js +21 -14
- package/dist/vue/index.mjs +21 -14
- package/package.json +1 -1
|
@@ -1528,6 +1528,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1528
1528
|
const drawerHeightRef = React__namespace.default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1529
1529
|
const drawerWidthRef = React__namespace.default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1530
1530
|
const initialDrawerHeight = React__namespace.default.useRef(0);
|
|
1531
|
+
const releaseHiddenFocusBeforeOpen = React__namespace.default.useCallback(()=>{
|
|
1532
|
+
var _drawerRef_current;
|
|
1533
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1534
|
+
return;
|
|
1535
|
+
}
|
|
1536
|
+
const activeElement = document.activeElement;
|
|
1537
|
+
if (!activeElement || activeElement === document.body) {
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
const activeElementNode = activeElement;
|
|
1541
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
activeElementNode.blur();
|
|
1548
|
+
}, [
|
|
1549
|
+
autoFocus,
|
|
1550
|
+
modal
|
|
1551
|
+
]);
|
|
1531
1552
|
const onSnapPointChange = React__namespace.default.useCallback((activeSnapPointIndex)=>{
|
|
1532
1553
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1533
1554
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1579,26 +1600,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1579
1600
|
autoFocus
|
|
1580
1601
|
});
|
|
1581
1602
|
useSafeLayoutEffect(()=>{
|
|
1582
|
-
|
|
1583
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1603
|
+
if (!isOpen) {
|
|
1584
1604
|
return;
|
|
1585
1605
|
}
|
|
1586
|
-
|
|
1587
|
-
if (!activeElement || activeElement === document.body) {
|
|
1588
|
-
return;
|
|
1589
|
-
}
|
|
1590
|
-
const activeElementNode = activeElement;
|
|
1591
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1592
|
-
return;
|
|
1593
|
-
}
|
|
1594
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1595
|
-
return;
|
|
1596
|
-
}
|
|
1597
|
-
activeElementNode.blur();
|
|
1606
|
+
releaseHiddenFocusBeforeOpen();
|
|
1598
1607
|
}, [
|
|
1599
|
-
autoFocus,
|
|
1600
1608
|
isOpen,
|
|
1601
|
-
|
|
1609
|
+
releaseHiddenFocusBeforeOpen
|
|
1602
1610
|
]);
|
|
1603
1611
|
function getScale() {
|
|
1604
1612
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -2007,6 +2015,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
2007
2015
|
onOpenChange: (open)=>{
|
|
2008
2016
|
if (!dismissible && !open) return;
|
|
2009
2017
|
if (open) {
|
|
2018
|
+
releaseHiddenFocusBeforeOpen();
|
|
2010
2019
|
setHasBeenOpened(true);
|
|
2011
2020
|
} else {
|
|
2012
2021
|
closeDrawer(true);
|
package/dist/{svelte/components-client-tfLTRxPH.mjs → browser/components-client-LPOAyYIW.mjs}
RENAMED
|
@@ -1508,6 +1508,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1508
1508
|
const drawerHeightRef = React__default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1509
1509
|
const drawerWidthRef = React__default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1510
1510
|
const initialDrawerHeight = React__default.useRef(0);
|
|
1511
|
+
const releaseHiddenFocusBeforeOpen = React__default.useCallback(()=>{
|
|
1512
|
+
var _drawerRef_current;
|
|
1513
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
const activeElement = document.activeElement;
|
|
1517
|
+
if (!activeElement || activeElement === document.body) {
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
const activeElementNode = activeElement;
|
|
1521
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
activeElementNode.blur();
|
|
1528
|
+
}, [
|
|
1529
|
+
autoFocus,
|
|
1530
|
+
modal
|
|
1531
|
+
]);
|
|
1511
1532
|
const onSnapPointChange = React__default.useCallback((activeSnapPointIndex)=>{
|
|
1512
1533
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1513
1534
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1559,26 +1580,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1559
1580
|
autoFocus
|
|
1560
1581
|
});
|
|
1561
1582
|
useSafeLayoutEffect(()=>{
|
|
1562
|
-
|
|
1563
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1583
|
+
if (!isOpen) {
|
|
1564
1584
|
return;
|
|
1565
1585
|
}
|
|
1566
|
-
|
|
1567
|
-
if (!activeElement || activeElement === document.body) {
|
|
1568
|
-
return;
|
|
1569
|
-
}
|
|
1570
|
-
const activeElementNode = activeElement;
|
|
1571
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1572
|
-
return;
|
|
1573
|
-
}
|
|
1574
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1575
|
-
return;
|
|
1576
|
-
}
|
|
1577
|
-
activeElementNode.blur();
|
|
1586
|
+
releaseHiddenFocusBeforeOpen();
|
|
1578
1587
|
}, [
|
|
1579
|
-
autoFocus,
|
|
1580
1588
|
isOpen,
|
|
1581
|
-
|
|
1589
|
+
releaseHiddenFocusBeforeOpen
|
|
1582
1590
|
]);
|
|
1583
1591
|
function getScale() {
|
|
1584
1592
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -1987,6 +1995,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1987
1995
|
onOpenChange: (open)=>{
|
|
1988
1996
|
if (!dismissible && !open) return;
|
|
1989
1997
|
if (open) {
|
|
1998
|
+
releaseHiddenFocusBeforeOpen();
|
|
1990
1999
|
setHasBeenOpened(true);
|
|
1991
2000
|
} else {
|
|
1992
2001
|
closeDrawer(true);
|
package/dist/browser/index.cjs
CHANGED
|
@@ -28075,6 +28075,23 @@ function Root2({
|
|
|
28075
28075
|
const drawerHeightRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
|
|
28076
28076
|
const drawerWidthRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
28077
28077
|
const initialDrawerHeight = import_react9.default.useRef(0);
|
|
28078
|
+
const releaseHiddenFocusBeforeOpen2 = import_react9.default.useCallback(() => {
|
|
28079
|
+
if (!modal || autoFocus || typeof document === "undefined") {
|
|
28080
|
+
return;
|
|
28081
|
+
}
|
|
28082
|
+
const activeElement = document.activeElement;
|
|
28083
|
+
if (!activeElement || activeElement === document.body) {
|
|
28084
|
+
return;
|
|
28085
|
+
}
|
|
28086
|
+
const activeElementNode = activeElement;
|
|
28087
|
+
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28088
|
+
return;
|
|
28089
|
+
}
|
|
28090
|
+
if (typeof activeElementNode.blur !== "function") {
|
|
28091
|
+
return;
|
|
28092
|
+
}
|
|
28093
|
+
activeElementNode.blur();
|
|
28094
|
+
}, [autoFocus, modal]);
|
|
28078
28095
|
const onSnapPointChange = import_react9.default.useCallback((activeSnapPointIndex2) => {
|
|
28079
28096
|
if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
28080
28097
|
}, []);
|
|
@@ -28134,22 +28151,11 @@ function Root2({
|
|
|
28134
28151
|
autoFocus
|
|
28135
28152
|
});
|
|
28136
28153
|
useSafeLayoutEffect(() => {
|
|
28137
|
-
if (!isOpen
|
|
28154
|
+
if (!isOpen) {
|
|
28138
28155
|
return;
|
|
28139
28156
|
}
|
|
28140
|
-
|
|
28141
|
-
|
|
28142
|
-
return;
|
|
28143
|
-
}
|
|
28144
|
-
const activeElementNode = activeElement;
|
|
28145
|
-
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28146
|
-
return;
|
|
28147
|
-
}
|
|
28148
|
-
if (typeof activeElementNode.blur !== "function") {
|
|
28149
|
-
return;
|
|
28150
|
-
}
|
|
28151
|
-
activeElementNode.blur();
|
|
28152
|
-
}, [autoFocus, isOpen, modal]);
|
|
28157
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28158
|
+
}, [isOpen, releaseHiddenFocusBeforeOpen2]);
|
|
28153
28159
|
function getScale() {
|
|
28154
28160
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
28155
28161
|
}
|
|
@@ -28533,6 +28539,7 @@ function Root2({
|
|
|
28533
28539
|
onOpenChange: (open) => {
|
|
28534
28540
|
if (!dismissible && !open) return;
|
|
28535
28541
|
if (open) {
|
|
28542
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28536
28543
|
setHasBeenOpened(true);
|
|
28537
28544
|
} else {
|
|
28538
28545
|
closeDrawer2(true);
|
package/dist/browser/index.js
CHANGED
|
@@ -28075,6 +28075,23 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
28075
28075
|
const drawerHeightRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
|
|
28076
28076
|
const drawerWidthRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
28077
28077
|
const initialDrawerHeight = import_react9.default.useRef(0);
|
|
28078
|
+
const releaseHiddenFocusBeforeOpen2 = import_react9.default.useCallback(() => {
|
|
28079
|
+
if (!modal || autoFocus || typeof document === "undefined") {
|
|
28080
|
+
return;
|
|
28081
|
+
}
|
|
28082
|
+
const activeElement = document.activeElement;
|
|
28083
|
+
if (!activeElement || activeElement === document.body) {
|
|
28084
|
+
return;
|
|
28085
|
+
}
|
|
28086
|
+
const activeElementNode = activeElement;
|
|
28087
|
+
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28088
|
+
return;
|
|
28089
|
+
}
|
|
28090
|
+
if (typeof activeElementNode.blur !== "function") {
|
|
28091
|
+
return;
|
|
28092
|
+
}
|
|
28093
|
+
activeElementNode.blur();
|
|
28094
|
+
}, [autoFocus, modal]);
|
|
28078
28095
|
const onSnapPointChange = import_react9.default.useCallback((activeSnapPointIndex2) => {
|
|
28079
28096
|
if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
28080
28097
|
}, []);
|
|
@@ -28134,22 +28151,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
28134
28151
|
autoFocus
|
|
28135
28152
|
});
|
|
28136
28153
|
useSafeLayoutEffect(() => {
|
|
28137
|
-
if (!isOpen
|
|
28154
|
+
if (!isOpen) {
|
|
28138
28155
|
return;
|
|
28139
28156
|
}
|
|
28140
|
-
|
|
28141
|
-
|
|
28142
|
-
return;
|
|
28143
|
-
}
|
|
28144
|
-
const activeElementNode = activeElement;
|
|
28145
|
-
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28146
|
-
return;
|
|
28147
|
-
}
|
|
28148
|
-
if (typeof activeElementNode.blur !== "function") {
|
|
28149
|
-
return;
|
|
28150
|
-
}
|
|
28151
|
-
activeElementNode.blur();
|
|
28152
|
-
}, [autoFocus, isOpen, modal]);
|
|
28157
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28158
|
+
}, [isOpen, releaseHiddenFocusBeforeOpen2]);
|
|
28153
28159
|
function getScale() {
|
|
28154
28160
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
28155
28161
|
}
|
|
@@ -28533,6 +28539,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
28533
28539
|
onOpenChange: (open) => {
|
|
28534
28540
|
if (!dismissible && !open) return;
|
|
28535
28541
|
if (open) {
|
|
28542
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28536
28543
|
setHasBeenOpened(true);
|
|
28537
28544
|
} else {
|
|
28538
28545
|
closeDrawer2(true);
|
package/dist/browser/index.mjs
CHANGED
|
@@ -28049,6 +28049,23 @@ function Root2({
|
|
|
28049
28049
|
const drawerHeightRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
|
|
28050
28050
|
const drawerWidthRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
28051
28051
|
const initialDrawerHeight = import_react9.default.useRef(0);
|
|
28052
|
+
const releaseHiddenFocusBeforeOpen2 = import_react9.default.useCallback(() => {
|
|
28053
|
+
if (!modal || autoFocus || typeof document === "undefined") {
|
|
28054
|
+
return;
|
|
28055
|
+
}
|
|
28056
|
+
const activeElement = document.activeElement;
|
|
28057
|
+
if (!activeElement || activeElement === document.body) {
|
|
28058
|
+
return;
|
|
28059
|
+
}
|
|
28060
|
+
const activeElementNode = activeElement;
|
|
28061
|
+
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28062
|
+
return;
|
|
28063
|
+
}
|
|
28064
|
+
if (typeof activeElementNode.blur !== "function") {
|
|
28065
|
+
return;
|
|
28066
|
+
}
|
|
28067
|
+
activeElementNode.blur();
|
|
28068
|
+
}, [autoFocus, modal]);
|
|
28052
28069
|
const onSnapPointChange = import_react9.default.useCallback((activeSnapPointIndex2) => {
|
|
28053
28070
|
if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
28054
28071
|
}, []);
|
|
@@ -28108,22 +28125,11 @@ function Root2({
|
|
|
28108
28125
|
autoFocus
|
|
28109
28126
|
});
|
|
28110
28127
|
useSafeLayoutEffect(() => {
|
|
28111
|
-
if (!isOpen
|
|
28128
|
+
if (!isOpen) {
|
|
28112
28129
|
return;
|
|
28113
28130
|
}
|
|
28114
|
-
|
|
28115
|
-
|
|
28116
|
-
return;
|
|
28117
|
-
}
|
|
28118
|
-
const activeElementNode = activeElement;
|
|
28119
|
-
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28120
|
-
return;
|
|
28121
|
-
}
|
|
28122
|
-
if (typeof activeElementNode.blur !== "function") {
|
|
28123
|
-
return;
|
|
28124
|
-
}
|
|
28125
|
-
activeElementNode.blur();
|
|
28126
|
-
}, [autoFocus, isOpen, modal]);
|
|
28131
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28132
|
+
}, [isOpen, releaseHiddenFocusBeforeOpen2]);
|
|
28127
28133
|
function getScale() {
|
|
28128
28134
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
28129
28135
|
}
|
|
@@ -28507,6 +28513,7 @@ function Root2({
|
|
|
28507
28513
|
onOpenChange: (open) => {
|
|
28508
28514
|
if (!dismissible && !open) return;
|
|
28509
28515
|
if (open) {
|
|
28516
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28510
28517
|
setHasBeenOpened(true);
|
|
28511
28518
|
} else {
|
|
28512
28519
|
closeDrawer2(true);
|
|
@@ -1528,6 +1528,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1528
1528
|
const drawerHeightRef = React__namespace.default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1529
1529
|
const drawerWidthRef = React__namespace.default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1530
1530
|
const initialDrawerHeight = React__namespace.default.useRef(0);
|
|
1531
|
+
const releaseHiddenFocusBeforeOpen = React__namespace.default.useCallback(()=>{
|
|
1532
|
+
var _drawerRef_current;
|
|
1533
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1534
|
+
return;
|
|
1535
|
+
}
|
|
1536
|
+
const activeElement = document.activeElement;
|
|
1537
|
+
if (!activeElement || activeElement === document.body) {
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
const activeElementNode = activeElement;
|
|
1541
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
activeElementNode.blur();
|
|
1548
|
+
}, [
|
|
1549
|
+
autoFocus,
|
|
1550
|
+
modal
|
|
1551
|
+
]);
|
|
1531
1552
|
const onSnapPointChange = React__namespace.default.useCallback((activeSnapPointIndex)=>{
|
|
1532
1553
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1533
1554
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1579,26 +1600,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1579
1600
|
autoFocus
|
|
1580
1601
|
});
|
|
1581
1602
|
useSafeLayoutEffect(()=>{
|
|
1582
|
-
|
|
1583
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1603
|
+
if (!isOpen) {
|
|
1584
1604
|
return;
|
|
1585
1605
|
}
|
|
1586
|
-
|
|
1587
|
-
if (!activeElement || activeElement === document.body) {
|
|
1588
|
-
return;
|
|
1589
|
-
}
|
|
1590
|
-
const activeElementNode = activeElement;
|
|
1591
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1592
|
-
return;
|
|
1593
|
-
}
|
|
1594
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1595
|
-
return;
|
|
1596
|
-
}
|
|
1597
|
-
activeElementNode.blur();
|
|
1606
|
+
releaseHiddenFocusBeforeOpen();
|
|
1598
1607
|
}, [
|
|
1599
|
-
autoFocus,
|
|
1600
1608
|
isOpen,
|
|
1601
|
-
|
|
1609
|
+
releaseHiddenFocusBeforeOpen
|
|
1602
1610
|
]);
|
|
1603
1611
|
function getScale() {
|
|
1604
1612
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -2007,6 +2015,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
2007
2015
|
onOpenChange: (open)=>{
|
|
2008
2016
|
if (!dismissible && !open) return;
|
|
2009
2017
|
if (open) {
|
|
2018
|
+
releaseHiddenFocusBeforeOpen();
|
|
2010
2019
|
setHasBeenOpened(true);
|
|
2011
2020
|
} else {
|
|
2012
2021
|
closeDrawer(true);
|
|
@@ -1508,6 +1508,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1508
1508
|
const drawerHeightRef = React__default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1509
1509
|
const drawerWidthRef = React__default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1510
1510
|
const initialDrawerHeight = React__default.useRef(0);
|
|
1511
|
+
const releaseHiddenFocusBeforeOpen = React__default.useCallback(()=>{
|
|
1512
|
+
var _drawerRef_current;
|
|
1513
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
const activeElement = document.activeElement;
|
|
1517
|
+
if (!activeElement || activeElement === document.body) {
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
const activeElementNode = activeElement;
|
|
1521
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
activeElementNode.blur();
|
|
1528
|
+
}, [
|
|
1529
|
+
autoFocus,
|
|
1530
|
+
modal
|
|
1531
|
+
]);
|
|
1511
1532
|
const onSnapPointChange = React__default.useCallback((activeSnapPointIndex)=>{
|
|
1512
1533
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1513
1534
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1559,26 +1580,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1559
1580
|
autoFocus
|
|
1560
1581
|
});
|
|
1561
1582
|
useSafeLayoutEffect(()=>{
|
|
1562
|
-
|
|
1563
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1583
|
+
if (!isOpen) {
|
|
1564
1584
|
return;
|
|
1565
1585
|
}
|
|
1566
|
-
|
|
1567
|
-
if (!activeElement || activeElement === document.body) {
|
|
1568
|
-
return;
|
|
1569
|
-
}
|
|
1570
|
-
const activeElementNode = activeElement;
|
|
1571
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1572
|
-
return;
|
|
1573
|
-
}
|
|
1574
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1575
|
-
return;
|
|
1576
|
-
}
|
|
1577
|
-
activeElementNode.blur();
|
|
1586
|
+
releaseHiddenFocusBeforeOpen();
|
|
1578
1587
|
}, [
|
|
1579
|
-
autoFocus,
|
|
1580
1588
|
isOpen,
|
|
1581
|
-
|
|
1589
|
+
releaseHiddenFocusBeforeOpen
|
|
1582
1590
|
]);
|
|
1583
1591
|
function getScale() {
|
|
1584
1592
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -1987,6 +1995,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1987
1995
|
onOpenChange: (open)=>{
|
|
1988
1996
|
if (!dismissible && !open) return;
|
|
1989
1997
|
if (open) {
|
|
1998
|
+
releaseHiddenFocusBeforeOpen();
|
|
1990
1999
|
setHasBeenOpened(true);
|
|
1991
2000
|
} else {
|
|
1992
2001
|
closeDrawer(true);
|
package/dist/index.js
CHANGED
|
@@ -28074,6 +28074,23 @@ function Root2({
|
|
|
28074
28074
|
const drawerHeightRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
|
|
28075
28075
|
const drawerWidthRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
28076
28076
|
const initialDrawerHeight = import_react9.default.useRef(0);
|
|
28077
|
+
const releaseHiddenFocusBeforeOpen2 = import_react9.default.useCallback(() => {
|
|
28078
|
+
if (!modal || autoFocus || typeof document === "undefined") {
|
|
28079
|
+
return;
|
|
28080
|
+
}
|
|
28081
|
+
const activeElement = document.activeElement;
|
|
28082
|
+
if (!activeElement || activeElement === document.body) {
|
|
28083
|
+
return;
|
|
28084
|
+
}
|
|
28085
|
+
const activeElementNode = activeElement;
|
|
28086
|
+
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28087
|
+
return;
|
|
28088
|
+
}
|
|
28089
|
+
if (typeof activeElementNode.blur !== "function") {
|
|
28090
|
+
return;
|
|
28091
|
+
}
|
|
28092
|
+
activeElementNode.blur();
|
|
28093
|
+
}, [autoFocus, modal]);
|
|
28077
28094
|
const onSnapPointChange = import_react9.default.useCallback((activeSnapPointIndex2) => {
|
|
28078
28095
|
if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
28079
28096
|
}, []);
|
|
@@ -28133,22 +28150,11 @@ function Root2({
|
|
|
28133
28150
|
autoFocus
|
|
28134
28151
|
});
|
|
28135
28152
|
useSafeLayoutEffect(() => {
|
|
28136
|
-
if (!isOpen
|
|
28153
|
+
if (!isOpen) {
|
|
28137
28154
|
return;
|
|
28138
28155
|
}
|
|
28139
|
-
|
|
28140
|
-
|
|
28141
|
-
return;
|
|
28142
|
-
}
|
|
28143
|
-
const activeElementNode = activeElement;
|
|
28144
|
-
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28145
|
-
return;
|
|
28146
|
-
}
|
|
28147
|
-
if (typeof activeElementNode.blur !== "function") {
|
|
28148
|
-
return;
|
|
28149
|
-
}
|
|
28150
|
-
activeElementNode.blur();
|
|
28151
|
-
}, [autoFocus, isOpen, modal]);
|
|
28156
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28157
|
+
}, [isOpen, releaseHiddenFocusBeforeOpen2]);
|
|
28152
28158
|
function getScale() {
|
|
28153
28159
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
28154
28160
|
}
|
|
@@ -28532,6 +28538,7 @@ function Root2({
|
|
|
28532
28538
|
onOpenChange: (open) => {
|
|
28533
28539
|
if (!dismissible && !open) return;
|
|
28534
28540
|
if (open) {
|
|
28541
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28535
28542
|
setHasBeenOpened(true);
|
|
28536
28543
|
} else {
|
|
28537
28544
|
closeDrawer2(true);
|
package/dist/index.mjs
CHANGED
|
@@ -28049,6 +28049,23 @@ function Root2({
|
|
|
28049
28049
|
const drawerHeightRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
|
|
28050
28050
|
const drawerWidthRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
28051
28051
|
const initialDrawerHeight = import_react9.default.useRef(0);
|
|
28052
|
+
const releaseHiddenFocusBeforeOpen2 = import_react9.default.useCallback(() => {
|
|
28053
|
+
if (!modal || autoFocus || typeof document === "undefined") {
|
|
28054
|
+
return;
|
|
28055
|
+
}
|
|
28056
|
+
const activeElement = document.activeElement;
|
|
28057
|
+
if (!activeElement || activeElement === document.body) {
|
|
28058
|
+
return;
|
|
28059
|
+
}
|
|
28060
|
+
const activeElementNode = activeElement;
|
|
28061
|
+
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28062
|
+
return;
|
|
28063
|
+
}
|
|
28064
|
+
if (typeof activeElementNode.blur !== "function") {
|
|
28065
|
+
return;
|
|
28066
|
+
}
|
|
28067
|
+
activeElementNode.blur();
|
|
28068
|
+
}, [autoFocus, modal]);
|
|
28052
28069
|
const onSnapPointChange = import_react9.default.useCallback((activeSnapPointIndex2) => {
|
|
28053
28070
|
if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
28054
28071
|
}, []);
|
|
@@ -28108,22 +28125,11 @@ function Root2({
|
|
|
28108
28125
|
autoFocus
|
|
28109
28126
|
});
|
|
28110
28127
|
useSafeLayoutEffect(() => {
|
|
28111
|
-
if (!isOpen
|
|
28128
|
+
if (!isOpen) {
|
|
28112
28129
|
return;
|
|
28113
28130
|
}
|
|
28114
|
-
|
|
28115
|
-
|
|
28116
|
-
return;
|
|
28117
|
-
}
|
|
28118
|
-
const activeElementNode = activeElement;
|
|
28119
|
-
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28120
|
-
return;
|
|
28121
|
-
}
|
|
28122
|
-
if (typeof activeElementNode.blur !== "function") {
|
|
28123
|
-
return;
|
|
28124
|
-
}
|
|
28125
|
-
activeElementNode.blur();
|
|
28126
|
-
}, [autoFocus, isOpen, modal]);
|
|
28131
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28132
|
+
}, [isOpen, releaseHiddenFocusBeforeOpen2]);
|
|
28127
28133
|
function getScale() {
|
|
28128
28134
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
28129
28135
|
}
|
|
@@ -28507,6 +28513,7 @@ function Root2({
|
|
|
28507
28513
|
onOpenChange: (open) => {
|
|
28508
28514
|
if (!dismissible && !open) return;
|
|
28509
28515
|
if (open) {
|
|
28516
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28510
28517
|
setHasBeenOpened(true);
|
|
28511
28518
|
} else {
|
|
28512
28519
|
closeDrawer2(true);
|
package/dist/react/index.js
CHANGED
|
@@ -1531,6 +1531,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1531
1531
|
const drawerHeightRef = React__namespace.default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1532
1532
|
const drawerWidthRef = React__namespace.default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1533
1533
|
const initialDrawerHeight = React__namespace.default.useRef(0);
|
|
1534
|
+
const releaseHiddenFocusBeforeOpen = React__namespace.default.useCallback(()=>{
|
|
1535
|
+
var _drawerRef_current;
|
|
1536
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1539
|
+
const activeElement = document.activeElement;
|
|
1540
|
+
if (!activeElement || activeElement === document.body) {
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
const activeElementNode = activeElement;
|
|
1544
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
activeElementNode.blur();
|
|
1551
|
+
}, [
|
|
1552
|
+
autoFocus,
|
|
1553
|
+
modal
|
|
1554
|
+
]);
|
|
1534
1555
|
const onSnapPointChange = React__namespace.default.useCallback((activeSnapPointIndex)=>{
|
|
1535
1556
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1536
1557
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1582,26 +1603,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1582
1603
|
autoFocus
|
|
1583
1604
|
});
|
|
1584
1605
|
useSafeLayoutEffect$1(()=>{
|
|
1585
|
-
|
|
1586
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1606
|
+
if (!isOpen) {
|
|
1587
1607
|
return;
|
|
1588
1608
|
}
|
|
1589
|
-
|
|
1590
|
-
if (!activeElement || activeElement === document.body) {
|
|
1591
|
-
return;
|
|
1592
|
-
}
|
|
1593
|
-
const activeElementNode = activeElement;
|
|
1594
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1595
|
-
return;
|
|
1596
|
-
}
|
|
1597
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1598
|
-
return;
|
|
1599
|
-
}
|
|
1600
|
-
activeElementNode.blur();
|
|
1609
|
+
releaseHiddenFocusBeforeOpen();
|
|
1601
1610
|
}, [
|
|
1602
|
-
autoFocus,
|
|
1603
1611
|
isOpen,
|
|
1604
|
-
|
|
1612
|
+
releaseHiddenFocusBeforeOpen
|
|
1605
1613
|
]);
|
|
1606
1614
|
function getScale() {
|
|
1607
1615
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -2010,6 +2018,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
2010
2018
|
onOpenChange: (open)=>{
|
|
2011
2019
|
if (!dismissible && !open) return;
|
|
2012
2020
|
if (open) {
|
|
2021
|
+
releaseHiddenFocusBeforeOpen();
|
|
2013
2022
|
setHasBeenOpened(true);
|
|
2014
2023
|
} else {
|
|
2015
2024
|
closeDrawer(true);
|
package/dist/react/index.mjs
CHANGED
|
@@ -1509,6 +1509,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1509
1509
|
const drawerHeightRef = React__default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1510
1510
|
const drawerWidthRef = React__default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1511
1511
|
const initialDrawerHeight = React__default.useRef(0);
|
|
1512
|
+
const releaseHiddenFocusBeforeOpen = React__default.useCallback(()=>{
|
|
1513
|
+
var _drawerRef_current;
|
|
1514
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1515
|
+
return;
|
|
1516
|
+
}
|
|
1517
|
+
const activeElement = document.activeElement;
|
|
1518
|
+
if (!activeElement || activeElement === document.body) {
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
const activeElementNode = activeElement;
|
|
1522
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1525
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
activeElementNode.blur();
|
|
1529
|
+
}, [
|
|
1530
|
+
autoFocus,
|
|
1531
|
+
modal
|
|
1532
|
+
]);
|
|
1512
1533
|
const onSnapPointChange = React__default.useCallback((activeSnapPointIndex)=>{
|
|
1513
1534
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1514
1535
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1560,26 +1581,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1560
1581
|
autoFocus
|
|
1561
1582
|
});
|
|
1562
1583
|
useSafeLayoutEffect$1(()=>{
|
|
1563
|
-
|
|
1564
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1584
|
+
if (!isOpen) {
|
|
1565
1585
|
return;
|
|
1566
1586
|
}
|
|
1567
|
-
|
|
1568
|
-
if (!activeElement || activeElement === document.body) {
|
|
1569
|
-
return;
|
|
1570
|
-
}
|
|
1571
|
-
const activeElementNode = activeElement;
|
|
1572
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1573
|
-
return;
|
|
1574
|
-
}
|
|
1575
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1576
|
-
return;
|
|
1577
|
-
}
|
|
1578
|
-
activeElementNode.blur();
|
|
1587
|
+
releaseHiddenFocusBeforeOpen();
|
|
1579
1588
|
}, [
|
|
1580
|
-
autoFocus,
|
|
1581
1589
|
isOpen,
|
|
1582
|
-
|
|
1590
|
+
releaseHiddenFocusBeforeOpen
|
|
1583
1591
|
]);
|
|
1584
1592
|
function getScale() {
|
|
1585
1593
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -1988,6 +1996,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1988
1996
|
onOpenChange: (open)=>{
|
|
1989
1997
|
if (!dismissible && !open) return;
|
|
1990
1998
|
if (open) {
|
|
1999
|
+
releaseHiddenFocusBeforeOpen();
|
|
1991
2000
|
setHasBeenOpened(true);
|
|
1992
2001
|
} else {
|
|
1993
2002
|
closeDrawer(true);
|
|
@@ -1528,6 +1528,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1528
1528
|
const drawerHeightRef = React__namespace.default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1529
1529
|
const drawerWidthRef = React__namespace.default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1530
1530
|
const initialDrawerHeight = React__namespace.default.useRef(0);
|
|
1531
|
+
const releaseHiddenFocusBeforeOpen = React__namespace.default.useCallback(()=>{
|
|
1532
|
+
var _drawerRef_current;
|
|
1533
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1534
|
+
return;
|
|
1535
|
+
}
|
|
1536
|
+
const activeElement = document.activeElement;
|
|
1537
|
+
if (!activeElement || activeElement === document.body) {
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
const activeElementNode = activeElement;
|
|
1541
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
activeElementNode.blur();
|
|
1548
|
+
}, [
|
|
1549
|
+
autoFocus,
|
|
1550
|
+
modal
|
|
1551
|
+
]);
|
|
1531
1552
|
const onSnapPointChange = React__namespace.default.useCallback((activeSnapPointIndex)=>{
|
|
1532
1553
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1533
1554
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1579,26 +1600,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1579
1600
|
autoFocus
|
|
1580
1601
|
});
|
|
1581
1602
|
useSafeLayoutEffect(()=>{
|
|
1582
|
-
|
|
1583
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1603
|
+
if (!isOpen) {
|
|
1584
1604
|
return;
|
|
1585
1605
|
}
|
|
1586
|
-
|
|
1587
|
-
if (!activeElement || activeElement === document.body) {
|
|
1588
|
-
return;
|
|
1589
|
-
}
|
|
1590
|
-
const activeElementNode = activeElement;
|
|
1591
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1592
|
-
return;
|
|
1593
|
-
}
|
|
1594
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1595
|
-
return;
|
|
1596
|
-
}
|
|
1597
|
-
activeElementNode.blur();
|
|
1606
|
+
releaseHiddenFocusBeforeOpen();
|
|
1598
1607
|
}, [
|
|
1599
|
-
autoFocus,
|
|
1600
1608
|
isOpen,
|
|
1601
|
-
|
|
1609
|
+
releaseHiddenFocusBeforeOpen
|
|
1602
1610
|
]);
|
|
1603
1611
|
function getScale() {
|
|
1604
1612
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -2007,6 +2015,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
2007
2015
|
onOpenChange: (open)=>{
|
|
2008
2016
|
if (!dismissible && !open) return;
|
|
2009
2017
|
if (open) {
|
|
2018
|
+
releaseHiddenFocusBeforeOpen();
|
|
2010
2019
|
setHasBeenOpened(true);
|
|
2011
2020
|
} else {
|
|
2012
2021
|
closeDrawer(true);
|
|
@@ -1508,6 +1508,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1508
1508
|
const drawerHeightRef = React__default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1509
1509
|
const drawerWidthRef = React__default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1510
1510
|
const initialDrawerHeight = React__default.useRef(0);
|
|
1511
|
+
const releaseHiddenFocusBeforeOpen = React__default.useCallback(()=>{
|
|
1512
|
+
var _drawerRef_current;
|
|
1513
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
const activeElement = document.activeElement;
|
|
1517
|
+
if (!activeElement || activeElement === document.body) {
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
const activeElementNode = activeElement;
|
|
1521
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
activeElementNode.blur();
|
|
1528
|
+
}, [
|
|
1529
|
+
autoFocus,
|
|
1530
|
+
modal
|
|
1531
|
+
]);
|
|
1511
1532
|
const onSnapPointChange = React__default.useCallback((activeSnapPointIndex)=>{
|
|
1512
1533
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1513
1534
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1559,26 +1580,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1559
1580
|
autoFocus
|
|
1560
1581
|
});
|
|
1561
1582
|
useSafeLayoutEffect(()=>{
|
|
1562
|
-
|
|
1563
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1583
|
+
if (!isOpen) {
|
|
1564
1584
|
return;
|
|
1565
1585
|
}
|
|
1566
|
-
|
|
1567
|
-
if (!activeElement || activeElement === document.body) {
|
|
1568
|
-
return;
|
|
1569
|
-
}
|
|
1570
|
-
const activeElementNode = activeElement;
|
|
1571
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1572
|
-
return;
|
|
1573
|
-
}
|
|
1574
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1575
|
-
return;
|
|
1576
|
-
}
|
|
1577
|
-
activeElementNode.blur();
|
|
1586
|
+
releaseHiddenFocusBeforeOpen();
|
|
1578
1587
|
}, [
|
|
1579
|
-
autoFocus,
|
|
1580
1588
|
isOpen,
|
|
1581
|
-
|
|
1589
|
+
releaseHiddenFocusBeforeOpen
|
|
1582
1590
|
]);
|
|
1583
1591
|
function getScale() {
|
|
1584
1592
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -1987,6 +1995,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1987
1995
|
onOpenChange: (open)=>{
|
|
1988
1996
|
if (!dismissible && !open) return;
|
|
1989
1997
|
if (open) {
|
|
1998
|
+
releaseHiddenFocusBeforeOpen();
|
|
1990
1999
|
setHasBeenOpened(true);
|
|
1991
2000
|
} else {
|
|
1992
2001
|
closeDrawer(true);
|
package/dist/svelte/index.js
CHANGED
|
@@ -28077,6 +28077,23 @@ function Root2({
|
|
|
28077
28077
|
const drawerHeightRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
|
|
28078
28078
|
const drawerWidthRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
28079
28079
|
const initialDrawerHeight = import_react9.default.useRef(0);
|
|
28080
|
+
const releaseHiddenFocusBeforeOpen2 = import_react9.default.useCallback(() => {
|
|
28081
|
+
if (!modal || autoFocus || typeof document === "undefined") {
|
|
28082
|
+
return;
|
|
28083
|
+
}
|
|
28084
|
+
const activeElement = document.activeElement;
|
|
28085
|
+
if (!activeElement || activeElement === document.body) {
|
|
28086
|
+
return;
|
|
28087
|
+
}
|
|
28088
|
+
const activeElementNode = activeElement;
|
|
28089
|
+
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28090
|
+
return;
|
|
28091
|
+
}
|
|
28092
|
+
if (typeof activeElementNode.blur !== "function") {
|
|
28093
|
+
return;
|
|
28094
|
+
}
|
|
28095
|
+
activeElementNode.blur();
|
|
28096
|
+
}, [autoFocus, modal]);
|
|
28080
28097
|
const onSnapPointChange = import_react9.default.useCallback((activeSnapPointIndex2) => {
|
|
28081
28098
|
if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
28082
28099
|
}, []);
|
|
@@ -28136,22 +28153,11 @@ function Root2({
|
|
|
28136
28153
|
autoFocus
|
|
28137
28154
|
});
|
|
28138
28155
|
useSafeLayoutEffect(() => {
|
|
28139
|
-
if (!isOpen
|
|
28156
|
+
if (!isOpen) {
|
|
28140
28157
|
return;
|
|
28141
28158
|
}
|
|
28142
|
-
|
|
28143
|
-
|
|
28144
|
-
return;
|
|
28145
|
-
}
|
|
28146
|
-
const activeElementNode = activeElement;
|
|
28147
|
-
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28148
|
-
return;
|
|
28149
|
-
}
|
|
28150
|
-
if (typeof activeElementNode.blur !== "function") {
|
|
28151
|
-
return;
|
|
28152
|
-
}
|
|
28153
|
-
activeElementNode.blur();
|
|
28154
|
-
}, [autoFocus, isOpen, modal]);
|
|
28159
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28160
|
+
}, [isOpen, releaseHiddenFocusBeforeOpen2]);
|
|
28155
28161
|
function getScale() {
|
|
28156
28162
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
28157
28163
|
}
|
|
@@ -28535,6 +28541,7 @@ function Root2({
|
|
|
28535
28541
|
onOpenChange: (open) => {
|
|
28536
28542
|
if (!dismissible && !open) return;
|
|
28537
28543
|
if (open) {
|
|
28544
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28538
28545
|
setHasBeenOpened(true);
|
|
28539
28546
|
} else {
|
|
28540
28547
|
closeDrawer2(true);
|
package/dist/svelte/index.mjs
CHANGED
|
@@ -28049,6 +28049,23 @@ function Root2({
|
|
|
28049
28049
|
const drawerHeightRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
|
|
28050
28050
|
const drawerWidthRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
28051
28051
|
const initialDrawerHeight = import_react9.default.useRef(0);
|
|
28052
|
+
const releaseHiddenFocusBeforeOpen2 = import_react9.default.useCallback(() => {
|
|
28053
|
+
if (!modal || autoFocus || typeof document === "undefined") {
|
|
28054
|
+
return;
|
|
28055
|
+
}
|
|
28056
|
+
const activeElement = document.activeElement;
|
|
28057
|
+
if (!activeElement || activeElement === document.body) {
|
|
28058
|
+
return;
|
|
28059
|
+
}
|
|
28060
|
+
const activeElementNode = activeElement;
|
|
28061
|
+
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28062
|
+
return;
|
|
28063
|
+
}
|
|
28064
|
+
if (typeof activeElementNode.blur !== "function") {
|
|
28065
|
+
return;
|
|
28066
|
+
}
|
|
28067
|
+
activeElementNode.blur();
|
|
28068
|
+
}, [autoFocus, modal]);
|
|
28052
28069
|
const onSnapPointChange = import_react9.default.useCallback((activeSnapPointIndex2) => {
|
|
28053
28070
|
if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
28054
28071
|
}, []);
|
|
@@ -28108,22 +28125,11 @@ function Root2({
|
|
|
28108
28125
|
autoFocus
|
|
28109
28126
|
});
|
|
28110
28127
|
useSafeLayoutEffect(() => {
|
|
28111
|
-
if (!isOpen
|
|
28128
|
+
if (!isOpen) {
|
|
28112
28129
|
return;
|
|
28113
28130
|
}
|
|
28114
|
-
|
|
28115
|
-
|
|
28116
|
-
return;
|
|
28117
|
-
}
|
|
28118
|
-
const activeElementNode = activeElement;
|
|
28119
|
-
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28120
|
-
return;
|
|
28121
|
-
}
|
|
28122
|
-
if (typeof activeElementNode.blur !== "function") {
|
|
28123
|
-
return;
|
|
28124
|
-
}
|
|
28125
|
-
activeElementNode.blur();
|
|
28126
|
-
}, [autoFocus, isOpen, modal]);
|
|
28131
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28132
|
+
}, [isOpen, releaseHiddenFocusBeforeOpen2]);
|
|
28127
28133
|
function getScale() {
|
|
28128
28134
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
28129
28135
|
}
|
|
@@ -28507,6 +28513,7 @@ function Root2({
|
|
|
28507
28513
|
onOpenChange: (open) => {
|
|
28508
28514
|
if (!dismissible && !open) return;
|
|
28509
28515
|
if (open) {
|
|
28516
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28510
28517
|
setHasBeenOpened(true);
|
|
28511
28518
|
} else {
|
|
28512
28519
|
closeDrawer2(true);
|
|
@@ -1528,6 +1528,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1528
1528
|
const drawerHeightRef = React__namespace.default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1529
1529
|
const drawerWidthRef = React__namespace.default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1530
1530
|
const initialDrawerHeight = React__namespace.default.useRef(0);
|
|
1531
|
+
const releaseHiddenFocusBeforeOpen = React__namespace.default.useCallback(()=>{
|
|
1532
|
+
var _drawerRef_current;
|
|
1533
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1534
|
+
return;
|
|
1535
|
+
}
|
|
1536
|
+
const activeElement = document.activeElement;
|
|
1537
|
+
if (!activeElement || activeElement === document.body) {
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
const activeElementNode = activeElement;
|
|
1541
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
activeElementNode.blur();
|
|
1548
|
+
}, [
|
|
1549
|
+
autoFocus,
|
|
1550
|
+
modal
|
|
1551
|
+
]);
|
|
1531
1552
|
const onSnapPointChange = React__namespace.default.useCallback((activeSnapPointIndex)=>{
|
|
1532
1553
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1533
1554
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1579,26 +1600,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1579
1600
|
autoFocus
|
|
1580
1601
|
});
|
|
1581
1602
|
useSafeLayoutEffect(()=>{
|
|
1582
|
-
|
|
1583
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1603
|
+
if (!isOpen) {
|
|
1584
1604
|
return;
|
|
1585
1605
|
}
|
|
1586
|
-
|
|
1587
|
-
if (!activeElement || activeElement === document.body) {
|
|
1588
|
-
return;
|
|
1589
|
-
}
|
|
1590
|
-
const activeElementNode = activeElement;
|
|
1591
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1592
|
-
return;
|
|
1593
|
-
}
|
|
1594
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1595
|
-
return;
|
|
1596
|
-
}
|
|
1597
|
-
activeElementNode.blur();
|
|
1606
|
+
releaseHiddenFocusBeforeOpen();
|
|
1598
1607
|
}, [
|
|
1599
|
-
autoFocus,
|
|
1600
1608
|
isOpen,
|
|
1601
|
-
|
|
1609
|
+
releaseHiddenFocusBeforeOpen
|
|
1602
1610
|
]);
|
|
1603
1611
|
function getScale() {
|
|
1604
1612
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -2007,6 +2015,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
2007
2015
|
onOpenChange: (open)=>{
|
|
2008
2016
|
if (!dismissible && !open) return;
|
|
2009
2017
|
if (open) {
|
|
2018
|
+
releaseHiddenFocusBeforeOpen();
|
|
2010
2019
|
setHasBeenOpened(true);
|
|
2011
2020
|
} else {
|
|
2012
2021
|
closeDrawer(true);
|
|
@@ -1508,6 +1508,27 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1508
1508
|
const drawerHeightRef = React__default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
1509
1509
|
const drawerWidthRef = React__default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
1510
1510
|
const initialDrawerHeight = React__default.useRef(0);
|
|
1511
|
+
const releaseHiddenFocusBeforeOpen = React__default.useCallback(()=>{
|
|
1512
|
+
var _drawerRef_current;
|
|
1513
|
+
if (!modal || autoFocus || typeof document === 'undefined') {
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
const activeElement = document.activeElement;
|
|
1517
|
+
if (!activeElement || activeElement === document.body) {
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
const activeElementNode = activeElement;
|
|
1521
|
+
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
if (typeof activeElementNode.blur !== 'function') {
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
activeElementNode.blur();
|
|
1528
|
+
}, [
|
|
1529
|
+
autoFocus,
|
|
1530
|
+
modal
|
|
1531
|
+
]);
|
|
1511
1532
|
const onSnapPointChange = React__default.useCallback((activeSnapPointIndex)=>{
|
|
1512
1533
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
1513
1534
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -1559,26 +1580,13 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1559
1580
|
autoFocus
|
|
1560
1581
|
});
|
|
1561
1582
|
useSafeLayoutEffect(()=>{
|
|
1562
|
-
|
|
1563
|
-
if (!isOpen || !modal || autoFocus || typeof document === 'undefined') {
|
|
1583
|
+
if (!isOpen) {
|
|
1564
1584
|
return;
|
|
1565
1585
|
}
|
|
1566
|
-
|
|
1567
|
-
if (!activeElement || activeElement === document.body) {
|
|
1568
|
-
return;
|
|
1569
|
-
}
|
|
1570
|
-
const activeElementNode = activeElement;
|
|
1571
|
-
if (((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.contains(activeElementNode)) || (activeElementNode.closest == null ? void 0 : activeElementNode.closest.call(activeElementNode, '[data-drawer]'))) {
|
|
1572
|
-
return;
|
|
1573
|
-
}
|
|
1574
|
-
if (typeof activeElementNode.blur !== 'function') {
|
|
1575
|
-
return;
|
|
1576
|
-
}
|
|
1577
|
-
activeElementNode.blur();
|
|
1586
|
+
releaseHiddenFocusBeforeOpen();
|
|
1578
1587
|
}, [
|
|
1579
|
-
autoFocus,
|
|
1580
1588
|
isOpen,
|
|
1581
|
-
|
|
1589
|
+
releaseHiddenFocusBeforeOpen
|
|
1582
1590
|
]);
|
|
1583
1591
|
function getScale() {
|
|
1584
1592
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
@@ -1987,6 +1995,7 @@ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRe
|
|
|
1987
1995
|
onOpenChange: (open)=>{
|
|
1988
1996
|
if (!dismissible && !open) return;
|
|
1989
1997
|
if (open) {
|
|
1998
|
+
releaseHiddenFocusBeforeOpen();
|
|
1990
1999
|
setHasBeenOpened(true);
|
|
1991
2000
|
} else {
|
|
1992
2001
|
closeDrawer(true);
|
package/dist/vue/index.js
CHANGED
|
@@ -28077,6 +28077,23 @@ function Root2({
|
|
|
28077
28077
|
const drawerHeightRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
|
|
28078
28078
|
const drawerWidthRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
28079
28079
|
const initialDrawerHeight = import_react9.default.useRef(0);
|
|
28080
|
+
const releaseHiddenFocusBeforeOpen2 = import_react9.default.useCallback(() => {
|
|
28081
|
+
if (!modal || autoFocus || typeof document === "undefined") {
|
|
28082
|
+
return;
|
|
28083
|
+
}
|
|
28084
|
+
const activeElement = document.activeElement;
|
|
28085
|
+
if (!activeElement || activeElement === document.body) {
|
|
28086
|
+
return;
|
|
28087
|
+
}
|
|
28088
|
+
const activeElementNode = activeElement;
|
|
28089
|
+
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28090
|
+
return;
|
|
28091
|
+
}
|
|
28092
|
+
if (typeof activeElementNode.blur !== "function") {
|
|
28093
|
+
return;
|
|
28094
|
+
}
|
|
28095
|
+
activeElementNode.blur();
|
|
28096
|
+
}, [autoFocus, modal]);
|
|
28080
28097
|
const onSnapPointChange = import_react9.default.useCallback((activeSnapPointIndex2) => {
|
|
28081
28098
|
if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
28082
28099
|
}, []);
|
|
@@ -28136,22 +28153,11 @@ function Root2({
|
|
|
28136
28153
|
autoFocus
|
|
28137
28154
|
});
|
|
28138
28155
|
useSafeLayoutEffect(() => {
|
|
28139
|
-
if (!isOpen
|
|
28156
|
+
if (!isOpen) {
|
|
28140
28157
|
return;
|
|
28141
28158
|
}
|
|
28142
|
-
|
|
28143
|
-
|
|
28144
|
-
return;
|
|
28145
|
-
}
|
|
28146
|
-
const activeElementNode = activeElement;
|
|
28147
|
-
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28148
|
-
return;
|
|
28149
|
-
}
|
|
28150
|
-
if (typeof activeElementNode.blur !== "function") {
|
|
28151
|
-
return;
|
|
28152
|
-
}
|
|
28153
|
-
activeElementNode.blur();
|
|
28154
|
-
}, [autoFocus, isOpen, modal]);
|
|
28159
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28160
|
+
}, [isOpen, releaseHiddenFocusBeforeOpen2]);
|
|
28155
28161
|
function getScale() {
|
|
28156
28162
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
28157
28163
|
}
|
|
@@ -28535,6 +28541,7 @@ function Root2({
|
|
|
28535
28541
|
onOpenChange: (open) => {
|
|
28536
28542
|
if (!dismissible && !open) return;
|
|
28537
28543
|
if (open) {
|
|
28544
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28538
28545
|
setHasBeenOpened(true);
|
|
28539
28546
|
} else {
|
|
28540
28547
|
closeDrawer2(true);
|
package/dist/vue/index.mjs
CHANGED
|
@@ -28052,6 +28052,23 @@ function Root2({
|
|
|
28052
28052
|
const drawerHeightRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
|
|
28053
28053
|
const drawerWidthRef = import_react9.default.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
28054
28054
|
const initialDrawerHeight = import_react9.default.useRef(0);
|
|
28055
|
+
const releaseHiddenFocusBeforeOpen2 = import_react9.default.useCallback(() => {
|
|
28056
|
+
if (!modal || autoFocus || typeof document === "undefined") {
|
|
28057
|
+
return;
|
|
28058
|
+
}
|
|
28059
|
+
const activeElement = document.activeElement;
|
|
28060
|
+
if (!activeElement || activeElement === document.body) {
|
|
28061
|
+
return;
|
|
28062
|
+
}
|
|
28063
|
+
const activeElementNode = activeElement;
|
|
28064
|
+
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28065
|
+
return;
|
|
28066
|
+
}
|
|
28067
|
+
if (typeof activeElementNode.blur !== "function") {
|
|
28068
|
+
return;
|
|
28069
|
+
}
|
|
28070
|
+
activeElementNode.blur();
|
|
28071
|
+
}, [autoFocus, modal]);
|
|
28055
28072
|
const onSnapPointChange = import_react9.default.useCallback((activeSnapPointIndex2) => {
|
|
28056
28073
|
if (snapPoints && activeSnapPointIndex2 === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
28057
28074
|
}, []);
|
|
@@ -28111,22 +28128,11 @@ function Root2({
|
|
|
28111
28128
|
autoFocus
|
|
28112
28129
|
});
|
|
28113
28130
|
useSafeLayoutEffect(() => {
|
|
28114
|
-
if (!isOpen
|
|
28131
|
+
if (!isOpen) {
|
|
28115
28132
|
return;
|
|
28116
28133
|
}
|
|
28117
|
-
|
|
28118
|
-
|
|
28119
|
-
return;
|
|
28120
|
-
}
|
|
28121
|
-
const activeElementNode = activeElement;
|
|
28122
|
-
if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
|
|
28123
|
-
return;
|
|
28124
|
-
}
|
|
28125
|
-
if (typeof activeElementNode.blur !== "function") {
|
|
28126
|
-
return;
|
|
28127
|
-
}
|
|
28128
|
-
activeElementNode.blur();
|
|
28129
|
-
}, [autoFocus, isOpen, modal]);
|
|
28134
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28135
|
+
}, [isOpen, releaseHiddenFocusBeforeOpen2]);
|
|
28130
28136
|
function getScale() {
|
|
28131
28137
|
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
28132
28138
|
}
|
|
@@ -28510,6 +28516,7 @@ function Root2({
|
|
|
28510
28516
|
onOpenChange: (open) => {
|
|
28511
28517
|
if (!dismissible && !open) return;
|
|
28512
28518
|
if (open) {
|
|
28519
|
+
releaseHiddenFocusBeforeOpen2();
|
|
28513
28520
|
setHasBeenOpened(true);
|
|
28514
28521
|
} else {
|
|
28515
28522
|
closeDrawer2(true);
|