@wakastellar/ui 2.4.0 → 3.1.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.
Files changed (173) hide show
  1. package/dist/blocks/antivirus-dashboard/index.d.ts +44 -0
  2. package/dist/blocks/clamav-service-status/index.d.ts +35 -0
  3. package/dist/blocks/file-scan-uploader/index.d.ts +29 -0
  4. package/dist/blocks/index.d.ts +18 -9
  5. package/dist/blocks/quarantine-manager/index.d.ts +27 -0
  6. package/dist/blocks/scan-history-log/index.d.ts +28 -0
  7. package/dist/blocks/scan-policy-editor/index.d.ts +27 -0
  8. package/dist/blocks/scan-report-generator/index.d.ts +47 -0
  9. package/dist/blocks/signature-database-manager/index.d.ts +39 -0
  10. package/dist/blocks/threat-alert-banner/index.d.ts +26 -0
  11. package/dist/components/index.d.ts +4 -4
  12. package/dist/components/waka-signature-pad/index.d.ts +1 -1
  13. package/dist/exceljs.min-BcLLX0PC.js +29 -0
  14. package/dist/exceljs.min-KOayaaQ4.mjs +23013 -0
  15. package/dist/export.cjs.js +1 -1
  16. package/dist/export.d.ts +2 -2
  17. package/dist/export.es.js +1 -1
  18. package/dist/index.cjs.js +136 -136
  19. package/dist/index.es.js +29978 -27215
  20. package/dist/stories/Button.stories.d.ts +1 -1
  21. package/dist/stories/Header.stories.d.ts +1 -1
  22. package/dist/stories/Page.stories.d.ts +1 -1
  23. package/dist/useDataTableImport-COVnvslz.js +9 -0
  24. package/dist/useDataTableImport-DAlxBY8w.mjs +237 -0
  25. package/dist/utils/index.d.ts +1 -0
  26. package/dist/utils/logger.d.ts +9 -0
  27. package/package.json +6 -5
  28. package/src/blocks/antivirus-dashboard/AntivirusDashboard.stories.tsx +291 -0
  29. package/src/blocks/antivirus-dashboard/index.tsx +525 -0
  30. package/src/blocks/clamav-service-status/ClamAVServiceStatus.stories.tsx +195 -0
  31. package/src/blocks/clamav-service-status/index.tsx +370 -0
  32. package/src/blocks/file-scan-uploader/FileScanUploader.stories.tsx +257 -0
  33. package/src/blocks/file-scan-uploader/index.tsx +311 -0
  34. package/src/blocks/index.ts +163 -11
  35. package/src/blocks/quarantine-manager/QuarantineManager.stories.tsx +209 -0
  36. package/src/blocks/quarantine-manager/index.tsx +435 -0
  37. package/src/blocks/scan-history-log/ScanHistoryLog.stories.tsx +231 -0
  38. package/src/blocks/scan-history-log/index.tsx +406 -0
  39. package/src/blocks/scan-policy-editor/ScanPolicyEditor.stories.tsx +106 -0
  40. package/src/blocks/scan-policy-editor/index.tsx +418 -0
  41. package/src/blocks/scan-report-generator/ScanReportGenerator.stories.tsx +232 -0
  42. package/src/blocks/scan-report-generator/index.tsx +612 -0
  43. package/src/blocks/sidebar/index.tsx +2 -1
  44. package/src/blocks/signature-database-manager/SignatureDatabaseManager.stories.tsx +279 -0
  45. package/src/blocks/signature-database-manager/index.tsx +470 -0
  46. package/src/blocks/theme-creator-block/index.tsx +16 -2
  47. package/src/blocks/threat-alert-banner/ThreatAlertBanner.stories.tsx +152 -0
  48. package/src/blocks/threat-alert-banner/index.tsx +320 -0
  49. package/src/components/DataTable/DataTable.stories.tsx +203 -0
  50. package/src/components/DataTable/hooks/useDataTableExport.ts +38 -31
  51. package/src/components/DataTable/hooks/useDataTableImport.ts +31 -20
  52. package/src/components/error-boundary/ErrorBoundary.stories.tsx +125 -0
  53. package/src/components/index.ts +45 -4
  54. package/src/components/language-selector/LanguageSelector.stories.tsx +112 -0
  55. package/src/components/theme-selector/ThemeSelector.stories.tsx +77 -0
  56. package/src/components/toaster/Toaster.stories.tsx +67 -0
  57. package/src/components/waka-activity-feed/WakaActivityFeed.stories.tsx +116 -0
  58. package/src/components/waka-ad-banner/WakaAdBanner.stories.tsx +102 -0
  59. package/src/components/waka-ad-fallback/WakaAdFallback.stories.tsx +117 -0
  60. package/src/components/waka-ad-inline/WakaAdInline.stories.tsx +105 -0
  61. package/src/components/waka-ad-interstitial/WakaAdInterstitial.stories.tsx +92 -0
  62. package/src/components/waka-ad-placeholder/WakaAdPlaceholder.stories.tsx +89 -0
  63. package/src/components/waka-ad-provider/WakaAdProvider.stories.tsx +110 -0
  64. package/src/components/waka-ad-sidebar/WakaAdSidebar.stories.tsx +89 -0
  65. package/src/components/waka-ad-sidebar/index.tsx +3 -2
  66. package/src/components/waka-ad-sticky-footer/WakaAdStickyFooter.stories.tsx +88 -0
  67. package/src/components/waka-address-autocomplete/WakaAddressAutocomplete.stories.tsx +46 -0
  68. package/src/components/waka-admincrumb/WakaAdmincrumb.stories.tsx +166 -0
  69. package/src/components/waka-alert-panel/WakaAlertPanel.stories.tsx +45 -0
  70. package/src/components/waka-alert-stack/WakaAlertStack.stories.tsx +62 -0
  71. package/src/components/waka-allocation-matrix/WakaAllocationMatrix.stories.tsx +68 -0
  72. package/src/components/waka-approval-chain/WakaApprovalChain.stories.tsx +63 -0
  73. package/src/components/waka-audit-log/WakaAuditLog.stories.tsx +73 -0
  74. package/src/components/waka-autocomplete/WakaAutocomplete.stories.tsx +132 -172
  75. package/src/components/waka-biometric-prompt/WakaBiometricPrompt.stories.tsx +48 -0
  76. package/src/components/waka-breadcrumb/WakaBreadcrumb.stories.tsx +74 -191
  77. package/src/components/waka-breadcrumb-path/WakaBreadcrumbPath.stories.tsx +40 -0
  78. package/src/components/waka-budget-burn/WakaBudgetBurn.stories.tsx +86 -0
  79. package/src/components/waka-capacity-planner/WakaCapacityPlanner.stories.tsx +273 -0
  80. package/src/components/waka-cart-summary/WakaCartSummary.stories.tsx +176 -0
  81. package/src/components/waka-cart-summary/index.tsx +19 -10
  82. package/src/components/waka-challenge-timer/WakaChallengeTimer.stories.tsx +98 -0
  83. package/src/components/waka-chat-bubble/WakaChatBubble.stories.tsx +118 -0
  84. package/src/components/waka-checklist/WakaChecklist.stories.tsx +71 -0
  85. package/src/components/waka-checkout-stepper/WakaCheckoutStepper.stories.tsx +102 -0
  86. package/src/components/waka-cohort-table/WakaCohortTable.stories.tsx +56 -0
  87. package/src/components/waka-color-picker/WakaColorPicker.stories.tsx +99 -155
  88. package/src/components/waka-combo-counter/WakaComboCounter.stories.tsx +128 -0
  89. package/src/components/waka-command-bar/WakaCommandBar.stories.tsx +45 -0
  90. package/src/components/waka-compare-period/WakaComparePeriod.stories.tsx +76 -0
  91. package/src/components/waka-config-comparator/WakaConfigComparator.stories.tsx +143 -0
  92. package/src/components/waka-connection-matrix/WakaConnectionMatrix.stories.tsx +52 -0
  93. package/src/components/waka-content-recommendation/WakaContentRecommendation.stories.tsx +41 -0
  94. package/src/components/waka-coupon-input/WakaCouponInput.stories.tsx +126 -0
  95. package/src/components/waka-credit-card-input/WakaCreditCardInput.stories.tsx +120 -0
  96. package/src/components/waka-datetime-picker.form-integration/WakaDateTimePickerForm.stories.tsx +79 -0
  97. package/src/components/waka-dependency-tree/WakaDependencyTree.stories.tsx +72 -0
  98. package/src/components/waka-device-trust/WakaDeviceTrust.stories.tsx +109 -0
  99. package/src/components/waka-empty-state/WakaEmptyState.stories.tsx +87 -0
  100. package/src/components/waka-feature-announcement/WakaFeatureAnnouncement.stories.tsx +47 -0
  101. package/src/components/waka-feature-flag-row/WakaFeatureFlagRow.stories.tsx +188 -0
  102. package/src/components/waka-file-upload/WakaFileUpload.stories.tsx +118 -174
  103. package/src/components/waka-floating-nav/WakaFloatingNav.stories.tsx +53 -0
  104. package/src/components/waka-goal-progress/WakaGoalProgress.stories.tsx +137 -0
  105. package/src/components/waka-hotspot/WakaHotspot.stories.tsx +56 -0
  106. package/src/components/waka-invoice-preview/WakaInvoicePreview.stories.tsx +169 -0
  107. package/src/components/waka-kpi-dashboard/WakaKpiDashboard.stories.tsx +46 -0
  108. package/src/components/waka-level-progress/WakaLevelProgress.stories.tsx +94 -75
  109. package/src/components/waka-liquid-button/WakaLiquidButton.stories.tsx +45 -0
  110. package/src/components/waka-magic-link/WakaMagicLink.stories.tsx +61 -0
  111. package/src/components/waka-magnetic-button/WakaMagneticButton.stories.tsx +40 -0
  112. package/src/components/waka-mention-input/WakaMentionInput.stories.tsx +140 -0
  113. package/src/components/waka-milestone-road/WakaMilestoneRoad.stories.tsx +143 -0
  114. package/src/components/waka-orbital-menu/WakaOrbitalMenu.stories.tsx +54 -0
  115. package/src/components/waka-order-tracker/WakaOrderTracker.stories.tsx +163 -0
  116. package/src/components/waka-outstream-video/WakaOutstreamVideo.stories.tsx +94 -0
  117. package/src/components/waka-pagination/WakaPagination.stories.tsx +110 -280
  118. package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +132 -268
  119. package/src/components/waka-payment-method-picker/WakaPaymentMethodPicker.stories.tsx +141 -0
  120. package/src/components/waka-permission-matrix/WakaPermissionMatrix.stories.tsx +124 -0
  121. package/src/components/waka-phone-input/WakaPhoneInput.stories.tsx +56 -0
  122. package/src/components/waka-points-popup/WakaPointsPopup.stories.tsx +96 -0
  123. package/src/components/waka-power-up/WakaPowerUp.stories.tsx +121 -0
  124. package/src/components/waka-presence-indicator/WakaPresenceIndicator.stories.tsx +49 -0
  125. package/src/components/waka-pricing-table/WakaPricingTable.stories.tsx +159 -0
  126. package/src/components/waka-product-card/WakaProductCard.stories.tsx +202 -0
  127. package/src/components/waka-progress-onboarding/WakaProgressOnboarding.stories.tsx +57 -0
  128. package/src/components/waka-pull-to-refresh/WakaPullToRefresh.stories.tsx +51 -0
  129. package/src/components/waka-rank-badge/WakaRankBadge.stories.tsx +108 -0
  130. package/src/components/waka-rating-input/WakaRatingInput.stories.tsx +51 -0
  131. package/src/components/waka-reaction-picker/WakaReactionPicker.stories.tsx +52 -0
  132. package/src/components/waka-region-map/WakaRegionMap.stories.tsx +181 -0
  133. package/src/components/waka-resource-pool/WakaResourcePool.stories.tsx +70 -0
  134. package/src/components/waka-rich-text-editor/WakaRichTextEditor.stories.tsx +108 -197
  135. package/src/components/waka-rollback-slider/WakaRollbackSlider.stories.tsx +41 -0
  136. package/src/components/waka-schedule-picker/WakaSchedulePicker.stories.tsx +64 -0
  137. package/src/components/waka-season-pass/WakaSeasonPass.stories.tsx +107 -0
  138. package/src/components/waka-security-scan-result/WakaSecurityScanResult.stories.tsx +146 -0
  139. package/src/components/waka-security-score/WakaSecurityScore.stories.tsx +63 -0
  140. package/src/components/waka-session-manager/WakaSessionManager.stories.tsx +68 -0
  141. package/src/components/waka-signature-pad/WakaSignaturePad.stories.tsx +159 -0
  142. package/src/components/waka-signature-pad/index.tsx +5 -3
  143. package/src/components/waka-sla-tracker/WakaSlaTracker.stories.tsx +65 -0
  144. package/src/components/waka-slider-range/WakaSliderRange.stories.tsx +66 -0
  145. package/src/components/waka-sponsored-badge/WakaSponsoredBadge.stories.tsx +60 -0
  146. package/src/components/waka-sponsored-card/WakaSponsoredCard.stories.tsx +64 -0
  147. package/src/components/waka-sponsored-feed/WakaSponsoredFeed.stories.tsx +58 -0
  148. package/src/components/waka-spotlight/WakaSpotlight.stories.tsx +53 -0
  149. package/src/components/waka-stats-hexagon/WakaStatsHexagon.stories.tsx +161 -0
  150. package/src/components/waka-stepper/WakaStepper.stories.tsx +137 -410
  151. package/src/components/waka-swipe-card/WakaSwipeCard.stories.tsx +51 -0
  152. package/src/components/waka-tag-input/WakaTagInput.stories.tsx +224 -0
  153. package/src/components/waka-team-banner/WakaTeamBanner.stories.tsx +50 -0
  154. package/src/components/waka-theme-creator/WakaThemeCreator.stories.tsx +58 -0
  155. package/src/components/waka-theme-manager/WakaThemeManager.stories.tsx +298 -0
  156. package/src/components/waka-theme-manager/index.tsx +6 -11
  157. package/src/components/waka-thread-view/WakaThreadView.stories.tsx +143 -0
  158. package/src/components/waka-timeline/WakaTimeline.stories.tsx +171 -324
  159. package/src/components/waka-tooltip-tour/WakaTooltipTour.stories.tsx +92 -0
  160. package/src/components/waka-tour-guide/WakaTourGuide.stories.tsx +89 -0
  161. package/src/components/waka-treemap-chart/WakaTreemapChart.stories.tsx +234 -129
  162. package/src/components/waka-treemap-chart/index.tsx +2 -2
  163. package/src/components/waka-two-factor-setup/WakaTwoFactorSetup.stories.tsx +142 -0
  164. package/src/components/waka-typing-indicator/WakaTypingIndicator.stories.tsx +134 -0
  165. package/src/components/waka-video-ad/WakaVideoAd.stories.tsx +138 -0
  166. package/src/components/waka-video-call/WakaVideoCall.stories.tsx +186 -0
  167. package/src/components/waka-video-overlay/WakaVideoOverlay.stories.tsx +100 -0
  168. package/src/components/waka-voice-message/WakaVoiceMessage.stories.tsx +190 -0
  169. package/src/components/waka-welcome-modal/WakaWelcomeModal.stories.tsx +87 -0
  170. package/src/components/waka-xp-bar/WakaXPBar.stories.tsx +29 -29
  171. package/dist/useDataTableImport-D8R2HQl6.mjs +0 -229
  172. package/dist/useDataTableImport-S_hhA5Wo.js +0 -9
  173. package/src/components/DataTable/README.md +0 -446
