@apipass/design-system 1.20.0 → 1.21.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":"WidgetGrid.cjs","sources":["../../../../../src/ui/components/WidgetGrid/WidgetGrid.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { Children, isValidElement, type CSSProperties, type ReactNode } from \"react\";\nimport GridLayout, { type Layout } from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport \"react-resizable/css/styles.css\";\nimport \"./widgetgrid.css\";\n\nconst ResizableGridLayout = /* @__PURE__ */ GridLayout.WidthProvider(GridLayout);\n\nconst WIDGET_DRAG_HANDLE_SELECTOR = \".widget-drag-handle\";\nconst WIDGET_HEADER_ACTIONS_SELECTOR = \".widget-header-actions\";\n\nexport interface WidgetLayoutItem {\n id: string;\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\nexport interface WidgetGridProps {\n layout: WidgetLayoutItem[];\n onLayoutChange?: (layout: WidgetLayoutItem[]) => void;\n cols?: number;\n rowHeight?: number;\n isEditable?: boolean;\n isDraggable?: boolean;\n isResizable?: boolean;\n className?: string;\n style?: CSSProperties;\n children: ReactNode;\n}\n\nexport function WidgetGrid({\n layout,\n onLayoutChange,\n cols = 12,\n rowHeight = 80,\n isEditable = false,\n isDraggable,\n isResizable,\n className,\n style,\n children,\n}: WidgetGridProps) {\n const rglLayout: Layout[] = layout.map(({ id, x, y, w, h }) => ({ i: id, x, y, w, h }));\n\n function handleLayoutChange(nextLayout: Layout[]): void {\n onLayoutChange?.(nextLayout.map(({ i, x, y, w, h }) => ({ id: i, x, y, w, h })));\n }\n\n return (\n <ResizableGridLayout\n className={clsx(\"widget-grid\", className)}\n style={style}\n layout={rglLayout}\n cols={cols}\n rowHeight={rowHeight}\n isDraggable={isDraggable ?? isEditable}\n isResizable={isResizable ?? isEditable}\n draggableHandle={WIDGET_DRAG_HANDLE_SELECTOR}\n draggableCancel={WIDGET_HEADER_ACTIONS_SELECTOR}\n onLayoutChange={handleLayoutChange}\n >\n {Children.map(children, (child) =>\n isValidElement(child) ? (\n // react-grid-layout clones this direct child to attach position styles and,\n // when resizable, appends the resize handle as one of its children. Widget\n // renders its own children inside .widget-body, so cloning Widget directly\n // would bury the handle there instead of at the item's edge. This wrapper\n // keeps Widget's markup untouched and gives react-grid-layout a plain node\n // to clone onto.\n <div key={child.key} className=\"widget-grid-item\">\n {child}\n </div>\n ) : (\n child\n ),\n )}\n </ResizableGridLayout>\n );\n}\n"],"names":["ResizableGridLayout","GridLayout","WIDGET_DRAG_HANDLE_SELECTOR","WIDGET_HEADER_ACTIONS_SELECTOR","WidgetGrid","layout","onLayoutChange","cols","rowHeight","isEditable","isDraggable","isResizable","className","style","children","rglLayout","id","x","y","w","h","handleLayoutChange","nextLayout","jsx","clsx","Children","child","isValidElement"],"mappings":"+XAOA,MAAMA,EAAsCC,EAAW,cAAcA,CAAU,EAEzEC,EAA8B,sBAC9BC,EAAiC,yBAuBhC,SAASC,EAAW,CACzB,OAAAC,EACA,eAAAC,EACA,KAAAC,EAAO,GACP,UAAAC,EAAY,GACZ,WAAAC,EAAa,GACb,YAAAC,EACA,YAAAC,EACA,UAAAC,EACA,MAAAC,EACA,SAAAC,CACF,EAAoB,CAClB,MAAMC,EAAsBV,EAAO,IAAI,CAAC,CAAE,GAAAW,EAAI,EAAAC,EAAG,EAAAC,EAAG,EAAAC,EAAG,EAAAC,CAAA,KAAS,CAAE,EAAGJ,EAAI,EAAAC,EAAG,EAAAC,EAAG,EAAAC,EAAG,EAAAC,GAAI,EAEtF,SAASC,EAAmBC,EAA4B,CACtDhB,GAAA,MAAAA,EAAiBgB,EAAW,IAAI,CAAC,CAAE,EAAG,EAAAL,EAAG,EAAAC,EAAG,EAAAC,EAAG,EAAAC,CAAA,KAAS,CAAE,GAAI,EAAG,EAAAH,EAAG,EAAAC,EAAG,EAAAC,EAAG,EAAAC,CAAA,EAAI,EAChF,CAEA,OACEG,EAAAA,IAACvB,EAAA,CACC,UAAWwB,EAAAA,KAAK,cAAeZ,CAAS,EACxC,MAAAC,EACA,OAAQE,EACR,KAAAR,EACA,UAAAC,EACA,YAAaE,GAAeD,EAC5B,YAAaE,GAAeF,EAC5B,gBAAiBP,EACjB,gBAAiBC,EACjB,eAAgBkB,EAEf,SAAAI,EAAAA,SAAS,IAAIX,EAAWY,GACvBC,EAAAA,eAAeD,CAAK,QAOjB,MAAA,CAAoB,UAAU,mBAC5B,SAAAA,CAAA,EADOA,EAAM,GAEhB,EAEAA,CAAA,CAEJ,CAAA,CAGN"}
1
+ {"version":3,"file":"WidgetGrid.cjs","sources":["../../../../../src/ui/components/WidgetGrid/WidgetGrid.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { isValidElement, type CSSProperties, type ReactNode } from \"react\";\nimport GridLayout, { type Layout } from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport \"react-resizable/css/styles.css\";\nimport \"./widgetgrid.css\";\n\nconst ResizableGridLayout = /* @__PURE__ */ GridLayout.WidthProvider(GridLayout);\n\nconst WIDGET_DRAG_HANDLE_SELECTOR = \".widget-drag-handle\";\nconst WIDGET_HEADER_ACTIONS_SELECTOR = \".widget-header-actions\";\n\nexport interface WidgetLayoutItem {\n id: string;\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\nexport interface WidgetGridProps {\n layout: WidgetLayoutItem[];\n onLayoutChange?: (layout: WidgetLayoutItem[]) => void;\n cols?: number;\n rowHeight?: number;\n isEditable?: boolean;\n isDraggable?: boolean;\n isResizable?: boolean;\n className?: string;\n style?: CSSProperties;\n children: ReactNode;\n}\n\nexport function WidgetGrid({\n layout,\n onLayoutChange,\n cols = 12,\n rowHeight = 80,\n isEditable = false,\n isDraggable,\n isResizable,\n className,\n style,\n children,\n}: WidgetGridProps) {\n const rglLayout: Layout[] = layout.map(({ id, x, y, w, h }) => ({ i: id, x, y, w, h }));\n\n function handleLayoutChange(nextLayout: Layout[]): void {\n onLayoutChange?.(nextLayout.map(({ i, x, y, w, h }) => ({ id: i, x, y, w, h })));\n }\n\n return (\n <ResizableGridLayout\n className={clsx(\"widget-grid\", className)}\n style={style}\n layout={rglLayout}\n cols={cols}\n rowHeight={rowHeight}\n isDraggable={isDraggable ?? isEditable}\n isResizable={isResizable ?? isEditable}\n draggableHandle={WIDGET_DRAG_HANDLE_SELECTOR}\n draggableCancel={WIDGET_HEADER_ACTIONS_SELECTOR}\n onLayoutChange={handleLayoutChange}\n >\n {(Array.isArray(children) ? children : [children]).map((child) =>\n isValidElement(child) ? (\n // react-grid-layout clones this direct child to attach position styles and,\n // when resizable, appends the resize handle as one of its children. Widget\n // renders its own children inside .widget-body, so cloning Widget directly\n // would bury the handle there instead of at the item's edge. This wrapper\n // keeps Widget's markup untouched and gives react-grid-layout a plain node\n // to clone onto.\n //\n // A plain array .map() is used here (not Children.map/Children.forEach/\n // Children.toArray): those APIs re-escape each child's key on every call,\n // prefixing it with React's internal `.$` marker regardless of the key set\n // on the returned element. react-grid-layout derives each item's id from\n // this wrapper's resolved key, and that id round-trips back into `layout` on\n // the next render, so the escaped key compounded every render (id -> `.$id`\n // -> `.$.$id` -> ...) and never converged, causing an infinite update loop\n // as soon as a consumer re-rendered with the reported layout. Plain .map()\n // leaves the explicit key untouched.\n <div key={child.key} className=\"widget-grid-item\">\n {child}\n </div>\n ) : (\n child\n ),\n )}\n </ResizableGridLayout>\n );\n}\n"],"names":["ResizableGridLayout","GridLayout","WIDGET_DRAG_HANDLE_SELECTOR","WIDGET_HEADER_ACTIONS_SELECTOR","WidgetGrid","layout","onLayoutChange","cols","rowHeight","isEditable","isDraggable","isResizable","className","style","children","rglLayout","id","x","y","w","h","handleLayoutChange","nextLayout","i","jsx","clsx","child","isValidElement"],"mappings":"+XAOA,MAAMA,EAAsCC,EAAW,cAAcA,CAAU,EAEzEC,EAA8B,sBAC9BC,EAAiC,yBAuBhC,SAASC,EAAW,CACzB,OAAAC,EACA,eAAAC,EACA,KAAAC,EAAO,GACP,UAAAC,EAAY,GACZ,WAAAC,EAAa,GACb,YAAAC,EACA,YAAAC,EACA,UAAAC,EACA,MAAAC,EACA,SAAAC,CACF,EAAoB,CAClB,MAAMC,EAAsBV,EAAO,IAAI,CAAC,CAAE,GAAAW,EAAI,EAAAC,EAAG,EAAAC,EAAG,EAAAC,EAAG,EAAAC,CAAA,KAAS,CAAE,EAAGJ,EAAI,EAAAC,EAAG,EAAAC,EAAG,EAAAC,EAAG,EAAAC,GAAI,EAEtF,SAASC,EAAmBC,EAA4B,CACtDhB,GAAA,MAAAA,EAAiBgB,EAAW,IAAI,CAAC,CAAE,EAAAC,EAAG,EAAAN,EAAG,EAAAC,EAAG,EAAAC,EAAG,EAAAC,CAAA,KAAS,CAAE,GAAIG,EAAG,EAAAN,EAAG,EAAAC,EAAG,EAAAC,EAAG,EAAAC,CAAA,EAAI,EAChF,CAEA,OACEI,EAAAA,IAACxB,EAAA,CACC,UAAWyB,EAAAA,KAAK,cAAeb,CAAS,EACxC,MAAAC,EACA,OAAQE,EACR,KAAAR,EACA,UAAAC,EACA,YAAaE,GAAeD,EAC5B,YAAaE,GAAeF,EAC5B,gBAAiBP,EACjB,gBAAiBC,EACjB,eAAgBkB,EAEd,gBAAM,QAAQP,CAAQ,EAAIA,EAAW,CAACA,CAAQ,GAAG,IAAKY,GACtDC,EAAAA,eAAeD,CAAK,QAiBjB,MAAA,CAAoB,UAAU,mBAC5B,SAAAA,CAAA,EADOA,EAAM,GAEhB,EAEAA,CAAA,CAEJ,CAAA,CAGN"}
@@ -1,51 +1,60 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { clsx as u } from "../../../vendor/clsx/dist/clsx.js";
3
- import { Children as T, isValidElement as b } from "react";
4
- import l from "../../../_virtual/index.js";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { clsx as _ } from "../../../vendor/clsx/dist/clsx.js";
3
+ import { isValidElement as u } from "react";
4
+ import g from "../../../_virtual/index.js";
5
5
  /* empty css */
