@easypost/easy-ui 1.0.0-alpha.120 → 1.0.0-alpha.121

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.121
4
+
5
+ ### Minor Changes
6
+
7
+ - e47ec8f: Add `allowsThirdPartyOverlays` to `Modal.Trigger` and `ModalContainer`. When enabled, the modal stops trapping focus and stops applying `aria-hidden`/`inert` to the rest of the page, so third-party overlays that render outside the modal (e.g. Stripe Link/autofill, reCAPTCHA) remain focusable and clickable instead of locking up.
8
+
3
9
  ## 1.0.0-alpha.120
4
10
 
5
11
  ### Patch Changes
@@ -8,6 +8,14 @@ type ModalContainerProps = {
8
8
  * Whether or not the modal is dismissable.
9
9
  */
10
10
  isDismissable?: boolean;
11
+ /**
12
+ * Disables focus trapping and background aria-hiding so the modal can host
13
+ * third-party overlays (e.g. Stripe Link/autofill, reCAPTCHA) that render
14
+ * outside the modal. Use sparingly — see `ModalUnderlay` for the tradeoffs.
15
+ *
16
+ * @default false
17
+ */
18
+ allowsThirdPartyOverlays?: boolean;
11
19
  /**
12
20
  * Handler that is called when the overlay is closed.
13
21
  */
@@ -1 +1 @@
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
+ {"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;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAmDxD"}
@@ -11,8 +11,18 @@ export type ModalTriggerProps = {
11
11
  defaultOpen?: boolean;
12
12
  /**
13
13
  * Whether or not the modal can be dismissed.
14
+ *
15
+ * @default true
14
16
  */
15
17
  isDismissable?: boolean;
18
+ /**
19
+ * Disables focus trapping and background aria-hiding so the modal can host
20
+ * third-party overlays (e.g. Stripe Link/autofill, reCAPTCHA) that render
21
+ * outside the modal. Use sparingly — see `ModalUnderlay` for the tradeoffs.
22
+ *
23
+ * @default false
24
+ */
25
+ allowsThirdPartyOverlays?: boolean;
16
26
  /**
17
27
  * Whether the modal is open by default (controlled).
18
28
  */
@@ -1 +1 @@
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
+ {"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;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;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"}
@@ -13,6 +13,19 @@ type ModalUnderlayProps = {
13
13
  * Whether or not the modal is dismissable.
14
14
  */
15
15
  isDismissable?: boolean;
16
+ /**
17
+ * When `true`, the modal stops trapping focus and stops hiding the rest of
18
+ * the page from assistive technologies (`aria-hidden`/`inert`). Use this only
19
+ * for modals that intentionally host third-party overlays — e.g. Stripe
20
+ * Link/autofill or reCAPTCHA — which render themselves into the document
21
+ * *outside* the modal. react-aria's focus trap and `inert` would otherwise
22
+ * blur and lock up those overlays. This trades away the modal's focus
23
+ * containment and background hiding, so reach for it only when a third-party
24
+ * overlay requires it.
25
+ *
26
+ * @default false
27
+ */
28
+ allowsThirdPartyOverlays?: boolean;
16
29
  };
17
30
  export declare function ModalUnderlay(props: ModalUnderlayProps): React.JSX.Element;
18
31
  export {};
@@ -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;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
+ {"version":3,"file":"ModalUnderlay.d.ts","sourceRoot":"","sources":["../../src/Modal/ModalUnderlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAQ5D,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;IAExB;;;;;;;;;;;OAWG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AASF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAOtD"}
package/Modal/index.js CHANGED
@@ -41,6 +41,7 @@ const HorizontalStack = require("../__chunks__/HorizontalStack-CWdKKY8L.js");
41
41
  const Icon = require("../__chunks__/Icon-BRlbo3RF.js");
42
42
  const Text = require("../__chunks__/Text-DkzMEqky.js");
43
43
  const VerticalStack = require("../__chunks__/VerticalStack-BHkiocKU.js");
44
+ const ariaHideOutside = require("../__chunks__/ariaHideOutside-Dl8SH3FU.js");
44
45
  const useModalOverlay = require("../__chunks__/useModalOverlay-C4Gci3MA.js");
45
46
  const Overlay = require("../__chunks__/Overlay-BNP_t3v4.js");
46
47
  const useOverlayTrigger = require("../__chunks__/useOverlayTrigger-DP9RbCAF.js");
@@ -216,13 +217,42 @@ function ModalHeader(props) {
216
217
  });
217
218
  }
218
219
  function ModalUnderlay(props) {
219
- const _a = props, { state, children } = _a, overlayProps = __objRest(_a, ["state", "children"]);
220
- const { isDismissable = true } = overlayProps;
220
+ return props.allowsThirdPartyOverlays ? jsxRuntime.jsx(ThirdPartyOverlayUnderlay, __spreadValues({}, props)) : jsxRuntime.jsx(FocusTrappingUnderlay, __spreadValues({}, props));
221
+ }
222
+ function FocusTrappingUnderlay(props) {
223
+ const { state, children, isDismissable = true } = props;
221
224
  const ref = React.useRef(null);
222
- const { modalProps, underlayProps } = useModalOverlay.$8ac8429251c45e4b$export$dbc0f175b25fb0fb(__spreadProps(__spreadValues({}, overlayProps), {
225
+ const { modalProps, underlayProps } = useModalOverlay.$8ac8429251c45e4b$export$dbc0f175b25fb0fb({
223
226
  isDismissable,
224
227
  isKeyboardDismissDisabled: !isDismissable
225
- }), state, ref);
228
+ }, state, ref);
229
+ return jsxRuntime.jsx(ModalUnderlayContent, {
230
+ modalProps,
231
+ underlayProps,
232
+ modalRef: ref,
233
+ children
234
+ });
235
+ }
236
+ function ThirdPartyOverlayUnderlay(props) {
237
+ const { state, children, isDismissable = true } = props;
238
+ const ref = React.useRef(null);
239
+ const { overlayProps, underlayProps } = ariaHideOutside.$a11501f3d1d39e6c$export$ea8f71083e90600f({
240
+ isOpen: state.isOpen,
241
+ onClose: state.close,
242
+ isDismissable,
243
+ isKeyboardDismissDisabled: !isDismissable
244
+ }, ref);
245
+ ariaHideOutside.$49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
246
+ isDisabled: !state.isOpen
247
+ });
248
+ return jsxRuntime.jsx(ModalUnderlayContent, {
249
+ modalProps: overlayProps,
250
+ underlayProps,
251
+ modalRef: ref,
252
+ children
253
+ });
254
+ }
255
+ function ModalUnderlayContent({ modalProps, underlayProps, modalRef, children }) {
226
256
  const { hasOpenNestedModal } = useModalTriggerContext();
227
257
  const className = utilities_css.classNames(styles.underlayBg, hasOpenNestedModal && styles.underlayBgHidden);
228
258
  return jsxRuntime.jsx(Overlay.$337b884510726a0d$export$c6fdb837b070b4ff, {
@@ -230,7 +260,7 @@ function ModalUnderlay(props) {
230
260
  className
231
261
  }, underlayProps), {
232
262
  children: jsxRuntime.jsxs("div", __spreadProps(__spreadValues({}, modalProps), {
233
- ref,
263
+ ref: modalRef,
234
264
  className: styles.underlayBox,
235
265
  children: [jsxRuntime.jsx("div", {
236
266
  className: styles.underlayEdge
@@ -261,7 +291,7 @@ function ModalTrigger(props) {
261
291
  });
262
292
  }
263
293
  function ModalContainer(props) {
264
- const { children, isDismissable = true, onDismiss = () => {
294
+ const { children, isDismissable = true, allowsThirdPartyOverlays = false, onDismiss = () => {
265
295
  } } = props;
266
296
  const childArray = React.Children.toArray(children);
267
297
  if (childArray.length > 1) {
@@ -294,6 +324,7 @@ function ModalContainer(props) {
294
324
  children: state.isOpen && jsxRuntime.jsx(ModalUnderlay, {
295
325
  state,
296
326
  isDismissable,
327
+ allowsThirdPartyOverlays,
297
328
  children: lastChild ? React.cloneElement(lastChild, overlayProps) : null
298
329
  })
299
330
  });
package/Modal/index.mjs CHANGED
@@ -30,7 +30,7 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
  import { jsx, jsxs } from "react/jsx-runtime";
33
- import React__default, { createContext, useState, useMemo, useContext, cloneElement, useRef } from "react";
33
+ import React__default, { createContext, useState, useMemo, useContext, useRef, cloneElement } from "react";
34
34
  import { classNames, variationName } from "../utilities/css.mjs";
35
35
  import { useScrollbar } from "../utilities/useScrollbar.mjs";
36
36
  import { B as Button } from "../__chunks__/Button-JL1YQxJ5.mjs";
@@ -39,6 +39,7 @@ import { H as HorizontalStack } from "../__chunks__/HorizontalStack-CJavrBHm.mjs
39
39
  import { I as Icon } from "../__chunks__/Icon-BIpaQJ_I.mjs";
40
40
  import { T as Text } from "../__chunks__/Text-D6oT5WJQ.mjs";
41
41
  import { V as VerticalStack } from "../__chunks__/VerticalStack-DoMqBfYD.mjs";
42
+ import { $ as $a11501f3d1d39e6c$export$ea8f71083e90600f, a as $49c51c25361d4cd2$export$ee0f7cc6afcd1c18 } from "../__chunks__/ariaHideOutside-BYq9cUwo.mjs";
42
43
  import { $ as $8ac8429251c45e4b$export$dbc0f175b25fb0fb } from "../__chunks__/useModalOverlay-BmYXH7rq.mjs";
43
44
  import { d as $337b884510726a0d$export$c6fdb837b070b4ff, a as $fc909762b330b746$export$61c6a8c84e605fb6 } from "../__chunks__/Overlay-Dkjxuk6V.mjs";
44
45
  import { $ as $628037886ba31236$export$f9d5c8beee7d008d } from "../__chunks__/useOverlayTrigger-CIVwezu3.mjs";
@@ -214,13 +215,42 @@ function ModalHeader(props) {
214
215
  });
215
216
  }
216
217
  function ModalUnderlay(props) {
217
- const _a = props, { state, children } = _a, overlayProps = __objRest(_a, ["state", "children"]);
218
- const { isDismissable = true } = overlayProps;
219
- const ref = React__default.useRef(null);
220
- const { modalProps, underlayProps } = $8ac8429251c45e4b$export$dbc0f175b25fb0fb(__spreadProps(__spreadValues({}, overlayProps), {
218
+ return props.allowsThirdPartyOverlays ? jsx(ThirdPartyOverlayUnderlay, __spreadValues({}, props)) : jsx(FocusTrappingUnderlay, __spreadValues({}, props));
219
+ }
220
+ function FocusTrappingUnderlay(props) {
221
+ const { state, children, isDismissable = true } = props;
222
+ const ref = useRef(null);
223
+ const { modalProps, underlayProps } = $8ac8429251c45e4b$export$dbc0f175b25fb0fb({
224
+ isDismissable,
225
+ isKeyboardDismissDisabled: !isDismissable
226
+ }, state, ref);
227
+ return jsx(ModalUnderlayContent, {
228
+ modalProps,
229
+ underlayProps,
230
+ modalRef: ref,
231
+ children
232
+ });
233
+ }
234
+ function ThirdPartyOverlayUnderlay(props) {
235
+ const { state, children, isDismissable = true } = props;
236
+ const ref = useRef(null);
237
+ const { overlayProps, underlayProps } = $a11501f3d1d39e6c$export$ea8f71083e90600f({
238
+ isOpen: state.isOpen,
239
+ onClose: state.close,
221
240
  isDismissable,
222
241
  isKeyboardDismissDisabled: !isDismissable
223
- }), state, ref);
242
+ }, ref);
243
+ $49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
244
+ isDisabled: !state.isOpen
245
+ });
246
+ return jsx(ModalUnderlayContent, {
247
+ modalProps: overlayProps,
248
+ underlayProps,
249
+ modalRef: ref,
250
+ children
251
+ });
252
+ }
253
+ function ModalUnderlayContent({ modalProps, underlayProps, modalRef, children }) {
224
254
  const { hasOpenNestedModal } = useModalTriggerContext();
225
255
  const className = classNames(styles.underlayBg, hasOpenNestedModal && styles.underlayBgHidden);
226
256
  return jsx($337b884510726a0d$export$c6fdb837b070b4ff, {
@@ -228,7 +258,7 @@ function ModalUnderlay(props) {
228
258
  className
229
259
  }, underlayProps), {
230
260
  children: jsxs("div", __spreadProps(__spreadValues({}, modalProps), {
231
- ref,
261
+ ref: modalRef,
232
262
  className: styles.underlayBox,
233
263
  children: [jsx("div", {
234
264
  className: styles.underlayEdge
@@ -259,7 +289,7 @@ function ModalTrigger(props) {
259
289
  });
260
290
  }
261
291
  function ModalContainer(props) {
262
- const { children, isDismissable = true, onDismiss = () => {
292
+ const { children, isDismissable = true, allowsThirdPartyOverlays = false, onDismiss = () => {
263
293
  } } = props;
264
294
  const childArray = React__default.Children.toArray(children);
265
295
  if (childArray.length > 1) {
@@ -292,6 +322,7 @@ function ModalContainer(props) {
292
322
  children: state.isOpen && jsx(ModalUnderlay, {
293
323
  state,
294
324
  isDismissable,
325
+ allowsThirdPartyOverlays,
295
326
  children: lastChild ? cloneElement(lastChild, overlayProps) : null
296
327
  })
297
328
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easypost/easy-ui",
3
- "version": "1.0.0-alpha.120",
3
+ "version": "1.0.0-alpha.121",
4
4
  "sideEffects": [
5
5
  "**/*.css"
6
6
  ],