@apipass/design-system 1.21.0 → 1.22.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,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../../../vendor/clsx/dist/clsx.cjs"),l=require("react");;/* empty css */const g=require("../../primitives/Tooltip/Tooltip.cjs"),u=require("../../icons/IconInfo.cjs"),h=require("../../primitives/IconButton/IconButton.cjs"),m=l.forwardRef(function({title:i,description:t,descriptionButtonLabel:r,headerActions:s,children:n,className:a,...c},d){return e.jsxs("div",{ref:d,className:o.clsx("widget",a),...c,children:[e.jsxs("div",{className:"widget-header widget-drag-handle",children:[e.jsxs("span",{className:"widget-header-title-group",children:[e.jsx("span",{className:"widget-header-title",children:i}),t&&e.jsx(g.Tooltip,{content:t,placement:"bottom",offset:4,children:e.jsx(h.IconButton,{"aria-label":r,variant:"subtle",size:"small",className:"widget-header-description-trigger",children:e.jsx(u.IconInfo,{size:"14"})})})]}),s&&e.jsx("div",{className:"widget-header-actions",children:s})]}),e.jsx("div",{className:"widget-body",children:n})]})});exports.Widget=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("../../../vendor/clsx/dist/clsx.cjs"),i=require("react");;/* empty css */const y=require("../../primitives/Tooltip/Tooltip.cjs"),z=require("../../icons/IconInfo.cjs"),B=require("../../icons/IconChevronDown.cjs"),u=require("../../primitives/IconButton/IconButton.cjs"),S=i.forwardRef(function({title:g,description:o,descriptionButtonLabel:x,headerActions:n,isCollapsible:s,collapseButtonLabel:m,expandButtonLabel:h,collapsed:a,defaultCollapsed:j,onCollapsedChange:r,children:w,className:f,...v},I){const d=i.useId(),c=a!==void 0,[p,N]=i.useState(j??!1),t=s===!0&&(c?a===!0:p);function q(){const l=!t;c||N(l),r==null||r(l)}return e.jsxs("div",{ref:I,className:b.clsx("widget",f),...v,"data-collapsed":t||void 0,children:[e.jsxs("div",{className:"widget-header widget-drag-handle",children:[e.jsxs("span",{className:"widget-header-title-group",children:[e.jsx("span",{className:"widget-header-title",children:g}),o&&e.jsx(y.Tooltip,{content:o,placement:"bottom",offset:4,children:e.jsx(u.IconButton,{"aria-label":x,variant:"subtle",size:"small",className:"widget-header-description-trigger",children:e.jsx(z.IconInfo,{size:"14"})})})]}),(n||s)&&e.jsxs("div",{className:"widget-header-actions",children:[n,s&&e.jsx(u.IconButton,{"aria-label":t?h:m,"aria-expanded":!t,"aria-controls":d,variant:"subtle",size:"small",className:"widget-header-collapse-trigger",onPress:q,children:e.jsx(B.IconChevronDown,{size:"16",className:"widget-header-collapse-indicator"})})]})]}),e.jsx("div",{id:d,className:"widget-body",hidden:t,children:w})]})});exports.Widget=S;
2
2
  //# sourceMappingURL=Widget.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Widget.cjs","sources":["../../../../../src/ui/components/Widget/Widget.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, type ReactNode, forwardRef } from \"react\";\nimport { IconInfo } from \"icons\";\nimport { IconButton, Tooltip } from \"primitives\";\nimport \"./widget.css\";\n\ntype WidgetDescriptionProps =\n | { description?: undefined; descriptionButtonLabel?: undefined }\n | { description: ReactNode; descriptionButtonLabel: string };\n\nexport type WidgetProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\"> &\n WidgetDescriptionProps & {\n title: ReactNode;\n headerActions?: ReactNode;\n };\n\nexport const Widget = forwardRef<HTMLDivElement, WidgetProps>(function Widget(\n { title, description, descriptionButtonLabel, headerActions, children, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={clsx(\"widget\", className)} {...props}>\n <div className=\"widget-header widget-drag-handle\">\n <span className=\"widget-header-title-group\">\n <span className=\"widget-header-title\">{title}</span>\n {description && (\n <Tooltip content={description} placement=\"bottom\" offset={4}>\n <IconButton\n aria-label={descriptionButtonLabel}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-description-trigger\"\n >\n <IconInfo size=\"14\" />\n </IconButton>\n </Tooltip>\n )}\n </span>\n {headerActions && <div className=\"widget-header-actions\">{headerActions}</div>}\n </div>\n <div className=\"widget-body\">{children}</div>\n </div>\n );\n});\n"],"names":["Widget","forwardRef","title","description","descriptionButtonLabel","headerActions","children","className","props","ref","jsxs","clsx","jsx","Tooltip","IconButton","IconInfo"],"mappings":"0WAgBaA,EAASC,EAAAA,WAAwC,SAC5D,CAAE,MAAAC,EAAO,YAAAC,EAAa,uBAAAC,EAAwB,cAAAC,EAAe,SAAAC,EAAU,UAAAC,EAAW,GAAGC,CAAA,EACrFC,EACA,CACA,OACEC,OAAC,OAAI,IAAAD,EAAU,UAAWE,OAAK,SAAUJ,CAAS,EAAI,GAAGC,EACvD,SAAA,CAAAE,EAAAA,KAAC,MAAA,CAAI,UAAU,mCACb,SAAA,CAAAA,EAAAA,KAAC,OAAA,CAAK,UAAU,4BACd,SAAA,CAAAE,EAAAA,IAAC,OAAA,CAAK,UAAU,sBAAuB,SAAAV,EAAM,EAC5CC,SACEU,UAAA,CAAQ,QAASV,EAAa,UAAU,SAAS,OAAQ,EACxD,SAAAS,EAAAA,IAACE,EAAAA,WAAA,CACC,aAAYV,EACZ,QAAQ,SACR,KAAK,QACL,UAAU,oCAEV,SAAAQ,EAAAA,IAACG,EAAAA,SAAA,CAAS,KAAK,IAAA,CAAK,CAAA,CAAA,CACtB,CACF,CAAA,EAEJ,EACCV,GAAiBO,EAAAA,IAAC,MAAA,CAAI,UAAU,wBAAyB,SAAAP,CAAA,CAAc,CAAA,EAC1E,EACAO,EAAAA,IAAC,MAAA,CAAI,UAAU,cAAe,SAAAN,CAAA,CAAS,CAAA,EACzC,CAEJ,CAAC"}