6
6
  /* empty css */
7
7
  /* empty css */
8
- const w = /* @__PURE__ */ l.WidthProvider(l), A = ".widget-drag-handle", L = ".widget-header-actions";
8
+ const y = /* @__PURE__ */ g.WidthProvider(g), T = ".widget-drag-handle", b = ".widget-header-actions";
9
9
  function O({
10
- layout: s,
11
- onLayoutChange: r,
12
- cols: g = 12,
10
+ layout: l,
11
+ onLayoutChange: i,
12
+ cols: p = 12,
13
13
  rowHeight: n = 80,
14
- isEditable: o = !1,
15
- isDraggable: p,
14
+ isEditable: m = !1,
15
+ isDraggable: E,
16
16
  isResizable: c,
17
- className: E,
18
- style: f,
19
- children: D
17
+ className: f,
18
+ style: A,
19
+ children: a
20
20
  }) {
21
- const G = s.map(({ id: i, x: e, y: t, w: a, h: d }) => ({ i, x: e, y: t, w: a, h: d }));
22
- function R(i) {
23
- r == null || r(i.map(({ i: e, x: t, y: a, w: d, h: _ }) => ({ id: e, x: t, y: a, w: d, h: _ })));
21
+ const D = l.map(({ id: r, x: e, y: t, w: o, h: d }) => ({ i: r, x: e, y: t, w: o, h: d }));
22
+ function G(r) {
23
+ i == null || i(r.map(({ i: e, x: t, y: o, w: d, h: R }) => ({ id: e, x: t, y: o, w: d, h: R })));
24
24
  }
25
- return /* @__PURE__ */ m(
26
- w,
25
+ return /* @__PURE__ */ s(
26
+ y,
27
27
  {
28
- className: u("widget-grid", E),
29
- style: f,
30
- layout: G,
31
- cols: g,
28
+ className: _("widget-grid", f),
29
+ style: A,
30
+ layout: D,
31
+ cols: p,
32
32
  rowHeight: n,
33
- isDraggable: p ?? o,
34
- isResizable: c ?? o,
35
- draggableHandle: A,
36
- draggableCancel: L,
37
- onLayoutChange: R,
38
- children: T.map(
39
- D,
40
- (i) => b(i) ? (
33
+ isDraggable: E ?? m,
34
+ isResizable: c ?? m,
35
+ draggableHandle: T,
36
+ draggableCancel: b,
37
+ onLayoutChange: G,
38
+ children: (Array.isArray(a) ? a : [a]).map(
39
+ (r) => u(r) ? (
41
40
  // react-grid-layout clones this direct child to attach position styles and,
42
41
  // when resizable, appends the resize handle as one of its children. Widget
43
42
  // renders its own children inside .widget-body, so cloning Widget directly
44
43
  // would bury the handle there instead of at the item's edge. This wrapper
45
44
  // keeps Widget's markup untouched and gives react-grid-layout a plain node
46
45
  // to clone onto.
47
- /* @__PURE__ */ m("div", { className: "widget-grid-item", children: i }, i.key)
48
- ) : i
46
+ //
47
+ // A plain array .map() is used here (not Children.map/Children.forEach/
48
+ // Children.toArray): those APIs re-escape each child's key on every call,
49
+ // prefixing it with React's internal `.$` marker regardless of the key set
50
+ // on the returned element. react-grid-layout derives each item's id from
51
+ // this wrapper's resolved key, and that id round-trips back into `layout` on
52
+ // the next render, so the escaped key compounded every render (id -> `.$id`
53
+ // -> `.$.$id` -> ...) and never converged, causing an infinite update loop
54
+ // as soon as a consumer re-rendered with the reported layout. Plain .map()
55
+ // leaves the explicit key untouched.
56
+ /* @__PURE__ */ s("div", { className: "widget-grid-item", children: r }, r.key)
57
+ ) : r
49
58
  )
50
59
  }
51
60
  );
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetGrid.js","sources":["../../../../../src/ui/components/WidgetGrid/WidgetGrid.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { Children, isValidElement, type CSSProperties, type ReactNode } from \"react\";\nimport GridLayout, { type Layout } from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport \"react-resizable/css/styles.css\";\nimport \"./widgetgrid.css\";\n\nconst ResizableGridLayout = /* @__PURE__ */ GridLayout.WidthProvider(GridLayout);\n\nconst WIDGET_DRAG_HANDLE_SELECTOR = \".widget-drag-handle\";\nconst WIDGET_HEADER_ACTIONS_SELECTOR = \".widget-header-actions\";\n\nexport interface WidgetLayoutItem {\n id: string;\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\nexport interface WidgetGridProps {\n layout: WidgetLayoutItem[];\n onLayoutChange?: (layout: WidgetLayoutItem[]) => void;\n cols?: number;\n rowHeight?: number;\n isEditable?: boolean;\n isDraggable?: boolean;\n isResizable?: boolean;\n className?: string;\n style?: CSSProperties;\n children: ReactNode;\n}\n\nexport function WidgetGrid({\n layout,\n onLayoutChange,\n cols = 12,\n rowHeight = 80,\n isEditable = false,\n isDraggable,\n isResizable,\n className,\n style,\n children,\n}: WidgetGridProps) {\n const rglLayout: Layout[] = layout.map(({ id, x, y, w, h }) => ({ i: id, x, y, w, h }));\n\n function handleLayoutChange(nextLayout: Layout[]): void {\n onLayoutChange?.(nextLayout.map(({ i, x, y, w, h }) => ({ id: i, x, y, w, h })));\n }\n\n return (\n <ResizableGridLayout\n className={clsx(\"widget-grid\", className)}\n style={style}\n layout={rglLayout}\n cols={cols}\n rowHeight={rowHeight}\n isDraggable={isDraggable ?? isEditable}\n isResizable={isResizable ?? isEditable}\n draggableHandle={WIDGET_DRAG_HANDLE_SELECTOR}\n draggableCancel={WIDGET_HEADER_ACTIONS_SELECTOR}\n onLayoutChange={handleLayoutChange}\n >\n {Children.map(children, (child) =>\n isValidElement(child) ? (\n // react-grid-layout clones this direct child to attach position styles and,\n // when resizable, appends the resize handle as one of its children. Widget\n // renders its own children inside .widget-body, so cloning Widget directly\n // would bury the handle there instead of at the item's edge. This wrapper\n // keeps Widget's markup untouched and gives react-grid-layout a plain node\n // to clone onto.\n <div key={child.key} className=\"widget-grid-item\">\n {child}\n </div>\n ) : (\n child\n ),\n )}\n </ResizableGridLayout>\n );\n}\n"],"names":["ResizableGridLayout","GridLayout","WIDGET_DRAG_HANDLE_SELECTOR","WIDGET_HEADER_ACTIONS_SELECTOR","WidgetGrid","layout","onLayoutChange","cols","rowHeight","isEditable","isDraggable","isResizable","className","style","children","rglLayout","id","x","y","w","h","handleLayoutChange","nextLayout","i","jsx","clsx","Children","child","isValidElement"],"mappings":";;;;;;;AAOA,MAAMA,IAAsC,gBAAAC,EAAW,cAAcA,CAAU,GAEzEC,IAA8B,uBAC9BC,IAAiC;AAuBhC,SAASC,EAAW;AAAA,EACzB,QAAAC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],"sourcesContent":["import clsx from \"clsx\";\nimport { isValidElement, type CSSProperties, type ReactNode } from \"react\";\nimport GridLayout, { type Layout } from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport \"react-resizable/css/styles.css\";\nimport \"./widgetgrid.css\";\n\nconst ResizableGridLayout = /* @__PURE__ */ GridLayout.WidthProvider(GridLayout);\n\nconst WIDGET_DRAG_HANDLE_SELECTOR = \".widget-drag-handle\";\nconst WIDGET_HEADER_ACTIONS_SELECTOR = \".widget-header-actions\";\n\nexport interface WidgetLayoutItem {\n id: string;\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\nexport interface WidgetGridProps {\n layout: WidgetLayoutItem[];\n onLayoutChange?: (layout: WidgetLayoutItem[]) => void;\n cols?: number;\n rowHeight?: number;\n isEditable?: boolean;\n isDraggable?: boolean;\n isResizable?: boolean;\n className?: string;\n style?: CSSProperties;\n children: ReactNode;\n}\n\nexport function WidgetGrid({\n layout,\n onLayoutChange,\n cols = 12,\n rowHeight = 80,\n isEditable = false,\n isDraggable,\n isResizable,\n className,\n style,\n children,\n}: WidgetGridProps) {\n const rglLayout: Layout[] = layout.map(({ id, x, y, w, h }) => ({ i: id, x, y, w, h }));\n\n function handleLayoutChange(nextLayout: Layout[]): void {\n onLayoutChange?.(nextLayout.map(({ i, x, y, w, h }) => ({ id: i, x, y, w, h })));\n }\n\n return (\n <ResizableGridLayout\n className={clsx(\"widget-grid\", className)}\n style={style}\n layout={rglLayout}\n cols={cols}\n rowHeight={rowHeight}\n isDraggable={isDraggable ?? isEditable}\n isResizable={isResizable ?? isEditable}\n draggableHandle={WIDGET_DRAG_HANDLE_SELECTOR}\n draggableCancel={WIDGET_HEADER_ACTIONS_SELECTOR}\n onLayoutChange={handleLayoutChange}\n >\n {(Array.isArray(children) ? children : [children]).map((child) =>\n isValidElement(child) ? (\n // react-grid-layout clones this direct child to attach position styles and,\n // when resizable, appends the resize handle as one of its children. Widget\n // renders its own children inside .widget-body, so cloning Widget directly\n // would bury the handle there instead of at the item's edge. This wrapper\n // keeps Widget's markup untouched and gives react-grid-layout a plain node\n // to clone onto.\n //\n // A plain array .map() is used here (not Children.map/Children.forEach/\n // Children.toArray): those APIs re-escape each child's key on every call,\n // prefixing it with React's internal `.$` marker regardless of the key set\n // on the returned element. react-grid-layout derives each item's id from\n // this wrapper's resolved key, and that id round-trips back into `layout` on\n // the next render, so the escaped key compounded every render (id -> `.$id`\n // -> `.$.$id` -> ...) and never converged, causing an infinite update loop\n // as soon as a consumer re-rendered with the reported layout. Plain .map()\n // leaves the explicit key untouched.\n <div key={child.key} className=\"widget-grid-item\">\n {child}\n </div>\n ) : (\n child\n ),\n )}\n </ResizableGridLayout>\n );\n}\n"],"names":["ResizableGridLayout","GridLayout","WIDGET_DRAG_HANDLE_SELECTOR","WIDGET_HEADER_ACTIONS_SELECTOR","WidgetGrid","layout","onLayoutChange","cols","rowHeight","isEditable","isDraggable","isResizable","className","style","children","rglLayout","id","x","y","w","h","handleLayoutChange","nextLayout","i","jsx","clsx","child","isValidElement"],"mappings":";;;;;;;AAOA,MAAMA,IAAsC,gBAAAC,EAAW,cAAcA,CAAU,GAEzEC,IAA8B,uBAC9BC,IAAiC;AAuBhC,SAASC,EAAW;AAAA,EACzB,QAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AACF,GAAoB;AAClB,QAAMC,IAAsBV,EAAO,IAAI,CAAC,EAAE,IAAAW,GAAI,GAAAC,GAAG,GAAAC,GAAG,GAAAC,GAAG,GAAAC,EAAA,OAAS,EAAE,GAAGJ,GAAI,GAAAC,GAAG,GAAAC,GAAG,GAAAC,GAAG,GAAAC,IAAI;AAEtF,WAASC,EAAmBC,GAA4B;AACtD,IAAAhB,KAAA,QAAAA,EAAiBgB,EAAW,IAAI,CAAC,EAAE,GAAAC,GAAG,GAAAN,GAAG,GAAAC,GAAG,GAAAC,GAAG,GAAAC,EAAA,OAAS,EAAE,IAAIG,GAAG,GAAAN,GAAG,GAAAC,GAAG,GAAAC,GAAG,GAAAC,EAAA,EAAI;AAAA,EAChF;AAEA,SACE,gBAAAI;AAAA,IAACxB;AAAA,IAAA;AAAA,MACC,WAAWyB,EAAK,eAAeb,CAAS;AAAA,MACxC,OAAAC;AAAA,MACA,QAAQE;AAAA,MACR,MAAAR;AAAA,MACA,WAAAC;AAAA,MACA,aAAaE,KAAeD;AAAA,MAC5B,aAAaE,KAAeF;AAAA,MAC5B,iBAAiBP;AAAA,MACjB,iBAAiBC;AAAA,MACjB,gBAAgBkB;AAAA,MAEd,iBAAM,QAAQP,CAAQ,IAAIA,IAAW,CAACA,CAAQ,GAAG;AAAA,QAAI,CAACY,MACtDC,EAAeD,CAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAiBjB,OAAA,EAAoB,WAAU,oBAC5B,UAAAA,EAAA,GADOA,EAAM,GAEhB;AAAA,YAEAA;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
@@ -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,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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AA,CAGhC,CAEO,SAASf,EAAe,CAAE,SAAAY,GAA2C,CAC1E,KAAM,CAAE,WAAAI,CAAA,EAAeC,gBAAA,EACvB,OAAOD,GAAclB,EAAAA,IAAC,OAAA,CAAK,UAAU,kBAAmB,SAAAc,EAAS,CACnE,CAEO,SAASP,EAAe,CAC7B,KAAAI,EACA,QAAAC,EACA,SAAAE,EACA,QAAAM,EAAU,EACZ,EAKG,CACD,OACEpB,EAAAA,IAACe,EAAAA,eAAA,CACE,GAAIJ,EAAO,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 { 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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AAA,IAAeC,EAAA;AACvB,SAAOD,KAAc,gBAAAL,EAAC,QAAA,EAAK,WAAU,mBAAmB,UAAAH,GAAS;AACnE;AAEO,SAASU,EAAe;AAAA,EAC7B,MAAAb;AAAA,EACA,SAAAC;AAAA,EACA,UAAAE;AAAA,EACA,SAAAW,IAAU;AACZ,GAKG;AACD,SACE,gBAAAR;AAAA,IAACD;AAAA,IAAA;AAAA,MACE,GAAIL,IAAO,EAAE,MAAAA,EAAA,IAAS,CAAA;AAAA,MACvB,SAAAC;AAAA,MACA,cAAY,QAAQE,CAAQ;AAAA,MAC5B,gBAAcW,IAAU,SAAS;AAAA,MACjC,WAAWhB,EAAK,kBAAkBgB,KAAW,uBAAuB;AAAA,MAEnE,UAAAX;AAAA,IAAA;AAAA,EAAA;AAGP;AAEO,SAASY,IAAgB;AAC9B,2BACG,OAAA,EAAI,eAAY,QAAO,WAAU,kBAAiB,UAAA,KAEnD;AAEJ;"}
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 &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":";;;;;;;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,CAA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AAM,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;"}
@@ -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.0",
3
+ "version": "1.21.0",
4
4
  "type": "module",
5
5
  "description": "APIPass React Design System",
6
6
  "sideEffects": [