@apipass/design-system 1.20.1 → 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 +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,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,GAEJ;AAAA,QACA,gBAAAJ,EAAC,SAAI,IAAIX,GAAQ,WAAU,eAAc,QAAQM,GAC9C,UAAAV,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
@@ -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");;/* empty css */const r=require("../../icons/IconArrowLeft.cjs"),l=require("../../icons/IconArrowRight.cjs"),u=require("../../hooks/useMediaQuery.cjs"),s=require("../../utils/AnchorOrButton.cjs");function c({"aria-label":a="Page navigation",className:n,...i}){const t=o.clsx(n,"pagination");return e.jsx("nav",{"aria-label":a,...i,className:t})}function g({href:a=null,onPress:n,isDisabled:i=!1,children:t="Previous"}){return e.jsxs(s.AnchorOrButton,{...a!==null?{href:a}:{},onPress:n,isDisabled:i||a===null&&!n,className:o.clsx("pagination-btn","pagination-nav"),"aria-label":"Previous page",children:[e.jsx(r.IconArrowLeft,{size:"16"}),t]})}function P({href:a=null,onPress:n,isDisabled:i=!1,children:t="Next"}){return e.jsxs(s.AnchorOrButton,{...a!==null?{href:a}:{},onPress:n,isDisabled:i||a===null&&!n,className:o.clsx("pagination-btn","pagination-nav"),"aria-label":"Next page",children:[t,e.jsx(l.IconArrowRight,{size:"16"})]})}function p({children:a}){const{isTabletUp:n}=u.useMediaQuery();return n&&e.jsx("span",{className:"pagination-list",children:a})}function x({href:a,onPress:n,children:i,current:t=!1}){return e.jsx(s.AnchorOrButton,{...a?{href:a}:{},onPress:n,"aria-label":`Page ${i}`,"aria-current":t?"page":void 0,className:o.clsx("pagination-btn",t&&"pagination-btn-active"),children:i})}function b(){return e.jsx("div",{"aria-hidden":"true",className:"pagination-gap",children:"…"})}exports.Pagination=c;exports.PaginationGap=b;exports.PaginationList=p;exports.PaginationNext=P;exports.PaginationPage=x;exports.PaginationPrevious=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("../../../vendor/clsx/dist/clsx.cjs");;/* empty css */const h=require("../../icons/IconArrowLeft.cjs"),N=require("../../icons/IconArrowRight.cjs"),A=require("../../hooks/useMediaQuery.cjs"),c=require("../../utils/AnchorOrButton.cjs");function q(a){return"totalPages"in a}function L(a){if(q(a)){const{page:t,totalPages:r,onPageChange:u,previousLabel:m,nextLabel:p,className:f}=a;return r<=1?null:i.jsxs("nav",{"aria-label":"Page navigation",className:l.clsx(f,"pagination"),children:[i.jsx(g,{isDisabled:t<=1,onPress:()=>u(Math.max(1,t-1)),children:m}),i.jsx(x,{children:j(t,r).map((o,v)=>o==="..."?i.jsx(b,{},`gap-${v}`):i.jsx(d,{current:o===t,onPress:()=>u(o),children:String(o)},o))}),i.jsx(P,{isDisabled:t>=r,onPress:()=>u(Math.min(r,t+1)),children:p})]})}const{"aria-label":n="Page navigation",className:e,...s}=a;return i.jsx("nav",{"aria-label":n,...s,className:l.clsx(e,"pagination")})}function g({href:a=null,onPress:n,isDisabled:e=!1,children:s="Previous"}){return i.jsxs(c.AnchorOrButton,{...a!==null?{href:a}:{},onPress:n,isDisabled:e||a===null&&!n,className:l.clsx("pagination-btn","pagination-nav"),"aria-label":"Previous page",children:[i.jsx(h.IconArrowLeft,{size:"16"}),s]})}function P({href:a=null,onPress:n,isDisabled:e=!1,children:s="Next"}){return i.jsxs(c.AnchorOrButton,{...a!==null?{href:a}:{},onPress:n,isDisabled:e||a===null&&!n,className:l.clsx("pagination-btn","pagination-nav"),"aria-label":"Next page",children:[s,i.jsx(N.IconArrowRight,{size:"16"})]})}function x({children:a}){const{isTabletUp:n}=A.useMediaQuery();return n&&i.jsx("span",{className:"pagination-list",children:a})}function d({href:a,onPress:n,children:e,current:s=!1}){return i.jsx(c.AnchorOrButton,{...a?{href:a}:{},onPress:n,"aria-label":`Page ${e}`,"aria-current":s?"page":void 0,className:l.clsx("pagination-btn",s&&"pagination-btn-active"),children:e})}function b(){return i.jsx("div",{"aria-hidden":"true",className:"pagination-gap",children:"…"})}function j(a,n){if(n<=6)return Array.from({length:n},(t,r)=>r+1);const e=[1,2,3],s=[n-1,n];return a<=4?[...e,"...",...s]:a>=n-3?[1,2,"...",n-2,n-1,n]:[1,"...",a-1,a,a+1,"...",n]}exports.Pagination=L;exports.PaginationGap=b;exports.PaginationList=x;exports.PaginationNext=P;exports.PaginationPage=d;exports.PaginationPrevious=g;exports.buildPaginationPages=j;
2
2
  //# sourceMappingURL=Pagination.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.cjs","sources":["../../../../../src/ui/primitives/Pagination/Pagination.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useMediaQuery } from \"hooks\";\nimport { IconArrowLeft, IconArrowRight } from \"icons\";\nimport type React from \"react\";\nimport { AnchorOrButton } from \"utils\";\nimport \"./pagination.css\";\n\nexport type PaginationProps = React.ComponentPropsWithoutRef<\"nav\">;\nexport function Pagination({\n \"aria-label\": ariaLabel = \"Page navigation\",\n className,\n ...props\n}: PaginationProps) {\n const classNames = clsx(className, \"pagination\");\n return <nav aria-label={ariaLabel} {...props} className={classNames} />;\n}\n\nexport function PaginationPrevious({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Previous\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Previous page\"\n >\n <IconArrowLeft size=\"16\" />\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationNext({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Next\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Next page\"\n >\n {children}\n <IconArrowRight size=\"16\" />\n </AnchorOrButton>\n );\n}\n\nexport function PaginationList({ children }: { children: React.ReactNode }) {\n const { isTabletUp } = useMediaQuery();\n return isTabletUp && <span className=\"pagination-list\">{children}</span>;\n}\n\nexport function PaginationPage({\n href,\n onPress,\n children,\n current = false,\n}: {\n href?: string;\n onPress?: () => void;\n children: string;\n current?: boolean;\n}) {\n return (\n <AnchorOrButton\n {...(href ? { href } : {})}\n onPress={onPress}\n aria-label={`Page ${children}`}\n aria-current={current ? \"page\" : undefined}\n className={clsx(\"pagination-btn\", current && \"pagination-btn-active\")}\n >\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationGap() {\n return (\n <div aria-hidden=\"true\" className=\"pagination-gap\">\n &hellip;\n </div>\n );\n}\n"],"names":["Pagination","ariaLabel","className","props","classNames","clsx","PaginationPrevious","href","onPress","isDisabled","children","jsxs","AnchorOrButton","jsx","IconArrowLeft","PaginationNext","IconArrowRight","PaginationList","isTabletUp","useMediaQuery","PaginationPage","current","PaginationGap"],"mappings":"yXAQO,SAASA,EAAW,CACzB,aAAcC,EAAY,kBAC1B,UAAAC,EACA,GAAGC,CACL,EAAoB,CAClB,MAAMC,EAAaC,EAAAA,KAAKH,EAAW,YAAY,EAC/C,aAAQ,MAAA,CAAI,aAAYD,EAAY,GAAGE,EAAO,UAAWC,EAAY,CACvE,CAEO,SAASE,EAAmB,CACjC,KAAAC,EAAO,KACP,QAAAC,EACA,WAAAC,EAAa,GACb,SAAAC,EAAW,UACb,EAKG,CACD,OACEC,EAAAA,KAACC,EAAAA,eAAA,CACE,GAAIL,IAAS,KAAO,CAAE,KAAAA,CAAA,EAAS,CAAA,EAChC,QAAAC,EACA,WAAYC,GAAeF,IAAS,MAAQ,CAACC,EAC7C,UAAWH,EAAAA,KAAK,iBAAkB,gBAAgB,EAClD,aAAW,gBAEX,SAAA,CAAAQ,EAAAA,IAACC,EAAAA,cAAA,CAAc,KAAK,IAAA,CAAK,EACxBJ,CAAA,CAAA,CAAA,CAGP,CAEO,SAASK,EAAe,CAC7B,KAAAR,EAAO,KACP,QAAAC,EACA,WAAAC,EAAa,GACb,SAAAC,EAAW,MACb,EAKG,CACD,OACEC,EAAAA,KAACC,EAAAA,eAAA,CACE,GAAIL,IAAS,KAAO,CAAE,KAAAA,CAAA,EAAS,CAAA,EAChC,QAAAC,EACA,WAAYC,GAAeF,IAAS,MAAQ,CAACC,EAC7C,UAAWH,EAAAA,KAAK,iBAAkB,gBAAgB,EAClD,aAAW,YAEV,SAAA,CAAAK,EACDG,EAAAA,IAACG,EAAAA,eAAA,CAAe,KAAK,IAAA,CAAK,CAAA,CAAA,CAAA,CAGhC,CAEO,SAASC,EAAe,CAAE,SAAAP,GAA2C,CAC1E,KAAM,CAAE,WAAAQ,CAAA,EAAeC,gBAAA,EACvB,OAAOD,GAAcL,EAAAA,IAAC,OAAA,CAAK,UAAU,kBAAmB,SAAAH,EAAS,CACnE,CAEO,SAASU,EAAe,CAC7B,KAAAb,EACA,QAAAC,EACA,SAAAE,EACA,QAAAW,EAAU,EACZ,EAKG,CACD,OACER,EAAAA,IAACD,EAAAA,eAAA,CACE,GAAIL,EAAO,CAAE,KAAAA,CAAA,EAAS,CAAA,EACvB,QAAAC,EACA,aAAY,QAAQE,CAAQ,GAC5B,eAAcW,EAAU,OAAS,OACjC,UAAWhB,EAAAA,KAAK,iBAAkBgB,GAAW,uBAAuB,EAEnE,SAAAX,CAAA,CAAA,CAGP,CAEO,SAASY,GAAgB,CAC9B,aACG,MAAA,CAAI,cAAY,OAAO,UAAU,iBAAiB,SAAA,IAEnD,CAEJ"}