1
+ {"version":3,"file":"Widget.cjs","sources":["../../../../../src/ui/components/Widget/Widget.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, type ReactNode, forwardRef, useId, useState } from \"react\";\nimport { IconChevronDown, IconInfo } from \"icons\";\nimport { IconButton, Tooltip } from \"primitives\";\nimport \"./widget.css\";\n\ntype WidgetDescriptionProps =\n | { description?: undefined; descriptionButtonLabel?: undefined }\n | { description: ReactNode; descriptionButtonLabel: string };\n\ntype WidgetCollapseProps =\n | {\n isCollapsible?: false;\n collapseButtonLabel?: undefined;\n expandButtonLabel?: undefined;\n collapsed?: undefined;\n defaultCollapsed?: undefined;\n onCollapsedChange?: undefined;\n }\n | {\n isCollapsible: true;\n collapseButtonLabel: string;\n expandButtonLabel: string;\n collapsed?: boolean;\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n };\n\nexport type WidgetProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\"> &\n WidgetDescriptionProps &\n WidgetCollapseProps & {\n title: ReactNode;\n headerActions?: ReactNode;\n };\n\nexport const Widget = forwardRef<HTMLDivElement, WidgetProps>(function Widget(\n {\n title,\n description,\n descriptionButtonLabel,\n headerActions,\n isCollapsible,\n collapseButtonLabel,\n expandButtonLabel,\n collapsed,\n defaultCollapsed,\n onCollapsedChange,\n children,\n className,\n ...props\n },\n ref,\n) {\n const bodyId: string = useId();\n const isCollapsedControlled: boolean = collapsed !== undefined;\n const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState<boolean>(\n defaultCollapsed ?? false,\n );\n const isCollapsed: boolean =\n isCollapsible === true && (isCollapsedControlled ? collapsed === true : uncontrolledCollapsed);\n\n function toggleCollapsed(): void {\n const nextCollapsed: boolean = !isCollapsed;\n if (!isCollapsedControlled) setUncontrolledCollapsed(nextCollapsed);\n onCollapsedChange?.(nextCollapsed);\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\"widget\", className)}\n {...props}\n data-collapsed={isCollapsed || undefined}\n >\n <div className=\"widget-header widget-drag-handle\">\n <span className=\"widget-header-title-group\">\n <span className=\"widget-header-title\">{title}</span>\n {description && (\n <Tooltip content={description} placement=\"bottom\" offset={4}>\n <IconButton\n aria-label={descriptionButtonLabel}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-description-trigger\"\n >\n <IconInfo size=\"14\" />\n </IconButton>\n </Tooltip>\n )}\n </span>\n {(headerActions || isCollapsible) && (\n <div className=\"widget-header-actions\">\n {headerActions}\n {isCollapsible && (\n <IconButton\n aria-label={isCollapsed ? expandButtonLabel : collapseButtonLabel}\n aria-expanded={!isCollapsed}\n aria-controls={bodyId}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-collapse-trigger\"\n onPress={toggleCollapsed}\n >\n <IconChevronDown size=\"16\" className=\"widget-header-collapse-indicator\" />\n </IconButton>\n )}\n </div>\n )}\n </div>\n <div id={bodyId} className=\"widget-body\" hidden={isCollapsed}>\n {children}\n </div>\n </div>\n );\n});\n"],"names":["Widget","forwardRef","title","description","descriptionButtonLabel","headerActions","isCollapsible","collapseButtonLabel","expandButtonLabel","collapsed","defaultCollapsed","onCollapsedChange","children","className","props","ref","bodyId","useId","isCollapsedControlled","uncontrolledCollapsed","setUncontrolledCollapsed","useState","isCollapsed","toggleCollapsed","nextCollapsed","jsxs","clsx","jsx","Tooltip","IconButton","IconInfo","IconChevronDown"],"mappings":"uZAmCaA,EAASC,EAAAA,WAAwC,SAC5D,CACE,MAAAC,EACA,YAAAC,EACA,uBAAAC,EACA,cAAAC,EACA,cAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,UAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAAiBC,EAAAA,MAAA,EACjBC,EAAiCT,IAAc,OAC/C,CAACU,EAAuBC,CAAwB,EAAIC,EAAAA,SACxDX,GAAoB,EAAA,EAEhBY,EACJhB,IAAkB,KAASY,EAAwBT,IAAc,GAAOU,GAE1E,SAASI,GAAwB,CAC/B,MAAMC,EAAyB,CAACF,EAC3BJ,GAAuBE,EAAyBI,CAAa,EAClEb,GAAA,MAAAA,EAAoBa,EACtB,CAEA,OACEC,EAAAA,KAAC,MAAA,CACC,IAAAV,EACA,UAAWW,EAAAA,KAAK,SAAUb,CAAS,EAClC,GAAGC,EACJ,iBAAgBQ,GAAe,OAE/B,SAAA,CAAAG,EAAAA,KAAC,MAAA,CAAI,UAAU,mCACb,SAAA,CAAAA,EAAAA,KAAC,OAAA,CAAK,UAAU,4BACd,SAAA,CAAAE,EAAAA,IAAC,OAAA,CAAK,UAAU,sBAAuB,SAAAzB,EAAM,EAC5CC,SACEyB,UAAA,CAAQ,QAASzB,EAAa,UAAU,SAAS,OAAQ,EACxD,SAAAwB,EAAAA,IAACE,EAAAA,WAAA,CACC,aAAYzB,EACZ,QAAQ,SACR,KAAK,QACL,UAAU,oCAEV,SAAAuB,EAAAA,IAACG,EAAAA,SAAA,CAAS,KAAK,IAAA,CAAK,CAAA,CAAA,CACtB,CACF,CAAA,EAEJ,GACEzB,GAAiBC,IACjBmB,EAAAA,KAAC,MAAA,CAAI,UAAU,wBACZ,SAAA,CAAApB,EACAC,GACCqB,EAAAA,IAACE,EAAAA,WAAA,CACC,aAAYP,EAAcd,EAAoBD,EAC9C,gBAAe,CAACe,EAChB,gBAAeN,EACf,QAAQ,SACR,KAAK,QACL,UAAU,iCACV,QAASO,EAET,SAAAI,EAAAA,IAACI,kBAAA,CAAgB,KAAK,KAAK,UAAU,kCAAA,CAAmC,CAAA,CAAA,CAC1E,CAAA,CAEJ,CAAA,EAEJ,EACAJ,MAAC,OAAI,GAAIX,EAAQ,UAAU,cAAc,OAAQM,EAC9C,SAAAV,CAAA,CACH,CAAA,CAAA,CAAA,CAGN,CAAC"}
@@ -1,32 +1,78 @@
1
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
- import { clsx as n } from "../../../vendor/clsx/dist/clsx.js";
3
- import { forwardRef as c } from "react";
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { clsx as j } from "../../../vendor/clsx/dist/clsx.js";
3
+ import { forwardRef as y, useId as W, useState as B } from "react";
4
4
  /* empty css */
