@nextui-org/react 1.0.1-alpha.50 → 1.0.1-alpha.51
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/cjs/index.d.ts +2 -0
- package/cjs/index.js +12 -2
- package/cjs/modal/modal-wrapper.js +14 -7
- package/esm/index.d.ts +2 -0
- package/esm/index.js +3 -1
- package/esm/modal/modal-wrapper.js +15 -8
- package/package.json +1 -1
- package/umd/nextui.js +223 -212
- package/umd/nextui.min.js +1 -1
package/umd/nextui.js
CHANGED
|
@@ -965,6 +965,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
965
965
|
// EXPORTS
|
|
966
966
|
__webpack_require__.d(__webpack_exports__, {
|
|
967
967
|
"Avatar": () => (/* reexport */ src_avatar),
|
|
968
|
+
"Backdrop": () => (/* reexport */ backdrop),
|
|
968
969
|
"Button": () => (/* reexport */ src_button),
|
|
969
970
|
"Card": () => (/* reexport */ src_card),
|
|
970
971
|
"Checkbox": () => (/* reexport */ src_checkbox),
|
|
@@ -994,6 +995,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
994
995
|
"useClickAway": () => (/* reexport */ src_use_click_away),
|
|
995
996
|
"useCurrentState": () => (/* reexport */ src_use_current_state),
|
|
996
997
|
"useInput": () => (/* reexport */ src_use_input),
|
|
998
|
+
"useKeyboard": () => (/* reexport */ src_use_keyboard),
|
|
997
999
|
"useModal": () => (/* reexport */ use_modal),
|
|
998
1000
|
"usePortal": () => (/* reexport */ src_use_portal),
|
|
999
1001
|
"useRealShape": () => (/* reexport */ src_use_real_shape),
|
|
@@ -1647,6 +1649,202 @@ const useInput = initialValue => {
|
|
|
1647
1649
|
;// CONCATENATED MODULE: ./src/use-input/index.ts
|
|
1648
1650
|
|
|
1649
1651
|
/* harmony default export */ const src_use_input = (use_input);
|
|
1652
|
+
;// CONCATENATED MODULE: ./src/use-keyboard/codes.ts
|
|
1653
|
+
/**
|
|
1654
|
+
* KeyBinding Codes
|
|
1655
|
+
* The content of this file is based on the design of the open source project "microsoft/vscode",
|
|
1656
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1657
|
+
*
|
|
1658
|
+
* We inherit the KeyMod values from "microsoft/vscode",
|
|
1659
|
+
* but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
|
|
1660
|
+
*/
|
|
1661
|
+
let KeyCode;
|
|
1662
|
+
|
|
1663
|
+
(function (KeyCode) {
|
|
1664
|
+
KeyCode[KeyCode["Unknown"] = 0] = "Unknown";
|
|
1665
|
+
KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
|
|
1666
|
+
KeyCode[KeyCode["Tab"] = 9] = "Tab";
|
|
1667
|
+
KeyCode[KeyCode["Enter"] = 13] = "Enter";
|
|
1668
|
+
KeyCode[KeyCode["Shift"] = 16] = "Shift";
|
|
1669
|
+
KeyCode[KeyCode["Ctrl"] = 17] = "Ctrl";
|
|
1670
|
+
KeyCode[KeyCode["Alt"] = 18] = "Alt";
|
|
1671
|
+
KeyCode[KeyCode["PauseBreak"] = 19] = "PauseBreak";
|
|
1672
|
+
KeyCode[KeyCode["CapsLock"] = 20] = "CapsLock";
|
|
1673
|
+
KeyCode[KeyCode["Escape"] = 27] = "Escape";
|
|
1674
|
+
KeyCode[KeyCode["Space"] = 32] = "Space";
|
|
1675
|
+
KeyCode[KeyCode["PageUp"] = 33] = "PageUp";
|
|
1676
|
+
KeyCode[KeyCode["PageDown"] = 34] = "PageDown";
|
|
1677
|
+
KeyCode[KeyCode["End"] = 35] = "End";
|
|
1678
|
+
KeyCode[KeyCode["Home"] = 36] = "Home";
|
|
1679
|
+
KeyCode[KeyCode["LeftArrow"] = 37] = "LeftArrow";
|
|
1680
|
+
KeyCode[KeyCode["UpArrow"] = 38] = "UpArrow";
|
|
1681
|
+
KeyCode[KeyCode["RightArrow"] = 39] = "RightArrow";
|
|
1682
|
+
KeyCode[KeyCode["DownArrow"] = 40] = "DownArrow";
|
|
1683
|
+
KeyCode[KeyCode["Insert"] = 45] = "Insert";
|
|
1684
|
+
KeyCode[KeyCode["Delete"] = 46] = "Delete";
|
|
1685
|
+
KeyCode[KeyCode["KEY_0"] = 48] = "KEY_0";
|
|
1686
|
+
KeyCode[KeyCode["KEY_1"] = 49] = "KEY_1";
|
|
1687
|
+
KeyCode[KeyCode["KEY_2"] = 50] = "KEY_2";
|
|
1688
|
+
KeyCode[KeyCode["KEY_3"] = 51] = "KEY_3";
|
|
1689
|
+
KeyCode[KeyCode["KEY_4"] = 52] = "KEY_4";
|
|
1690
|
+
KeyCode[KeyCode["KEY_5"] = 53] = "KEY_5";
|
|
1691
|
+
KeyCode[KeyCode["KEY_6"] = 54] = "KEY_6";
|
|
1692
|
+
KeyCode[KeyCode["KEY_7"] = 55] = "KEY_7";
|
|
1693
|
+
KeyCode[KeyCode["KEY_8"] = 56] = "KEY_8";
|
|
1694
|
+
KeyCode[KeyCode["KEY_9"] = 57] = "KEY_9";
|
|
1695
|
+
KeyCode[KeyCode["KEY_A"] = 65] = "KEY_A";
|
|
1696
|
+
KeyCode[KeyCode["KEY_B"] = 66] = "KEY_B";
|
|
1697
|
+
KeyCode[KeyCode["KEY_C"] = 67] = "KEY_C";
|
|
1698
|
+
KeyCode[KeyCode["KEY_D"] = 68] = "KEY_D";
|
|
1699
|
+
KeyCode[KeyCode["KEY_E"] = 69] = "KEY_E";
|
|
1700
|
+
KeyCode[KeyCode["KEY_F"] = 70] = "KEY_F";
|
|
1701
|
+
KeyCode[KeyCode["KEY_G"] = 71] = "KEY_G";
|
|
1702
|
+
KeyCode[KeyCode["KEY_H"] = 72] = "KEY_H";
|
|
1703
|
+
KeyCode[KeyCode["KEY_I"] = 73] = "KEY_I";
|
|
1704
|
+
KeyCode[KeyCode["KEY_J"] = 74] = "KEY_J";
|
|
1705
|
+
KeyCode[KeyCode["KEY_K"] = 75] = "KEY_K";
|
|
1706
|
+
KeyCode[KeyCode["KEY_L"] = 76] = "KEY_L";
|
|
1707
|
+
KeyCode[KeyCode["KEY_M"] = 77] = "KEY_M";
|
|
1708
|
+
KeyCode[KeyCode["KEY_N"] = 78] = "KEY_N";
|
|
1709
|
+
KeyCode[KeyCode["KEY_O"] = 79] = "KEY_O";
|
|
1710
|
+
KeyCode[KeyCode["KEY_P"] = 80] = "KEY_P";
|
|
1711
|
+
KeyCode[KeyCode["KEY_Q"] = 81] = "KEY_Q";
|
|
1712
|
+
KeyCode[KeyCode["KEY_R"] = 82] = "KEY_R";
|
|
1713
|
+
KeyCode[KeyCode["KEY_S"] = 83] = "KEY_S";
|
|
1714
|
+
KeyCode[KeyCode["KEY_T"] = 84] = "KEY_T";
|
|
1715
|
+
KeyCode[KeyCode["KEY_U"] = 85] = "KEY_U";
|
|
1716
|
+
KeyCode[KeyCode["KEY_V"] = 86] = "KEY_V";
|
|
1717
|
+
KeyCode[KeyCode["KEY_W"] = 87] = "KEY_W";
|
|
1718
|
+
KeyCode[KeyCode["KEY_X"] = 88] = "KEY_X";
|
|
1719
|
+
KeyCode[KeyCode["KEY_Y"] = 89] = "KEY_Y";
|
|
1720
|
+
KeyCode[KeyCode["KEY_Z"] = 90] = "KEY_Z";
|
|
1721
|
+
KeyCode[KeyCode["Meta"] = 91] = "Meta";
|
|
1722
|
+
KeyCode[KeyCode["F1"] = 112] = "F1";
|
|
1723
|
+
KeyCode[KeyCode["F2"] = 113] = "F2";
|
|
1724
|
+
KeyCode[KeyCode["F3"] = 114] = "F3";
|
|
1725
|
+
KeyCode[KeyCode["F4"] = 115] = "F4";
|
|
1726
|
+
KeyCode[KeyCode["F5"] = 116] = "F5";
|
|
1727
|
+
KeyCode[KeyCode["F6"] = 117] = "F6";
|
|
1728
|
+
KeyCode[KeyCode["F7"] = 118] = "F7";
|
|
1729
|
+
KeyCode[KeyCode["F8"] = 119] = "F8";
|
|
1730
|
+
KeyCode[KeyCode["F9"] = 120] = "F9";
|
|
1731
|
+
KeyCode[KeyCode["F10"] = 121] = "F10";
|
|
1732
|
+
KeyCode[KeyCode["F11"] = 122] = "F11";
|
|
1733
|
+
KeyCode[KeyCode["F12"] = 123] = "F12";
|
|
1734
|
+
KeyCode[KeyCode["NumLock"] = 144] = "NumLock";
|
|
1735
|
+
KeyCode[KeyCode["ScrollLock"] = 145] = "ScrollLock";
|
|
1736
|
+
KeyCode[KeyCode["Equal"] = 187] = "Equal";
|
|
1737
|
+
KeyCode[KeyCode["Minus"] = 189] = "Minus";
|
|
1738
|
+
KeyCode[KeyCode["Backquote"] = 192] = "Backquote";
|
|
1739
|
+
KeyCode[KeyCode["Backslash"] = 220] = "Backslash";
|
|
1740
|
+
})(KeyCode || (KeyCode = {}));
|
|
1741
|
+
|
|
1742
|
+
let KeyMod;
|
|
1743
|
+
|
|
1744
|
+
(function (KeyMod) {
|
|
1745
|
+
KeyMod[KeyMod["CtrlCmd"] = 2048] = "CtrlCmd";
|
|
1746
|
+
KeyMod[KeyMod["Shift"] = 1024] = "Shift";
|
|
1747
|
+
KeyMod[KeyMod["Alt"] = 512] = "Alt";
|
|
1748
|
+
KeyMod[KeyMod["WinCtrl"] = 256] = "WinCtrl";
|
|
1749
|
+
})(KeyMod || (KeyMod = {}));
|
|
1750
|
+
;// CONCATENATED MODULE: ./src/use-keyboard/helper.ts
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
/* istanbul ignore next */
|
|
1754
|
+
|
|
1755
|
+
const getCtrlKeysByPlatform = () => {
|
|
1756
|
+
return {
|
|
1757
|
+
CtrlCmd: isMac() ? 'metaKey' : 'ctrlKey',
|
|
1758
|
+
WinCtrl: isMac() ? 'ctrlKey' : 'metaKey'
|
|
1759
|
+
};
|
|
1760
|
+
};
|
|
1761
|
+
const getActiveModMap = bindings => {
|
|
1762
|
+
const modBindings = bindings.filter(item => !!KeyMod[item]);
|
|
1763
|
+
const activeModMap = {
|
|
1764
|
+
CtrlCmd: false,
|
|
1765
|
+
Shift: false,
|
|
1766
|
+
Alt: false,
|
|
1767
|
+
WinCtrl: false
|
|
1768
|
+
};
|
|
1769
|
+
modBindings.forEach(code => {
|
|
1770
|
+
const modKey = KeyMod[code];
|
|
1771
|
+
activeModMap[modKey] = true;
|
|
1772
|
+
});
|
|
1773
|
+
return activeModMap;
|
|
1774
|
+
};
|
|
1775
|
+
;// CONCATENATED MODULE: ./src/use-keyboard/use-keyboard.ts
|
|
1776
|
+
|
|
1777
|
+
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
const useKeyboard = (handler, keyBindings, options = {}) => {
|
|
1781
|
+
const bindings = Array.isArray(keyBindings) ? keyBindings : [keyBindings];
|
|
1782
|
+
const {
|
|
1783
|
+
disableGlobalEvent = false,
|
|
1784
|
+
capture = false,
|
|
1785
|
+
stopPropagation = false,
|
|
1786
|
+
preventDefault = true,
|
|
1787
|
+
event = 'keydown'
|
|
1788
|
+
} = options;
|
|
1789
|
+
const activeModMap = getActiveModMap(bindings);
|
|
1790
|
+
const keyCode = bindings.filter(item => !KeyMod[item])[0];
|
|
1791
|
+
const {
|
|
1792
|
+
CtrlCmd,
|
|
1793
|
+
WinCtrl
|
|
1794
|
+
} = getCtrlKeysByPlatform();
|
|
1795
|
+
|
|
1796
|
+
const eventHandler = event => {
|
|
1797
|
+
if (activeModMap.Shift && !event.shiftKey) return;
|
|
1798
|
+
if (activeModMap.Alt && !event.altKey) return;
|
|
1799
|
+
if (activeModMap.CtrlCmd && !event[CtrlCmd]) return;
|
|
1800
|
+
if (activeModMap.WinCtrl && !event[WinCtrl]) return;
|
|
1801
|
+
if (keyCode && event.keyCode !== keyCode) return;
|
|
1802
|
+
|
|
1803
|
+
if (stopPropagation) {
|
|
1804
|
+
event.stopPropagation();
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
if (preventDefault) {
|
|
1808
|
+
event.preventDefault();
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
handler && handler(event);
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1814
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
|
|
1815
|
+
if (!disableGlobalEvent) {
|
|
1816
|
+
document.addEventListener(event, eventHandler);
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
return () => {
|
|
1820
|
+
document.removeEventListener(event, eventHandler);
|
|
1821
|
+
};
|
|
1822
|
+
}, [disableGlobalEvent]);
|
|
1823
|
+
|
|
1824
|
+
const elementBindingHandler = (elementEventType, isCapture = false) => {
|
|
1825
|
+
if (elementEventType !== event) return () => {};
|
|
1826
|
+
if (isCapture !== capture) return () => {};
|
|
1827
|
+
return e => eventHandler(e);
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1830
|
+
return {
|
|
1831
|
+
bindings: {
|
|
1832
|
+
onKeyDown: elementBindingHandler('keydown'),
|
|
1833
|
+
onKeyDownCapture: elementBindingHandler('keydown', true),
|
|
1834
|
+
onKeyPress: elementBindingHandler('keypress'),
|
|
1835
|
+
onKeyPressCapture: elementBindingHandler('keypress', true),
|
|
1836
|
+
onKeyUp: elementBindingHandler('keyup'),
|
|
1837
|
+
onKeyUpCapture: elementBindingHandler('keyup', true)
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
};
|
|
1841
|
+
|
|
1842
|
+
/* harmony default export */ const use_keyboard = (useKeyboard);
|
|
1843
|
+
;// CONCATENATED MODULE: ./src/use-keyboard/index.ts
|
|
1844
|
+
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+
/* harmony default export */ const src_use_keyboard = (use_keyboard);
|
|
1650
1848
|
// EXTERNAL MODULE: ../../node_modules/styled-jsx/style.js
|
|
1651
1849
|
var styled_jsx_style = __webpack_require__(746);
|
|
1652
1850
|
;// CONCATENATED MODULE: ./src/utils/prop-types.ts
|
|
@@ -7409,6 +7607,12 @@ const ModalWrapper = ({
|
|
|
7409
7607
|
const modalContent = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
7410
7608
|
const tabStart = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
7411
7609
|
const tabEnd = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
7610
|
+
const [rendered, setRendered] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
|
|
7611
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
|
|
7612
|
+
setTimeout(() => {
|
|
7613
|
+
setRendered(true);
|
|
7614
|
+
}, 300);
|
|
7615
|
+
}, []);
|
|
7412
7616
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
|
|
7413
7617
|
if (!visible) return;
|
|
7414
7618
|
const activeElement = document.activeElement;
|
|
@@ -7450,48 +7654,49 @@ const ModalWrapper = ({
|
|
|
7450
7654
|
onKeyDown: onKeyDown,
|
|
7451
7655
|
ref: modalContent,
|
|
7452
7656
|
...props,
|
|
7453
|
-
className: styled_jsx_style["default"].dynamic([["
|
|
7657
|
+
className: styled_jsx_style["default"].dynamic([["1270377280", [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.type === 'light' ? theme.palette.background : theme.palette.accents_1, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + (props && props.className != null && props.className || clsx('modal-wrapper', {
|
|
7454
7658
|
fullscreen: fullScreen,
|
|
7455
7659
|
'with-close-button': closeButton,
|
|
7456
|
-
'modal-rebound': rebound
|
|
7660
|
+
'modal-rebound': rebound,
|
|
7661
|
+
rendered
|
|
7457
7662
|
}, className) || ""),
|
|
7458
7663
|
children: [/*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)("div", {
|
|
7459
7664
|
tabIndex: 0,
|
|
7460
7665
|
"aria-hidden": "true",
|
|
7461
7666
|
ref: tabStart,
|
|
7462
|
-
className: styled_jsx_style["default"].dynamic([["
|
|
7667
|
+
className: styled_jsx_style["default"].dynamic([["1270377280", [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.type === 'light' ? theme.palette.background : theme.palette.accents_1, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + "hide-tab"
|
|
7463
7668
|
}, void 0, false, {
|
|
7464
7669
|
fileName: modal_wrapper_jsxFileName,
|
|
7465
|
-
lineNumber:
|
|
7670
|
+
lineNumber: 103,
|
|
7466
7671
|
columnNumber: 9
|
|
7467
7672
|
}, undefined), closeButton && /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(modal_close_button, {
|
|
7468
7673
|
onClick: handleClose
|
|
7469
7674
|
}, void 0, false, {
|
|
7470
7675
|
fileName: modal_wrapper_jsxFileName,
|
|
7471
|
-
lineNumber:
|
|
7676
|
+
lineNumber: 109,
|
|
7472
7677
|
columnNumber: 25
|
|
7473
7678
|
}, undefined), children, /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)("div", {
|
|
7474
7679
|
tabIndex: 0,
|
|
7475
7680
|
"aria-hidden": "true",
|
|
7476
7681
|
ref: tabEnd,
|
|
7477
|
-
className: styled_jsx_style["default"].dynamic([["
|
|
7682
|
+
className: styled_jsx_style["default"].dynamic([["1270377280", [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.type === 'light' ? theme.palette.background : theme.palette.accents_1, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + "hide-tab"
|
|
7478
7683
|
}, void 0, false, {
|
|
7479
7684
|
fileName: modal_wrapper_jsxFileName,
|
|
7480
|
-
lineNumber:
|
|
7685
|
+
lineNumber: 111,
|
|
7481
7686
|
columnNumber: 9
|
|
7482
7687
|
}, undefined), /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(styled_jsx_style["default"], {
|
|
7483
|
-
id: "
|
|
7484
|
-
dynamic: [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap],
|
|
7485
|
-
children: `.modal-wrapper.__jsx-style-dynamic-selector{max-width:100%;vertical-align:middle;overflow:hidden;height:-webkit-fit-content(20em);height:-moz-fit-content(20em);height:fit-content(20em);max-height:${scroll ? 'calc(100vh - 200px)' : 'inherit'};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:relative;box-sizing:border-box;background-color:${theme.palette.background};color:${theme.palette.foreground};border-radius:${theme.layout.radius};box-shadow:${theme.expressiveness.shadowLarge};
|
|
7688
|
+
id: "1270377280",
|
|
7689
|
+
dynamic: [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.type === 'light' ? theme.palette.background : theme.palette.accents_1, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap],
|
|
7690
|
+
children: `.modal-wrapper.__jsx-style-dynamic-selector{max-width:100%;vertical-align:middle;overflow:hidden;height:-webkit-fit-content(20em);height:-moz-fit-content(20em);height:fit-content(20em);max-height:${scroll ? 'calc(100vh - 200px)' : 'inherit'};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:relative;box-sizing:border-box;background-color:${theme.type === 'light' ? theme.palette.background : theme.palette.accents_1};color:${theme.palette.foreground};border-radius:${theme.layout.radius};box-shadow:${theme.expressiveness.shadowLarge};outline:none;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;}.hide-tab.__jsx-style-dynamic-selector{outline:none;overflow:hidden;width:0;height:0;opacity:0;}.fullscreen.__jsx-style-dynamic-selector{width:100%;height:100%;max-height:100%;}.modal-rebound.__jsx-style-dynamic-selector:not(.fullscreen){-webkit-animation-duration:250ms;animation-duration:250ms;-webkit-animation-name:rebound-__jsx-style-dynamic-selector;animation-name:rebound-__jsx-style-dynamic-selector;-webkit-animation-timing-function:ease;animation-timing-function:ease;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;}.modal-wrapper-enter.__jsx-style-dynamic-selector:not(.rendered){-webkit-animation-name:appearance-in-__jsx-style-dynamic-selector;animation-name:appearance-in-__jsx-style-dynamic-selector;-webkit-animation-duration:200ms;animation-duration:200ms;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-direction:normal;animation-direction:normal;}.modal-wrapper-leave.__jsx-style-dynamic-selector{-webkit-animation-name:appearance-out-__jsx-style-dynamic-selector;animation-name:appearance-out-__jsx-style-dynamic-selector;-webkit-animation-duration:50ms;animation-duration:50ms;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out;}.with-close-button.__jsx-style-dynamic-selector{padding-top:${theme.layout.gap};}.fullscreen.__jsx-style-dynamic-selector .close-icon{top:${theme.layout.gap};right:calc(${theme.layout.gap} * 0.5);}.fullscreen.__jsx-style-dynamic-selector .close-icon svg{width:24px;height:24px;}@-webkit-keyframes appearance-in-__jsx-style-dynamic-selector{0%{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}60%{opacity:0.75;-webkit-transform:scale(1.02);-ms-transform:scale(1.02);transform:scale(1.02);}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@keyframes appearance-in-__jsx-style-dynamic-selector{0%{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}60%{opacity:0.75;-webkit-transform:scale(1.02);-ms-transform:scale(1.02);transform:scale(1.02);}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@-webkit-keyframes appearance-out-__jsx-style-dynamic-selector{0%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}100%{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}}@keyframes appearance-out-__jsx-style-dynamic-selector{0%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}100%{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}}@-webkit-keyframes rebound-__jsx-style-dynamic-selector{0%{-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}40%{-webkit-transform:scale(1.02);-ms-transform:scale(1.02);transform:scale(1.02);}80%{-webkit-transform:scale(0.98);-ms-transform:scale(0.98);transform:scale(0.98);}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@keyframes rebound-__jsx-style-dynamic-selector{0%{-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}40%{-webkit-transform:scale(1.02);-ms-transform:scale(1.02);transform:scale(1.02);}80%{-webkit-transform:scale(0.98);-ms-transform:scale(0.98);transform:scale(0.98);}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}`
|
|
7486
7691
|
}, void 0, false, void 0, undefined)]
|
|
7487
7692
|
}, void 0, true, {
|
|
7488
7693
|
fileName: modal_wrapper_jsxFileName,
|
|
7489
|
-
lineNumber:
|
|
7694
|
+
lineNumber: 85,
|
|
7490
7695
|
columnNumber: 7
|
|
7491
7696
|
}, undefined)
|
|
7492
7697
|
}, void 0, false, {
|
|
7493
7698
|
fileName: modal_wrapper_jsxFileName,
|
|
7494
|
-
lineNumber:
|
|
7699
|
+
lineNumber: 78,
|
|
7495
7700
|
columnNumber: 5
|
|
7496
7701
|
}, undefined);
|
|
7497
7702
|
};
|
|
@@ -7560,7 +7765,7 @@ const Backdrop = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react
|
|
|
7560
7765
|
className: styled_jsx_style["default"].dynamic([["903909204", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.breakpoints.sm.max]]]) + " " + (clsx('layer', blur ? 'layer-blur' : 'layer-default') || "")
|
|
7561
7766
|
}, void 0, false, {
|
|
7562
7767
|
fileName: backdrop_jsxFileName,
|
|
7563
|
-
lineNumber:
|
|
7768
|
+
lineNumber: 74,
|
|
7564
7769
|
columnNumber: 11
|
|
7565
7770
|
}, undefined), /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)("div", {
|
|
7566
7771
|
onClick: childrenClickHandler,
|
|
@@ -7569,7 +7774,7 @@ const Backdrop = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react
|
|
|
7569
7774
|
children: children
|
|
7570
7775
|
}, void 0, false, {
|
|
7571
7776
|
fileName: backdrop_jsxFileName,
|
|
7572
|
-
lineNumber:
|
|
7777
|
+
lineNumber: 77,
|
|
7573
7778
|
columnNumber: 11
|
|
7574
7779
|
}, undefined), /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(styled_jsx_style["default"], {
|
|
7575
7780
|
id: "903909204",
|
|
@@ -7578,12 +7783,12 @@ const Backdrop = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react
|
|
|
7578
7783
|
}, void 0, false, void 0, undefined)]
|
|
7579
7784
|
}, void 0, true, {
|
|
7580
7785
|
fileName: backdrop_jsxFileName,
|
|
7581
|
-
lineNumber:
|
|
7786
|
+
lineNumber: 66,
|
|
7582
7787
|
columnNumber: 9
|
|
7583
7788
|
}, undefined)
|
|
7584
7789
|
}, void 0, false, {
|
|
7585
7790
|
fileName: backdrop_jsxFileName,
|
|
7586
|
-
lineNumber:
|
|
7791
|
+
lineNumber: 59,
|
|
7587
7792
|
columnNumber: 7
|
|
7588
7793
|
}, undefined);
|
|
7589
7794
|
});
|
|
@@ -7598,202 +7803,6 @@ if (__DEV__) {
|
|
|
7598
7803
|
const modal_context_defaultContext = {};
|
|
7599
7804
|
const ModalContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext(modal_context_defaultContext);
|
|
7600
7805
|
const useModalContext = () => React.useContext(ModalContext);
|
|
7601
|
-
;// CONCATENATED MODULE: ./src/use-keyboard/codes.ts
|
|
7602
|
-
/**
|
|
7603
|
-
* KeyBinding Codes
|
|
7604
|
-
* The content of this file is based on the design of the open source project "microsoft/vscode",
|
|
7605
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7606
|
-
*
|
|
7607
|
-
* We inherit the KeyMod values from "microsoft/vscode",
|
|
7608
|
-
* but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
|
|
7609
|
-
*/
|
|
7610
|
-
let KeyCode;
|
|
7611
|
-
|
|
7612
|
-
(function (KeyCode) {
|
|
7613
|
-
KeyCode[KeyCode["Unknown"] = 0] = "Unknown";
|
|
7614
|
-
KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
|
|
7615
|
-
KeyCode[KeyCode["Tab"] = 9] = "Tab";
|
|
7616
|
-
KeyCode[KeyCode["Enter"] = 13] = "Enter";
|
|
7617
|
-
KeyCode[KeyCode["Shift"] = 16] = "Shift";
|
|
7618
|
-
KeyCode[KeyCode["Ctrl"] = 17] = "Ctrl";
|
|
7619
|
-
KeyCode[KeyCode["Alt"] = 18] = "Alt";
|
|
7620
|
-
KeyCode[KeyCode["PauseBreak"] = 19] = "PauseBreak";
|
|
7621
|
-
KeyCode[KeyCode["CapsLock"] = 20] = "CapsLock";
|
|
7622
|
-
KeyCode[KeyCode["Escape"] = 27] = "Escape";
|
|
7623
|
-
KeyCode[KeyCode["Space"] = 32] = "Space";
|
|
7624
|
-
KeyCode[KeyCode["PageUp"] = 33] = "PageUp";
|
|
7625
|
-
KeyCode[KeyCode["PageDown"] = 34] = "PageDown";
|
|
7626
|
-
KeyCode[KeyCode["End"] = 35] = "End";
|
|
7627
|
-
KeyCode[KeyCode["Home"] = 36] = "Home";
|
|
7628
|
-
KeyCode[KeyCode["LeftArrow"] = 37] = "LeftArrow";
|
|
7629
|
-
KeyCode[KeyCode["UpArrow"] = 38] = "UpArrow";
|
|
7630
|
-
KeyCode[KeyCode["RightArrow"] = 39] = "RightArrow";
|
|
7631
|
-
KeyCode[KeyCode["DownArrow"] = 40] = "DownArrow";
|
|
7632
|
-
KeyCode[KeyCode["Insert"] = 45] = "Insert";
|
|
7633
|
-
KeyCode[KeyCode["Delete"] = 46] = "Delete";
|
|
7634
|
-
KeyCode[KeyCode["KEY_0"] = 48] = "KEY_0";
|
|
7635
|
-
KeyCode[KeyCode["KEY_1"] = 49] = "KEY_1";
|
|
7636
|
-
KeyCode[KeyCode["KEY_2"] = 50] = "KEY_2";
|
|
7637
|
-
KeyCode[KeyCode["KEY_3"] = 51] = "KEY_3";
|
|
7638
|
-
KeyCode[KeyCode["KEY_4"] = 52] = "KEY_4";
|
|
7639
|
-
KeyCode[KeyCode["KEY_5"] = 53] = "KEY_5";
|
|
7640
|
-
KeyCode[KeyCode["KEY_6"] = 54] = "KEY_6";
|
|
7641
|
-
KeyCode[KeyCode["KEY_7"] = 55] = "KEY_7";
|
|
7642
|
-
KeyCode[KeyCode["KEY_8"] = 56] = "KEY_8";
|
|
7643
|
-
KeyCode[KeyCode["KEY_9"] = 57] = "KEY_9";
|
|
7644
|
-
KeyCode[KeyCode["KEY_A"] = 65] = "KEY_A";
|
|
7645
|
-
KeyCode[KeyCode["KEY_B"] = 66] = "KEY_B";
|
|
7646
|
-
KeyCode[KeyCode["KEY_C"] = 67] = "KEY_C";
|
|
7647
|
-
KeyCode[KeyCode["KEY_D"] = 68] = "KEY_D";
|
|
7648
|
-
KeyCode[KeyCode["KEY_E"] = 69] = "KEY_E";
|
|
7649
|
-
KeyCode[KeyCode["KEY_F"] = 70] = "KEY_F";
|
|
7650
|
-
KeyCode[KeyCode["KEY_G"] = 71] = "KEY_G";
|
|
7651
|
-
KeyCode[KeyCode["KEY_H"] = 72] = "KEY_H";
|
|
7652
|
-
KeyCode[KeyCode["KEY_I"] = 73] = "KEY_I";
|
|
7653
|
-
KeyCode[KeyCode["KEY_J"] = 74] = "KEY_J";
|
|
7654
|
-
KeyCode[KeyCode["KEY_K"] = 75] = "KEY_K";
|
|
7655
|
-
KeyCode[KeyCode["KEY_L"] = 76] = "KEY_L";
|
|
7656
|
-
KeyCode[KeyCode["KEY_M"] = 77] = "KEY_M";
|
|
7657
|
-
KeyCode[KeyCode["KEY_N"] = 78] = "KEY_N";
|
|
7658
|
-
KeyCode[KeyCode["KEY_O"] = 79] = "KEY_O";
|
|
7659
|
-
KeyCode[KeyCode["KEY_P"] = 80] = "KEY_P";
|
|
7660
|
-
KeyCode[KeyCode["KEY_Q"] = 81] = "KEY_Q";
|
|
7661
|
-
KeyCode[KeyCode["KEY_R"] = 82] = "KEY_R";
|
|
7662
|
-
KeyCode[KeyCode["KEY_S"] = 83] = "KEY_S";
|
|
7663
|
-
KeyCode[KeyCode["KEY_T"] = 84] = "KEY_T";
|
|
7664
|
-
KeyCode[KeyCode["KEY_U"] = 85] = "KEY_U";
|
|
7665
|
-
KeyCode[KeyCode["KEY_V"] = 86] = "KEY_V";
|
|
7666
|
-
KeyCode[KeyCode["KEY_W"] = 87] = "KEY_W";
|
|
7667
|
-
KeyCode[KeyCode["KEY_X"] = 88] = "KEY_X";
|
|
7668
|
-
KeyCode[KeyCode["KEY_Y"] = 89] = "KEY_Y";
|
|
7669
|
-
KeyCode[KeyCode["KEY_Z"] = 90] = "KEY_Z";
|
|
7670
|
-
KeyCode[KeyCode["Meta"] = 91] = "Meta";
|
|
7671
|
-
KeyCode[KeyCode["F1"] = 112] = "F1";
|
|
7672
|
-
KeyCode[KeyCode["F2"] = 113] = "F2";
|
|
7673
|
-
KeyCode[KeyCode["F3"] = 114] = "F3";
|
|
7674
|
-
KeyCode[KeyCode["F4"] = 115] = "F4";
|
|
7675
|
-
KeyCode[KeyCode["F5"] = 116] = "F5";
|
|
7676
|
-
KeyCode[KeyCode["F6"] = 117] = "F6";
|
|
7677
|
-
KeyCode[KeyCode["F7"] = 118] = "F7";
|
|
7678
|
-
KeyCode[KeyCode["F8"] = 119] = "F8";
|
|
7679
|
-
KeyCode[KeyCode["F9"] = 120] = "F9";
|
|
7680
|
-
KeyCode[KeyCode["F10"] = 121] = "F10";
|
|
7681
|
-
KeyCode[KeyCode["F11"] = 122] = "F11";
|
|
7682
|
-
KeyCode[KeyCode["F12"] = 123] = "F12";
|
|
7683
|
-
KeyCode[KeyCode["NumLock"] = 144] = "NumLock";
|
|
7684
|
-
KeyCode[KeyCode["ScrollLock"] = 145] = "ScrollLock";
|
|
7685
|
-
KeyCode[KeyCode["Equal"] = 187] = "Equal";
|
|
7686
|
-
KeyCode[KeyCode["Minus"] = 189] = "Minus";
|
|
7687
|
-
KeyCode[KeyCode["Backquote"] = 192] = "Backquote";
|
|
7688
|
-
KeyCode[KeyCode["Backslash"] = 220] = "Backslash";
|
|
7689
|
-
})(KeyCode || (KeyCode = {}));
|
|
7690
|
-
|
|
7691
|
-
let KeyMod;
|
|
7692
|
-
|
|
7693
|
-
(function (KeyMod) {
|
|
7694
|
-
KeyMod[KeyMod["CtrlCmd"] = 2048] = "CtrlCmd";
|
|
7695
|
-
KeyMod[KeyMod["Shift"] = 1024] = "Shift";
|
|
7696
|
-
KeyMod[KeyMod["Alt"] = 512] = "Alt";
|
|
7697
|
-
KeyMod[KeyMod["WinCtrl"] = 256] = "WinCtrl";
|
|
7698
|
-
})(KeyMod || (KeyMod = {}));
|
|
7699
|
-
;// CONCATENATED MODULE: ./src/use-keyboard/helper.ts
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
/* istanbul ignore next */
|
|
7703
|
-
|
|
7704
|
-
const getCtrlKeysByPlatform = () => {
|
|
7705
|
-
return {
|
|
7706
|
-
CtrlCmd: isMac() ? 'metaKey' : 'ctrlKey',
|
|
7707
|
-
WinCtrl: isMac() ? 'ctrlKey' : 'metaKey'
|
|
7708
|
-
};
|
|
7709
|
-
};
|
|
7710
|
-
const getActiveModMap = bindings => {
|
|
7711
|
-
const modBindings = bindings.filter(item => !!KeyMod[item]);
|
|
7712
|
-
const activeModMap = {
|
|
7713
|
-
CtrlCmd: false,
|
|
7714
|
-
Shift: false,
|
|
7715
|
-
Alt: false,
|
|
7716
|
-
WinCtrl: false
|
|
7717
|
-
};
|
|
7718
|
-
modBindings.forEach(code => {
|
|
7719
|
-
const modKey = KeyMod[code];
|
|
7720
|
-
activeModMap[modKey] = true;
|
|
7721
|
-
});
|
|
7722
|
-
return activeModMap;
|
|
7723
|
-
};
|
|
7724
|
-
;// CONCATENATED MODULE: ./src/use-keyboard/use-keyboard.ts
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
const useKeyboard = (handler, keyBindings, options = {}) => {
|
|
7730
|
-
const bindings = Array.isArray(keyBindings) ? keyBindings : [keyBindings];
|
|
7731
|
-
const {
|
|
7732
|
-
disableGlobalEvent = false,
|
|
7733
|
-
capture = false,
|
|
7734
|
-
stopPropagation = false,
|
|
7735
|
-
preventDefault = true,
|
|
7736
|
-
event = 'keydown'
|
|
7737
|
-
} = options;
|
|
7738
|
-
const activeModMap = getActiveModMap(bindings);
|
|
7739
|
-
const keyCode = bindings.filter(item => !KeyMod[item])[0];
|
|
7740
|
-
const {
|
|
7741
|
-
CtrlCmd,
|
|
7742
|
-
WinCtrl
|
|
7743
|
-
} = getCtrlKeysByPlatform();
|
|
7744
|
-
|
|
7745
|
-
const eventHandler = event => {
|
|
7746
|
-
if (activeModMap.Shift && !event.shiftKey) return;
|
|
7747
|
-
if (activeModMap.Alt && !event.altKey) return;
|
|
7748
|
-
if (activeModMap.CtrlCmd && !event[CtrlCmd]) return;
|
|
7749
|
-
if (activeModMap.WinCtrl && !event[WinCtrl]) return;
|
|
7750
|
-
if (keyCode && event.keyCode !== keyCode) return;
|
|
7751
|
-
|
|
7752
|
-
if (stopPropagation) {
|
|
7753
|
-
event.stopPropagation();
|
|
7754
|
-
}
|
|
7755
|
-
|
|
7756
|
-
if (preventDefault) {
|
|
7757
|
-
event.preventDefault();
|
|
7758
|
-
}
|
|
7759
|
-
|
|
7760
|
-
handler && handler(event);
|
|
7761
|
-
};
|
|
7762
|
-
|
|
7763
|
-
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
|
|
7764
|
-
if (!disableGlobalEvent) {
|
|
7765
|
-
document.addEventListener(event, eventHandler);
|
|
7766
|
-
}
|
|
7767
|
-
|
|
7768
|
-
return () => {
|
|
7769
|
-
document.removeEventListener(event, eventHandler);
|
|
7770
|
-
};
|
|
7771
|
-
}, [disableGlobalEvent]);
|
|
7772
|
-
|
|
7773
|
-
const elementBindingHandler = (elementEventType, isCapture = false) => {
|
|
7774
|
-
if (elementEventType !== event) return () => {};
|
|
7775
|
-
if (isCapture !== capture) return () => {};
|
|
7776
|
-
return e => eventHandler(e);
|
|
7777
|
-
};
|
|
7778
|
-
|
|
7779
|
-
return {
|
|
7780
|
-
bindings: {
|
|
7781
|
-
onKeyDown: elementBindingHandler('keydown'),
|
|
7782
|
-
onKeyDownCapture: elementBindingHandler('keydown', true),
|
|
7783
|
-
onKeyPress: elementBindingHandler('keypress'),
|
|
7784
|
-
onKeyPressCapture: elementBindingHandler('keypress', true),
|
|
7785
|
-
onKeyUp: elementBindingHandler('keyup'),
|
|
7786
|
-
onKeyUpCapture: elementBindingHandler('keyup', true)
|
|
7787
|
-
}
|
|
7788
|
-
};
|
|
7789
|
-
};
|
|
7790
|
-
|
|
7791
|
-
/* harmony default export */ const use_keyboard = (useKeyboard);
|
|
7792
|
-
;// CONCATENATED MODULE: ./src/use-keyboard/index.ts
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
/* harmony default export */ const src_use_keyboard = (use_keyboard);
|
|
7797
7806
|
;// CONCATENATED MODULE: ./src/modal/modal.tsx
|
|
7798
7807
|
var modal_jsxFileName = "/home/runner/work/nextui/nextui/packages/nextui/src/modal/modal.tsx";
|
|
7799
7808
|
|
|
@@ -8152,6 +8161,8 @@ const useModal = (initialVisible = false) => {
|
|
|
8152
8161
|
|
|
8153
8162
|
|
|
8154
8163
|
|
|
8164
|
+
|
|
8165
|
+
|
|
8155
8166
|
|
|
8156
8167
|
|
|
8157
8168
|
|