1
+ {"version":3,"file":"Pagination.cjs","sources":["../../../../../src/ui/primitives/Pagination/Pagination.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useMediaQuery } from \"hooks\";\nimport { IconArrowLeft, IconArrowRight } from \"icons\";\nimport type React from \"react\";\nimport { AnchorOrButton } from \"utils\";\nimport \"./pagination.css\";\n\nexport type PaginationManualProps = React.ComponentPropsWithoutRef<\"nav\">;\n\nexport type PaginationControlledProps = {\n page: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n previousLabel: string;\n nextLabel: string;\n className?: string;\n};\n\nexport type PaginationProps = PaginationManualProps | PaginationControlledProps;\n\nfunction isControlledProps(\n props: PaginationProps,\n): props is PaginationControlledProps {\n return \"totalPages\" in props;\n}\n\nexport function Pagination(props: PaginationProps) {\n if (isControlledProps(props)) {\n const { page, totalPages, onPageChange, previousLabel, nextLabel, className } = props;\n if (totalPages <= 1) return null;\n return (\n <nav aria-label=\"Page navigation\" className={clsx(className, \"pagination\")}>\n <PaginationPrevious isDisabled={page <= 1} onPress={() => onPageChange(Math.max(1, page - 1))}>\n {previousLabel}\n </PaginationPrevious>\n <PaginationList>\n {buildPaginationPages(page, totalPages).map((p, i) =>\n p === \"...\" ? (\n <PaginationGap key={`gap-${i}`} />\n ) : (\n <PaginationPage key={p} current={p === page} onPress={() => onPageChange(p)}>\n {String(p)}\n </PaginationPage>\n ),\n )}\n </PaginationList>\n <PaginationNext isDisabled={page >= totalPages} onPress={() => onPageChange(Math.min(totalPages, page + 1))}>\n {nextLabel}\n </PaginationNext>\n </nav>\n );\n }\n const { \"aria-label\": ariaLabel = \"Page navigation\", className, ...rest } = props;\n return <nav aria-label={ariaLabel} {...rest} className={clsx(className, \"pagination\")} />;\n}\n\nexport function PaginationPrevious({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Previous\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Previous page\"\n >\n <IconArrowLeft size=\"16\" />\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationNext({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Next\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Next page\"\n >\n {children}\n <IconArrowRight size=\"16\" />\n </AnchorOrButton>\n );\n}\n\nexport function PaginationList({ children }: { children: React.ReactNode }) {\n const { isTabletUp } = useMediaQuery();\n return isTabletUp && <span className=\"pagination-list\">{children}</span>;\n}\n\nexport function PaginationPage({\n href,\n onPress,\n children,\n current = false,\n}: {\n href?: string;\n onPress?: () => void;\n children: string;\n current?: boolean;\n}) {\n return (\n <AnchorOrButton\n {...(href ? { href } : {})}\n onPress={onPress}\n aria-label={`Page ${children}`}\n aria-current={current ? \"page\" : undefined}\n className={clsx(\"pagination-btn\", current && \"pagination-btn-active\")}\n >\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationGap() {\n return (\n <div aria-hidden=\"true\" className=\"pagination-gap\">\n &hellip;\n </div>\n );\n}\n\nexport function buildPaginationPages(current: number, total: number): Array<number | \"...\"> {\n if (total <= 6) return Array.from({ length: total }, (_, i) => i + 1);\n const head = [1, 2, 3];\n const tail = [total - 1, total];\n if (current <= 4) return [...head, \"...\", ...tail];\n if (current >= total - 3) return [1, 2, \"...\", total - 2, total - 1, total];\n return [1, \"...\", current - 1, current, current + 1, \"...\", total];\n}\n"],"names":["isControlledProps","props","Pagination","page","totalPages","onPageChange","previousLabel","nextLabel","className","jsxs","clsx","jsx","PaginationPrevious","PaginationList","buildPaginationPages","p","i","PaginationGap","PaginationPage","PaginationNext","ariaLabel","rest","href","onPress","isDisabled","children","AnchorOrButton","IconArrowLeft","IconArrowRight","isTabletUp","useMediaQuery","current","total","_","head","tail"],"mappings":"yXAoBA,SAASA,EACPC,EACoC,CACpC,MAA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AG,OAAO,MAAM,KAAK,CAAE,OAAQA,CAAA,EAAS,CAACC,EAAGjB,IAAMA,EAAI,CAAC,EACpE,MAAMkB,EAAO,CAAC,EAAG,EAAG,CAAC,EACfC,EAAO,CAACH,EAAQ,EAAGA,CAAK,EAC9B,OAAID,GAAW,EAAU,CAAC,GAAGG,EAAM,MAAO,GAAGC,CAAI,EAC7CJ,GAAWC,EAAQ,EAAU,CAAC,EAAG,EAAG,MAAOA,EAAQ,EAAGA,EAAQ,EAAGA,CAAK,EACnE,CAAC,EAAG,MAAOD,EAAU,EAAGA,EAASA,EAAU,EAAG,MAAOC,CAAK,CACnE"}
@@ -1,91 +1,106 @@
1
- import { jsx as o, jsxs as r } from "react/jsx-runtime";
2
- import { clsx as e } from "../../../vendor/clsx/dist/clsx.js";
1
+ import { jsxs as u, jsx as i } from "react/jsx-runtime";
2
+ import { clsx as o } from "../../../vendor/clsx/dist/clsx.js";
3
3
  /* empty css */
