@commercetools/nimbus-mcp 0.1.0 → 2.11.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/README.md +63 -14
- package/data/docs/route-manifest.json +10998 -0
- package/data/docs/routes/components-accessibility-visually-hidden.json +388 -0
- package/data/docs/routes/components-accessibility.json +34 -0
- package/data/docs/routes/components-buttons-button.json +715 -0
- package/data/docs/routes/components-buttons-icon-button.json +852 -0
- package/data/docs/routes/components-buttons-icon-toggle-button.json +594 -0
- package/data/docs/routes/components-buttons-split-button.json +670 -0
- package/data/docs/routes/components-buttons-toggle-button-group.json +722 -0
- package/data/docs/routes/components-buttons-toggle-button.json +689 -0
- package/data/docs/routes/components-buttons.json +36 -0
- package/data/docs/routes/components-data-display-badge.json +555 -0
- package/data/docs/routes/components-data-display-card.json +338 -0
- package/data/docs/routes/components-data-display-data-table.json +855 -0
- package/data/docs/routes/components-data-display-draggable-list.json +596 -0
- package/data/docs/routes/components-data-display-table.json +472 -0
- package/data/docs/routes/components-data-display-tag-group.json +535 -0
- package/data/docs/routes/components-data-display.json +34 -0
- package/data/docs/routes/components-feedback-alert.json +696 -0
- package/data/docs/routes/components-feedback-dialog.json +682 -0
- package/data/docs/routes/components-feedback-drawer.json +600 -0
- package/data/docs/routes/components-feedback-loading-spinner.json +415 -0
- package/data/docs/routes/components-feedback-progress-bar.json +661 -0
- package/data/docs/routes/components-feedback-toast.json +1040 -0
- package/data/docs/routes/components-feedback-tooltip.json +510 -0
- package/data/docs/routes/components-feedback.json +34 -0
- package/data/docs/routes/components-forms-field-errors.json +557 -0
- package/data/docs/routes/components-forms-form-field.json +848 -0
- package/data/docs/routes/components-forms-group.json +427 -0
- package/data/docs/routes/components-forms-localized-field.json +770 -0
- package/data/docs/routes/components-forms.json +37 -0
- package/data/docs/routes/components-inputs-calendar.json +611 -0
- package/data/docs/routes/components-inputs-checkbox.json +774 -0
- package/data/docs/routes/components-inputs-combo-box.json +761 -0
- package/data/docs/routes/components-inputs-date-input.json +628 -0
- package/data/docs/routes/components-inputs-date-picker.json +709 -0
- package/data/docs/routes/components-inputs-date-range-picker.json +599 -0
- package/data/docs/routes/components-inputs-money-input.json +721 -0
- package/data/docs/routes/components-inputs-multiline-text-input.json +611 -0
- package/data/docs/routes/components-inputs-number-input.json +647 -0
- package/data/docs/routes/components-inputs-password-input.json +576 -0
- package/data/docs/routes/components-inputs-radio-input.json +583 -0
- package/data/docs/routes/components-inputs-range-calendar.json +607 -0
- package/data/docs/routes/components-inputs-rich-text-input.json +599 -0
- package/data/docs/routes/components-inputs-scoped-search-input.json +570 -0
- package/data/docs/routes/components-inputs-search-input.json +588 -0
- package/data/docs/routes/components-inputs-select-input.json +960 -0
- package/data/docs/routes/components-inputs-switch.json +720 -0
- package/data/docs/routes/components-inputs-text-input.json +566 -0
- package/data/docs/routes/components-inputs-time-input.json +775 -0
- package/data/docs/routes/components-inputs.json +34 -0
- package/data/docs/routes/components-layout-box.json +501 -0
- package/data/docs/routes/components-layout-defaultpage.json +748 -0
- package/data/docs/routes/components-layout-flex.json +587 -0
- package/data/docs/routes/components-layout-grid.json +393 -0
- package/data/docs/routes/components-layout-modalpage.json +716 -0
- package/data/docs/routes/components-layout-pagecontent.json +673 -0
- package/data/docs/routes/components-layout-scrollarea.json +428 -0
- package/data/docs/routes/components-layout-separator.json +461 -0
- package/data/docs/routes/components-layout-simple-grid.json +519 -0
- package/data/docs/routes/components-layout-spacer.json +573 -0
- package/data/docs/routes/components-layout-stack.json +481 -0
- package/data/docs/routes/components-layout.json +34 -0
- package/data/docs/routes/components-media-avatar.json +427 -0
- package/data/docs/routes/components-media-icon.json +663 -0
- package/data/docs/routes/components-media-image.json +511 -0
- package/data/docs/routes/components-media-inline-svg.json +586 -0
- package/data/docs/routes/components-media.json +34 -0
- package/data/docs/routes/components-navigation-accordion.json +643 -0
- package/data/docs/routes/components-navigation-collapsible-motion.json +628 -0
- package/data/docs/routes/components-navigation-link.json +554 -0
- package/data/docs/routes/components-navigation-menu.json +546 -0
- package/data/docs/routes/components-navigation-pagination.json +502 -0
- package/data/docs/routes/components-navigation-steps.json +629 -0
- package/data/docs/routes/components-navigation-tabnav.json +546 -0
- package/data/docs/routes/components-navigation-tabs.json +635 -0
- package/data/docs/routes/components-navigation-toolbar.json +549 -0
- package/data/docs/routes/components-navigation.json +34 -0
- package/data/docs/routes/components-typography-code.json +39 -0
- package/data/docs/routes/components-typography-heading.json +402 -0
- package/data/docs/routes/components-typography-kbd.json +399 -0
- package/data/docs/routes/components-typography-list.json +593 -0
- package/data/docs/routes/components-typography-text.json +444 -0
- package/data/docs/routes/components-typography.json +34 -0
- package/data/docs/routes/components-utilities-nimbus-i18n-provider.json +295 -0
- package/data/docs/routes/components-utilities-nimbus-provider.json +663 -0
- package/data/docs/routes/components-utilities.json +34 -0
- package/data/docs/routes/components.json +33 -0
- package/data/docs/routes/home-contribute-adrs-adr0001-consumer-component-apis.json +314 -0
- package/data/docs/routes/home-contribute-adrs-adr0002-compound-component-extraction.json +160 -0
- package/data/docs/routes/home-contribute-adrs-adr0003-component-lifecycle-states.json +460 -0
- package/data/docs/routes/home-contribute-adrs.json +205 -0
- package/data/docs/routes/home-contribute-development-setup.json +213 -0
- package/data/docs/routes/home-contribute-stats.json +36 -0
- package/data/docs/routes/home-contribute.json +36 -0
- package/data/docs/routes/home-design-tokens-aspect-ratios.json +36 -0
- package/data/docs/routes/home-design-tokens-borders.json +35 -0
- package/data/docs/routes/home-design-tokens-colors.json +157 -0
- package/data/docs/routes/home-design-tokens-other-animations.json +119 -0
- package/data/docs/routes/home-design-tokens-other-blurs.json +36 -0
- package/data/docs/routes/home-design-tokens-other-breakpoints.json +61 -0
- package/data/docs/routes/home-design-tokens-other-cursors.json +36 -0
- package/data/docs/routes/home-design-tokens-other-z-indices.json +39 -0
- package/data/docs/routes/home-design-tokens-other.json +35 -0
- package/data/docs/routes/home-design-tokens-radii.json +59 -0
- package/data/docs/routes/home-design-tokens-shadows.json +57 -0
- package/data/docs/routes/home-design-tokens-sizes.json +137 -0
- package/data/docs/routes/home-design-tokens-spacing.json +36 -0
- package/data/docs/routes/home-design-tokens-typography.json +184 -0
- package/data/docs/routes/home-design-tokens.json +34 -0
- package/data/docs/routes/home-getting-started-core-concepts.json +301 -0
- package/data/docs/routes/home-getting-started-installation.json +621 -0
- package/data/docs/routes/home-getting-started-mcp-server-overview.json +139 -0
- package/data/docs/routes/home-getting-started-mcp-server-setup.json +316 -0
- package/data/docs/routes/home-getting-started-release-process.json +294 -0
- package/data/docs/routes/home-getting-started-testing-setup.json +296 -0
- package/data/docs/routes/home-playground-markdown.json +638 -0
- package/data/docs/routes/home-playground-toc.json +169 -0
- package/data/docs/routes/home-playground.json +34 -0
- package/data/docs/routes/home-style-props-background.json +236 -0
- package/data/docs/routes/home-style-props-border.json +310 -0
- package/data/docs/routes/home-style-props-display.json +120 -0
- package/data/docs/routes/home-style-props-effects.json +116 -0
- package/data/docs/routes/home-style-props-filters.json +396 -0
- package/data/docs/routes/home-style-props-flex-and-grid.json +496 -0
- package/data/docs/routes/home-style-props-interactivity.json +356 -0
- package/data/docs/routes/home-style-props-layout.json +422 -0
- package/data/docs/routes/home-style-props-list.json +116 -0
- package/data/docs/routes/home-style-props-sizing.json +244 -0
- package/data/docs/routes/home-style-props-spacing.json +228 -0
- package/data/docs/routes/home-style-props-svg.json +96 -0
- package/data/docs/routes/home-style-props-tables.json +116 -0
- package/data/docs/routes/home-style-props-transforms.json +216 -0
- package/data/docs/routes/home-style-props-transitions.json +216 -0
- package/data/docs/routes/home-style-props-typography.json +536 -0
- package/data/docs/routes/home-style-props.json +33 -0
- package/data/docs/routes/home.json +32 -0
- package/data/docs/routes/hooks-usecopytoclipboard.json +76 -0
- package/data/docs/routes/hooks-usehotkeys.json +117 -0
- package/data/docs/routes/hooks.json +33 -0
- package/data/docs/routes/icons.json +32 -0
- package/data/docs/routes/patterns-fields-date-range-picker-field.json +393 -0
- package/data/docs/routes/patterns-fields-money-input-field.json +415 -0
- package/data/docs/routes/patterns-fields-multiline-text-input-field.json +404 -0
- package/data/docs/routes/patterns-fields-number-input-field.json +470 -0
- package/data/docs/routes/patterns-fields-password-input-field.json +319 -0
- package/data/docs/routes/patterns-fields-search-input-field.json +382 -0
- package/data/docs/routes/patterns-fields-text-input-field.json +404 -0
- package/data/docs/routes/patterns-fields.json +78 -0
- package/data/docs/routes/patterns.json +34 -0
- package/data/docs/search-index.json +1 -0
- package/data/docs/types/Accordion.json +12 -0
- package/data/docs/types/AccordionContent.json +286 -0
- package/data/docs/types/AccordionHeader.json +891 -0
- package/data/docs/types/AccordionHeaderRightContent.json +27 -0
- package/data/docs/types/AccordionItem.json +242 -0
- package/data/docs/types/AccordionRoot.json +162 -0
- package/data/docs/types/Alert.json +12 -0
- package/data/docs/types/AlertActions.json +11 -0
- package/data/docs/types/AlertDescription.json +118 -0
- package/data/docs/types/AlertDismissButton.json +937 -0
- package/data/docs/types/AlertRoot.json +42 -0
- package/data/docs/types/AlertTitle.json +118 -0
- package/data/docs/types/Avatar.json +125 -0
- package/data/docs/types/Badge.json +64 -0
- package/data/docs/types/Body.json +67 -0
- package/data/docs/types/Box.json +85 -0
- package/data/docs/types/Button.json +1015 -0
- package/data/docs/types/Calendar.json +565 -0
- package/data/docs/types/Caption.json +67 -0
- package/data/docs/types/Card.json +12 -0
- package/data/docs/types/CardContent.json +27 -0
- package/data/docs/types/CardHeader.json +27 -0
- package/data/docs/types/CardRoot.json +106 -0
- package/data/docs/types/Cell.json +227 -0
- package/data/docs/types/Checkbox.json +897 -0
- package/data/docs/types/Code.json +112 -0
- package/data/docs/types/CollapsibleMotionContent.json +35 -0
- package/data/docs/types/CollapsibleMotionRoot.json +99 -0
- package/data/docs/types/CollapsibleMotionTrigger.json +71 -0
- package/data/docs/types/Column.json +101 -0
- package/data/docs/types/ColumnGroup.json +101 -0
- package/data/docs/types/ColumnHeader.json +193 -0
- package/data/docs/types/ComboBoxListBox.json +751 -0
- package/data/docs/types/ComboBoxOption.json +672 -0
- package/data/docs/types/ComboBoxPopover.json +786 -0
- package/data/docs/types/ComboBoxRoot.json +747 -0
- package/data/docs/types/ComboBoxSection.json +277 -0
- package/data/docs/types/ComboBoxTrigger.json +70 -0
- package/data/docs/types/Content.json +33 -0
- package/data/docs/types/DataTable.json +596 -0
- package/data/docs/types/DataTableBody.json +223 -0
- package/data/docs/types/DataTableFooter.json +27 -0
- package/data/docs/types/DataTableHeader.json +269 -0
- package/data/docs/types/DataTableManager.json +11 -0
- package/data/docs/types/DataTableRoot.json +590 -0
- package/data/docs/types/DataTableTable.json +271 -0
- package/data/docs/types/DateInput.json +792 -0
- package/data/docs/types/DatePicker.json +700 -0
- package/data/docs/types/DateRangePicker.json +936 -0
- package/data/docs/types/DateRangePickerField.json +1047 -0
- package/data/docs/types/DefaultPage.json +12 -0
- package/data/docs/types/DefaultPageActions.json +27 -0
- package/data/docs/types/DefaultPageBackLink.json +213 -0
- package/data/docs/types/DefaultPageContent.json +27 -0
- package/data/docs/types/DefaultPageFooter.json +27 -0
- package/data/docs/types/DefaultPageHeader.json +27 -0
- package/data/docs/types/DefaultPageRoot.json +106 -0
- package/data/docs/types/DefaultPageSubtitle.json +27 -0
- package/data/docs/types/DefaultPageTabNav.json +28 -0
- package/data/docs/types/DefaultPageTitle.json +27 -0
- package/data/docs/types/DialogBody.json +27 -0
- package/data/docs/types/DialogCloseTrigger.json +939 -0
- package/data/docs/types/DialogContent.json +27 -0
- package/data/docs/types/DialogFooter.json +27 -0
- package/data/docs/types/DialogHeader.json +27 -0
- package/data/docs/types/DialogRoot.json +138 -0
- package/data/docs/types/DialogTitle.json +27 -0
- package/data/docs/types/DialogTrigger.json +80 -0
- package/data/docs/types/DraggableList.json +12 -0
- package/data/docs/types/DraggableListField.json +894 -0
- package/data/docs/types/DraggableListItem.json +574 -0
- package/data/docs/types/DraggableListRoot.json +745 -0
- package/data/docs/types/Drawer.json +12 -0
- package/data/docs/types/DrawerBody.json +27 -0
- package/data/docs/types/DrawerCloseTrigger.json +939 -0
- package/data/docs/types/DrawerContent.json +27 -0
- package/data/docs/types/DrawerFooter.json +27 -0
- package/data/docs/types/DrawerHeader.json +27 -0
- package/data/docs/types/DrawerRoot.json +142 -0
- package/data/docs/types/DrawerTitle.json +27 -0
- package/data/docs/types/DrawerTrigger.json +80 -0
- package/data/docs/types/FieldErrors.getBuiltInMessage.json +11 -0
- package/data/docs/types/FieldErrors.getCustomMessage.json +9 -0
- package/data/docs/types/FieldErrors.json +109 -0
- package/data/docs/types/Flex.json +238 -0
- package/data/docs/types/Footer.json +67 -0
- package/data/docs/types/FormFieldDescription.json +11 -0
- package/data/docs/types/FormFieldError.json +11 -0
- package/data/docs/types/FormFieldInfoBox.json +27 -0
- package/data/docs/types/FormFieldInput.json +11 -0
- package/data/docs/types/FormFieldLabel.json +11 -0
- package/data/docs/types/FormFieldRoot.json +148 -0
- package/data/docs/types/Grid.json +253 -0
- package/data/docs/types/GridProps.json +11 -0
- package/data/docs/types/Group.json +143 -0
- package/data/docs/types/Header.json +67 -0
- package/data/docs/types/Heading.json +109 -0
- package/data/docs/types/Icon.json +112 -0
- package/data/docs/types/IconButton.json +1019 -0
- package/data/docs/types/IconToggleButton.json +787 -0
- package/data/docs/types/Image.json +373 -0
- package/data/docs/types/Indicator.json +67 -0
- package/data/docs/types/InlineSvg.json +98 -0
- package/data/docs/types/Item.json +67 -0
- package/data/docs/types/Kbd.json +118 -0
- package/data/docs/types/Link.json +380 -0
- package/data/docs/types/List.json +12 -0
- package/data/docs/types/ListIndicator.json +70 -0
- package/data/docs/types/ListItem.json +70 -0
- package/data/docs/types/ListRoot.json +124 -0
- package/data/docs/types/LoadingSpinner.json +87 -0
- package/data/docs/types/LocalizedField.json +460 -0
- package/data/docs/types/LocalizedStringFormatter.json +9 -0
- package/data/docs/types/MakeElementFocusable.json +196 -0
- package/data/docs/types/MenuContent.json +111 -0
- package/data/docs/types/MenuItem.json +671 -0
- package/data/docs/types/MenuRoot.json +670 -0
- package/data/docs/types/MenuSection.json +364 -0
- package/data/docs/types/MenuSubmenu.json +111 -0
- package/data/docs/types/MenuSubmenuTrigger.json +67 -0
- package/data/docs/types/MenuTrigger.json +906 -0
- package/data/docs/types/ModalPage.json +12 -0
- package/data/docs/types/ModalPageActions.json +27 -0
- package/data/docs/types/ModalPageContent.json +27 -0
- package/data/docs/types/ModalPageFooter.json +27 -0
- package/data/docs/types/ModalPageHeader.json +27 -0
- package/data/docs/types/ModalPageRoot.json +87 -0
- package/data/docs/types/ModalPageSubtitle.json +27 -0
- package/data/docs/types/ModalPageTabNav.json +28 -0
- package/data/docs/types/ModalPageTitle.json +27 -0
- package/data/docs/types/ModalPageTopBar.json +57 -0
- package/data/docs/types/MoneyInput.isEmpty.json +40 -0
- package/data/docs/types/MoneyInput.json +282 -0
- package/data/docs/types/MoneyInputField.json +379 -0
- package/data/docs/types/MoneyInputFieldProps.json +9 -0
- package/data/docs/types/MultilineTextInput.json +1194 -0
- package/data/docs/types/MultilineTextInputField.json +1269 -0
- package/data/docs/types/MultilineTextInputFieldProps.json +9 -0
- package/data/docs/types/NimbusI18nProvider.json +42 -0
- package/data/docs/types/NimbusI18nProviderProps.json +9 -0
- package/data/docs/types/NimbusProvider.json +270 -0
- package/data/docs/types/NumberInput.json +952 -0
- package/data/docs/types/NumberInputField.json +1004 -0
- package/data/docs/types/NumberInputFieldProps.json +9 -0
- package/data/docs/types/PageContent.json +11 -0
- package/data/docs/types/PageContentColumn.json +99 -0
- package/data/docs/types/PageContentRoot.json +114 -0
- package/data/docs/types/Pagination.json +159 -0
- package/data/docs/types/PasswordInput.json +1120 -0
- package/data/docs/types/PasswordInputField.json +1216 -0
- package/data/docs/types/PasswordInputFieldProps.json +9 -0
- package/data/docs/types/ProgressBar.json +280 -0
- package/data/docs/types/RadioInputOption.json +550 -0
- package/data/docs/types/RadioInputRoot.json +514 -0
- package/data/docs/types/RangeCalendar.json +618 -0
- package/data/docs/types/RichTextInput.json +134 -0
- package/data/docs/types/Root.json +122 -0
- package/data/docs/types/Row.json +67 -0
- package/data/docs/types/ScopedSearchInput.isEmpty.json +40 -0
- package/data/docs/types/ScopedSearchInput.json +253 -0
- package/data/docs/types/ScrollArea.json +179 -0
- package/data/docs/types/ScrollAreaElementIds.json +9 -0
- package/data/docs/types/ScrollAreaProps.json +9 -0
- package/data/docs/types/SearchInput.json +1165 -0
- package/data/docs/types/SearchInputField.json +1240 -0
- package/data/docs/types/Select.json +12 -0
- package/data/docs/types/SelectOption.json +572 -0
- package/data/docs/types/SelectOptionGroup.json +215 -0
- package/data/docs/types/SelectOptions.json +693 -0
- package/data/docs/types/SelectRoot.json +926 -0
- package/data/docs/types/Separator.json +65 -0
- package/data/docs/types/SimpleGrid.json +291 -0
- package/data/docs/types/Spacer.json +27 -0
- package/data/docs/types/SpacerProps.json +9 -0
- package/data/docs/types/SplitButton.json +203 -0
- package/data/docs/types/Stack.json +144 -0
- package/data/docs/types/Steps.json +12 -0
- package/data/docs/types/StepsChangeDetails.json +9 -0
- package/data/docs/types/StepsCompletedContent.json +28 -0
- package/data/docs/types/StepsCompletedContentProps.json +9 -0
- package/data/docs/types/StepsContent.json +43 -0
- package/data/docs/types/StepsContentProps.json +9 -0
- package/data/docs/types/StepsDescription.json +28 -0
- package/data/docs/types/StepsDescriptionProps.json +9 -0
- package/data/docs/types/StepsIndicator.json +28 -0
- package/data/docs/types/StepsIndicatorProps.json +9 -0
- package/data/docs/types/StepsItem.json +43 -0
- package/data/docs/types/StepsItemProps.json +9 -0
- package/data/docs/types/StepsList.json +28 -0
- package/data/docs/types/StepsListProps.json +9 -0
- package/data/docs/types/StepsNextTrigger.json +62 -0
- package/data/docs/types/StepsNextTriggerProps.json +9 -0
- package/data/docs/types/StepsNumber.json +28 -0
- package/data/docs/types/StepsNumberProps.json +9 -0
- package/data/docs/types/StepsPrevTrigger.json +62 -0
- package/data/docs/types/StepsPrevTriggerProps.json +9 -0
- package/data/docs/types/StepsRoot.json +183 -0
- package/data/docs/types/StepsRootProps.json +11 -0
- package/data/docs/types/StepsSeparator.json +28 -0
- package/data/docs/types/StepsSeparatorProps.json +9 -0
- package/data/docs/types/StepsStatus.json +57 -0
- package/data/docs/types/StepsStatusProps.json +9 -0
- package/data/docs/types/StepsTitle.json +28 -0
- package/data/docs/types/StepsTitleProps.json +9 -0
- package/data/docs/types/StepsTrigger.json +47 -0
- package/data/docs/types/StepsTriggerProps.json +9 -0
- package/data/docs/types/Switch.json +371 -0
- package/data/docs/types/TabListProps.json +9 -0
- package/data/docs/types/TabNav.json +12 -0
- package/data/docs/types/TabNavItem.json +300 -0
- package/data/docs/types/TabNavItemProps.json +9 -0
- package/data/docs/types/TabNavProps.json +9 -0
- package/data/docs/types/TabNavRoot.json +80 -0
- package/data/docs/types/TabPanelProps.json +9 -0
- package/data/docs/types/TabPanelsProps.json +9 -0
- package/data/docs/types/TabProps.json +9 -0
- package/data/docs/types/Table.json +9 -0
- package/data/docs/types/TableBody.json +67 -0
- package/data/docs/types/TableBodyProps.json +9 -0
- package/data/docs/types/TableCaption.json +67 -0
- package/data/docs/types/TableCaptionProps.json +9 -0
- package/data/docs/types/TableCell.json +227 -0
- package/data/docs/types/TableCellProps.json +9 -0
- package/data/docs/types/TableColumn.json +101 -0
- package/data/docs/types/TableColumnGroup.json +101 -0
- package/data/docs/types/TableColumnGroupProps.json +9 -0
- package/data/docs/types/TableColumnHeader.json +193 -0
- package/data/docs/types/TableColumnHeaderProps.json +9 -0
- package/data/docs/types/TableColumnProps.json +9 -0
- package/data/docs/types/TableFooter.json +67 -0
- package/data/docs/types/TableFooterProps.json +9 -0
- package/data/docs/types/TableHeader.json +67 -0
- package/data/docs/types/TableHeaderProps.json +9 -0
- package/data/docs/types/TableRoot.json +365 -0
- package/data/docs/types/TableRootProps.json +12 -0
- package/data/docs/types/TableRow.json +67 -0
- package/data/docs/types/TableRowProps.json +9 -0
- package/data/docs/types/TableScrollArea.json +82 -0
- package/data/docs/types/TableScrollAreaProps.json +9 -0
- package/data/docs/types/Tabs.json +12 -0
- package/data/docs/types/TabsList.json +110 -0
- package/data/docs/types/TabsPanel.json +112 -0
- package/data/docs/types/TabsPanels.json +108 -0
- package/data/docs/types/TabsRoot.json +211 -0
- package/data/docs/types/TabsTab.json +174 -0
- package/data/docs/types/TagGroup.json +12 -0
- package/data/docs/types/TagGroupRoot.json +306 -0
- package/data/docs/types/TagGroupTag.json +595 -0
- package/data/docs/types/TagGroupTagList.json +166 -0
- package/data/docs/types/Text.json +119 -0
- package/data/docs/types/TextInput.json +1156 -0
- package/data/docs/types/TextInputField.json +1263 -0
- package/data/docs/types/TimeInput.json +752 -0
- package/data/docs/types/ToastAction.json +9 -0
- package/data/docs/types/ToastManagerApi.json +9 -0
- package/data/docs/types/ToastOptions.json +9 -0
- package/data/docs/types/ToastOutlet.json +12 -0
- package/data/docs/types/ToastPlacement.json +9 -0
- package/data/docs/types/ToastPromiseOptions.json +9 -0
- package/data/docs/types/ToastType.json +9 -0
- package/data/docs/types/ToastVariant.json +9 -0
- package/data/docs/types/ToggleButton.json +789 -0
- package/data/docs/types/ToggleButtonGroup.json +9 -0
- package/data/docs/types/ToggleButtonGroupButton.json +331 -0
- package/data/docs/types/ToggleButtonGroupRoot.json +269 -0
- package/data/docs/types/Toolbar.json +176 -0
- package/data/docs/types/Tooltip.json +12 -0
- package/data/docs/types/TooltipContent.json +372 -0
- package/data/docs/types/TooltipRoot.json +179 -0
- package/data/docs/types/Trigger.json +69 -0
- package/data/docs/types/VisuallyHidden.json +93 -0
- package/data/docs/types/__object.json +12 -0
- package/data/docs/types/filters.json +11 -0
- package/data/docs/types/manifest.json +280 -0
- package/data/docs/types/toast.json +234 -0
- package/data/docs/types/useColorMode.json +13 -0
- package/data/docs/types/useColorModeValue.json +13 -0
- package/data/docs/types/useColorScheme.json +12 -0
- package/data/docs/types/useLocalizedStringFormatter.json +14 -0
- package/data/icons.json +21940 -0
- package/data/tokens.json +40061 -0
- package/dist/index.js +2516 -17
- package/package.json +25 -6
- package/dist/data-loader.d.ts +0 -102
- package/dist/data-loader.js +0 -104
- package/dist/index.d.ts +0 -13
- package/dist/server.d.ts +0 -9
- package/dist/server.js +0 -22
- package/dist/server.spec.d.ts +0 -1
- package/dist/server.spec.js +0 -69
- package/dist/tools/list-components.d.ts +0 -9
- package/dist/tools/list-components.js +0 -42
- package/dist/types.d.ts +0 -28
- package/dist/types.js +0 -4
- package/src/data-loader.ts +0 -226
- package/src/index.ts +0 -29
- package/src/server.spec.ts +0 -86
- package/src/server.ts +0 -28
- package/src/tools/list-components.ts +0 -49
- package/src/types.ts +0 -31
- package/tsconfig.json +0 -14
- package/vitest.config.ts +0 -9
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"id": "Components-Pagination",
|
|
4
|
+
"title": "Pagination",
|
|
5
|
+
"exportName": "Pagination",
|
|
6
|
+
"description": "Pagination is a component that divides a large set of content or data into sequential pages, providing navigation controls to move between them.",
|
|
7
|
+
"lifecycleState": "Stable",
|
|
8
|
+
"order": 999,
|
|
9
|
+
"repoPath": "packages/nimbus/src/components/pagination/pagination.mdx",
|
|
10
|
+
"menu": [
|
|
11
|
+
"Components",
|
|
12
|
+
"Navigation",
|
|
13
|
+
"Pagination"
|
|
14
|
+
],
|
|
15
|
+
"route": "components/navigation/pagination",
|
|
16
|
+
"tags": [
|
|
17
|
+
"component",
|
|
18
|
+
"pagination",
|
|
19
|
+
"paging",
|
|
20
|
+
"navigation",
|
|
21
|
+
"pages"
|
|
22
|
+
],
|
|
23
|
+
"toc": [
|
|
24
|
+
{
|
|
25
|
+
"value": "Overview",
|
|
26
|
+
"href": "#overview",
|
|
27
|
+
"depth": 2,
|
|
28
|
+
"numbering": [
|
|
29
|
+
1,
|
|
30
|
+
1
|
|
31
|
+
],
|
|
32
|
+
"parent": "root"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"value": "Resources",
|
|
36
|
+
"href": "#resources",
|
|
37
|
+
"depth": 3,
|
|
38
|
+
"numbering": [
|
|
39
|
+
1,
|
|
40
|
+
1,
|
|
41
|
+
1
|
|
42
|
+
],
|
|
43
|
+
"parent": "root"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"value": "Variables",
|
|
47
|
+
"href": "#variables",
|
|
48
|
+
"depth": 2,
|
|
49
|
+
"numbering": [
|
|
50
|
+
1,
|
|
51
|
+
2
|
|
52
|
+
],
|
|
53
|
+
"parent": "root"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"value": "Visuals",
|
|
57
|
+
"href": "#visuals",
|
|
58
|
+
"depth": 3,
|
|
59
|
+
"numbering": [
|
|
60
|
+
1,
|
|
61
|
+
2,
|
|
62
|
+
1
|
|
63
|
+
],
|
|
64
|
+
"parent": "root"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"figmaLink": "https://www.figma.com/design/AvtPX6g7OGGCRvNlatGOIY/NIMBUS-design-system",
|
|
68
|
+
"layout": "app-frame",
|
|
69
|
+
"tabs": [
|
|
70
|
+
{
|
|
71
|
+
"key": "overview",
|
|
72
|
+
"title": "Overview",
|
|
73
|
+
"order": 0
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"key": "guidelines",
|
|
77
|
+
"title": "Guidelines",
|
|
78
|
+
"order": 2
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"key": "dev",
|
|
82
|
+
"title": "Implementation",
|
|
83
|
+
"order": 3
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"key": "a11y",
|
|
87
|
+
"title": "Accessibility",
|
|
88
|
+
"order": 4
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"mdx": "\n## Overview\n\nPagination contains controls for navigating with dedicated buttons for moving to the next and previous pages, visible page numbering for direct access, and clear feedback indicating the user's current page position within the total set of results.\n\n### Resources\n\nDeep dive into implementation details and access the Nimbus design library.\n\n[Figma library](https://www.figma.com/design/AvtPX6g7OGGCRvNlatGOIY/NIMBUS-design-system)\n\n## Variables\n\nGet familiar with the features.\n\n### Visuals\n\n**Page size selection paired with jump to page**\n\nUse this combination for the most control over viewing and jumping to pages. This is best suited for navigating pagination with a lot of resources. Allowing users to jump to different pages as needed. \n\n\n```jsx live\nconst App = () => {\n const [currentPage, setCurrentPage] = React.useState(1);\n const [pageSize, setPageSize] = React.useState(20);\n \n return (\n <Pagination\n totalItems={150}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n />\n );\n};\n```\n**Simplified paging without page input**\n\nThis combination allows users to select how many items appear on the page and tab through other existing pages. It simplifies paging but restricts users from jumping pages. This is better suited for content that is 20 pages or less. \n\n```jsx live\nconst App = () => {\n const [currentPage, setCurrentPage] = React.useState(1);\n const [pageSize, setPageSize] = React.useState(20);\n \n return (\n <Pagination\n totalItems={150}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n enablePageInput={false}\n />\n );\n};\n```\n\n**Without page size selector**\n\nThe simplest solution, and mainly for uses with minimal data or processes that have multiple steps. This won't allow users to select how much information is viewed on the page, but only to navigate through via tapping through the arrows.\n\n```jsx live\nconst App = () => {\n const [currentPage, setCurrentPage] = React.useState(1);\n \n return (\n <Box display=\"flex\" justifyContent=\"flex-start\">\n <Pagination\n totalItems={75}\n currentPage={currentPage}\n pageSize={15}\n onPageChange={setCurrentPage}\n enablePageInput={false}\n enablePageSizeSelector={false}\n />\n </Box>\n );\n};\n```\n",
|
|
93
|
+
"views": {
|
|
94
|
+
"overview": {
|
|
95
|
+
"mdx": "\n## Overview\n\nPagination contains controls for navigating with dedicated buttons for moving to the next and previous pages, visible page numbering for direct access, and clear feedback indicating the user's current page position within the total set of results.\n\n### Resources\n\nDeep dive into implementation details and access the Nimbus design library.\n\n[Figma library](https://www.figma.com/design/AvtPX6g7OGGCRvNlatGOIY/NIMBUS-design-system)\n\n## Variables\n\nGet familiar with the features.\n\n### Visuals\n\n**Page size selection paired with jump to page**\n\nUse this combination for the most control over viewing and jumping to pages. This is best suited for navigating pagination with a lot of resources. Allowing users to jump to different pages as needed. \n\n\n```jsx live\nconst App = () => {\n const [currentPage, setCurrentPage] = React.useState(1);\n const [pageSize, setPageSize] = React.useState(20);\n \n return (\n <Pagination\n totalItems={150}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n />\n );\n};\n```\n**Simplified paging without page input**\n\nThis combination allows users to select how many items appear on the page and tab through other existing pages. It simplifies paging but restricts users from jumping pages. This is better suited for content that is 20 pages or less. \n\n```jsx live\nconst App = () => {\n const [currentPage, setCurrentPage] = React.useState(1);\n const [pageSize, setPageSize] = React.useState(20);\n \n return (\n <Pagination\n totalItems={150}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n enablePageInput={false}\n />\n );\n};\n```\n\n**Without page size selector**\n\nThe simplest solution, and mainly for uses with minimal data or processes that have multiple steps. This won't allow users to select how much information is viewed on the page, but only to navigate through via tapping through the arrows.\n\n```jsx live\nconst App = () => {\n const [currentPage, setCurrentPage] = React.useState(1);\n \n return (\n <Box display=\"flex\" justifyContent=\"flex-start\">\n <Pagination\n totalItems={75}\n currentPage={currentPage}\n pageSize={15}\n onPageChange={setCurrentPage}\n enablePageInput={false}\n enablePageSizeSelector={false}\n />\n </Box>\n );\n};\n```\n",
|
|
96
|
+
"toc": [
|
|
97
|
+
{
|
|
98
|
+
"value": "Overview",
|
|
99
|
+
"href": "#overview",
|
|
100
|
+
"depth": 2,
|
|
101
|
+
"numbering": [
|
|
102
|
+
1,
|
|
103
|
+
1
|
|
104
|
+
],
|
|
105
|
+
"parent": "root"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"value": "Resources",
|
|
109
|
+
"href": "#resources",
|
|
110
|
+
"depth": 3,
|
|
111
|
+
"numbering": [
|
|
112
|
+
1,
|
|
113
|
+
1,
|
|
114
|
+
1
|
|
115
|
+
],
|
|
116
|
+
"parent": "root"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"value": "Variables",
|
|
120
|
+
"href": "#variables",
|
|
121
|
+
"depth": 2,
|
|
122
|
+
"numbering": [
|
|
123
|
+
1,
|
|
124
|
+
2
|
|
125
|
+
],
|
|
126
|
+
"parent": "root"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"value": "Visuals",
|
|
130
|
+
"href": "#visuals",
|
|
131
|
+
"depth": 3,
|
|
132
|
+
"numbering": [
|
|
133
|
+
1,
|
|
134
|
+
2,
|
|
135
|
+
1
|
|
136
|
+
],
|
|
137
|
+
"parent": "root"
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"a11y": {
|
|
142
|
+
"mdx": "\n## Accessibility\n\nAccessibility ensures that digital content and functionality are usable by\neveryone, including people with disabilities, by addressing visual, auditory,\ncognitive, and physical limitations.\n\n```jsx live\nconst App = () => {\n const [currentPage, setCurrentPage] = React.useState(1);\n const [pageSize, setPageSize] = React.useState(20);\n\n return (\n <Pagination\n totalItems={150}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n />\n );\n};\n```\n\n### Accessibility standards\n\n- **ARIA Roles:** Use `role=\"navigation\"` to identify the component as a\n navigation block. Use `aria-current=\"page\"` on the active page link/button to\n signal the user's location to screen readers.\n- **Keyboard Navigation:** Ensure the entire component is navigable using the\n Tab key and that all links/buttons are operable with the Enter key.\n- **Descriptive Text:** Use `aria-label` on the navigation buttons (\"Previous\n page,\" \"Next page\") to provide screen readers with unambiguous information,\n even if the visual text is just an arrow.\n- **Focus Indication:** Provide a strong, clear focus indicator on the currently\n active navigation item when using keyboard control.\n",
|
|
143
|
+
"toc": [
|
|
144
|
+
{
|
|
145
|
+
"value": "Accessibility",
|
|
146
|
+
"href": "#accessibility",
|
|
147
|
+
"depth": 2,
|
|
148
|
+
"numbering": [
|
|
149
|
+
1,
|
|
150
|
+
1
|
|
151
|
+
],
|
|
152
|
+
"parent": "root"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"value": "Accessibility standards",
|
|
156
|
+
"href": "#accessibility-standards",
|
|
157
|
+
"depth": 3,
|
|
158
|
+
"numbering": [
|
|
159
|
+
1,
|
|
160
|
+
1,
|
|
161
|
+
1
|
|
162
|
+
],
|
|
163
|
+
"parent": "root"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
"dev": {
|
|
168
|
+
"mdx": "\n## Getting started\n\n### Import\n\n```tsx\nimport { Pagination, type PaginationProps } from '@commercetools/nimbus';\n```\n\n### Basic usage\n\nThe simplest implementation requires managing the pagination state:\n\n```jsx live-dev\nconst App = () => {\n const [currentPage, setCurrentPage] = useState<PaginationProps[\"currentPage\"]>(1);\n const [pageSize, setPageSize] = useState<PaginationProps[\"pageSize\"]>(10);\n\n const totalItems = 100;\n\n return (\n <Stack direction=\"column\" gap=\"400\">\n <Text>Total items: {totalItems}</Text>\n <Pagination\n totalItems={totalItems}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n />\n </Stack>\n );\n};\n```\n\n## Usage examples\n\n### Displaying current state\n\nDisplay the current pagination state to provide context to users:\n\n```jsx live-dev\nconst App = () => {\n const [currentPage, setCurrentPage] = useState<PaginationProps[\"currentPage\"]>(1);\n const [pageSize, setPageSize] = useState<PaginationProps[\"pageSize\"]>(10);\n\n const totalItems = 247;\n\n return (\n <Stack direction=\"column\" gap=\"400\">\n <Stack direction=\"row\" gap=\"200\" align=\"center\">\n <Text fontWeight=\"semibold\">Current state:</Text>\n <Text>Page {currentPage} of {Math.ceil(totalItems / (pageSize || 10))}</Text>\n <Text>•</Text>\n <Text>{pageSize} items per page</Text>\n </Stack>\n\n <Pagination\n totalItems={totalItems}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n />\n </Stack>\n );\n};\n```\n\n### Page size selector\n\nEnable the page size selector to allow users to change how many items are displayed per page:\n\n```jsx live-dev\nconst App = () => {\n const [currentPage, setCurrentPage] = useState<PaginationProps[\"currentPage\"]>(1);\n const [pageSize, setPageSize] = useState<PaginationProps[\"pageSize\"]>(20);\n\n const totalItems = 1000;\n const startItem = ((currentPage || 1) - 1) * (pageSize || 20) + 1;\n const endItem = Math.min((currentPage || 1) * (pageSize || 20), totalItems);\n\n return (\n <Stack direction=\"column\" gap=\"400\">\n <Text>\n Showing items {startItem}-{endItem} of {totalItems}\n </Text>\n\n <Pagination\n totalItems={totalItems}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n enablePageSizeSelector={true}\n />\n </Stack>\n );\n};\n```\n\n### Direct page input\n\nThe page input field allows users to jump directly to a specific page by typing the page number:\n\n```jsx live-dev\nconst App = () => {\n const [currentPage, setCurrentPage] = useState<PaginationProps[\"currentPage\"]>(1);\n\n return (\n <Stack direction=\"column\" gap=\"400\">\n <Text>\n Try typing a page number directly in the input field\n </Text>\n\n <Pagination\n totalItems={500}\n currentPage={currentPage}\n onPageChange={setCurrentPage}\n enablePageInput={true}\n />\n </Stack>\n );\n};\n```\n\n### Configuration options\n\nCustomize which controls are displayed by enabling or disabling the page input and page size selector:\n\n```jsx live-dev\nconst App = () => {\n const [currentPage, setCurrentPage] = useState<PaginationProps[\"currentPage\"]>(1);\n const [pageSize, setPageSize] = useState<PaginationProps[\"pageSize\"]>(10);\n const [showInput, setShowInput] = useState(true);\n const [showSelector, setShowSelector] = useState(true);\n\n return (\n <Stack direction=\"column\" gap=\"400\">\n <Stack direction=\"row\" gap=\"400\">\n <Checkbox\n isSelected={showInput}\n onChange={setShowInput}\n >\n Enable page input\n </Checkbox>\n <Checkbox\n isSelected={showSelector}\n onChange={setShowSelector}\n >\n Enable page size selector\n </Checkbox>\n </Stack>\n\n <Pagination\n totalItems={200}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n enablePageInput={showInput}\n enablePageSizeSelector={showSelector}\n />\n </Stack>\n );\n};\n```\n\n### Custom page size options\n\nProvide custom page size options to match your application's needs:\n\n```jsx live-dev\nconst App = () => {\n const [currentPage, setCurrentPage] = useState<PaginationProps[\"currentPage\"]>(1);\n const [pageSize, setPageSize] = useState<PaginationProps[\"pageSize\"]>(25);\n\n return (\n <Stack direction=\"column\" gap=\"400\">\n <Text>\n Custom page sizes: 25, 50, 75, 100\n </Text>\n\n <Pagination\n totalItems={300}\n currentPage={currentPage}\n pageSize={pageSize}\n pageSizeOptions={[25, 50, 75, 100]}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n enablePageSizeSelector={true}\n />\n </Stack>\n );\n};\n```\n\n### With data rendering\n\nComplete example showing pagination with actual data rendering:\n\n```jsx live-dev\nconst App = () => {\n const [currentPage, setCurrentPage] = useState<PaginationProps[\"currentPage\"]>(1);\n const [pageSize, setPageSize] = useState<PaginationProps[\"pageSize\"]>(5);\n\n // Generate sample data\n const allItems = Array.from({ length: 50 }, (_, i) => ({\n id: i + 1,\n name: `Item ${i + 1}`,\n category: ['Electronics', 'Clothing', 'Food'][i % 3],\n }));\n\n // Calculate which items to display\n const startIndex = ((currentPage || 1) - 1) * (pageSize || 5);\n const endIndex = startIndex + (pageSize || 5);\n const displayedItems = allItems.slice(startIndex, endIndex);\n\n return (\n <Stack direction=\"column\" gap=\"400\">\n <Stack direction=\"column\" gap=\"200\" padding=\"400\" borderWidth=\"1px\" borderRadius=\"200\">\n {displayedItems.map((item) => (\n <Stack key={item.id} direction=\"row\" gap=\"200\" justify=\"space-between\">\n <Text fontWeight=\"semibold\">{item.name}</Text>\n <Text color=\"neutral.11\">{item.category}</Text>\n </Stack>\n ))}\n </Stack>\n\n <Pagination\n totalItems={allItems.length}\n currentPage={currentPage}\n pageSize={pageSize}\n pageSizeOptions={[5, 10, 25]}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n enablePageSizeSelector={true}\n />\n </Stack>\n );\n};\n```\n\n## Component requirements\n\n## Accessibility\n\nThe Pagination component follows WCAG 2.1 AA guidelines and provides comprehensive keyboard navigation and screen reader support.\n\n#### Role\n\n- Navigation element uses `role=\"navigation\"` with descriptive `aria-label`\n\n#### Labeling\n\n- Previous/next buttons have clear `aria-label` attributes\n- Page input field has `aria-label` and `aria-current=\"page\"` attributes\n- Page size selector has descriptive `aria-label`\n- All labels are internationalized using `@internationalized/string`\n\n#### Keyboard navigation\n\n| Key | Action |\n|-----|--------|\n| `Tab` | Move focus between pagination controls |\n| `Enter` / `Space` | Activate focused button (previous/next) |\n| `Arrow Up` / `Arrow Down` | Increment/decrement page number in input field |\n| Type number | Directly enter page number in input field |\n\nIf your use case requires tracking and analytics for this component, it is good practice to add a **persistent**, **unique** id to the component:\n\n```tsx\nconst PERSISTENT_ID = \"product-list-pagination\";\n\nexport const ProductList = () => {\n const [currentPage, setCurrentPage] = useState(1);\n const [pageSize, setPageSize] = useState(20);\n\n return (\n <Pagination\n id={PERSISTENT_ID}\n totalItems={500}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n />\n );\n};\n```\n\n## API reference\n\n<PropsTable id=\"Pagination\" />\n\n## Common patterns\n\n### Resetting to page 1 on filter changes\n\nWhen filters or search criteria change, reset pagination to the first page:\n\n```tsx\nconst ProductList = () => {\n const [currentPage, setCurrentPage] = useState(1);\n const [searchQuery, setSearchQuery] = useState('');\n const [filteredItems, setFilteredItems] = useState([]);\n\n // Reset to page 1 when search changes\n useEffect(() => {\n setCurrentPage(1);\n }, [searchQuery]);\n\n return (\n <>\n <TextInput\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder=\"Search...\"\n />\n\n <Pagination\n totalItems={filteredItems.length}\n currentPage={currentPage}\n onPageChange={setCurrentPage}\n />\n </>\n );\n};\n```\n\n### Persisting pagination state\n\nStore pagination state in URL query parameters for shareable links:\n\n```tsx\nconst ProductList = () => {\n const [searchParams, setSearchParams] = useSearchParams();\n\n const currentPage = parseInt(searchParams.get('page') || '1', 10);\n const pageSize = parseInt(searchParams.get('size') || '20', 10);\n\n const handlePageChange = (page: number) => {\n setSearchParams({ page: page.toString(), size: pageSize.toString() });\n };\n\n const handlePageSizeChange = (size: number) => {\n setSearchParams({ page: '1', size: size.toString() });\n };\n\n return (\n <Pagination\n totalItems={500}\n currentPage={currentPage}\n pageSize={pageSize}\n onPageChange={handlePageChange}\n onPageSizeChange={handlePageSizeChange}\n enablePageSizeSelector\n />\n );\n};\n```\n\n## Testing your implementation\n\nThese examples demonstrate how to test your implementation when using Pagination within your application. As the component's internal functionality is already tested by Nimbus, these patterns help you verify your integration and application-specific logic.\n\n### Basic Rendering Tests\n\nVerify the pagination component renders with expected controls and labels\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { Pagination, NimbusProvider } from \"@commercetools/nimbus\";\n\ndescribe(\"Pagination - Basic rendering\", () => {\n it(\"renders pagination navigation with accessible controls\", () => {\n render(\n <NimbusProvider>\n <Pagination totalItems={100} />\n </NimbusProvider>\n );\n\n // Verify navigation element exists\n const nav = screen.getByRole(\"navigation\", { name: /pagination/i });\n expect(nav).toBeInTheDocument();\n\n // Verify previous/next buttons\n expect(\n screen.getByRole(\"button\", { name: /go to previous page/i })\n ).toBeInTheDocument();\n expect(\n screen.getByRole(\"button\", { name: /go to next page/i })\n ).toBeInTheDocument();\n\n // Verify page input exists\n expect(screen.getByLabelText(/current page/i)).toBeInTheDocument();\n });\n\n it(\"renders page size selector when enabled\", () => {\n render(\n <NimbusProvider>\n <Pagination totalItems={100} enablePageSizeSelector={true} />\n </NimbusProvider>\n );\n\n // Verify page size selector is present\n expect(screen.getByLabelText(/items per page/i)).toBeInTheDocument();\n expect(screen.getByText(/items per page/i)).toBeInTheDocument();\n });\n\n it(\"hides page input when disabled\", () => {\n render(\n <NimbusProvider>\n <Pagination totalItems={100} enablePageInput={false} />\n </NimbusProvider>\n );\n\n // Page input should not exist\n expect(screen.queryByLabelText(/current page/i)).not.toBeInTheDocument();\n\n // But current page number should still be displayed as text\n expect(screen.getByText(\"1\")).toBeInTheDocument();\n });\n});\n```\n\n### Controlled Mode Tests\n\nTest controlled pagination state management\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { Pagination, NimbusProvider } from \"@commercetools/nimbus\";\n\ndescribe(\"Pagination - Controlled mode\", () => {\n it(\"respects controlled currentPage prop\", () => {\n const { rerender } = render(\n <NimbusProvider>\n <Pagination totalItems={100} currentPage={1} pageSize={10} />\n </NimbusProvider>\n );\n\n // Verify initial page\n const pageInput = screen.getByLabelText(/current page/i);\n expect(pageInput).toHaveValue(\"1\");\n\n // Update to page 5\n rerender(\n <NimbusProvider>\n <Pagination totalItems={100} currentPage={5} pageSize={10} />\n </NimbusProvider>\n );\n\n expect(pageInput).toHaveValue(\"5\");\n });\n\n it(\"calls onPageChange callback when navigating\", async () => {\n const user = userEvent.setup();\n const handlePageChange = vi.fn();\n\n render(\n <NimbusProvider>\n <Pagination\n totalItems={100}\n currentPage={1}\n pageSize={10}\n onPageChange={handlePageChange}\n />\n </NimbusProvider>\n );\n\n // Click next button\n const nextButton = screen.getByRole(\"button\", {\n name: /go to next page/i,\n });\n await user.click(nextButton);\n\n expect(handlePageChange).toHaveBeenCalledWith(2);\n });\n\n it(\"calls onPageSizeChange callback when changing page size\", async () => {\n const user = userEvent.setup();\n const handlePageSizeChange = vi.fn();\n\n render(\n <NimbusProvider>\n <Pagination\n totalItems={100}\n pageSize={10}\n pageSizeOptions={[10, 20, 50]}\n enablePageSizeSelector={true}\n onPageSizeChange={handlePageSizeChange}\n />\n </NimbusProvider>\n );\n\n // Open the page size selector\n const selector = screen.getByLabelText(/items per page/i);\n await user.click(selector);\n\n // Select a different page size\n const option20 = screen.getByRole(\"option\", { name: \"20\" });\n await user.click(option20);\n\n expect(handlePageSizeChange).toHaveBeenCalledWith(20);\n });\n});\n```\n\n### Page Navigation Tests\n\nTest previous/next navigation and direct page input\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { Pagination, NimbusProvider } from \"@commercetools/nimbus\";\n\ndescribe(\"Pagination - Page navigation\", () => {\n it(\"disables previous button on first page\", () => {\n render(\n <NimbusProvider>\n <Pagination totalItems={100} currentPage={1} pageSize={10} />\n </NimbusProvider>\n );\n\n const prevButton = screen.getByRole(\"button\", {\n name: /go to previous page/i,\n });\n expect(prevButton).toBeDisabled();\n });\n\n it(\"disables next button on last page\", () => {\n render(\n <NimbusProvider>\n <Pagination totalItems={100} currentPage={10} pageSize={10} />\n </NimbusProvider>\n );\n\n const nextButton = screen.getByRole(\"button\", {\n name: /go to next page/i,\n });\n expect(nextButton).toBeDisabled();\n });\n\n it(\"allows direct page number input\", async () => {\n const user = userEvent.setup();\n const handlePageChange = vi.fn();\n\n render(\n <NimbusProvider>\n <Pagination\n totalItems={100}\n currentPage={1}\n pageSize={10}\n onPageChange={handlePageChange}\n enablePageInput={true}\n />\n </NimbusProvider>\n );\n\n const pageInput = screen.getByLabelText(/current page/i);\n\n // Clear and type new page number, then blur to commit\n await user.clear(pageInput);\n await user.type(pageInput, \"5\");\n await user.tab(); // Blur the input to commit the value\n\n expect(handlePageChange).toHaveBeenCalledWith(5);\n });\n\n it(\"validates page input within bounds\", async () => {\n const user = userEvent.setup();\n const handlePageChange = vi.fn();\n\n render(\n <NimbusProvider>\n <Pagination\n totalItems={100}\n currentPage={1}\n pageSize={10}\n onPageChange={handlePageChange}\n enablePageInput={true}\n />\n </NimbusProvider>\n );\n\n const pageInput = screen.getByLabelText(/current page/i);\n\n // Try to enter page number beyond total pages (max is 10), then blur to commit\n await user.clear(pageInput);\n await user.type(pageInput, \"999\");\n await user.tab(); // Blur the input to commit the value\n\n // Should clamp to max page (10)\n expect(handlePageChange).toHaveBeenCalledWith(10);\n });\n});\n```\n\n### Page Size Selector Tests\n\nTest page size selection and option configuration\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { Pagination, NimbusProvider } from \"@commercetools/nimbus\";\n\ndescribe(\"Pagination - Page size selector\", () => {\n it(\"renders custom page size options\", async () => {\n const user = userEvent.setup();\n\n render(\n <NimbusProvider>\n <Pagination\n totalItems={100}\n pageSize={25}\n pageSizeOptions={[25, 50, 75, 100]}\n enablePageSizeSelector={true}\n />\n </NimbusProvider>\n );\n\n // Open the selector\n const selector = screen.getByLabelText(/items per page/i);\n await user.click(selector);\n\n // Verify custom options are present\n expect(screen.getByRole(\"option\", { name: \"25\" })).toBeInTheDocument();\n expect(screen.getByRole(\"option\", { name: \"50\" })).toBeInTheDocument();\n expect(screen.getByRole(\"option\", { name: \"75\" })).toBeInTheDocument();\n expect(screen.getByRole(\"option\", { name: \"100\" })).toBeInTheDocument();\n });\n\n it(\"shows correct selected page size\", async () => {\n const user = userEvent.setup();\n\n render(\n <NimbusProvider>\n <Pagination\n totalItems={100}\n pageSize={50}\n pageSizeOptions={[10, 20, 50, 100]}\n enablePageSizeSelector={true}\n />\n </NimbusProvider>\n );\n\n // Open selector to verify selected option\n const selector = screen.getByLabelText(/items per page/i);\n await user.click(selector);\n\n const option50 = screen.getByRole(\"option\", { name: \"50\" });\n expect(option50).toHaveAttribute(\"aria-selected\", \"true\");\n });\n});\n```\n\n### Integration Tests\n\nTest pagination with data rendering and realistic scenarios\n\n```tsx\nimport { describe, it, expect, vi } from \"vitest\";\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { Pagination, NimbusProvider } from \"@commercetools/nimbus\";\n\ndescribe(\"Pagination - Integration scenarios\", () => {\n it(\"calculates correct page ranges for data slicing\", () => {\n const totalItems = 47;\n const pageSize = 10;\n const currentPage = 3;\n\n // Calculate start and end indices for data slicing\n const startIndex = (currentPage - 1) * pageSize;\n const endIndex = startIndex + pageSize;\n\n expect(startIndex).toBe(20);\n expect(endIndex).toBe(30);\n\n // For display: start item is 1-based\n const startItem = startIndex + 1;\n const endItem = Math.min(endIndex, totalItems);\n\n expect(startItem).toBe(21);\n expect(endItem).toBe(30);\n });\n\n it(\"handles page size changes by resetting to valid page\", async () => {\n const user = userEvent.setup();\n const handlePageChange = vi.fn();\n const handlePageSizeChange = vi.fn();\n\n const { rerender } = render(\n <NimbusProvider>\n <Pagination\n totalItems={100}\n currentPage={10}\n pageSize={10}\n pageSizeOptions={[10, 50]}\n onPageChange={handlePageChange}\n onPageSizeChange={handlePageSizeChange}\n enablePageSizeSelector={true}\n />\n </NimbusProvider>\n );\n\n // Currently on page 10 of 10 (100 items / 10 per page)\n const nextButton = screen.getByRole(\"button\", { name: /go to next page/i });\n expect(nextButton).toBeDisabled();\n\n // Change page size to 50\n const selector = screen.getByLabelText(/items per page/i);\n await user.click(selector);\n\n const option50 = screen.getByRole(\"option\", { name: \"50\" });\n await user.click(option50);\n\n expect(handlePageSizeChange).toHaveBeenCalledWith(50);\n\n // With 100 items and 50 per page, we now have 2 total pages\n // Current page 10 is invalid, should adjust to page 2\n rerender(\n <NimbusProvider>\n <Pagination\n totalItems={100}\n currentPage={2}\n pageSize={50}\n pageSizeOptions={[10, 50]}\n onPageChange={handlePageChange}\n onPageSizeChange={handlePageSizeChange}\n enablePageSizeSelector={true}\n />\n </NimbusProvider>\n );\n\n const pageInput = screen.getByLabelText(/current page/i);\n expect(pageInput).toHaveValue(\"2\");\n });\n\n it(\"works with zero items\", () => {\n render(\n <NimbusProvider>\n <Pagination totalItems={0} pageSize={10} />\n </NimbusProvider>\n );\n\n // Should show page 1 of 1\n const pageInput = screen.getByLabelText(/current page/i);\n expect(pageInput).toHaveValue(\"1\");\n\n // Both navigation buttons should be disabled\n expect(\n screen.getByRole(\"button\", { name: /go to previous page/i })\n ).toBeDisabled();\n expect(\n screen.getByRole(\"button\", { name: /go to next page/i })\n ).toBeDisabled();\n });\n});\n```\n\n\n## Resources\n\n- [Pagination Storybook](https://nimbus-storybook.vercel.app/?path=/docs/components-pagination--docs)\n",
|
|
169
|
+
"toc": [
|
|
170
|
+
{
|
|
171
|
+
"value": "Getting started",
|
|
172
|
+
"href": "#getting-started",
|
|
173
|
+
"depth": 2,
|
|
174
|
+
"numbering": [
|
|
175
|
+
1,
|
|
176
|
+
1
|
|
177
|
+
],
|
|
178
|
+
"parent": "root"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"value": "Import",
|
|
182
|
+
"href": "#import",
|
|
183
|
+
"depth": 3,
|
|
184
|
+
"numbering": [
|
|
185
|
+
1,
|
|
186
|
+
1,
|
|
187
|
+
1
|
|
188
|
+
],
|
|
189
|
+
"parent": "root"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"value": "Basic usage",
|
|
193
|
+
"href": "#basic-usage",
|
|
194
|
+
"depth": 3,
|
|
195
|
+
"numbering": [
|
|
196
|
+
1,
|
|
197
|
+
1,
|
|
198
|
+
2
|
|
199
|
+
],
|
|
200
|
+
"parent": "root"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"value": "Usage examples",
|
|
204
|
+
"href": "#usage-examples",
|
|
205
|
+
"depth": 2,
|
|
206
|
+
"numbering": [
|
|
207
|
+
1,
|
|
208
|
+
2
|
|
209
|
+
],
|
|
210
|
+
"parent": "root"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"value": "Displaying current state",
|
|
214
|
+
"href": "#displaying-current-state",
|
|
215
|
+
"depth": 3,
|
|
216
|
+
"numbering": [
|
|
217
|
+
1,
|
|
218
|
+
2,
|
|
219
|
+
1
|
|
220
|
+
],
|
|
221
|
+
"parent": "root"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"value": "Page size selector",
|
|
225
|
+
"href": "#page-size-selector",
|
|
226
|
+
"depth": 3,
|
|
227
|
+
"numbering": [
|
|
228
|
+
1,
|
|
229
|
+
2,
|
|
230
|
+
2
|
|
231
|
+
],
|
|
232
|
+
"parent": "root"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"value": "Direct page input",
|
|
236
|
+
"href": "#direct-page-input",
|
|
237
|
+
"depth": 3,
|
|
238
|
+
"numbering": [
|
|
239
|
+
1,
|
|
240
|
+
2,
|
|
241
|
+
3
|
|
242
|
+
],
|
|
243
|
+
"parent": "root"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"value": "Configuration options",
|
|
247
|
+
"href": "#configuration-options",
|
|
248
|
+
"depth": 3,
|
|
249
|
+
"numbering": [
|
|
250
|
+
1,
|
|
251
|
+
2,
|
|
252
|
+
4
|
|
253
|
+
],
|
|
254
|
+
"parent": "root"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"value": "Custom page size options",
|
|
258
|
+
"href": "#custom-page-size-options",
|
|
259
|
+
"depth": 3,
|
|
260
|
+
"numbering": [
|
|
261
|
+
1,
|
|
262
|
+
2,
|
|
263
|
+
5
|
|
264
|
+
],
|
|
265
|
+
"parent": "root"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"value": "With data rendering",
|
|
269
|
+
"href": "#with-data-rendering",
|
|
270
|
+
"depth": 3,
|
|
271
|
+
"numbering": [
|
|
272
|
+
1,
|
|
273
|
+
2,
|
|
274
|
+
6
|
|
275
|
+
],
|
|
276
|
+
"parent": "root"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"value": "Component requirements",
|
|
280
|
+
"href": "#component-requirements",
|
|
281
|
+
"depth": 2,
|
|
282
|
+
"numbering": [
|
|
283
|
+
1,
|
|
284
|
+
3
|
|
285
|
+
],
|
|
286
|
+
"parent": "root"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"value": "Accessibility",
|
|
290
|
+
"href": "#accessibility",
|
|
291
|
+
"depth": 2,
|
|
292
|
+
"numbering": [
|
|
293
|
+
1,
|
|
294
|
+
4
|
|
295
|
+
],
|
|
296
|
+
"parent": "root"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"value": "Role",
|
|
300
|
+
"href": "#role",
|
|
301
|
+
"depth": 4,
|
|
302
|
+
"numbering": [
|
|
303
|
+
1,
|
|
304
|
+
4,
|
|
305
|
+
1,
|
|
306
|
+
1
|
|
307
|
+
],
|
|
308
|
+
"parent": "root"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"value": "Labeling",
|
|
312
|
+
"href": "#labeling",
|
|
313
|
+
"depth": 4,
|
|
314
|
+
"numbering": [
|
|
315
|
+
1,
|
|
316
|
+
4,
|
|
317
|
+
1,
|
|
318
|
+
2
|
|
319
|
+
],
|
|
320
|
+
"parent": "root"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"value": "Keyboard navigation",
|
|
324
|
+
"href": "#keyboard-navigation",
|
|
325
|
+
"depth": 4,
|
|
326
|
+
"numbering": [
|
|
327
|
+
1,
|
|
328
|
+
4,
|
|
329
|
+
1,
|
|
330
|
+
3
|
|
331
|
+
],
|
|
332
|
+
"parent": "root"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"value": "API reference",
|
|
336
|
+
"href": "#api-reference",
|
|
337
|
+
"depth": 2,
|
|
338
|
+
"numbering": [
|
|
339
|
+
1,
|
|
340
|
+
5
|
|
341
|
+
],
|
|
342
|
+
"parent": "root"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"value": "Common patterns",
|
|
346
|
+
"href": "#common-patterns",
|
|
347
|
+
"depth": 2,
|
|
348
|
+
"numbering": [
|
|
349
|
+
1,
|
|
350
|
+
6
|
|
351
|
+
],
|
|
352
|
+
"parent": "root"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"value": "Resetting to page 1 on filter changes",
|
|
356
|
+
"href": "#resetting-to-page-1-on-filter-changes",
|
|
357
|
+
"depth": 3,
|
|
358
|
+
"numbering": [
|
|
359
|
+
1,
|
|
360
|
+
6,
|
|
361
|
+
1
|
|
362
|
+
],
|
|
363
|
+
"parent": "root"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"value": "Persisting pagination state",
|
|
367
|
+
"href": "#persisting-pagination-state",
|
|
368
|
+
"depth": 3,
|
|
369
|
+
"numbering": [
|
|
370
|
+
1,
|
|
371
|
+
6,
|
|
372
|
+
2
|
|
373
|
+
],
|
|
374
|
+
"parent": "root"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"value": "Testing your implementation",
|
|
378
|
+
"href": "#testing-your-implementation",
|
|
379
|
+
"depth": 2,
|
|
380
|
+
"numbering": [
|
|
381
|
+
1,
|
|
382
|
+
7
|
|
383
|
+
],
|
|
384
|
+
"parent": "root"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
"value": "Basic Rendering Tests",
|
|
388
|
+
"href": "#basic-rendering-tests",
|
|
389
|
+
"depth": 3,
|
|
390
|
+
"numbering": [
|
|
391
|
+
1,
|
|
392
|
+
7,
|
|
393
|
+
1
|
|
394
|
+
],
|
|
395
|
+
"parent": "root"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"value": "Controlled Mode Tests",
|
|
399
|
+
"href": "#controlled-mode-tests",
|
|
400
|
+
"depth": 3,
|
|
401
|
+
"numbering": [
|
|
402
|
+
1,
|
|
403
|
+
7,
|
|
404
|
+
2
|
|
405
|
+
],
|
|
406
|
+
"parent": "root"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"value": "Page Navigation Tests",
|
|
410
|
+
"href": "#page-navigation-tests",
|
|
411
|
+
"depth": 3,
|
|
412
|
+
"numbering": [
|
|
413
|
+
1,
|
|
414
|
+
7,
|
|
415
|
+
3
|
|
416
|
+
],
|
|
417
|
+
"parent": "root"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"value": "Page Size Selector Tests",
|
|
421
|
+
"href": "#page-size-selector-tests",
|
|
422
|
+
"depth": 3,
|
|
423
|
+
"numbering": [
|
|
424
|
+
1,
|
|
425
|
+
7,
|
|
426
|
+
4
|
|
427
|
+
],
|
|
428
|
+
"parent": "root"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"value": "Integration Tests",
|
|
432
|
+
"href": "#integration-tests",
|
|
433
|
+
"depth": 3,
|
|
434
|
+
"numbering": [
|
|
435
|
+
1,
|
|
436
|
+
7,
|
|
437
|
+
5
|
|
438
|
+
],
|
|
439
|
+
"parent": "root"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"value": "Resources",
|
|
443
|
+
"href": "#resources",
|
|
444
|
+
"depth": 2,
|
|
445
|
+
"numbering": [
|
|
446
|
+
1,
|
|
447
|
+
8
|
|
448
|
+
],
|
|
449
|
+
"parent": "root"
|
|
450
|
+
}
|
|
451
|
+
]
|
|
452
|
+
},
|
|
453
|
+
"guidelines": {
|
|
454
|
+
"mdx": "\n## Guidelines\n\nPagination guidelines aim to support similar and consistent experiences for\nusers seeking to navigate their data or processes.\n\n### Best practices\n\n- **Provide clear feedback:** always highlight the current active page clearly.\n- **Keep navigation minimal:** limit the visible page numbers shown to a\n manageable amount (e.g., show 5-7 pages).\n- **Show total context:** display the total number of items or total pages\n available (e.g., \"Showing 1-20 of 150 results\").\n- **Disable end controls:** clearly disable the \"Previous\" button on the first\n page and the \"Next\" button on the last page.\n\n### Usage\n\n> [!TIP]\\\n> When to use\n\n- **Control is essential:** When the user needs control over where they are and\n how many items they see.\n- **Predictable data sets:** For data tables, structured search results, or\n catalogs where items have a known order and consistent size.\n- **User needs to bookmark/reference:** When users need to easily save or share\n a specific page number, or refer back to a particular screen of results.\n\n> [!CAUTION]\\\n> When not to use\n\n- **Unstructured or image-heavy content:** For image galleries or highly\n dynamic, unstructured content where infinite scrolling provides a smoother,\n faster visual experience.\n- **Mobile experience:** Infinite scroll is often preferred on mobile devices to\n reduce the effort of tapping small pagination controls\n\n### Pagination in use\n\n> [!TIP]\\\n> **Do**\n>\n> - Do allow direct input to jump to a specific page number (if the set is very\n> large).\n> - Do place pagination controls consistently at the top, bottom, or both, of\n> the content being paginated.\n\n```jsx live\nconst App = () => {\n const [currentPage, setCurrentPage] = useState(1);\n const [pageSize, setPageSize] = useState(4);\n\n return (\n <Pagination\n totalItems={10240}\n currentPage={currentPage}\n pageSize={pageSize}\n pageSizeOptions={[4, 10, 20, 50]}\n enablePageSizeSelector\n enablePageInput\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n />\n );\n};\n```\n\n> [!CAUTION]\\\n> **Don't**\n>\n> - Don't reset the pagination every time a filter or sort option is applied;\n> try to maintain the user's current page if possible.\n> - Don't overload the component with too many page numbers that visually\n> clutter the interface.\n> - Don't hide or neglect to disable the 'Previous' or 'Next' buttons when they\n> are no longer functional.\n\n```jsx live\nconst App = () => {\n const [currentPage, setCurrentPage] = useState(1483271);\n const [pageSize, setPageSize] = useState(4);\n\n return (\n <Pagination\n totalItems={9007199254740991}\n currentPage={currentPage}\n pageSize={pageSize}\n pageSizeOptions={[4, 10, 20, 50]}\n enablePageSizeSelector\n enablePageInput\n onPageChange={setCurrentPage}\n onPageSizeChange={setPageSize}\n />\n );\n};\n```\n",
|
|
455
|
+
"toc": [
|
|
456
|
+
{
|
|
457
|
+
"value": "Guidelines",
|
|
458
|
+
"href": "#guidelines",
|
|
459
|
+
"depth": 2,
|
|
460
|
+
"numbering": [
|
|
461
|
+
1,
|
|
462
|
+
1
|
|
463
|
+
],
|
|
464
|
+
"parent": "root"
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"value": "Best practices",
|
|
468
|
+
"href": "#best-practices",
|
|
469
|
+
"depth": 3,
|
|
470
|
+
"numbering": [
|
|
471
|
+
1,
|
|
472
|
+
1,
|
|
473
|
+
1
|
|
474
|
+
],
|
|
475
|
+
"parent": "root"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"value": "Usage",
|
|
479
|
+
"href": "#usage",
|
|
480
|
+
"depth": 3,
|
|
481
|
+
"numbering": [
|
|
482
|
+
1,
|
|
483
|
+
1,
|
|
484
|
+
2
|
|
485
|
+
],
|
|
486
|
+
"parent": "root"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"value": "Pagination in use",
|
|
490
|
+
"href": "#pagination-in-use",
|
|
491
|
+
"depth": 3,
|
|
492
|
+
"numbering": [
|
|
493
|
+
1,
|
|
494
|
+
1,
|
|
495
|
+
3
|
|
496
|
+
],
|
|
497
|
+
"parent": "root"
|
|
498
|
+
}
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|