se-design 1.0.96 → 1.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index12.js +11 -11
- package/dist/index12.js.map +1 -1
- package/package.json +1 -1
package/dist/index12.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import e from "react";
|
|
2
2
|
import { Button as d } from "./index4.js";
|
|
3
|
-
import { Icon as
|
|
3
|
+
import { Icon as N } from "./index6.js";
|
|
4
4
|
import "./index77.js";
|
|
5
|
-
import { useModalA11y as
|
|
6
|
-
import { useFocusTrapPortalRegistry as
|
|
5
|
+
import { useModalA11y as k } from "./index215.js";
|
|
6
|
+
import { useFocusTrapPortalRegistry as P, FocusTrapPortalContext as j } from "./index216.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
function r() {
|
|
9
9
|
return r = Object.assign ? Object.assign.bind() : function(n) {
|
|
@@ -33,17 +33,17 @@ const _ = (n) => {
|
|
|
33
33
|
} = n, {
|
|
34
34
|
register: x,
|
|
35
35
|
portalContainerRefs: h
|
|
36
|
-
} =
|
|
36
|
+
} = P(), {
|
|
37
37
|
containerRef: y,
|
|
38
38
|
titleId: E,
|
|
39
|
-
dialogProps:
|
|
40
|
-
} =
|
|
39
|
+
dialogProps: w
|
|
40
|
+
} = k({
|
|
41
41
|
isOpen: i,
|
|
42
42
|
onDismiss: l,
|
|
43
43
|
ariaLabel: a ?? t,
|
|
44
44
|
ariaLabelledBy: o,
|
|
45
45
|
portalContainerRefs: h
|
|
46
|
-
}),
|
|
46
|
+
}), C = typeof s == "string";
|
|
47
47
|
return /* @__PURE__ */ e.createElement(j.Provider, {
|
|
48
48
|
value: x
|
|
49
49
|
}, /* @__PURE__ */ e.createElement("div", {
|
|
@@ -51,7 +51,7 @@ const _ = (n) => {
|
|
|
51
51
|
"aria-hidden": i ? void 0 : !0
|
|
52
52
|
}, /* @__PURE__ */ e.createElement("div", r({
|
|
53
53
|
ref: y
|
|
54
|
-
},
|
|
54
|
+
}, w, {
|
|
55
55
|
className: "modal-content relative flex flex-col gap-3 bg-[var(--color-white)] rounded-xl shadow-lg p-7",
|
|
56
56
|
style: {
|
|
57
57
|
width: f,
|
|
@@ -62,13 +62,13 @@ const _ = (n) => {
|
|
|
62
62
|
className: "flex items-start justify-between gap-3"
|
|
63
63
|
}, t && /* @__PURE__ */ e.createElement("h2", {
|
|
64
64
|
id: E,
|
|
65
|
-
className: "text-lg font-semibold text-[var(--color-gray-900)]"
|
|
66
|
-
}, t), u && /* @__PURE__ */ e.createElement(
|
|
65
|
+
className: "text-lg font-semibold text-[var(--color-gray-900)] break-words min-w-0"
|
|
66
|
+
}, t), u && /* @__PURE__ */ e.createElement(N, {
|
|
67
67
|
name: "close",
|
|
68
68
|
onClick: l,
|
|
69
69
|
ariaLabel: "Close dialog",
|
|
70
70
|
className: "cursor-pointer shrink-0 ml-auto"
|
|
71
|
-
})),
|
|
71
|
+
})), C ? /* @__PURE__ */ e.createElement("p", {
|
|
72
72
|
className: "leading-normal text-[var(--color-gray-700)]"
|
|
73
73
|
}, s) : s, /* @__PURE__ */ e.createElement("div", {
|
|
74
74
|
className: "flex flex-wrap items-center justify-end gap-4 pt-3"
|
package/dist/index12.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index12.js","sources":["../src/components/Modal/index.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { Button } from 'src/components/Button';\nimport { ButtonProps } from 'src/components/Button';\nimport { Icon } from '../Icon';\nimport { useModalA11y } from 'src/utils/a11y';\nimport { FocusTrapPortalContext, useFocusTrapPortalRegistry } from 'src/utils/a11y/FocusTrapPortalContext';\nimport './style.scss';\n\nexport interface ModalProps {\n title?: string;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n content: string | React.ReactNode;\n successButtonProps?: ButtonProps;\n cancelButtonProps?: ButtonProps;\n cancelAction?: () => void;\n successAction?: () => void;\n showCloseIcon?: boolean;\n isOpen: boolean;\n width?: string;\n height?: string;\n automationId?: string;\n customModalClassName?: string;\n}\n\nexport const Modal: FC<ModalProps> = (props) => {\n const {\n title,\n ariaLabel,\n ariaLabelledBy,\n content = '',\n showCloseIcon = false,\n successButtonProps,\n cancelButtonProps,\n cancelAction,\n successAction,\n isOpen,\n width = '500px',\n height = 'auto',\n automationId = '',\n customModalClassName = ''\n } = props;\n\n const { register, portalContainerRefs } = useFocusTrapPortalRegistry();\n\n const { containerRef, titleId, dialogProps } = useModalA11y({\n isOpen,\n onDismiss: cancelAction,\n ariaLabel: ariaLabel ?? title,\n ariaLabelledBy,\n portalContainerRefs,\n });\n\n const isContentString = typeof content === 'string';\n\n return (\n <FocusTrapPortalContext.Provider value={register}>\n <div\n className={`${customModalClassName} se-design-modal fixed inset-0 flex items-start justify-center z-[2001] backdrop-brightness-50 backdrop-blur-sm ${isOpen ? 'visible' : 'invisible pointer-events-none'\n }`}\n aria-hidden={isOpen ? undefined : true}\n >\n <div\n ref={containerRef}\n {...dialogProps}\n className=\"modal-content relative flex flex-col gap-3 bg-[var(--color-white)] rounded-xl shadow-lg p-7\"\n style={{ width, height }}\n data-automation-id={automationId}\n >\n <div className=\"flex items-start justify-between gap-3\">\n {title && <h2 id={titleId} className=\"text-lg font-semibold text-[var(--color-gray-900)]\">{title}</h2>}\n {showCloseIcon && (\n <Icon name=\"close\" onClick={cancelAction} ariaLabel=\"Close dialog\" className=\"cursor-pointer shrink-0 ml-auto\" />\n )}\n </div>\n {isContentString ? <p className=\"leading-normal text-[var(--color-gray-700)]\">{content}</p> : content}\n <div className=\"flex flex-wrap items-center justify-end gap-4 pt-3\">\n {cancelButtonProps?.label && <Button {...cancelButtonProps} onClick={cancelAction} />}\n {successButtonProps?.label && <Button {...successButtonProps} onClick={successAction} />}\n </div>\n </div>\n </div>\n </FocusTrapPortalContext.Provider>\n );\n};\n"],"names":["Modal","props","title","ariaLabel","ariaLabelledBy","content","showCloseIcon","successButtonProps","cancelButtonProps","cancelAction","successAction","isOpen","width","height","automationId","customModalClassName","register","portalContainerRefs","useFocusTrapPortalRegistry","containerRef","titleId","dialogProps","useModalA11y","onDismiss","isContentString","React","createElement","FocusTrapPortalContext","Provider","value","className","undefined","_extends","ref","style","id","Icon","name","onClick","label","Button"],"mappings":";;;;;;;;;;;;;;;;AAyBO,MAAMA,IAAyBC,CAAAA,MAAU;AAC9C,QAAM;AAAA,IACJC,OAAAA;AAAAA,IACAC,WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,SAAAA,IAAU;AAAA,IACVC,eAAAA,IAAgB;AAAA,IAChBC,oBAAAA;AAAAA,IACAC,mBAAAA;AAAAA,IACAC,cAAAA;AAAAA,IACAC,eAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,OAAAA,IAAQ;AAAA,IACRC,QAAAA,IAAS;AAAA,IACTC,cAAAA,IAAe;AAAA,IACfC,sBAAAA,IAAuB;AAAA,EAAA,IACrBd,GAEE;AAAA,IAAEe,UAAAA;AAAAA,IAAUC,qBAAAA;AAAAA,EAAAA,IAAwBC,EAAAA,GAEpC;AAAA,IAAEC,cAAAA;AAAAA,IAAcC,SAAAA;AAAAA,IAASC,aAAAA;AAAAA,EAAAA,IAAgBC,EAAa;AAAA,IAC1DX,QAAAA;AAAAA,IACAY,WAAWd;AAAAA,IACXN,WAAWA,KAAaD;AAAAA,IACxBE,gBAAAA;AAAAA,IACAa,qBAAAA;AAAAA,EAAAA,CACD,GAEKO,IAAkB,OAAOnB,KAAY;AAE3C,SACEoB,gBAAAA,EAAAC,cAACC,EAAuBC,UAAQ;AAAA,IAACC,OAAOb;AAAAA,EAAAA,GACtCS,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACEI,WAAW,GAAGf,CAAoB,mHAAmHJ,IAAS,YAAY,+BAA+B;AAAA,IAEzM,eAAaA,IAASoB,SAAY;AAAA,EAAA,GAElCN,gBAAAA,EAAAC,cAAA,OAAAM,EAAA;AAAA,IACEC,KAAKd;AAAAA,EAAAA,GACDE,GAAW;AAAA,IACfS,WAAU;AAAA,IACVI,OAAO;AAAA,MAAEtB,OAAAA;AAAAA,MAAOC,QAAAA;AAAAA,IAAAA;AAAAA,IAChB,sBAAoBC;AAAAA,EAAAA,CAAa,GAEjCW,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKI,WAAU;AAAA,EAAA,GACZ5B,KAASuB,gBAAAA,EAAAC,cAAA,MAAA;AAAA,IAAIS,IAAIf;AAAAA,IAASU,WAAU;AAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"index12.js","sources":["../src/components/Modal/index.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { Button } from 'src/components/Button';\nimport { ButtonProps } from 'src/components/Button';\nimport { Icon } from '../Icon';\nimport { useModalA11y } from 'src/utils/a11y';\nimport { FocusTrapPortalContext, useFocusTrapPortalRegistry } from 'src/utils/a11y/FocusTrapPortalContext';\nimport './style.scss';\n\nexport interface ModalProps {\n title?: string;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n content: string | React.ReactNode;\n successButtonProps?: ButtonProps;\n cancelButtonProps?: ButtonProps;\n cancelAction?: () => void;\n successAction?: () => void;\n showCloseIcon?: boolean;\n isOpen: boolean;\n width?: string;\n height?: string;\n automationId?: string;\n customModalClassName?: string;\n}\n\nexport const Modal: FC<ModalProps> = (props) => {\n const {\n title,\n ariaLabel,\n ariaLabelledBy,\n content = '',\n showCloseIcon = false,\n successButtonProps,\n cancelButtonProps,\n cancelAction,\n successAction,\n isOpen,\n width = '500px',\n height = 'auto',\n automationId = '',\n customModalClassName = ''\n } = props;\n\n const { register, portalContainerRefs } = useFocusTrapPortalRegistry();\n\n const { containerRef, titleId, dialogProps } = useModalA11y({\n isOpen,\n onDismiss: cancelAction,\n ariaLabel: ariaLabel ?? title,\n ariaLabelledBy,\n portalContainerRefs,\n });\n\n const isContentString = typeof content === 'string';\n\n return (\n <FocusTrapPortalContext.Provider value={register}>\n <div\n className={`${customModalClassName} se-design-modal fixed inset-0 flex items-start justify-center z-[2001] backdrop-brightness-50 backdrop-blur-sm ${isOpen ? 'visible' : 'invisible pointer-events-none'\n }`}\n aria-hidden={isOpen ? undefined : true}\n >\n <div\n ref={containerRef}\n {...dialogProps}\n className=\"modal-content relative flex flex-col gap-3 bg-[var(--color-white)] rounded-xl shadow-lg p-7\"\n style={{ width, height }}\n data-automation-id={automationId}\n >\n <div className=\"flex items-start justify-between gap-3\">\n {title && <h2 id={titleId} className=\"text-lg font-semibold text-[var(--color-gray-900)] break-words min-w-0\">{title}</h2>}\n {showCloseIcon && (\n <Icon name=\"close\" onClick={cancelAction} ariaLabel=\"Close dialog\" className=\"cursor-pointer shrink-0 ml-auto\" />\n )}\n </div>\n {isContentString ? <p className=\"leading-normal text-[var(--color-gray-700)]\">{content}</p> : content}\n <div className=\"flex flex-wrap items-center justify-end gap-4 pt-3\">\n {cancelButtonProps?.label && <Button {...cancelButtonProps} onClick={cancelAction} />}\n {successButtonProps?.label && <Button {...successButtonProps} onClick={successAction} />}\n </div>\n </div>\n </div>\n </FocusTrapPortalContext.Provider>\n );\n};\n"],"names":["Modal","props","title","ariaLabel","ariaLabelledBy","content","showCloseIcon","successButtonProps","cancelButtonProps","cancelAction","successAction","isOpen","width","height","automationId","customModalClassName","register","portalContainerRefs","useFocusTrapPortalRegistry","containerRef","titleId","dialogProps","useModalA11y","onDismiss","isContentString","React","createElement","FocusTrapPortalContext","Provider","value","className","undefined","_extends","ref","style","id","Icon","name","onClick","label","Button"],"mappings":";;;;;;;;;;;;;;;;AAyBO,MAAMA,IAAyBC,CAAAA,MAAU;AAC9C,QAAM;AAAA,IACJC,OAAAA;AAAAA,IACAC,WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,SAAAA,IAAU;AAAA,IACVC,eAAAA,IAAgB;AAAA,IAChBC,oBAAAA;AAAAA,IACAC,mBAAAA;AAAAA,IACAC,cAAAA;AAAAA,IACAC,eAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,OAAAA,IAAQ;AA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