5
- import { Tooltip as g } from "../../primitives/Tooltip/Tooltip.js";
6
- import { IconInfo as p } from "../../icons/IconInfo.js";
7
- import { IconButton as f } from "../../primitives/IconButton/IconButton.js";
8
- const j = c(function({ title: a, description: t, descriptionButtonLabel: d, headerActions: r, children: o, className: s, ...l }, m) {
9
- return /* @__PURE__ */ i("div", { ref: m, className: n("widget", s), ...l, children: [
10
- /* @__PURE__ */ i("div", { className: "widget-header widget-drag-handle", children: [
11
- /* @__PURE__ */ i("span", { className: "widget-header-title-group", children: [
12
- /* @__PURE__ */ e("span", { className: "widget-header-title", children: a }),
13
- t && /* @__PURE__ */ e(g, { content: t, placement: "bottom", offset: 4, children: /* @__PURE__ */ e(
14
- f,
15
- {
16
- "aria-label": d,
17
- variant: "subtle",
18
- size: "small",
19
- className: "widget-header-description-trigger",
20
- children: /* @__PURE__ */ e(p, { size: "14" })
21
- }
22
- ) })
23
- ] }),
24
- r && /* @__PURE__ */ e("div", { className: "widget-header-actions", children: r })
25
- ] }),
26
- /* @__PURE__ */ e("div", { className: "widget-body", children: o })
27
- ] });
5
+ import { Tooltip as D } from "../../primitives/Tooltip/Tooltip.js";
6
+ import { IconInfo as P } from "../../icons/IconInfo.js";
7
+ import { IconChevronDown as R } from "../../icons/IconChevronDown.js";
8
+ import { IconButton as m } from "../../primitives/IconButton/IconButton.js";
9
+ const J = y(function({
10
+ title: p,
11
+ description: a,
12
+ descriptionButtonLabel: f,
13
+ headerActions: d,
14
+ isCollapsible: i,
15
+ collapseButtonLabel: g,
16
+ expandButtonLabel: h,
17
+ collapsed: s,
18
+ defaultCollapsed: u,
19
+ onCollapsedChange: o,
20
+ children: w,
21
+ className: v,
22
+ ...N
23
+ }, x) {
24
+ const l = W(), c = s !== void 0, [I, b] = B(
25
+ u ?? !1
26
+ ), t = i === !0 && (c ? s === !0 : I);
27
+ function z() {
28
+ const n = !t;
29
+ c || b(n), o == null || o(n);
30
+ }
31
+ return /* @__PURE__ */ r(
32
+ "div",
33
+ {
34
+ ref: x,
35
+ className: j("widget", v),
36
+ ...N,
37
+ "data-collapsed": t || void 0,
38
+ children: [
39
+ /* @__PURE__ */ r("div", { className: "widget-header widget-drag-handle", children: [
40
+ /* @__PURE__ */ r("span", { className: "widget-header-title-group", children: [
41
+ /* @__PURE__ */ e("span", { className: "widget-header-title", children: p }),
42
+ a && /* @__PURE__ */ e(D, { content: a, placement: "bottom", offset: 4, children: /* @__PURE__ */ e(
43
+ m,
44
+ {
45
+ "aria-label": f,
46
+ variant: "subtle",
47
+ size: "small",
48
+ className: "widget-header-description-trigger",
49
+ children: /* @__PURE__ */ e(P, { size: "14" })
50
+ }
51
+ ) })
52
+ ] }),
53
+ (d || i) && /* @__PURE__ */ r("div", { className: "widget-header-actions", children: [
54
+ d,
55
+ i && /* @__PURE__ */ e(
56
+ m,
57
+ {
58
+ "aria-label": t ? h : g,
59
+ "aria-expanded": !t,
60
+ "aria-controls": l,
61
+ variant: "subtle",
62
+ size: "small",
63
+ className: "widget-header-collapse-trigger",
64
+ onPress: z,
65
+ children: /* @__PURE__ */ e(R, { size: "16", className: "widget-header-collapse-indicator" })
66
+ }
67
+ )
68
+ ] })
69
+ ] }),
70
+ /* @__PURE__ */ e("div", { id: l, className: "widget-body", hidden: t, children: w })
71
+ ]
72
+ }
73
+ );
28
74
  });
29
75
  export {
30
- j as Widget
76
+ J as Widget
31
77
  };
32
78
  //# sourceMappingURL=Widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Widget.js","sources":["../../../../../src/ui/components/Widget/Widget.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, type ReactNode, forwardRef } from \"react\";\nimport { IconInfo } from \"icons\";\nimport { IconButton, Tooltip } from \"primitives\";\nimport \"./widget.css\";\n\ntype WidgetDescriptionProps =\n | { description?: undefined; descriptionButtonLabel?: undefined }\n | { description: ReactNode; descriptionButtonLabel: string };\n\nexport type WidgetProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\"> &\n WidgetDescriptionProps & {\n title: ReactNode;\n headerActions?: ReactNode;\n };\n\nexport const Widget = forwardRef<HTMLDivElement, WidgetProps>(function Widget(\n { title, description, descriptionButtonLabel, headerActions, children, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={clsx(\"widget\", className)} {...props}>\n <div className=\"widget-header widget-drag-handle\">\n <span className=\"widget-header-title-group\">\n <span className=\"widget-header-title\">{title}</span>\n {description && (\n <Tooltip content={description} placement=\"bottom\" offset={4}>\n <IconButton\n aria-label={descriptionButtonLabel}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-description-trigger\"\n >\n <IconInfo size=\"14\" />\n </IconButton>\n </Tooltip>\n )}\n </span>\n {headerActions && <div className=\"widget-header-actions\">{headerActions}</div>}\n </div>\n <div className=\"widget-body\">{children}</div>\n </div>\n );\n});\n"],"names":["Widget","forwardRef","title","description","descriptionButtonLabel","headerActions","children","className","props","ref","jsxs","clsx","jsx","Tooltip","IconButton","IconInfo"],"mappings":";;;;;;;AAgBO,MAAMA,IAASC,EAAwC,SAC5D,EAAE,OAAAC,GAAO,aAAAC,GAAa,wBAAAC,GAAwB,eAAAC,GAAe,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GACrFC,GACA;AACA,SACE,gBAAAC,EAAC,SAAI,KAAAD,GAAU,WAAWE,EAAK,UAAUJ,CAAS,GAAI,GAAGC,GACvD,UAAA;AAAA,IAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,oCACb,UAAA;AAAA,MAAA,gBAAAA,EAAC,QAAA,EAAK,WAAU,6BACd,UAAA;AAAA,QAAA,gBAAAE,EAAC,QAAA,EAAK,WAAU,uBAAuB,UAAAV,GAAM;AAAA,QAC5CC,uBACEU,GAAA,EAAQ,SAASV,GAAa,WAAU,UAAS,QAAQ,GACxD,UAAA,gBAAAS;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,cAAYV;AAAA,YACZ,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,WAAU;AAAA,YAEV,UAAA,gBAAAQ,EAACG,GAAA,EAAS,MAAK,KAAA,CAAK;AAAA,UAAA;AAAA,QAAA,EACtB,CACF;AAAA,MAAA,GAEJ;AAAA,MACCV,KAAiB,gBAAAO,EAAC,OAAA,EAAI,WAAU,yBAAyB,UAAAP,EAAA,CAAc;AAAA,IAAA,GAC1E;AAAA,IACA,gBAAAO,EAAC,OAAA,EAAI,WAAU,eAAe,UAAAN,EAAA,CAAS;AAAA,EAAA,GACzC;AAEJ,CAAC;"}
1
+ {"version":3,"file":"Widget.js","sources":["../../../../../src/ui/components/Widget/Widget.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { type ComponentPropsWithoutRef, type ReactNode, forwardRef, useId, useState } from \"react\";\nimport { IconChevronDown, IconInfo } from \"icons\";\nimport { IconButton, Tooltip } from \"primitives\";\nimport \"./widget.css\";\n\ntype WidgetDescriptionProps =\n | { description?: undefined; descriptionButtonLabel?: undefined }\n | { description: ReactNode; descriptionButtonLabel: string };\n\ntype WidgetCollapseProps =\n | {\n isCollapsible?: false;\n collapseButtonLabel?: undefined;\n expandButtonLabel?: undefined;\n collapsed?: undefined;\n defaultCollapsed?: undefined;\n onCollapsedChange?: undefined;\n }\n | {\n isCollapsible: true;\n collapseButtonLabel: string;\n expandButtonLabel: string;\n collapsed?: boolean;\n defaultCollapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n };\n\nexport type WidgetProps = Omit<ComponentPropsWithoutRef<\"div\">, \"title\"> &\n WidgetDescriptionProps &\n WidgetCollapseProps & {\n title: ReactNode;\n headerActions?: ReactNode;\n };\n\nexport const Widget = forwardRef<HTMLDivElement, WidgetProps>(function Widget(\n {\n title,\n description,\n descriptionButtonLabel,\n headerActions,\n isCollapsible,\n collapseButtonLabel,\n expandButtonLabel,\n collapsed,\n defaultCollapsed,\n onCollapsedChange,\n children,\n className,\n ...props\n },\n ref,\n) {\n const bodyId: string = useId();\n const isCollapsedControlled: boolean = collapsed !== undefined;\n const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState<boolean>(\n defaultCollapsed ?? false,\n );\n const isCollapsed: boolean =\n isCollapsible === true && (isCollapsedControlled ? collapsed === true : uncontrolledCollapsed);\n\n function toggleCollapsed(): void {\n const nextCollapsed: boolean = !isCollapsed;\n if (!isCollapsedControlled) setUncontrolledCollapsed(nextCollapsed);\n onCollapsedChange?.(nextCollapsed);\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\"widget\", className)}\n {...props}\n data-collapsed={isCollapsed || undefined}\n >\n <div className=\"widget-header widget-drag-handle\">\n <span className=\"widget-header-title-group\">\n <span className=\"widget-header-title\">{title}</span>\n {description && (\n <Tooltip content={description} placement=\"bottom\" offset={4}>\n <IconButton\n aria-label={descriptionButtonLabel}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-description-trigger\"\n >\n <IconInfo size=\"14\" />\n </IconButton>\n </Tooltip>\n )}\n </span>\n {(headerActions || isCollapsible) && (\n <div className=\"widget-header-actions\">\n {headerActions}\n {isCollapsible && (\n <IconButton\n aria-label={isCollapsed ? expandButtonLabel : collapseButtonLabel}\n aria-expanded={!isCollapsed}\n aria-controls={bodyId}\n variant=\"subtle\"\n size=\"small\"\n className=\"widget-header-collapse-trigger\"\n onPress={toggleCollapsed}\n >\n <IconChevronDown size=\"16\" className=\"widget-header-collapse-indicator\" />\n </IconButton>\n )}\n </div>\n )}\n </div>\n <div id={bodyId} className=\"widget-body\" hidden={isCollapsed}>\n {children}\n </div>\n </div>\n );\n});\n"],"names":["Widget","forwardRef","title","description","descriptionButtonLabel","headerActions","isCollapsible","collapseButtonLabel","expandButtonLabel","collapsed","defaultCollapsed","onCollapsedChange","children","className","props","ref","bodyId","useId","isCollapsedControlled","uncontrolledCollapsed","setUncontrolledCollapsed","useState","isCollapsed","toggleCollapsed","nextCollapsed","jsxs","clsx","jsx","Tooltip","IconButton","IconInfo","IconChevronDown"],"mappings":";;;;;;;;AAmCO,MAAMA,IAASC,EAAwC,SAC5D;AAAA,EACE,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAiBC,EAAA,GACjBC,IAAiCT,MAAc,QAC/C,CAACU,GAAuBC,CAAwB,IAAIC;AAAA,IACxDX,KAAoB;AAAA,EAAA,GAEhBY,IACJhB,MAAkB,OAASY,IAAwBT,MAAc,KAAOU;AAE1E,WAASI,IAAwB;AAC/B,UAAMC,IAAyB,CAACF;AAChC,IAAKJ,KAAuBE,EAAyBI,CAAa,GAClEb,KAAA,QAAAA,EAAoBa;AAAA,EACtB;AAEA,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAV;AAAA,MACA,WAAWW,EAAK,UAAUb,CAAS;AAAA,MAClC,GAAGC;AAAA,MACJ,kBAAgBQ,KAAe;AAAA,MAE/B,UAAA;AAAA,QAAA,gBAAAG,EAAC,OAAA,EAAI,WAAU,oCACb,UAAA;AAAA,UAAA,gBAAAA,EAAC,QAAA,EAAK,WAAU,6BACd,UAAA;AAAA,YAAA,gBAAAE,EAAC,QAAA,EAAK,WAAU,uBAAuB,UAAAzB,GAAM;AAAA,YAC5CC,uBACEyB,GAAA,EAAQ,SAASzB,GAAa,WAAU,UAAS,QAAQ,GACxD,UAAA,gBAAAwB;AAAA,cAACE;AAAA,cAAA;AAAA,gBACC,cAAYzB;AAAA,gBACZ,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,WAAU;AAAA,gBAEV,UAAA,gBAAAuB,EAACG,GAAA,EAAS,MAAK,KAAA,CAAK;AAAA,cAAA;AAAA,YAAA,EACtB,CACF;AAAA,UAAA,GAEJ;AAAA,WACEzB,KAAiBC,MACjB,gBAAAmB,EAAC,OAAA,EAAI,WAAU,yBACZ,UAAA;AAAA,YAAApB;AAAA,YACAC,KACC,gBAAAqB;AAAA,cAACE;AAAA,cAAA;AAAA,gBACC,cAAYP,IAAcd,IAAoBD;AAAA,gBAC9C,iBAAe,CAACe;AAAA,gBAChB,iBAAeN;AAAA,gBACf,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,WAAU;AAAA,gBACV,SAASO;AAAA,gBAET,UAAA,gBAAAI,EAACI,GAAA,EAAgB,MAAK,MAAK,WAAU,mCAAA,CAAmC;AAAA,cAAA;AAAA,YAAA;AAAA,UAC1E,EAAA,CAEJ;AAAA,QAAA,GAEJ;AAAA,QACA,gBAAAJ,EAAC,SAAI,IAAIX,GAAQ,WAAU,eAAc,QAAQM,GAC9C,UAAAV,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
@@ -7,7 +7,22 @@ type WidgetDescriptionProps = {
7
7
  description: ReactNode;
8
8
  descriptionButtonLabel: string;
9
9
  };
10
- export type WidgetProps = Omit<ComponentPropsWithoutRef<"div">, "title"> & WidgetDescriptionProps & {
10
+ type WidgetCollapseProps = {
11
+ isCollapsible?: false;
12
+ collapseButtonLabel?: undefined;
13
+ expandButtonLabel?: undefined;
14
+ collapsed?: undefined;
15
+ defaultCollapsed?: undefined;
16
+ onCollapsedChange?: undefined;
17
+ } | {
18
+ isCollapsible: true;
19
+ collapseButtonLabel: string;
20
+ expandButtonLabel: string;
21
+ collapsed?: boolean;
22
+ defaultCollapsed?: boolean;
23
+ onCollapsedChange?: (collapsed: boolean) => void;
24
+ };
25
+ export type WidgetProps = Omit<ComponentPropsWithoutRef<"div">, "title"> & WidgetDescriptionProps & WidgetCollapseProps & {
11
26
  title: ReactNode;
12
27
  headerActions?: ReactNode;
13
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apipass/design-system",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "type": "module",
5
5
  "description": "APIPass React Design System",
6
6
  "sideEffects": [