@semcore/modal 4.56.2 → 4.57.0-prerelease.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 +6 -0
- package/lib/cjs/Modal.js +56 -61
- package/lib/cjs/Modal.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/modal.shadow.css +19 -12
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/Modal.js +50 -52
- package/lib/es6/Modal.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/modal.shadow.css +19 -12
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/Modal.mjs +54 -57
- package/lib/esm/style/modal.shadow.css +19 -12
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/index.d.ts +7 -16
- package/package.json +10 -10
package/lib/es6/Modal.js
CHANGED
|
@@ -1,76 +1,72 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import { sstyled as _sstyled } from "@semcore/
|
|
7
|
+
import { sstyled as _sstyled } from "@semcore/core";
|
|
9
8
|
import { assignProps as _assignProps5 } from "@semcore/core";
|
|
10
9
|
import { assignProps as _assignProps4 } from "@semcore/core";
|
|
11
10
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
12
11
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
13
12
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
14
|
-
import
|
|
15
|
-
import { FadeInOut, Slide } from '@semcore/animation';
|
|
16
|
-
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
17
|
-
import Portal, { PortalProvider } from '@semcore/portal';
|
|
13
|
+
import { FadeInOut, Slide, Flex, OutsideClick, Portal, PortalProvider } from '@semcore/base-components';
|
|
18
14
|
import Button from '@semcore/button';
|
|
19
|
-
import
|
|
15
|
+
import { createComponent, Component, sstyled, Root } from '@semcore/core';
|
|
16
|
+
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
17
|
+
import { isAdvanceMode } from '@semcore/core/lib/utils/findComponent';
|
|
18
|
+
import fire from '@semcore/core/lib/utils/fire';
|
|
19
|
+
import { useContextTheme } from '@semcore/core/lib/utils/ThemeProvider';
|
|
20
|
+
import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
21
|
+
import { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver';
|
|
22
|
+
import { useFocusLock } from '@semcore/core/lib/utils/use/useFocusLock';
|
|
23
|
+
import usePreventScroll from '@semcore/core/lib/utils/use/usePreventScroll';
|
|
24
|
+
import { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';
|
|
25
|
+
import { ZIndexStackingContextProvider, useZIndexStacking } from '@semcore/core/lib/utils/zIndexStacking';
|
|
20
26
|
import CloseIcon from '@semcore/icon/Close/l';
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import { isAdvanceMode } from '@semcore/utils/lib/findComponent';
|
|
24
|
-
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
27
|
+
import { Text } from '@semcore/typography';
|
|
28
|
+
import React from 'react';
|
|
25
29
|
/*!__reshadow-styles__:"./style/modal.shadow.css"*/
|
|
26
|
-
var style = (
|
|
30
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SWindow_ryb06_gg_{position:relative;border-radius:var(--intergalactic-modal-rounded, calc(12px + 2px));background:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255));box-sizing:border-box;margin:auto;padding:var(--intergalactic-spacing-10x, 40px);box-shadow:var(--intergalactic-box-shadow-modal, 0px 1px 5px 0px rgba(0, 21, 16, 0.07));color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}@supports (color:color(display-p3 0 0 0%)){.___SWindow_ryb06_gg_{box-shadow:var(--intergalactic-box-shadow-modal, 0px 1px 5px 0px rgba(0, 21, 16, 0.07))}@media (color-gamut:p3){.___SWindow_ryb06_gg_{box-shadow:var(--intergalactic-box-shadow-modal, 0px 1px 5px 0px color(display-p3 0.01753 0.08157 0.06372 / 0.07))}}}.___SWindow_ryb06_gg_:focus{outline:0}.___SWindow_ryb06_gg_ .___STitle_ryb06_gg_{color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899));font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%);font-weight:var(--intergalactic-semi-bold, 600);margin-bottom:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-4x, 16px)}.___SWindow_ryb06_gg_ .___STitle_ryb06_gg_.__color_ryb06_gg_{color:var(--color_ryb06)}.___SWindow_ryb06_gg_ .___SClose_ryb06_gg_{display:inline-flex;position:absolute;right:var(--intergalactic-spacing-2x, 8px);top:var(--intergalactic-spacing-2x, 8px)}.___SWindow_ryb06_gg_ .___SClose_ryb06_gg_.__ghost_ryb06_gg_{right:0;top:0}.___SWindow_ryb06_gg_.__ghost_ryb06_gg_{background:0 0;padding:0;box-shadow:none}.___SOverlayContentWrapper_ryb06_gg_{flex:1;max-width:100%;box-sizing:border-box;padding:var(--intergalactic-spacing-10x, 40px)}.___SOverlay_ryb06_gg_{display:flex;justify-content:center;flex-wrap:wrap;position:fixed;top:0;bottom:0;left:0;right:0;margin:0;background:var(--intergalactic-overlay-primary, rgba(0, 6, 3, 0.337));overflow:auto;-webkit-overflow-scrolling:touch}@supports (color:color(display-p3 0 0 0%)){.___SOverlay_ryb06_gg_{background:var(--intergalactic-overlay-primary, rgba(0, 6, 3, 0.337))}@media (color-gamut:p3){.___SOverlay_ryb06_gg_{background:var(--intergalactic-overlay-primary, color(display-p3 0.00414 0.0233 0.01269 / 0.337))}}}.___SOverlay_ryb06_gg_ .___SOverlay_ryb06_gg_{background:var(--intergalactic-overlay-secondary, rgba(0, 8, 5, 0.262))}@media (max-width:767px){.___SWindow_ryb06_gg_{min-width:60%}.___SOverlayContentWrapper_ryb06_gg_{padding:var(--intergalactic-spacing-3x, 12px)}}", /*__inner_css_end__*/"ryb06_gg_"),
|
|
27
31
|
/*__reshadow_css_end__*/
|
|
28
32
|
{
|
|
29
|
-
"__SWindow": "
|
|
30
|
-
"_ghost": "
|
|
31
|
-
"
|
|
32
|
-
"__STitle": "
|
|
33
|
-
"_color": "
|
|
34
|
-
"--color": "--
|
|
35
|
-
"__SClose": "
|
|
33
|
+
"__SWindow": "___SWindow_ryb06_gg_",
|
|
34
|
+
"_ghost": "__ghost_ryb06_gg_",
|
|
35
|
+
"__SOverlayContentWrapper": "___SOverlayContentWrapper_ryb06_gg_",
|
|
36
|
+
"__STitle": "___STitle_ryb06_gg_",
|
|
37
|
+
"_color": "__color_ryb06_gg_",
|
|
38
|
+
"--color": "--color_ryb06",
|
|
39
|
+
"__SClose": "___SClose_ryb06_gg_",
|
|
40
|
+
"__SOverlay": "___SOverlay_ryb06_gg_"
|
|
36
41
|
});
|
|
37
42
|
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
38
|
-
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
39
|
-
import { Text } from '@semcore/typography';
|
|
40
|
-
import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
|
|
41
|
-
import { cssVariableEnhance } from '@semcore/utils/lib/useCssVariable';
|
|
42
|
-
import { useFocusLock } from '@semcore/utils/lib/use/useFocusLock';
|
|
43
|
-
import { useContextTheme } from '@semcore/utils/lib/ThemeProvider';
|
|
44
|
-
import { useColorResolver } from '@semcore/utils/lib/use/useColorResolver';
|
|
45
|
-
import { ZIndexStackingContextProvider, useZIndexStacking } from '@semcore/utils/lib/zIndexStacking';
|
|
46
43
|
var ModalRoot = /*#__PURE__*/function (_Component) {
|
|
47
|
-
_inherits(ModalRoot, _Component);
|
|
48
|
-
var _super = _createSuper(ModalRoot);
|
|
49
44
|
function ModalRoot() {
|
|
50
45
|
var _this;
|
|
51
46
|
_classCallCheck(this, ModalRoot);
|
|
52
47
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
53
48
|
args[_key] = arguments[_key];
|
|
54
49
|
}
|
|
55
|
-
_this =
|
|
56
|
-
_defineProperty(
|
|
50
|
+
_this = _callSuper(this, ModalRoot, [].concat(args));
|
|
51
|
+
_defineProperty(_this, "state", {
|
|
57
52
|
hasTitle: false
|
|
58
53
|
});
|
|
59
|
-
_defineProperty(
|
|
54
|
+
_defineProperty(_this, "handleKeyDown", function (e) {
|
|
60
55
|
if (e.key === 'Escape') {
|
|
61
56
|
e.stopPropagation();
|
|
62
|
-
fire(
|
|
57
|
+
fire(_this, 'onClose', 'onEscape', e);
|
|
63
58
|
}
|
|
64
59
|
});
|
|
65
|
-
_defineProperty(
|
|
66
|
-
fire(
|
|
60
|
+
_defineProperty(_this, "handleIconCloseClick", function (e) {
|
|
61
|
+
fire(_this, 'onClose', 'onCloseClick', e);
|
|
67
62
|
});
|
|
68
|
-
_defineProperty(
|
|
69
|
-
fire(
|
|
63
|
+
_defineProperty(_this, "handleOutsideClick", function (e) {
|
|
64
|
+
fire(_this, 'onClose', 'onOutsideClick', e);
|
|
70
65
|
});
|
|
71
66
|
return _this;
|
|
72
67
|
}
|
|
73
|
-
|
|
68
|
+
_inherits(ModalRoot, _Component);
|
|
69
|
+
return _createClass(ModalRoot, [{
|
|
74
70
|
key: "getOverlayProps",
|
|
75
71
|
value: function getOverlayProps() {
|
|
76
72
|
var _this$asProps = this.asProps,
|
|
@@ -100,7 +96,7 @@ var ModalRoot = /*#__PURE__*/function (_Component) {
|
|
|
100
96
|
return {
|
|
101
97
|
visible: visible,
|
|
102
98
|
closable: closable,
|
|
103
|
-
onKeyDown: this.handleKeyDown,
|
|
99
|
+
'onKeyDown': this.handleKeyDown,
|
|
104
100
|
'aria-label': hasTitle ? undefined : getI18nText('title'),
|
|
105
101
|
'aria-labelledby': hasTitle ? "igc-".concat(uid, "-title") : undefined,
|
|
106
102
|
duration: duration,
|
|
@@ -150,7 +146,6 @@ var ModalRoot = /*#__PURE__*/function (_Component) {
|
|
|
150
146
|
}, advancedMode ? /*#__PURE__*/React.createElement(Children, null) : /*#__PURE__*/React.createElement(Modal.Overlay, null, /*#__PURE__*/React.createElement(Modal.Window, _assignProps({}, _ref))));
|
|
151
147
|
}
|
|
152
148
|
}]);
|
|
153
|
-
return ModalRoot;
|
|
154
149
|
}(Component);
|
|
155
150
|
_defineProperty(ModalRoot, "displayName", 'Modal');
|
|
156
151
|
_defineProperty(ModalRoot, "style", style);
|
|
@@ -176,7 +171,7 @@ function Window(props) {
|
|
|
176
171
|
closable = props.closable,
|
|
177
172
|
duration = props.duration;
|
|
178
173
|
var windowRef = React.useRef(null);
|
|
179
|
-
useFocusLock(windowRef,
|
|
174
|
+
useFocusLock(windowRef, 'enforced', 'auto', !visible, true);
|
|
180
175
|
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SWindow, _ref6.cn("SWindow", _objectSpread({}, _assignProps2({
|
|
181
176
|
"initialAnimation": true,
|
|
182
177
|
"slideOrigin": 'top',
|
|
@@ -184,7 +179,8 @@ function Window(props) {
|
|
|
184
179
|
"role": 'dialog',
|
|
185
180
|
"aria-modal": true,
|
|
186
181
|
"duration": duration,
|
|
187
|
-
"ref": windowRef
|
|
182
|
+
"ref": windowRef,
|
|
183
|
+
"tabIndex": -1
|
|
188
184
|
}, _ref2))), /*#__PURE__*/React.createElement(ZIndexStackingContextProvider, _ref6.cn("ZIndexStackingContextProvider", {
|
|
189
185
|
"designToken": 'z-index-modal'
|
|
190
186
|
}), /*#__PURE__*/React.createElement(PortalProvider, _ref6.cn("PortalProvider", {
|
|
@@ -195,21 +191,24 @@ function Overlay(props) {
|
|
|
195
191
|
var _ref3 = arguments[0],
|
|
196
192
|
_ref7;
|
|
197
193
|
var SOverlay = FadeInOut;
|
|
194
|
+
var SOverlayContentWrapper = Flex;
|
|
198
195
|
var Children = props.Children,
|
|
199
196
|
styles = props.styles,
|
|
200
197
|
onOutsideClick = props.onOutsideClick,
|
|
201
198
|
visible = props.visible;
|
|
202
|
-
var
|
|
199
|
+
var overlayContentWrapperRef = React.useRef(null);
|
|
203
200
|
usePreventScroll(visible, props.disablePreventScroll);
|
|
204
|
-
useContextTheme(
|
|
201
|
+
useContextTheme(overlayContentWrapperRef, visible);
|
|
205
202
|
var zIndex = useZIndexStacking('z-index-modal');
|
|
206
203
|
return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SOverlay, _ref7.cn("SOverlay", _objectSpread({}, _assignProps3({
|
|
207
|
-
"ref": overlayRef,
|
|
208
204
|
"zIndex": zIndex
|
|
209
|
-
}, _ref3))), /*#__PURE__*/React.createElement(
|
|
210
|
-
"
|
|
205
|
+
}, _ref3))), /*#__PURE__*/React.createElement(SOverlayContentWrapper, _ref7.cn("SOverlayContentWrapper", {
|
|
206
|
+
"data-ui-name": 'Modal.Overlay.ContentWrapper',
|
|
207
|
+
"ref": overlayContentWrapperRef
|
|
208
|
+
}), /*#__PURE__*/React.createElement(OutsideClick, _ref7.cn("OutsideClick", {
|
|
209
|
+
"root": overlayContentWrapperRef,
|
|
211
210
|
"onOutsideClick": onOutsideClick
|
|
212
|
-
}), /*#__PURE__*/React.createElement(Children, _ref7.cn("Children", {}))));
|
|
211
|
+
}), /*#__PURE__*/React.createElement(Children, _ref7.cn("Children", {})))));
|
|
213
212
|
}
|
|
214
213
|
function Close(props) {
|
|
215
214
|
var _ref4 = arguments[0],
|
|
@@ -225,13 +224,12 @@ function Close(props) {
|
|
|
225
224
|
"theme": ghost ? 'invert' : 'muted',
|
|
226
225
|
"aria-label": getI18nText('close')
|
|
227
226
|
}, _ref4))), hasChildren ? /*#__PURE__*/React.createElement(Children, _ref8.cn("Children", {})) : /*#__PURE__*/React.createElement(Button.Addon, {
|
|
228
|
-
ml:
|
|
229
|
-
mr:
|
|
227
|
+
ml: "7px",
|
|
228
|
+
mr: "7px"
|
|
230
229
|
}, /*#__PURE__*/React.createElement(CloseIcon, _ref8.cn("CloseIcon", {
|
|
231
230
|
"title": getI18nText('close')
|
|
232
231
|
}))));
|
|
233
232
|
}
|
|
234
|
-
Close.enhance = [keyboardFocusEnhance()];
|
|
235
233
|
function Title(props) {
|
|
236
234
|
var _ref5 = arguments[0],
|
|
237
235
|
_ref9;
|
package/lib/es6/Modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["React","FadeInOut","Slide","createComponent","Component","sstyled","Root","Portal","PortalProvider","Button","OutsideClick","CloseIcon","fire","usePreventScroll","isAdvanceMode","keyboardFocusEnhance","style","_sstyled","insert","localizedMessages","i18nEnhance","Text","uniqueIDEnhancement","cssVariableEnhance","useFocusLock","useContextTheme","useColorResolver","ZIndexStackingContextProvider","useZIndexStacking","ModalRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","hasTitle","e","key","stopPropagation","_createClass","value","getOverlayProps","_this$asProps","asProps","duration","visible","animationsDisabled","disablePreventScroll","onOutsideClick","handleOutsideClick","getWindowProps","_this$asProps2","closable","getI18nText","uid","state","onKeyDown","handleKeyDown","undefined","getCloseProps","_this$asProps3","ghost","onClick","handleIconCloseClick","getTitleProps","_this2","setHasTitle","setState","id","render","_ref","_this$asProps4","Children","disablePortal","forcedAdvancedMode","ignorePortalsStacking","advancedMode","Modal","Overlay","displayName","Window","createElement","_assignProps","variable","fallback","map","Number","parseInt","prop","i18n","locale","props","_ref2","arguments[0]","_ref6","SWindow","styles","windowRef","useRef","cn","_objectSpread","_assignProps2","Close","_ref3","_ref7","SOverlay","overlayRef","zIndex","_assignProps3","_ref4","_ref8","SClose","hasChildren","children","_assignProps4","Addon","ml","mr","enhance","Title","_ref5","_ref9","color","STitle","resolveColor","useEffect","_assignProps5"],"sources":["../../src/Modal.jsx"],"sourcesContent":["import React from 'react';\nimport { FadeInOut, Slide } from '@semcore/animation';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport Portal, { PortalProvider } from '@semcore/portal';\nimport Button from '@semcore/button';\nimport OutsideClick from '@semcore/outside-click';\nimport CloseIcon from '@semcore/icon/Close/l';\nimport fire from '@semcore/utils/lib/fire';\nimport usePreventScroll from '@semcore/utils/lib/use/usePreventScroll';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport style from './style/modal.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\nimport { Text } from '@semcore/typography';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\nimport { cssVariableEnhance } from '@semcore/utils/lib/useCssVariable';\nimport { useFocusLock } from '@semcore/utils/lib/use/useFocusLock';\nimport { useContextTheme } from '@semcore/utils/lib/ThemeProvider';\nimport { useColorResolver } from '@semcore/utils/lib/use/useColorResolver';\nimport {\n ZIndexStackingContextProvider,\n useZIndexStacking,\n} from '@semcore/utils/lib/zIndexStacking';\n\nclass ModalRoot extends Component {\n static displayName = 'Modal';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n uniqueIDEnhancement(),\n cssVariableEnhance({\n variable: '--intergalactic-duration-modal',\n fallback: '200',\n map: Number.parseInt,\n prop: 'duration',\n }),\n ];\n static defaultProps = {\n closable: true,\n i18n: localizedMessages,\n locale: 'en',\n disablePreventScroll: false,\n };\n state = { hasTitle: false };\n\n handleKeyDown = (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n fire(this, 'onClose', 'onEscape', e);\n }\n };\n\n handleIconCloseClick = (e) => {\n fire(this, 'onClose', 'onCloseClick', e);\n };\n\n handleOutsideClick = (e) => {\n fire(this, 'onClose', 'onOutsideClick', e);\n };\n\n getOverlayProps() {\n const { duration, visible, animationsDisabled, disablePreventScroll } = this.asProps;\n return {\n duration,\n visible,\n onOutsideClick: this.handleOutsideClick,\n animationsDisabled,\n disablePreventScroll,\n };\n }\n\n getWindowProps() {\n const { visible, closable, getI18nText, uid, duration, animationsDisabled } = this.asProps;\n const { hasTitle } = this.state;\n return {\n visible,\n closable,\n onKeyDown: this.handleKeyDown,\n 'aria-label': hasTitle ? undefined : getI18nText('title'),\n 'aria-labelledby': hasTitle ? `igc-${uid}-title` : undefined,\n duration,\n animationsDisabled,\n };\n }\n\n getCloseProps() {\n const { getI18nText, ghost } = this.asProps;\n\n return {\n onClick: this.handleIconCloseClick,\n getI18nText,\n ghost,\n };\n }\n\n getTitleProps() {\n const { uid } = this.asProps;\n const setHasTitle = () => this.setState({ hasTitle: true });\n\n return {\n id: `igc-${uid}-title`,\n setHasTitle,\n };\n }\n\n render() {\n const { Children, disablePortal, forcedAdvancedMode, ignorePortalsStacking } = this.asProps;\n\n const advancedMode =\n forcedAdvancedMode ||\n isAdvanceMode(Children, [Modal.Overlay.displayName, Modal.Window.displayName]);\n\n return (\n <Portal disablePortal={disablePortal} ignorePortalsStacking={ignorePortalsStacking}>\n {advancedMode ? (\n <Children />\n ) : (\n <Modal.Overlay>\n <Root render={Modal.Window} />\n </Modal.Overlay>\n )}\n </Portal>\n );\n }\n}\n\nfunction Window(props) {\n const SWindow = Root;\n const { Children, styles, visible, closable, duration } = props;\n const windowRef = React.useRef(null);\n\n useFocusLock(windowRef, true, 'auto', !visible, true);\n\n return sstyled(styles)(\n <SWindow\n render={Slide}\n initialAnimation={true}\n slideOrigin='top'\n visible={visible}\n role='dialog'\n aria-modal={true}\n duration={duration}\n ref={windowRef}\n >\n <ZIndexStackingContextProvider designToken='z-index-modal'>\n <PortalProvider value={windowRef}>\n {closable && <Modal.Close />}\n <Children />\n </PortalProvider>\n </ZIndexStackingContextProvider>\n </SWindow>,\n );\n}\n\nfunction Overlay(props) {\n const SOverlay = Root;\n const { Children, styles, onOutsideClick, visible } = props;\n const overlayRef = React.useRef(null);\n usePreventScroll(visible, props.disablePreventScroll);\n useContextTheme(overlayRef, visible);\n const zIndex = useZIndexStacking('z-index-modal');\n\n return sstyled(styles)(\n <SOverlay render={FadeInOut} ref={overlayRef} zIndex={zIndex}>\n <OutsideClick root={overlayRef} onOutsideClick={onOutsideClick}>\n <Children />\n </OutsideClick>\n </SOverlay>,\n );\n}\n\nfunction Close(props) {\n const SClose = Root;\n const { Children, children: hasChildren, getI18nText, ghost } = props;\n return sstyled(props.styles)(\n <SClose\n render={Button}\n use='tertiary'\n size='l'\n theme={ghost ? 'invert' : 'muted'}\n aria-label={getI18nText('close')}\n >\n {hasChildren ? (\n <Children />\n ) : (\n <Button.Addon ml={'7px'} mr={'7px'}>\n <CloseIcon title={getI18nText('close')} />\n </Button.Addon>\n )}\n </SClose>,\n );\n}\n\nClose.enhance = [keyboardFocusEnhance()];\n\nfunction Title(props) {\n const { setHasTitle, styles, color } = props;\n const STitle = Root;\n\n const resolveColor = useColorResolver();\n React.useEffect(() => setHasTitle());\n\n return sstyled(styles)(<STitle render={Text} tag='h2' use:color={resolveColor(color)} />);\n}\n\nconst Modal = createComponent(ModalRoot, {\n Window,\n Overlay,\n Close,\n Title,\n});\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,S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,YAAY,GAAG9G,gBAAgB,EAAE;EACvC1B,KAAK,CAACyI,SAAS,CAAC;IAAA,OAAM3D,WAAW,EAAE;EAAA,EAAC;EAEpC,OAAAuD,KAAA,GAAOhI,OAAO,CAACuG,MAAM,CAAC,eAAC5G,KAAA,CAAA6F,aAAA,CAAC0C,MAAM,EAAAF,KAAA,CAAAtB,EAAA,WAAAC,aAAA,KAAA0B,aAAA;IAAA,OAAmB,IAAI;IAAA,aAAYF,YAAY,CAACF,KAAK;EAAC,GAAAF,KAAA,IAAI;AAC1F;AAEA,IAAM3C,KAAK,GAAGtF,eAAe,CAAC0B,SAAS,EAAE;EACvC+D,MAAM,EAANA,MAAM;EACNF,OAAO,EAAPA,OAAO;EACPwB,KAAK,EAALA,KAAK;EACLiB,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAe1C,KAAK"}
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["FadeInOut","Slide","Flex","OutsideClick","Portal","PortalProvider","Button","createComponent","Component","sstyled","Root","i18nEnhance","isAdvanceMode","fire","useContextTheme","uniqueIDEnhancement","useColorResolver","useFocusLock","usePreventScroll","cssVariableEnhance","ZIndexStackingContextProvider","useZIndexStacking","CloseIcon","Text","React","style","_sstyled","insert","localizedMessages","ModalRoot","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","hasTitle","e","key","stopPropagation","_inherits","_createClass","value","getOverlayProps","_this$asProps","asProps","duration","visible","animationsDisabled","disablePreventScroll","onOutsideClick","handleOutsideClick","getWindowProps","_this$asProps2","closable","getI18nText","uid","state","handleKeyDown","undefined","getCloseProps","_this$asProps3","ghost","onClick","handleIconCloseClick","getTitleProps","_this2","setHasTitle","setState","id","render","_ref","_this$asProps4","Children","disablePortal","forcedAdvancedMode","ignorePortalsStacking","advancedMode","Modal","Overlay","displayName","Window","createElement","_assignProps","variable","fallback","map","Number","parseInt","prop","i18n","locale","props","_ref2","arguments[0]","_ref6","SWindow","styles","windowRef","useRef","cn","_objectSpread","_assignProps2","Close","_ref3","_ref7","SOverlay","SOverlayContentWrapper","overlayContentWrapperRef","zIndex","_assignProps3","_ref4","_ref8","SClose","hasChildren","children","_assignProps4","Addon","ml","mr","Title","_ref5","_ref9","color","STitle","resolveColor","useEffect","_assignProps5"],"sources":["../../src/Modal.jsx"],"sourcesContent":["import { FadeInOut, Slide, Flex, OutsideClick, Portal, PortalProvider } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { isAdvanceMode } from '@semcore/core/lib/utils/findComponent';\nimport fire from '@semcore/core/lib/utils/fire';\nimport { useContextTheme } from '@semcore/core/lib/utils/ThemeProvider';\nimport uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';\nimport { useColorResolver } from '@semcore/core/lib/utils/use/useColorResolver';\nimport { useFocusLock } from '@semcore/core/lib/utils/use/useFocusLock';\nimport usePreventScroll from '@semcore/core/lib/utils/use/usePreventScroll';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport {\n ZIndexStackingContextProvider,\n useZIndexStacking,\n} from '@semcore/core/lib/utils/zIndexStacking';\nimport CloseIcon from '@semcore/icon/Close/l';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport style from './style/modal.shadow.css';\nimport { localizedMessages } from './translations/__intergalactic-dynamic-locales';\n\nclass ModalRoot extends Component {\n static displayName = 'Modal';\n static style = style;\n static enhance = [\n i18nEnhance(localizedMessages),\n uniqueIDEnhancement(),\n cssVariableEnhance({\n variable: '--intergalactic-duration-modal',\n fallback: '200',\n map: Number.parseInt,\n prop: 'duration',\n }),\n ];\n\n static defaultProps = {\n closable: true,\n i18n: localizedMessages,\n locale: 'en',\n disablePreventScroll: false,\n };\n\n state = { hasTitle: false };\n\n handleKeyDown = (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n fire(this, 'onClose', 'onEscape', e);\n }\n };\n\n handleIconCloseClick = (e) => {\n fire(this, 'onClose', 'onCloseClick', e);\n };\n\n handleOutsideClick = (e) => {\n fire(this, 'onClose', 'onOutsideClick', e);\n };\n\n getOverlayProps() {\n const { duration, visible, animationsDisabled, disablePreventScroll } = this.asProps;\n return {\n duration,\n visible,\n onOutsideClick: this.handleOutsideClick,\n animationsDisabled,\n disablePreventScroll,\n };\n }\n\n getWindowProps() {\n const { visible, closable, getI18nText, uid, duration, animationsDisabled } = this.asProps;\n const { hasTitle } = this.state;\n return {\n visible,\n closable,\n 'onKeyDown': this.handleKeyDown,\n 'aria-label': hasTitle ? undefined : getI18nText('title'),\n 'aria-labelledby': hasTitle ? `igc-${uid}-title` : undefined,\n duration,\n animationsDisabled,\n };\n }\n\n getCloseProps() {\n const { getI18nText, ghost } = this.asProps;\n\n return {\n onClick: this.handleIconCloseClick,\n getI18nText,\n ghost,\n };\n }\n\n getTitleProps() {\n const { uid } = this.asProps;\n const setHasTitle = () => this.setState({ hasTitle: true });\n\n return {\n id: `igc-${uid}-title`,\n setHasTitle,\n };\n }\n\n render() {\n const { Children, disablePortal, forcedAdvancedMode, ignorePortalsStacking } = this.asProps;\n\n const advancedMode =\n forcedAdvancedMode ||\n isAdvanceMode(Children, [Modal.Overlay.displayName, Modal.Window.displayName]);\n\n return (\n <Portal disablePortal={disablePortal} ignorePortalsStacking={ignorePortalsStacking}>\n {advancedMode\n ? (\n <Children />\n )\n : (\n <Modal.Overlay>\n <Root render={Modal.Window} />\n </Modal.Overlay>\n )}\n </Portal>\n );\n }\n}\n\nfunction Window(props) {\n const SWindow = Root;\n const { Children, styles, visible, closable, duration } = props;\n const windowRef = React.useRef(null);\n\n useFocusLock(windowRef, 'enforced', 'auto', !visible, true);\n\n return sstyled(styles)(\n <SWindow\n render={Slide}\n initialAnimation={true}\n slideOrigin='top'\n visible={visible}\n role='dialog'\n aria-modal={true}\n duration={duration}\n ref={windowRef}\n tabIndex={-1}\n >\n <ZIndexStackingContextProvider designToken='z-index-modal'>\n <PortalProvider value={windowRef}>\n {closable && <Modal.Close />}\n <Children />\n </PortalProvider>\n </ZIndexStackingContextProvider>\n </SWindow>,\n );\n}\n\nfunction Overlay(props) {\n const SOverlay = Root;\n const SOverlayContentWrapper = Flex;\n const { Children, styles, onOutsideClick, visible } = props;\n const overlayContentWrapperRef = React.useRef(null);\n usePreventScroll(visible, props.disablePreventScroll);\n useContextTheme(overlayContentWrapperRef, visible);\n const zIndex = useZIndexStacking('z-index-modal');\n\n return sstyled(styles)(\n <SOverlay render={FadeInOut} zIndex={zIndex}>\n {/* This child component is intended to be private. Since true encapsulation isn't possible in this context, we’re applying the data-ui-name attribute directly as a workaround. */}\n <SOverlayContentWrapper data-ui-name='Modal.Overlay.ContentWrapper' ref={overlayContentWrapperRef}>\n <OutsideClick root={overlayContentWrapperRef} onOutsideClick={onOutsideClick}>\n <Children />\n </OutsideClick>\n </SOverlayContentWrapper>\n </SOverlay>,\n );\n}\n\nfunction Close(props) {\n const SClose = Root;\n const { Children, children: hasChildren, getI18nText, ghost } = props;\n return sstyled(props.styles)(\n <SClose\n render={Button}\n use='tertiary'\n size='l'\n theme={ghost ? 'invert' : 'muted'}\n aria-label={getI18nText('close')}\n >\n {hasChildren\n ? (\n <Children />\n )\n : (\n <Button.Addon ml='7px' mr='7px'>\n <CloseIcon title={getI18nText('close')} />\n </Button.Addon>\n )}\n </SClose>,\n );\n}\n\nfunction Title(props) {\n const { setHasTitle, styles, color } = props;\n const STitle = Root;\n\n const resolveColor = useColorResolver();\n React.useEffect(() => setHasTitle());\n\n return sstyled(styles)(<STitle render={Text} tag='h2' use:color={resolveColor(color)} />);\n}\n\nconst Modal = createComponent(ModalRoot, {\n Window,\n Overlay,\n Close,\n Title,\n});\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,SAAS,EAAEC,KAAK,EAAEC,IAAI,EAAEC,YAAY,EAAEC,MAAM,EAAEC,cAAc,QAAQ,0BAA0B;AACvG,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AEpC,OAAAuD,KAAA,GAAOvH,OAAO,CAAC8F,MAAM,CAAC,eAAC/E,KAAA,CAAAgE,aAAA,CAAC0C,MAAM,EAAAF,KAAA,CAAAtB,EAAA,WAAAC,aAAA,KAAA0B,aAAA;IAAA,OAAmB,IAAI;IAAA,aAAYF,YAAY,CAACF,KAAK;EAAC,GAAAF,KAAA,GAAG,CAAC;AAC1F;AAEA,IAAM3C,KAAK,GAAG7E,eAAe,CAACsB,SAAS,EAAE;EACvC0D,MAAM,EAANA,MAAM;EACNF,OAAO,EAAPA,OAAO;EACPwB,KAAK,EAALA,KAAK;EACLiB,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAe1C,KAAK","ignoreList":[]}
|
package/lib/es6/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { FadeInOutProps, SlideProps, Box, BoxProps, PortalProps } from '@semcore/base-components';\nimport type Button from '@semcore/button';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\nimport type React from 'react';\n\nexport type ModalProps = PortalProps &\n BoxProps &\n FadeInOutProps & {\n /** Duration of animation, ms\n * @default 200\n */\n duration?: number;\n /** This property is responsible for the visibility of the modal window */\n visible?: boolean;\n /** Function called when the component is hidden */\n onClose?: (\n trigger: 'onOutsideClick' | 'onCloseClick' | 'onEscape',\n e?: React.MouseEvent | React.KeyboardEvent,\n ) => void;\n /** Displaying the close button(x) in the upper-right corner of the modal dialog\n * @default true\n * */\n closable?: boolean;\n /**\n * Setting `true` disables mechanism that hides document body scrollbar when Modal is visible\n * @default false\n */\n disablePreventScroll?: boolean;\n /** Specifies the locale for i18n support */\n locale?: string;\n /**\n * Props for render modal without background and paddings. Useful in carousel for example\n */\n ghost?: boolean;\n };\n\nexport type WindowProps = BoxProps & SlideProps & {};\n\nexport type ModalContext = {\n getOverlayProps: PropGetterFn;\n getWindowProps: PropGetterFn;\n getCloseProps: PropGetterFn;\n};\n\ndeclare const Modal: Intergalactic.Component<'div', ModalProps, ModalContext> & {\n Window: Intergalactic.Component<'div', WindowProps>;\n Overlay: typeof Box;\n Close: typeof Button;\n Title: Intergalactic.Component<'div', NSText.Props>;\n};\n\nexport default Modal;\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Modal';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,SAAS"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Modal';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
SWindow {
|
|
2
2
|
position: relative;
|
|
3
|
-
border-radius: var(--intergalactic-modal-rounded, 12px);
|
|
4
|
-
background: var(--intergalactic-bg-primary-neutral,
|
|
3
|
+
border-radius: var(--intergalactic-modal-rounded, calc(12px + 2px));
|
|
4
|
+
background: var(--intergalactic-bg-primary-neutral, oklch(1 0 0));
|
|
5
5
|
box-sizing: border-box;
|
|
6
6
|
margin: auto;
|
|
7
7
|
padding: var(--intergalactic-spacing-10x, 40px);
|
|
8
|
-
box-shadow: var(--intergalactic-box-shadow-modal, 0px
|
|
9
|
-
color: var(--intergalactic-text-primary,
|
|
8
|
+
box-shadow: var(--intergalactic-box-shadow-modal, 0px 1px 5px 0px oklch(0.176 0.033 175.7 / 0.07));
|
|
9
|
+
color: var(--intergalactic-text-primary, oklch(0.1 0.03 137 / 0.899));
|
|
10
10
|
|
|
11
11
|
&:focus {
|
|
12
12
|
outline: none;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
STitle {
|
|
16
|
-
color: var(--intergalactic-text-primary,
|
|
16
|
+
color: var(--intergalactic-text-primary, oklch(0.1 0.03 137 / 0.899));
|
|
17
17
|
font-size: var(--intergalactic-fs-500, 24px);
|
|
18
18
|
line-height: var(--intergalactic-lh-500, 117%);
|
|
19
19
|
font-weight: var(--intergalactic-semi-bold, 600);
|
|
@@ -43,24 +43,31 @@ SWindow[ghost] {
|
|
|
43
43
|
box-shadow: none;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
SOverlayContentWrapper {
|
|
47
|
+
flex: 1;
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
padding: var(--intergalactic-spacing-10x, 40px);
|
|
51
|
+
}
|
|
52
|
+
|
|
46
53
|
SOverlay {
|
|
54
|
+
display: flex;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
flex-wrap: wrap;
|
|
47
57
|
position: fixed;
|
|
48
58
|
top: 0;
|
|
49
59
|
bottom: 0;
|
|
50
60
|
left: 0;
|
|
51
61
|
right: 0;
|
|
52
62
|
margin: 0;
|
|
53
|
-
|
|
54
|
-
justify-content: center;
|
|
55
|
-
align-items: center;
|
|
56
|
-
padding: var(--intergalactic-spacing-10x, 40px);
|
|
57
|
-
background: var(--intergalactic-overlay-primary, rgba(25, 27, 35, 0.7));
|
|
63
|
+
background: var(--intergalactic-overlay-primary, oklch(0.109 0.023 165.5 / 0.337));
|
|
58
64
|
overflow: auto;
|
|
59
65
|
-webkit-overflow-scrolling: touch;
|
|
60
66
|
|
|
61
67
|
& SOverlay {
|
|
62
|
-
background: var(--intergalactic-overlay-secondary,
|
|
68
|
+
background: var(--intergalactic-overlay-secondary, oklch(0.118 0.023 170.1 / 0.262));
|
|
63
69
|
}
|
|
70
|
+
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
@media (max-width: 767px) {
|
|
@@ -68,7 +75,7 @@ SOverlay {
|
|
|
68
75
|
min-width: 60%;
|
|
69
76
|
}
|
|
70
77
|
|
|
71
|
-
|
|
78
|
+
SOverlayContentWrapper {
|
|
72
79
|
padding: var(--intergalactic-spacing-3x, 12px);
|
|
73
80
|
}
|
|
74
81
|
}
|
|
@@ -6,12 +6,12 @@ import it from './it.json';
|
|
|
6
6
|
import ja from './ja.json';
|
|
7
7
|
import ko from './ko.json';
|
|
8
8
|
import nl from './nl.json';
|
|
9
|
+
import pl from './pl.json';
|
|
9
10
|
import pt from './pt.json';
|
|
11
|
+
import sv from './sv.json';
|
|
10
12
|
import tr from './tr.json';
|
|
11
13
|
import vi from './vi.json';
|
|
12
14
|
import zh from './zh.json';
|
|
13
|
-
import pl from './pl.json';
|
|
14
|
-
import sv from './sv.json';
|
|
15
15
|
export var localizedMessages = {
|
|
16
16
|
de: de,
|
|
17
17
|
en: en,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","
|
|
1
|
+
{"version":3,"file":"__intergalactic-dynamic-locales.js","names":["de","en","es","fr","it","ja","ko","nl","pl","pt","sv","tr","vi","zh","localizedMessages"],"sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport es from './es.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport ja from './ja.json';\nimport ko from './ko.json';\nimport nl from './nl.json';\nimport pl from './pl.json';\nimport pt from './pt.json';\nimport sv from './sv.json';\nimport tr from './tr.json';\nimport vi from './vi.json';\nimport zh from './zh.json';\n\nexport const localizedMessages = {\n de,\n en,\n es,\n fr,\n it,\n ja,\n ko,\n nl,\n pt,\n tr,\n vi,\n zh,\n pl,\n sv,\n};\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAE1B,OAAO,IAAMC,iBAAiB,GAAG;EAC/Bd,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFE,EAAE,EAAFA,EAAE;EACFE,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFC,EAAE,EAAFA,EAAE;EACFL,EAAE,EAAFA,EAAE;EACFE,EAAE,EAAFA;AACF,CAAC","ignoreList":[]}
|
package/lib/esm/Modal.mjs
CHANGED
|
@@ -1,78 +1,73 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import { sstyled } from "@semcore/
|
|
9
|
-
import
|
|
10
|
-
import React from "react";
|
|
11
|
-
import { Slide, FadeInOut } from "@semcore/animation";
|
|
12
|
-
import Portal, { PortalProvider } from "@semcore/portal";
|
|
7
|
+
import { sstyled, assignProps, Component, createComponent } from "@semcore/core";
|
|
8
|
+
import { Portal, Slide, PortalProvider, FadeInOut, Flex, OutsideClick } from "@semcore/base-components";
|
|
13
9
|
import Button from "@semcore/button";
|
|
14
|
-
import
|
|
10
|
+
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
11
|
+
import { isAdvanceMode } from "@semcore/core/lib/utils/findComponent";
|
|
12
|
+
import fire from "@semcore/core/lib/utils/fire";
|
|
13
|
+
import { useContextTheme } from "@semcore/core/lib/utils/ThemeProvider";
|
|
14
|
+
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
15
|
+
import { useColorResolver } from "@semcore/core/lib/utils/use/useColorResolver";
|
|
16
|
+
import { useFocusLock } from "@semcore/core/lib/utils/use/useFocusLock";
|
|
17
|
+
import usePreventScroll from "@semcore/core/lib/utils/use/usePreventScroll";
|
|
18
|
+
import { cssVariableEnhance } from "@semcore/core/lib/utils/useCssVariable";
|
|
19
|
+
import { ZIndexStackingContextProvider, useZIndexStacking } from "@semcore/core/lib/utils/zIndexStacking";
|
|
15
20
|
import CloseIcon from "@semcore/icon/Close/l";
|
|
16
|
-
import fire from "@semcore/utils/lib/fire";
|
|
17
|
-
import usePreventScroll from "@semcore/utils/lib/use/usePreventScroll";
|
|
18
|
-
import { isAdvanceMode } from "@semcore/utils/lib/findComponent";
|
|
19
|
-
import keyboardFocusEnhance from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
|
|
20
|
-
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
21
|
-
import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
22
21
|
import { Text } from "@semcore/typography";
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import { useFocusLock } from "@semcore/utils/lib/use/useFocusLock";
|
|
26
|
-
import { useContextTheme } from "@semcore/utils/lib/ThemeProvider";
|
|
27
|
-
import { useColorResolver } from "@semcore/utils/lib/use/useColorResolver";
|
|
28
|
-
import { ZIndexStackingContextProvider, useZIndexStacking } from "@semcore/utils/lib/zIndexStacking";
|
|
22
|
+
import React from "react";
|
|
23
|
+
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
29
24
|
/*!__reshadow-styles__:"./style/modal.shadow.css"*/
|
|
30
25
|
var style = (
|
|
31
26
|
/*__reshadow_css_start__*/
|
|
32
27
|
(sstyled.insert(
|
|
33
28
|
/*__inner_css_start__*/
|
|
34
|
-
".
|
|
29
|
+
".___SWindow_ryb06_gg_{position:relative;border-radius:var(--intergalactic-modal-rounded, calc(12px + 2px));background:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255));box-sizing:border-box;margin:auto;padding:var(--intergalactic-spacing-10x, 40px);box-shadow:var(--intergalactic-box-shadow-modal, 0px 1px 5px 0px rgba(0, 21, 16, 0.07));color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}@supports (color:color(display-p3 0 0 0%)){.___SWindow_ryb06_gg_{box-shadow:var(--intergalactic-box-shadow-modal, 0px 1px 5px 0px rgba(0, 21, 16, 0.07))}@media (color-gamut:p3){.___SWindow_ryb06_gg_{box-shadow:var(--intergalactic-box-shadow-modal, 0px 1px 5px 0px color(display-p3 0.01753 0.08157 0.06372 / 0.07))}}}.___SWindow_ryb06_gg_:focus{outline:0}.___SWindow_ryb06_gg_ .___STitle_ryb06_gg_{color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899));font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%);font-weight:var(--intergalactic-semi-bold, 600);margin-bottom:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-4x, 16px)}.___SWindow_ryb06_gg_ .___STitle_ryb06_gg_.__color_ryb06_gg_{color:var(--color_ryb06)}.___SWindow_ryb06_gg_ .___SClose_ryb06_gg_{display:inline-flex;position:absolute;right:var(--intergalactic-spacing-2x, 8px);top:var(--intergalactic-spacing-2x, 8px)}.___SWindow_ryb06_gg_ .___SClose_ryb06_gg_.__ghost_ryb06_gg_{right:0;top:0}.___SWindow_ryb06_gg_.__ghost_ryb06_gg_{background:0 0;padding:0;box-shadow:none}.___SOverlayContentWrapper_ryb06_gg_{flex:1;max-width:100%;box-sizing:border-box;padding:var(--intergalactic-spacing-10x, 40px)}.___SOverlay_ryb06_gg_{display:flex;justify-content:center;flex-wrap:wrap;position:fixed;top:0;bottom:0;left:0;right:0;margin:0;background:var(--intergalactic-overlay-primary, rgba(0, 6, 3, 0.337));overflow:auto;-webkit-overflow-scrolling:touch}@supports (color:color(display-p3 0 0 0%)){.___SOverlay_ryb06_gg_{background:var(--intergalactic-overlay-primary, rgba(0, 6, 3, 0.337))}@media (color-gamut:p3){.___SOverlay_ryb06_gg_{background:var(--intergalactic-overlay-primary, color(display-p3 0.00414 0.0233 0.01269 / 0.337))}}}.___SOverlay_ryb06_gg_ .___SOverlay_ryb06_gg_{background:var(--intergalactic-overlay-secondary, rgba(0, 8, 5, 0.262))}@media (max-width:767px){.___SWindow_ryb06_gg_{min-width:60%}.___SOverlayContentWrapper_ryb06_gg_{padding:var(--intergalactic-spacing-3x, 12px)}}",
|
|
35
30
|
/*__inner_css_end__*/
|
|
36
|
-
"
|
|
31
|
+
"ryb06_gg_"
|
|
37
32
|
), /*__reshadow_css_end__*/
|
|
38
33
|
{
|
|
39
|
-
"__SWindow": "
|
|
40
|
-
"_ghost": "
|
|
41
|
-
"
|
|
42
|
-
"__STitle": "
|
|
43
|
-
"_color": "
|
|
44
|
-
"--color": "--
|
|
45
|
-
"__SClose": "
|
|
34
|
+
"__SWindow": "___SWindow_ryb06_gg_",
|
|
35
|
+
"_ghost": "__ghost_ryb06_gg_",
|
|
36
|
+
"__SOverlayContentWrapper": "___SOverlayContentWrapper_ryb06_gg_",
|
|
37
|
+
"__STitle": "___STitle_ryb06_gg_",
|
|
38
|
+
"_color": "__color_ryb06_gg_",
|
|
39
|
+
"--color": "--color_ryb06",
|
|
40
|
+
"__SClose": "___SClose_ryb06_gg_",
|
|
41
|
+
"__SOverlay": "___SOverlay_ryb06_gg_"
|
|
46
42
|
})
|
|
47
43
|
);
|
|
48
|
-
var ModalRoot = /* @__PURE__ */ function(_Component) {
|
|
49
|
-
_inherits(ModalRoot2, _Component);
|
|
50
|
-
var _super = _createSuper(ModalRoot2);
|
|
44
|
+
var ModalRoot = /* @__PURE__ */ (function(_Component) {
|
|
51
45
|
function ModalRoot2() {
|
|
52
46
|
var _this;
|
|
53
47
|
_classCallCheck(this, ModalRoot2);
|
|
54
48
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
49
|
args[_key] = arguments[_key];
|
|
56
50
|
}
|
|
57
|
-
_this =
|
|
58
|
-
_defineProperty(
|
|
51
|
+
_this = _callSuper(this, ModalRoot2, [].concat(args));
|
|
52
|
+
_defineProperty(_this, "state", {
|
|
59
53
|
hasTitle: false
|
|
60
54
|
});
|
|
61
|
-
_defineProperty(
|
|
55
|
+
_defineProperty(_this, "handleKeyDown", function(e) {
|
|
62
56
|
if (e.key === "Escape") {
|
|
63
57
|
e.stopPropagation();
|
|
64
|
-
fire(
|
|
58
|
+
fire(_this, "onClose", "onEscape", e);
|
|
65
59
|
}
|
|
66
60
|
});
|
|
67
|
-
_defineProperty(
|
|
68
|
-
fire(
|
|
61
|
+
_defineProperty(_this, "handleIconCloseClick", function(e) {
|
|
62
|
+
fire(_this, "onClose", "onCloseClick", e);
|
|
69
63
|
});
|
|
70
|
-
_defineProperty(
|
|
71
|
-
fire(
|
|
64
|
+
_defineProperty(_this, "handleOutsideClick", function(e) {
|
|
65
|
+
fire(_this, "onClose", "onOutsideClick", e);
|
|
72
66
|
});
|
|
73
67
|
return _this;
|
|
74
68
|
}
|
|
75
|
-
|
|
69
|
+
_inherits(ModalRoot2, _Component);
|
|
70
|
+
return _createClass(ModalRoot2, [{
|
|
76
71
|
key: "getOverlayProps",
|
|
77
72
|
value: function getOverlayProps() {
|
|
78
73
|
var _this$asProps = this.asProps, duration = _this$asProps.duration, visible = _this$asProps.visible, animationsDisabled = _this$asProps.animationsDisabled, disablePreventScroll = _this$asProps.disablePreventScroll;
|
|
@@ -92,7 +87,7 @@ var ModalRoot = /* @__PURE__ */ function(_Component) {
|
|
|
92
87
|
return {
|
|
93
88
|
visible,
|
|
94
89
|
closable,
|
|
95
|
-
onKeyDown: this.handleKeyDown,
|
|
90
|
+
"onKeyDown": this.handleKeyDown,
|
|
96
91
|
"aria-label": hasTitle ? void 0 : getI18nText("title"),
|
|
97
92
|
"aria-labelledby": hasTitle ? "igc-".concat(uid, "-title") : void 0,
|
|
98
93
|
duration,
|
|
@@ -136,8 +131,7 @@ var ModalRoot = /* @__PURE__ */ function(_Component) {
|
|
|
136
131
|
}, advancedMode ? /* @__PURE__ */ React.createElement(Children, null) : /* @__PURE__ */ React.createElement(Modal.Overlay, null, /* @__PURE__ */ React.createElement(Modal.Window, assignProps({}, _ref))));
|
|
137
132
|
}
|
|
138
133
|
}]);
|
|
139
|
-
|
|
140
|
-
}(Component);
|
|
134
|
+
})(Component);
|
|
141
135
|
_defineProperty(ModalRoot, "displayName", "Modal");
|
|
142
136
|
_defineProperty(ModalRoot, "style", style);
|
|
143
137
|
_defineProperty(ModalRoot, "enhance", [i18nEnhance(localizedMessages), uniqueIDEnhancement(), cssVariableEnhance({
|
|
@@ -157,15 +151,16 @@ function Window(props) {
|
|
|
157
151
|
var SWindow = Slide;
|
|
158
152
|
var Children = props.Children, styles = props.styles, visible = props.visible, closable = props.closable, duration = props.duration;
|
|
159
153
|
var windowRef = React.useRef(null);
|
|
160
|
-
useFocusLock(windowRef,
|
|
161
|
-
return _ref6 = sstyled
|
|
154
|
+
useFocusLock(windowRef, "enforced", "auto", !visible, true);
|
|
155
|
+
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SWindow, _ref6.cn("SWindow", _objectSpread({}, assignProps({
|
|
162
156
|
"initialAnimation": true,
|
|
163
157
|
"slideOrigin": "top",
|
|
164
158
|
"visible": visible,
|
|
165
159
|
"role": "dialog",
|
|
166
160
|
"aria-modal": true,
|
|
167
161
|
"duration": duration,
|
|
168
|
-
"ref": windowRef
|
|
162
|
+
"ref": windowRef,
|
|
163
|
+
"tabIndex": -1
|
|
169
164
|
}, _ref2))), /* @__PURE__ */ React.createElement(ZIndexStackingContextProvider, _ref6.cn("ZIndexStackingContextProvider", {
|
|
170
165
|
"designToken": "z-index-modal"
|
|
171
166
|
}), /* @__PURE__ */ React.createElement(PortalProvider, _ref6.cn("PortalProvider", {
|
|
@@ -175,24 +170,27 @@ function Window(props) {
|
|
|
175
170
|
function Overlay(props) {
|
|
176
171
|
var _ref3 = arguments[0], _ref7;
|
|
177
172
|
var SOverlay = FadeInOut;
|
|
173
|
+
var SOverlayContentWrapper = Flex;
|
|
178
174
|
var Children = props.Children, styles = props.styles, onOutsideClick = props.onOutsideClick, visible = props.visible;
|
|
179
|
-
var
|
|
175
|
+
var overlayContentWrapperRef = React.useRef(null);
|
|
180
176
|
usePreventScroll(visible, props.disablePreventScroll);
|
|
181
|
-
useContextTheme(
|
|
177
|
+
useContextTheme(overlayContentWrapperRef, visible);
|
|
182
178
|
var zIndex = useZIndexStacking("z-index-modal");
|
|
183
|
-
return _ref7 = sstyled
|
|
184
|
-
"ref": overlayRef,
|
|
179
|
+
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SOverlay, _ref7.cn("SOverlay", _objectSpread({}, assignProps({
|
|
185
180
|
"zIndex": zIndex
|
|
186
|
-
}, _ref3))), /* @__PURE__ */ React.createElement(
|
|
187
|
-
"
|
|
181
|
+
}, _ref3))), /* @__PURE__ */ React.createElement(SOverlayContentWrapper, _ref7.cn("SOverlayContentWrapper", {
|
|
182
|
+
"data-ui-name": "Modal.Overlay.ContentWrapper",
|
|
183
|
+
"ref": overlayContentWrapperRef
|
|
184
|
+
}), /* @__PURE__ */ React.createElement(OutsideClick, _ref7.cn("OutsideClick", {
|
|
185
|
+
"root": overlayContentWrapperRef,
|
|
188
186
|
"onOutsideClick": onOutsideClick
|
|
189
|
-
}), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {}))));
|
|
187
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {})))));
|
|
190
188
|
}
|
|
191
189
|
function Close(props) {
|
|
192
190
|
var _ref4 = arguments[0], _ref8;
|
|
193
191
|
var SClose = Button;
|
|
194
192
|
var Children = props.Children, hasChildren = props.children, getI18nText = props.getI18nText, ghost = props.ghost;
|
|
195
|
-
return _ref8 = sstyled
|
|
193
|
+
return _ref8 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SClose, _ref8.cn("SClose", _objectSpread({}, assignProps({
|
|
196
194
|
"use": "tertiary",
|
|
197
195
|
"size": "l",
|
|
198
196
|
"theme": ghost ? "invert" : "muted",
|
|
@@ -204,7 +202,6 @@ function Close(props) {
|
|
|
204
202
|
"title": getI18nText("close")
|
|
205
203
|
}))));
|
|
206
204
|
}
|
|
207
|
-
Close.enhance = [keyboardFocusEnhance()];
|
|
208
205
|
function Title(props) {
|
|
209
206
|
var _ref5 = arguments[0], _ref9;
|
|
210
207
|
var setHasTitle = props.setHasTitle, styles = props.styles, color = props.color;
|
|
@@ -213,7 +210,7 @@ function Title(props) {
|
|
|
213
210
|
React.useEffect(function() {
|
|
214
211
|
return setHasTitle();
|
|
215
212
|
});
|
|
216
|
-
return _ref9 = sstyled
|
|
213
|
+
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(STitle, _ref9.cn("STitle", _objectSpread({}, assignProps({
|
|
217
214
|
"tag": "h2",
|
|
218
215
|
"use:color": resolveColor(color)
|
|
219
216
|
}, _ref5))));
|