@@ -1,41 +1,52 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
- import { WakaPagination, usePagination } from './index'
3
- import * as React from 'react'
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+ import { WakaPagination } from "./index"
3
+ import { useState } from "react"
4
4
 
5
5
  const meta: Meta<typeof WakaPagination> = {
6
- title: 'Components/Display/WakaPagination',
6
+ title: "Navigation/WakaPagination",
7
7
  component: WakaPagination,
8
8
  parameters: {
9
- layout: 'centered',
10
- docs: {
11
- description: {
12
- component: 'A pagination component with page navigation, size selection, and item information display.',
13
- },
14
- },
9
+ layout: "centered",
15
10
  },
16
- tags: ['autodocs'],
11
+ tags: ["autodocs"],
17
12
  argTypes: {
18
- size: {
19
- control: 'select',
20
- options: ['sm', 'md', 'lg'],
21
- description: 'Size of the buttons',
13
+ page: {
14
+ control: { type: "number", min: 1 },
15
+ description: "Page courante",
22
16
  },
23
- variant: {
24
- control: 'select',
25
- options: ['default', 'outline', 'ghost'],
26
- description: 'Visual variant',
17
+ totalPages: {
18
+ control: { type: "number", min: 1 },
19
+ description: "Nombre total de pages",
27
20
  },
28
- showFirstLast: {
29
- control: 'boolean',
30
- description: 'Show first/last page buttons',
21
+ pageSize: {
22
+ control: "number",
23
+ description: "Nombre d'éléments par page",
24
+ },
25
+ totalItems: {
26
+ control: "number",
27
+ description: "Nombre total d'éléments",
31
28
  },
32
29
  showPageSizeSelector: {
33
- control: 'boolean',
34
- description: 'Show page size selector',
30
+ control: "boolean",
31
+ description: "Afficher le sélecteur de taille de page",
35
32
  },
36
33
  showItemsInfo: {
37
- control: 'boolean',
38
- description: 'Show items information',
34
+ control: "boolean",
35
+ description: "Afficher les infos sur les éléments",
36
+ },
37
+ showFirstLast: {
38
+ control: "boolean",
39
+ description: "Afficher les boutons premier/dernier",
40
+ },
41
+ size: {
42
+ control: "select",
43
+ options: ["sm", "md", "lg"],
44
+ description: "Taille des boutons",
45
+ },
46
+ variant: {
47
+ control: "select",
48
+ options: ["default", "outline", "ghost"],
49
+ description: "Variante visuelle",
39
50
  },
40
51
  },
41
52
  }
@@ -43,286 +54,105 @@ const meta: Meta<typeof WakaPagination> = {
43
54
  export default meta
44
55
  type Story = StoryObj<typeof WakaPagination>
45
56
 
57
+ const PaginationWrapper = (props: any) => {
58
+ const [page, setPage] = useState(props.page || 1)
59
+ const [pageSize, setPageSize] = useState(props.pageSize || 10)
60
+ return (
61
+ <WakaPagination
62
+ {...props}
63
+ page={page}
64
+ pageSize={pageSize}
65
+ onPageChange={setPage}
66
+ onPageSizeChange={setPageSize}
67
+ />
68
+ )
69
+ }
70
+
46
71
  export const Default: Story = {
47
72
  args: {
73
+ page: 1,
48
74
  totalPages: 10,
75
+ totalItems: 100,
76
+ pageSize: 10,
77
+ showFirstLast: true,
78
+ showItemsInfo: true,
49
79
  },
50
- render: (args) => {
51
- const [page, setPage] = React.useState(1)
52
- return (
53
- <WakaPagination
54
- {...args}
55
- page={page}
56
- onPageChange={setPage}
57
- />
58
- )
59
- },
60
- }
61
-
62
- export const WithItemsInfo: Story = {
63
- render: () => {
64
- const [page, setPage] = React.useState(1)
65
- return (
66
- <WakaPagination
67
- page={page}
68
- totalPages={10}
69
- totalItems={95}
70
- pageSize={10}
71
- onPageChange={setPage}
72
- showItemsInfo
73
- />
74
- )
75
- },
80
+ render: (args) => <PaginationWrapper {...args} />,
76
81
  }
77
82
 
78
83
  export const WithPageSizeSelector: Story = {
79
- render: () => {
80
- const [page, setPage] = React.useState(1)
81
- const [pageSize, setPageSize] = React.useState(10)
82
- const totalItems = 247
83
- const totalPages = Math.ceil(totalItems / pageSize)
84
-
85
- return (
86
- <WakaPagination
87
- page={page}
88
- totalPages={totalPages}
89
- totalItems={totalItems}
90
- pageSize={pageSize}
91
- onPageChange={setPage}
92
- onPageSizeChange={(size) => {
93
- setPageSize(size)
94
- setPage(1)
95
- }}
96
- showPageSizeSelector
97
- showItemsInfo
98
- />
99
- )
100
- },
101
- }
102
-
103
- export const Sizes: Story = {
104
- render: () => {
105
- const [page, setPage] = React.useState(5)
106
-
107
- return (
108
- <div className="space-y-8">
109
- <div>
110
- <p className="text-sm text-muted-foreground mb-2">Small</p>
111
- <WakaPagination
112
- page={page}
113
- totalPages={10}
114
- onPageChange={setPage}
115
- size="sm"
116
- />
117
- </div>
118
- <div>
119
- <p className="text-sm text-muted-foreground mb-2">Medium (Default)</p>
120
- <WakaPagination
121
- page={page}
122
- totalPages={10}
123
- onPageChange={setPage}
124
- size="md"
125
- />
126
- </div>
127
- <div>
128
- <p className="text-sm text-muted-foreground mb-2">Large</p>
129
- <WakaPagination
130
- page={page}
131
- totalPages={10}
132
- onPageChange={setPage}
133
- size="lg"
134
- />
135
- </div>
136
- </div>
137
- )
84
+ args: {
85
+ page: 1,
86
+ totalPages: 20,
87
+ totalItems: 200,
88
+ pageSize: 10,
89
+ pageSizeOptions: [5, 10, 20, 50],
90
+ showPageSizeSelector: true,
91
+ showItemsInfo: true,
92
+ showFirstLast: true,
138
93
  },
94
+ render: (args) => <PaginationWrapper {...args} />,
139
95
  }
140
96
 
141
- export const Variants: Story = {
142
- render: () => {
143
- const [page, setPage] = React.useState(5)
144
-
145
- return (
146
- <div className="space-y-8">
147
- <div>
148
- <p className="text-sm text-muted-foreground mb-2">Default</p>
149
- <WakaPagination
150
- page={page}
151
- totalPages={10}
152
- onPageChange={setPage}
153
- variant="default"
154
- />
155
- </div>
156
- <div>
157
- <p className="text-sm text-muted-foreground mb-2">Outline</p>
158
- <WakaPagination
159
- page={page}
160
- totalPages={10}
161
- onPageChange={setPage}
162
- variant="outline"
163
- />
164
- </div>
165
- <div>
166
- <p className="text-sm text-muted-foreground mb-2">Ghost</p>
167
- <WakaPagination
168
- page={page}
169
- totalPages={10}
170
- onPageChange={setPage}
171
- variant="ghost"
172
- />
173
- </div>
174
- </div>
175
- )
97
+ export const Simple: Story = {
98
+ args: {
99
+ page: 5,
100
+ totalPages: 10,
101
+ showFirstLast: false,
102
+ showItemsInfo: false,
176
103
  },
104
+ render: (args) => <PaginationWrapper {...args} />,
177
105
  }
178
106
 
179
107
  export const ManyPages: Story = {
180
- render: () => {
181
- const [page, setPage] = React.useState(50)
182
- return (
183
- <WakaPagination
184
- page={page}
185
- totalPages={100}
186
- onPageChange={setPage}
187
- maxVisiblePages={7}
188
- />
189
- )
108
+ args: {
109
+ page: 25,
110
+ totalPages: 100,
111
+ totalItems: 1000,
112
+ pageSize: 10,
113
+ showFirstLast: true,
114
+ showItemsInfo: true,
190
115
  },
116
+ render: (args) => <PaginationWrapper {...args} />,
191
117
  }
192
118
 
193
119
  export const FewPages: Story = {
194
- render: () => {
195
- const [page, setPage] = React.useState(2)
196
- return (
197
- <WakaPagination
198
- page={page}
199
- totalPages={3}
200
- onPageChange={setPage}
201
- />
202
- )
203
- },
204
- }
205
-
206
- export const NoFirstLast: Story = {
207
- render: () => {
208
- const [page, setPage] = React.useState(5)
209
- return (
210
- <WakaPagination
211
- page={page}
212
- totalPages={10}
213
- onPageChange={setPage}
214
- showFirstLast={false}
215
- />
216
- )
120
+ args: {
121
+ page: 2,
122
+ totalPages: 3,
123
+ totalItems: 25,
124
+ pageSize: 10,
125
+ showFirstLast: true,
126
+ showItemsInfo: true,
217
127
  },
128
+ render: (args) => <PaginationWrapper {...args} />,
218
129
  }
219
130
 
220
- export const WithHook: Story = {
221
- render: () => {
222
- const pagination = usePagination({
223
- totalItems: 156,
224
- initialPageSize: 10,
225
- initialPage: 1,
226
- })
227
-
228
- return (
229
- <div className="space-y-4">
230
- <WakaPagination
231
- page={pagination.page}
232
- totalPages={pagination.totalPages}
233
- totalItems={156}
234
- pageSize={pagination.pageSize}
235
- onPageChange={pagination.setPage}
236
- onPageSizeChange={pagination.setPageSize}
237
- showPageSizeSelector
238
- showItemsInfo
239
- />
240
- <div className="text-sm text-muted-foreground">
241
- Showing items {pagination.startIndex + 1} to {pagination.endIndex + 1}
242
- </div>
243
- </div>
244
- )
131
+ export const FirstPage: Story = {
132
+ args: {
133
+ page: 1,
134
+ totalPages: 10,
135
+ showFirstLast: true,
245
136
  },
137
+ render: (args) => <PaginationWrapper {...args} />,
246
138
  }
247
139
 
248
- export const TableExample: Story = {
249
- render: () => {
250
- const allData = Array.from({ length: 47 }, (_, i) => ({
251
- id: i + 1,
252
- name: `User ${i + 1}`,
253
- email: `user${i + 1}@example.com`,
254
- role: ['Admin', 'Editor', 'Viewer'][i % 3],
255
- }))
256
-
257
- const pagination = usePagination({
258
- totalItems: allData.length,
259
- initialPageSize: 10,
260
- })
261
-
262
- const visibleData = allData.slice(pagination.startIndex, pagination.endIndex + 1)
263
-
264
- return (
265
- <div className="w-[600px] border rounded-lg">
266
- <table className="w-full">
267
- <thead className="bg-muted">
268
- <tr>
269
- <th className="px-4 py-2 text-left text-sm">ID</th>
270
- <th className="px-4 py-2 text-left text-sm">Name</th>
271
- <th className="px-4 py-2 text-left text-sm">Email</th>
272
- <th className="px-4 py-2 text-left text-sm">Role</th>
273
- </tr>
274
- </thead>
275
- <tbody>
276
- {visibleData.map((row) => (
277
- <tr key={row.id} className="border-t">
278
- <td className="px-4 py-2 text-sm">{row.id}</td>
279
- <td className="px-4 py-2 text-sm">{row.name}</td>
280
- <td className="px-4 py-2 text-sm text-muted-foreground">{row.email}</td>
281
- <td className="px-4 py-2 text-sm">{row.role}</td>
282
- </tr>
283
- ))}
284
- </tbody>
285
- </table>
286
- <div className="border-t p-4">
287
- <WakaPagination
288
- page={pagination.page}
289
- totalPages={pagination.totalPages}
290
- totalItems={allData.length}
291
- pageSize={pagination.pageSize}
292
- onPageChange={pagination.setPage}
293
- onPageSizeChange={pagination.setPageSize}
294
- showPageSizeSelector
295
- showItemsInfo
296
- pageSizeOptions={[5, 10, 20]}
297
- />
298
- </div>
299
- </div>
300
- )
140
+ export const LastPage: Story = {
141
+ args: {
142
+ page: 10,
143
+ totalPages: 10,
144
+ showFirstLast: true,
301
145
  },
146
+ render: (args) => <PaginationWrapper {...args} />,
302
147
  }
303
148
 
304
- export const CustomLabels: Story = {
305
- render: () => {
306
- const [page, setPage] = React.useState(1)
307
- return (
308
- <WakaPagination
309
- page={page}
310
- totalPages={10}
311
- totalItems={95}
312
- pageSize={10}
313
- onPageChange={setPage}
314
- showItemsInfo
315
- labels={{
316
- page: 'Page',
317
- of: 'of',
318
- items: 'results',
319
- itemsPerPage: 'Per page',
320
- first: 'Go to first',
321
- previous: 'Previous',
322
- next: 'Next',
323
- last: 'Go to last',
324
- }}
325
- />
326
- )
149
+ export const SinglePage: Story = {
150
+ args: {
151
+ page: 1,
152
+ totalPages: 1,
153
+ totalItems: 5,
154
+ pageSize: 10,
155
+ showItemsInfo: true,
327
156
  },
157
+ render: (args) => <PaginationWrapper {...args} />,
328
158
  }