@ktnpm_devops/react-component 0.10.0 → 0.12.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/charts/TemporalTrendChartCard/TemporalTrendChartCard.d.ts +1 -1
- package/dist/charts/TemporalTrendChartCard/TemporalTrendChartCard.d.ts.map +1 -1
- package/dist/charts/TemporalTrendChartCard/TemporalTrendChartCard.types.d.ts +24 -1
- package/dist/charts/TemporalTrendChartCard/TemporalTrendChartCard.types.d.ts.map +1 -1
- package/dist/charts/TemporalTrendChartCard/buildChartOption.d.ts +138 -0
- package/dist/charts/TemporalTrendChartCard/buildChartOption.d.ts.map +1 -0
- package/dist/charts/TemporalTrendChartCard/index.d.ts +1 -1
- package/dist/charts/TemporalTrendChartCard/index.d.ts.map +1 -1
- package/dist/composites/Loading/Loading.d.ts +4 -0
- package/dist/composites/Loading/Loading.d.ts.map +1 -0
- package/dist/composites/Loading/Loading.types.d.ts +14 -0
- package/dist/composites/Loading/Loading.types.d.ts.map +1 -0
- package/dist/composites/Loading/index.d.ts +3 -0
- package/dist/composites/Loading/index.d.ts.map +1 -0
- package/dist/index.cjs +41 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -35
- package/dist/index.js.map +1 -1
- package/dist/index10.cjs +2 -2
- package/dist/index10.js +2 -2
- package/dist/index100.cjs +42 -0
- package/dist/index100.cjs.map +1 -0
- package/dist/index100.js +42 -0
- package/dist/index100.js.map +1 -0
- package/dist/index101.cjs +95 -0
- package/dist/index101.cjs.map +1 -0
- package/dist/index101.js +95 -0
- package/dist/index101.js.map +1 -0
- package/dist/index102.cjs +42 -0
- package/dist/index102.cjs.map +1 -0
- package/dist/index102.js +42 -0
- package/dist/index102.js.map +1 -0
- package/dist/index103.cjs +21 -0
- package/dist/index103.cjs.map +1 -0
- package/dist/index103.js +21 -0
- package/dist/index103.js.map +1 -0
- package/dist/index104.cjs +9 -0
- package/dist/index104.cjs.map +1 -0
- package/dist/index104.js +9 -0
- package/dist/index104.js.map +1 -0
- package/dist/index105.cjs +33 -0
- package/dist/index105.cjs.map +1 -0
- package/dist/index105.js +33 -0
- package/dist/index105.js.map +1 -0
- package/dist/index11.cjs +2 -2
- package/dist/index11.js +2 -2
- package/dist/index12.cjs +2 -2
- package/dist/index12.js +2 -2
- package/dist/index13.cjs +2 -2
- package/dist/index13.js +2 -2
- package/dist/index14.cjs +2 -2
- package/dist/index14.js +2 -2
- package/dist/index15.cjs +3 -3
- package/dist/index15.js +3 -3
- package/dist/index16.cjs +2 -2
- package/dist/index16.js +2 -2
- package/dist/index17.cjs +52 -16
- package/dist/index17.cjs.map +1 -1
- package/dist/index17.js +54 -18
- package/dist/index17.js.map +1 -1
- package/dist/index18.cjs +16 -24
- package/dist/index18.cjs.map +1 -1
- package/dist/index18.js +17 -25
- package/dist/index18.js.map +1 -1
- package/dist/index19.cjs +22 -39
- package/dist/index19.cjs.map +1 -1
- package/dist/index19.js +23 -40
- package/dist/index19.js.map +1 -1
- package/dist/index20.cjs +38 -85
- package/dist/index20.cjs.map +1 -1
- package/dist/index20.js +40 -87
- package/dist/index20.js.map +1 -1
- package/dist/index21.cjs +85 -153
- package/dist/index21.cjs.map +1 -1
- package/dist/index21.js +87 -155
- package/dist/index21.js.map +1 -1
- package/dist/index22.cjs +150 -128
- package/dist/index22.cjs.map +1 -1
- package/dist/index22.js +150 -128
- package/dist/index22.js.map +1 -1
- package/dist/index23.cjs +121 -106
- package/dist/index23.cjs.map +1 -1
- package/dist/index23.js +122 -107
- package/dist/index23.js.map +1 -1
- package/dist/index24.cjs +121 -17
- package/dist/index24.cjs.map +1 -1
- package/dist/index24.js +121 -17
- package/dist/index24.js.map +1 -1
- package/dist/index25.cjs +16 -163
- package/dist/index25.cjs.map +1 -1
- package/dist/index25.js +16 -163
- package/dist/index25.js.map +1 -1
- package/dist/index26.cjs +132 -99
- package/dist/index26.cjs.map +1 -1
- package/dist/index26.js +132 -99
- package/dist/index26.js.map +1 -1
- package/dist/index27.cjs +14 -69
- package/dist/index27.cjs.map +1 -1
- package/dist/index27.js +15 -70
- package/dist/index27.js.map +1 -1
- package/dist/index28.cjs +130 -7
- package/dist/index28.cjs.map +1 -1
- package/dist/index28.js +132 -9
- package/dist/index28.js.map +1 -1
- package/dist/index29.cjs +74 -128
- package/dist/index29.cjs.map +1 -1
- package/dist/index29.js +76 -130
- package/dist/index29.js.map +1 -1
- package/dist/index30.cjs +8 -38
- package/dist/index30.cjs.map +1 -1
- package/dist/index30.js +9 -39
- package/dist/index30.js.map +1 -1
- package/dist/index31.cjs +118 -213
- package/dist/index31.cjs.map +1 -1
- package/dist/index31.js +119 -214
- package/dist/index31.js.map +1 -1
- package/dist/index32.cjs +48 -26
- package/dist/index32.cjs.map +1 -1
- package/dist/index32.js +50 -28
- package/dist/index32.js.map +1 -1
- package/dist/index33.cjs +34 -106
- package/dist/index33.cjs.map +1 -1
- package/dist/index33.js +34 -106
- package/dist/index33.js.map +1 -1
- package/dist/index34.cjs +224 -66
- package/dist/index34.cjs.map +1 -1
- package/dist/index34.js +225 -67
- package/dist/index34.js.map +1 -1
- package/dist/index35.cjs +29 -73
- package/dist/index35.cjs.map +1 -1
- package/dist/index35.js +31 -75
- package/dist/index35.js.map +1 -1
- package/dist/index36.cjs +104 -53
- package/dist/index36.cjs.map +1 -1
- package/dist/index36.js +105 -54
- package/dist/index36.js.map +1 -1
- package/dist/index37.cjs +62 -147
- package/dist/index37.cjs.map +1 -1
- package/dist/index37.js +63 -148
- package/dist/index37.js.map +1 -1
- package/dist/index38.cjs +66 -86
- package/dist/index38.cjs.map +1 -1
- package/dist/index38.js +67 -87
- package/dist/index38.js.map +1 -1
- package/dist/index39.cjs +53 -66
- package/dist/index39.cjs.map +1 -1
- package/dist/index39.js +54 -67
- package/dist/index39.js.map +1 -1
- package/dist/index40.cjs +152 -7
- package/dist/index40.cjs.map +1 -1
- package/dist/index40.js +154 -9
- package/dist/index40.js.map +1 -1
- package/dist/index41.cjs +96 -15
- package/dist/index41.cjs.map +1 -1
- package/dist/index41.js +96 -15
- package/dist/index41.js.map +1 -1
- package/dist/index42.cjs +66 -71
- package/dist/index42.cjs.map +1 -1
- package/dist/index42.js +68 -73
- package/dist/index42.js.map +1 -1
- package/dist/index43.cjs +7 -142
- package/dist/index43.cjs.map +1 -1
- package/dist/index43.js +9 -144
- package/dist/index43.js.map +1 -1
- package/dist/index44.cjs +17 -64
- package/dist/index44.cjs.map +1 -1
- package/dist/index44.js +17 -64
- package/dist/index44.js.map +1 -1
- package/dist/index45.cjs +69 -97
- package/dist/index45.cjs.map +1 -1
- package/dist/index45.js +71 -99
- package/dist/index45.js.map +1 -1
- package/dist/index46.cjs +140 -44
- package/dist/index46.cjs.map +1 -1
- package/dist/index46.js +141 -45
- package/dist/index46.js.map +1 -1
- package/dist/index47.cjs +64 -6
- package/dist/index47.cjs.map +1 -1
- package/dist/index47.js +65 -7
- package/dist/index47.js.map +1 -1
- package/dist/index48.cjs +74 -185
- package/dist/index48.cjs.map +1 -1
- package/dist/index48.js +67 -178
- package/dist/index48.js.map +1 -1
- package/dist/index49.cjs +45 -6
- package/dist/index49.cjs.map +1 -1
- package/dist/index49.js +46 -7
- package/dist/index49.js.map +1 -1
- package/dist/index50.cjs +6 -17
- package/dist/index50.cjs.map +1 -1
- package/dist/index50.js +6 -17
- package/dist/index50.js.map +1 -1
- package/dist/index51.cjs +141 -60
- package/dist/index51.cjs.map +1 -1
- package/dist/index51.js +142 -61
- package/dist/index51.js.map +1 -1
- package/dist/index52.cjs +10 -16
- package/dist/index52.cjs.map +1 -1
- package/dist/index52.js +9 -15
- package/dist/index52.js.map +1 -1
- package/dist/index53.cjs +19 -28
- package/dist/index53.cjs.map +1 -1
- package/dist/index53.js +18 -27
- package/dist/index53.js.map +1 -1
- package/dist/index54.cjs +67 -6
- package/dist/index54.cjs.map +1 -1
- package/dist/index54.js +66 -5
- package/dist/index54.js.map +1 -1
- package/dist/index55.cjs +15 -18
- package/dist/index55.cjs.map +1 -1
- package/dist/index55.js +15 -18
- package/dist/index55.js.map +1 -1
- package/dist/index56.cjs +2 -14
- package/dist/index56.cjs.map +1 -1
- package/dist/index56.js +3 -15
- package/dist/index56.js.map +1 -1
- package/dist/index57.cjs +20 -2
- package/dist/index57.cjs.map +1 -1
- package/dist/index57.js +20 -2
- package/dist/index57.js.map +1 -1
- package/dist/index58.cjs +20 -2
- package/dist/index58.cjs.map +1 -1
- package/dist/index58.js +20 -2
- package/dist/index58.js.map +1 -1
- package/dist/index59.cjs +6 -89
- package/dist/index59.cjs.map +1 -1
- package/dist/index59.js +5 -88
- package/dist/index59.js.map +1 -1
- package/dist/index60.cjs +46 -19
- package/dist/index60.cjs.map +1 -1
- package/dist/index60.js +46 -19
- package/dist/index60.js.map +1 -1
- package/dist/index61.cjs +64 -37
- package/dist/index61.cjs.map +1 -1
- package/dist/index61.js +64 -37
- package/dist/index61.js.map +1 -1
- package/dist/index62.cjs +89 -24
- package/dist/index62.cjs.map +1 -1
- package/dist/index62.js +88 -23
- package/dist/index62.js.map +1 -1
- package/dist/index63.cjs +80 -2
- package/dist/index63.cjs.map +1 -1
- package/dist/index63.js +81 -3
- package/dist/index63.js.map +1 -1
- package/dist/index64.cjs +28 -19
- package/dist/index64.cjs.map +1 -1
- package/dist/index64.js +29 -20
- package/dist/index64.js.map +1 -1
- package/dist/index65.cjs +34 -64
- package/dist/index65.cjs.map +1 -1
- package/dist/index65.js +34 -64
- package/dist/index65.js.map +1 -1
- package/dist/index66.cjs +22 -13
- package/dist/index66.cjs.map +1 -1
- package/dist/index66.js +22 -13
- package/dist/index66.js.map +1 -1
- package/dist/index67.cjs +36 -6
- package/dist/index67.cjs.map +1 -1
- package/dist/index67.js +36 -6
- package/dist/index67.js.map +1 -1
- package/dist/index68.cjs +52 -10
- package/dist/index68.cjs.map +1 -1
- package/dist/index68.js +53 -11
- package/dist/index68.js.map +1 -1
- package/dist/index69.cjs +17 -2
- package/dist/index69.cjs.map +1 -1
- package/dist/index69.js +18 -3
- package/dist/index69.js.map +1 -1
- package/dist/index70.cjs +2 -35
- package/dist/index70.cjs.map +1 -1
- package/dist/index70.js +3 -36
- package/dist/index70.js.map +1 -1
- package/dist/index71.cjs +8 -8
- package/dist/index71.js +8 -8
- package/dist/index72.cjs +2 -17
- package/dist/index72.cjs.map +1 -1
- package/dist/index72.js +3 -18
- package/dist/index72.js.map +1 -1
- package/dist/index73.cjs +5 -47
- package/dist/index73.cjs.map +1 -1
- package/dist/index73.js +6 -48
- package/dist/index73.js.map +1 -1
- package/dist/index74.cjs +16 -16
- package/dist/index74.js +17 -17
- package/dist/index75.cjs +24 -39
- package/dist/index75.cjs.map +1 -1
- package/dist/index75.js +23 -38
- package/dist/index75.js.map +1 -1
- package/dist/index76.cjs +15 -92
- package/dist/index76.cjs.map +1 -1
- package/dist/index76.js +14 -91
- package/dist/index76.js.map +1 -1
- package/dist/index77.cjs +17 -23
- package/dist/index77.cjs.map +1 -1
- package/dist/index77.js +18 -24
- package/dist/index77.js.map +1 -1
- package/dist/index78.cjs +16 -52
- package/dist/index78.cjs.map +1 -1
- package/dist/index78.js +16 -52
- package/dist/index78.js.map +1 -1
- package/dist/index79.cjs +19 -28
- package/dist/index79.cjs.map +1 -1
- package/dist/index79.js +19 -28
- package/dist/index79.js.map +1 -1
- package/dist/index80.cjs +28 -134
- package/dist/index80.cjs.map +1 -1
- package/dist/index80.js +27 -133
- package/dist/index80.js.map +1 -1
- package/dist/index81.cjs +14 -41
- package/dist/index81.cjs.map +1 -1
- package/dist/index81.js +14 -41
- package/dist/index81.js.map +1 -1
- package/dist/index82.cjs +13 -37
- package/dist/index82.cjs.map +1 -1
- package/dist/index82.js +14 -38
- package/dist/index82.js.map +1 -1
- package/dist/index83.cjs +13 -25
- package/dist/index83.cjs.map +1 -1
- package/dist/index83.js +14 -26
- package/dist/index83.js.map +1 -1
- package/dist/index84.cjs +34 -34
- package/dist/index84.js +34 -34
- package/dist/index85.cjs +52 -4
- package/dist/index85.cjs.map +1 -1
- package/dist/index85.js +53 -5
- package/dist/index85.js.map +1 -1
- package/dist/index86.cjs +15 -30
- package/dist/index86.cjs.map +1 -1
- package/dist/index86.js +15 -30
- package/dist/index86.js.map +1 -1
- package/dist/index87.cjs +16 -13
- package/dist/index87.cjs.map +1 -1
- package/dist/index87.js +17 -14
- package/dist/index87.js.map +1 -1
- package/dist/index88.cjs +16 -79
- package/dist/index88.cjs.map +1 -1
- package/dist/index88.js +16 -79
- package/dist/index88.js.map +1 -1
- package/dist/index9.cjs +2 -2
- package/dist/index9.js +2 -2
- package/dist/index90.cjs +10 -10
- package/dist/index90.js +11 -11
- package/dist/index91.cjs +4 -22
- package/dist/index91.cjs.map +1 -1
- package/dist/index91.js +5 -23
- package/dist/index91.js.map +1 -1
- package/dist/index92.cjs +17 -11
- package/dist/index92.cjs.map +1 -1
- package/dist/index92.js +18 -12
- package/dist/index92.js.map +1 -1
- package/dist/index93.cjs +16 -16
- package/dist/index93.js +17 -17
- package/dist/index94.cjs +134 -22
- package/dist/index94.cjs.map +1 -1
- package/dist/index94.js +133 -21
- package/dist/index94.js.map +1 -1
- package/dist/index95.cjs +40 -28
- package/dist/index95.cjs.map +1 -1
- package/dist/index95.js +40 -28
- package/dist/index95.js.map +1 -1
- package/dist/index96.cjs +22 -52
- package/dist/index96.cjs.map +1 -1
- package/dist/index96.js +22 -52
- package/dist/index96.js.map +1 -1
- package/dist/index97.cjs +116 -19
- package/dist/index97.cjs.map +1 -1
- package/dist/index97.js +115 -18
- package/dist/index97.js.map +1 -1
- package/dist/index98.cjs +37 -19
- package/dist/index98.cjs.map +1 -1
- package/dist/index98.js +37 -19
- package/dist/index98.js.map +1 -1
- package/dist/index99.cjs +45 -0
- package/dist/index99.cjs.map +1 -0
- package/dist/index99.js +45 -0
- package/dist/index99.js.map +1 -0
- package/dist/primitives/Checkbox/Checkbox.d.ts +4 -0
- package/dist/primitives/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/primitives/Checkbox/Checkbox.types.d.ts +14 -0
- package/dist/primitives/Checkbox/Checkbox.types.d.ts.map +1 -0
- package/dist/primitives/Checkbox/index.d.ts +3 -0
- package/dist/primitives/Checkbox/index.d.ts.map +1 -0
- package/dist/primitives/EmptyState/EmptyState.d.ts +4 -0
- package/dist/primitives/EmptyState/EmptyState.d.ts.map +1 -0
- package/dist/primitives/EmptyState/EmptyState.types.d.ts +14 -0
- package/dist/primitives/EmptyState/EmptyState.types.d.ts.map +1 -0
- package/dist/primitives/EmptyState/index.d.ts +3 -0
- package/dist/primitives/EmptyState/index.d.ts.map +1 -0
- package/dist/style.css +188 -0
- package/dist/types/chart.types.d.ts +11 -0
- package/dist/types/chart.types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index35.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index35.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index35.js","sources":["../src/primitives/NavItem/NavItem.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport clsx from 'clsx';\nimport type { NavItemProps } from './NavItem.types';\nimport styles from './NavItem.module.css';\n\nexport const NavItem = forwardRef<HTMLElement, NavItemProps>(\n ({ icon, label, active = false, badge, collapsed = false, disabled = false, href, onClick, className }, ref) => {\n const content = (\n <>\n {icon && <span className={styles.icon}>{icon}</span>}\n {!collapsed && <span className={styles.label}>{label}</span>}\n {!collapsed && badge !== undefined && (\n <span className={styles.badge}>{badge}</span>\n )}\n </>\n );\n\n const sharedProps = {\n className: clsx(styles.root, { [styles.active]: active, [styles.collapsed]: collapsed, [styles.disabled]: disabled }, className),\n 'aria-current': active ? ('page' as const) : undefined,\n 'aria-disabled': disabled || undefined,\n title: collapsed ? label : undefined,\n };\n\n if (href && !disabled) {\n return (\n <a ref={ref as React.Ref<HTMLAnchorElement>} href={href} {...sharedProps}>\n {content}\n </a>\n );\n }\n\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n onClick={disabled ? undefined : onClick}\n disabled={disabled}\n {...sharedProps}\n >\n {content}\n </button>\n );\n },\n);\n\nNavItem.displayName = 'NavItem';\n"],"names":[],"mappings":";;;;AAKO,MAAM,UAAU;AAAA,EACrB,CAAC,EAAE,MAAM,OAAO,SAAS,OAAO,OAAO,YAAY,OAAO,WAAW,OAAO,MAAM,SAAS,UAAA,GAAa,QAAQ;AAC9G,UAAM,UACJ,qBAAA,UAAA,EACG,UAAA;AAAA,MAAA,QAAQ,oBAAC,QAAA,EAAK,WAAW,OAAO,MAAO,UAAA,MAAK;AAAA,MAC5C,CAAC,aAAa,oBAAC,UAAK,WAAW,OAAO,OAAQ,UAAA,OAAM;AAAA,MACpD,CAAC,aAAa,UAAU,8BACtB,QAAA,EAAK,WAAW,OAAO,OAAQ,UAAA,MAAA,CAAM;AAAA,IAAA,GAE1C;AAGF,UAAM,cAAc;AAAA,MAClB,WAAW,KAAK,OAAO,MAAM,EAAE,CAAC,OAAO,MAAM,GAAG,QAAQ,CAAC,OAAO,SAAS,GAAG,WAAW,CAAC,OAAO,QAAQ,GAAG,SAAA,GAAY,SAAS;AAAA,MAC/H,gBAAgB,SAAU,SAAmB;AAAA,MAC7C,iBAAiB,YAAY;AAAA,MAC7B,OAAO,YAAY,QAAQ;AAAA,IAAA;AAG7B,QAAI,QAAQ,CAAC,UAAU;AACrB,iCACG,KAAA,EAAE,KAA0C,MAAa,GAAG,aAC1D,UAAA,SACH;AAAA,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,SAAS,WAAW,SAAY;AAAA,QAChC;AAAA,QACC,GAAG;AAAA,QAEH,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,QAAQ,cAAc;"}
|
package/dist/index36.cjs
CHANGED
|
@@ -2,62 +2,113 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const clsx = require("./
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
5
|
+
const clsx = require("./index55.cjs");
|
|
6
|
+
const constants = require("./index62.cjs");
|
|
7
|
+
const Pagination_module = require("./index74.cjs");
|
|
8
|
+
function range(start, end) {
|
|
9
|
+
const out = [];
|
|
10
|
+
for (let page = start; page <= end; page += 1) out.push(page);
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
function getPaginationItems(currentPage, totalPages, siblingCount, boundaryCount) {
|
|
14
|
+
const totalNumbers = boundaryCount * 2 + siblingCount * 2 + 3;
|
|
15
|
+
if (totalPages <= totalNumbers) return range(1, totalPages);
|
|
16
|
+
const startPages = range(1, boundaryCount);
|
|
17
|
+
const endPages = range(totalPages - boundaryCount + 1, totalPages);
|
|
18
|
+
const siblingsStart = Math.max(
|
|
19
|
+
Math.min(currentPage - siblingCount, totalPages - boundaryCount - siblingCount * 2 - 1),
|
|
20
|
+
boundaryCount + 2
|
|
21
|
+
);
|
|
22
|
+
const siblingsEnd = Math.min(
|
|
23
|
+
Math.max(currentPage + siblingCount, boundaryCount + siblingCount * 2 + 2),
|
|
24
|
+
endPages[0] - 2
|
|
25
|
+
);
|
|
26
|
+
const items = [...startPages];
|
|
27
|
+
items.push(siblingsStart > boundaryCount + 2 ? "ellipsis" : boundaryCount + 1);
|
|
28
|
+
items.push(...range(siblingsStart, siblingsEnd));
|
|
29
|
+
items.push(siblingsEnd < totalPages - boundaryCount - 1 ? "ellipsis" : totalPages - boundaryCount);
|
|
30
|
+
items.push(...endPages);
|
|
31
|
+
return items;
|
|
32
|
+
}
|
|
33
|
+
function Chevron({ direction }) {
|
|
34
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
35
|
+
"svg",
|
|
36
|
+
{
|
|
37
|
+
width: constants.ICON_SIZE.MD,
|
|
38
|
+
height: constants.ICON_SIZE.MD,
|
|
39
|
+
viewBox: constants.SVG_VIEWBOX,
|
|
40
|
+
fill: "none",
|
|
41
|
+
stroke: "currentColor",
|
|
42
|
+
strokeWidth: constants.SVG_STROKE_WIDTH,
|
|
43
|
+
strokeLinecap: "round",
|
|
44
|
+
strokeLinejoin: "round",
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: direction === "left" ? "15 18 9 12 15 6" : "9 18 15 12 9 6" })
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const Pagination = react.forwardRef(
|
|
34
51
|
({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
currentPage,
|
|
53
|
+
totalItems,
|
|
54
|
+
pageSize,
|
|
55
|
+
onPageChange,
|
|
56
|
+
siblingCount = constants.PAGINATION.SIBLING_COUNT,
|
|
57
|
+
boundaryCount = constants.PAGINATION.BOUNDARY_COUNT,
|
|
58
|
+
showPrevNext = true,
|
|
40
59
|
className,
|
|
41
|
-
|
|
60
|
+
"aria-label": ariaLabel = "Pagination",
|
|
42
61
|
...props
|
|
43
|
-
}, ref) =>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
}, ref) => {
|
|
63
|
+
const totalPages = Math.max(1, Math.ceil(totalItems / Math.max(1, pageSize)));
|
|
64
|
+
const page = Math.min(Math.max(currentPage, 1), totalPages);
|
|
65
|
+
const items = getPaginationItems(page, totalPages, siblingCount, boundaryCount);
|
|
66
|
+
const goTo = (target) => {
|
|
67
|
+
const next = Math.min(Math.max(target, 1), totalPages);
|
|
68
|
+
if (next !== page) onPageChange(next);
|
|
69
|
+
};
|
|
70
|
+
return /* @__PURE__ */ jsxRuntime.jsx("nav", { ref, "aria-label": ariaLabel, className: clsx.clsx(Pagination_module.default.root, className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: Pagination_module.default.list, children: [
|
|
71
|
+
showPrevNext && /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
72
|
+
"button",
|
|
73
|
+
{
|
|
74
|
+
type: "button",
|
|
75
|
+
className: Pagination_module.default.arrow,
|
|
76
|
+
onClick: () => goTo(page - 1),
|
|
77
|
+
disabled: page <= 1,
|
|
78
|
+
"aria-label": "Go to previous page",
|
|
79
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Chevron, { direction: "left" })
|
|
80
|
+
}
|
|
81
|
+
) }),
|
|
82
|
+
items.map(
|
|
83
|
+
(item, index) => item === "ellipsis" ? (
|
|
84
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
85
|
+
/* @__PURE__ */ jsxRuntime.jsx("li", { className: Pagination_module.default.ellipsis, "aria-hidden": "true", children: "…" }, `ellipsis-${index}`)
|
|
86
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
type: "button",
|
|
90
|
+
className: clsx.clsx(Pagination_module.default.page, item === page && Pagination_module.default.isActive),
|
|
91
|
+
onClick: () => goTo(item),
|
|
92
|
+
"aria-current": item === page ? "page" : void 0,
|
|
93
|
+
"aria-label": `Go to page ${item}`,
|
|
94
|
+
children: item
|
|
95
|
+
}
|
|
96
|
+
) }, item)
|
|
55
97
|
),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
98
|
+
showPrevNext && /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
99
|
+
"button",
|
|
100
|
+
{
|
|
101
|
+
type: "button",
|
|
102
|
+
className: Pagination_module.default.arrow,
|
|
103
|
+
onClick: () => goTo(page + 1),
|
|
104
|
+
disabled: page >= totalPages,
|
|
105
|
+
"aria-label": "Go to next page",
|
|
106
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Chevron, { direction: "right" })
|
|
107
|
+
}
|
|
108
|
+
) })
|
|
109
|
+
] }) });
|
|
110
|
+
}
|
|
60
111
|
);
|
|
61
|
-
|
|
62
|
-
exports.
|
|
112
|
+
Pagination.displayName = "Pagination";
|
|
113
|
+
exports.Pagination = Pagination;
|
|
63
114
|
//# sourceMappingURL=index36.cjs.map
|
package/dist/index36.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index36.cjs","sources":["../src/primitives/
|
|
1
|
+
{"version":3,"file":"index36.cjs","sources":["../src/primitives/Pagination/Pagination.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport clsx from 'clsx';\nimport { ICON_SIZE, PAGINATION, SVG_STROKE_WIDTH, SVG_VIEWBOX } from '../../constants';\nimport type { PaginationItem, PaginationProps } from './Pagination.types';\nimport styles from './Pagination.module.css';\n\nfunction range(start: number, end: number): number[] {\n const out: number[] = [];\n for (let page = start; page <= end; page += 1) out.push(page);\n return out;\n}\n\n/**\n * Builds the sequence of page numbers and ellipsis gaps to render, keeping the\n * first/last boundaries and a window of siblings around the current page.\n */\nfunction getPaginationItems(\n currentPage: number,\n totalPages: number,\n siblingCount: number,\n boundaryCount: number,\n): PaginationItem[] {\n const totalNumbers = boundaryCount * 2 + siblingCount * 2 + 3;\n if (totalPages <= totalNumbers) return range(1, totalPages);\n\n const startPages = range(1, boundaryCount);\n const endPages = range(totalPages - boundaryCount + 1, totalPages);\n\n const siblingsStart = Math.max(\n Math.min(currentPage - siblingCount, totalPages - boundaryCount - siblingCount * 2 - 1),\n boundaryCount + 2,\n );\n const siblingsEnd = Math.min(\n Math.max(currentPage + siblingCount, boundaryCount + siblingCount * 2 + 2),\n endPages[0] - 2,\n );\n\n const items: PaginationItem[] = [...startPages];\n items.push(siblingsStart > boundaryCount + 2 ? 'ellipsis' : boundaryCount + 1);\n items.push(...range(siblingsStart, siblingsEnd));\n items.push(siblingsEnd < totalPages - boundaryCount - 1 ? 'ellipsis' : totalPages - boundaryCount);\n items.push(...endPages);\n\n return items;\n}\n\nfunction Chevron({ direction }: { direction: 'left' | 'right' }) {\n return (\n <svg\n width={ICON_SIZE.MD}\n height={ICON_SIZE.MD}\n viewBox={SVG_VIEWBOX}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={SVG_STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points={direction === 'left' ? '15 18 9 12 15 6' : '9 18 15 12 9 6'} />\n </svg>\n );\n}\n\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n (\n {\n currentPage,\n totalItems,\n pageSize,\n onPageChange,\n siblingCount = PAGINATION.SIBLING_COUNT,\n boundaryCount = PAGINATION.BOUNDARY_COUNT,\n showPrevNext = true,\n className,\n 'aria-label': ariaLabel = 'Pagination',\n ...props\n },\n ref,\n ) => {\n const totalPages = Math.max(1, Math.ceil(totalItems / Math.max(1, pageSize)));\n const page = Math.min(Math.max(currentPage, 1), totalPages);\n const items = getPaginationItems(page, totalPages, siblingCount, boundaryCount);\n\n const goTo = (target: number) => {\n const next = Math.min(Math.max(target, 1), totalPages);\n if (next !== page) onPageChange(next);\n };\n\n return (\n <nav ref={ref} aria-label={ariaLabel} className={clsx(styles.root, className)} {...props}>\n <ul className={styles.list}>\n {showPrevNext && (\n <li>\n <button\n type=\"button\"\n className={styles.arrow}\n onClick={() => goTo(page - 1)}\n disabled={page <= 1}\n aria-label=\"Go to previous page\"\n >\n <Chevron direction=\"left\" />\n </button>\n </li>\n )}\n\n {items.map((item, index) =>\n item === 'ellipsis' ? (\n // eslint-disable-next-line react/no-array-index-key\n <li key={`ellipsis-${index}`} className={styles.ellipsis} aria-hidden=\"true\">\n …\n </li>\n ) : (\n <li key={item}>\n <button\n type=\"button\"\n className={clsx(styles.page, item === page && styles.isActive)}\n onClick={() => goTo(item)}\n aria-current={item === page ? 'page' : undefined}\n aria-label={`Go to page ${item}`}\n >\n {item}\n </button>\n </li>\n ),\n )}\n\n {showPrevNext && (\n <li>\n <button\n type=\"button\"\n className={styles.arrow}\n onClick={() => goTo(page + 1)}\n disabled={page >= totalPages}\n aria-label=\"Go to next page\"\n >\n <Chevron direction=\"right\" />\n </button>\n </li>\n )}\n </ul>\n </nav>\n );\n },\n);\n\nPagination.displayName = 'Pagination';\n"],"names":["jsx","ICON_SIZE","SVG_VIEWBOX","SVG_STROKE_WIDTH","forwardRef","PAGINATION","clsx","styles"],"mappings":";;;;;;;AAMA,SAAS,MAAM,OAAe,KAAuB;AACnD,QAAM,MAAgB,CAAA;AACtB,WAAS,OAAO,OAAO,QAAQ,KAAK,QAAQ,EAAG,KAAI,KAAK,IAAI;AAC5D,SAAO;AACT;AAMA,SAAS,mBACP,aACA,YACA,cACA,eACkB;AAClB,QAAM,eAAe,gBAAgB,IAAI,eAAe,IAAI;AAC5D,MAAI,cAAc,aAAc,QAAO,MAAM,GAAG,UAAU;AAE1D,QAAM,aAAa,MAAM,GAAG,aAAa;AACzC,QAAM,WAAW,MAAM,aAAa,gBAAgB,GAAG,UAAU;AAEjE,QAAM,gBAAgB,KAAK;AAAA,IACzB,KAAK,IAAI,cAAc,cAAc,aAAa,gBAAgB,eAAe,IAAI,CAAC;AAAA,IACtF,gBAAgB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ACL,WAAWO,kBAAAA,QAAO;AAAA,UAClB,SAAS,MAAM,KAAK,OAAO,CAAC;AAAA,UAC5B,UAAU,QAAQ;AAAA,UAClB,cAAW;AAAA,UAEX,UAAAP,2BAAAA,IAAC,SAAA,EAAQ,WAAU,QAAA,CAAQ;AAAA,QAAA;AAAA,MAAA,EAC7B,CACF;AAAA,IAAA,EAAA,CAEJ,EAAA,CACF;AAAA,EAEJ;AACF;AAEA,WAAW,cAAc;;"}
|
package/dist/index36.js
CHANGED
|
@@ -1,63 +1,114 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { clsx } from "./
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
3
|
+
import { clsx } from "./index55.js";
|
|
4
|
+
import { PAGINATION, SVG_STROKE_WIDTH, SVG_VIEWBOX, ICON_SIZE } from "./index62.js";
|
|
5
|
+
import styles from "./index74.js";
|
|
6
|
+
function range(start, end) {
|
|
7
|
+
const out = [];
|
|
8
|
+
for (let page = start; page <= end; page += 1) out.push(page);
|
|
9
|
+
return out;
|
|
10
|
+
}
|
|
11
|
+
function getPaginationItems(currentPage, totalPages, siblingCount, boundaryCount) {
|
|
12
|
+
const totalNumbers = boundaryCount * 2 + siblingCount * 2 + 3;
|
|
13
|
+
if (totalPages <= totalNumbers) return range(1, totalPages);
|
|
14
|
+
const startPages = range(1, boundaryCount);
|
|
15
|
+
const endPages = range(totalPages - boundaryCount + 1, totalPages);
|
|
16
|
+
const siblingsStart = Math.max(
|
|
17
|
+
Math.min(currentPage - siblingCount, totalPages - boundaryCount - siblingCount * 2 - 1),
|
|
18
|
+
boundaryCount + 2
|
|
19
|
+
);
|
|
20
|
+
const siblingsEnd = Math.min(
|
|
21
|
+
Math.max(currentPage + siblingCount, boundaryCount + siblingCount * 2 + 2),
|
|
22
|
+
endPages[0] - 2
|
|
23
|
+
);
|
|
24
|
+
const items = [...startPages];
|
|
25
|
+
items.push(siblingsStart > boundaryCount + 2 ? "ellipsis" : boundaryCount + 1);
|
|
26
|
+
items.push(...range(siblingsStart, siblingsEnd));
|
|
27
|
+
items.push(siblingsEnd < totalPages - boundaryCount - 1 ? "ellipsis" : totalPages - boundaryCount);
|
|
28
|
+
items.push(...endPages);
|
|
29
|
+
return items;
|
|
30
|
+
}
|
|
31
|
+
function Chevron({ direction }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
"svg",
|
|
34
|
+
{
|
|
35
|
+
width: ICON_SIZE.MD,
|
|
36
|
+
height: ICON_SIZE.MD,
|
|
37
|
+
viewBox: SVG_VIEWBOX,
|
|
38
|
+
fill: "none",
|
|
39
|
+
stroke: "currentColor",
|
|
40
|
+
strokeWidth: SVG_STROKE_WIDTH,
|
|
41
|
+
strokeLinecap: "round",
|
|
42
|
+
strokeLinejoin: "round",
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
children: /* @__PURE__ */ jsx("polyline", { points: direction === "left" ? "15 18 9 12 15 6" : "9 18 15 12 9 6" })
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
const Pagination = forwardRef(
|
|
32
49
|
({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
currentPage,
|
|
51
|
+
totalItems,
|
|
52
|
+
pageSize,
|
|
53
|
+
onPageChange,
|
|
54
|
+
siblingCount = PAGINATION.SIBLING_COUNT,
|
|
55
|
+
boundaryCount = PAGINATION.BOUNDARY_COUNT,
|
|
56
|
+
showPrevNext = true,
|
|
38
57
|
className,
|
|
39
|
-
|
|
58
|
+
"aria-label": ariaLabel = "Pagination",
|
|
40
59
|
...props
|
|
41
|
-
}, ref) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
}, ref) => {
|
|
61
|
+
const totalPages = Math.max(1, Math.ceil(totalItems / Math.max(1, pageSize)));
|
|
62
|
+
const page = Math.min(Math.max(currentPage, 1), totalPages);
|
|
63
|
+
const items = getPaginationItems(page, totalPages, siblingCount, boundaryCount);
|
|
64
|
+
const goTo = (target) => {
|
|
65
|
+
const next = Math.min(Math.max(target, 1), totalPages);
|
|
66
|
+
if (next !== page) onPageChange(next);
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ jsx("nav", { ref, "aria-label": ariaLabel, className: clsx(styles.root, className), ...props, children: /* @__PURE__ */ jsxs("ul", { className: styles.list, children: [
|
|
69
|
+
showPrevNext && /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
type: "button",
|
|
73
|
+
className: styles.arrow,
|
|
74
|
+
onClick: () => goTo(page - 1),
|
|
75
|
+
disabled: page <= 1,
|
|
76
|
+
"aria-label": "Go to previous page",
|
|
77
|
+
children: /* @__PURE__ */ jsx(Chevron, { direction: "left" })
|
|
78
|
+
}
|
|
79
|
+
) }),
|
|
80
|
+
items.map(
|
|
81
|
+
(item, index) => item === "ellipsis" ? (
|
|
82
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
83
|
+
/* @__PURE__ */ jsx("li", { className: styles.ellipsis, "aria-hidden": "true", children: "…" }, `ellipsis-${index}`)
|
|
84
|
+
) : /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
className: clsx(styles.page, item === page && styles.isActive),
|
|
89
|
+
onClick: () => goTo(item),
|
|
90
|
+
"aria-current": item === page ? "page" : void 0,
|
|
91
|
+
"aria-label": `Go to page ${item}`,
|
|
92
|
+
children: item
|
|
93
|
+
}
|
|
94
|
+
) }, item)
|
|
53
95
|
),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
96
|
+
showPrevNext && /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
97
|
+
"button",
|
|
98
|
+
{
|
|
99
|
+
type: "button",
|
|
100
|
+
className: styles.arrow,
|
|
101
|
+
onClick: () => goTo(page + 1),
|
|
102
|
+
disabled: page >= totalPages,
|
|
103
|
+
"aria-label": "Go to next page",
|
|
104
|
+
children: /* @__PURE__ */ jsx(Chevron, { direction: "right" })
|
|
105
|
+
}
|
|
106
|
+
) })
|
|
107
|
+
] }) });
|
|
108
|
+
}
|
|
58
109
|
);
|
|
59
|
-
|
|
110
|
+
Pagination.displayName = "Pagination";
|
|
60
111
|
export {
|
|
61
|
-
|
|
112
|
+
Pagination
|
|
62
113
|
};
|
|
63
114
|
//# sourceMappingURL=index36.js.map
|
package/dist/index36.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index36.js","sources":["../src/primitives/
|
|
1
|
+
{"version":3,"file":"index36.js","sources":["../src/primitives/Pagination/Pagination.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport clsx from 'clsx';\nimport { ICON_SIZE, PAGINATION, SVG_STROKE_WIDTH, SVG_VIEWBOX } from '../../constants';\nimport type { PaginationItem, PaginationProps } from './Pagination.types';\nimport styles from './Pagination.module.css';\n\nfunction range(start: number, end: number): number[] {\n const out: number[] = [];\n for (let page = start; page <= end; page += 1) out.push(page);\n return out;\n}\n\n/**\n * Builds the sequence of page numbers and ellipsis gaps to render, keeping the\n * first/last boundaries and a window of siblings around the current page.\n */\nfunction getPaginationItems(\n currentPage: number,\n totalPages: number,\n siblingCount: number,\n boundaryCount: number,\n): PaginationItem[] {\n const totalNumbers = boundaryCount * 2 + siblingCount * 2 + 3;\n if (totalPages <= totalNumbers) return range(1, totalPages);\n\n const startPages = range(1, boundaryCount);\n const endPages = range(totalPages - boundaryCount + 1, totalPages);\n\n const siblingsStart = Math.max(\n Math.min(currentPage - siblingCount, totalPages - boundaryCount - siblingCount * 2 - 1),\n boundaryCount + 2,\n );\n const siblingsEnd = Math.min(\n Math.max(currentPage + siblingCount, boundaryCount + siblingCount * 2 + 2),\n endPages[0] - 2,\n );\n\n const items: PaginationItem[] = [...startPages];\n items.push(siblingsStart > boundaryCount + 2 ? 'ellipsis' : boundaryCount + 1);\n items.push(...range(siblingsStart, siblingsEnd));\n items.push(siblingsEnd < totalPages - boundaryCount - 1 ? 'ellipsis' : totalPages - boundaryCount);\n items.push(...endPages);\n\n return items;\n}\n\nfunction Chevron({ direction }: { direction: 'left' | 'right' }) {\n return (\n <svg\n width={ICON_SIZE.MD}\n height={ICON_SIZE.MD}\n viewBox={SVG_VIEWBOX}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={SVG_STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points={direction === 'left' ? '15 18 9 12 15 6' : '9 18 15 12 9 6'} />\n </svg>\n );\n}\n\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n (\n {\n currentPage,\n totalItems,\n pageSize,\n onPageChange,\n siblingCount = PAGINATION.SIBLING_COUNT,\n boundaryCount = PAGINATION.BOUNDARY_COUNT,\n showPrevNext = true,\n className,\n 'aria-label': ariaLabel = 'Pagination',\n ...props\n },\n ref,\n ) => {\n const totalPages = Math.max(1, Math.ceil(totalItems / Math.max(1, pageSize)));\n const page = Math.min(Math.max(currentPage, 1), totalPages);\n const items = getPaginationItems(page, totalPages, siblingCount, boundaryCount);\n\n const goTo = (target: number) => {\n const next = Math.min(Math.max(target, 1), totalPages);\n if (next !== page) onPageChange(next);\n };\n\n return (\n <nav ref={ref} aria-label={ariaLabel} className={clsx(styles.root, className)} {...props}>\n <ul className={styles.list}>\n {showPrevNext && (\n <li>\n <button\n type=\"button\"\n className={styles.arrow}\n onClick={() => goTo(page - 1)}\n disabled={page <= 1}\n aria-label=\"Go to previous page\"\n >\n <Chevron direction=\"left\" />\n </button>\n </li>\n )}\n\n {items.map((item, index) =>\n item === 'ellipsis' ? (\n // eslint-disable-next-line react/no-array-index-key\n <li key={`ellipsis-${index}`} className={styles.ellipsis} aria-hidden=\"true\">\n …\n </li>\n ) : (\n <li key={item}>\n <button\n type=\"button\"\n className={clsx(styles.page, item === page && styles.isActive)}\n onClick={() => goTo(item)}\n aria-current={item === page ? 'page' : undefined}\n aria-label={`Go to page ${item}`}\n >\n {item}\n </button>\n </li>\n ),\n )}\n\n {showPrevNext && (\n <li>\n <button\n type=\"button\"\n className={styles.arrow}\n onClick={() => goTo(page + 1)}\n disabled={page >= totalPages}\n aria-label=\"Go to next page\"\n >\n <Chevron direction=\"right\" />\n </button>\n </li>\n )}\n </ul>\n </nav>\n );\n },\n);\n\nPagination.displayName = 'Pagination';\n"],"names":[],"mappings":";;;;;AAMA,SAAS,MAAM,OAAe,KAAuB;AACnD,QAAM,MAAgB,CAAA;AACtB,WAAS,OAAO,OAAO,QAAQ,KAAK,QAAQ,EAAG,KAAI,KAAK,IAAI;AAC5D,SAAO;AACT;AAMA,SAAS,mBACP,aACA,YACA,cACA,eACkB;AAClB,QAAM,eAAe,gBAAgB,IAAI,eAAe,IAAI;AAC5D,MAAI,cAAc,aAAc,QAAO,MAAM,GAAG,UAAU;AAE1D,QAAM,aAAa,MAAM,GAAG,aAAa;AACzC,QAAM,WAAW,MAAM,aAAa,gBAAgB,GAAG,UAAU;AAEjE,QAAM,gBAAgB,KAAK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