@metamask/design-system-react 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/dist/components/HeaderBase/HeaderBase.cjs +43 -0
- package/dist/components/HeaderBase/HeaderBase.cjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.d.cts +4 -0
- package/dist/components/HeaderBase/HeaderBase.d.cts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.d.mts +4 -0
- package/dist/components/HeaderBase/HeaderBase.d.mts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.mjs +24 -0
- package/dist/components/HeaderBase/HeaderBase.mjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.types.cjs +3 -0
- package/dist/components/HeaderBase/HeaderBase.types.cjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.cts +51 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.cts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.mts +51 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.mts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.types.mjs +2 -0
- package/dist/components/HeaderBase/HeaderBase.types.mjs.map +1 -0
- package/dist/components/HeaderBase/index.cjs +6 -0
- package/dist/components/HeaderBase/index.cjs.map +1 -0
- package/dist/components/HeaderBase/index.d.cts +3 -0
- package/dist/components/HeaderBase/index.d.cts.map +1 -0
- package/dist/components/HeaderBase/index.d.mts +3 -0
- package/dist/components/HeaderBase/index.d.mts.map +1 -0
- package/dist/components/HeaderBase/index.mjs +2 -0
- package/dist/components/HeaderBase/index.mjs.map +1 -0
- package/dist/components/Icon/icons/Candlestick.cjs +1 -1
- package/dist/components/Icon/icons/Candlestick.cjs.map +1 -1
- package/dist/components/Icon/icons/Candlestick.mjs +1 -1
- package/dist/components/Icon/icons/Candlestick.mjs.map +1 -1
- package/dist/components/Icon/icons/Group.cjs +32 -0
- package/dist/components/Icon/icons/Group.cjs.map +1 -0
- package/dist/components/Icon/icons/Group.d.cts +4 -0
- package/dist/components/Icon/icons/Group.d.cts.map +1 -0
- package/dist/components/Icon/icons/Group.d.mts +4 -0
- package/dist/components/Icon/icons/Group.d.mts.map +1 -0
- package/dist/components/Icon/icons/Group.mjs +7 -0
- package/dist/components/Icon/icons/Group.mjs.map +1 -0
- package/dist/components/Icon/icons/ListArrow.cjs +32 -0
- package/dist/components/Icon/icons/ListArrow.cjs.map +1 -0
- package/dist/components/Icon/icons/ListArrow.d.cts +4 -0
- package/dist/components/Icon/icons/ListArrow.d.cts.map +1 -0
- package/dist/components/Icon/icons/ListArrow.d.mts +4 -0
- package/dist/components/Icon/icons/ListArrow.d.mts.map +1 -0
- package/dist/components/Icon/icons/ListArrow.mjs +7 -0
- package/dist/components/Icon/icons/ListArrow.mjs.map +1 -0
- package/dist/components/Icon/icons/Musd.cjs +32 -0
- package/dist/components/Icon/icons/Musd.cjs.map +1 -0
- package/dist/components/Icon/icons/Musd.d.cts +4 -0
- package/dist/components/Icon/icons/Musd.d.cts.map +1 -0
- package/dist/components/Icon/icons/Musd.d.mts +4 -0
- package/dist/components/Icon/icons/Musd.d.mts.map +1 -0
- package/dist/components/Icon/icons/Musd.mjs +7 -0
- package/dist/components/Icon/icons/Musd.mjs.map +1 -0
- package/dist/components/Icon/icons/MusdFilled.cjs +32 -0
- package/dist/components/Icon/icons/MusdFilled.cjs.map +1 -0
- package/dist/components/Icon/icons/MusdFilled.d.cts +4 -0
- package/dist/components/Icon/icons/MusdFilled.d.cts.map +1 -0
- package/dist/components/Icon/icons/MusdFilled.d.mts +4 -0
- package/dist/components/Icon/icons/MusdFilled.d.mts.map +1 -0
- package/dist/components/Icon/icons/MusdFilled.mjs +7 -0
- package/dist/components/Icon/icons/MusdFilled.mjs.map +1 -0
- package/dist/components/Icon/icons/PieChart.cjs +32 -0
- package/dist/components/Icon/icons/PieChart.cjs.map +1 -0
- package/dist/components/Icon/icons/PieChart.d.cts +4 -0
- package/dist/components/Icon/icons/PieChart.d.cts.map +1 -0
- package/dist/components/Icon/icons/PieChart.d.mts +4 -0
- package/dist/components/Icon/icons/PieChart.d.mts.map +1 -0
- package/dist/components/Icon/icons/PieChart.mjs +7 -0
- package/dist/components/Icon/icons/PieChart.mjs.map +1 -0
- package/dist/components/Icon/icons/Predictions.cjs +32 -0
- package/dist/components/Icon/icons/Predictions.cjs.map +1 -0
- package/dist/components/Icon/icons/Predictions.d.cts +4 -0
- package/dist/components/Icon/icons/Predictions.d.cts.map +1 -0
- package/dist/components/Icon/icons/Predictions.d.mts +4 -0
- package/dist/components/Icon/icons/Predictions.d.mts.map +1 -0
- package/dist/components/Icon/icons/Predictions.mjs +7 -0
- package/dist/components/Icon/icons/Predictions.mjs.map +1 -0
- package/dist/components/Icon/icons/index.cjs +12 -0
- package/dist/components/Icon/icons/index.cjs.map +1 -1
- package/dist/components/Icon/icons/index.d.cts +6 -0
- package/dist/components/Icon/icons/index.d.cts.map +1 -1
- package/dist/components/Icon/icons/index.d.mts +6 -0
- package/dist/components/Icon/icons/index.d.mts.map +1 -1
- package/dist/components/Icon/icons/index.mjs +12 -0
- package/dist/components/Icon/icons/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +49 -0
- package/dist/components/Modal/Modal.cjs.map +1 -0
- package/dist/components/Modal/Modal.context.cjs +14 -0
- package/dist/components/Modal/Modal.context.cjs.map +1 -0
- package/dist/components/Modal/Modal.context.d.cts +6 -0
- package/dist/components/Modal/Modal.context.d.cts.map +1 -0
- package/dist/components/Modal/Modal.context.d.mts +6 -0
- package/dist/components/Modal/Modal.context.d.mts.map +1 -0
- package/dist/components/Modal/Modal.context.mjs +10 -0
- package/dist/components/Modal/Modal.context.mjs.map +1 -0
- package/dist/components/Modal/Modal.d.cts +4 -0
- package/dist/components/Modal/Modal.d.cts.map +1 -0
- package/dist/components/Modal/Modal.d.mts +4 -0
- package/dist/components/Modal/Modal.d.mts.map +1 -0
- package/dist/components/Modal/Modal.mjs +30 -0
- package/dist/components/Modal/Modal.mjs.map +1 -0
- package/dist/components/Modal/Modal.types.cjs +3 -0
- package/dist/components/Modal/Modal.types.cjs.map +1 -0
- package/dist/components/Modal/Modal.types.d.cts +64 -0
- package/dist/components/Modal/Modal.types.d.cts.map +1 -0
- package/dist/components/Modal/Modal.types.d.mts +64 -0
- package/dist/components/Modal/Modal.types.d.mts.map +1 -0
- package/dist/components/Modal/Modal.types.mjs +2 -0
- package/dist/components/Modal/Modal.types.mjs.map +1 -0
- package/dist/components/Modal/index.cjs +8 -0
- package/dist/components/Modal/index.cjs.map +1 -0
- package/dist/components/Modal/index.d.cts +5 -0
- package/dist/components/Modal/index.d.cts.map +1 -0
- package/dist/components/Modal/index.d.mts +5 -0
- package/dist/components/Modal/index.d.mts.map +1 -0
- package/dist/components/Modal/index.mjs +3 -0
- package/dist/components/Modal/index.mjs.map +1 -0
- package/dist/components/ModalContent/ModalContent.cjs +73 -0
- package/dist/components/ModalContent/ModalContent.cjs.map +1 -0
- package/dist/components/ModalContent/ModalContent.constants.cjs +34 -0
- package/dist/components/ModalContent/ModalContent.constants.cjs.map +1 -0
- package/dist/components/ModalContent/ModalContent.constants.d.cts +31 -0
- package/dist/components/ModalContent/ModalContent.constants.d.cts.map +1 -0
- package/dist/components/ModalContent/ModalContent.constants.d.mts +31 -0
- package/dist/components/ModalContent/ModalContent.constants.d.mts.map +1 -0
- package/dist/components/ModalContent/ModalContent.constants.mjs +31 -0
- package/dist/components/ModalContent/ModalContent.constants.mjs.map +1 -0
- package/dist/components/ModalContent/ModalContent.d.cts +4 -0
- package/dist/components/ModalContent/ModalContent.d.cts.map +1 -0
- package/dist/components/ModalContent/ModalContent.d.mts +4 -0
- package/dist/components/ModalContent/ModalContent.d.mts.map +1 -0
- package/dist/components/ModalContent/ModalContent.mjs +54 -0
- package/dist/components/ModalContent/ModalContent.mjs.map +1 -0
- package/dist/components/ModalContent/ModalContent.types.cjs +15 -0
- package/dist/components/ModalContent/ModalContent.types.cjs.map +1 -0
- package/dist/components/ModalContent/ModalContent.types.d.cts +51 -0
- package/dist/components/ModalContent/ModalContent.types.d.cts.map +1 -0
- package/dist/components/ModalContent/ModalContent.types.d.mts +51 -0
- package/dist/components/ModalContent/ModalContent.types.d.mts.map +1 -0
- package/dist/components/ModalContent/ModalContent.types.mjs +12 -0
- package/dist/components/ModalContent/ModalContent.types.mjs.map +1 -0
- package/dist/components/ModalContent/index.cjs +10 -0
- package/dist/components/ModalContent/index.cjs.map +1 -0
- package/dist/components/ModalContent/index.d.cts +5 -0
- package/dist/components/ModalContent/index.d.cts.map +1 -0
- package/dist/components/ModalContent/index.d.mts +5 -0
- package/dist/components/ModalContent/index.d.mts.map +1 -0
- package/dist/components/ModalContent/index.mjs +4 -0
- package/dist/components/ModalContent/index.mjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.cjs +46 -0
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.cts +4 -0
- package/dist/components/Skeleton/Skeleton.d.cts.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.mts +4 -0
- package/dist/components/Skeleton/Skeleton.d.mts.map +1 -0
- package/dist/components/Skeleton/Skeleton.mjs +27 -0
- package/dist/components/Skeleton/Skeleton.mjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.types.cjs +3 -0
- package/dist/components/Skeleton/Skeleton.types.cjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.types.d.cts +38 -0
- package/dist/components/Skeleton/Skeleton.types.d.cts.map +1 -0
- package/dist/components/Skeleton/Skeleton.types.d.mts +38 -0
- package/dist/components/Skeleton/Skeleton.types.d.mts.map +1 -0
- package/dist/components/Skeleton/Skeleton.types.mjs +2 -0
- package/dist/components/Skeleton/Skeleton.types.mjs.map +1 -0
- package/dist/components/Skeleton/index.cjs +6 -0
- package/dist/components/Skeleton/index.cjs.map +1 -0
- package/dist/components/Skeleton/index.d.cts +3 -0
- package/dist/components/Skeleton/index.d.cts.map +1 -0
- package/dist/components/Skeleton/index.d.mts +3 -0
- package/dist/components/Skeleton/index.d.mts.map +1 -0
- package/dist/components/Skeleton/index.mjs +2 -0
- package/dist/components/Skeleton/index.mjs.map +1 -0
- package/dist/components/index.cjs +13 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +8 -0
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +8 -0
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.mjs +4 -0
- package/dist/components/index.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ModalContent = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const tw_merge_1 = require("../../utils/tw-merge.cjs");
|
|
29
|
+
const Box_1 = require("../Box/index.cjs");
|
|
30
|
+
const Modal_1 = require("../Modal/index.cjs");
|
|
31
|
+
const ModalFocus_1 = require("../ModalFocus/index.cjs");
|
|
32
|
+
const ModalContent_constants_1 = require("./ModalContent.constants.cjs");
|
|
33
|
+
const ModalContent_types_1 = require("./ModalContent.types.cjs");
|
|
34
|
+
exports.ModalContent = (0, react_1.forwardRef)(({ className, children, size = ModalContent_types_1.ModalContentSize.Sm, modalDialogProps, ...props }, ref) => {
|
|
35
|
+
const { onClose, isClosedOnEscapeKey, isClosedOnOutsideClick, initialFocusRef, finalFocusRef, restoreFocus, autoFocus, } = (0, Modal_1.useModalContext)();
|
|
36
|
+
const modalDialogRef = (0, react_1.useRef)(null);
|
|
37
|
+
(0, react_1.useEffect)(() => {
|
|
38
|
+
const handleEscKey = (event) => {
|
|
39
|
+
if (isClosedOnEscapeKey && event.key === 'Escape') {
|
|
40
|
+
onClose();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const handleClickOutside = (event) => {
|
|
44
|
+
if (!isClosedOnOutsideClick) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const target = event.target;
|
|
48
|
+
// Floating UI primitives (Popover, Tooltip, Select dropdown, etc.)
|
|
49
|
+
// that portal alongside the Modal but are part of the modal
|
|
50
|
+
// interaction can opt out of the outside-click handler by setting
|
|
51
|
+
// `data-mm-modal-ignore-outside-click` on their root element.
|
|
52
|
+
if (target?.closest(`[${ModalContent_constants_1.MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR}]`)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (modalDialogRef.current &&
|
|
56
|
+
!modalDialogRef.current.contains(target)) {
|
|
57
|
+
onClose();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
document.addEventListener('keydown', handleEscKey);
|
|
61
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
62
|
+
return () => {
|
|
63
|
+
document.removeEventListener('keydown', handleEscKey);
|
|
64
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
65
|
+
};
|
|
66
|
+
}, [isClosedOnEscapeKey, isClosedOnOutsideClick, onClose]);
|
|
67
|
+
return (react_1.default.createElement(ModalFocus_1.ModalFocus, { initialFocusRef: initialFocusRef, finalFocusRef: finalFocusRef, restoreFocus: restoreFocus, autoFocus: autoFocus },
|
|
68
|
+
react_1.default.createElement("div", { ref: ref, className: (0, tw_merge_1.twMerge)('fixed inset-0 z-[1050] flex items-start justify-center p-4 sm:py-8 md:py-12', '[@media(max-height:475px)]:p-2', className), ...props },
|
|
69
|
+
react_1.default.createElement(Box_1.Box, { ref: modalDialogRef, asChild: true, backgroundColor: Box_1.BoxBackgroundColor.BackgroundDefault, justifyContent: Box_1.BoxJustifyContent.Start, alignItems: Box_1.BoxAlignItems.Stretch, flexDirection: Box_1.BoxFlexDirection.Column, paddingTop: 4, paddingBottom: 4, ...modalDialogProps, className: (0, tw_merge_1.twMerge)('flex max-h-full w-full rounded-lg shadow-lg motion-safe:animate-slide-up', ModalContent_constants_1.TWCLASSMAP_MODAL_CONTENT_SIZE[size], modalDialogProps?.className) },
|
|
70
|
+
react_1.default.createElement("section", { role: "dialog", "aria-modal": "true" }, children)))));
|
|
71
|
+
});
|
|
72
|
+
exports.ModalContent.displayName = 'ModalContent';
|
|
73
|
+
//# sourceMappingURL=ModalContent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.cjs","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA6D;AAE7D,uDAA+C;AAC/C,0CAMgB;AAChB,8CAA2C;AAC3C,wDAA2C;AAE3C,yEAGkC;AAElC,iEAAwD;AAE3C,QAAA,YAAY,GAAG,IAAA,kBAAU,EACpC,CACE,EACE,SAAS,EACT,QAAQ,EACR,IAAI,GAAG,qCAAgB,CAAC,EAAE,EAC1B,gBAAgB,EAChB,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EACJ,OAAO,EACP,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,SAAS,GACV,GAAG,IAAA,uBAAe,GAAE,CAAC;IACtB,MAAM,cAAc,GAAG,IAAA,cAAM,EAAc,IAAI,CAAC,CAAC;IAEjD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,CAAC,KAAoB,EAAE,EAAE;YAC5C,IAAI,mBAAmB,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE;gBACjD,OAAO,EAAE,CAAC;aACX;QACH,CAAC,CAAC;QACF,MAAM,kBAAkB,GAAG,CAAC,KAAiB,EAAE,EAAE;YAC/C,IAAI,CAAC,sBAAsB,EAAE;gBAC3B,OAAO;aACR;YACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAA4B,CAAC;YAClD,mEAAmE;YACnE,4DAA4D;YAC5D,kEAAkE;YAClE,8DAA8D;YAC9D,IAAI,MAAM,EAAE,OAAO,CAAC,IAAI,gEAAuC,GAAG,CAAC,EAAE;gBACnE,OAAO;aACR;YACD,IACE,cAAc,CAAC,OAAO;gBACtB,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAc,CAAC,EAChD;gBACA,OAAO,EAAE,CAAC;aACX;QACH,CAAC,CAAC;QAEF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QACnD,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAE3D,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;YACtD,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3D,OAAO,CACL,8BAAC,uBAAU,IACT,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS;QAEpB,uCACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,kBAAO,EAChB,6EAA6E,EAC7E,gCAAgC,EAChC,SAAS,CACV,KACG,KAAK;YAET,8BAAC,SAAG,IACF,GAAG,EAAE,cAA2C,EAChD,OAAO,QACP,eAAe,EAAE,wBAAkB,CAAC,iBAAiB,EACrD,cAAc,EAAE,uBAAiB,CAAC,KAAK,EACvC,UAAU,EAAE,mBAAa,CAAC,OAAO,EACjC,aAAa,EAAE,sBAAgB,CAAC,MAAM,EACtC,UAAU,EAAE,CAAC,EACb,aAAa,EAAE,CAAC,KACZ,gBAAgB,EACpB,SAAS,EAAE,IAAA,kBAAO,EAChB,0EAA0E,EAC1E,sDAA6B,CAAC,IAAI,CAAC,EACnC,gBAAgB,EAAE,SAAS,CAC5B;gBAED,2CAAS,IAAI,EAAC,QAAQ,gBAAY,MAAM,IACrC,QAAQ,CACD,CACN,CACF,CACK,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport {\n Box,\n BoxAlignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n BoxJustifyContent,\n} from '../Box';\nimport { useModalContext } from '../Modal';\nimport { ModalFocus } from '../ModalFocus';\n\nimport {\n MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR,\n TWCLASSMAP_MODAL_CONTENT_SIZE,\n} from './ModalContent.constants';\nimport type { ModalContentProps } from './ModalContent.types';\nimport { ModalContentSize } from './ModalContent.types';\n\nexport const ModalContent = forwardRef<HTMLDivElement, ModalContentProps>(\n (\n {\n className,\n children,\n size = ModalContentSize.Sm,\n modalDialogProps,\n ...props\n },\n ref,\n ) => {\n const {\n onClose,\n isClosedOnEscapeKey,\n isClosedOnOutsideClick,\n initialFocusRef,\n finalFocusRef,\n restoreFocus,\n autoFocus,\n } = useModalContext();\n const modalDialogRef = useRef<HTMLElement>(null);\n\n useEffect(() => {\n const handleEscKey = (event: KeyboardEvent) => {\n if (isClosedOnEscapeKey && event.key === 'Escape') {\n onClose();\n }\n };\n const handleClickOutside = (event: MouseEvent) => {\n if (!isClosedOnOutsideClick) {\n return;\n }\n const target = event.target as HTMLElement | null;\n // Floating UI primitives (Popover, Tooltip, Select dropdown, etc.)\n // that portal alongside the Modal but are part of the modal\n // interaction can opt out of the outside-click handler by setting\n // `data-mm-modal-ignore-outside-click` on their root element.\n if (target?.closest(`[${MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR}]`)) {\n return;\n }\n if (\n modalDialogRef.current &&\n !modalDialogRef.current.contains(target as Node)\n ) {\n onClose();\n }\n };\n\n document.addEventListener('keydown', handleEscKey);\n document.addEventListener('mousedown', handleClickOutside);\n\n return () => {\n document.removeEventListener('keydown', handleEscKey);\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, [isClosedOnEscapeKey, isClosedOnOutsideClick, onClose]);\n\n return (\n <ModalFocus\n initialFocusRef={initialFocusRef}\n finalFocusRef={finalFocusRef}\n restoreFocus={restoreFocus}\n autoFocus={autoFocus}\n >\n <div\n ref={ref}\n className={twMerge(\n 'fixed inset-0 z-[1050] flex items-start justify-center p-4 sm:py-8 md:py-12',\n '[@media(max-height:475px)]:p-2',\n className,\n )}\n {...props}\n >\n <Box\n ref={modalDialogRef as React.Ref<HTMLDivElement>}\n asChild\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n justifyContent={BoxJustifyContent.Start}\n alignItems={BoxAlignItems.Stretch}\n flexDirection={BoxFlexDirection.Column}\n paddingTop={4}\n paddingBottom={4}\n {...modalDialogProps}\n className={twMerge(\n 'flex max-h-full w-full rounded-lg shadow-lg motion-safe:animate-slide-up',\n TWCLASSMAP_MODAL_CONTENT_SIZE[size],\n modalDialogProps?.className,\n )}\n >\n <section role=\"dialog\" aria-modal=\"true\">\n {children}\n </section>\n </Box>\n </div>\n </ModalFocus>\n );\n },\n);\n\nModalContent.displayName = 'ModalContent';\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TWCLASSMAP_MODAL_CONTENT_SIZE = exports.MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Attribute consumers can set on a portal-rendered subtree to opt out of the
|
|
6
|
+
* ModalContent outside-click handler. Useful for floating UI primitives
|
|
7
|
+
* (popover, tooltip, dropdown) that render as siblings to the modal portal
|
|
8
|
+
* but are conceptually part of the modal interaction.
|
|
9
|
+
*
|
|
10
|
+
* Example:
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Box {...{ [MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR]: '' }}>
|
|
14
|
+
* {popoverContent}
|
|
15
|
+
* </Box>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Clicks whose target's `closest('[data-mm-modal-ignore-outside-click]')` is
|
|
19
|
+
* non-null are ignored by ModalContent's outside-click logic and will not
|
|
20
|
+
* trigger `onClose`.
|
|
21
|
+
*/
|
|
22
|
+
exports.MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR = 'data-mm-modal-ignore-outside-click';
|
|
23
|
+
/**
|
|
24
|
+
* ModalContent dialog max-width tokens, expressed as Tailwind utilities.
|
|
25
|
+
* - `Sm` → 360px
|
|
26
|
+
* - `Md` → 480px
|
|
27
|
+
* - `Lg` → 720px
|
|
28
|
+
*/
|
|
29
|
+
exports.TWCLASSMAP_MODAL_CONTENT_SIZE = {
|
|
30
|
+
sm: 'max-w-[360px]',
|
|
31
|
+
md: 'max-w-[480px]',
|
|
32
|
+
lg: 'max-w-[720px]',
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=ModalContent.constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.constants.cjs","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.constants.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,uCAAuC,GAClD,oCAAoC,CAAC;AAEvC;;;;;GAKG;AACU,QAAA,6BAA6B,GAAG;IAC3C,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,eAAe;CACX,CAAC","sourcesContent":["/**\n * Attribute consumers can set on a portal-rendered subtree to opt out of the\n * ModalContent outside-click handler. Useful for floating UI primitives\n * (popover, tooltip, dropdown) that render as siblings to the modal portal\n * but are conceptually part of the modal interaction.\n *\n * Example:\n *\n * ```tsx\n * <Box {...{ [MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR]: '' }}>\n * {popoverContent}\n * </Box>\n * ```\n *\n * Clicks whose target's `closest('[data-mm-modal-ignore-outside-click]')` is\n * non-null are ignored by ModalContent's outside-click logic and will not\n * trigger `onClose`.\n */\nexport const MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR =\n 'data-mm-modal-ignore-outside-click';\n\n/**\n * ModalContent dialog max-width tokens, expressed as Tailwind utilities.\n * - `Sm` → 360px\n * - `Md` → 480px\n * - `Lg` → 720px\n */\nexport const TWCLASSMAP_MODAL_CONTENT_SIZE = {\n sm: 'max-w-[360px]',\n md: 'max-w-[480px]',\n lg: 'max-w-[720px]',\n} as const;\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attribute consumers can set on a portal-rendered subtree to opt out of the
|
|
3
|
+
* ModalContent outside-click handler. Useful for floating UI primitives
|
|
4
|
+
* (popover, tooltip, dropdown) that render as siblings to the modal portal
|
|
5
|
+
* but are conceptually part of the modal interaction.
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Box {...{ [MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR]: '' }}>
|
|
11
|
+
* {popoverContent}
|
|
12
|
+
* </Box>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Clicks whose target's `closest('[data-mm-modal-ignore-outside-click]')` is
|
|
16
|
+
* non-null are ignored by ModalContent's outside-click logic and will not
|
|
17
|
+
* trigger `onClose`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR = "data-mm-modal-ignore-outside-click";
|
|
20
|
+
/**
|
|
21
|
+
* ModalContent dialog max-width tokens, expressed as Tailwind utilities.
|
|
22
|
+
* - `Sm` → 360px
|
|
23
|
+
* - `Md` → 480px
|
|
24
|
+
* - `Lg` → 720px
|
|
25
|
+
*/
|
|
26
|
+
export declare const TWCLASSMAP_MODAL_CONTENT_SIZE: {
|
|
27
|
+
readonly sm: "max-w-[360px]";
|
|
28
|
+
readonly md: "max-w-[480px]";
|
|
29
|
+
readonly lg: "max-w-[720px]";
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=ModalContent.constants.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.constants.d.cts","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uCAAuC,uCACd,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;;;CAIhC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attribute consumers can set on a portal-rendered subtree to opt out of the
|
|
3
|
+
* ModalContent outside-click handler. Useful for floating UI primitives
|
|
4
|
+
* (popover, tooltip, dropdown) that render as siblings to the modal portal
|
|
5
|
+
* but are conceptually part of the modal interaction.
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Box {...{ [MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR]: '' }}>
|
|
11
|
+
* {popoverContent}
|
|
12
|
+
* </Box>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Clicks whose target's `closest('[data-mm-modal-ignore-outside-click]')` is
|
|
16
|
+
* non-null are ignored by ModalContent's outside-click logic and will not
|
|
17
|
+
* trigger `onClose`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR = "data-mm-modal-ignore-outside-click";
|
|
20
|
+
/**
|
|
21
|
+
* ModalContent dialog max-width tokens, expressed as Tailwind utilities.
|
|
22
|
+
* - `Sm` → 360px
|
|
23
|
+
* - `Md` → 480px
|
|
24
|
+
* - `Lg` → 720px
|
|
25
|
+
*/
|
|
26
|
+
export declare const TWCLASSMAP_MODAL_CONTENT_SIZE: {
|
|
27
|
+
readonly sm: "max-w-[360px]";
|
|
28
|
+
readonly md: "max-w-[480px]";
|
|
29
|
+
readonly lg: "max-w-[720px]";
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=ModalContent.constants.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.constants.d.mts","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uCAAuC,uCACd,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;;;CAIhC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attribute consumers can set on a portal-rendered subtree to opt out of the
|
|
3
|
+
* ModalContent outside-click handler. Useful for floating UI primitives
|
|
4
|
+
* (popover, tooltip, dropdown) that render as siblings to the modal portal
|
|
5
|
+
* but are conceptually part of the modal interaction.
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Box {...{ [MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR]: '' }}>
|
|
11
|
+
* {popoverContent}
|
|
12
|
+
* </Box>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Clicks whose target's `closest('[data-mm-modal-ignore-outside-click]')` is
|
|
16
|
+
* non-null are ignored by ModalContent's outside-click logic and will not
|
|
17
|
+
* trigger `onClose`.
|
|
18
|
+
*/
|
|
19
|
+
export const MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR = 'data-mm-modal-ignore-outside-click';
|
|
20
|
+
/**
|
|
21
|
+
* ModalContent dialog max-width tokens, expressed as Tailwind utilities.
|
|
22
|
+
* - `Sm` → 360px
|
|
23
|
+
* - `Md` → 480px
|
|
24
|
+
* - `Lg` → 720px
|
|
25
|
+
*/
|
|
26
|
+
export const TWCLASSMAP_MODAL_CONTENT_SIZE = {
|
|
27
|
+
sm: 'max-w-[360px]',
|
|
28
|
+
md: 'max-w-[480px]',
|
|
29
|
+
lg: 'max-w-[720px]',
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=ModalContent.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.constants.mjs","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAClD,oCAAoC,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,eAAe;CACX,CAAC","sourcesContent":["/**\n * Attribute consumers can set on a portal-rendered subtree to opt out of the\n * ModalContent outside-click handler. Useful for floating UI primitives\n * (popover, tooltip, dropdown) that render as siblings to the modal portal\n * but are conceptually part of the modal interaction.\n *\n * Example:\n *\n * ```tsx\n * <Box {...{ [MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR]: '' }}>\n * {popoverContent}\n * </Box>\n * ```\n *\n * Clicks whose target's `closest('[data-mm-modal-ignore-outside-click]')` is\n * non-null are ignored by ModalContent's outside-click logic and will not\n * trigger `onClose`.\n */\nexport const MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR =\n 'data-mm-modal-ignore-outside-click';\n\n/**\n * ModalContent dialog max-width tokens, expressed as Tailwind utilities.\n * - `Sm` → 360px\n * - `Md` → 480px\n * - `Lg` → 720px\n */\nexport const TWCLASSMAP_MODAL_CONTENT_SIZE = {\n sm: 'max-w-[360px]',\n md: 'max-w-[480px]',\n lg: 'max-w-[720px]',\n} as const;\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ModalContentProps } from "./ModalContent.types.cjs";
|
|
3
|
+
export declare const ModalContent: React.ForwardRefExoticComponent<Omit<ModalContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
//# sourceMappingURL=ModalContent.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.d.cts","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,cAAc;AAiB7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAG9D,eAAO,MAAM,YAAY,uGAiGxB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ModalContentProps } from "./ModalContent.types.mjs";
|
|
3
|
+
export declare const ModalContent: React.ForwardRefExoticComponent<Omit<ModalContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
//# sourceMappingURL=ModalContent.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.d.mts","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,cAAc;AAiB7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAG9D,eAAO,MAAM,YAAY,uGAiGxB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function $importDefault(module) {
|
|
2
|
+
if (module?.__esModule) {
|
|
3
|
+
return module.default;
|
|
4
|
+
}
|
|
5
|
+
return module;
|
|
6
|
+
}
|
|
7
|
+
import $React, { forwardRef, useEffect, useRef } from "react";
|
|
8
|
+
const React = $importDefault($React);
|
|
9
|
+
import { twMerge } from "../../utils/tw-merge.mjs";
|
|
10
|
+
import { Box, BoxAlignItems, BoxBackgroundColor, BoxFlexDirection, BoxJustifyContent } from "../Box/index.mjs";
|
|
11
|
+
import { useModalContext } from "../Modal/index.mjs";
|
|
12
|
+
import { ModalFocus } from "../ModalFocus/index.mjs";
|
|
13
|
+
import { MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR, TWCLASSMAP_MODAL_CONTENT_SIZE } from "./ModalContent.constants.mjs";
|
|
14
|
+
import { ModalContentSize } from "./ModalContent.types.mjs";
|
|
15
|
+
export const ModalContent = forwardRef(({ className, children, size = ModalContentSize.Sm, modalDialogProps, ...props }, ref) => {
|
|
16
|
+
const { onClose, isClosedOnEscapeKey, isClosedOnOutsideClick, initialFocusRef, finalFocusRef, restoreFocus, autoFocus, } = useModalContext();
|
|
17
|
+
const modalDialogRef = useRef(null);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const handleEscKey = (event) => {
|
|
20
|
+
if (isClosedOnEscapeKey && event.key === 'Escape') {
|
|
21
|
+
onClose();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const handleClickOutside = (event) => {
|
|
25
|
+
if (!isClosedOnOutsideClick) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const target = event.target;
|
|
29
|
+
// Floating UI primitives (Popover, Tooltip, Select dropdown, etc.)
|
|
30
|
+
// that portal alongside the Modal but are part of the modal
|
|
31
|
+
// interaction can opt out of the outside-click handler by setting
|
|
32
|
+
// `data-mm-modal-ignore-outside-click` on their root element.
|
|
33
|
+
if (target?.closest(`[${MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR}]`)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (modalDialogRef.current &&
|
|
37
|
+
!modalDialogRef.current.contains(target)) {
|
|
38
|
+
onClose();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
document.addEventListener('keydown', handleEscKey);
|
|
42
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
43
|
+
return () => {
|
|
44
|
+
document.removeEventListener('keydown', handleEscKey);
|
|
45
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
46
|
+
};
|
|
47
|
+
}, [isClosedOnEscapeKey, isClosedOnOutsideClick, onClose]);
|
|
48
|
+
return (React.createElement(ModalFocus, { initialFocusRef: initialFocusRef, finalFocusRef: finalFocusRef, restoreFocus: restoreFocus, autoFocus: autoFocus },
|
|
49
|
+
React.createElement("div", { ref: ref, className: twMerge('fixed inset-0 z-[1050] flex items-start justify-center p-4 sm:py-8 md:py-12', '[@media(max-height:475px)]:p-2', className), ...props },
|
|
50
|
+
React.createElement(Box, { ref: modalDialogRef, asChild: true, backgroundColor: BoxBackgroundColor.BackgroundDefault, justifyContent: BoxJustifyContent.Start, alignItems: BoxAlignItems.Stretch, flexDirection: BoxFlexDirection.Column, paddingTop: 4, paddingBottom: 4, ...modalDialogProps, className: twMerge('flex max-h-full w-full rounded-lg shadow-lg motion-safe:animate-slide-up', TWCLASSMAP_MODAL_CONTENT_SIZE[size], modalDialogProps?.className) },
|
|
51
|
+
React.createElement("section", { role: "dialog", "aria-modal": "true" }, children)))));
|
|
52
|
+
});
|
|
53
|
+
ModalContent.displayName = 'ModalContent';
|
|
54
|
+
//# sourceMappingURL=ModalContent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.mjs","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc;;AAE7D,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EACL,GAAG,EACH,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAClB,yBAAe;AAChB,OAAO,EAAE,eAAe,EAAE,2BAAiB;AAC3C,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAE3C,OAAO,EACL,uCAAuC,EACvC,6BAA6B,EAC9B,qCAAiC;AAElC,OAAO,EAAE,gBAAgB,EAAE,iCAA6B;AAExD,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CACpC,CACE,EACE,SAAS,EACT,QAAQ,EACR,IAAI,GAAG,gBAAgB,CAAC,EAAE,EAC1B,gBAAgB,EAChB,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EACJ,OAAO,EACP,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,SAAS,GACV,GAAG,eAAe,EAAE,CAAC;IACtB,MAAM,cAAc,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,CAAC,KAAoB,EAAE,EAAE;YAC5C,IAAI,mBAAmB,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE;gBACjD,OAAO,EAAE,CAAC;aACX;QACH,CAAC,CAAC;QACF,MAAM,kBAAkB,GAAG,CAAC,KAAiB,EAAE,EAAE;YAC/C,IAAI,CAAC,sBAAsB,EAAE;gBAC3B,OAAO;aACR;YACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAA4B,CAAC;YAClD,mEAAmE;YACnE,4DAA4D;YAC5D,kEAAkE;YAClE,8DAA8D;YAC9D,IAAI,MAAM,EAAE,OAAO,CAAC,IAAI,uCAAuC,GAAG,CAAC,EAAE;gBACnE,OAAO;aACR;YACD,IACE,cAAc,CAAC,OAAO;gBACtB,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAc,CAAC,EAChD;gBACA,OAAO,EAAE,CAAC;aACX;QACH,CAAC,CAAC;QAEF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QACnD,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAE3D,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;YACtD,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3D,OAAO,CACL,oBAAC,UAAU,IACT,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS;QAEpB,6BACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,CAChB,6EAA6E,EAC7E,gCAAgC,EAChC,SAAS,CACV,KACG,KAAK;YAET,oBAAC,GAAG,IACF,GAAG,EAAE,cAA2C,EAChD,OAAO,QACP,eAAe,EAAE,kBAAkB,CAAC,iBAAiB,EACrD,cAAc,EAAE,iBAAiB,CAAC,KAAK,EACvC,UAAU,EAAE,aAAa,CAAC,OAAO,EACjC,aAAa,EAAE,gBAAgB,CAAC,MAAM,EACtC,UAAU,EAAE,CAAC,EACb,aAAa,EAAE,CAAC,KACZ,gBAAgB,EACpB,SAAS,EAAE,OAAO,CAChB,0EAA0E,EAC1E,6BAA6B,CAAC,IAAI,CAAC,EACnC,gBAAgB,EAAE,SAAS,CAC5B;gBAED,iCAAS,IAAI,EAAC,QAAQ,gBAAY,MAAM,IACrC,QAAQ,CACD,CACN,CACF,CACK,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport {\n Box,\n BoxAlignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n BoxJustifyContent,\n} from '../Box';\nimport { useModalContext } from '../Modal';\nimport { ModalFocus } from '../ModalFocus';\n\nimport {\n MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR,\n TWCLASSMAP_MODAL_CONTENT_SIZE,\n} from './ModalContent.constants';\nimport type { ModalContentProps } from './ModalContent.types';\nimport { ModalContentSize } from './ModalContent.types';\n\nexport const ModalContent = forwardRef<HTMLDivElement, ModalContentProps>(\n (\n {\n className,\n children,\n size = ModalContentSize.Sm,\n modalDialogProps,\n ...props\n },\n ref,\n ) => {\n const {\n onClose,\n isClosedOnEscapeKey,\n isClosedOnOutsideClick,\n initialFocusRef,\n finalFocusRef,\n restoreFocus,\n autoFocus,\n } = useModalContext();\n const modalDialogRef = useRef<HTMLElement>(null);\n\n useEffect(() => {\n const handleEscKey = (event: KeyboardEvent) => {\n if (isClosedOnEscapeKey && event.key === 'Escape') {\n onClose();\n }\n };\n const handleClickOutside = (event: MouseEvent) => {\n if (!isClosedOnOutsideClick) {\n return;\n }\n const target = event.target as HTMLElement | null;\n // Floating UI primitives (Popover, Tooltip, Select dropdown, etc.)\n // that portal alongside the Modal but are part of the modal\n // interaction can opt out of the outside-click handler by setting\n // `data-mm-modal-ignore-outside-click` on their root element.\n if (target?.closest(`[${MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR}]`)) {\n return;\n }\n if (\n modalDialogRef.current &&\n !modalDialogRef.current.contains(target as Node)\n ) {\n onClose();\n }\n };\n\n document.addEventListener('keydown', handleEscKey);\n document.addEventListener('mousedown', handleClickOutside);\n\n return () => {\n document.removeEventListener('keydown', handleEscKey);\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, [isClosedOnEscapeKey, isClosedOnOutsideClick, onClose]);\n\n return (\n <ModalFocus\n initialFocusRef={initialFocusRef}\n finalFocusRef={finalFocusRef}\n restoreFocus={restoreFocus}\n autoFocus={autoFocus}\n >\n <div\n ref={ref}\n className={twMerge(\n 'fixed inset-0 z-[1050] flex items-start justify-center p-4 sm:py-8 md:py-12',\n '[@media(max-height:475px)]:p-2',\n className,\n )}\n {...props}\n >\n <Box\n ref={modalDialogRef as React.Ref<HTMLDivElement>}\n asChild\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n justifyContent={BoxJustifyContent.Start}\n alignItems={BoxAlignItems.Stretch}\n flexDirection={BoxFlexDirection.Column}\n paddingTop={4}\n paddingBottom={4}\n {...modalDialogProps}\n className={twMerge(\n 'flex max-h-full w-full rounded-lg shadow-lg motion-safe:animate-slide-up',\n TWCLASSMAP_MODAL_CONTENT_SIZE[size],\n modalDialogProps?.className,\n )}\n >\n <section role=\"dialog\" aria-modal=\"true\">\n {children}\n </section>\n </Box>\n </div>\n </ModalFocus>\n );\n },\n);\n\nModalContent.displayName = 'ModalContent';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModalContentSize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* ModalContent dialog max-width.
|
|
6
|
+
* - `Sm` → 360px (default)
|
|
7
|
+
* - `Md` → 480px
|
|
8
|
+
* - `Lg` → 720px
|
|
9
|
+
*/
|
|
10
|
+
exports.ModalContentSize = {
|
|
11
|
+
Sm: 'sm',
|
|
12
|
+
Md: 'md',
|
|
13
|
+
Lg: 'lg',
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=ModalContent.types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.types.cjs","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.types.ts"],"names":[],"mappings":";;;AAIA;;;;;GAKG;AACU,QAAA,gBAAgB,GAAG;IAC9B,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;CACA,CAAC","sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\n\nimport type { BoxProps } from '../Box';\n\n/**\n * ModalContent dialog max-width.\n * - `Sm` → 360px (default)\n * - `Md` → 480px\n * - `Lg` → 720px\n */\nexport const ModalContentSize = {\n Sm: 'sm',\n Md: 'md',\n Lg: 'lg',\n} as const;\nexport type ModalContentSize =\n (typeof ModalContentSize)[keyof typeof ModalContentSize];\n\n/**\n * Box prop bag used for the inner dialog `<section>`. Mirrors the legacy\n * `modalDialogProps` typing but is bound to the MMDS `BoxProps` shape and\n * carries an explicit `data-*` index signature so consumers can pass through\n * test ids and other dataset attributes through `Partial`/`Omit` indirection.\n */\ntype DialogBoxProps = Omit<BoxProps, 'children' | 'asChild'> & {\n [key: `data-${string}`]: string | undefined;\n};\n\nexport type ModalContentProps = Omit<ComponentProps<'div'>, 'children'> & {\n /**\n * Content rendered inside the dialog. Typically composed of `ModalHeader`,\n * `ModalBody`, and `ModalFooter`.\n */\n children: ReactNode;\n /**\n * Optional max-width for the inner dialog. Use one of `ModalContentSize`\n * tokens (Sm/Md/Lg → 360/480/720px). Override entirely via\n * `modalDialogProps.className=\"max-w-...\"` if you need a custom width.\n *\n * @default ModalContentSize.Sm\n */\n size?: ModalContentSize;\n /**\n * Props forwarded to the inner dialog `Box` (the `<section\n * role=\"dialog\">`). Use this to add `data-testid`, override layout, change\n * background, or apply Tailwind utilities via `className`.\n */\n modalDialogProps?: DialogBoxProps;\n /**\n * Optional prop for additional CSS classes applied to the outer\n * positioning element. Merged with the component's defaults via `twMerge`.\n */\n className?: string;\n};\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import type { BoxProps } from "../Box/index.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* ModalContent dialog max-width.
|
|
5
|
+
* - `Sm` → 360px (default)
|
|
6
|
+
* - `Md` → 480px
|
|
7
|
+
* - `Lg` → 720px
|
|
8
|
+
*/
|
|
9
|
+
export declare const ModalContentSize: {
|
|
10
|
+
readonly Sm: "sm";
|
|
11
|
+
readonly Md: "md";
|
|
12
|
+
readonly Lg: "lg";
|
|
13
|
+
};
|
|
14
|
+
export type ModalContentSize = (typeof ModalContentSize)[keyof typeof ModalContentSize];
|
|
15
|
+
/**
|
|
16
|
+
* Box prop bag used for the inner dialog `<section>`. Mirrors the legacy
|
|
17
|
+
* `modalDialogProps` typing but is bound to the MMDS `BoxProps` shape and
|
|
18
|
+
* carries an explicit `data-*` index signature so consumers can pass through
|
|
19
|
+
* test ids and other dataset attributes through `Partial`/`Omit` indirection.
|
|
20
|
+
*/
|
|
21
|
+
type DialogBoxProps = Omit<BoxProps, 'children' | 'asChild'> & {
|
|
22
|
+
[key: `data-${string}`]: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
export type ModalContentProps = Omit<ComponentProps<'div'>, 'children'> & {
|
|
25
|
+
/**
|
|
26
|
+
* Content rendered inside the dialog. Typically composed of `ModalHeader`,
|
|
27
|
+
* `ModalBody`, and `ModalFooter`.
|
|
28
|
+
*/
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Optional max-width for the inner dialog. Use one of `ModalContentSize`
|
|
32
|
+
* tokens (Sm/Md/Lg → 360/480/720px). Override entirely via
|
|
33
|
+
* `modalDialogProps.className="max-w-..."` if you need a custom width.
|
|
34
|
+
*
|
|
35
|
+
* @default ModalContentSize.Sm
|
|
36
|
+
*/
|
|
37
|
+
size?: ModalContentSize;
|
|
38
|
+
/**
|
|
39
|
+
* Props forwarded to the inner dialog `Box` (the `<section
|
|
40
|
+
* role="dialog">`). Use this to add `data-testid`, override layout, change
|
|
41
|
+
* background, or apply Tailwind utilities via `className`.
|
|
42
|
+
*/
|
|
43
|
+
modalDialogProps?: DialogBoxProps;
|
|
44
|
+
/**
|
|
45
|
+
* Optional prop for additional CSS classes applied to the outer
|
|
46
|
+
* positioning element. Merged with the component's defaults via `twMerge`.
|
|
47
|
+
*/
|
|
48
|
+
className?: string;
|
|
49
|
+
};
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=ModalContent.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.types.d.cts","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAe;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AACX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,KAAK,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG;IAC7D,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACxE;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import type { BoxProps } from "../Box/index.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* ModalContent dialog max-width.
|
|
5
|
+
* - `Sm` → 360px (default)
|
|
6
|
+
* - `Md` → 480px
|
|
7
|
+
* - `Lg` → 720px
|
|
8
|
+
*/
|
|
9
|
+
export declare const ModalContentSize: {
|
|
10
|
+
readonly Sm: "sm";
|
|
11
|
+
readonly Md: "md";
|
|
12
|
+
readonly Lg: "lg";
|
|
13
|
+
};
|
|
14
|
+
export type ModalContentSize = (typeof ModalContentSize)[keyof typeof ModalContentSize];
|
|
15
|
+
/**
|
|
16
|
+
* Box prop bag used for the inner dialog `<section>`. Mirrors the legacy
|
|
17
|
+
* `modalDialogProps` typing but is bound to the MMDS `BoxProps` shape and
|
|
18
|
+
* carries an explicit `data-*` index signature so consumers can pass through
|
|
19
|
+
* test ids and other dataset attributes through `Partial`/`Omit` indirection.
|
|
20
|
+
*/
|
|
21
|
+
type DialogBoxProps = Omit<BoxProps, 'children' | 'asChild'> & {
|
|
22
|
+
[key: `data-${string}`]: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
export type ModalContentProps = Omit<ComponentProps<'div'>, 'children'> & {
|
|
25
|
+
/**
|
|
26
|
+
* Content rendered inside the dialog. Typically composed of `ModalHeader`,
|
|
27
|
+
* `ModalBody`, and `ModalFooter`.
|
|
28
|
+
*/
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Optional max-width for the inner dialog. Use one of `ModalContentSize`
|
|
32
|
+
* tokens (Sm/Md/Lg → 360/480/720px). Override entirely via
|
|
33
|
+
* `modalDialogProps.className="max-w-..."` if you need a custom width.
|
|
34
|
+
*
|
|
35
|
+
* @default ModalContentSize.Sm
|
|
36
|
+
*/
|
|
37
|
+
size?: ModalContentSize;
|
|
38
|
+
/**
|
|
39
|
+
* Props forwarded to the inner dialog `Box` (the `<section
|
|
40
|
+
* role="dialog">`). Use this to add `data-testid`, override layout, change
|
|
41
|
+
* background, or apply Tailwind utilities via `className`.
|
|
42
|
+
*/
|
|
43
|
+
modalDialogProps?: DialogBoxProps;
|
|
44
|
+
/**
|
|
45
|
+
* Optional prop for additional CSS classes applied to the outer
|
|
46
|
+
* positioning element. Merged with the component's defaults via `twMerge`.
|
|
47
|
+
*/
|
|
48
|
+
className?: string;
|
|
49
|
+
};
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=ModalContent.types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.types.d.mts","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAe;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AACX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,KAAK,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG;IAC7D,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACxE;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContent.types.mjs","sourceRoot":"","sources":["../../../src/components/ModalContent/ModalContent.types.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;CACA,CAAC","sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\n\nimport type { BoxProps } from '../Box';\n\n/**\n * ModalContent dialog max-width.\n * - `Sm` → 360px (default)\n * - `Md` → 480px\n * - `Lg` → 720px\n */\nexport const ModalContentSize = {\n Sm: 'sm',\n Md: 'md',\n Lg: 'lg',\n} as const;\nexport type ModalContentSize =\n (typeof ModalContentSize)[keyof typeof ModalContentSize];\n\n/**\n * Box prop bag used for the inner dialog `<section>`. Mirrors the legacy\n * `modalDialogProps` typing but is bound to the MMDS `BoxProps` shape and\n * carries an explicit `data-*` index signature so consumers can pass through\n * test ids and other dataset attributes through `Partial`/`Omit` indirection.\n */\ntype DialogBoxProps = Omit<BoxProps, 'children' | 'asChild'> & {\n [key: `data-${string}`]: string | undefined;\n};\n\nexport type ModalContentProps = Omit<ComponentProps<'div'>, 'children'> & {\n /**\n * Content rendered inside the dialog. Typically composed of `ModalHeader`,\n * `ModalBody`, and `ModalFooter`.\n */\n children: ReactNode;\n /**\n * Optional max-width for the inner dialog. Use one of `ModalContentSize`\n * tokens (Sm/Md/Lg → 360/480/720px). Override entirely via\n * `modalDialogProps.className=\"max-w-...\"` if you need a custom width.\n *\n * @default ModalContentSize.Sm\n */\n size?: ModalContentSize;\n /**\n * Props forwarded to the inner dialog `Box` (the `<section\n * role=\"dialog\">`). Use this to add `data-testid`, override layout, change\n * background, or apply Tailwind utilities via `className`.\n */\n modalDialogProps?: DialogBoxProps;\n /**\n * Optional prop for additional CSS classes applied to the outer\n * positioning element. Merged with the component's defaults via `twMerge`.\n */\n className?: string;\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR = exports.ModalContentSize = exports.ModalContent = void 0;
|
|
4
|
+
var ModalContent_1 = require("./ModalContent.cjs");
|
|
5
|
+
Object.defineProperty(exports, "ModalContent", { enumerable: true, get: function () { return ModalContent_1.ModalContent; } });
|
|
6
|
+
var ModalContent_types_1 = require("./ModalContent.types.cjs");
|
|
7
|
+
Object.defineProperty(exports, "ModalContentSize", { enumerable: true, get: function () { return ModalContent_types_1.ModalContentSize; } });
|
|
8
|
+
var ModalContent_constants_1 = require("./ModalContent.constants.cjs");
|
|
9
|
+
Object.defineProperty(exports, "MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR", { enumerable: true, get: function () { return ModalContent_constants_1.MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR; } });
|
|
10
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/ModalContent/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,+DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AAEzB,uEAAmF;AAA1E,iJAAA,uCAAuC,OAAA","sourcesContent":["export { ModalContent } from './ModalContent';\nexport { ModalContentSize } from './ModalContent.types';\nexport type { ModalContentProps } from './ModalContent.types';\nexport { MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR } from './ModalContent.constants';\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ModalContent } from "./ModalContent.cjs";
|
|
2
|
+
export { ModalContentSize } from "./ModalContent.types.cjs";
|
|
3
|
+
export type { ModalContentProps } from "./ModalContent.types.cjs";
|
|
4
|
+
export { MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR } from "./ModalContent.constants.cjs";
|
|
5
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/ModalContent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAAuB;AAC9C,OAAO,EAAE,gBAAgB,EAAE,iCAA6B;AACxD,YAAY,EAAE,iBAAiB,EAAE,iCAA6B;AAC9D,OAAO,EAAE,uCAAuC,EAAE,qCAAiC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ModalContent } from "./ModalContent.mjs";
|
|
2
|
+
export { ModalContentSize } from "./ModalContent.types.mjs";
|
|
3
|
+
export type { ModalContentProps } from "./ModalContent.types.mjs";
|
|
4
|
+
export { MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR } from "./ModalContent.constants.mjs";
|
|
5
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/ModalContent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAAuB;AAC9C,OAAO,EAAE,gBAAgB,EAAE,iCAA6B;AACxD,YAAY,EAAE,iBAAiB,EAAE,iCAA6B;AAC9D,OAAO,EAAE,uCAAuC,EAAE,qCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/ModalContent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAAuB;AAC9C,OAAO,EAAE,gBAAgB,EAAE,iCAA6B;AAExD,OAAO,EAAE,uCAAuC,EAAE,qCAAiC","sourcesContent":["export { ModalContent } from './ModalContent';\nexport { ModalContentSize } from './ModalContent.types';\nexport type { ModalContentProps } from './ModalContent.types';\nexport { MODAL_CONTENT_IGNORE_OUTSIDE_CLICK_ATTR } from './ModalContent.constants';\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Skeleton = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const tw_merge_1 = require("../../utils/tw-merge.cjs");
|
|
29
|
+
exports.Skeleton = (0, react_1.forwardRef)(({ height, width, children, hideChildren = false, className, style, ...props }, ref) => {
|
|
30
|
+
const hasChildren = children !== null && children !== undefined;
|
|
31
|
+
// Pass-through case (matches RN `BottomSheet` Skeleton): when children
|
|
32
|
+
// are provided and we're not asked to hide them, render the children
|
|
33
|
+
// directly without any skeleton overlay or animation.
|
|
34
|
+
if (!hideChildren && hasChildren) {
|
|
35
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
36
|
+
}
|
|
37
|
+
return (react_1.default.createElement("div", { ref: ref, "aria-hidden": "true", className: (0, tw_merge_1.twMerge)('relative overflow-hidden rounded', className), style: { height, width, ...style }, ...props },
|
|
38
|
+
react_1.default.createElement("div", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 rounded bg-icon-alternative motion-safe:animate-skeleton-pulse" }),
|
|
39
|
+
hasChildren && (react_1.default.createElement("div", { "aria-hidden": "true",
|
|
40
|
+
// Children render invisibly so the skeleton container takes its
|
|
41
|
+
// natural layout dimensions. They're hidden from assistive tech
|
|
42
|
+
// (the wrapping skeleton is already `aria-hidden`).
|
|
43
|
+
className: "pointer-events-none invisible relative z-10" }, children))));
|
|
44
|
+
});
|
|
45
|
+
exports.Skeleton.displayName = 'Skeleton';
|
|
46
|
+
//# sourceMappingURL=Skeleton.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.cjs","sourceRoot":"","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,uDAA+C;AAIlC,QAAA,QAAQ,GAAG,IAAA,kBAAU,EAChC,CACE,EACE,MAAM,EACN,KAAK,EACL,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,WAAW,GAAG,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,CAAC;IAEhE,uEAAuE;IACvE,qEAAqE;IACrE,sDAAsD;IACtD,IAAI,CAAC,YAAY,IAAI,WAAW,EAAE;QAChC,OAAO,8DAAG,QAAQ,CAAI,CAAC;KACxB;IAED,OAAO,CACL,uCACE,GAAG,EAAE,GAAG,iBACI,MAAM,EAClB,SAAS,EAAE,IAAA,kBAAO,EAAC,kCAAkC,EAAE,SAAS,CAAC,EACjE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,KAC9B,KAAK;QAET,sDACc,MAAM,EAClB,SAAS,EAAC,qGAAqG,GAC/G;QACD,WAAW,IAAI,CACd,sDACc,MAAM;YAClB,gEAAgE;YAChE,gEAAgE;YAChE,oDAAoD;YACpD,SAAS,EAAC,6CAA6C,IAEtD,QAAQ,CACL,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\n\nimport type { SkeletonProps } from './Skeleton.types';\n\nexport const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(\n (\n {\n height,\n width,\n children,\n hideChildren = false,\n className,\n style,\n ...props\n },\n ref,\n ) => {\n const hasChildren = children !== null && children !== undefined;\n\n // Pass-through case (matches RN `BottomSheet` Skeleton): when children\n // are provided and we're not asked to hide them, render the children\n // directly without any skeleton overlay or animation.\n if (!hideChildren && hasChildren) {\n return <>{children}</>;\n }\n\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={twMerge('relative overflow-hidden rounded', className)}\n style={{ height, width, ...style }}\n {...props}\n >\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-0 rounded bg-icon-alternative motion-safe:animate-skeleton-pulse\"\n />\n {hasChildren && (\n <div\n aria-hidden=\"true\"\n // Children render invisibly so the skeleton container takes its\n // natural layout dimensions. They're hidden from assistive tech\n // (the wrapping skeleton is already `aria-hidden`).\n className=\"pointer-events-none invisible relative z-10\"\n >\n {children}\n </div>\n )}\n </div>\n );\n },\n);\n\nSkeleton.displayName = 'Skeleton';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.d.cts","sourceRoot":"","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,cAAc;AAI1C,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAEtD,eAAO,MAAM,QAAQ,mGAgDpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.d.mts","sourceRoot":"","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,cAAc;AAI1C,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAEtD,eAAO,MAAM,QAAQ,mGAgDpB,CAAC"}
|