@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.
- package/dist/blocks/antivirus-dashboard/index.d.ts +44 -0
- package/dist/blocks/clamav-service-status/index.d.ts +35 -0
- package/dist/blocks/file-scan-uploader/index.d.ts +29 -0
- package/dist/blocks/index.d.ts +18 -9
- package/dist/blocks/quarantine-manager/index.d.ts +27 -0
- package/dist/blocks/scan-history-log/index.d.ts +28 -0
- package/dist/blocks/scan-policy-editor/index.d.ts +27 -0
- package/dist/blocks/scan-report-generator/index.d.ts +47 -0
- package/dist/blocks/signature-database-manager/index.d.ts +39 -0
- package/dist/blocks/threat-alert-banner/index.d.ts +26 -0
- package/dist/components/index.d.ts +4 -4
- package/dist/components/waka-signature-pad/index.d.ts +1 -1
- package/dist/exceljs.min-BcLLX0PC.js +29 -0
- package/dist/exceljs.min-KOayaaQ4.mjs +23013 -0
- package/dist/export.cjs.js +1 -1
- package/dist/export.d.ts +2 -2
- package/dist/export.es.js +1 -1
- package/dist/index.cjs.js +136 -136
- package/dist/index.es.js +29978 -27215
- package/dist/stories/Button.stories.d.ts +1 -1
- package/dist/stories/Header.stories.d.ts +1 -1
- package/dist/stories/Page.stories.d.ts +1 -1
- package/dist/useDataTableImport-COVnvslz.js +9 -0
- package/dist/useDataTableImport-DAlxBY8w.mjs +237 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/logger.d.ts +9 -0
- package/package.json +6 -5
- package/src/blocks/antivirus-dashboard/AntivirusDashboard.stories.tsx +291 -0
- package/src/blocks/antivirus-dashboard/index.tsx +525 -0
- package/src/blocks/clamav-service-status/ClamAVServiceStatus.stories.tsx +195 -0
- package/src/blocks/clamav-service-status/index.tsx +370 -0
- package/src/blocks/file-scan-uploader/FileScanUploader.stories.tsx +257 -0
- package/src/blocks/file-scan-uploader/index.tsx +311 -0
- package/src/blocks/index.ts +163 -11
- package/src/blocks/quarantine-manager/QuarantineManager.stories.tsx +209 -0
- package/src/blocks/quarantine-manager/index.tsx +435 -0
- package/src/blocks/scan-history-log/ScanHistoryLog.stories.tsx +231 -0
- package/src/blocks/scan-history-log/index.tsx +406 -0
- package/src/blocks/scan-policy-editor/ScanPolicyEditor.stories.tsx +106 -0
- package/src/blocks/scan-policy-editor/index.tsx +418 -0
- package/src/blocks/scan-report-generator/ScanReportGenerator.stories.tsx +232 -0
- package/src/blocks/scan-report-generator/index.tsx +612 -0
- package/src/blocks/sidebar/index.tsx +2 -1
- package/src/blocks/signature-database-manager/SignatureDatabaseManager.stories.tsx +279 -0
- package/src/blocks/signature-database-manager/index.tsx +470 -0
- package/src/blocks/theme-creator-block/index.tsx +16 -2
- package/src/blocks/threat-alert-banner/ThreatAlertBanner.stories.tsx +152 -0
- package/src/blocks/threat-alert-banner/index.tsx +320 -0
- package/src/components/DataTable/DataTable.stories.tsx +203 -0
- package/src/components/DataTable/hooks/useDataTableExport.ts +38 -31
- package/src/components/DataTable/hooks/useDataTableImport.ts +31 -20
- package/src/components/error-boundary/ErrorBoundary.stories.tsx +125 -0
- package/src/components/index.ts +45 -4
- package/src/components/language-selector/LanguageSelector.stories.tsx +112 -0
- package/src/components/theme-selector/ThemeSelector.stories.tsx +77 -0
- package/src/components/toaster/Toaster.stories.tsx +67 -0
- package/src/components/waka-activity-feed/WakaActivityFeed.stories.tsx +116 -0
- package/src/components/waka-ad-banner/WakaAdBanner.stories.tsx +102 -0
- package/src/components/waka-ad-fallback/WakaAdFallback.stories.tsx +117 -0
- package/src/components/waka-ad-inline/WakaAdInline.stories.tsx +105 -0
- package/src/components/waka-ad-interstitial/WakaAdInterstitial.stories.tsx +92 -0
- package/src/components/waka-ad-placeholder/WakaAdPlaceholder.stories.tsx +89 -0
- package/src/components/waka-ad-provider/WakaAdProvider.stories.tsx +110 -0
- package/src/components/waka-ad-sidebar/WakaAdSidebar.stories.tsx +89 -0
- package/src/components/waka-ad-sidebar/index.tsx +3 -2
- package/src/components/waka-ad-sticky-footer/WakaAdStickyFooter.stories.tsx +88 -0
- package/src/components/waka-address-autocomplete/WakaAddressAutocomplete.stories.tsx +46 -0
- package/src/components/waka-admincrumb/WakaAdmincrumb.stories.tsx +166 -0
- package/src/components/waka-alert-panel/WakaAlertPanel.stories.tsx +45 -0
- package/src/components/waka-alert-stack/WakaAlertStack.stories.tsx +62 -0
- package/src/components/waka-allocation-matrix/WakaAllocationMatrix.stories.tsx +68 -0
- package/src/components/waka-approval-chain/WakaApprovalChain.stories.tsx +63 -0
- package/src/components/waka-audit-log/WakaAuditLog.stories.tsx +73 -0
- package/src/components/waka-autocomplete/WakaAutocomplete.stories.tsx +132 -172
- package/src/components/waka-biometric-prompt/WakaBiometricPrompt.stories.tsx +48 -0
- package/src/components/waka-breadcrumb/WakaBreadcrumb.stories.tsx +74 -191
- package/src/components/waka-breadcrumb-path/WakaBreadcrumbPath.stories.tsx +40 -0
- package/src/components/waka-budget-burn/WakaBudgetBurn.stories.tsx +86 -0
- package/src/components/waka-capacity-planner/WakaCapacityPlanner.stories.tsx +273 -0
- package/src/components/waka-cart-summary/WakaCartSummary.stories.tsx +176 -0
- package/src/components/waka-cart-summary/index.tsx +19 -10
- package/src/components/waka-challenge-timer/WakaChallengeTimer.stories.tsx +98 -0
- package/src/components/waka-chat-bubble/WakaChatBubble.stories.tsx +118 -0
- package/src/components/waka-checklist/WakaChecklist.stories.tsx +71 -0
- package/src/components/waka-checkout-stepper/WakaCheckoutStepper.stories.tsx +102 -0
- package/src/components/waka-cohort-table/WakaCohortTable.stories.tsx +56 -0
- package/src/components/waka-color-picker/WakaColorPicker.stories.tsx +99 -155
- package/src/components/waka-combo-counter/WakaComboCounter.stories.tsx +128 -0
- package/src/components/waka-command-bar/WakaCommandBar.stories.tsx +45 -0
- package/src/components/waka-compare-period/WakaComparePeriod.stories.tsx +76 -0
- package/src/components/waka-config-comparator/WakaConfigComparator.stories.tsx +143 -0
- package/src/components/waka-connection-matrix/WakaConnectionMatrix.stories.tsx +52 -0
- package/src/components/waka-content-recommendation/WakaContentRecommendation.stories.tsx +41 -0
- package/src/components/waka-coupon-input/WakaCouponInput.stories.tsx +126 -0
- package/src/components/waka-credit-card-input/WakaCreditCardInput.stories.tsx +120 -0
- package/src/components/waka-datetime-picker.form-integration/WakaDateTimePickerForm.stories.tsx +79 -0
- package/src/components/waka-dependency-tree/WakaDependencyTree.stories.tsx +72 -0
- package/src/components/waka-device-trust/WakaDeviceTrust.stories.tsx +109 -0
- package/src/components/waka-empty-state/WakaEmptyState.stories.tsx +87 -0
- package/src/components/waka-feature-announcement/WakaFeatureAnnouncement.stories.tsx +47 -0
- package/src/components/waka-feature-flag-row/WakaFeatureFlagRow.stories.tsx +188 -0
- package/src/components/waka-file-upload/WakaFileUpload.stories.tsx +118 -174
- package/src/components/waka-floating-nav/WakaFloatingNav.stories.tsx +53 -0
- package/src/components/waka-goal-progress/WakaGoalProgress.stories.tsx +137 -0
- package/src/components/waka-hotspot/WakaHotspot.stories.tsx +56 -0
- package/src/components/waka-invoice-preview/WakaInvoicePreview.stories.tsx +169 -0
- package/src/components/waka-kpi-dashboard/WakaKpiDashboard.stories.tsx +46 -0
- package/src/components/waka-level-progress/WakaLevelProgress.stories.tsx +94 -75
- package/src/components/waka-liquid-button/WakaLiquidButton.stories.tsx +45 -0
- package/src/components/waka-magic-link/WakaMagicLink.stories.tsx +61 -0
- package/src/components/waka-magnetic-button/WakaMagneticButton.stories.tsx +40 -0
- package/src/components/waka-mention-input/WakaMentionInput.stories.tsx +140 -0
- package/src/components/waka-milestone-road/WakaMilestoneRoad.stories.tsx +143 -0
- package/src/components/waka-orbital-menu/WakaOrbitalMenu.stories.tsx +54 -0
- package/src/components/waka-order-tracker/WakaOrderTracker.stories.tsx +163 -0
- package/src/components/waka-outstream-video/WakaOutstreamVideo.stories.tsx +94 -0
- package/src/components/waka-pagination/WakaPagination.stories.tsx +110 -280
- package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +132 -268
- package/src/components/waka-payment-method-picker/WakaPaymentMethodPicker.stories.tsx +141 -0
- package/src/components/waka-permission-matrix/WakaPermissionMatrix.stories.tsx +124 -0
- package/src/components/waka-phone-input/WakaPhoneInput.stories.tsx +56 -0
- package/src/components/waka-points-popup/WakaPointsPopup.stories.tsx +96 -0
- package/src/components/waka-power-up/WakaPowerUp.stories.tsx +121 -0
- package/src/components/waka-presence-indicator/WakaPresenceIndicator.stories.tsx +49 -0
- package/src/components/waka-pricing-table/WakaPricingTable.stories.tsx +159 -0
- package/src/components/waka-product-card/WakaProductCard.stories.tsx +202 -0
- package/src/components/waka-progress-onboarding/WakaProgressOnboarding.stories.tsx +57 -0
- package/src/components/waka-pull-to-refresh/WakaPullToRefresh.stories.tsx +51 -0
- package/src/components/waka-rank-badge/WakaRankBadge.stories.tsx +108 -0
- package/src/components/waka-rating-input/WakaRatingInput.stories.tsx +51 -0
- package/src/components/waka-reaction-picker/WakaReactionPicker.stories.tsx +52 -0
- package/src/components/waka-region-map/WakaRegionMap.stories.tsx +181 -0
- package/src/components/waka-resource-pool/WakaResourcePool.stories.tsx +70 -0
- package/src/components/waka-rich-text-editor/WakaRichTextEditor.stories.tsx +108 -197
- package/src/components/waka-rollback-slider/WakaRollbackSlider.stories.tsx +41 -0
- package/src/components/waka-schedule-picker/WakaSchedulePicker.stories.tsx +64 -0
- package/src/components/waka-season-pass/WakaSeasonPass.stories.tsx +107 -0
- package/src/components/waka-security-scan-result/WakaSecurityScanResult.stories.tsx +146 -0
- package/src/components/waka-security-score/WakaSecurityScore.stories.tsx +63 -0
- package/src/components/waka-session-manager/WakaSessionManager.stories.tsx +68 -0
- package/src/components/waka-signature-pad/WakaSignaturePad.stories.tsx +159 -0
- package/src/components/waka-signature-pad/index.tsx +5 -3
- package/src/components/waka-sla-tracker/WakaSlaTracker.stories.tsx +65 -0
- package/src/components/waka-slider-range/WakaSliderRange.stories.tsx +66 -0
- package/src/components/waka-sponsored-badge/WakaSponsoredBadge.stories.tsx +60 -0
- package/src/components/waka-sponsored-card/WakaSponsoredCard.stories.tsx +64 -0
- package/src/components/waka-sponsored-feed/WakaSponsoredFeed.stories.tsx +58 -0
- package/src/components/waka-spotlight/WakaSpotlight.stories.tsx +53 -0
- package/src/components/waka-stats-hexagon/WakaStatsHexagon.stories.tsx +161 -0
- package/src/components/waka-stepper/WakaStepper.stories.tsx +137 -410
- package/src/components/waka-swipe-card/WakaSwipeCard.stories.tsx +51 -0
- package/src/components/waka-tag-input/WakaTagInput.stories.tsx +224 -0
- package/src/components/waka-team-banner/WakaTeamBanner.stories.tsx +50 -0
- package/src/components/waka-theme-creator/WakaThemeCreator.stories.tsx +58 -0
- package/src/components/waka-theme-manager/WakaThemeManager.stories.tsx +298 -0
- package/src/components/waka-theme-manager/index.tsx +6 -11
- package/src/components/waka-thread-view/WakaThreadView.stories.tsx +143 -0
- package/src/components/waka-timeline/WakaTimeline.stories.tsx +171 -324
- package/src/components/waka-tooltip-tour/WakaTooltipTour.stories.tsx +92 -0
- package/src/components/waka-tour-guide/WakaTourGuide.stories.tsx +89 -0
- package/src/components/waka-treemap-chart/WakaTreemapChart.stories.tsx +234 -129
- package/src/components/waka-treemap-chart/index.tsx +2 -2
- package/src/components/waka-two-factor-setup/WakaTwoFactorSetup.stories.tsx +142 -0
- package/src/components/waka-typing-indicator/WakaTypingIndicator.stories.tsx +134 -0
- package/src/components/waka-video-ad/WakaVideoAd.stories.tsx +138 -0
- package/src/components/waka-video-call/WakaVideoCall.stories.tsx +186 -0
- package/src/components/waka-video-overlay/WakaVideoOverlay.stories.tsx +100 -0
- package/src/components/waka-voice-message/WakaVoiceMessage.stories.tsx +190 -0
- package/src/components/waka-welcome-modal/WakaWelcomeModal.stories.tsx +87 -0
- package/src/components/waka-xp-bar/WakaXPBar.stories.tsx +29 -29
- package/dist/useDataTableImport-D8R2HQl6.mjs +0 -229
- package/dist/useDataTableImport-S_hhA5Wo.js +0 -9
- package/src/components/DataTable/README.md +0 -446
|
@@ -1,41 +1,52 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
2
|
-
import { WakaPagination
|
|
3
|
-
import
|
|
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:
|
|
6
|
+
title: "Navigation/WakaPagination",
|
|
7
7
|
component: WakaPagination,
|
|
8
8
|
parameters: {
|
|
9
|
-
layout:
|
|
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: [
|
|
11
|
+
tags: ["autodocs"],
|
|
17
12
|
argTypes: {
|
|
18
|
-
|
|
19
|
-
control:
|
|
20
|
-
|
|
21
|
-
description: 'Size of the buttons',
|
|
13
|
+
page: {
|
|
14
|
+
control: { type: "number", min: 1 },
|
|
15
|
+
description: "Page courante",
|
|
22
16
|
},
|
|
23
|
-
|
|
24
|
-
control:
|
|
25
|
-
|
|
26
|
-
description: 'Visual variant',
|
|
17
|
+
totalPages: {
|
|
18
|
+
control: { type: "number", min: 1 },
|
|
19
|
+
description: "Nombre total de pages",
|
|
27
20
|
},
|
|
28
|
-
|
|
29
|
-
control:
|
|
30
|
-
description: '
|
|
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:
|
|
34
|
-
description:
|
|
30
|
+
control: "boolean",
|
|
31
|
+
description: "Afficher le sélecteur de taille de page",
|
|
35
32
|
},
|
|
36
33
|
showItemsInfo: {
|
|
37
|
-
control:
|
|
38
|
-
description:
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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
|
}
|