4
- import { IconArrowLeft as s } from "../../icons/IconArrowLeft.js";
5
- import { IconArrowRight as u } from "../../icons/IconArrowRight.js";
6
- import { useMediaQuery as g } from "../../hooks/useMediaQuery.js";
7
- import { AnchorOrButton as l } from "../../utils/AnchorOrButton.js";
8
- function P({
9
- "aria-label": a = "Page navigation",
10
- className: i,
11
- ...n
12
- }) {
13
- const t = e(i, "pagination");
14
- return /* @__PURE__ */ o("nav", { "aria-label": a, ...n, className: t });
4
+ import { IconArrowLeft as d } from "../../icons/IconArrowLeft.js";
5
+ import { IconArrowRight as f } from "../../icons/IconArrowRight.js";
6
+ import { useMediaQuery as v } from "../../hooks/useMediaQuery.js";
7
+ import { AnchorOrButton as c } from "../../utils/AnchorOrButton.js";
8
+ function N(a) {
9
+ return "totalPages" in a;
10
+ }
11
+ function B(a) {
12
+ if (N(a)) {
13
+ const { page: t, totalPages: s, onPageChange: g, previousLabel: m, nextLabel: p, className: P } = a;
14
+ return s <= 1 ? null : /* @__PURE__ */ u("nav", { "aria-label": "Page navigation", className: o(P, "pagination"), children: [
15
+ /* @__PURE__ */ i(h, { isDisabled: t <= 1, onPress: () => g(Math.max(1, t - 1)), children: m }),
16
+ /* @__PURE__ */ i(L, { children: M(t, s).map(
17
+ (l, b) => l === "..." ? /* @__PURE__ */ i(D, {}, `gap-${b}`) : /* @__PURE__ */ i(A, { current: l === t, onPress: () => g(l), children: String(l) }, l)
18
+ ) }),
19
+ /* @__PURE__ */ i(x, { isDisabled: t >= s, onPress: () => g(Math.min(s, t + 1)), children: p })
20
+ ] });
21
+ }
22
+ const { "aria-label": n = "Page navigation", className: e, ...r } = a;
23
+ return /* @__PURE__ */ i("nav", { "aria-label": n, ...r, className: o(e, "pagination") });
15
24
  }
16
- function d({
25
+ function h({
17
26
  href: a = null,
18
- onPress: i,
19
- isDisabled: n = !1,
20
- children: t = "Previous"
27
+ onPress: n,
28
+ isDisabled: e = !1,
29
+ children: r = "Previous"
21
30
  }) {
22
- return /* @__PURE__ */ r(
23
- l,
31
+ return /* @__PURE__ */ u(
32
+ c,
24
33
  {
25
34
  ...a !== null ? { href: a } : {},
26
- onPress: i,
27
- isDisabled: n || a === null && !i,
28
- className: e("pagination-btn", "pagination-nav"),
35
+ onPress: n,
36
+ isDisabled: e || a === null && !n,
37
+ className: o("pagination-btn", "pagination-nav"),
29
38
  "aria-label": "Previous page",
30
39
  children: [
31
- /* @__PURE__ */ o(s, { size: "16" }),
32
- t
40
+ /* @__PURE__ */ i(d, { size: "16" }),
41
+ r
33
42
  ]
34
43
  }
35
44
  );
36
45
  }
37
46
  function x({
38
47
  href: a = null,
39
- onPress: i,
40
- isDisabled: n = !1,
41
- children: t = "Next"
48
+ onPress: n,
49
+ isDisabled: e = !1,
50
+ children: r = "Next"
42
51
  }) {
43
- return /* @__PURE__ */ r(
44
- l,
52
+ return /* @__PURE__ */ u(
53
+ c,
45
54
  {
46
55
  ...a !== null ? { href: a } : {},
47
- onPress: i,
48
- isDisabled: n || a === null && !i,
49
- className: e("pagination-btn", "pagination-nav"),
56
+ onPress: n,
57
+ isDisabled: e || a === null && !n,
58
+ className: o("pagination-btn", "pagination-nav"),
50
59
  "aria-label": "Next page",
51
60
  children: [
52
- t,
53
- /* @__PURE__ */ o(u, { size: "16" })
61
+ r,
62
+ /* @__PURE__ */ i(f, { size: "16" })
54
63
  ]
55
64
  }
56
65
  );
57
66
  }
58
- function A({ children: a }) {
59
- const { isTabletUp: i } = g();
60
- return i && /* @__PURE__ */ o("span", { className: "pagination-list", children: a });
67
+ function L({ children: a }) {
68
+ const { isTabletUp: n } = v();
69
+ return n && /* @__PURE__ */ i("span", { className: "pagination-list", children: a });
61
70
  }
62
- function j({
71
+ function A({
63
72
  href: a,
64
- onPress: i,
65
- children: n,
66
- current: t = !1
73
+ onPress: n,
74
+ children: e,
75
+ current: r = !1
67
76
  }) {
68
- return /* @__PURE__ */ o(
69
- l,
77
+ return /* @__PURE__ */ i(
78
+ c,
70
79
  {
71
80
  ...a ? { href: a } : {},
72
- onPress: i,
73
- "aria-label": `Page ${n}`,
74
- "aria-current": t ? "page" : void 0,
75
- className: e("pagination-btn", t && "pagination-btn-active"),
76
- children: n
81
+ onPress: n,
82
+ "aria-label": `Page ${e}`,
83
+ "aria-current": r ? "page" : void 0,
84
+ className: o("pagination-btn", r && "pagination-btn-active"),
85
+ children: e
77
86
  }
78
87
  );
79
88
  }
80
- function w() {
81
- return /* @__PURE__ */ o("div", { "aria-hidden": "true", className: "pagination-gap", children: "…" });
89
+ function D() {
90
+ return /* @__PURE__ */ i("div", { "aria-hidden": "true", className: "pagination-gap", children: "…" });
91
+ }
92
+ function M(a, n) {
93
+ if (n <= 6) return Array.from({ length: n }, (t, s) => s + 1);
94
+ const e = [1, 2, 3], r = [n - 1, n];
95
+ return a <= 4 ? [...e, "...", ...r] : a >= n - 3 ? [1, 2, "...", n - 2, n - 1, n] : [1, "...", a - 1, a, a + 1, "...", n];
82
96
  }
83
97
  export {
84
- P as Pagination,
85
- w as PaginationGap,
86
- A as PaginationList,
98
+ B as Pagination,
99
+ D as PaginationGap,
100
+ L as PaginationList,
87
101
  x as PaginationNext,
88
- j as PaginationPage,
89
- d as PaginationPrevious
102
+ A as PaginationPage,
103
+ h as PaginationPrevious,
104
+ M as buildPaginationPages
90
105
  };
91
106
  //# sourceMappingURL=Pagination.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.js","sources":["../../../../../src/ui/primitives/Pagination/Pagination.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useMediaQuery } from \"hooks\";\nimport { IconArrowLeft, IconArrowRight } from \"icons\";\nimport type React from \"react\";\nimport { AnchorOrButton } from \"utils\";\nimport \"./pagination.css\";\n\nexport type PaginationProps = React.ComponentPropsWithoutRef<\"nav\">;\nexport function Pagination({\n \"aria-label\": ariaLabel = \"Page navigation\",\n className,\n ...props\n}: PaginationProps) {\n const classNames = clsx(className, \"pagination\");\n return <nav aria-label={ariaLabel} {...props} className={classNames} />;\n}\n\nexport function PaginationPrevious({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Previous\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Previous page\"\n >\n <IconArrowLeft size=\"16\" />\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationNext({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Next\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Next page\"\n >\n {children}\n <IconArrowRight size=\"16\" />\n </AnchorOrButton>\n );\n}\n\nexport function PaginationList({ children }: { children: React.ReactNode }) {\n const { isTabletUp } = useMediaQuery();\n return isTabletUp && <span className=\"pagination-list\">{children}</span>;\n}\n\nexport function PaginationPage({\n href,\n onPress,\n children,\n current = false,\n}: {\n href?: string;\n onPress?: () => void;\n children: string;\n current?: boolean;\n}) {\n return (\n <AnchorOrButton\n {...(href ? { href } : {})}\n onPress={onPress}\n aria-label={`Page ${children}`}\n aria-current={current ? \"page\" : undefined}\n className={clsx(\"pagination-btn\", current && \"pagination-btn-active\")}\n >\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationGap() {\n return (\n <div aria-hidden=\"true\" className=\"pagination-gap\">\n &hellip;\n </div>\n );\n}\n"],"names":["Pagination","ariaLabel","className","props","classNames","clsx","PaginationPrevious","href","onPress","isDisabled","children","jsxs","AnchorOrButton","jsx","IconArrowLeft","PaginationNext","IconArrowRight","PaginationList","isTabletUp","useMediaQuery","PaginationPage","current","PaginationGap"],"mappings":";;;;;;;AAQO,SAASA,EAAW;AAAA,EACzB,cAAcC,IAAY;AAAA,EAC1B,WAAAC;AAAA,EACA,GAAGC;AACL,GAAoB;AAClB,QAAMC,IAAaC,EAAKH,GAAW,YAAY;AAC/C,2BAAQ,OAAA,EAAI,cAAYD,GAAY,GAAGE,GAAO,WAAWC,GAAY;AACvE;AAEO,SAASE,EAAmB;AAAA,EACjC,MAAAC,IAAO;AAAA,EACP,SAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AACb,GAKG;AACD,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAIL,MAAS,OAAO,EAAE,MAAAA,EAAA,IAAS,CAAA;AAAA,MAChC,SAAAC;AAAA,MACA,YAAYC,KAAeF,MAAS,QAAQ,CAACC;AAAA,MAC7C,WAAWH,EAAK,kBAAkB,gBAAgB;AAAA,MAClD,cAAW;AAAA,MAEX,UAAA;AAAA,QAAA,gBAAAQ,EAACC,GAAA,EAAc,MAAK,KAAA,CAAK;AAAA,QACxBJ;AAAA,MAA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"sourcesContent":["import clsx from \"clsx\";\nimport { useMediaQuery } from \"hooks\";\nimport { IconArrowLeft, IconArrowRight } from \"icons\";\nimport type React from \"react\";\nimport { AnchorOrButton } from \"utils\";\nimport \"./pagination.css\";\n\nexport type PaginationManualProps = React.ComponentPropsWithoutRef<\"nav\">;\n\nexport type PaginationControlledProps = {\n page: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n previousLabel: string;\n nextLabel: string;\n className?: string;\n};\n\nexport type PaginationProps = PaginationManualProps | PaginationControlledProps;\n\nfunction isControlledProps(\n props: PaginationProps,\n): props is PaginationControlledProps {\n return \"totalPages\" in props;\n}\n\nexport function Pagination(props: PaginationProps) {\n if (isControlledProps(props)) {\n const { page, totalPages, onPageChange, previousLabel, nextLabel, className } = props;\n if (totalPages <= 1) return null;\n return (\n <nav aria-label=\"Page navigation\" className={clsx(className, \"pagination\")}>\n <PaginationPrevious isDisabled={page <= 1} onPress={() => onPageChange(Math.max(1, page - 1))}>\n {previousLabel}\n </PaginationPrevious>\n <PaginationList>\n {buildPaginationPages(page, totalPages).map((p, i) =>\n p === \"...\" ? (\n <PaginationGap key={`gap-${i}`} />\n ) : (\n <PaginationPage key={p} current={p === page} onPress={() => onPageChange(p)}>\n {String(p)}\n </PaginationPage>\n ),\n )}\n </PaginationList>\n <PaginationNext isDisabled={page >= totalPages} onPress={() => onPageChange(Math.min(totalPages, page + 1))}>\n {nextLabel}\n </PaginationNext>\n </nav>\n );\n }\n const { \"aria-label\": ariaLabel = \"Page navigation\", className, ...rest } = props;\n return <nav aria-label={ariaLabel} {...rest} className={clsx(className, \"pagination\")} />;\n}\n\nexport function PaginationPrevious({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Previous\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Previous page\"\n >\n <IconArrowLeft size=\"16\" />\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationNext({\n href = null,\n onPress,\n isDisabled = false,\n children = \"Next\",\n}: {\n href?: string | null;\n onPress?: () => void;\n isDisabled?: boolean;\n children?: React.ReactNode;\n}) {\n return (\n <AnchorOrButton\n {...(href !== null ? { href } : {})}\n onPress={onPress}\n isDisabled={isDisabled || (href === null && !onPress)}\n className={clsx(\"pagination-btn\", \"pagination-nav\")}\n aria-label=\"Next page\"\n >\n {children}\n <IconArrowRight size=\"16\" />\n </AnchorOrButton>\n );\n}\n\nexport function PaginationList({ children }: { children: React.ReactNode }) {\n const { isTabletUp } = useMediaQuery();\n return isTabletUp && <span className=\"pagination-list\">{children}</span>;\n}\n\nexport function PaginationPage({\n href,\n onPress,\n children,\n current = false,\n}: {\n href?: string;\n onPress?: () => void;\n children: string;\n current?: boolean;\n}) {\n return (\n <AnchorOrButton\n {...(href ? { href } : {})}\n onPress={onPress}\n aria-label={`Page ${children}`}\n aria-current={current ? \"page\" : undefined}\n className={clsx(\"pagination-btn\", current && \"pagination-btn-active\")}\n >\n {children}\n </AnchorOrButton>\n );\n}\n\nexport function PaginationGap() {\n return (\n <div aria-hidden=\"true\" className=\"pagination-gap\">\n &hellip;\n </div>\n );\n}\n\nexport function buildPaginationPages(current: number, total: number): Array<number | \"...\"> {\n if (total <= 6) return Array.from({ length: total }, (_, i) => i + 1);\n const head = [1, 2, 3];\n const tail = [total - 1, total];\n if (current <= 4) return [...head, \"...\", ...tail];\n if (current >= total - 3) return [1, 2, \"...\", total - 2, total - 1, total];\n return [1, \"...\", current - 1, current, current + 1, \"...\", total];\n}\n"],"names":["isControlledProps","props","Pagination","page","totalPages","onPageChange","previousLabel","nextLabel","className","jsxs","clsx","jsx","PaginationPrevious","PaginationList","buildPaginationPages","p","i","PaginationGap","PaginationPage","PaginationNext","ariaLabel","rest","href","onPress","isDisabled","children","AnchorOrButton","I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,IAAO,EAAE,MAAAA,EAAA,IAAS,CAAA;AAAA,MACvB,SAAAC;AAAA,MACA,cAAY,QAAQE,CAAQ;AAAA,MAC5B,gBAAcM,IAAU,SAAS;AAAA,MACjC,WAAWrB,EAAK,kBAAkBqB,KAAW,uBAAuB;AAAA,MAEnE,UAAAN;AAAA,IAAA;AAAA,EAAA;AAGP;AAEO,SAASR,IAAgB;AAC9B,2BACG,OAAA,EAAI,eAAY,QAAO,WAAU,kBAAiB,UAAA,KAEnD;AAEJ;AAEO,SAASH,EAAqBiB,GAAiBC,GAAsC;AAC1F,MAAIA,KAAS,EAAG,QAAO,MAAM,KAAK,EAAE,QAAQA,EAAA,GAAS,CAACC,GAAGjB,MAAMA,IAAI,CAAC;AACpE,QAAMkB,IAAO,CAAC,GAAG,GAAG,CAAC,GACfC,IAAO,CAACH,IAAQ,GAAGA,CAAK;AAC9B,SAAID,KAAW,IAAU,CAAC,GAAGG,GAAM,OAAO,GAAGC,CAAI,IAC7CJ,KAAWC,IAAQ,IAAU,CAAC,GAAG,GAAG,OAAOA,IAAQ,GAAGA,IAAQ,GAAGA,CAAK,IACnE,CAAC,GAAG,OAAOD,IAAU,GAAGA,GAASA,IAAU,GAAG,OAAOC,CAAK;AACnE;"}
@@ -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
  };
@@ -1,7 +1,16 @@
1
1
  import type React from "react";
2
2
  import "./pagination.css";
3
- export type PaginationProps = React.ComponentPropsWithoutRef<"nav">;
4
- export declare function Pagination({ "aria-label": ariaLabel, className, ...props }: PaginationProps): import("react/jsx-runtime").JSX.Element;
3
+ export type PaginationManualProps = React.ComponentPropsWithoutRef<"nav">;
4
+ export type PaginationControlledProps = {
5
+ page: number;
6
+ totalPages: number;
7
+ onPageChange: (page: number) => void;
8
+ previousLabel: string;
9
+ nextLabel: string;
10
+ className?: string;
11
+ };
12
+ export type PaginationProps = PaginationManualProps | PaginationControlledProps;
13
+ export declare function Pagination(props: PaginationProps): import("react/jsx-runtime").JSX.Element | null;
5
14
  export declare function PaginationPrevious({ href, onPress, isDisabled, children, }: {
6
15
  href?: string | null;
7
16
  onPress?: () => void;
@@ -24,3 +33,4 @@ export declare function PaginationPage({ href, onPress, children, current, }: {
24
33
  current?: boolean;
25
34
  }): import("react/jsx-runtime").JSX.Element;
26
35
  export declare function PaginationGap(): import("react/jsx-runtime").JSX.Element;
36
+ export declare function buildPaginationPages(current: number, total: number): Array<number | "...">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apipass/design-system",
3
- "version": "1.20.1",
3
+ "version": "1.22.0",
4
4
  "type": "module",
5
5
  "description": "APIPass React Design System",
6
6
  "sideEffects": [