@viasat/beam-react 2.16.0 → 2.18.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("clsx"),m=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const p=require("./Panel.context.cjs.js"),q=require("../../FloatingUI/FloatingUI.root.cjs.js"),x=require("../../FloatingUI/FloatingUI.content.cjs.js"),P=require("./Panel.Inline.cjs.js"),i=require("../../../chunks/panel.module.BX1x4FlX.js"),{baseClassNamePrefix:t}=m.getBEMClassNames("panel"),b=({contextValue:r,panelClassName:a,resolvedPosition:l,showDivider:n,modalType:s,open:o,onOpenChange:c,transitionConfig:u,children:_,...d})=>{const g=s==="alert"?{escapeKey:!1,outsidePress:!1}:void 0,v=y(i.styles[`${t}__overlay-divider`],i.styles[`${t}__overlay-divider--${l}`]);return e.jsx(p.PanelContext.Provider,{value:r,children:e.jsx(q.FloatingUIRoot,{open:o,onOpenChange:c,portalled:!0,transitionConfig:u,dismiss:g,children:e.jsxs(x.Content,{className:a,skipFloatingStyles:!0,overlay:!0,...d,role:s==="alert"?"alertdialog":"dialog","data-position":l,children:[_,n&&e.jsx(P.InlineDivider,{position:l,className:v})]})})})};exports.OverlayPanel=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),m=require("clsx"),x=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const b=require("./Panel.context.cjs.js"),p=require("./Panel.helpers.cjs.js"),y=require("../../FloatingUI/FloatingUI.root.cjs.js"),C=require("../../FloatingUI/FloatingUI.content.cjs.js"),I=require("./Panel.Inline.cjs.js"),n=require("../../../chunks/panel.module.BX1x4FlX.js"),{baseClassNamePrefix:t}=x.getBEMClassNames("panel"),f=({contextValue:r,panelClassName:a,resolvedPosition:l,showDivider:o,modalType:e,closeOnOutsidePress:c,open:_,onOpenChange:u,transitionConfig:d,children:g,...v})=>{const s=e==="isModal"||e==="alert",P=p.getPanelDismissConfig(e,c),q=m(n.styles[`${t}__overlay-divider`],n.styles[`${t}__overlay-divider--${l}`]);return i.jsx(b.PanelContext.Provider,{value:r,children:i.jsx(y.FloatingUIRoot,{open:_,onOpenChange:u,portalled:!0,transitionConfig:d,dismiss:P,focusConfiguration:s||void 0,children:i.jsxs(C.Content,{className:a,skipFloatingStyles:!0,overlay:s,...v,role:e==="alert"?"alertdialog":"dialog","data-position":l,children:[g,o&&i.jsx(I.InlineDivider,{position:l,className:q})]})})})};exports.OverlayPanel=f;
@@ -8,10 +8,11 @@ type OverlayPanelProps = {
8
8
  resolvedPosition: PanelPosition;
9
9
  showDivider: boolean;
10
10
  modalType?: PanelModalType;
11
+ closeOnOutsidePress?: boolean;
11
12
  open?: boolean;
12
13
  onOpenChange?: FloatingUIProps['onOpenChange'];
13
14
  transitionConfig: UseTransitionStylesProps;
14
15
  children: React.ReactNode;
15
16
  } & React.ComponentPropsWithoutRef<'aside'>;
