@easypost/easy-ui 1.0.0-alpha.95 → 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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 1.0.0-alpha.95
4
10
 
5
11
  ### Patch Changes
@@ -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;AAI9C,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"}
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,EAEZ,SAAS,EAIV,MAAM,OAAO,CAAC;AAMf,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,qBA8CxD"}
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"}
@@ -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: string;
13
+ children: ReactNode;
14
14
  /**
15
15
  * The content for the subtitle of the modal.
16
16
  */
17
- subtitle?: string;
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;AAK1B,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAMtC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG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AAgB,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,EAAyB,MAAM,OAAO,CAAC;AAMnE,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,qBAkCpD"}
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;AAIpD,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,qBA0BtD"}
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"}
@@ -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 declare const ModalContext: import("react").Context<ModalContextType | null>;
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: import("react").Context<ModalTriggerContextType | null>;
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
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/Modal/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAC5E,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,mBAA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AAY,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
- const underlayBg = "_underlayBg_12m01_4";
69
- const underlayBox = "_underlayBox_12m01_27";
70
- const underlayEdge = "_underlayEdge_12m01_35";
71
- const Modal$1 = "_Modal_12m01_41";
72
- const header = "_header_12m01_59";
73
- const stuck = "_stuck_12m01_65";
74
- const body = "_body_12m01_69";
75
- const content = "_content_12m01_76";
76
- const footer = "_footer_12m01_93";
77
- const closeBtn = "_closeBtn_12m01_110";
78
- const iconAtEnd = "_iconAtEnd_12m01_124";
79
- const sizeSm = "_sizeSm_12m01_130";
80
- const sizeMd = "_sizeMd_12m01_134";
81
- const sizeLg = "_sizeLg_12m01_138";
82
- const sizeXl = "_sizeXl_12m01_142";
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: styles.underlayBg
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
- const context = React.useMemo(() => {
202
- return {
203
- state,
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
- const context = React.useMemo(() => {
242
- return {
243
- state,
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, cloneElement, useState, useRef } from "react";
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
- const underlayBg = "_underlayBg_12m01_4";
67
- const underlayBox = "_underlayBox_12m01_27";
68
- const underlayEdge = "_underlayEdge_12m01_35";
69
- const Modal$1 = "_Modal_12m01_41";
70
- const header = "_header_12m01_59";
71
- const stuck = "_stuck_12m01_65";
72
- const body = "_body_12m01_69";
73
- const content = "_content_12m01_76";
74
- const footer = "_footer_12m01_93";
75
- const closeBtn = "_closeBtn_12m01_110";
76
- const iconAtEnd = "_iconAtEnd_12m01_124";
77
- const sizeSm = "_sizeSm_12m01_130";
78
- const sizeMd = "_sizeMd_12m01_134";
79
- const sizeLg = "_sizeLg_12m01_138";
80
- const sizeXl = "_sizeXl_12m01_142";
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: styles.underlayBg
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
- const context = useMemo(() => {
200
- return {
201
- state,
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
- const context = useMemo(() => {
240
- return {
241
- state,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easypost/easy-ui",
3
- "version": "1.0.0-alpha.95",
3
+ "version": "1.0.0-alpha.96",
4
4
  "sideEffects": [
5
5
  "**/*.css"
6
6
  ],
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
- ._underlayBg_12m01_4 {
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
- ._underlayBg_12m01_4::before {
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
- ._underlayBg_12m01_4,
4980
- ._underlayBg_12m01_4::before {
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
- ._underlayBox_12m01_27 {
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
- ._underlayEdge_12m01_35 {
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
- ._Modal_12m01_41 {
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
- ._header_12m01_59 {
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
- ._header_12m01_59._stuck_12m01_65 {
5029
+ ._header_w1orl_63._stuck_w1orl_69 {
5026
5030
  box-shadow: var(--ezui-shadow-stuck-from-top);
5027
5031
  }
5028
5032
 
5029
- ._body_12m01_69 {
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
- ._content_12m01_76 {
5040
+ ._content_w1orl_80 {
5037
5041
  padding: 0 var(--ezui-space-5);
5038
5042
  position: relative;
5039
5043
  }
5040
- ._content_12m01_76 [data-intercept] {
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
- ._content_12m01_76 [data-intercept="header"] {
5050
+ ._content_w1orl_80 [data-intercept="header"] {
5047
5051
  top: 0;
5048
5052
  }
5049
- ._content_12m01_76 [data-intercept="footer"] {
5053
+ ._content_w1orl_80 [data-intercept="footer"] {
5050
5054
  bottom: 0;
5051
5055
  }
5052
5056
 
5053
- ._footer_12m01_93 {
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
- ._footer_12m01_93 {
5066
+ ._footer_w1orl_97 {
5063
5067
  flex-direction: row;
5064
5068
  }
5065
5069
  }
5066
- ._footer_12m01_93._stuck_12m01_65 {
5070
+ ._footer_w1orl_97._stuck_w1orl_69 {
5067
5071
  box-shadow: var(--ezui-shadow-stuck-from-bottom);
5068
5072
  }
5069
5073
 
5070
- ._closeBtn_12m01_110 {
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
- ._iconAtEnd_12m01_124[data-size="2xl"] {
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
- ._sizeSm_12m01_130 {
5094
+ ._sizeSm_w1orl_134 {
5091
5095
  --ezui-c-modal-max-width: 528px;
5092
5096
  }
5093
5097
 
5094
- ._sizeMd_12m01_134 {
5098
+ ._sizeMd_w1orl_138 {
5095
5099
  --ezui-c-modal-max-width: 672px;
5096
5100
  }
5097
5101
 
5098
- ._sizeLg_12m01_138 {
5102
+ ._sizeLg_w1orl_142 {
5099
5103
  --ezui-c-modal-max-width: 788px;
5100
5104
  }
5101
5105
 
5102
- ._sizeXl_12m01_142 {
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.