@viasat/beam-react 2.18.1 → 2.20.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.
- package/chunks/ActionList.Group.C23ltM06.js +1 -0
- package/chunks/ActionList.Group.a-ke8J4W.js +115 -0
- package/lib/ActionList/ActionList.Group.cjs.js +1 -1
- package/lib/ActionList/ActionList.Group.es.js +4 -2
- package/lib/ActionList/ActionList.cjs.js +1 -1
- package/lib/ActionList/ActionList.es.js +1 -1
- package/lib/ActionList/useActionListChildren.cjs.js +1 -1
- package/lib/ActionList/useActionListChildren.es.js +1 -1
- package/lib/Card/Card.cjs.js +1 -1
- package/lib/Card/Card.es.js +153 -147
- package/lib/Card/CardContext.d.ts +4 -0
- package/lib/Card/CardGroup.cjs.js +1 -1
- package/lib/Card/CardGroup.d.ts +20 -8
- package/lib/Card/CardGroup.es.js +81 -49
- package/lib/Card/useCardGroup.cjs.js +1 -1
- package/lib/Card/useCardGroup.es.js +16 -16
- package/lib/Card/useCardGroupValue.cjs.js +1 -1
- package/lib/Card/useCardGroupValue.d.ts +2 -1
- package/lib/Card/useCardGroupValue.es.js +33 -21
- package/lib/SideNav/SideNavActionListGroup.cjs.js +1 -1
- package/lib/SideNav/SideNavActionListGroup.es.js +1 -1
- package/package.json +6 -6
- package/chunks/ActionList.Group.Bw5vZpeb.js +0 -1
- package/chunks/ActionList.Group.CUHMD8Oo.js +0 -111
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),n=require("react"),I=require("clsx"),s=require("./ActionList.Item.YxZyttjT.js"),j=require("./classNames.DAeKwerT.js");require("./constants.hwjHOsvT.js");const E=require("../lib/ActionList/ActionListSelectionContext.cjs.js"),_=require("../lib/ActionList/ActionListIndentationContext.cjs.js"),P=require("../lib/Divider/Divider.cjs.js"),C=require("../utils/functions.cjs.js"),M=require("../lib/ActionList/ActionList.context.cjs.js"),$=({children:p,disabled:t,allowGroups:l=!1,kind:r="action"})=>{const{allowChildrenTypes:a=[]}=M.useActionListContext();return n.useMemo(()=>{let o=!1;const d=[s.ActionListItem,...l?[v]:[],...a];return{children:n.Children.toArray(p).flatMap((i,u)=>{if(!n.isValidElement(i))return[];const{disabled:m,kind:h}=i.props;if(C.isSameComponent(i.type,s.ActionListItem)){const e=h??r;return o=o||s.isChoiceKind(e),[n.cloneElement(i,{disabled:t??m,kind:e})]}if(l&&C.isSameComponent(i.type,v)){const e=i.props;return n.Children.forEach(e.children,L=>{if(n.isValidElement(L)){const f=L.props.kind??e.kind??r;o=o||s.isChoiceKind(f)}}),[n.cloneElement(i,{disabled:t??m})]}if(a.some(e=>C.isSameComponent(i.type,e)))return[n.cloneElement(i,{disabled:t??m})];const b=d.map(e=>e.displayName??e.name).join(", ").replace(/, (.+?)$/," or $1");return console.warn(`ActionList: Invalid child at position ${u}. Only ${b} allowed.`),[]}),hasChoiceItems:o}},[p,a,l,t,r])},{baseClassNamePrefix:S,classModifierPrefix:x,subElementClassPrefix:y}=j.getBEMClassNames("action-list__group"),v=({children:p,heading:t,divider:l=!1,kind:r="action",className:a,disabled:o,noResults:d,indent:q,role:i="group",...u})=>{const m=I(s.styles[S],s.styles[`${x}kind-${r}`],d&&s.styles[`${x}no-results`],o&&s.styles[`${x}disabled`],a),{children:h,hasChoiceItems:b}=$({children:p,disabled:o,allowGroups:!1,kind:r}),e=_.useActionListIndentation({hasChoiceItems:b,indentProp:q}),L=typeof t=="string"?c.jsx("div",{className:s.styles[`${y}heading`],children:t}):t,A=u["aria-label"],f=u["aria-labelledby"],N=n.useMemo(()=>{if(A)return A;if(!f&&t)return C.extractTextFromReactNode(t)},[A,f,t]);return c.jsx(E.ActionListSelectionProvider,{kind:r,children:c.jsx(_.ActionListIndentationProvider,{indent:e,children:c.jsxs("div",{className:m,role:i,...u,"aria-label":N,children:[L||null,d&&c.jsx("div",{className:s.styles[`${y}no-results`],children:d}),h,l&&c.jsx(P.Divider,{borderColor:"01",className:s.styles[`${y}divider`],role:"presentation","aria-orientation":void 0})]})})})};exports.ActionListGroup=v;exports.useActionListChildren=$;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as m, jsxs as M } from "react/jsx-runtime";
|
|
2
|
+
import j, { useMemo as k, Children as x, isValidElement as N, cloneElement as C } from "react";
|
|
3
|
+
import w from "clsx";
|
|
4
|
+
import { A as P, i as I, s } from "./ActionList.Item.CxvNhTRB.js";
|
|
5
|
+
import { g as B } from "./classNames.BTJmrO_L.js";
|
|
6
|
+
import "./constants.CKKGf1-i.js";
|
|
7
|
+
import { ActionListSelectionProvider as D } from "../lib/ActionList/ActionListSelectionContext.es.js";
|
|
8
|
+
import { useActionListIndentation as K, ActionListIndentationProvider as S } from "../lib/ActionList/ActionListIndentationContext.es.js";
|
|
9
|
+
import { Divider as T } from "../lib/Divider/Divider.es.js";
|
|
10
|
+
import { isSameComponent as L, extractTextFromReactNode as F } from "../utils/functions.es.js";
|
|
11
|
+
import { useActionListContext as O } from "../lib/ActionList/ActionList.context.es.js";
|
|
12
|
+
const V = ({
|
|
13
|
+
children: p,
|
|
14
|
+
disabled: r,
|
|
15
|
+
allowGroups: n = !1,
|
|
16
|
+
kind: o = "action"
|
|
17
|
+
}) => {
|
|
18
|
+
const { allowChildrenTypes: a = [] } = O();
|
|
19
|
+
return k(() => {
|
|
20
|
+
let t = !1;
|
|
21
|
+
const l = [
|
|
22
|
+
P,
|
|
23
|
+
...n ? [g] : [],
|
|
24
|
+
...a
|
|
25
|
+
];
|
|
26
|
+
return { children: x.toArray(p).flatMap((i, c) => {
|
|
27
|
+
if (!N(i))
|
|
28
|
+
return [];
|
|
29
|
+
const { disabled: d, kind: b } = i.props;
|
|
30
|
+
if (L(i.type, P)) {
|
|
31
|
+
const e = b ?? o;
|
|
32
|
+
return t = t || I(e), [
|
|
33
|
+
C(i, {
|
|
34
|
+
disabled: r ?? d,
|
|
35
|
+
kind: e
|
|
36
|
+
})
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
if (n && L(i.type, g)) {
|
|
40
|
+
const e = i.props;
|
|
41
|
+
return x.forEach(e.children, (f) => {
|
|
42
|
+
if (N(f)) {
|
|
43
|
+
const h = f.props.kind ?? e.kind ?? o;
|
|
44
|
+
t = t || I(h);
|
|
45
|
+
}
|
|
46
|
+
}), [
|
|
47
|
+
C(i, {
|
|
48
|
+
disabled: r ?? d
|
|
49
|
+
})
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
if (a.some(
|
|
53
|
+
(e) => L(i.type, e)
|
|
54
|
+
))
|
|
55
|
+
return [
|
|
56
|
+
C(i, {
|
|
57
|
+
disabled: r ?? d
|
|
58
|
+
})
|
|
59
|
+
];
|
|
60
|
+
const A = l.map((e) => e.displayName ?? e.name).join(", ").replace(/, (.+?)$/, " or $1");
|
|
61
|
+
return console.warn(
|
|
62
|
+
`ActionList: Invalid child at position ${c}. Only ${A} allowed.`
|
|
63
|
+
), [];
|
|
64
|
+
}), hasChoiceItems: t };
|
|
65
|
+
}, [p, a, n, r, o]);
|
|
66
|
+
}, { baseClassNamePrefix: q, classModifierPrefix: v, subElementClassPrefix: y } = B("action-list__group"), g = ({
|
|
67
|
+
children: p,
|
|
68
|
+
heading: r,
|
|
69
|
+
divider: n = !1,
|
|
70
|
+
kind: o = "action",
|
|
71
|
+
className: a,
|
|
72
|
+
disabled: t,
|
|
73
|
+
noResults: l,
|
|
74
|
+
indent: $,
|
|
75
|
+
role: i = "group",
|
|
76
|
+
...c
|
|
77
|
+
}) => {
|
|
78
|
+
const d = w(
|
|
79
|
+
s[q],
|
|
80
|
+
s[`${v}kind-${o}`],
|
|
81
|
+
l && s[`${v}no-results`],
|
|
82
|
+
t && s[`${v}disabled`],
|
|
83
|
+
a
|
|
84
|
+
), { children: b, hasChoiceItems: A } = V({
|
|
85
|
+
children: p,
|
|
86
|
+
disabled: t,
|
|
87
|
+
allowGroups: !1,
|
|
88
|
+
kind: o
|
|
89
|
+
}), e = K({
|
|
90
|
+
hasChoiceItems: A,
|
|
91
|
+
indentProp: $
|
|
92
|
+
}), f = typeof r == "string" ? /* @__PURE__ */ m("div", { className: s[`${y}heading`], children: r }) : r, u = c["aria-label"], h = c["aria-labelledby"], E = j.useMemo(() => {
|
|
93
|
+
if (u) return u;
|
|
94
|
+
if (!h && r)
|
|
95
|
+
return F(r);
|
|
96
|
+
}, [u, h, r]);
|
|
97
|
+
return /* @__PURE__ */ m(D, { kind: o, children: /* @__PURE__ */ m(S, { indent: e, children: /* @__PURE__ */ M("div", { className: d, role: i, ...c, "aria-label": E, children: [
|
|
98
|
+
f || null,
|
|
99
|
+
l && /* @__PURE__ */ m("div", { className: s[`${y}no-results`], children: l }),
|
|
100
|
+
b,
|
|
101
|
+
n && /* @__PURE__ */ m(
|
|
102
|
+
T,
|
|
103
|
+
{
|
|
104
|
+
borderColor: "01",
|
|
105
|
+
className: s[`${y}divider`],
|
|
106
|
+
role: "presentation",
|
|
107
|
+
"aria-orientation": void 0
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
] }) }) });
|
|
111
|
+
};
|
|
112
|
+
export {
|
|
113
|
+
g as A,
|
|
114
|
+
V as u
|
|
115
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("clsx");require("../../chunks/ActionList.Item.YxZyttjT.js");require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");require("./ActionListSelectionContext.cjs.js");require("./ActionListIndentationContext.cjs.js");require("../Divider/Divider.cjs.js");const e=require("../../chunks/ActionList.Group.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");require("clsx");require("../../chunks/ActionList.Item.YxZyttjT.js");require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");require("./ActionListSelectionContext.cjs.js");require("./ActionListIndentationContext.cjs.js");require("../Divider/Divider.cjs.js");const e=require("../../chunks/ActionList.Group.C23ltM06.js");require("../../utils/functions.cjs.js");exports.ActionListGroup=e.ActionListGroup;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
2
3
|
import "clsx";
|
|
3
4
|
import "../../chunks/ActionList.Item.CxvNhTRB.js";
|
|
4
5
|
import "../../chunks/classNames.BTJmrO_L.js";
|
|
@@ -6,7 +7,8 @@ import "../../chunks/constants.CKKGf1-i.js";
|
|
|
6
7
|
import "./ActionListSelectionContext.es.js";
|
|
7
8
|
import "./ActionListIndentationContext.es.js";
|
|
8
9
|
import "../Divider/Divider.es.js";
|
|
9
|
-
import { A as
|
|
10
|
+
import { A as n } from "../../chunks/ActionList.Group.a-ke8J4W.js";
|
|
11
|
+
import "../../utils/functions.es.js";
|
|
10
12
|
export {
|
|
11
|
-
|
|
13
|
+
n as ActionListGroup
|
|
12
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),f=require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");const e=require("../../chunks/ActionList.Item.YxZyttjT.js"),m=require("./ActionListIndentationContext.cjs.js"),_=require("clsx"),S=require("./ActionListSelectionContext.cjs.js"),A=require("../../chunks/ActionList.Group.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),f=require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");const e=require("../../chunks/ActionList.Item.YxZyttjT.js"),m=require("./ActionListIndentationContext.cjs.js"),_=require("clsx"),S=require("./ActionListSelectionContext.cjs.js"),A=require("../../chunks/ActionList.Group.C23ltM06.js"),P=require("../Spinner/Spinner.cjs.js");require("react");const k=require("../Form/hooks/useAccessibleId.hook.cjs.js");require("../../chunks/form.context.B26th8Od.js");const p=require("./ActionList.IconButton.cjs.js"),M=require("@floating-ui/react"),B=require("./ActionList.context.cjs.js"),{baseClassNamePrefix:G,classModifierPrefix:a,subElementClassPrefix:i}=f.getBEMClassNames("action-list"),o=({children:L,loading:s=!1,noResults:n,header:c,supportingText:r,disabled:l,indent:x,className:b,ariaLabel:u,role:h,id:q})=>{const y=_(e.styles[G],s&&e.styles[`${a}loading`],n&&e.styles[`${a}no-results`],l&&e.styles[`${a}disabled`],b),{children:I,hasChoiceItems:j}=A.useActionListChildren({children:L,disabled:l,allowGroups:!0}),C=m.useActionListIndentation({hasChoiceItems:j,indentProp:x,ignoreContext:!0}),{id:d}=k.useAccessibleId(),{elementsRef:N,labelsRef:v,insideMenu:$}=B.useActionListContext();return t.jsx(S.ActionListSelectionProvider,{kind:"multiCheckMark",children:t.jsx(m.ActionListIndentationProvider,{indent:C,children:t.jsx(M.FloatingList,{elementsRef:N,labelsRef:v,children:t.jsxs("div",{className:y,role:h??($?"menu":"listbox"),"aria-labelledby":!u&&c?d:void 0,"aria-label":u,"aria-disabled":l,"aria-busy":s,id:q,children:[(c||r)&&t.jsx("div",{className:_(e.styles[`${i}item`],e.styles[`${i}item--header`]),id:d,children:t.jsxs("div",{className:e.styles[`${i}item__content`],children:[c&&t.jsx("div",{className:e.styles[`${i}item__text`],children:c}),r&&t.jsx("div",{className:e.styles[`${i}item__supporting-text`],children:r})]})}),s&&t.jsx(P.Spinner,{size:"sm",className:e.styles[`${i}loading`]}),!s&&n&&t.jsx("div",{className:e.styles[`${i}no-results`],children:n}),!s&&!n&&I]})})})})};o.Group=A.ActionListGroup;o.Item=e.ActionListItem;o.IconButton=p.ActionListIconButton;exports.ActionList=o;
|
|
@@ -5,7 +5,7 @@ import { s as i, A as M } from "../../chunks/ActionList.Item.CxvNhTRB.js";
|
|
|
5
5
|
import { useActionListIndentation as k, ActionListIndentationProvider as y } from "./ActionListIndentationContext.es.js";
|
|
6
6
|
import p from "clsx";
|
|
7
7
|
import { ActionListSelectionProvider as B } from "./ActionListSelectionContext.es.js";
|
|
8
|
-
import { u as G, A as j } from "../../chunks/ActionList.Group.
|
|
8
|
+
import { u as G, A as j } from "../../chunks/ActionList.Group.a-ke8J4W.js";
|
|
9
9
|
import { Spinner as E } from "../Spinner/Spinner.es.js";
|
|
10
10
|
import "react";
|
|
11
11
|
import { useAccessibleId as S } from "../Form/hooks/useAccessibleId.hook.es.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react");require("../../chunks/ActionList.Item.YxZyttjT.js");require("../../utils/functions.cjs.js");const e=require("../../chunks/ActionList.Group.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react");require("../../chunks/ActionList.Item.YxZyttjT.js");require("../../utils/functions.cjs.js");const e=require("../../chunks/ActionList.Group.C23ltM06.js");require("./ActionList.context.cjs.js");exports.useActionListChildren=e.useActionListChildren;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "../../chunks/ActionList.Item.CxvNhTRB.js";
|
|
3
3
|
import "../../utils/functions.es.js";
|
|
4
|
-
import { u as e } from "../../chunks/ActionList.Group.
|
|
4
|
+
import { u as e } from "../../chunks/ActionList.Group.a-ke8J4W.js";
|
|
5
5
|
import "./ActionList.context.es.js";
|
|
6
6
|
export {
|
|
7
7
|
e as useActionListChildren
|
package/lib/Card/Card.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|
package/lib/Card/Card.es.js
CHANGED
|
@@ -1,197 +1,203 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
import { g as
|
|
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
|
|
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
|
|
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 {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
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:
|
|
25
|
-
borderColor:
|
|
26
|
-
borderRadius:
|
|
27
|
-
backgroundColor:
|
|
28
|
-
shadow:
|
|
29
|
-
type:
|
|
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:
|
|
33
|
-
target:
|
|
34
|
-
rel:
|
|
35
|
-
onClick:
|
|
36
|
-
selectionMode:
|
|
37
|
-
showIndicator:
|
|
38
|
-
selected:
|
|
39
|
-
defaultSelected:
|
|
40
|
-
onSelect:
|
|
41
|
-
name:
|
|
42
|
-
value:
|
|
43
|
-
style:
|
|
44
|
-
...
|
|
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
|
|
47
|
-
process.env.NODE_ENV !== "production" &&
|
|
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
|
|
53
|
+
const v = a ? "selectable" : _, y = !!v, r = v === "clickable", o = v === "selectable", {
|
|
51
54
|
selected: I,
|
|
52
|
-
handleChange:
|
|
53
|
-
resolvedValue:
|
|
54
|
-
isSelectionEligible:
|
|
55
|
-
resolvedDisabled:
|
|
56
|
-
resolvedName:
|
|
57
|
-
resolvedShowIndicator:
|
|
58
|
-
inputType:
|
|
59
|
-
} =
|
|
60
|
-
cardGroup:
|
|
61
|
-
selected:
|
|
62
|
-
defaultSelected:
|
|
63
|
-
value:
|
|
64
|
-
id:
|
|
65
|
-
disabled:
|
|
66
|
-
name:
|
|
67
|
-
selectionMode:
|
|
68
|
-
showIndicator:
|
|
69
|
-
onSelect:
|
|
70
|
-
}),
|
|
71
|
-
...
|
|
72
|
-
"--bm-card-radius-outer":
|
|
73
|
-
} :
|
|
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
|
|
77
|
-
if (!
|
|
78
|
-
const
|
|
79
|
-
return
|
|
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
|
-
),
|
|
85
|
+
), R = a == null ? void 0 : a.readOnly, ae = E(
|
|
83
86
|
(e) => {
|
|
84
|
-
if (
|
|
85
|
-
if (
|
|
86
|
-
if (r &&
|
|
87
|
-
const
|
|
88
|
-
(!
|
|
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 && (
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
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
|
-
|
|
100
|
+
C.current && C.current.click();
|
|
98
101
|
}
|
|
99
102
|
},
|
|
100
103
|
[
|
|
101
104
|
r,
|
|
102
105
|
o,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
$,
|
|
107
|
+
b,
|
|
108
|
+
u,
|
|
109
|
+
s,
|
|
106
110
|
i,
|
|
107
|
-
|
|
111
|
+
R
|
|
108
112
|
]
|
|
109
|
-
),
|
|
113
|
+
), re = E(
|
|
110
114
|
(e) => {
|
|
111
|
-
|
|
115
|
+
i || e.key !== "Enter" && e.key !== " " || b(e.target) || (e.preventDefault(), r && (s == null || s(e)));
|
|
112
116
|
},
|
|
113
|
-
[r,
|
|
114
|
-
),
|
|
115
|
-
t[
|
|
116
|
-
!
|
|
117
|
-
!
|
|
118
|
-
!
|
|
119
|
-
|
|
120
|
-
r && t[`${
|
|
121
|
-
o && t[`${
|
|
122
|
-
o && I && t[`${
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
),
|
|
127
|
-
isInteractive:
|
|
128
|
-
disabled:
|
|
130
|
+
), se = ve({
|
|
131
|
+
isInteractive: y,
|
|
132
|
+
disabled: i,
|
|
129
133
|
isClickable: r,
|
|
130
|
-
elementType:
|
|
131
|
-
href: r ?
|
|
132
|
-
target: r ?
|
|
133
|
-
rel: r ?
|
|
134
|
-
onClick:
|
|
135
|
-
onKeyDown:
|
|
136
|
-
}),
|
|
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:
|
|
140
|
-
type:
|
|
141
|
-
className: t[`${
|
|
143
|
+
ref: C,
|
|
144
|
+
type: M,
|
|
145
|
+
className: t[`${m}hidden-input`],
|
|
142
146
|
checked: I,
|
|
143
|
-
disabled:
|
|
144
|
-
name:
|
|
145
|
-
value:
|
|
146
|
-
onChange:
|
|
147
|
-
"aria-label":
|
|
148
|
-
"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
|
-
),
|
|
152
|
-
if (!o || !
|
|
153
|
-
const e =
|
|
154
|
-
t[`${
|
|
155
|
-
t[`${
|
|
156
|
-
I && t[`${
|
|
157
|
-
|
|
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__ */
|
|
165
|
+
return /* @__PURE__ */ x("span", { className: e, "aria-hidden": "true" });
|
|
160
166
|
}, {
|
|
161
|
-
"aria-label":
|
|
162
|
-
"aria-labelledby":
|
|
163
|
-
...
|
|
164
|
-
} =
|
|
165
|
-
return /* @__PURE__ */
|
|
166
|
-
|
|
167
|
+
"aria-label": ne,
|
|
168
|
+
"aria-labelledby": de,
|
|
169
|
+
...ce
|
|
170
|
+
} = f;
|
|
171
|
+
return /* @__PURE__ */ me(
|
|
172
|
+
he,
|
|
167
173
|
{
|
|
168
|
-
as:
|
|
169
|
-
className:
|
|
170
|
-
borderColor:
|
|
174
|
+
as: u,
|
|
175
|
+
className: ie,
|
|
176
|
+
borderColor: D,
|
|
171
177
|
borderWidth: "md",
|
|
172
|
-
backgroundColor:
|
|
173
|
-
shadow:
|
|
174
|
-
style:
|
|
175
|
-
...te,
|
|
178
|
+
backgroundColor: w,
|
|
179
|
+
shadow: S,
|
|
180
|
+
style: te,
|
|
176
181
|
...se,
|
|
177
|
-
|
|
178
|
-
"aria-
|
|
182
|
+
...ce,
|
|
183
|
+
"aria-label": o ? void 0 : ne,
|
|
184
|
+
"aria-labelledby": o ? void 0 : de,
|
|
179
185
|
children: [
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
186
|
+
oe(),
|
|
187
|
+
le(),
|
|
188
|
+
y && !i && /* @__PURE__ */ x(Se, {}),
|
|
183
189
|
T
|
|
184
190
|
]
|
|
185
191
|
}
|
|
186
192
|
);
|
|
187
193
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
-
|
|
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
|
|
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;
|
package/lib/Card/CardGroup.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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>>;
|
package/lib/Card/CardGroup.es.js
CHANGED
|
@@ -1,67 +1,99 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
7
|
+
import { s as $ } from "../../chunks/card.module.ByBYpexJ.js";
|
|
7
8
|
import "../../chunks/CSSLookup.DOOy1rxJ.js";
|
|
8
|
-
import { useId as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
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:
|
|
14
|
-
className:
|
|
15
|
-
disabled:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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:
|
|
36
|
-
showIndicator:
|
|
37
|
-
name:
|
|
38
|
-
disabled:
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
66
|
+
d,
|
|
45
67
|
o,
|
|
46
|
-
|
|
68
|
+
n,
|
|
69
|
+
u,
|
|
47
70
|
l,
|
|
71
|
+
r,
|
|
48
72
|
s
|
|
49
73
|
]
|
|
50
74
|
);
|
|
51
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ O(
|
|
52
76
|
"div",
|
|
53
77
|
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"aria-
|
|
57
|
-
"aria-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
95
|
+
});
|
|
96
|
+
Q.displayName = "CardGroup";
|
|
65
97
|
export {
|
|
66
|
-
|
|
98
|
+
Q as CardGroup
|
|
67
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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
|
|
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:
|
|
12
|
-
showIndicator:
|
|
11
|
+
selectionMode: y,
|
|
12
|
+
showIndicator: M,
|
|
13
13
|
onSelect: n
|
|
14
14
|
}) {
|
|
15
|
-
const t = !!e, s = v ?? I,
|
|
16
|
-
|
|
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
|
|
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,
|
|
24
|
-
(
|
|
25
|
-
|
|
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
|
-
[
|
|
27
|
+
[f, i, e, s, n]
|
|
28
28
|
);
|
|
29
29
|
return {
|
|
30
|
-
selected:
|
|
31
|
-
handleChange:
|
|
30
|
+
selected: O,
|
|
31
|
+
handleChange: T,
|
|
32
32
|
resolvedValue: s,
|
|
33
|
-
isSelectionEligible:
|
|
34
|
-
resolvedDisabled:
|
|
35
|
-
resolvedName:
|
|
36
|
-
resolvedShowIndicator:
|
|
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
|
|
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
|
|
2
|
-
import { normalizeToSingle as
|
|
3
|
-
function
|
|
4
|
-
value:
|
|
5
|
-
defaultValue:
|
|
6
|
-
selectionMode:
|
|
7
|
-
onChange:
|
|
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
|
|
10
|
-
|
|
11
|
-
),
|
|
12
|
-
() =>
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
21
|
-
|
|
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
|
-
[
|
|
35
|
+
[u, f, s, t]
|
|
24
36
|
);
|
|
25
|
-
return { currentValue:
|
|
37
|
+
return { currentValue: f, handleItemSelect: x };
|
|
26
38
|
}
|
|
27
39
|
export {
|
|
28
|
-
|
|
40
|
+
k as useCardGroupValue
|
|
29
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),d=require("clsx"),u=require("../../chunks/sideNav.module.B3wMOMTH.js"),l=require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");const p=require("../../chunks/ActionList.Group.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),d=require("clsx"),u=require("../../chunks/sideNav.module.B3wMOMTH.js"),l=require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");const p=require("../../chunks/ActionList.Group.C23ltM06.js"),N=require("../../utils/extractSpecifiedComponents.cjs.js"),i=require("./SideNavActionListGroupHeading.cjs.js"),{baseClassNamePrefix:g}=l.getBEMClassNames("side-nav__group"),e=({children:s,className:t,...n})=>{const[{heading:o},r]=N.extractSpecifiedComponents(s,{heading:i.SideNavActionListGroupHeading}),a=d(u.styles[`${g}`],t);return c.jsx(p.ActionListGroup,{...n,kind:"action",className:a,role:"group",heading:o,children:r})};e.displayName="SideNav.ActionList.Group";e.Heading=i.SideNavActionListGroupHeading;exports.SideNavActionListGroup=e;
|
|
@@ -3,7 +3,7 @@ import p from "clsx";
|
|
|
3
3
|
import { s as c } from "../../chunks/sideNav.module.DBN2ryFs.js";
|
|
4
4
|
import { g as d } from "../../chunks/classNames.BTJmrO_L.js";
|
|
5
5
|
import "../../chunks/constants.CKKGf1-i.js";
|
|
6
|
-
import { A as l } from "../../chunks/ActionList.Group.
|
|
6
|
+
import { A as l } from "../../chunks/ActionList.Group.a-ke8J4W.js";
|
|
7
7
|
import { extractSpecifiedComponents as f } from "../../utils/extractSpecifiedComponents.es.js";
|
|
8
8
|
import { SideNavActionListGroupHeading as o } from "./SideNavActionListGroupHeading.es.js";
|
|
9
9
|
const { baseClassNamePrefix: g } = d("side-nav__group"), i = ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viasat/beam-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.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.
|
|
63
|
-
"@viasat/beam-shared": "2.
|
|
64
|
-
"@viasat/beam-styles": "2.
|
|
65
|
-
"@viasat/beam-tokens": "2.
|
|
66
|
-
"@viasat/beam-icons": "2.
|
|
62
|
+
"@viasat/beam-fonts": "2.20.0",
|
|
63
|
+
"@viasat/beam-shared": "2.20.0",
|
|
64
|
+
"@viasat/beam-styles": "2.20.0",
|
|
65
|
+
"@viasat/beam-tokens": "2.20.0",
|
|
66
|
+
"@viasat/beam-icons": "2.20.0",
|
|
67
67
|
"clsx": "^1.2.1",
|
|
68
68
|
"@floating-ui/react": "^0.26.18",
|
|
69
69
|
"@stepperize/react": "^5.1.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),b=require("clsx"),t=require("./ActionList.Item.YxZyttjT.js"),I=require("./classNames.DAeKwerT.js");require("./constants.hwjHOsvT.js");const N=require("../lib/ActionList/ActionListSelectionContext.cjs.js"),q=require("../lib/ActionList/ActionListIndentationContext.cjs.js"),j=require("../lib/Divider/Divider.cjs.js"),o=require("react"),C=require("../utils/functions.cjs.js"),E=require("../lib/ActionList/ActionList.context.cjs.js"),v=({children:m,disabled:s,allowGroups:l=!1,kind:r="action"})=>{const{allowChildrenTypes:a=[]}=E.useActionListContext();return o.useMemo(()=>{let n=!1;const d=[t.ActionListItem,...l?[y]:[],...a];return{children:o.Children.toArray(m).flatMap((i,h)=>{if(!o.isValidElement(i))return[];const{disabled:u,kind:A}=i.props;if(C.isSameComponent(i.type,t.ActionListItem)){const e=A??r;return n=n||t.isChoiceKind(e),[o.cloneElement(i,{disabled:s??u,kind:e})]}if(l&&C.isSameComponent(i.type,y)){const e=i.props;return o.Children.forEach(e.children,p=>{if(o.isValidElement(p)){const $=p.props.kind??e.kind??r;n=n||t.isChoiceKind($)}}),[o.cloneElement(i,{disabled:s??u})]}if(a.some(e=>C.isSameComponent(i.type,e)))return[o.cloneElement(i,{disabled:s??u})];const L=d.map(e=>e.displayName??e.name).join(", ").replace(/, (.+?)$/," or $1");return console.warn(`ActionList: Invalid child at position ${h}. Only ${L} allowed.`),[]}),hasChoiceItems:n}},[m,a,l,s,r])},{baseClassNamePrefix:P,classModifierPrefix:f,subElementClassPrefix:x}=I.getBEMClassNames("action-list__group"),y=({children:m,heading:s,divider:l=!1,kind:r="action",className:a,disabled:n,noResults:d,indent:_,role:i="group",...h})=>{const u=b(t.styles[P],t.styles[`${f}kind-${r}`],d&&t.styles[`${f}no-results`],n&&t.styles[`${f}disabled`],a),{children:A,hasChoiceItems:L}=v({children:m,disabled:n,allowGroups:!1,kind:r}),e=q.useActionListIndentation({hasChoiceItems:L,indentProp:_}),p=typeof s=="string"?c.jsx("div",{className:t.styles[`${x}heading`],children:s}):s;return c.jsx(N.ActionListSelectionProvider,{kind:r,children:c.jsx(q.ActionListIndentationProvider,{indent:e,children:c.jsxs("div",{className:u,role:i,...h,children:[p||null,d&&c.jsx("div",{className:t.styles[`${x}no-results`],children:d}),A,l&&c.jsx(j.Divider,{borderColor:"01",className:t.styles[`${x}divider`],role:"presentation","aria-orientation":void 0})]})})})};exports.ActionListGroup=y;exports.useActionListChildren=v;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { jsx as d, jsxs as b } from "react/jsx-runtime";
|
|
2
|
-
import E from "clsx";
|
|
3
|
-
import { A as L, i as g, s as t } from "./ActionList.Item.CxvNhTRB.js";
|
|
4
|
-
import { g as M } from "./classNames.BTJmrO_L.js";
|
|
5
|
-
import "./constants.CKKGf1-i.js";
|
|
6
|
-
import { ActionListSelectionProvider as j } from "../lib/ActionList/ActionListSelectionContext.es.js";
|
|
7
|
-
import { useActionListIndentation as k, ActionListIndentationProvider as w } from "../lib/ActionList/ActionListIndentationContext.es.js";
|
|
8
|
-
import { Divider as D } from "../lib/Divider/Divider.es.js";
|
|
9
|
-
import { useMemo as K, Children as x, isValidElement as N, cloneElement as C } from "react";
|
|
10
|
-
import { isSameComponent as A } from "../utils/functions.es.js";
|
|
11
|
-
import { useActionListContext as S } from "../lib/ActionList/ActionList.context.es.js";
|
|
12
|
-
const B = ({
|
|
13
|
-
children: m,
|
|
14
|
-
disabled: o,
|
|
15
|
-
allowGroups: n = !1,
|
|
16
|
-
kind: r = "action"
|
|
17
|
-
}) => {
|
|
18
|
-
const { allowChildrenTypes: a = [] } = S();
|
|
19
|
-
return K(() => {
|
|
20
|
-
let s = !1;
|
|
21
|
-
const l = [
|
|
22
|
-
L,
|
|
23
|
-
...n ? [P] : [],
|
|
24
|
-
...a
|
|
25
|
-
];
|
|
26
|
-
return { children: x.toArray(m).flatMap((i, f) => {
|
|
27
|
-
if (!N(i))
|
|
28
|
-
return [];
|
|
29
|
-
const { disabled: c, kind: u } = i.props;
|
|
30
|
-
if (A(i.type, L)) {
|
|
31
|
-
const e = u ?? r;
|
|
32
|
-
return s = s || g(e), [
|
|
33
|
-
C(i, {
|
|
34
|
-
disabled: o ?? c,
|
|
35
|
-
kind: e
|
|
36
|
-
})
|
|
37
|
-
];
|
|
38
|
-
}
|
|
39
|
-
if (n && A(i.type, P)) {
|
|
40
|
-
const e = i.props;
|
|
41
|
-
return x.forEach(e.children, (p) => {
|
|
42
|
-
if (N(p)) {
|
|
43
|
-
const I = p.props.kind ?? e.kind ?? r;
|
|
44
|
-
s = s || g(I);
|
|
45
|
-
}
|
|
46
|
-
}), [
|
|
47
|
-
C(i, {
|
|
48
|
-
disabled: o ?? c
|
|
49
|
-
})
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
if (a.some(
|
|
53
|
-
(e) => A(i.type, e)
|
|
54
|
-
))
|
|
55
|
-
return [
|
|
56
|
-
C(i, {
|
|
57
|
-
disabled: o ?? c
|
|
58
|
-
})
|
|
59
|
-
];
|
|
60
|
-
const h = l.map((e) => e.displayName ?? e.name).join(", ").replace(/, (.+?)$/, " or $1");
|
|
61
|
-
return console.warn(
|
|
62
|
-
`ActionList: Invalid child at position ${f}. Only ${h} allowed.`
|
|
63
|
-
), [];
|
|
64
|
-
}), hasChoiceItems: s };
|
|
65
|
-
}, [m, a, n, o, r]);
|
|
66
|
-
}, { baseClassNamePrefix: O, classModifierPrefix: $, subElementClassPrefix: v } = M("action-list__group"), P = ({
|
|
67
|
-
children: m,
|
|
68
|
-
heading: o,
|
|
69
|
-
divider: n = !1,
|
|
70
|
-
kind: r = "action",
|
|
71
|
-
className: a,
|
|
72
|
-
disabled: s,
|
|
73
|
-
noResults: l,
|
|
74
|
-
indent: y,
|
|
75
|
-
role: i = "group",
|
|
76
|
-
...f
|
|
77
|
-
}) => {
|
|
78
|
-
const c = E(
|
|
79
|
-
t[O],
|
|
80
|
-
t[`${$}kind-${r}`],
|
|
81
|
-
l && t[`${$}no-results`],
|
|
82
|
-
s && t[`${$}disabled`],
|
|
83
|
-
a
|
|
84
|
-
), { children: u, hasChoiceItems: h } = B({
|
|
85
|
-
children: m,
|
|
86
|
-
disabled: s,
|
|
87
|
-
allowGroups: !1,
|
|
88
|
-
kind: r
|
|
89
|
-
}), e = k({
|
|
90
|
-
hasChoiceItems: h,
|
|
91
|
-
indentProp: y
|
|
92
|
-
}), p = typeof o == "string" ? /* @__PURE__ */ d("div", { className: t[`${v}heading`], children: o }) : o;
|
|
93
|
-
return /* @__PURE__ */ d(j, { kind: r, children: /* @__PURE__ */ d(w, { indent: e, children: /* @__PURE__ */ b("div", { className: c, role: i, ...f, children: [
|
|
94
|
-
p || null,
|
|
95
|
-
l && /* @__PURE__ */ d("div", { className: t[`${v}no-results`], children: l }),
|
|
96
|
-
u,
|
|
97
|
-
n && /* @__PURE__ */ d(
|
|
98
|
-
D,
|
|
99
|
-
{
|
|
100
|
-
borderColor: "01",
|
|
101
|
-
className: t[`${v}divider`],
|
|
102
|
-
role: "presentation",
|
|
103
|
-
"aria-orientation": void 0
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
] }) }) });
|
|
107
|
-
};
|
|
108
|
-
export {
|
|
109
|
-
P as A,
|
|
110
|
-
B as u
|
|
111
|
-
};
|