@easypost/easy-ui 1.0.0-alpha.95 → 1.0.0-alpha.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/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 +54 -32
- package/Modal/index.mjs +55 -33
- package/package.json +1 -1
- package/style.css +27 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @easypost/easy-ui
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.97
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4aeb5f8: fix(Modal): nested modal unmount cleanup
|
|
8
|
+
|
|
9
|
+
## 1.0.0-alpha.96
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7670391: fix(Modal): hide parent of nested modal
|
|
14
|
+
|
|
3
15
|
## 1.0.0-alpha.95
|
|
4
16
|
|
|
5
17
|
### Patch 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,qBA2B3B"}
|
package/Modal/index.js
CHANGED
|
@@ -65,23 +65,53 @@ 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
|
+
return () => {
|
|
87
|
+
if (parentContext && parentContext.hasOpenNestedModal) {
|
|
88
|
+
parentContext.setHasOpenNestedModal(false);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}, [parentContext, state.isOpen]);
|
|
92
|
+
return React.createElement(ModalTriggerContext.Provider, {
|
|
93
|
+
value: context
|
|
94
|
+
}, children);
|
|
95
|
+
}
|
|
96
|
+
const underlayBg = "_underlayBg_w1orl_4";
|
|
97
|
+
const underlayBgHidden = "_underlayBgHidden_w1orl_27";
|
|
98
|
+
const underlayBox = "_underlayBox_w1orl_31";
|
|
99
|
+
const underlayEdge = "_underlayEdge_w1orl_39";
|
|
100
|
+
const Modal$1 = "_Modal_w1orl_45";
|
|
101
|
+
const header = "_header_w1orl_63";
|
|
102
|
+
const stuck = "_stuck_w1orl_69";
|
|
103
|
+
const body = "_body_w1orl_73";
|
|
104
|
+
const content = "_content_w1orl_80";
|
|
105
|
+
const footer = "_footer_w1orl_97";
|
|
106
|
+
const closeBtn = "_closeBtn_w1orl_114";
|
|
107
|
+
const iconAtEnd = "_iconAtEnd_w1orl_128";
|
|
108
|
+
const sizeSm = "_sizeSm_w1orl_134";
|
|
109
|
+
const sizeMd = "_sizeMd_w1orl_138";
|
|
110
|
+
const sizeLg = "_sizeLg_w1orl_142";
|
|
111
|
+
const sizeXl = "_sizeXl_w1orl_146";
|
|
83
112
|
const styles = {
|
|
84
113
|
underlayBg,
|
|
114
|
+
underlayBgHidden,
|
|
85
115
|
underlayBox,
|
|
86
116
|
underlayEdge,
|
|
87
117
|
Modal: Modal$1,
|
|
@@ -177,8 +207,10 @@ function ModalUnderlay(props) {
|
|
|
177
207
|
isDismissable,
|
|
178
208
|
isKeyboardDismissDisabled: !isDismissable
|
|
179
209
|
}), state, ref);
|
|
210
|
+
const { hasOpenNestedModal } = useModalTriggerContext();
|
|
211
|
+
const className = utilities_css.classNames(styles.underlayBg, hasOpenNestedModal && styles.underlayBgHidden);
|
|
180
212
|
return React.createElement(Overlay.$337b884510726a0d$export$c6fdb837b070b4ff, null, React.createElement("div", __spreadValues({
|
|
181
|
-
className
|
|
213
|
+
className
|
|
182
214
|
}, underlayProps), React.createElement("div", __spreadProps(__spreadValues({}, modalProps), {
|
|
183
215
|
ref,
|
|
184
216
|
className: styles.underlayBox
|
|
@@ -198,14 +230,9 @@ function ModalTrigger(props) {
|
|
|
198
230
|
throw new Error("children must be exactly one trigger element and one modal element");
|
|
199
231
|
}
|
|
200
232
|
const [trigger, modal] = children;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
isDismissable
|
|
205
|
-
};
|
|
206
|
-
}, [isDismissable, state]);
|
|
207
|
-
return React.createElement(ModalTriggerContext.Provider, {
|
|
208
|
-
value: context
|
|
233
|
+
return React.createElement(ModalTriggerProvider, {
|
|
234
|
+
state,
|
|
235
|
+
isDismissable
|
|
209
236
|
}, React.cloneElement(trigger, triggerProps), state.isOpen && React.createElement(ModalUnderlay, __spreadProps(__spreadValues({}, props), {
|
|
210
237
|
state
|
|
211
238
|
}), React.cloneElement(typeof modal === "function" ? modal(state.close) : modal, overlayProps)));
|
|
@@ -238,14 +265,9 @@ function ModalContainer(props) {
|
|
|
238
265
|
const { overlayProps } = useOverlayTrigger.$628037886ba31236$export$f9d5c8beee7d008d({
|
|
239
266
|
type: "dialog"
|
|
240
267
|
}, state);
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
isDismissable
|
|
245
|
-
};
|
|
246
|
-
}, [state, isDismissable]);
|
|
247
|
-
return React.createElement(ModalTriggerContext.Provider, {
|
|
248
|
-
value: context
|
|
268
|
+
return React.createElement(ModalTriggerProvider, {
|
|
269
|
+
state,
|
|
270
|
+
isDismissable
|
|
249
271
|
}, state.isOpen && React.createElement(ModalUnderlay, {
|
|
250
272
|
state,
|
|
251
273
|
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,53 @@ 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
|
+
return () => {
|
|
85
|
+
if (parentContext && parentContext.hasOpenNestedModal) {
|
|
86
|
+
parentContext.setHasOpenNestedModal(false);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}, [parentContext, state.isOpen]);
|
|
90
|
+
return React__default.createElement(ModalTriggerContext.Provider, {
|
|
91
|
+
value: context
|
|
92
|
+
}, children);
|
|
93
|
+
}
|
|
94
|
+
const underlayBg = "_underlayBg_w1orl_4";
|
|
95
|
+
const underlayBgHidden = "_underlayBgHidden_w1orl_27";
|
|
96
|
+
const underlayBox = "_underlayBox_w1orl_31";
|
|
97
|
+
const underlayEdge = "_underlayEdge_w1orl_39";
|
|
98
|
+
const Modal$1 = "_Modal_w1orl_45";
|
|
99
|
+
const header = "_header_w1orl_63";
|
|
100
|
+
const stuck = "_stuck_w1orl_69";
|
|
101
|
+
const body = "_body_w1orl_73";
|
|
102
|
+
const content = "_content_w1orl_80";
|
|
103
|
+
const footer = "_footer_w1orl_97";
|
|
104
|
+
const closeBtn = "_closeBtn_w1orl_114";
|
|
105
|
+
const iconAtEnd = "_iconAtEnd_w1orl_128";
|
|
106
|
+
const sizeSm = "_sizeSm_w1orl_134";
|
|
107
|
+
const sizeMd = "_sizeMd_w1orl_138";
|
|
108
|
+
const sizeLg = "_sizeLg_w1orl_142";
|
|
109
|
+
const sizeXl = "_sizeXl_w1orl_146";
|
|
81
110
|
const styles = {
|
|
82
111
|
underlayBg,
|
|
112
|
+
underlayBgHidden,
|
|
83
113
|
underlayBox,
|
|
84
114
|
underlayEdge,
|
|
85
115
|
Modal: Modal$1,
|
|
@@ -175,8 +205,10 @@ function ModalUnderlay(props) {
|
|
|
175
205
|
isDismissable,
|
|
176
206
|
isKeyboardDismissDisabled: !isDismissable
|
|
177
207
|
}), state, ref);
|
|
208
|
+
const { hasOpenNestedModal } = useModalTriggerContext();
|
|
209
|
+
const className = classNames(styles.underlayBg, hasOpenNestedModal && styles.underlayBgHidden);
|
|
178
210
|
return React__default.createElement($337b884510726a0d$export$c6fdb837b070b4ff, null, React__default.createElement("div", __spreadValues({
|
|
179
|
-
className
|
|
211
|
+
className
|
|
180
212
|
}, underlayProps), React__default.createElement("div", __spreadProps(__spreadValues({}, modalProps), {
|
|
181
213
|
ref,
|
|
182
214
|
className: styles.underlayBox
|
|
@@ -196,14 +228,9 @@ function ModalTrigger(props) {
|
|
|
196
228
|
throw new Error("children must be exactly one trigger element and one modal element");
|
|
197
229
|
}
|
|
198
230
|
const [trigger, modal] = children;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
isDismissable
|
|
203
|
-
};
|
|
204
|
-
}, [isDismissable, state]);
|
|
205
|
-
return React__default.createElement(ModalTriggerContext.Provider, {
|
|
206
|
-
value: context
|
|
231
|
+
return React__default.createElement(ModalTriggerProvider, {
|
|
232
|
+
state,
|
|
233
|
+
isDismissable
|
|
207
234
|
}, cloneElement(trigger, triggerProps), state.isOpen && React__default.createElement(ModalUnderlay, __spreadProps(__spreadValues({}, props), {
|
|
208
235
|
state
|
|
209
236
|
}), cloneElement(typeof modal === "function" ? modal(state.close) : modal, overlayProps)));
|
|
@@ -236,14 +263,9 @@ function ModalContainer(props) {
|
|
|
236
263
|
const { overlayProps } = $628037886ba31236$export$f9d5c8beee7d008d({
|
|
237
264
|
type: "dialog"
|
|
238
265
|
}, state);
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
isDismissable
|
|
243
|
-
};
|
|
244
|
-
}, [state, isDismissable]);
|
|
245
|
-
return React__default.createElement(ModalTriggerContext.Provider, {
|
|
246
|
-
value: context
|
|
266
|
+
return React__default.createElement(ModalTriggerProvider, {
|
|
267
|
+
state,
|
|
268
|
+
isDismissable
|
|
247
269
|
}, state.isOpen && React__default.createElement(ModalUnderlay, {
|
|
248
270
|
state,
|
|
249
271
|
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,22 +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
4978
|
|
|
4979
|
-
.
|
|
4980
|
-
.
|
|
4979
|
+
._underlayBg_w1orl_4,
|
|
4980
|
+
._underlayBg_w1orl_4::before {
|
|
4981
4981
|
top: 0;
|
|
4982
4982
|
left: 0;
|
|
4983
4983
|
right: 0;
|
|
4984
4984
|
bottom: 0;
|
|
4985
4985
|
}
|
|
4986
4986
|
|
|
4987
|
-
.
|
|
4987
|
+
._underlayBgHidden_w1orl_27 {
|
|
4988
|
+
display: none;
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
._underlayBox_w1orl_31 {
|
|
4988
4992
|
position: relative;
|
|
4989
4993
|
display: flex;
|
|
4990
4994
|
flex-direction: column;
|
|
@@ -4992,13 +4996,13 @@ textarea {
|
|
|
4992
4996
|
pointer-events: none;
|
|
4993
4997
|
}
|
|
4994
4998
|
|
|
4995
|
-
.
|
|
4999
|
+
._underlayEdge_w1orl_39 {
|
|
4996
5000
|
flex: 0 9 auto;
|
|
4997
5001
|
height: var(--ezui-c-modal-underlay-edge-max-height);
|
|
4998
5002
|
min-height: var(--ezui-c-modal-underlay-edge-min-height);
|
|
4999
5003
|
}
|
|
5000
5004
|
|
|
5001
|
-
.
|
|
5005
|
+
._Modal_w1orl_45 {
|
|
5002
5006
|
--ezui-c-modal-max-height: 762px;
|
|
5003
5007
|
--ezui-c-modal-width: 95vw;
|
|
5004
5008
|
flex: 0 1 auto;
|
|
@@ -5016,41 +5020,41 @@ textarea {
|
|
|
5016
5020
|
outline: none;
|
|
5017
5021
|
}
|
|
5018
5022
|
|
|
5019
|
-
.
|
|
5023
|
+
._header_w1orl_63 {
|
|
5020
5024
|
margin: 0;
|
|
5021
5025
|
padding: var(--ezui-space-5);
|
|
5022
5026
|
padding-bottom: var(--ezui-space-2);
|
|
5023
5027
|
color: var(--ezui-color-primary-800);
|
|
5024
5028
|
}
|
|
5025
|
-
.
|
|
5029
|
+
._header_w1orl_63._stuck_w1orl_69 {
|
|
5026
5030
|
box-shadow: var(--ezui-shadow-stuck-from-top);
|
|
5027
5031
|
}
|
|
5028
5032
|
|
|
5029
|
-
.
|
|
5033
|
+
._body_w1orl_73 {
|
|
5030
5034
|
overflow: auto;
|
|
5031
5035
|
display: flex;
|
|
5032
5036
|
flex-direction: column;
|
|
5033
5037
|
overscroll-behavior: contain;
|
|
5034
5038
|
}
|
|
5035
5039
|
|
|
5036
|
-
.
|
|
5040
|
+
._content_w1orl_80 {
|
|
5037
5041
|
padding: 0 var(--ezui-space-5);
|
|
5038
5042
|
position: relative;
|
|
5039
5043
|
}
|
|
5040
|
-
.
|
|
5044
|
+
._content_w1orl_80 [data-intercept] {
|
|
5041
5045
|
position: absolute;
|
|
5042
5046
|
left: 0;
|
|
5043
5047
|
width: 1px;
|
|
5044
5048
|
height: 1px;
|
|
5045
5049
|
}
|
|
5046
|
-
.
|
|
5050
|
+
._content_w1orl_80 [data-intercept="header"] {
|
|
5047
5051
|
top: 0;
|
|
5048
5052
|
}
|
|
5049
|
-
.
|
|
5053
|
+
._content_w1orl_80 [data-intercept="footer"] {
|
|
5050
5054
|
bottom: 0;
|
|
5051
5055
|
}
|
|
5052
5056
|
|
|
5053
|
-
.
|
|
5057
|
+
._footer_w1orl_97 {
|
|
5054
5058
|
display: flex;
|
|
5055
5059
|
flex-direction: column;
|
|
5056
5060
|
justify-content: flex-end;
|
|
@@ -5059,15 +5063,15 @@ textarea {
|
|
|
5059
5063
|
padding-top: var(--ezui-space-3);
|
|
5060
5064
|
}
|
|
5061
5065
|
@media (min-width: 30em) {
|
|
5062
|
-
.
|
|
5066
|
+
._footer_w1orl_97 {
|
|
5063
5067
|
flex-direction: row;
|
|
5064
5068
|
}
|
|
5065
5069
|
}
|
|
5066
|
-
.
|
|
5070
|
+
._footer_w1orl_97._stuck_w1orl_69 {
|
|
5067
5071
|
box-shadow: var(--ezui-shadow-stuck-from-bottom);
|
|
5068
5072
|
}
|
|
5069
5073
|
|
|
5070
|
-
.
|
|
5074
|
+
._closeBtn_w1orl_114 {
|
|
5071
5075
|
appearance: none;
|
|
5072
5076
|
margin: 0;
|
|
5073
5077
|
padding: 0;
|
|
@@ -5081,25 +5085,25 @@ textarea {
|
|
|
5081
5085
|
cursor: pointer;
|
|
5082
5086
|
}
|
|
5083
5087
|
|
|
5084
|
-
.
|
|
5088
|
+
._iconAtEnd_w1orl_128[data-size="2xl"] {
|
|
5085
5089
|
display: inline-flex;
|
|
5086
5090
|
margin-top: -5px;
|
|
5087
5091
|
margin-bottom: -5px;
|
|
5088
5092
|
}
|
|
5089
5093
|
|
|
5090
|
-
.
|
|
5094
|
+
._sizeSm_w1orl_134 {
|
|
5091
5095
|
--ezui-c-modal-max-width: 528px;
|
|
5092
5096
|
}
|
|
5093
5097
|
|
|
5094
|
-
.
|
|
5098
|
+
._sizeMd_w1orl_138 {
|
|
5095
5099
|
--ezui-c-modal-max-width: 672px;
|
|
5096
5100
|
}
|
|
5097
5101
|
|
|
5098
|
-
.
|
|
5102
|
+
._sizeLg_w1orl_142 {
|
|
5099
5103
|
--ezui-c-modal-max-width: 788px;
|
|
5100
5104
|
}
|
|
5101
5105
|
|
|
5102
|
-
.
|
|
5106
|
+
._sizeXl_w1orl_146 {
|
|
5103
5107
|
--ezui-c-modal-max-width: 1000px;
|
|
5104
5108
|
}/**
|
|
5105
5109
|
* Do not edit directly, this file was auto-generated.
|