@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.
- package/dist/lib/embedded-styles.js +1 -1
- package/dist/lib/lib.index.cjs +1 -1
- package/dist/lib/lib.index.js +688 -687
- package/dist/lib/style.css +1 -1
- package/dist/lib/ui/components/DataTable/DataTable.cjs +1 -1
- package/dist/lib/ui/components/DataTable/DataTable.cjs.map +1 -1
- package/dist/lib/ui/components/DataTable/DataTable.js +117 -171
- package/dist/lib/ui/components/DataTable/DataTable.js.map +1 -1
- package/dist/lib/ui/components/Widget/Widget.cjs +1 -1
- package/dist/lib/ui/components/Widget/Widget.cjs.map +1 -1
- package/dist/lib/ui/components/Widget/Widget.js +73 -27
- package/dist/lib/ui/components/Widget/Widget.js.map +1 -1
- package/dist/lib/ui/primitives/Pagination/Pagination.cjs +1 -1
- package/dist/lib/ui/primitives/Pagination/Pagination.cjs.map +1 -1
- package/dist/lib/ui/primitives/Pagination/Pagination.js +70 -55
- package/dist/lib/ui/primitives/Pagination/Pagination.js.map +1 -1
- package/dist/types/ui/components/Widget/Widget.d.ts +16 -1
- package/dist/types/ui/primitives/Pagination/Pagination.d.ts +12 -2
- package/package.json +1 -1
|
@@ -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 {
|
|
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,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
|
|
3
|
-
import { forwardRef as
|
|
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
|
|
6
|
-
import { IconInfo as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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 {
|
|
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;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/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
|
|
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 …\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,MAAO,eAAgBA,CACzB,CAEO,SAASC,EAAWD,EAAwB,CACjD,GAAID,EAAkBC,CAAK,EAAG,CAC5B,KAAM,CAAE,KAAAE,EAAM,WAAAC,EAAY,aAAAC,EAAc,cAAAC,EAAe,UAAAC,EAAW,UAAAC,GAAcP,EAChF,OAAIG,GAAc,EAAU,KAE1BK,OAAC,OAAI,aAAW,kBAAkB,UAAWC,EAAAA,KAAKF,EAAW,YAAY,EACvE,SAAA,CAAAG,EAAAA,IAACC,EAAA,CAAmB,WAAYT,GAAQ,EAAG,QAAS,IAAME,EAAa,KAAK,IAAI,EAAGF,EAAO,CAAC,CAAC,EACzF,SAAAG,EACH,EACAK,EAAAA,IAACE,EAAA,CACE,SAAAC,EAAqBX,EAAMC,CAAU,EAAE,IAAI,CAACW,EAAGC,IAC9CD,IAAM,YACHE,EAAA,CAAA,EAAmB,OAAOD,CAAC,EAAI,EAEhCL,EAAAA,IAACO,GAAuB,QAASH,IAAMZ,EAAM,QAAS,IAAME,EAAaU,CAAC,EACvE,SAAA,OAAOA,CAAC,CAAA,EADUA,CAErB,CAAA,EAGN,EACAJ,EAAAA,IAACQ,EAAA,CAAe,WAAYhB,GAAQC,EAAY,QAAS,IAAMC,EAAa,KAAK,IAAID,EAAYD,EAAO,CAAC,CAAC,EACvG,SAAAI,CAAA,CACH,CAAA,EACF,CAEJ,CACA,KAAM,CAAE,aAAca,EAAY,kBAAmB,UAAAZ,EAAW,GAAGa,GAAS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,CAAE,KAAAA,CAAA,EAAS,CAAA,EACvB,QAAAC,EACA,aAAY,QAAQE,CAAQ,GAC5B,eAAcM,EAAU,OAAS,OACjC,UAAWrB,EAAAA,KAAK,iBAAkBqB,GAAW,uBAAuB,EAEnE,SAAAN,CAAA,CAAA,CAGP,CAEO,SAASR,GAAgB,CAC9B,aACG,MAAA,CAAI,cAAY,OAAO,UAAU,iBAAiB,SAAA,IAEnD,CAEJ,CAEO,SAASH,EAAqBiB,EAAiBC,EAAsC,CAC1F,GAAIA,GAAS,EAAG,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 {
|
|
2
|
-
import { clsx as
|
|
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
|
|
5
|
-
import { IconArrowRight as
|
|
6
|
-
import { useMediaQuery as
|
|
7
|
-
import { AnchorOrButton as
|
|
8
|
-
function
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
25
|
+
function h({
|
|
17
26
|
href: a = null,
|
|
18
|
-
onPress:
|
|
19
|
-
isDisabled:
|
|
20
|
-
children:
|
|
27
|
+
onPress: n,
|
|
28
|
+
isDisabled: e = !1,
|
|
29
|
+
children: r = "Previous"
|
|
21
30
|
}) {
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
31
|
+
return /* @__PURE__ */ u(
|
|
32
|
+
c,
|
|
24
33
|
{
|
|
25
34
|
...a !== null ? { href: a } : {},
|
|
26
|
-
onPress:
|
|
27
|
-
isDisabled:
|
|
28
|
-
className:
|
|
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__ */
|
|
32
|
-
|
|
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:
|
|
40
|
-
isDisabled:
|
|
41
|
-
children:
|
|
48
|
+
onPress: n,
|
|
49
|
+
isDisabled: e = !1,
|
|
50
|
+
children: r = "Next"
|
|
42
51
|
}) {
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
|
|
52
|
+
return /* @__PURE__ */ u(
|
|
53
|
+
c,
|
|
45
54
|
{
|
|
46
55
|
...a !== null ? { href: a } : {},
|
|
47
|
-
onPress:
|
|
48
|
-
isDisabled:
|
|
49
|
-
className:
|
|
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
|
-
|
|
53
|
-
/* @__PURE__ */
|
|
61
|
+
r,
|
|
62
|
+
/* @__PURE__ */ i(f, { size: "16" })
|
|
54
63
|
]
|
|
55
64
|
}
|
|
56
65
|
);
|
|
57
66
|
}
|
|
58
|
-
function
|
|
59
|
-
const { isTabletUp:
|
|
60
|
-
return
|
|
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
|
|
71
|
+
function A({
|
|
63
72
|
href: a,
|
|
64
|
-
onPress:
|
|
65
|
-
children:
|
|
66
|
-
current:
|
|
73
|
+
onPress: n,
|
|
74
|
+
children: e,
|
|
75
|
+
current: r = !1
|
|
67
76
|
}) {
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
-
|
|
77
|
+
return /* @__PURE__ */ i(
|
|
78
|
+
c,
|
|
70
79
|
{
|
|
71
80
|
...a ? { href: a } : {},
|
|
72
|
-
onPress:
|
|
73
|
-
"aria-label": `Page ${
|
|
74
|
-
"aria-current":
|
|
75
|
-
className:
|
|
76
|
-
children:
|
|
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
|
|
81
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
98
|
+
B as Pagination,
|
|
99
|
+
D as PaginationGap,
|
|
100
|
+
L as PaginationList,
|
|
87
101
|
x as PaginationNext,
|
|
88
|
-
|
|
89
|
-
|
|
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
|
|
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 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 …\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":";;;;;;;AAoBA,SAASA,EACPC,GACoC;AACpC,SAAO,gBAAgBA;AACzB;AAEO,SAASC,EAAWD,GAAwB;AACjD,MAAID,EAAkBC,CAAK,GAAG;AAC5B,UAAM,EAAE,MAAAE,GAAM,YAAAC,GAAY,cAAAC,GAAc,eAAAC,GAAe,WAAAC,GAAW,WAAAC,MAAcP;AAChF,WAAIG,KAAc,IAAU,OAE1B,gBAAAK,EAAC,SAAI,cAAW,mBAAkB,WAAWC,EAAKF,GAAW,YAAY,GACvE,UAAA;AAAA,MAAA,gBAAAG,EAACC,GAAA,EAAmB,YAAYT,KAAQ,GAAG,SAAS,MAAME,EAAa,KAAK,IAAI,GAAGF,IAAO,CAAC,CAAC,GACzF,UAAAG,GACH;AAAA,MACA,gBAAAK,EAACE,GAAA,EACE,UAAAC,EAAqBX,GAAMC,CAAU,EAAE;AAAA,QAAI,CAACW,GAAGC,MAC9CD,MAAM,0BACHE,GAAA,CAAA,GAAmB,OAAOD,CAAC,EAAI,IAEhC,gBAAAL,EAACO,KAAuB,SAASH,MAAMZ,GAAM,SAAS,MAAME,EAAaU,CAAC,GACvE,UAAA,OAAOA,CAAC,EAAA,GADUA,CAErB;AAAA,MAAA,GAGN;AAAA,MACA,gBAAAJ,EAACQ,GAAA,EAAe,YAAYhB,KAAQC,GAAY,SAAS,MAAMC,EAAa,KAAK,IAAID,GAAYD,IAAO,CAAC,CAAC,GACvG,UAAAI,EAAA,CACH;AAAA,IAAA,GACF;AAAA,EAEJ;AACA,QAAM,EAAE,cAAca,IAAY,mBAAmB,WAAAZ,GAAW,GAAGa,MAASpB;AAC5E,SAAO,gBAAAU,EAAC,OAAA,E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A,EAC7B,MAAAI;AAAA,EACA,SAAAC;AAAA,EACA,UAAAE;AAAA,EACA,SAAAM,IAAU;AACZ,GAKG;AACD,SACE,gBAAApB;AAAA,IAACe;AAAA,IAAA;AAAA,MACE,GAAIJ,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
|
-
|
|
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
|
|
4
|
-
export
|
|
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 | "...">;
|