@viasat/beam-react 2.18.0 → 2.19.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.
@@ -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.Bw5vZpeb.js");exports.ActionListGroup=e.ActionListGroup;
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 e } from "../../chunks/ActionList.Group.CUHMD8Oo.js";
10
+ import { A as n } from "../../chunks/ActionList.Group.a-ke8J4W.js";
11
+ import "../../utils/functions.es.js";
10
12
  export {
11
- e as ActionListGroup
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.Bw5vZpeb.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;
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.CUHMD8Oo.js";
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.Bw5vZpeb.js");require("./ActionList.context.cjs.js");exports.useActionListChildren=e.useActionListChildren;
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.CUHMD8Oo.js";
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
@@ -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.Bw5vZpeb.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;
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.CUHMD8Oo.js";
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.18.0",
3
+ "version": "2.19.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.18.0",
63
- "@viasat/beam-shared": "2.18.0",
64
- "@viasat/beam-styles": "2.18.0",
65
- "@viasat/beam-tokens": "2.18.0",
66
- "@viasat/beam-icons": "2.18.0",
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",
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
- };