@viasat/beam-react 2.29.0 → 2.30.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,116 +1,124 @@
1
- import { jsx as E } from "react/jsx-runtime";
2
- import S from "clsx";
3
- import { useMemo as z } from "react";
4
- import { g as V } from "../../../chunks/classNames.BTJmrO_L.js";
1
+ import { jsx as S } from "react/jsx-runtime";
2
+ import z from "clsx";
3
+ import { useMemo as x, useRef as W } from "react";
4
+ import { g as q } from "../../../chunks/classNames.BTJmrO_L.js";
5
5
  import "../../../chunks/constants.CKKGf1-i.js";
6
- import { Header as W } from "./Header/Panel.Header.es.js";
7
- import { Body as q } from "./Panel.Body.es.js";
8
- import { Footer as G } from "./Footer/Panel.Footer.es.js";
9
- import { resolveOffset as U, usePanelClose as J, getPanelDividerState as Q, PANEL_TRANSITION_DURATION_MS as X, getResolvedPanelPosition as Y } from "./Panel.helpers.es.js";
10
- import { InlinePanel as Z } from "./Panel.Inline.es.js";
11
- import { OverlayPanel as k } from "./Panel.Overlay.es.js";
6
+ import { Header as G } from "./Header/Panel.Header.es.js";
7
+ import { Body as U } from "./Panel.Body.es.js";
8
+ import { Footer as Q } from "./Footer/Panel.Footer.es.js";
9
+ import { resolveOffset as X, usePanelClose as Y, getPanelDividerState as Z, PANEL_TRANSITION_DURATION_MS as k, getResolvedPanelPosition as ee } from "./Panel.helpers.es.js";
10
+ import { InlinePanel as oe } from "./Panel.Inline.es.js";
11
+ import { OverlayPanel as se } from "./Panel.Overlay.es.js";
12
12
  import { s as e } from "../../../chunks/panel.module.BblnuBjO.js";
