@easypost/easy-ui 1.0.0-alpha.94 → 1.0.0-alpha.96
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 -0
- package/Modal/Modal.stories.d.ts +1 -0
- package/Modal/Modal.stories.d.ts.map +1 -1
- package/Modal/ModalContainer.d.ts.map +1 -1
- package/Modal/ModalHeader.d.ts +3 -3
- package/Modal/ModalHeader.d.ts.map +1 -1
- package/Modal/ModalTrigger.d.ts.map +1 -1
- package/Modal/ModalUnderlay.d.ts.map +1 -1
- package/Modal/context.d.ts +9 -2
- package/Modal/context.d.ts.map +1 -1
- package/Modal/index.js +49 -32
- package/Modal/index.mjs +50 -33
- package/package.json +1 -1
- package/style.css +27 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @easypost/easy-ui
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.96
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7670391: fix(Modal): hide parent of nested modal
|
|
8
|
+
|
|
9
|
+
## 1.0.0-alpha.95
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ba6929c: fix(Modal): disable hiding parent nested modal
|
|
14
|
+
|
|
3
15
|
## 1.0.0-alpha.94
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/Modal/Modal.stories.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export declare const DefaultOpen: ModalTriggerStory;
|
|
|
13
13
|
export declare const Controlled: ModalTriggerStory;
|
|
14
14
|
export declare const MenuTrigger: ModalTriggerStory;
|
|
15
15
|
export declare const Nested: ModalTriggerStory;
|
|
16
|
+
export declare const WithSelect: ModalStory;
|
|
16
17
|
//# sourceMappingURL=Modal.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.stories.d.ts","sourceRoot":"","sources":["../../src/Modal/Modal.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQlD,OAAO,EAAE,KAAK,EAAmC,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.stories.d.ts","sourceRoot":"","sources":["../../src/Modal/Modal.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQlD,OAAO,EAAE,KAAK,EAAmC,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK9C,KAAK,UAAU,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AACzC,KAAK,iBAAiB,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;AAEvD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAQ5B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,MAAM,EAAE,UAkBpB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,UA6CtB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBA6B5B,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,UAwBlB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,iBAwBzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,iBAwBxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,iBAyBzB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,iBA4FpB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAqBxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContainer.d.ts","sourceRoot":"","sources":["../../src/Modal/ModalContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ModalContainer.d.ts","sourceRoot":"","sources":["../../src/Modal/ModalContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgB,SAAS,EAA0B,MAAM,OAAO,CAAC;AAM/E,KAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBA0CxD"}
|
package/Modal/ModalHeader.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
2
|
import { IconSymbol } from "../types";
|
|
3
3
|
export type ModalHeaderProps = {
|
|
4
4
|
/**
|
|
@@ -10,11 +10,11 @@ export type ModalHeaderProps = {
|
|
|
10
10
|
/**
|
|
11
11
|
* The content for the title of the modal.
|
|
12
12
|
*/
|
|
13
|
-
children:
|
|
13
|
+
children: ReactNode;
|
|
14
14
|
/**
|
|
15
15
|
* The content for the subtitle of the modal.
|
|
16
16
|
*/
|
|
17
|
-
subtitle?:
|
|
17
|
+
subtitle?: ReactNode;
|
|
18
18
|
/**
|
|
19
19
|
* Icon to display at the start of the header title.
|
|
20
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalHeader.d.ts","sourceRoot":"","sources":["../../src/Modal/ModalHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ModalHeader.d.ts","sourceRoot":"","sources":["../../src/Modal/ModalHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAMtC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAE7C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE;QACZ,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC;KACpB,CAAC;IAEF;;OAEG;IACH,SAAS,CAAC,EAAE;QACV,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC;QACnB,IAAI,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,qBA+ClD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalTrigger.d.ts","sourceRoot":"","sources":["../../src/Modal/ModalTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"ModalTrigger.d.ts","sourceRoot":"","sources":["../../src/Modal/ModalTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAgB,MAAM,OAAO,CAAC;AAM1D,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,YAAY,CAAC;AAExE,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,QAAQ,EAAE,CAAC,YAAY,EAAE,qBAAqB,GAAG,YAAY,CAAC,CAAC;IAE/D;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBA8BpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalUnderlay.d.ts","sourceRoot":"","sources":["../../src/Modal/ModalUnderlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ModalUnderlay.d.ts","sourceRoot":"","sources":["../../src/Modal/ModalUnderlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAMpD,KAAK,kBAAkB,GAAG;IACxB;;OAEG;IACH,KAAK,EAAE,mBAAmB,CAAC;IAE3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAgCtD"}
|
package/Modal/context.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
1
2
|
import { FocusableElement } from "@react-types/shared";
|
|
2
3
|
import { DOMAttributes, RefObject } from "react";
|
|
3
4
|
import { OverlayTriggerState } from "react-stately";
|
|
@@ -13,11 +14,17 @@ export type ModalContextType = {
|
|
|
13
14
|
type ModalTriggerContextType = {
|
|
14
15
|
isDismissable: boolean;
|
|
15
16
|
state: OverlayTriggerState;
|
|
17
|
+
hasOpenNestedModal: boolean;
|
|
18
|
+
setHasOpenNestedModal: (hasOpenNestedModal: boolean) => void;
|
|
16
19
|
};
|
|
17
|
-
export
|
|
20
|
+
export type ModalTriggerProviderProps = Pick<ModalTriggerContextType, "state" | "isDismissable"> & {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
export declare const ModalContext: React.Context<ModalContextType | null>;
|
|
18
24
|
export declare const useModalContext: () => ModalContextType;
|
|
19
|
-
export declare const ModalTriggerContext:
|
|
25
|
+
export declare const ModalTriggerContext: React.Context<ModalTriggerContextType | null>;
|
|
20
26
|
export declare const useModalTriggerContext: () => ModalTriggerContextType;
|
|
21
27
|
export declare const useModalTrigger: () => OverlayTriggerState;
|
|
28
|
+
export declare function ModalTriggerProvider({ state, isDismissable, children, }: ModalTriggerProviderProps): React.JSX.Element;
|
|
22
29
|
export {};
|
|
23
30
|
//# sourceMappingURL=context.d.ts.map
|
package/Modal/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/Modal/context.
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/Modal/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,aAAa,EACb,SAAS,EAMV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC7C,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC5C,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACnC,oBAAoB,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IAChD,oBAAoB,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CACjD,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,CAAC,kBAAkB,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,uBAAuB,EACvB,OAAO,GAAG,eAAe,CAC1B,GAAG;IACF,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,YAAY,wCAA+C,CAAC;AAEzE,eAAO,MAAM,eAAe,wBAM3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,+CACqB,CAAC;AAEtD,eAAO,MAAM,sBAAsB,+BAMlC,CAAC;AAEF,eAAO,MAAM,eAAe,2BAG3B,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,aAAa,EACb,QAAQ,GACT,EAAE,yBAAyB,qBAqB3B"}
|
package/Modal/index.js
CHANGED
|
@@ -65,23 +65,48 @@ const useModalTrigger = () => {
|
|
|
65
65
|
const modalTriggerContext = useModalTriggerContext();
|
|
66
66
|
return modalTriggerContext.state;
|
|
67
67
|
};
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
function ModalTriggerProvider({ state, isDismissable, children }) {
|
|
69
|
+
const parentContext = React.useContext(ModalTriggerContext);
|
|
70
|
+
const [hasOpenNestedModal, setHasOpenNestedModal] = React.useState(false);
|
|
71
|
+
const context = React.useMemo(() => {
|
|
72
|
+
return {
|
|
73
|
+
hasOpenNestedModal,
|
|
74
|
+
setHasOpenNestedModal,
|
|
75
|
+
state,
|
|
76
|
+
isDismissable
|
|
77
|
+
};
|
|
78
|
+
}, [hasOpenNestedModal, state, isDismissable]);
|
|
79
|
+
React.useLayoutEffect(() => {
|
|
80
|
+
if (parentContext && state.isOpen && !parentContext.hasOpenNestedModal) {
|
|
81
|
+
parentContext.setHasOpenNestedModal(true);
|
|
82
|
+
}
|
|
83
|
+
if (parentContext && !state.isOpen && parentContext.hasOpenNestedModal) {
|
|
84
|
+
parentContext.setHasOpenNestedModal(false);
|
|
85
|
+
}
|
|
86
|
+
}, [parentContext, state.isOpen]);
|
|
87
|
+
return React.createElement(ModalTriggerContext.Provider, {
|
|
88
|
+
value: context
|
|
89
|
+
}, children);
|
|
90
|
+
}
|
|
91
|
+
const underlayBg = "_underlayBg_w1orl_4";
|
|
92
|
+
const underlayBgHidden = "_underlayBgHidden_w1orl_27";
|
|
93
|
+
const underlayBox = "_underlayBox_w1orl_31";
|
|
94
|
+
const underlayEdge = "_underlayEdge_w1orl_39";
|
|
95
|
+
const Modal$1 = "_Modal_w1orl_45";
|
|
96
|
+
const header = "_header_w1orl_63";
|
|
97
|
+
const stuck = "_stuck_w1orl_69";
|
|
98
|
+
const body = "_body_w1orl_73";
|
|
99
|
+
const content = "_content_w1orl_80";
|
|
100
|
+
const footer = "_footer_w1orl_97";
|
|
101
|
+
const closeBtn = "_closeBtn_w1orl_114";
|
|
102
|
+
const iconAtEnd = "_iconAtEnd_w1orl_128";
|
|
103
|
+
const sizeSm = "_sizeSm_w1orl_134";
|
|
104
|
+
const sizeMd = "_sizeMd_w1orl_138";
|
|
105
|
+
const sizeLg = "_sizeLg_w1orl_142";
|
|
106
|
+
const sizeXl = "_sizeXl_w1orl_146";
|
|
83
107
|
const styles = {
|
|
84
108
|
underlayBg,
|
|
109
|
+
underlayBgHidden,
|
|
85
110
|
underlayBox,
|
|
86
111
|
underlayEdge,
|
|
87
112
|
Modal: Modal$1,
|
|
@@ -177,8 +202,10 @@ function ModalUnderlay(props) {
|
|
|
177
202
|
isDismissable,
|
|
178
203
|
isKeyboardDismissDisabled: !isDismissable
|
|
179
204
|
}), state, ref);
|
|
205
|
+
const { hasOpenNestedModal } = useModalTriggerContext();
|
|
206
|
+
const className = utilities_css.classNames(styles.underlayBg, hasOpenNestedModal && styles.underlayBgHidden);
|
|
180
207
|
return React.createElement(Overlay.$337b884510726a0d$export$c6fdb837b070b4ff, null, React.createElement("div", __spreadValues({
|
|
181
|
-
className
|
|
208
|
+
className
|
|
182
209
|
}, underlayProps), React.createElement("div", __spreadProps(__spreadValues({}, modalProps), {
|
|
183
210
|
ref,
|
|
184
211
|
className: styles.underlayBox
|
|
@@ -198,14 +225,9 @@ function ModalTrigger(props) {
|
|
|
198
225
|
throw new Error("children must be exactly one trigger element and one modal element");
|
|
199
226
|
}
|
|
200
227
|
const [trigger, modal] = children;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
isDismissable
|
|
205
|
-
};
|
|
206
|
-
}, [isDismissable, state]);
|
|
207
|
-
return React.createElement(ModalTriggerContext.Provider, {
|
|
208
|
-
value: context
|
|
228
|
+
return React.createElement(ModalTriggerProvider, {
|
|
229
|
+
state,
|
|
230
|
+
isDismissable
|
|
209
231
|
}, React.cloneElement(trigger, triggerProps), state.isOpen && React.createElement(ModalUnderlay, __spreadProps(__spreadValues({}, props), {
|
|
210
232
|
state
|
|
211
233
|
}), React.cloneElement(typeof modal === "function" ? modal(state.close) : modal, overlayProps)));
|
|
@@ -238,14 +260,9 @@ function ModalContainer(props) {
|
|
|
238
260
|
const { overlayProps } = useOverlayTrigger.$628037886ba31236$export$f9d5c8beee7d008d({
|
|
239
261
|
type: "dialog"
|
|
240
262
|
}, state);
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
isDismissable
|
|
245
|
-
};
|
|
246
|
-
}, [state, isDismissable]);
|
|
247
|
-
return React.createElement(ModalTriggerContext.Provider, {
|
|
248
|
-
value: context
|
|
263
|
+
return React.createElement(ModalTriggerProvider, {
|
|
264
|
+
state,
|
|
265
|
+
isDismissable
|
|
249
266
|
}, state.isOpen && React.createElement(ModalUnderlay, {
|
|
250
267
|
state,
|
|
251
268
|
isDismissable
|
package/Modal/index.mjs
CHANGED
|
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import React__default, { createContext, useContext, useMemo,
|
|
32
|
+
import React__default, { createContext, useContext, useState, useMemo, useLayoutEffect, cloneElement, useRef } from "react";
|
|
33
33
|
import { classNames, variationName } from "../utilities/css.mjs";
|
|
34
34
|
import { useScrollbar } from "../utilities/useScrollbar.mjs";
|
|
35
35
|
import { B as Button } from "../__chunks__/Button-BUkrUXzg.mjs";
|
|
@@ -63,23 +63,48 @@ const useModalTrigger = () => {
|
|
|
63
63
|
const modalTriggerContext = useModalTriggerContext();
|
|
64
64
|
return modalTriggerContext.state;
|
|
65
65
|
};
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
function ModalTriggerProvider({ state, isDismissable, children }) {
|
|
67
|
+
const parentContext = useContext(ModalTriggerContext);
|
|
68
|
+
const [hasOpenNestedModal, setHasOpenNestedModal] = useState(false);
|
|
69
|
+
const context = useMemo(() => {
|
|
70
|
+
return {
|
|
71
|
+
hasOpenNestedModal,
|
|
72
|
+
setHasOpenNestedModal,
|
|
73
|
+
state,
|
|
74
|
+
isDismissable
|
|
75
|
+
};
|
|
76
|
+
}, [hasOpenNestedModal, state, isDismissable]);
|
|
77
|
+
useLayoutEffect(() => {
|
|
78
|
+
if (parentContext && state.isOpen && !parentContext.hasOpenNestedModal) {
|
|
79
|
+
parentContext.setHasOpenNestedModal(true);
|
|
80
|
+
}
|
|
81
|
+
if (parentContext && !state.isOpen && parentContext.hasOpenNestedModal) {
|
|
82
|
+
parentContext.setHasOpenNestedModal(false);
|
|
83
|
+
}
|
|
84
|
+
}, [parentContext, state.isOpen]);
|
|
85
|
+
return React__default.createElement(ModalTriggerContext.Provider, {
|
|
86
|
+
value: context
|
|
87
|
+
}, children);
|
|
88
|
+
}
|
|
89
|
+
const underlayBg = "_underlayBg_w1orl_4";
|
|
90
|
+
const underlayBgHidden = "_underlayBgHidden_w1orl_27";
|
|
91
|
+
const underlayBox = "_underlayBox_w1orl_31";
|
|
92
|
+
const underlayEdge = "_underlayEdge_w1orl_39";
|
|
93
|
+
const Modal$1 = "_Modal_w1orl_45";
|
|
94
|
+
const header = "_header_w1orl_63";
|
|
95
|
+
const stuck = "_stuck_w1orl_69";
|
|
96
|
+
const body = "_body_w1orl_73";
|
|
97
|
+
const content = "_content_w1orl_80";
|
|
98
|
+
const footer = "_footer_w1orl_97";
|
|
99
|
+
const closeBtn = "_closeBtn_w1orl_114";
|
|
100
|
+
const iconAtEnd = "_iconAtEnd_w1orl_128";
|
|
101
|
+
const sizeSm = "_sizeSm_w1orl_134";
|
|
102
|
+
const sizeMd = "_sizeMd_w1orl_138";
|
|
103
|
+
const sizeLg = "_sizeLg_w1orl_142";
|
|
104
|
+
const sizeXl = "_sizeXl_w1orl_146";
|
|
81
105
|
const styles = {
|
|
82
106
|
underlayBg,
|
|
107
|
+
underlayBgHidden,
|
|
83
108
|
underlayBox,
|
|
84
109
|
underlayEdge,
|
|
85
110
|
Modal: Modal$1,
|
|
@@ -175,8 +200,10 @@ function ModalUnderlay(props) {
|
|
|
175
200
|
isDismissable,
|
|
176
201
|
isKeyboardDismissDisabled: !isDismissable
|
|
177
202
|
}), state, ref);
|
|
203
|
+
const { hasOpenNestedModal } = useModalTriggerContext();
|
|
204
|
+
const className = classNames(styles.underlayBg, hasOpenNestedModal && styles.underlayBgHidden);
|
|
178
205
|
return React__default.createElement($337b884510726a0d$export$c6fdb837b070b4ff, null, React__default.createElement("div", __spreadValues({
|
|
179
|
-
className
|
|
206
|
+
className
|
|
180
207
|
}, underlayProps), React__default.createElement("div", __spreadProps(__spreadValues({}, modalProps), {
|
|
181
208
|
ref,
|
|
182
209
|
className: styles.underlayBox
|
|
@@ -196,14 +223,9 @@ function ModalTrigger(props) {
|
|
|
196
223
|
throw new Error("children must be exactly one trigger element and one modal element");
|
|
197
224
|
}
|
|
198
225
|
const [trigger, modal] = children;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
isDismissable
|
|
203
|
-
};
|
|
204
|
-
}, [isDismissable, state]);
|
|
205
|
-
return React__default.createElement(ModalTriggerContext.Provider, {
|
|
206
|
-
value: context
|
|
226
|
+
return React__default.createElement(ModalTriggerProvider, {
|
|
227
|
+
state,
|
|
228
|
+
isDismissable
|
|
207
229
|
}, cloneElement(trigger, triggerProps), state.isOpen && React__default.createElement(ModalUnderlay, __spreadProps(__spreadValues({}, props), {
|
|
208
230
|
state
|
|
209
231
|
}), cloneElement(typeof modal === "function" ? modal(state.close) : modal, overlayProps)));
|
|
@@ -236,14 +258,9 @@ function ModalContainer(props) {
|
|
|
236
258
|
const { overlayProps } = $628037886ba31236$export$f9d5c8beee7d008d({
|
|
237
259
|
type: "dialog"
|
|
238
260
|
}, state);
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
isDismissable
|
|
243
|
-
};
|
|
244
|
-
}, [state, isDismissable]);
|
|
245
|
-
return React__default.createElement(ModalTriggerContext.Provider, {
|
|
246
|
-
value: context
|
|
261
|
+
return React__default.createElement(ModalTriggerProvider, {
|
|
262
|
+
state,
|
|
263
|
+
isDismissable
|
|
247
264
|
}, state.isOpen && React__default.createElement(ModalUnderlay, {
|
|
248
265
|
state,
|
|
249
266
|
isDismissable
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -4961,7 +4961,7 @@ textarea {
|
|
|
4961
4961
|
}/**
|
|
4962
4962
|
* Do not edit directly, this file was auto-generated.
|
|
4963
4963
|
*/
|
|
4964
|
-
.
|
|
4964
|
+
._underlayBg_w1orl_4 {
|
|
4965
4965
|
--ezui-c-modal-underlay-edge-max-height: 72px;
|
|
4966
4966
|
--ezui-c-modal-underlay-edge-min-height: 2.5vh;
|
|
4967
4967
|
position: fixed;
|
|
@@ -4969,25 +4969,26 @@ textarea {
|
|
|
4969
4969
|
display: flex;
|
|
4970
4970
|
flex-direction: column;
|
|
4971
4971
|
}
|
|
4972
|
-
.
|
|
4972
|
+
._underlayBg_w1orl_4::before {
|
|
4973
4973
|
content: "";
|
|
4974
4974
|
position: absolute;
|
|
4975
4975
|
background: var(--ezui-color-primary-800);
|
|
4976
4976
|
opacity: var(--ezui-opacity-underlay);
|
|
4977
4977
|
}
|
|
4978
|
-
._underlayBg_1i8y3_4[aria-hidden=true] {
|
|
4979
|
-
display: none;
|
|
4980
|
-
}
|
|
4981
4978
|
|
|
4982
|
-
.
|
|
4983
|
-
.
|
|
4979
|
+
._underlayBg_w1orl_4,
|
|
4980
|
+
._underlayBg_w1orl_4::before {
|
|
4984
4981
|
top: 0;
|
|
4985
4982
|
left: 0;
|
|
4986
4983
|
right: 0;
|
|
4987
4984
|
bottom: 0;
|
|
4988
4985
|
}
|
|
4989
4986
|
|
|
4990
|
-
.
|
|
4987
|
+
._underlayBgHidden_w1orl_27 {
|
|
4988
|
+
display: none;
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
._underlayBox_w1orl_31 {
|
|
4991
4992
|
position: relative;
|
|
4992
4993
|
display: flex;
|
|
4993
4994
|
flex-direction: column;
|
|
@@ -4995,13 +4996,13 @@ textarea {
|
|
|
4995
4996
|
pointer-events: none;
|
|
4996
4997
|
}
|
|
4997
4998
|
|
|
4998
|
-
.
|
|
4999
|
+
._underlayEdge_w1orl_39 {
|
|
4999
5000
|
flex: 0 9 auto;
|
|
5000
5001
|
height: var(--ezui-c-modal-underlay-edge-max-height);
|
|
5001
5002
|
min-height: var(--ezui-c-modal-underlay-edge-min-height);
|
|
5002
5003
|
}
|
|
5003
5004
|
|
|
5004
|
-
.
|
|
5005
|
+
._Modal_w1orl_45 {
|
|
5005
5006
|
--ezui-c-modal-max-height: 762px;
|
|
5006
5007
|
--ezui-c-modal-width: 95vw;
|
|
5007
5008
|
flex: 0 1 auto;
|
|
@@ -5019,41 +5020,41 @@ textarea {
|
|
|
5019
5020
|
outline: none;
|
|
5020
5021
|
}
|
|
5021
5022
|
|
|
5022
|
-
.
|
|
5023
|
+
._header_w1orl_63 {
|
|
5023
5024
|
margin: 0;
|
|
5024
5025
|
padding: var(--ezui-space-5);
|
|
5025
5026
|
padding-bottom: var(--ezui-space-2);
|
|
5026
5027
|
color: var(--ezui-color-primary-800);
|
|
5027
5028
|
}
|
|
5028
|
-
.
|
|
5029
|
+
._header_w1orl_63._stuck_w1orl_69 {
|
|
5029
5030
|
box-shadow: var(--ezui-shadow-stuck-from-top);
|
|
5030
5031
|
}
|
|
5031
5032
|
|
|
5032
|
-
.
|
|
5033
|
+
._body_w1orl_73 {
|
|
5033
5034
|
overflow: auto;
|
|
5034
5035
|
display: flex;
|
|
5035
5036
|
flex-direction: column;
|
|
5036
5037
|
overscroll-behavior: contain;
|
|
5037
5038
|
}
|
|
5038
5039
|
|
|
5039
|
-
.
|
|
5040
|
+
._content_w1orl_80 {
|
|
5040
5041
|
padding: 0 var(--ezui-space-5);
|
|
5041
5042
|
position: relative;
|
|
5042
5043
|
}
|
|
5043
|
-
.
|
|
5044
|
+
._content_w1orl_80 [data-intercept] {
|
|
5044
5045
|
position: absolute;
|
|
5045
5046
|
left: 0;
|
|
5046
5047
|
width: 1px;
|
|
5047
5048
|
height: 1px;
|
|
5048
5049
|
}
|
|
5049
|
-
.
|
|
5050
|
+
._content_w1orl_80 [data-intercept="header"] {
|
|
5050
5051
|
top: 0;
|
|
5051
5052
|
}
|
|
5052
|
-
.
|
|
5053
|
+
._content_w1orl_80 [data-intercept="footer"] {
|
|
5053
5054
|
bottom: 0;
|
|
5054
5055
|
}
|
|
5055
5056
|
|
|
5056
|
-
.
|
|
5057
|
+
._footer_w1orl_97 {
|
|
5057
5058
|
display: flex;
|
|
5058
5059
|
flex-direction: column;
|
|
5059
5060
|
justify-content: flex-end;
|
|
@@ -5062,15 +5063,15 @@ textarea {
|
|
|
5062
5063
|
padding-top: var(--ezui-space-3);
|
|
5063
5064
|
}
|
|
5064
5065
|
@media (min-width: 30em) {
|
|
5065
|
-
.
|
|
5066
|
+
._footer_w1orl_97 {
|
|
5066
5067
|
flex-direction: row;
|
|
5067
5068
|
}
|
|
5068
5069
|
}
|
|
5069
|
-
.
|
|
5070
|
+
._footer_w1orl_97._stuck_w1orl_69 {
|
|
5070
5071
|
box-shadow: var(--ezui-shadow-stuck-from-bottom);
|
|
5071
5072
|
}
|
|
5072
5073
|
|
|
5073
|
-
.
|
|
5074
|
+
._closeBtn_w1orl_114 {
|
|
5074
5075
|
appearance: none;
|
|
5075
5076
|
margin: 0;
|
|
5076
5077
|
padding: 0;
|
|
@@ -5084,25 +5085,25 @@ textarea {
|
|
|
5084
5085
|
cursor: pointer;
|
|
5085
5086
|
}
|
|
5086
5087
|
|
|
5087
|
-
.
|
|
5088
|
+
._iconAtEnd_w1orl_128[data-size="2xl"] {
|
|
5088
5089
|
display: inline-flex;
|
|
5089
5090
|
margin-top: -5px;
|
|
5090
5091
|
margin-bottom: -5px;
|
|
5091
5092
|
}
|
|
5092
5093
|
|
|
5093
|
-
.
|
|
5094
|
+
._sizeSm_w1orl_134 {
|
|
5094
5095
|
--ezui-c-modal-max-width: 528px;
|
|
5095
5096
|
}
|
|
5096
5097
|
|
|
5097
|
-
.
|
|
5098
|
+
._sizeMd_w1orl_138 {
|
|
5098
5099
|
--ezui-c-modal-max-width: 672px;
|
|
5099
5100
|
}
|
|
5100
5101
|
|
|
5101
|
-
.
|
|
5102
|
+
._sizeLg_w1orl_142 {
|
|
5102
5103
|
--ezui-c-modal-max-width: 788px;
|
|
5103
5104
|
}
|
|
5104
5105
|
|
|
5105
|
-
.
|
|
5106
|
+
._sizeXl_w1orl_146 {
|
|
5106
5107
|
--ezui-c-modal-max-width: 1000px;
|
|
5107
5108
|
}/**
|
|
5108
5109
|
* Do not edit directly, this file was auto-generated.
|