@viasat/beam-react 2.19.0 → 2.21.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 y=require("react/jsx-runtime"),o=require("react"),P=require("clsx"),ne=require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");const de=require("../Box/Box.cjs.js");require("../../chunks/CSSLookup.DESAWWRT.js");require("../../utils/hooks/useId.cjs.js");const oe=require("../../utils/hooks/useInteractiveProps.cjs.js"),t=require("../../chunks/card.module.8KnCe1uR.js"),ce=require("../Box/utils.cjs.js"),ue=require("./Card.MediaAbove.cjs.js"),be=require("./Card.Header.cjs.js"),_e=require("./Card.MediaBelow.cjs.js"),fe=require("./Card.Body.cjs.js"),ye=require("./Card.Content.cjs.js"),Ce=require("./Card.Footer.cjs.js"),me=require("./CardContext.cjs.js"),pe=require("./useCardGroup.cjs.js"),he=require("../StateLayer/StateLayer.cjs.js"),{baseClassNamePrefix:c,classModifierPrefix:d,subElementClassPrefix:u}=ne.getBEMClassNames("card"),qe='button, a, input:not([data-card-input]), select, textarea, [role="button"], [role="link"], [tabindex]:not([tabindex="-1"])',n=({children:R,className:k,density:N="md",borderColor:g,borderRadius:C,backgroundColor:B,shadow:E,type:S,as:L,disabled:T=!1,href:M,target:A,rel:j,onClick:s,selectionMode:O="single",showIndicator:G=!1,selected:H,defaultSelected:V=!1,onSelect:F,name:K,value:U,style:m,...b})=>{const p=me.useCardGroupContext();process.env.NODE_ENV!=="production"&&p&&S==="clickable"&&console.warn('Card: type="clickable" is ignored when Card is inside a CardGroup; treating as selectable instead.');const h=p?"selectable":S,q=!!h,a=h==="clickable",i=h==="selectable",{selected:v,handleChange:W,resolvedValue:X,isSelectionEligible:x,resolvedDisabled:r,resolvedName:z,resolvedShowIndicator:J,inputType:w}=pe.useCardGroup({cardGroup:p,selected:H,defaultSelected:V,value:U,id:b.id,disabled:T,name:K,selectionMode:O,showIndicator:G,onSelect:F}),I=o.useRef(null),_=L??(a&&M?"a":"div"),Q=o.useMemo(()=>C?{...m,"--bm-card-radius-outer":ce.BOX_BORDER_RADIUS_TO_CSS_VAR[C]}:m,[C,m]),f=o.useCallback(e=>{if(!e||!(e instanceof Element))return!1;const $=e.closest(qe);if(!$)return!1;const l=e.closest(`.${t.styles[c]}`);return $!==l},[]),Y=o.useCallback(e=>{if(r)return;if(f(e.target)){if(a&&_==="a"){const l=e.target,D=l==null?void 0:l.closest('a, [role="link"]');(!D||D===e.currentTarget)&&e.preventDefault()}return}if(a&&(s==null||s(e)),i){if(!x)return;const l=e.target;if(l.tagName==="INPUT"&&l.hasAttribute("data-card-input"))return;I.current&&I.current.click()}},[a,i,x,f,_,s,r]),Z=o.useCallback(e=>{r||e.key!=="Enter"&&e.key!==" "||f(e.target)||(e.preventDefault(),a&&(s==null||s(e)))},[a,f,s,r]),ee=P(t.styles[c],!B&&t.styles[`${c}--default-background`],!E&&t.styles[`${c}--default-shadow`],!g&&t.styles[`${c}--default-border`],q&&t.styles[`${d}interactive`],a&&t.styles[`${d}clickable`],i&&t.styles[`${d}selectable`],i&&v&&t.styles[`${d}selected`],r&&t.styles[`${d}disabled`],N&&t.styles[`${d}density-${N}`],k),te=oe.useInteractiveProps({isInteractive:q,disabled:r,isClickable:a,elementType:_,href:a?M:void 0,target:a?A:void 0,rel:a?j:void 0,onClick:Y,onKeyDown:Z}),ae=()=>!i||!x?null:y.jsx("input",{ref:I,type:w,className:t.styles[`${u}hidden-input`],checked:v,disabled:r,name:z,value:X,onChange:W,"aria-label":b["aria-label"],"aria-labelledby":b["aria-labelledby"],"data-card-input":""}),re=()=>{if(!i||!J)return null;const e=P(t.styles[`${u}selection-indicator`],t.styles[`${u}selection-indicator--${w}`],v&&t.styles[`${u}selection-indicator--checked`],r&&t.styles[`${u}selection-indicator--disabled`]);return y.jsx("span",{className:e,"aria-hidden":"true"})},{"aria-label":se,"aria-labelledby":ie,...le}=b;return y.jsxs(de.Box,{as:_,className:ee,borderColor:g,borderWidth:"md",backgroundColor:B,shadow:E,style:Q,...te,...le,"aria-label":i?void 0:se,"aria-labelledby":i?void 0:ie,children:[ae(),re(),q&&!r&&y.jsx(he.StateLayer,{}),R]})};n.displayName="Card";n.MediaAbove=ue.MediaAbove;n.MediaBelow=_e.MediaBelow;n.Header=be.Header;n.Body=fe.Body;n.Content=ye.Content;n.Footer=Ce.Footer;exports.Card=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),d=require("react"),T=require("clsx"),ue=require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");const be=require("../Box/Box.cjs.js");require("../../chunks/CSSLookup.DESAWWRT.js");require("../../utils/hooks/useId.cjs.js");const fe=require("../../utils/hooks/useInteractiveProps.cjs.js"),t=require("../../chunks/card.module.8KnCe1uR.js"),_e=require("../../chunks/form.context.B26th8Od.js");require("../Form/contexts/label.context.cjs.js");require("../Form/contexts/helperText.context.cjs.js");const ye=require("../Box/utils.cjs.js"),Ce=require("./Card.MediaAbove.cjs.js"),me=require("./Card.Header.cjs.js"),qe=require("./Card.MediaBelow.cjs.js"),ve=require("./Card.Body.cjs.js"),xe=require("./Card.Content.cjs.js"),he=require("./Card.Footer.cjs.js"),pe=require("./CardContext.cjs.js"),Ie=require("./useCardGroup.cjs.js"),$e=require("../StateLayer/StateLayer.cjs.js"),{baseClassNamePrefix:u,classModifierPrefix:c,subElementClassPrefix:b}=ue.getBEMClassNames("card"),ge='button, a, input:not([data-card-input]), select, textarea, [role="button"], [role="link"], [tabindex]:not([tabindex="-1"])',o=({children:P,className:k,density:g="md",borderColor:N,borderRadius:m,backgroundColor:E,shadow:B,type:S,as:L,disabled:O=!1,href:M,target:A,rel:H,onClick:i,selectionMode:j="single",showIndicator:F=!1,selected:V,defaultSelected:K=!1,onSelect:U,name:W,value:X,style:q,...f})=>{const a=pe.useCardGroupContext(),z=!!a,{ctxDisabled:G}=d.useContext(_e.FormContext),J=O||(z?!1:G);process.env.NODE_ENV!=="production"&&a&&S==="clickable"&&console.warn('Card: type="clickable" is ignored when Card is inside a CardGroup; treating as selectable instead.');const v=a?"selectable":S,x=!!v,r=v==="clickable",l=v==="selectable",{selected:h,handleChange:Q,resolvedValue:Y,isSelectionEligible:p,resolvedDisabled:s,resolvedName:Z,resolvedShowIndicator:ee,inputType:w}=Ie.useCardGroup({cardGroup:a,selected:V,defaultSelected:K,value:X,id:f.id,disabled:J,name:W,selectionMode:j,showIndicator:F,onSelect:U}),I=d.useRef(null),_=L??(r&&M?"a":"div"),te=d.useMemo(()=>m?{...q,"--bm-card-radius-outer":ye.BOX_BORDER_RADIUS_TO_CSS_VAR[m]}:q,[m,q]),y=d.useCallback(e=>{if(!e||!(e instanceof Element))return!1;const $=e.closest(ge);if(!$)return!1;const n=e.closest(`.${t.styles[u]}`);return $!==n},[]),D=a==null?void 0:a.readOnly,ae=d.useCallback(e=>{if(s||D)return;if(y(e.target)){if(r&&_==="a"){const n=e.target,R=n==null?void 0:n.closest('a, [role="link"]');(!R||R===e.currentTarget)&&e.preventDefault()}return}if(r&&(i==null||i(e)),l){if(!p)return;const n=e.target;if(n.tagName==="INPUT"&&n.hasAttribute("data-card-input"))return;I.current&&I.current.click()}},[r,l,p,y,_,i,s,D]),re=d.useCallback(e=>{s||e.key!=="Enter"&&e.key!==" "||y(e.target)||(e.preventDefault(),r&&(i==null||i(e)))},[r,y,i,s]),se=T(t.styles[u],!E&&t.styles[`${u}--default-background`],!B&&t.styles[`${u}--default-shadow`],!N&&t.styles[`${u}--default-border`],x&&t.styles[`${c}interactive`],r&&t.styles[`${c}clickable`],l&&t.styles[`${c}selectable`],l&&h&&t.styles[`${c}selected`],s&&t.styles[`${c}disabled`],g&&t.styles[`${c}density-${g}`],k),ie=fe.useInteractiveProps({isInteractive:x,disabled:s,isClickable:r,elementType:_,href:r?M:void 0,target:r?A:void 0,rel:r?H:void 0,onClick:ae,onKeyDown:re}),le=()=>!l||!p?null:C.jsx("input",{ref:I,type:w,className:t.styles[`${b}hidden-input`],checked:h,disabled:s,name:Z,value:Y,onChange:Q,"aria-label":f["aria-label"],"aria-labelledby":f["aria-labelledby"],"aria-invalid":(a==null?void 0:a.isInvalid)||void 0,"aria-errormessage":a==null?void 0:a.validationErrorsId,"data-card-input":""}),ne=()=>{if(!l||!ee)return null;const e=T(t.styles[`${b}selection-indicator`],t.styles[`${b}selection-indicator--${w}`],h&&t.styles[`${b}selection-indicator--checked`],s&&t.styles[`${b}selection-indicator--disabled`]);return C.jsx("span",{className:e,"aria-hidden":"true"})},{"aria-label":oe,"aria-labelledby":de,...ce}=f;return C.jsxs(be.Box,{as:_,className:se,borderColor:N,borderWidth:"md",backgroundColor:E,shadow:B,style:te,...ie,...ce,"aria-label":l?void 0:oe,"aria-labelledby":l?void 0:de,children:[le(),ne(),x&&!s&&C.jsx($e.StateLayer,{}),P]})};o.displayName="Card";o.MediaAbove=Ce.MediaAbove;o.MediaBelow=qe.MediaBelow;o.Header=me.Header;o.Body=ve.Body;o.Content=xe.Content;o.Footer=he.Footer;exports.Card=o;
@@ -1,197 +1,203 @@
1
- import { jsxs as le, jsx as E } from "react/jsx-runtime";
2
- import { useRef as ne, useMemo as de, useCallback as g } from "react";
3
- import R from "clsx";
4
- import { g as ce } from "../../chunks/classNames.BTJmrO_L.js";
1
+ import { jsxs as me, jsx as x } from "react/jsx-runtime";
2
+ import fe, { useRef as ue, useMemo as be, useCallback as E } from "react";
3
+ import P from "clsx";
4
+ import { g as pe } from "../../chunks/classNames.BTJmrO_L.js";
5
5
  import "../../chunks/constants.CKKGf1-i.js";