13
- const ee = 165, oe = 100, se = (s, m) => {
14
- if (!s || m === "full") return;
15
- const p = m === "bottom", r = typeof s == "object" ? s : {}, c = r.minSize ?? (p ? oe : ee), n = r.maxSize ?? 1 / 0, f = r.storageKey ?? "";
16
- return { minSize: c, maxSize: n, storageKey: f };
17
- }, { baseClassNamePrefix: o } = V("panel"), d = ({
18
- children: s,
13
+ const ne = 165, te = 100, re = (n, m) => {
14
+ if (!n || m === "full") return;
15
+ const p = m === "bottom", i = typeof n == "object" ? n : {}, a = i.minSize ?? (p ? te : ne), t = i.maxSize ?? 1 / 0, f = i.storageKey ?? "";
16
+ return { minSize: a, maxSize: t, storageKey: f };
17
+ }, { baseClassNamePrefix: o } = q("panel"), d = ({
18
+ children: n,
19
19
  className: m,
20
20
  padding: p = "md",
21
- onOpenChange: r,
22
- open: c,
23
- size: n = "md",
21
+ onOpenChange: i,
22
+ open: a,
23
+ size: t = "md",
24
24
  dismissible: f = !0,
25
25
  closeButtonAriaLabel: N = "Close panel",
26
- kind: i = "inline",
27
- position: g,
28
- divider: M = !0,
29
- dividerColor: v,
30
- isAnimated: P = !0,
31
- onBeforeClose: x,
32
- modalType: a,
33
- offset: O,
34
- resizable: D,
26
+ kind: s = "inline",
27
+ position: u,
28
+ divider: D = !0,
29
+ dividerColor: P,
30
+ isAnimated: O = !0,
31
+ onBeforeClose: A,
32
+ modalType: l,
33
+ offset: C,
34
+ resizable: B,
35
35
  id: _,
36
- ...u
36
+ ...g
37
37
  }) => {
38
- const t = Y(g), l = se(D, t), B = !!l;
38
+ const r = ee(u), c = re(B, r), R = !!c;
39
39
  if (process.env.NODE_ENV !== "production") {
40
- l && !l.storageKey && console.warn("Panel: provide a `storageKey` in the `resizable` config to persist panel size across sessions."), a === "alert" && f && console.warn('Panel: `dismissible` is ignored when `modalType="alert"`. The close button is always hidden.');
41
- const { closeOnOutsidePress: L } = u;
42
- L && a !== "nonModal" && a !== void 0 && console.warn('Panel: `closeOnOutsidePress` has no effect when `modalType` is not `"nonModal"`.');
40
+ c && !c.storageKey && console.warn(
41
+ "Panel: provide a `storageKey` in the `resizable` config to persist panel size across sessions."
42
+ ), l === "alert" && f && console.warn(
43
+ 'Panel: `dismissible` is ignored when `modalType="alert"`. The close button is always hidden.'
44
+ );
45
+ const { closeOnOutsidePress: V } = g;
46
+ V && l !== "nonModal" && l !== void 0 && console.warn(
47
+ 'Panel: `closeOnOutsidePress` has no effect when `modalType` is not `"nonModal"`.'
48
+ );
43
49
  }
44
- const y = a === "alert" ? !1 : f, T = n && (t !== "bottom" || n === "full"), $ = i === "overlay" && O ? U(O) : void 0, C = !!$, I = S(
50
+ const y = l === "alert" ? !1 : f, T = t && (r !== "bottom" || t === "full"), $ = s === "overlay" && C ? X(C) : void 0, h = !!$, I = z(
45
51
  e[o],
46
- e[`${o}--${i}`],
47
- T && e[`${o}--size-${n}`],
52
+ e[`${o}--${s}`],
53
+ T && e[`${o}--size-${t}`],
48
54
  e[`${o}--padding-${p}`],
49
- e[`${o}--position-${t}`],
50
- C && e[`${o}--floating`],
51
- B && e[`${o}--resizable`],
55
+ e[`${o}--position-${r}`],
56
+ h && e[`${o}--floating`],
57
+ R && e[`${o}--resizable`],
52
58
  m
53
- ), A = S(
59
+ ), H = z(
54
60
  e[`${o}__inline-wrapper`],
55
- e[`${o}__inline-wrapper--size-${n}`]
56
- ), { requestClose: h, handleOverlayOpenChange: H } = J(
57
- x,
58
- r
59
- ), b = z(
61
+ e[`${o}__inline-wrapper--size-${t}`]
62
+ ), { requestClose: b, handleOverlayOpenChange: K } = Y(
63
+ A,
64
+ i
65
+ ), w = x(
60
66
  () => ({
61
- kind: i,
67
+ kind: s,
62
68
  dismissible: y,
63
69
  closeButtonAriaLabel: N,
64
- position: g,
65
- requestClose: h
70
+ position: u,
71
+ requestClose: b
66
72
  }),
67
- [i, y, N, g, h]
68
- ), { showDivider: K, dividerBefore: R, dividerInner: F, dividerAfter: j } = Q(M && !C, t), w = z(
69
- () => ({ duration: P ? X : 0 }),
70
- [P]
71
- );
72
- return i === "inline" ? /* @__PURE__ */ E(
73
- Z,
73
+ [s, y, N, u, b]
74
+ ), { showDivider: F, dividerBefore: j, dividerInner: J, dividerAfter: L } = Z(D && !h, r), E = x(
75
+ () => ({ duration: O ? k : 0 }),
76
+ [O]
77
+ ), v = W(void 0), M = v.current !== void 0 && v.current !== s && a === !0;
78
+ return v.current = s, s === "inline" ? /* @__PURE__ */ S(
79
+ oe,
74
80
  {
75
- contextValue: b,
81
+ contextValue: w,
76
82
  panelClassName: I,
77
- inlineWrapperClassName: A,
78
- resolvedPosition: t,
79
- dividerBefore: R,
80
- dividerInner: F,
81
- dividerAfter: j,
82
- dividerColor: v,
83
- open: c,
84
- transitionConfig: w,
85
- resizeConfig: l,
83
+ inlineWrapperClassName: H,
84
+ resolvedPosition: r,
85
+ dividerBefore: j,
86
+ dividerInner: J,
87
+ dividerAfter: L,
88
+ dividerColor: P,
89
+ open: a,
90
+ transitionConfig: E,
91
+ resizeConfig: c,
92
+ skipMountAnimation: M,
86
93
  id: _,
87
- ...u,
88
- children: s
94
+ ...g,
95
+ children: n
89
96
  }
90
- ) : /* @__PURE__ */ E(
91
- k,
97
+ ) : /* @__PURE__ */ S(
98
+ se,
92
99
  {
93
- contextValue: b,
100
+ contextValue: w,
94
101
  panelClassName: I,
95
- resolvedPosition: t,
96
- showDivider: K,
97
- dividerColor: v,
98
- modalType: a,
102
+ resolvedPosition: r,
103
+ showDivider: F,
104
+ dividerColor: P,
105
+ modalType: l,
99
106
  floatingOffset: $,
100
- open: c,
101
- onOpenChange: H,
102
- transitionConfig: w,
103
- resizeConfig: l,
107
+ open: a,
108
+ onOpenChange: K,
109
+ transitionConfig: E,
110
+ resizeConfig: c,
111
+ skipMountAnimation: M,
104
112
  id: _,
105
- ...u,
106
- children: s
113
+ ...g,
114
+ children: n
107
115
  }
108
116
  );
109
117
  };
110
118
  d.displayName = "Panel";
111
- d.Header = W;
112
- d.Body = q;
113
- d.Footer = G;
119
+ d.Header = G;
120
+ d.Body = U;
121
+ d.Footer = Q;
114
122
  export {
115
123
  d as Panel
116
124
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-react",
3
- "version": "2.29.0",
3
+ "version": "2.30.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.29.0",
63
- "@viasat/beam-shared": "2.29.0",
64
- "@viasat/beam-styles": "2.29.0",
65
- "@viasat/beam-tokens": "2.29.0",
66
- "@viasat/beam-icons": "2.29.0",
62
+ "@viasat/beam-fonts": "2.30.0",
63
+ "@viasat/beam-shared": "2.30.0",
64
+ "@viasat/beam-styles": "2.30.0",
65
+ "@viasat/beam-tokens": "2.30.0",
66
+ "@viasat/beam-icons": "2.30.0",
67
67
  "clsx": "^1.2.1",
68
68
  "@floating-ui/react": "^0.26.18",
69
69
  "@stepperize/react": "^5.1.5",