16
- export declare const OverlayPanel: ({ contextValue, panelClassName, resolvedPosition, showDivider, modalType, open, onOpenChange, transitionConfig, children, ...props }: OverlayPanelProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const OverlayPanel: ({ contextValue, panelClassName, resolvedPosition, showDivider, modalType, closeOnOutsidePress, open, onOpenChange, transitionConfig, children, ...props }: OverlayPanelProps) => import("react/jsx-runtime").JSX.Element;
17
18
  export {};
@@ -1,48 +1,51 @@
1
- import { jsx as r, jsxs as g } from "react/jsx-runtime";
2
- import y from "clsx";
3
- import { g as u } from "../../../chunks/classNames.BTJmrO_L.js";
1
+ import { jsx as r, jsxs as u } from "react/jsx-runtime";
2
+ import x from "clsx";
3
+ import { g as N } from "../../../chunks/classNames.BTJmrO_L.js";
4
4
  import "../../../chunks/constants.CKKGf1-i.js";
5
- import { PanelContext as x } from "./Panel.context.es.js";
6
- import { FloatingUIRoot as C } from "../../FloatingUI/FloatingUI.root.es.js";
7
- import { Content as N } from "../../FloatingUI/FloatingUI.content.es.js";
8
- import { InlineDivider as _ } from "./Panel.Inline.es.js";
9
- import { s } from "../../../chunks/panel.module.BVm3KvDs.js";
10
- const { baseClassNamePrefix: i } = u("panel"), B = ({
5
+ import { PanelContext as y } from "./Panel.context.es.js";
6
+ import { getPanelDismissConfig as _ } from "./Panel.helpers.es.js";
7
+ import { FloatingUIRoot as h } from "../../FloatingUI/FloatingUI.root.es.js";
8
+ import { Content as D } from "../../FloatingUI/FloatingUI.content.es.js";
9
+ import { InlineDivider as P } from "./Panel.Inline.es.js";
10
+ import { s as t } from "../../../chunks/panel.module.BVm3KvDs.js";
11
+ const { baseClassNamePrefix: e } = N("panel"), R = ({
11
12
  contextValue: a,
12
- panelClassName: t,
13
- resolvedPosition: e,
14
- showDivider: l,
15
- modalType: o,
16
- open: m,
17
- onOpenChange: n,
13
+ panelClassName: l,
14
+ resolvedPosition: o,
15
+ showDivider: n,
16
+ modalType: i,
17
+ closeOnOutsidePress: m,
18
+ open: f,
19
+ onOpenChange: c,
18
20
  transitionConfig: d,
19
21
  children: p,
20
- ...f
22
+ ...g
21
23
  }) => {
22
- const c = o === "alert" ? { escapeKey: !1, outsidePress: !1 } : void 0, v = y(
23
- s[`${i}__overlay-divider`],
24
- s[`${i}__overlay-divider--${e}`]
24
+ const s = i === "isModal" || i === "alert", v = _(i, m), C = x(
25
+ t[`${e}__overlay-divider`],
26
+ t[`${e}__overlay-divider--${o}`]
25
27
  );
26
- return /* @__PURE__ */ r(x.Provider, { value: a, children: /* @__PURE__ */ r(
27
- C,
28
+ return /* @__PURE__ */ r(y.Provider, { value: a, children: /* @__PURE__ */ r(
29
+ h,
28
30
  {
29
- open: m,
30
- onOpenChange: n,
31
+ open: f,
32
+ onOpenChange: c,
31
33
  portalled: !0,
32
34
  transitionConfig: d,
33
- dismiss: c,
34
- children: /* @__PURE__ */ g(
35
- N,
35
+ dismiss: v,
36
+ focusConfiguration: s || void 0,
37
+ children: /* @__PURE__ */ u(
38
+ D,
36
39
  {
37
- className: t,
40
+ className: l,
38
41
  skipFloatingStyles: !0,
39
- overlay: !0,
40
- ...f,
41
- role: o === "alert" ? "alertdialog" : "dialog",
42
- "data-position": e,
42
+ overlay: s,
43
+ ...g,
44
+ role: i === "alert" ? "alertdialog" : "dialog",
45
+ "data-position": o,
43
46
  children: [
44
47
  p,
45
- l && /* @__PURE__ */ r(_, { position: e, className: v })
48
+ n && /* @__PURE__ */ r(P, { position: o, className: C })
46
49
  ]
47
50
  }
48
51
  )
@@ -50,5 +53,5 @@ const { baseClassNamePrefix: i } = u("panel"), B = ({
50
53
  ) });
51
54
  };
52
55
  export {
53
- B as OverlayPanel
56
+ R as OverlayPanel
54
57
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),b=require("clsx"),C=require("react"),j=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const B=require("./Panel.Header.cjs.js"),E=require("./Panel.Body.cjs.js"),T=require("./Panel.Footer.cjs.js"),r=require("./Panel.helpers.cjs.js"),F=require("./Panel.Inline.cjs.js"),H=require("./Panel.Overlay.cjs.js"),e=require("../../../chunks/panel.module.BX1x4FlX.js"),{baseClassNamePrefix:s}=j.getBEMClassNames("panel"),n=({children:o,className:f,padding:g="md",onOpenChange:$,open:_,size:a,dismissible:c=!0,closeButtonAriaLabel:u="Close panel",kind:d="inline",position:i,divider:O=!0,isAnimated:P=!0,onBeforeClose:h,modalType:t,...p})=>{process.env.NODE_ENV!=="production"&&t==="alert"&&c&&console.warn('Panel: `dismissible` is ignored when `modalType="alert"`. The close button is always hidden.');const y=t==="alert"?!1:c,l=r.getResolvedPanelPosition(i),m=b(e.styles[s],e.styles[`${s}--${d}`],a&&e.styles[`${s}--size-${a}`],e.styles[`${s}--padding-${g}`],e.styles[`${s}--position-${l}`],f),x=b(e.styles[`${s}__inline-wrapper`],a==="full"&&e.styles[`${s}__inline-wrapper--full`]),{requestClose:N,handleOverlayOpenChange:I}=r.usePanelClose(h,$),q=C.useMemo(()=>({dismissible:y,closeButtonAriaLabel:u,position:i,requestClose:N}),[y,u,i,N]),{showDivider:D,dividerBefore:M,dividerInner:R,dividerAfter:S}=r.getPanelDividerState(O,l),v=C.useMemo(()=>({duration:P?r.PANEL_TRANSITION_DURATION_MS:0}),[P]);return d==="inline"?w.jsx(F.InlinePanel,{contextValue:q,panelClassName:m,inlineWrapperClassName:x,resolvedPosition:l,dividerBefore:M,dividerInner:R,dividerAfter:S,open:_,transitionConfig:v,...p,children:o}):w.jsx(H.OverlayPanel,{contextValue:q,panelClassName:m,resolvedPosition:l,showDivider:D,modalType:t,open:_,onOpenChange:I,transitionConfig:v,...p,children:o})};n.displayName="Panel";n.Header=B.Header;n.Body=E.Body;n.Footer=T.Footer;exports.Panel=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),f=require("clsx"),q=require("react"),S=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const j=require("./Panel.Header.cjs.js"),B=require("./Panel.Body.cjs.js"),F=require("./Panel.Footer.cjs.js"),i=require("./Panel.helpers.cjs.js"),H=require("./Panel.Inline.cjs.js"),T=require("./Panel.Overlay.cjs.js"),e=require("../../../chunks/panel.module.BX1x4FlX.js"),{baseClassNamePrefix:s}=S.getBEMClassNames("panel"),l=({children:c,className:b,padding:C="md",onOpenChange:g,open:u,size:a,dismissible:_=!0,closeButtonAriaLabel:d="Close panel",kind:P="inline",position:o,divider:$=!0,isAnimated:p=!0,onBeforeClose:h,modalType:n,...t})=>{process.env.NODE_ENV!=="production"&&n==="alert"&&_&&console.warn('Panel: `dismissible` is ignored when `modalType="alert"`. The close button is always hidden.'),process.env.NODE_ENV!=="production"&&t.closeOnOutsidePress&&n!=="nonModal"&&n!==void 0&&console.warn('Panel: `closeOnOutsidePress` has no effect when `modalType` is not `"nonModal"`.');const N=n==="alert"?!1:_,r=i.getResolvedPanelPosition(o),v=f(e.styles[s],e.styles[`${s}--${P}`],a&&e.styles[`${s}--size-${a}`],e.styles[`${s}--padding-${C}`],e.styles[`${s}--position-${r}`],b),M=f(e.styles[`${s}__inline-wrapper`],a==="full"&&e.styles[`${s}__inline-wrapper--full`]),{requestClose:y,handleOverlayOpenChange:x}=i.usePanelClose(h,g),m=q.useMemo(()=>({dismissible:N,closeButtonAriaLabel:d,position:o,requestClose:y}),[N,d,o,y]),{showDivider:D,dividerBefore:E,dividerInner:I,dividerAfter:R}=i.getPanelDividerState($,r),w=q.useMemo(()=>({duration:p?i.PANEL_TRANSITION_DURATION_MS:0}),[p]);return P==="inline"?O.jsx(H.InlinePanel,{contextValue:m,panelClassName:v,inlineWrapperClassName:M,resolvedPosition:r,dividerBefore:E,dividerInner:I,dividerAfter:R,open:u,transitionConfig:w,...t,children:c}):O.jsx(T.OverlayPanel,{contextValue:m,panelClassName:v,resolvedPosition:r,showDivider:D,modalType:n,open:u,onOpenChange:x,transitionConfig:w,...t,children:c})};l.displayName="Panel";l.Header=j.Header;l.Body=B.Body;l.Footer=F.Footer;exports.Panel=l;
@@ -1,90 +1,92 @@
1
- import { jsx as $ } from "react/jsx-runtime";
2
- import g from "clsx";
3
- import { useMemo as _ } from "react";
1
+ import { jsx as C } from "react/jsx-runtime";
2
+ import $ from "clsx";
3
+ import { useMemo as g } from "react";
4
4
  import { g as R } from "../../../chunks/classNames.BTJmrO_L.js";
5
5
  import "../../../chunks/constants.CKKGf1-i.js";
6
6
  import { Header as S } from "./Panel.Header.es.js";
7
- import { Body as T } from "./Panel.Body.es.js";
7
+ import { Body as V } from "./Panel.Body.es.js";
8
8
  import { Footer as A } from "./Panel.Footer.es.js";
9
- import { usePanelClose as F, getPanelDividerState as H, PANEL_TRANSITION_DURATION_MS as V, getResolvedPanelPosition as j } from "./Panel.helpers.es.js";
9
+ import { usePanelClose as F, getPanelDividerState as H, PANEL_TRANSITION_DURATION_MS as T, getResolvedPanelPosition as j } from "./Panel.helpers.es.js";
10
10
  import { InlinePanel as q } from "./Panel.Inline.es.js";
11
11
  import { OverlayPanel as U } from "./Panel.Overlay.es.js";
12
12
  import { s as e } from "../../../chunks/panel.module.BVm3KvDs.js";
13
- const { baseClassNamePrefix: r } = R("panel"), s = ({
14
- children: t,
15
- className: O,
13
+ const { baseClassNamePrefix: o } = R("panel"), r = ({
14
+ children: l,
15
+ className: _,
16
16
  padding: h = "md",
17
17
  onOpenChange: w,
18
- open: l,
19
- size: n,
20
- dismissible: m = !0,
21
- closeButtonAriaLabel: p = "Close panel",
22
- kind: d = "inline",
23
- position: i,
24
- divider: y = !0,
25
- isAnimated: f = !0,
26
- onBeforeClose: x,
27
- modalType: a,
28
- ...c
18
+ open: m,
19
+ size: i,
20
+ dismissible: d = !0,
21
+ closeButtonAriaLabel: f = "Close panel",
22
+ kind: p = "inline",
23
+ position: t,
24
+ divider: D = !0,
25
+ isAnimated: c = !0,
26
+ onBeforeClose: E,
27
+ modalType: s,
28
+ ...a
29
29
  }) => {
30
- process.env.NODE_ENV !== "production" && a === "alert" && m && console.warn(
30
+ process.env.NODE_ENV !== "production" && s === "alert" && d && console.warn(
31
31
  'Panel: `dismissible` is ignored when `modalType="alert"`. The close button is always hidden.'
32
+ ), process.env.NODE_ENV !== "production" && a.closeOnOutsidePress && s !== "nonModal" && s !== void 0 && console.warn(
33
+ 'Panel: `closeOnOutsidePress` has no effect when `modalType` is not `"nonModal"`.'
32
34
  );
33
- const N = a === "alert" ? !1 : m, o = j(i), u = g(
34
- e[r],
35
- e[`${r}--${d}`],
36
- n && e[`${r}--size-${n}`],
37
- e[`${r}--padding-${h}`],
38
- e[`${r}--position-${o}`],
39
- O
40
- ), D = g(
41
- e[`${r}__inline-wrapper`],
42
- n === "full" && e[`${r}__inline-wrapper--full`]
43
- ), { requestClose: v, handleOverlayOpenChange: I } = F(
44
- x,
35
+ const u = s === "alert" ? !1 : d, n = j(t), N = $(
36
+ e[o],
37
+ e[`${o}--${p}`],
38
+ i && e[`${o}--size-${i}`],
39
+ e[`${o}--padding-${h}`],
40
+ e[`${o}--position-${n}`],
41
+ _
42
+ ), x = $(
43
+ e[`${o}__inline-wrapper`],
44
+ i === "full" && e[`${o}__inline-wrapper--full`]
45
+ ), { requestClose: v, handleOverlayOpenChange: y } = F(
46
+ E,
45
47
  w
46
- ), C = _(
47
- () => ({ dismissible: N, closeButtonAriaLabel: p, position: i, requestClose: v }),
48
- [N, p, i, v]
49
- ), { showDivider: E, dividerBefore: b, dividerInner: B, dividerAfter: M } = H(y, o), P = _(
50
- () => ({ duration: f ? V : 0 }),
51
- [f]
48
+ ), P = g(
49
+ () => ({ dismissible: u, closeButtonAriaLabel: f, position: t, requestClose: v }),
50
+ [u, f, t, v]
51
+ ), { showDivider: I, dividerBefore: M, dividerInner: b, dividerAfter: B } = H(D, n), O = g(
52
+ () => ({ duration: c ? T : 0 }),
53
+ [c]
52
54
  );
53
- return d === "inline" ? /* @__PURE__ */ $(
55
+ return p === "inline" ? /* @__PURE__ */ C(
54
56
  q,
55
57
  {
56
- contextValue: C,
57
- panelClassName: u,
58
- inlineWrapperClassName: D,
59
- resolvedPosition: o,
60
- dividerBefore: b,
61
- dividerInner: B,
62
- dividerAfter: M,
63
- open: l,
64
- transitionConfig: P,
65
- ...c,
66
- children: t
58
+ contextValue: P,
59
+ panelClassName: N,
60
+ inlineWrapperClassName: x,
61
+ resolvedPosition: n,
62
+ dividerBefore: M,
63
+ dividerInner: b,
64
+ dividerAfter: B,
65
+ open: m,
66
+ transitionConfig: O,
67
+ ...a,
68
+ children: l
67
69
  }
68
- ) : /* @__PURE__ */ $(
70
+ ) : /* @__PURE__ */ C(
69
71
  U,
70
72
  {
71
- contextValue: C,
72
- panelClassName: u,
73
- resolvedPosition: o,
74
- showDivider: E,
75
- modalType: a,
76
- open: l,
77
- onOpenChange: I,
78
- transitionConfig: P,
79
- ...c,
80
- children: t
73
+ contextValue: P,
74
+ panelClassName: N,
75
+ resolvedPosition: n,
76
+ showDivider: I,
77
+ modalType: s,
78
+ open: m,
79
+ onOpenChange: y,
80
+ transitionConfig: O,
81
+ ...a,
82
+ children: l
81
83
  }
82
84
  );
83
85
  };
84
- s.displayName = "Panel";
85
- s.Header = S;
86
- s.Body = T;
87
- s.Footer = A;
86
+ r.displayName = "Panel";
87
+ r.Header = S;
88
+ r.Body = V;
89
+ r.Footer = A;
88
90
  export {
89
- s as Panel
91
+ r as Panel
90
92
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),d=400,P=s=>s||"end",f=(s,t)=>{const r=s&&t!=="full";return{showDivider:r,dividerBefore:r&&t!=="start"&&t!=="bottom",dividerInner:r&&t==="bottom",dividerAfter:r&&t==="start"}},v=s=>s==="escape-key"?"escapeKey":s==="outside-press"?"outsidePress":"programmatic",N=(s,t)=>{const r=c.useCallback(l=>{if(!s){t==null||t(!1);return}const e=s(l);e instanceof Promise?e.then(i=>{i&&(t==null||t(!1))}).catch(()=>{}):e&&(t==null||t(!1))},[s,t]),u=c.useCallback((l,e,i)=>{l?t==null||t(!0):r(v(i))},[t,r]);return{requestClose:r,handleOverlayOpenChange:u}};exports.PANEL_TRANSITION_DURATION_MS=d;exports.getPanelDividerState=f;exports.getResolvedPanelPosition=P;exports.usePanelClose=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),d=400,f=t=>t||"end",P=(t,s)=>{const e=t&&s!=="full";return{showDivider:e,dividerBefore:e&&s!=="start"&&s!=="bottom",dividerInner:e&&s==="bottom",dividerAfter:e&&s==="start"}},a=(t,s)=>{if(t!=="isModal")return t==="alert"?{escapeKey:!1,outsidePress:!1}:{escapeKey:!1,outsidePress:s??!1}},v=t=>t==="escape-key"?"escapeKey":t==="outside-press"?"outsidePress":"programmatic",N=(t,s)=>{const e=u.useCallback(i=>{if(!t){s==null||s(!1);return}const r=t(i);r instanceof Promise?r.then(l=>{l&&(s==null||s(!1))}).catch(()=>{}):r&&(s==null||s(!1))},[t,s]),c=u.useCallback((i,r,l)=>{i?s==null||s(!0):e(v(l))},[s,e]);return{requestClose:e,handleOverlayOpenChange:c}};exports.PANEL_TRANSITION_DURATION_MS=d;exports.getPanelDismissConfig=a;exports.getPanelDividerState=P;exports.getResolvedPanelPosition=f;exports.usePanelClose=N;
@@ -1,5 +1,5 @@
1
1
  import { OpenChangeReason } from '@floating-ui/react';
2
- import { PanelCloseReason, PanelPosition, PanelProps } from './Panel.types';
2
+ import { PanelCloseReason, PanelModalType, PanelPosition, PanelProps } from './Panel.types';
3
3
  export declare const PANEL_TRANSITION_DURATION_MS = 400;
4
4
  export declare const getResolvedPanelPosition: (position?: PanelPosition) => PanelPosition;
5
5
  export declare const getPanelDividerState: (divider: boolean, position?: PanelPosition) => {
@@ -8,6 +8,17 @@ export declare const getPanelDividerState: (divider: boolean, position?: PanelPo
8
8
  dividerInner: boolean;
9
9
  dividerAfter: boolean;
10
10
  };
11
+ /**
12
+ * Returns the floating-ui `dismiss` config for an overlay panel.
13
+ *
14
+ * - `isModal` — `undefined` (floating-ui defaults: ESC + backdrop click both close)
15
+ * - `nonModal` / omitted — ESC suppressed; outside-press controlled by `closeOnOutsidePress`
16
+ * - `alert` — ESC and outside-press both suppressed
17
+ */
18
+ export declare const getPanelDismissConfig: (modalType: PanelModalType | undefined, closeOnOutsidePress?: boolean) => {
19
+ escapeKey: boolean;
20
+ outsidePress: boolean;
21
+ } | undefined;
11
22
  export declare const usePanelClose: (onBeforeClose: PanelProps["onBeforeClose"], onOpenChange: PanelProps["onOpenChange"]) => {
12
23
  requestClose: (reason: PanelCloseReason) => void;
13
24
  handleOverlayOpenChange: (nextOpen: boolean, _event?: Event, floatingReason?: OpenChangeReason) => void;
@@ -1,39 +1,43 @@
1
- import { useCallback as u } from "react";
2
- const v = 400, m = (r) => r || "end", P = (r, t) => {
3
- const s = r && t !== "full";
1
+ import { useCallback as c } from "react";
2
+ const P = 400, v = (t) => t || "end", m = (t, s) => {
3
+ const r = t && s !== "full";
4
4
  return {
5
- showDivider: s,
6
- dividerBefore: s && t !== "start" && t !== "bottom",
5
+ showDivider: r,
6
+ dividerBefore: r && s !== "start" && s !== "bottom",
7
7
  // For 'bottom' panels the divider must sit inside the scrollable wrapper (above the content),
8
8
  // not outside it — so it is rendered via dividerInner rather than dividerBefore.
9
- dividerInner: s && t === "bottom",
10
- dividerAfter: s && t === "start"
9
+ dividerInner: r && s === "bottom",
10
+ dividerAfter: r && s === "start"
11
11
  };
12
- }, e = (r) => r === "escape-key" ? "escapeKey" : r === "outside-press" ? "outsidePress" : "programmatic", A = (r, t) => {
13
- const s = u(
12
+ }, a = (t, s) => {
13
+ if (t !== "isModal")
14
+ return t === "alert" ? { escapeKey: !1, outsidePress: !1 } : { escapeKey: !1, outsidePress: s ?? !1 };
15
+ }, u = (t) => t === "escape-key" ? "escapeKey" : t === "outside-press" ? "outsidePress" : "programmatic", y = (t, s) => {
16
+ const r = c(
14
17
  (i) => {
15
- if (!r) {
16
- t == null || t(!1);
18
+ if (!t) {
19
+ s == null || s(!1);
17
20
  return;
18
21
  }
19
- const c = r(i);
20
- c instanceof Promise ? c.then((l) => {
21
- l && (t == null || t(!1));
22
+ const e = t(i);
23
+ e instanceof Promise ? e.then((l) => {
24
+ l && (s == null || s(!1));
22
25
  }).catch(() => {
23
- }) : c && (t == null || t(!1));
24
- },
25
- [r, t]
26
- ), d = u(
27
- (i, c, l) => {
28
- i ? t == null || t(!0) : s(e(l));
26
+ }) : e && (s == null || s(!1));
29
27
  },
30
28
  [t, s]
29
+ ), f = c(
30
+ (i, e, l) => {
31
+ i ? s == null || s(!0) : r(u(l));
32
+ },
33
+ [s, r]
31
34
  );
32
- return { requestClose: s, handleOverlayOpenChange: d };
35
+ return { requestClose: r, handleOverlayOpenChange: f };
33
36
  };
34
37
  export {
35
- v as PANEL_TRANSITION_DURATION_MS,
36
- P as getPanelDividerState,
37
- m as getResolvedPanelPosition,
38
- A as usePanelClose
38
+ P as PANEL_TRANSITION_DURATION_MS,
39
+ a as getPanelDismissConfig,
40
+ m as getPanelDividerState,
41
+ v as getResolvedPanelPosition,
42
+ y as usePanelClose
39
43
  };
@@ -112,6 +112,12 @@ export interface OverlayPanelProps extends BasePanelProps {
112
112
  * @default 'nonModal'
113
113
  */
114
114
  modalType?: PanelModalType;
115
+ /**
116
+ * When `modalType="nonModal"`, allows the panel to close when the user
117
+ * clicks outside it. Has no effect for `'isModal'` or `'alert'` panels.
118
+ * @default false
119
+ */
120
+ closeOnOutsidePress?: boolean;
115
121
  }
116
122
  export type PanelProps = InlinePanelProps | OverlayPanelProps;
117
123
  export type { PanelHeaderProps } from './Panel.Header';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-react",
3
- "version": "2.16.0",
3
+ "version": "2.18.0",
4
4
  "description": "React component library for the Beam design system",
5
5
  "license": "MIT",
6
6
  "author": "Viasat",
@@ -59,11 +59,11 @@
59
59
  "access": "public"
60
60
  },
61
61
  "dependencies": {
62
- "@viasat/beam-fonts": "2.16.0",
63
- "@viasat/beam-shared": "2.16.0",
64
- "@viasat/beam-styles": "2.16.0",
65
- "@viasat/beam-tokens": "2.16.0",
66
- "@viasat/beam-icons": "2.16.0",
62
+ "@viasat/beam-fonts": "2.18.0",
63
+ "@viasat/beam-shared": "2.18.0",
64
+ "@viasat/beam-styles": "2.18.0",
65
+ "@viasat/beam-tokens": "2.18.0",
66
+ "@viasat/beam-icons": "2.18.0",
67
67
  "clsx": "^1.2.1",
68
68
  "@floating-ui/react": "^0.26.18",
69
69
  "@stepperize/react": "^5.1.5",