6
- import { Box as ue } from "../Box/Box.es.js";
6
+ import { Box as he } from "../Box/Box.es.js";
7
7
  import "../../chunks/CSSLookup.DOOy1rxJ.js";
8
8
  import "../../utils/hooks/useId.es.js";
9
- import { useInteractiveProps as me } from "../../utils/hooks/useInteractiveProps.es.js";
9
+ import { useInteractiveProps as ve } from "../../utils/hooks/useInteractiveProps.es.js";
10
10
  import { s as t } from "../../chunks/card.module.ByBYpexJ.js";
11
- import { BOX_BORDER_RADIUS_TO_CSS_VAR as fe } from "../Box/utils.es.js";
12
- import { MediaAbove as be } from "./Card.MediaAbove.es.js";
13
- import { Header as pe } from "./Card.Header.es.js";
14
- import { MediaBelow as he } from "./Card.MediaBelow.es.js";
15
- import { Body as ye } from "./Card.Body.es.js";
16
- import { Content as $e } from "./Card.Content.es.js";
17
- import { Footer as Ie } from "./Card.Footer.es.js";
18
- import { useCardGroupContext as ve } from "./CardContext.es.js";
19
- import { useCardGroup as Ne } from "./useCardGroup.es.js";
20
- import { StateLayer as Ce } from "../StateLayer/StateLayer.es.js";
21
- const { baseClassNamePrefix: d, classModifierPrefix: n, subElementClassPrefix: c } = ce("card"), Ee = 'button, a, input:not([data-card-input]), select, textarea, [role="button"], [role="link"], [tabindex]:not([tabindex="-1"])', l = ({
11
+ import { F as ye } from "../../chunks/form.context.BhylRiG2.js";
12
+ import "../Form/contexts/label.context.es.js";
13
+ import "../Form/contexts/helperText.context.es.js";
14
+ import { BOX_BORDER_RADIUS_TO_CSS_VAR as Ie } from "../Box/utils.es.js";
15
+ import { MediaAbove as $e } from "./Card.MediaAbove.es.js";
16
+ import { Header as Ce } from "./Card.Header.es.js";
17
+ import { MediaBelow as ge } from "./Card.MediaBelow.es.js";
18
+ import { Body as xe } from "./Card.Body.es.js";
19
+ import { Content as Ee } from "./Card.Content.es.js";
20
+ import { Footer as Ne } from "./Card.Footer.es.js";
21
+ import { useCardGroupContext as De } from "./CardContext.es.js";
22
+ import { useCardGroup as we } from "./useCardGroup.es.js";
23
+ import { StateLayer as Se } from "../StateLayer/StateLayer.es.js";
24
+ const { baseClassNamePrefix: c, classModifierPrefix: d, subElementClassPrefix: m } = pe("card"), _e = 'button, a, input:not([data-card-input]), select, textarea, [role="button"], [role="link"], [tabindex]:not([tabindex="-1"])', n = ({
22
25
  children: T,
23
26
  className: A,
24
- density: x = "md",
25
- borderColor: w,
26
- borderRadius: b,
27
- backgroundColor: S,
28
- shadow: B,
29
- type: D,
27
+ density: N = "md",
28
+ borderColor: D,
29
+ borderRadius: p,
30
+ backgroundColor: w,
31
+ shadow: S,
32
+ type: _,
30
33
  as: L,
31
34
  disabled: k = !1,
32
- href: M,
33
- target: O,
34
- rel: G,
35
- onClick: i,
36
- selectionMode: H = "single",
37
- showIndicator: V = !1,
38
- selected: j,
39
- defaultSelected: F = !1,
40
- onSelect: K,
41
- name: U,
42
- value: W,
43
- style: p,
44
- ...u
35
+ href: B,
36
+ target: F,
37
+ rel: H,
38
+ onClick: s,
39
+ selectionMode: V = "single",
40
+ showIndicator: j = !1,
41
+ selected: K,
42
+ defaultSelected: U = !1,
43
+ onSelect: W,
44
+ name: X,
45
+ value: q,
46
+ style: h,
47
+ ...f
45
48
  }) => {
46
- const h = ve();
47
- process.env.NODE_ENV !== "production" && h && D === "clickable" && console.warn(
49
+ const a = De(), z = !!a, { ctxDisabled: J } = fe.useContext(ye), Q = k || (z ? !1 : J);
50
+ process.env.NODE_ENV !== "production" && a && _ === "clickable" && console.warn(
48
51
  'Card: type="clickable" is ignored when Card is inside a CardGroup; treating as selectable instead.'
49
52
  );
50
- const y = h ? "selectable" : D, $ = !!y, r = y === "clickable", o = y === "selectable", {
53
+ const v = a ? "selectable" : _, y = !!v, r = v === "clickable", o = v === "selectable", {
51
54
  selected: I,
52
- handleChange: X,
53
- resolvedValue: q,
54
- isSelectionEligible: v,
55
- resolvedDisabled: a,
56
- resolvedName: z,
57
- resolvedShowIndicator: J,
58
- inputType: _
59
- } = Ne({
60
- cardGroup: h,
61
- selected: j,
62
- defaultSelected: F,
63
- value: W,
64
- id: u.id,
65
- disabled: k,
66
- name: U,
67
- selectionMode: H,
68
- showIndicator: V,
69
- onSelect: K
70
- }), N = ne(null), m = L ?? (r && M ? "a" : "div"), Q = de(() => b ? {
71
- ...p,
72
- "--bm-card-radius-outer": fe[b]
73
- } : p, [b, p]), f = g(
55
+ handleChange: Y,
56
+ resolvedValue: Z,
57
+ isSelectionEligible: $,
58
+ resolvedDisabled: i,
59
+ resolvedName: G,
60
+ resolvedShowIndicator: ee,
61
+ inputType: M
62
+ } = we({
63
+ cardGroup: a,
64
+ selected: K,
65
+ defaultSelected: U,
66
+ value: q,
67
+ id: f.id,
68
+ disabled: Q,
69
+ name: X,
70
+ selectionMode: V,
71
+ showIndicator: j,
72
+ onSelect: W
73
+ }), C = ue(null), u = L ?? (r && B ? "a" : "div"), te = be(() => p ? {
74
+ ...h,
75
+ "--bm-card-radius-outer": Ie[p]
76
+ } : h, [p, h]), b = E(
74
77
  (e) => {
75
78
  if (!e || !(e instanceof Element)) return !1;
76
- const C = e.closest(Ee);
77
- if (!C) return !1;
78
- const s = e.closest(`.${t[d]}`);
79
- return C !== s;
79
+ const g = e.closest(_e);
80
+ if (!g) return !1;
81
+ const l = e.closest(`.${t[c]}`);
82
+ return g !== l;
80
83
  },
81
84
  []
82
- ), Y = g(
85
+ ), R = a == null ? void 0 : a.readOnly, ae = E(
83
86
  (e) => {
84
- if (a) return;
85
- if (f(e.target)) {
86
- if (r && m === "a") {
87
- const s = e.target, P = s == null ? void 0 : s.closest('a, [role="link"]');
88
- (!P || P === e.currentTarget) && e.preventDefault();
87
+ if (i || R) return;
88
+ if (b(e.target)) {
89
+ if (r && u === "a") {
90
+ const l = e.target, O = l == null ? void 0 : l.closest('a, [role="link"]');
91
+ (!O || O === e.currentTarget) && e.preventDefault();
89
92
  }
90
93
  return;
91
94
  }
92
- if (r && (i == null || i(e)), o) {
93
- if (!v) return;
94
- const s = e.target;
95
- if (s.tagName === "INPUT" && s.hasAttribute("data-card-input"))
95
+ if (r && (s == null || s(e)), o) {
96
+ if (!$) return;
97
+ const l = e.target;
98
+ if (l.tagName === "INPUT" && l.hasAttribute("data-card-input"))
96
99
  return;
97
- N.current && N.current.click();
100
+ C.current && C.current.click();
98
101
  }
99
102
  },
100
103
  [
101
104
  r,
102
105
  o,
103
- v,
104
- f,
105
- m,
106
+ $,
107
+ b,
108
+ u,
109
+ s,
106
110
  i,
107
- a
111
+ R
108
112
  ]
109
- ), Z = g(
113
+ ), re = E(
110
114
  (e) => {
111
- a || e.key !== "Enter" && e.key !== " " || f(e.target) || (e.preventDefault(), r && (i == null || i(e)));
115
+ i || e.key !== "Enter" && e.key !== " " || b(e.target) || (e.preventDefault(), r && (s == null || s(e)));
112
116
  },
113
- [r, f, i, a]
114
- ), ee = R(
115
- t[d],
116
- !S && t[`${d}--default-background`],
117
- !B && t[`${d}--default-shadow`],
118
- !w && t[`${d}--default-border`],
119
- $ && t[`${n}interactive`],
120
- r && t[`${n}clickable`],
121
- o && t[`${n}selectable`],
122
- o && I && t[`${n}selected`],
123
- a && t[`${n}disabled`],
124
- x && t[`${n}density-${x}`],
117
+ [r, b, s, i]
118
+ ), ie = P(
119
+ t[c],
120
+ !w && t[`${c}--default-background`],
121
+ !S && t[`${c}--default-shadow`],
122
+ !D && t[`${c}--default-border`],
123
+ y && t[`${d}interactive`],
124
+ r && t[`${d}clickable`],
125
+ o && t[`${d}selectable`],
126
+ o && I && t[`${d}selected`],
127
+ i && t[`${d}disabled`],
128
+ N && t[`${d}density-${N}`],
125
129
  A
126
- ), te = me({
127
- isInteractive: $,
128
- disabled: a,
130
+ ), se = ve({
131
+ isInteractive: y,
132
+ disabled: i,
129
133
  isClickable: r,
130
- elementType: m,
131
- href: r ? M : void 0,
132
- target: r ? O : void 0,
133
- rel: r ? G : void 0,
134
- onClick: Y,
135
- onKeyDown: Z
136
- }), re = () => !o || !v ? null : /* @__PURE__ */ E(
134
+ elementType: u,
135
+ href: r ? B : void 0,
136
+ target: r ? F : void 0,
137
+ rel: r ? H : void 0,
138
+ onClick: ae,
139
+ onKeyDown: re
140
+ }), oe = () => !o || !$ ? null : /* @__PURE__ */ x(
137
141
  "input",
138
142
  {
139
- ref: N,
140
- type: _,
141
- className: t[`${c}hidden-input`],
143
+ ref: C,
144
+ type: M,
145
+ className: t[`${m}hidden-input`],
142
146
  checked: I,
143
- disabled: a,
144
- name: z,
145
- value: q,
146
- onChange: X,
147
- "aria-label": u["aria-label"],
148
- "aria-labelledby": u["aria-labelledby"],
147
+ disabled: i,
148
+ name: G,
149
+ value: Z,
150
+ onChange: Y,
151
+ "aria-label": f["aria-label"],
152
+ "aria-labelledby": f["aria-labelledby"],
153
+ "aria-invalid": (a == null ? void 0 : a.isInvalid) || void 0,
154
+ "aria-errormessage": a == null ? void 0 : a.validationErrorsId,
149
155
  "data-card-input": ""
150
156
  }
151
- ), ae = () => {
152
- if (!o || !J) return null;
153
- const e = R(
154
- t[`${c}selection-indicator`],
155
- t[`${c}selection-indicator--${_}`],
156
- I && t[`${c}selection-indicator--checked`],
157
- a && t[`${c}selection-indicator--disabled`]
157
+ ), le = () => {
158
+ if (!o || !ee) return null;
159
+ const e = P(
160
+ t[`${m}selection-indicator`],
161
+ t[`${m}selection-indicator--${M}`],
162
+ I && t[`${m}selection-indicator--checked`],
163
+ i && t[`${m}selection-indicator--disabled`]
158
164
  );
159
- return /* @__PURE__ */ E("span", { className: e, "aria-hidden": "true" });
165
+ return /* @__PURE__ */ x("span", { className: e, "aria-hidden": "true" });
160
166
  }, {
161
- "aria-label": ie,
162
- "aria-labelledby": oe,
163
- ...se
164
- } = u;
165
- return /* @__PURE__ */ le(
166
- ue,
167
+ "aria-label": ne,
168
+ "aria-labelledby": de,
169
+ ...ce
170
+ } = f;
171
+ return /* @__PURE__ */ me(
172
+ he,
167
173
  {
168
- as: m,
169
- className: ee,
170
- borderColor: w,
174
+ as: u,
175
+ className: ie,
176
+ borderColor: D,
171
177
  borderWidth: "md",
172
- backgroundColor: S,
173
- shadow: B,
174
- style: Q,
175
- ...te,
178
+ backgroundColor: w,
179
+ shadow: S,
180
+ style: te,
176
181
  ...se,
177
- "aria-label": o ? void 0 : ie,
178
- "aria-labelledby": o ? void 0 : oe,
182
+ ...ce,
183
+ "aria-label": o ? void 0 : ne,
184
+ "aria-labelledby": o ? void 0 : de,
179
185
  children: [
180
- re(),
181
- ae(),
182
- $ && !a && /* @__PURE__ */ E(Ce, {}),
186
+ oe(),
187
+ le(),
188
+ y && !i && /* @__PURE__ */ x(Se, {}),
183
189
  T
184
190
  ]
185
191
  }
186
192
  );
187
193
  };
188
- l.displayName = "Card";
189
- l.MediaAbove = be;
190
- l.MediaBelow = he;
191
- l.Header = pe;
192
- l.Body = ye;
193
- l.Content = $e;
194
- l.Footer = Ie;
194
+ n.displayName = "Card";
195
+ n.MediaAbove = $e;
196
+ n.MediaBelow = ge;
197
+ n.Header = Ce;
198
+ n.Body = xe;
199
+ n.Content = Ee;
200
+ n.Footer = Ne;
195
201
  export {
196
- l as Card
202
+ n as Card
197
203
  };
@@ -5,8 +5,12 @@ export interface CardGroupContextValue {
5
5
  showIndicator?: boolean;
6
6
  name?: string;
7
7
  disabled?: boolean;
8
+ required?: boolean;
9
+ readOnly?: boolean;
8
10
  value?: string | string[];
9
11
  onItemSelect?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
12
+ validationErrorsId?: string;
13
+ isInvalid?: boolean;
10
14
  }
11
15
  export declare const CardGroupProvider: ({ children, value, }: {
12
16
  children: React.ReactNode;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),y=require("react"),f=require("clsx"),h=require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");const G=require("../../chunks/card.module.8KnCe1uR.js");require("../../chunks/CSSLookup.DESAWWRT.js");const I=require("../../utils/hooks/useId.cjs.js"),M=require("./CardContext.cjs.js"),V=require("./useCardGroupValue.cjs.js"),{classModifierPrefix:j}=h.getBEMClassNames("card"),i=u=>{const{children:d,className:c,disabled:e=!1,selectionMode:a="single",showIndicator:r=!1,name:n,value:m,defaultValue:b,onChange:C,"aria-label":p,"aria-labelledby":q,...g}=u,v=I.useId(),s=n??v,{currentValue:l,handleItemSelect:o}=V.useCardGroupValue({value:m,defaultValue:b,selectionMode:a,onChange:C}),N=f(e&&G.styles[`${j}disabled`],c),_=a==="single"?"radiogroup":"group",x=y.useMemo(()=>({selectionMode:a,showIndicator:r,name:s,disabled:e,value:l,onItemSelect:o}),[a,r,s,e,l,o]);return t.jsx("div",{role:_,"aria-disabled":e||void 0,"aria-label":p,"aria-labelledby":q,className:N,...g,children:t.jsx(M.CardGroupProvider,{value:x,children:d})})};i.displayName="CardGroup";exports.CardGroup=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),u=require("react"),E=require("../../utils/functions.cjs.js"),k=require("clsx"),F=require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");const T=require("../../chunks/card.module.8KnCe1uR.js");require("../../chunks/CSSLookup.DESAWWRT.js");const A=require("../../utils/hooks/useId.cjs.js"),B=require("../Form/hooks/useAccessibleId.hook.cjs.js"),H=require("../../chunks/form.context.B26th8Od.js");require("../Form/contexts/label.context.cjs.js");require("../Form/contexts/helperText.context.cjs.js");const L=require("./CardContext.cjs.js"),$=require("./useCardGroupValue.cjs.js"),{classModifierPrefix:z}=F.getBEMClassNames("card"),q=u.forwardRef((v,_)=>{const{children:f,className:p,disabled:y=!1,required:C=!1,readOnly:g=!1,validationRules:h=[],selectionMode:e="single",showIndicator:n=!1,name:I,value:x,defaultValue:N,onChange:R,"aria-label":G,"aria-labelledby":P,...M}=v,O=A.useId(),{id:r}=B.useAccessibleId(),o=I??O,{showErrors:S,isInvalid:i,errorShown:l,disabled:a,readOnly:s,required:d}=H.useFormField({name:o,validationRules:h,disabledProp:y,readOnlyProp:g,requiredProp:C}),t=u.useRef(null),{currentValue:c,handleItemSelect:b}=$.useCardGroupValue({value:x,defaultValue:N,selectionMode:e,onChange:R,rootRef:t}),V=k(a&&T.styles[`${z}disabled`],p),j=e==="single"?"radiogroup":"group",w=u.useMemo(()=>({selectionMode:e,showIndicator:n,name:o,disabled:a,required:d,readOnly:s,value:c,onItemSelect:b,validationErrorsId:l?r:void 0,isInvalid:i}),[e,n,o,a,d,s,c,b,l,r,i]);return m.jsxs("div",{ref:E.mergeRefs(t,_),role:j,"aria-disabled":a||s||void 0,"aria-readonly":s||void 0,"aria-required":d||void 0,"aria-invalid":i||void 0,"aria-errormessage":l?r:void 0,"aria-label":G,"aria-labelledby":P,className:V,...M,children:[m.jsx(L.CardGroupProvider,{value:w,children:f}),S(r)]})});q.displayName="CardGroup";exports.CardGroup=q;
@@ -1,10 +1,11 @@
1
- import { default as React } from 'react';
1
+ import { default as React, ComponentPropsWithoutRef } from 'react';
2
2
  import { CardGroupSelectionMode } from '@viasat/beam-shared/components/card';
3
- export type CardGroupProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'> & {
3
+ import { FormValidator } from '@viasat/beam-shared/components/form';
4
+ export interface CardGroupProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange'> {
4
5
  /**
5
6
  * The Cards that belong to this CardGroup
6
7
  */
7
- children?: React.ReactNode;
8
+ 'children'?: React.ReactNode;
8
9
  /**
9
10
  * Accessible group label
10
11
  */
@@ -48,8 +49,19 @@ export type CardGroupProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'onChan
48
49
  * Callback invoked when the group selection changes
49
50
  */
50
51
  'onChange'?: (value: string | string[] | undefined, event: React.ChangeEvent<HTMLInputElement>) => void;
51
- };
52
- export declare const CardGroup: {
53
- (props: CardGroupProps): import("react/jsx-runtime").JSX.Element;
54
- displayName: string;
55
- };
52
+ /**
53
+ * Specify if the group is a required field
54
+ * @default false
55
+ */
56
+ 'required'?: boolean;
57
+ /**
58
+ * Specify if the group displays in a read-only state
59
+ * @default false
60
+ */
61
+ 'readOnly'?: boolean;
62
+ /**
63
+ * Specify form validation rules for the group
64
+ */
65
+ 'validationRules'?: FormValidator[];
66
+ }
67
+ export declare const CardGroup: React.ForwardRefExoticComponent<CardGroupProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,67 +1,99 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { useMemo as x } from "react";
3
- import y from "clsx";
4
- import { g as G } from "../../chunks/classNames.BTJmrO_L.js";
1
+ import { jsxs as O, jsx as V } from "react/jsx-runtime";
2
+ import S, { forwardRef as j, useMemo as B } from "react";
3
+ import { mergeRefs as F } from "../../utils/functions.es.js";
4
+ import L from "clsx";
5
+ import { g as A } from "../../chunks/classNames.BTJmrO_L.js";
5
6
  import "../../chunks/constants.CKKGf1-i.js";
6
- import { s as I } from "../../chunks/card.module.ByBYpexJ.js";
7
+ import { s as $ } from "../../chunks/card.module.ByBYpexJ.js";
7
8
  import "../../chunks/CSSLookup.DOOy1rxJ.js";
8
- import { useId as M } from "../../utils/hooks/useId.es.js";
9
- import { CardGroupProvider as V } from "./CardContext.es.js";
10
- import { useCardGroupValue as B } from "./useCardGroupValue.es.js";
11
- const { classModifierPrefix: L } = G("card"), P = (i) => {
9
+ import { useId as k } from "../../utils/hooks/useId.es.js";
10
+ import { useAccessibleId as z } from "../Form/hooks/useAccessibleId.hook.es.js";
11
+ import { b as D } from "../../chunks/form.context.BhylRiG2.js";
12
+ import "../Form/contexts/label.context.es.js";
13
+ import "../Form/contexts/helperText.context.es.js";
14
+ import { CardGroupProvider as H } from "./CardContext.es.js";
15
+ import { useCardGroupValue as J } from "./useCardGroupValue.es.js";
16
+ const { classModifierPrefix: K } = A("card"), Q = j((c, p) => {
12
17
  const {
13
- children: m,
14
- className: d,
15
- disabled: e = !1,
16
- selectionMode: a = "single",
17
- showIndicator: r = !1,
18
- name: n,
19
- value: c,
20
- defaultValue: u,
21
- onChange: p,
22
- "aria-label": f,
23
- "aria-labelledby": b,
24
- ...g
25
- } = i, v = M(), o = n ?? v, { currentValue: l, handleItemSelect: s } = B({
26
- value: c,
27
- defaultValue: u,
28
- selectionMode: a,
29
- onChange: p
30
- }), N = y(
31
- e && I[`${L}disabled`],
32
- d
33
- ), C = a === "single" ? "radiogroup" : "group", h = x(
18
+ children: f,
19
+ className: v,
20
+ disabled: b = !1,
21
+ required: y = !1,
22
+ readOnly: g = !1,
23
+ validationRules: I = [],
24
+ selectionMode: e = "single",
25
+ showIndicator: t = !1,
26
+ name: h,
27
+ value: N,
28
+ defaultValue: x,
29
+ onChange: C,
30
+ "aria-label": R,
31
+ "aria-labelledby": _,
32
+ ...q
33
+ } = c, P = k(), { id: r } = z(), i = h ?? P, { showErrors: w, isInvalid: s, errorShown: l, disabled: a, readOnly: o, required: d } = D({
34
+ name: i,
35
+ validationRules: I,
36
+ disabledProp: b,
37
+ readOnlyProp: g,
38
+ requiredProp: y
39
+ }), m = S.useRef(null), { currentValue: n, handleItemSelect: u } = J({
40
+ value: N,
41
+ defaultValue: x,
42
+ selectionMode: e,
43
+ onChange: C,
44
+ rootRef: m
45
+ }), E = L(
46
+ a && $[`${K}disabled`],
47
+ v
48
+ ), G = e === "single" ? "radiogroup" : "group", M = B(
34
49
  () => ({
35
- selectionMode: a,
36
- showIndicator: r,
37
- name: o,
38
- disabled: e,
39
- value: l,
40
- onItemSelect: s
50
+ selectionMode: e,
51
+ showIndicator: t,
52
+ name: i,
53
+ disabled: a,
54
+ required: d,
55
+ readOnly: o,
56
+ value: n,
57
+ onItemSelect: u,
58
+ validationErrorsId: l ? r : void 0,
59
+ isInvalid: s
41
60
  }),
42
61
  [
62
+ e,
63
+ t,
64
+ i,
43
65
  a,
44
- r,
66
+ d,
45
67
  o,
46
- e,
68
+ n,
69
+ u,
47
70
  l,
71
+ r,
48
72
  s
49
73
  ]
50
74
  );
51
- return /* @__PURE__ */ t(
75
+ return /* @__PURE__ */ O(
52
76
  "div",
53
77
  {
54
- role: C,
55
- "aria-disabled": e || void 0,
56
- "aria-label": f,
57
- "aria-labelledby": b,
58
- className: N,
59
- ...g,
60
- children: /* @__PURE__ */ t(V, { value: h, children: m })
78
+ ref: F(m, p),
79
+ role: G,
80
+ "aria-disabled": a || o || void 0,
81
+ "aria-readonly": o || void 0,
82
+ "aria-required": d || void 0,
83
+ "aria-invalid": s || void 0,
84
+ "aria-errormessage": l ? r : void 0,
85
+ "aria-label": R,
86
+ "aria-labelledby": _,
87
+ className: E,
88
+ ...q,
89
+ children: [
90
+ /* @__PURE__ */ V(H, { value: M, children: f }),
91
+ w(r)
92
+ ]
61
93
  }
62
94
  );
63
- };
64
- P.displayName = "CardGroup";
95
+ });
96
+ Q.displayName = "CardGroup";
65
97
  export {
66
- P as CardGroup
98
+ Q as CardGroup
67
99
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),k=require("./card.utils.cjs.js");function q({cardGroup:e,selected:C,defaultSelected:S,value:b,id:m,disabled:I,name:y,selectionMode:M,showIndicator:a,onSelect:n}){const t=!!e,s=b??m,o=!t||!!s;l.useEffect(()=>{process.env.NODE_ENV!=="production"&&t&&!s&&console.warn("Card: A Card inside a CardGroup is missing a `value` or `id` prop. It will not participate in group selection.")},[]);const f=I||(e==null?void 0:e.disabled)||!1,c=(e==null?void 0:e.name)??y,h=(e==null?void 0:e.showIndicator)??a,w=(e==null?void 0:e.selectionMode)??M??"single",E=k.getInputType(w),[_,A]=l.useState(()=>t?!1:S),N=C!==void 0?C:_,i=e==null?void 0:e.value,v=(e==null?void 0:e.selectionMode)??"single",T=l.useMemo(()=>!t||!s?null:v==="single"?i===s:Array.isArray(i)?i.includes(s):!1,[i,v,t,s]),V=t?T??!1:N,d=l.useCallback(g=>{f||!o||(e!=null&&e.onItemSelect&&s?e.onItemSelect(s,g):A(g.target.checked),n==null||n(g))},[f,o,e,s,n]);return{selected:V,handleChange:d,resolvedValue:s,isSelectionEligible:o,resolvedDisabled:f,resolvedName:c,resolvedShowIndicator:h,inputType:E}}exports.useCardGroup=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),D=require("./card.utils.cjs.js");function a({cardGroup:e,selected:C,defaultSelected:S,value:b,id:m,disabled:y,name:I,selectionMode:M,showIndicator:h,onSelect:n}){const t=!!e,s=b??m,o=!t||!!s;i.useEffect(()=>{process.env.NODE_ENV!=="production"&&t&&!s&&console.warn("Card: A Card inside a CardGroup is missing a `value` or `id` prop. It will not participate in group selection.")},[]);const f=y||(e==null?void 0:e.disabled)||!1,w=(e==null?void 0:e.name)??I,E=(e==null?void 0:e.showIndicator)??h,_=(e==null?void 0:e.selectionMode)??M??"single",A=D.getInputType(_),[N,O]=i.useState(()=>t?!1:S),T=C!==void 0?C:N,l=e==null?void 0:e.value,v=(e==null?void 0:e.selectionMode)??"single",V=i.useMemo(()=>!t||!s?null:v==="single"?l===s:Array.isArray(l)?l.includes(s):!1,[l,v,t,s]),k=t?V??!1:T,q=i.useCallback(g=>{f||e!=null&&e.readOnly||!o||(e!=null&&e.onItemSelect&&s?e.onItemSelect(s,g):O(g.target.checked),n==null||n(g))},[f,o,e,s,n]);return{selected:k,handleChange:q,resolvedValue:s,isSelectionEligible:o,resolvedDisabled:f,resolvedName:w,resolvedShowIndicator:E,inputType:A}}exports.useCardGroup=a;
@@ -1,4 +1,4 @@
1
- import { useEffect as O, useState as _, useMemo as j, useCallback as q } from "react";
1
+ import { useEffect as x, useState as _, useMemo as j, useCallback as q } from "react";
2
2
  import { getInputType as z } from "./card.utils.es.js";
3
3
  function J({
4
4
  cardGroup: e,
@@ -8,32 +8,32 @@ function J({
8
8
  id: I,
9
9
  disabled: S,
10
10
  name: h,
11
- selectionMode: M,
12
- showIndicator: b,
11
+ selectionMode: y,
12
+ showIndicator: M,
13
13
  onSelect: n
14
14
  }) {
15
- const t = !!e, s = v ?? I, l = !t || !!s;
16
- O(() => {
15
+ const t = !!e, s = v ?? I, i = !t || !!s;
16
+ x(() => {
17
17
  process.env.NODE_ENV !== "production" && t && !s && console.warn(
18
18
  "Card: A Card inside a CardGroup is missing a `value` or `id` prop. It will not participate in group selection."
19
19
  );
20
20
  }, []);
21
- const o = S || (e == null ? void 0 : e.disabled) || !1, w = (e == null ? void 0 : e.name) ?? h, y = (e == null ? void 0 : e.showIndicator) ?? b, E = (e == null ? void 0 : e.selectionMode) ?? M ?? "single", A = z(E), [N, V] = _(
21
+ const f = S || (e == null ? void 0 : e.disabled) || !1, b = (e == null ? void 0 : e.name) ?? h, w = (e == null ? void 0 : e.showIndicator) ?? M, E = (e == null ? void 0 : e.selectionMode) ?? y ?? "single", A = z(E), [N, V] = _(
22
22
  () => t ? !1 : C
23
- ), k = g !== void 0 ? g : N, i = e == null ? void 0 : e.value, m = (e == null ? void 0 : e.selectionMode) ?? "single", D = j(() => !t || !s ? null : m === "single" ? i === s : Array.isArray(i) ? i.includes(s) : !1, [i, m, t, s]), T = t ? D ?? !1 : k, x = q(
24
- (f) => {
25
- o || !l || (e != null && e.onItemSelect && s ? e.onItemSelect(s, f) : V(f.target.checked), n == null || n(f));
23
+ ), k = g !== void 0 ? g : N, l = e == null ? void 0 : e.value, m = (e == null ? void 0 : e.selectionMode) ?? "single", D = j(() => !t || !s ? null : m === "single" ? l === s : Array.isArray(l) ? l.includes(s) : !1, [l, m, t, s]), O = t ? D ?? !1 : k, T = q(
24
+ (o) => {
25
+ f || e != null && e.readOnly || !i || (e != null && e.onItemSelect && s ? e.onItemSelect(s, o) : V(o.target.checked), n == null || n(o));
26
26
  },
27
- [o, l, e, s, n]
27
+ [f, i, e, s, n]
28
28
  );
29
29
  return {
30
- selected: T,
31
- handleChange: x,
30
+ selected: O,
31
+ handleChange: T,
32
32
  resolvedValue: s,
33
- isSelectionEligible: l,
34
- resolvedDisabled: o,
35
- resolvedName: w,
36
- resolvedShowIndicator: y,
33
+ isSelectionEligible: i,
34
+ resolvedDisabled: f,
35
+ resolvedName: b,
36
+ resolvedShowIndicator: w,
37
37
  inputType: A
38
38
  };
39
39
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),s=require("./card.utils.cjs.js");function b({value:o,defaultValue:n,selectionMode:t,onChange:r}){const u=o!==void 0,[d,y]=a.useState(()=>t==="single"?s.normalizeToSingle(n):s.normalizeToArray(n)),i=u?o:d,e=a.useMemo(()=>t==="single"?s.normalizeToSingle(i):s.normalizeToArray(i),[i,t]),f=a.useCallback((l,S)=>{if(t==="single"){u||y(l),r==null||r(l,S);return}const c=s.normalizeToArray(e),T=c.includes(l)?c.filter(z=>z!==l):[...c,l];u||y(T),r==null||r(T,S)},[t,e,u,r]);return{currentValue:e,handleItemSelect:f}}exports.useCardGroupValue=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),l=require("./card.utils.cjs.js");function A({value:f,defaultValue:m,selectionMode:u,onChange:e,rootRef:c}){const t=f!==void 0,y=i.useRef(u==="single"?l.normalizeToSingle(m):l.normalizeToArray(m)),[T,a]=i.useState(()=>y.current);i.useEffect(()=>{var s;if(t)return;const r=(s=c==null?void 0:c.current)==null?void 0:s.closest("form");if(!r)return;const n=()=>a(y.current);return r.addEventListener("reset",n),()=>r.removeEventListener("reset",n)},[t,c]);const o=t?f:T,d=i.useMemo(()=>u==="single"?l.normalizeToSingle(o):l.normalizeToArray(o),[o,u]),z=i.useCallback((r,n)=>{if(u==="single"){t||a(r),e==null||e(r,n);return}const s=l.normalizeToArray(d),S=s.includes(r)?s.filter(b=>b!==r):[...s,r];t||a(S),e==null||e(S,n)},[u,d,t,e]);return{currentValue:d,handleItemSelect:z}}exports.useCardGroupValue=A;
@@ -5,10 +5,11 @@ interface UseCardGroupValueParams {
5
5
  defaultValue: string | string[] | undefined;
6
6
  selectionMode: CardGroupSelectionMode;
7
7
  onChange?: (value: string | string[] | undefined, event: React.ChangeEvent<HTMLInputElement>) => void;
8
+ rootRef?: React.RefObject<HTMLDivElement>;
8
9
  }
9
10
  interface UseCardGroupValueReturn {
10
11
  currentValue: string | string[] | undefined;
11
12
  handleItemSelect: (itemValue: string, event: React.ChangeEvent<HTMLInputElement>) => void;
12
13
  }
13
- export declare function useCardGroupValue({ value, defaultValue, selectionMode, onChange, }: UseCardGroupValueParams): UseCardGroupValueReturn;
14
+ export declare function useCardGroupValue({ value, defaultValue, selectionMode, onChange, rootRef, }: UseCardGroupValueParams): UseCardGroupValueReturn;
14
15
  export {};
@@ -1,29 +1,41 @@
1
- import { useState as I, useMemo as T, useCallback as a } from "react";
2
- import { normalizeToSingle as x, normalizeToArray as f } from "./card.utils.es.js";
3
- function w({
4
- value: m,
5
- defaultValue: o,
6
- selectionMode: t,
7
- onChange: r
1
+ import { useRef as z, useState as A, useEffect as I, useMemo as L, useCallback as T } from "react";
2
+ import { normalizeToSingle as S, normalizeToArray as m } from "./card.utils.es.js";
3
+ function k({
4
+ value: a,
5
+ defaultValue: p,
6
+ selectionMode: u,
7
+ onChange: t,
8
+ rootRef: n
8
9
  }) {
9
- const l = m !== void 0, [y, p] = I(
10
- () => t === "single" ? x(o) : f(o)
11
- ), u = l ? m : y, c = T(
12
- () => t === "single" ? x(u) : f(u),
13
- [u, t]
14
- ), z = a(
15
- (s, n) => {
16
- if (t === "single") {
17
- l || p(s), r == null || r(s, n);
10
+ const s = a !== void 0, d = z(
11
+ u === "single" ? S(p) : m(p)
12
+ ), [v, i] = A(
13
+ () => d.current
14
+ );
15
+ I(() => {
16
+ var e;
17
+ if (s) return;
18
+ const r = (e = n == null ? void 0 : n.current) == null ? void 0 : e.closest("form");
19
+ if (!r) return;
20
+ const c = () => i(d.current);
21
+ return r.addEventListener("reset", c), () => r.removeEventListener("reset", c);
22
+ }, [s, n]);
23
+ const l = s ? a : v, f = L(
24
+ () => u === "single" ? S(l) : m(l),
25
+ [l, u]
26
+ ), x = T(
27
+ (r, c) => {
28
+ if (u === "single") {
29
+ s || i(r), t == null || t(r, c);
18
30
  return;
19
31
  }
20
- const i = f(c), S = i.includes(s) ? i.filter((A) => A !== s) : [...i, s];
21
- l || p(S), r == null || r(S, n);
32
+ const e = m(f), E = e.includes(r) ? e.filter((y) => y !== r) : [...e, r];
33
+ s || i(E), t == null || t(E, c);
22
34
  },
23
- [t, c, l, r]
35
+ [u, f, s, t]
24
36
  );
25
- return { currentValue: c, handleItemSelect: z };
37
+ return { currentValue: f, handleItemSelect: x };
26
38
  }
27
39
  export {
28
- w as useCardGroupValue
40
+ k as useCardGroupValue
29
41
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("clsx"),i=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const c=require("../../../chunks/panel.module.BX1x4FlX.js"),{subElementClassPrefix:o}=i.getBEMClassNames("panel"),u=`${o}header`,e=({children:s,className:a,...n})=>{const r=l(c.styles[`${u}__heading`],a);return t.jsx("div",{className:r,...n,children:s})};e.displayName="Panel.Header.Heading";exports.Heading=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),o=require("react"),g=require("clsx"),m=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const q=require("../../../chunks/FloatingUI.context.B15Tz_4h.js"),b=require("./Panel.context.cjs.js"),x=require("../../../utils/hooks/useId.cjs.js"),I=require("../../../chunks/panel.module.BX1x4FlX.js"),{subElementClassPrefix:y}=m.getBEMClassNames("panel"),P=`${y}header`,a=({children:r,className:i,id:c,...l})=>{const u=x.useId(),e=c??u,d=g(I.styles[`${P}__heading`],i),t=o.useContext(b.PanelContext),n=o.useContext(q.BmFloatingUIContext),s=(t==null?void 0:t.kind)==="overlay"?n==null?void 0:n.setLabelId:void 0;return o.useLayoutEffect(()=>{if(!(!s||!e))return s(e),()=>s(void 0)},[e,s]),_.jsx("div",{id:e,className:d,...l,children:r})};a.displayName="Panel.Header.Heading";exports.Heading=a;
@@ -6,6 +6,6 @@ export interface PanelHeaderHeadingProps extends ComponentPropsWithoutRef<'div'>
6
6
  children?: React.ReactNode;
7
7
  }
8
8
  export declare const Heading: {
9
- ({ children, className: _className, ...props }: PanelHeaderHeadingProps): import("react/jsx-runtime").JSX.Element;
9
+ ({ children, className: _className, id: _id, ...props }: PanelHeaderHeadingProps): import("react/jsx-runtime").JSX.Element;
10
10
  displayName: string;
11
11
  };
@@ -1,17 +1,25 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import o from "clsx";
3
- import { g as t } from "../../../chunks/classNames.BTJmrO_L.js";
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useContext as r, useLayoutEffect as f } from "react";
3
+ import p from "clsx";
4
+ import { g as u } from "../../../chunks/classNames.BTJmrO_L.js";
4
5
  import "../../../chunks/constants.CKKGf1-i.js";
5
- import { s as i } from "../../../chunks/panel.module.BVm3KvDs.js";
6
- const { subElementClassPrefix: l } = t("panel"), n = `${l}header`, p = ({
7
- children: s,
8
- className: e,
9
- ...a
6
+ import { B as g } from "../../../chunks/FloatingUI.context.Dl4Y1y1z.js";
7
+ import { PanelContext as x } from "./Panel.context.es.js";
8
+ import { useId as I } from "../../../utils/hooks/useId.es.js";
9
+ import { s as b } from "../../../chunks/panel.module.BVm3KvDs.js";
10
+ const { subElementClassPrefix: v } = u("panel"), y = `${v}header`, C = ({
11
+ children: a,
12
+ className: m,
13
+ id: n,
14
+ ...i
10
15
  }) => {
11
- const r = o(i[`${n}__heading`], e);
12
- return /* @__PURE__ */ m("div", { className: r, ...a, children: s });
16
+ const d = I(), e = n ?? d, l = p(b[`${y}__heading`], m), o = r(x), t = r(g), s = (o == null ? void 0 : o.kind) === "overlay" ? t == null ? void 0 : t.setLabelId : void 0;
17
+ return f(() => {
18
+ if (!(!s || !e))
19
+ return s(e), () => s(void 0);
20
+ }, [e, s]), /* @__PURE__ */ c("div", { id: e, className: l, ...i, children: a });
13
21
  };
14
- p.displayName = "Panel.Header.Heading";
22
+ C.displayName = "Panel.Header.Heading";
15
23
  export {
16
- p as Heading
24
+ C as Heading
17
25
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("clsx"),m=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const _=require("../../CloseButton/CloseButton.cjs.js"),b=require("./Panel.context.cjs.js"),s=require("../../../chunks/panel.module.BX1x4FlX.js"),{subElementClassPrefix:C}=m.getBEMClassNames("panel"),t=`${C}header`,l=({children:o,className:n,...a})=>{const{dismissible:r,closeButtonAriaLabel:i,requestClose:c}=b.usePanelContext(),u=d(s.styles[`${t}__row`],n);return e.jsxs("div",{className:u,...a,children:[o,r&&e.jsx("div",{className:s.styles[`${t}__close-button`],children:e.jsx(_.CloseButton,{"aria-label":i,onClick:()=>c("closeButton"),size:"lg"})})]})};l.displayName="Panel.Header.Row";exports.Row=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("clsx"),b=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const m=require("../../CloseButton/CloseButton.cjs.js"),_=require("../../Tooltip/Tooltip.cjs.js"),p=require("./Panel.context.cjs.js"),t=require("../../../chunks/panel.module.BX1x4FlX.js"),{subElementClassPrefix:x}=b.getBEMClassNames("panel"),l=`${x}header`,o=({children:n,className:r,...a})=>{const{dismissible:i,closeButtonAriaLabel:s,requestClose:c}=p.usePanelContext(),u=d(t.styles[`${l}__row`],r);return e.jsxs("div",{className:u,...a,children:[n,i&&e.jsx("div",{className:t.styles[`${l}__close-button`],children:e.jsx(_.Tooltip,{text:s,placement:"bottom",portalled:!0,role:{enabled:!1},children:e.jsx(m.CloseButton,{"aria-label":s,onClick:()=>c("closeButton"),size:"lg"})})})]})};o.displayName="Panel.Header.Row";exports.Row=o;
@@ -1,29 +1,30 @@
1
- import { jsxs as c, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
2
  import p from "clsx";
3
3
  import { g as d } from "../../../chunks/classNames.BTJmrO_L.js";
4
4
  import "../../../chunks/constants.CKKGf1-i.js";
5
- import { CloseButton as u } from "../../CloseButton/CloseButton.es.js";
6
- import { usePanelContext as f } from "./Panel.context.es.js";
7
- import { s as e } from "../../../chunks/panel.module.BVm3KvDs.js";
8
- const { subElementClassPrefix: C } = d("panel"), o = `${C}header`, b = ({
9
- children: t,
10
- className: l,
5
+ import { CloseButton as f } from "../../CloseButton/CloseButton.es.js";
6
+ import { Tooltip as u } from "../../Tooltip/Tooltip.es.js";
7
+ import { usePanelContext as b } from "./Panel.context.es.js";
8
+ import { s as o } from "../../../chunks/panel.module.BVm3KvDs.js";
9
+ const { subElementClassPrefix: x } = d("panel"), t = `${x}header`, C = ({
10
+ children: l,
11
+ className: r,
11
12
  ...a
12
13
  }) => {
13
- const { dismissible: r, closeButtonAriaLabel: i, requestClose: m } = f(), n = p(e[`${o}__row`], l);
14
+ const { dismissible: m, closeButtonAriaLabel: s, requestClose: i } = b(), n = p(o[`${t}__row`], r);
14
15
  return /* @__PURE__ */ c("div", { className: n, ...a, children: [
15
- t,
16
- r && /* @__PURE__ */ s("div", { className: e[`${o}__close-button`], children: /* @__PURE__ */ s(
17
- u,
16
+ l,
17
+ m && /* @__PURE__ */ e("div", { className: o[`${t}__close-button`], children: /* @__PURE__ */ e(u, { text: s, placement: "bottom", portalled: !0, role: { enabled: !1 }, children: /* @__PURE__ */ e(
18
+ f,
18
19
  {
19
- "aria-label": i,
20
- onClick: () => m("closeButton"),
20
+ "aria-label": s,
21
+ onClick: () => i("closeButton"),
21
22
  size: "lg"
22
23
  }
23
- ) })
24
+ ) }) })
24
25
  ] });
25
26
  };
26
- b.displayName = "Panel.Header.Row";
27
+ C.displayName = "Panel.Header.Row";
27
28
  export {
28
- b as Row
29
+ C as Row
29
30
  };
@@ -22,7 +22,7 @@ export declare const Header: {
22
22
  displayName: string;
23
23
  };
24
24
  Heading: {
25
- ({ children, className: _className, ...props }: import('./Panel.Header.Heading').PanelHeaderHeadingProps): import("react/jsx-runtime").JSX.Element;
25
+ ({ children, className: _className, id: _id, ...props }: import('./Panel.Header.Heading').PanelHeaderHeadingProps): import("react/jsx-runtime").JSX.Element;
26
26
  displayName: string;
27
27
  };
28
28
  Description: {
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),q=require("clsx"),x=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const b=require("./Panel.context.cjs.js"),f=require("./Panel.helpers.cjs.js"),p=require("../../FloatingUI/FloatingUI.root.cjs.js"),y=require("../../FloatingUI/FloatingUI.content.cjs.js"),C=require("./Panel.Inline.cjs.js"),n=require("../../../chunks/panel.module.BX1x4FlX.js"),{baseClassNamePrefix:a}=x.getBEMClassNames("panel"),F=({contextValue:t,panelClassName:r,resolvedPosition:l,showDivider:o,modalType:e,closeOnOutsidePress:c,open:u,onOpenChange:_,transitionConfig:d,children:g,...v})=>{const s=e==="isModal"||e==="alert",m=f.getPanelDismissConfig(e,c),P=q(n.styles[`${a}__overlay-divider`],n.styles[`${a}__overlay-divider--${l}`]);return i.jsx(b.PanelContext.Provider,{value:t,children:i.jsx(p.FloatingUIRoot,{open:u,onOpenChange:_,portalled:!0,transitionConfig:d,dismiss:m,focusConfiguration:s?!0:{modal:!1,closeOnFocusOut:!1},children:i.jsxs(y.Content,{className:r,skipFloatingStyles:!0,overlay:s,...v,role:e==="alert"?"alertdialog":"dialog","aria-modal":s||void 0,"data-position":l,children:[g,o&&i.jsx(C.InlineDivider,{position:l,className:P})]})})})};exports.OverlayPanel=F;
@@ -1,4 +1,4 @@
1
- import { jsx as r, jsxs as u } from "react/jsx-runtime";
1
+ import { jsx as s, jsxs as C } from "react/jsx-runtime";
2
2
  import x from "clsx";
3
3
  import { g as N } from "../../../chunks/classNames.BTJmrO_L.js";
4
4
  import "../../../chunks/constants.CKKGf1-i.js";
@@ -6,26 +6,26 @@ import { PanelContext as y } from "./Panel.context.es.js";
6
6
  import { getPanelDismissConfig as _ } from "./Panel.helpers.es.js";
7
7
  import { FloatingUIRoot as h } from "../../FloatingUI/FloatingUI.root.es.js";
8
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";
9
+ import { InlineDivider as F } from "./Panel.Inline.es.js";
10
+ import { s as a } from "../../../chunks/panel.module.BVm3KvDs.js";
11
11
  const { baseClassNamePrefix: e } = N("panel"), R = ({
12
- contextValue: a,
12
+ contextValue: t,
13
13
  panelClassName: l,
14
- resolvedPosition: o,
15
- showDivider: n,
16
- modalType: i,
17
- closeOnOutsidePress: m,
14
+ resolvedPosition: r,
15
+ showDivider: m,
16
+ modalType: o,
17
+ closeOnOutsidePress: n,
18
18
  open: f,
19
19
  onOpenChange: c,
20
20
  transitionConfig: d,
21
21
  children: p,
22
22
  ...g
23
23
  }) => {
24
- const s = i === "isModal" || i === "alert", v = _(i, m), C = x(
25
- t[`${e}__overlay-divider`],
26
- t[`${e}__overlay-divider--${o}`]
24
+ const i = o === "isModal" || o === "alert", v = _(o, n), u = x(
25
+ a[`${e}__overlay-divider`],
26
+ a[`${e}__overlay-divider--${r}`]
27
27
  );
28
- return /* @__PURE__ */ r(y.Provider, { value: a, children: /* @__PURE__ */ r(
28
+ return /* @__PURE__ */ s(y.Provider, { value: t, children: /* @__PURE__ */ s(
29
29
  h,
30
30
  {
31
31
  open: f,
@@ -33,19 +33,20 @@ const { baseClassNamePrefix: e } = N("panel"), R = ({
33
33
  portalled: !0,
34
34
  transitionConfig: d,
35
35
  dismiss: v,
36
- focusConfiguration: s || void 0,
37
- children: /* @__PURE__ */ u(
36
+ focusConfiguration: i ? !0 : { modal: !1, closeOnFocusOut: !1 },
37
+ children: /* @__PURE__ */ C(
38
38
  D,
39
39
  {
40
40
  className: l,
41
41
  skipFloatingStyles: !0,
42
- overlay: s,
42
+ overlay: i,
43
43
  ...g,
44
- role: i === "alert" ? "alertdialog" : "dialog",
45
- "data-position": o,
44
+ role: o === "alert" ? "alertdialog" : "dialog",
45
+ "aria-modal": i || void 0,
46
+ "data-position": r,
46
47
  children: [
47
48
  p,
48
- n && /* @__PURE__ */ r(P, { position: o, className: C })
49
+ m && /* @__PURE__ */ s(F, { position: r, className: u })
49
50
  ]
50
51
  }
51
52
  )
@@ -1 +1 @@
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
+ "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:u,className:b,padding:C="md",onOpenChange:g,open:_,size:o,dismissible:d=!0,closeButtonAriaLabel:P="Close panel",kind:r="inline",position:t,divider:$=!0,isAnimated:p=!0,onBeforeClose:h,modalType:n,...c})=>{process.env.NODE_ENV!=="production"&&n==="alert"&&d&&console.warn('Panel: `dismissible` is ignored when `modalType="alert"`. The close button is always hidden.'),process.env.NODE_ENV!=="production"&&c.closeOnOutsidePress&&n!=="nonModal"&&n!==void 0&&console.warn('Panel: `closeOnOutsidePress` has no effect when `modalType` is not `"nonModal"`.');const N=n==="alert"?!1:d,a=i.getResolvedPanelPosition(t),v=f(e.styles[s],e.styles[`${s}--${r}`],o&&e.styles[`${s}--size-${o}`],e.styles[`${s}--padding-${C}`],e.styles[`${s}--position-${a}`],b),M=f(e.styles[`${s}__inline-wrapper`],o==="full"&&e.styles[`${s}__inline-wrapper--full`]),{requestClose:y,handleOverlayOpenChange:x}=i.usePanelClose(h,g),m=q.useMemo(()=>({kind:r,dismissible:N,closeButtonAriaLabel:P,position:t,requestClose:y}),[r,N,P,t,y]),{showDivider:D,dividerBefore:E,dividerInner:I,dividerAfter:R}=i.getPanelDividerState($,a),w=q.useMemo(()=>({duration:p?i.PANEL_TRANSITION_DURATION_MS:0}),[p]);return r==="inline"?O.jsx(H.InlinePanel,{contextValue:m,panelClassName:v,inlineWrapperClassName:M,resolvedPosition:a,dividerBefore:E,dividerInner:I,dividerAfter:R,open:_,transitionConfig:w,...c,children:u}):O.jsx(T.OverlayPanel,{contextValue:m,panelClassName:v,resolvedPosition:a,showDivider:D,modalType:n,open:_,onOpenChange:x,transitionConfig:w,...c,children:u})};l.displayName="Panel";l.Header=j.Header;l.Body=B.Body;l.Footer=F.Footer;exports.Panel=l;
@@ -1,5 +1,9 @@
1
- import { PanelCloseReason, PanelPosition } from './Panel.types';
1
+ import { PanelCloseReason, PanelKind, PanelPosition } from './Panel.types';
2
2
  export interface PanelContextValue {
3
+ /**
4
+ * The panel kind — used by sub-components to vary behaviour per kind.
5
+ */
6
+ kind: PanelKind;
3
7
  /**
4
8
  * Whether to show a dismissible button
5
9
  */
@@ -14,7 +14,7 @@ export declare const Panel: {
14
14
  displayName: string;
15
15
  };
16
16
  Heading: {
17
- ({ children, className: _className, ...props }: import('./Panel.Header.Heading').PanelHeaderHeadingProps): import("react/jsx-runtime").JSX.Element;
17
+ ({ children, className: _className, id: _id, ...props }: import('./Panel.Header.Heading').PanelHeaderHeadingProps): import("react/jsx-runtime").JSX.Element;
18
18
  displayName: string;
19
19
  };
20
20
  Description: {
@@ -10,49 +10,49 @@ import { usePanelClose as F, getPanelDividerState as H, PANEL_TRANSITION_DURATIO
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: o } = R("panel"), r = ({
14
- children: l,
13
+ const { baseClassNamePrefix: o } = R("panel"), i = ({
14
+ children: m,
15
15
  className: _,
16
16
  padding: h = "md",
17
17
  onOpenChange: w,
18
- open: m,
19
- size: i,
20
- dismissible: d = !0,
21
- closeButtonAriaLabel: f = "Close panel",
22
- kind: p = "inline",
23
- position: t,
18
+ open: d,
19
+ size: t,
20
+ dismissible: f = !0,
21
+ closeButtonAriaLabel: p = "Close panel",
22
+ kind: r = "inline",
23
+ position: a,
24
24
  divider: D = !0,
25
25
  isAnimated: c = !0,
26
26
  onBeforeClose: E,
27
27
  modalType: s,
28
- ...a
28
+ ...l
29
29
  }) => {
30
- process.env.NODE_ENV !== "production" && s === "alert" && d && console.warn(
30
+ process.env.NODE_ENV !== "production" && s === "alert" && f && 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(
32
+ ), process.env.NODE_ENV !== "production" && l.closeOnOutsidePress && s !== "nonModal" && s !== void 0 && console.warn(
33
33
  'Panel: `closeOnOutsidePress` has no effect when `modalType` is not `"nonModal"`.'
34
34
  );
35
- const u = s === "alert" ? !1 : d, n = j(t), N = $(
35
+ const u = s === "alert" ? !1 : f, n = j(a), N = $(
36
36
  e[o],
37
- e[`${o}--${p}`],
38
- i && e[`${o}--size-${i}`],
37
+ e[`${o}--${r}`],
38
+ t && e[`${o}--size-${t}`],
39
39
  e[`${o}--padding-${h}`],
40
40
  e[`${o}--position-${n}`],
41
41
  _
42
42
  ), x = $(
43
43
  e[`${o}__inline-wrapper`],
44
- i === "full" && e[`${o}__inline-wrapper--full`]
44
+ t === "full" && e[`${o}__inline-wrapper--full`]
45
45
  ), { requestClose: v, handleOverlayOpenChange: y } = F(
46
46
  E,
47
47
  w
48
48
  ), P = g(
49
- () => ({ dismissible: u, closeButtonAriaLabel: f, position: t, requestClose: v }),
50
- [u, f, t, v]
49
+ () => ({ kind: r, dismissible: u, closeButtonAriaLabel: p, position: a, requestClose: v }),
50
+ [r, u, p, a, v]
51
51
  ), { showDivider: I, dividerBefore: M, dividerInner: b, dividerAfter: B } = H(D, n), O = g(
52
52
  () => ({ duration: c ? T : 0 }),
53
53
  [c]
54
54
  );
55
- return p === "inline" ? /* @__PURE__ */ C(
55
+ return r === "inline" ? /* @__PURE__ */ C(
56
56
  q,
57
57
  {
58
58
  contextValue: P,
@@ -62,10 +62,10 @@ const { baseClassNamePrefix: o } = R("panel"), r = ({
62
62
  dividerBefore: M,
63
63
  dividerInner: b,
64
64
  dividerAfter: B,
65
- open: m,
65
+ open: d,
66
66
  transitionConfig: O,
67
- ...a,
68
- children: l
67
+ ...l,
68
+ children: m
69
69
  }
70
70
  ) : /* @__PURE__ */ C(
71
71
  U,
@@ -75,18 +75,18 @@ const { baseClassNamePrefix: o } = R("panel"), r = ({
75
75
  resolvedPosition: n,
76
76
  showDivider: I,
77
77
  modalType: s,
78
- open: m,
78
+ open: d,
79
79
  onOpenChange: y,
80
80
  transitionConfig: O,
81
- ...a,
82
- children: l
81
+ ...l,
82
+ children: m
83
83
  }
84
84
  );
85
85
  };
86
- r.displayName = "Panel";
87
- r.Header = S;
88
- r.Body = V;
89
- r.Footer = A;
86
+ i.displayName = "Panel";
87
+ i.Header = S;
88
+ i.Body = V;
89
+ i.Footer = A;
90
90
  export {
91
- r as Panel
91
+ i as Panel
92
92
  };
@@ -18,6 +18,18 @@ interface BasePanelProps extends ComponentPropsWithoutRef<'aside'> {
18
18
  * Specify the content of the Panel
19
19
  */
20
20
  children: React.ReactNode;
21
+ /**
22
+ * Accessible name for the panel dialog when `Panel.Header.Heading` is not rendered.
23
+ * When a heading is present, `aria-labelledby` is set automatically.
24
+ * Provide this prop whenever you build a panel without `Panel.Header.Heading` to satisfy
25
+ * the WCAG requirement that every `role="dialog"` element has an accessible name.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <Panel kind="overlay" aria-label="User settings" ... />
30
+ * ```
31
+ */
32
+ 'aria-label'?: string;
21
33
  /**
22
34
  * Controls the Panel's visibility. For inline panels, omitting this prop
23
35
  * renders the panel as always-visible (uncontrolled).
@@ -44,7 +56,8 @@ interface BasePanelProps extends ComponentPropsWithoutRef<'aside'> {
44
56
  */
45
57
  dismissible?: boolean;
46
58
  /**
47
- * Aria label for the dismissible button
59
+ * Label for the close button. Used as both the button's `aria-label` (screen reader name)
60
+ * and the visible tooltip text. Provide a value that works in both contexts.
48
61
  * @default 'Close panel'
49
62
  */
50
63
  closeButtonAriaLabel?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-react",
3
- "version": "2.19.0",
3
+ "version": "2.21.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.19.0",
63
- "@viasat/beam-shared": "2.19.0",
64
- "@viasat/beam-styles": "2.19.0",
65
- "@viasat/beam-tokens": "2.19.0",
66
- "@viasat/beam-icons": "2.19.0",
62
+ "@viasat/beam-fonts": "2.21.0",
63
+ "@viasat/beam-shared": "2.21.0",
64
+ "@viasat/beam-styles": "2.21.0",
65
+ "@viasat/beam-tokens": "2.21.0",
66
+ "@viasat/beam-icons": "2.21.0",
67
67
  "clsx": "^1.2.1",
68
68
  "@floating-ui/react": "^0.26.18",
69
69
  "@stepperize/react": "^5.1.5",