@primecoderin/fast-ui-react 0.0.0-stage → 0.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/CHANGELOG.md +90 -0
- package/LICENSE +21 -0
- package/README.md +180 -3
- package/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/charts.d.ts +7 -0
- package/dist/charts.js +7 -0
- package/dist/components/Avatar/Avatar.d.ts +12 -0
- package/dist/components/Avatar/Avatar.js +92 -0
- package/dist/components/Button/Button.d.ts +44 -0
- package/dist/components/Button/Button.js +221 -0
- package/dist/components/Checkbox/CheckboxBox.d.ts +33 -0
- package/dist/components/Checkbox/CheckboxBox.js +148 -0
- package/dist/components/CodeSnippet/CodeSnippet.d.ts +26 -0
- package/dist/components/CodeSnippet/CodeSnippet.js +153 -0
- package/dist/components/Collapsible/Collapsible.d.ts +20 -0
- package/dist/components/Collapsible/Collapsible.js +97 -0
- package/dist/components/Container/Container.d.ts +301 -0
- package/dist/components/Container/Container.js +20 -0
- package/dist/components/FloatingActionButton/FloatingActionButton.d.ts +22 -0
- package/dist/components/FloatingActionButton/FloatingActionButton.js +141 -0
- package/dist/components/Grid/Grid.d.ts +311 -0
- package/dist/components/Grid/Grid.js +30 -0
- package/dist/components/IconTile/IconTile.d.ts +12 -0
- package/dist/components/IconTile/IconTile.js +70 -0
- package/dist/components/InlineError/InlineError.d.ts +9 -0
- package/dist/components/InlineError/InlineError.js +62 -0
- package/dist/components/Kbd/Kbd.d.ts +11 -0
- package/dist/components/Kbd/Kbd.js +31 -0
- package/dist/components/Link/Link.d.ts +18 -0
- package/dist/components/Link/Link.js +68 -0
- package/dist/components/Menu/ContextMenu.d.ts +18 -0
- package/dist/components/Menu/ContextMenu.js +68 -0
- package/dist/components/Menu/Menu.d.ts +86 -0
- package/dist/components/Menu/Menu.js +394 -0
- package/dist/components/OtpInput/OtpInput.d.ts +32 -0
- package/dist/components/OtpInput/OtpInput.js +177 -0
- package/dist/components/Popover/HoverPopover.d.ts +22 -0
- package/dist/components/Popover/HoverPopover.js +74 -0
- package/dist/components/Popover/Popover.d.ts +21 -0
- package/dist/components/Popover/Popover.js +64 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +17 -0
- package/dist/components/ProgressBar/ProgressBar.js +44 -0
- package/dist/components/Rating/Rating.d.ts +49 -0
- package/dist/components/Rating/Rating.js +241 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +23 -0
- package/dist/components/ScrollArea/ScrollArea.js +90 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +29 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +99 -0
- package/dist/components/Separator/Separator.d.ts +9 -0
- package/dist/components/Separator/Separator.js +34 -0
- package/dist/components/Skeleton/Skeleton.d.ts +31 -0
- package/dist/components/Skeleton/Skeleton.js +152 -0
- package/dist/components/Slider/Slider.d.ts +54 -0
- package/dist/components/Slider/Slider.js +178 -0
- package/dist/components/Spinner/Spinner.d.ts +17 -0
- package/dist/components/Spinner/Spinner.js +118 -0
- package/dist/components/Stack/Stack.d.ts +302 -0
- package/dist/components/Stack/Stack.js +14 -0
- package/dist/components/StateIcon/StateIcon.d.ts +11 -0
- package/dist/components/StateIcon/StateIcon.js +65 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +19 -0
- package/dist/components/StatusBadge/StatusBadge.js +82 -0
- package/dist/components/Tabs/Tabs.d.ts +28 -0
- package/dist/components/Tabs/Tabs.js +109 -0
- package/dist/components/Tag/Tag.d.ts +11 -0
- package/dist/components/Tag/Tag.js +66 -0
- package/dist/components/Toast/AppToaster.d.ts +8 -0
- package/dist/components/Toast/AppToaster.js +135 -0
- package/dist/components/Toast/toast-manager.d.ts +28 -0
- package/dist/components/Toast/toast-manager.js +47 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +26 -0
- package/dist/components/ToggleButton/ToggleButton.js +106 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +32 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +79 -0
- package/dist/components/Tooltip/Tooltip.d.ts +16 -0
- package/dist/components/Tooltip/Tooltip.js +58 -0
- package/dist/components/Tooltip/TooltipGroup.d.ts +22 -0
- package/dist/components/Tooltip/TooltipGroup.js +65 -0
- package/dist/components/Typography/Typography.d.ts +17 -0
- package/dist/components/Typography/Typography.js +100 -0
- package/dist/editor-forms.d.ts +1 -0
- package/dist/editor-forms.js +1 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.js +1 -0
- package/dist/fonts/LICENSE +93 -0
- package/dist/fonts/inter-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-wght-normal.woff2 +0 -0
- package/dist/fonts.css +69 -0
- package/dist/forms.d.ts +22 -0
- package/dist/forms.js +23 -0
- package/dist/foundation.css +23 -0
- package/dist/global.css +116 -0
- package/dist/hooks/useAppToast.d.ts +12 -0
- package/dist/hooks/useAppToast.js +29 -0
- package/dist/icons/icons.d.ts +43 -0
- package/dist/icons/icons.js +44 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +101 -0
- package/dist/patterns/Accordion/Accordion.d.ts +35 -0
- package/dist/patterns/Accordion/Accordion.js +139 -0
- package/dist/patterns/Alert/Alert.d.ts +38 -0
- package/dist/patterns/Alert/Alert.js +151 -0
- package/dist/patterns/AppShell/AppShell.d.ts +39 -0
- package/dist/patterns/AppShell/AppShell.js +218 -0
- package/dist/patterns/Breadcrumbs/Breadcrumbs.d.ts +21 -0
- package/dist/patterns/Breadcrumbs/Breadcrumbs.js +73 -0
- package/dist/patterns/Calendar/Calendar.d.ts +59 -0
- package/dist/patterns/Calendar/Calendar.js +283 -0
- package/dist/patterns/Calendar/DateRangePicker.d.ts +53 -0
- package/dist/patterns/Calendar/DateRangePicker.js +266 -0
- package/dist/patterns/Calendar/FormDateRangeField.d.ts +24 -0
- package/dist/patterns/Calendar/FormDateRangeField.js +138 -0
- package/dist/patterns/Card/Card.d.ts +26 -0
- package/dist/patterns/Card/Card.js +125 -0
- package/dist/patterns/Carousel/Carousel.d.ts +33 -0
- package/dist/patterns/Carousel/Carousel.js +127 -0
- package/dist/patterns/Cascader/Cascader.d.ts +53 -0
- package/dist/patterns/Cascader/Cascader.js +371 -0
- package/dist/patterns/Cascader/FormCascaderField.d.ts +21 -0
- package/dist/patterns/Cascader/FormCascaderField.js +130 -0
- package/dist/patterns/Charts/AreaChart.d.ts +13 -0
- package/dist/patterns/Charts/AreaChart.js +220 -0
- package/dist/patterns/Charts/BarChart.d.ts +11 -0
- package/dist/patterns/Charts/BarChart.js +220 -0
- package/dist/patterns/Charts/DonutChart.d.ts +37 -0
- package/dist/patterns/Charts/DonutChart.js +215 -0
- package/dist/patterns/Charts/GaugeChart.d.ts +44 -0
- package/dist/patterns/Charts/GaugeChart.js +210 -0
- package/dist/patterns/Charts/LineChart.d.ts +14 -0
- package/dist/patterns/Charts/LineChart.js +222 -0
- package/dist/patterns/Charts/Sparkline.d.ts +24 -0
- package/dist/patterns/Charts/Sparkline.js +81 -0
- package/dist/patterns/Charts/chart-parts.d.ts +139 -0
- package/dist/patterns/Charts/chart-parts.js +385 -0
- package/dist/patterns/Charts/gauge-math.d.ts +20 -0
- package/dist/patterns/Charts/gauge-math.js +21 -0
- package/dist/patterns/Charts/sparkline-path.d.ts +11 -0
- package/dist/patterns/Charts/sparkline-path.js +24 -0
- package/dist/patterns/ColorPicker/ColorPicker.d.ts +50 -0
- package/dist/patterns/ColorPicker/ColorPicker.js +590 -0
- package/dist/patterns/ColorPicker/FormColorField.d.ts +21 -0
- package/dist/patterns/ColorPicker/FormColorField.js +130 -0
- package/dist/patterns/ColorPicker/color-value.d.ts +19 -0
- package/dist/patterns/ColorPicker/color-value.js +72 -0
- package/dist/patterns/Combobox/Autocomplete.d.ts +48 -0
- package/dist/patterns/Combobox/Autocomplete.js +158 -0
- package/dist/patterns/Combobox/Combobox.d.ts +52 -0
- package/dist/patterns/Combobox/Combobox.js +195 -0
- package/dist/patterns/Combobox/ComboboxPopup.d.ts +24 -0
- package/dist/patterns/Combobox/ComboboxPopup.js +107 -0
- package/dist/patterns/Combobox/FormAutocompleteField.d.ts +17 -0
- package/dist/patterns/Combobox/FormAutocompleteField.js +119 -0
- package/dist/patterns/Combobox/FormComboboxField.d.ts +18 -0
- package/dist/patterns/Combobox/FormComboboxField.js +119 -0
- package/dist/patterns/Combobox/FormMultiSelectField.d.ts +18 -0
- package/dist/patterns/Combobox/FormMultiSelectField.js +119 -0
- package/dist/patterns/Combobox/MultiSelect.d.ts +54 -0
- package/dist/patterns/Combobox/MultiSelect.js +175 -0
- package/dist/patterns/CommandPalette/CommandPalette.d.ts +50 -0
- package/dist/patterns/CommandPalette/CommandPalette.js +193 -0
- package/dist/patterns/DataTable/DataTable.d.ts +107 -0
- package/dist/patterns/DataTable/DataTable.js +364 -0
- package/dist/patterns/DateTimePicker/DateTimePanel.d.ts +28 -0
- package/dist/patterns/DateTimePicker/DateTimePanel.js +444 -0
- package/dist/patterns/DateTimePicker/DateTimePicker.d.ts +75 -0
- package/dist/patterns/DateTimePicker/DateTimePicker.js +271 -0
- package/dist/patterns/DateTimePicker/FormDateTimeField.d.ts +32 -0
- package/dist/patterns/DateTimePicker/FormDateTimeField.js +148 -0
- package/dist/patterns/DateTimePicker/TimeSliders.d.ts +14 -0
- package/dist/patterns/DateTimePicker/TimeSliders.js +206 -0
- package/dist/patterns/DateTimePicker/picker-labels.d.ts +30 -0
- package/dist/patterns/DateTimePicker/picker-labels.js +23 -0
- package/dist/patterns/DateTimePicker/picker-values.d.ts +98 -0
- package/dist/patterns/DateTimePicker/picker-values.js +194 -0
- package/dist/patterns/DescriptionList/DescriptionList.d.ts +20 -0
- package/dist/patterns/DescriptionList/DescriptionList.js +57 -0
- package/dist/patterns/Dialog/Dialog.d.ts +26 -0
- package/dist/patterns/Dialog/Dialog.js +212 -0
- package/dist/patterns/Drawer/Drawer.d.ts +33 -0
- package/dist/patterns/Drawer/Drawer.js +153 -0
- package/dist/patterns/EmptyState/EmptyState.d.ts +35 -0
- package/dist/patterns/EmptyState/EmptyState.js +44 -0
- package/dist/patterns/FileUpload/FileUpload.d.ts +87 -0
- package/dist/patterns/FileUpload/FileUpload.js +417 -0
- package/dist/patterns/FileUpload/FormFileUploadField.d.ts +19 -0
- package/dist/patterns/FileUpload/FormFileUploadField.js +117 -0
- package/dist/patterns/FileUpload/add-files.d.ts +26 -0
- package/dist/patterns/FileUpload/add-files.js +35 -0
- package/dist/patterns/FileUpload/file-size.d.ts +14 -0
- package/dist/patterns/FileUpload/file-size.js +44 -0
- package/dist/patterns/FormField/CheckboxField.d.ts +26 -0
- package/dist/patterns/FormField/CheckboxField.js +97 -0
- package/dist/patterns/FormField/FieldFrame.d.ts +85 -0
- package/dist/patterns/FormField/FieldFrame.js +257 -0
- package/dist/patterns/FormField/FormCheckboxField.d.ts +17 -0
- package/dist/patterns/FormField/FormCheckboxField.js +92 -0
- package/dist/patterns/FormField/FormRadioGroupField.d.ts +16 -0
- package/dist/patterns/FormField/FormRadioGroupField.js +97 -0
- package/dist/patterns/FormField/FormRatingField.d.ts +19 -0
- package/dist/patterns/FormField/FormRatingField.js +119 -0
- package/dist/patterns/FormField/FormSelectField.d.ts +16 -0
- package/dist/patterns/FormField/FormSelectField.js +91 -0
- package/dist/patterns/FormField/FormSliderField.d.ts +22 -0
- package/dist/patterns/FormField/FormSliderField.js +128 -0
- package/dist/patterns/FormField/FormSwitchField.d.ts +19 -0
- package/dist/patterns/FormField/FormSwitchField.js +88 -0
- package/dist/patterns/FormField/FormTextAreaField.d.ts +12 -0
- package/dist/patterns/FormField/FormTextAreaField.js +91 -0
- package/dist/patterns/FormField/FormTextField.d.ts +23 -0
- package/dist/patterns/FormField/FormTextField.js +103 -0
- package/dist/patterns/FormField/RadioGroupField.d.ts +38 -0
- package/dist/patterns/FormField/RadioGroupField.js +201 -0
- package/dist/patterns/FormField/SelectField.d.ts +43 -0
- package/dist/patterns/FormField/SelectField.js +211 -0
- package/dist/patterns/FormField/SwitchField.d.ts +27 -0
- package/dist/patterns/FormField/SwitchField.js +105 -0
- package/dist/patterns/FormField/TextAreaField.d.ts +37 -0
- package/dist/patterns/FormField/TextAreaField.js +134 -0
- package/dist/patterns/FormField/TextField.d.ts +51 -0
- package/dist/patterns/FormField/TextField.js +256 -0
- package/dist/patterns/FormField/error-message.d.ts +6 -0
- package/dist/patterns/FormField/error-message.js +8 -0
- package/dist/patterns/FormField/field-styles.d.ts +44 -0
- package/dist/patterns/FormField/field-styles.js +89 -0
- package/dist/patterns/FormField/field-types.d.ts +4 -0
- package/dist/patterns/FormField/use-field-ids.d.ts +18 -0
- package/dist/patterns/FormField/use-field-ids.js +53 -0
- package/dist/patterns/List/List.d.ts +38 -0
- package/dist/patterns/List/List.js +174 -0
- package/dist/patterns/MentionsInput/FormMentionsField.d.ts +18 -0
- package/dist/patterns/MentionsInput/FormMentionsField.js +124 -0
- package/dist/patterns/MentionsInput/MentionsInput.d.ts +57 -0
- package/dist/patterns/MentionsInput/MentionsInput.js +133 -0
- package/dist/patterns/MentionsInput/mention-text.d.ts +24 -0
- package/dist/patterns/MentionsInput/mention-text.js +31 -0
- package/dist/patterns/Menubar/Menubar.d.ts +22 -0
- package/dist/patterns/Menubar/Menubar.js +79 -0
- package/dist/patterns/NavigationMenu/NavigationMenu.d.ts +27 -0
- package/dist/patterns/NavigationMenu/NavigationMenu.js +104 -0
- package/dist/patterns/NumberField/FormNumberField.d.ts +18 -0
- package/dist/patterns/NumberField/FormNumberField.js +119 -0
- package/dist/patterns/NumberField/NumberField.d.ts +57 -0
- package/dist/patterns/NumberField/NumberField.js +242 -0
- package/dist/patterns/Pagination/Pagination.d.ts +31 -0
- package/dist/patterns/Pagination/Pagination.js +275 -0
- package/dist/patterns/Pagination/page-items.d.ts +18 -0
- package/dist/patterns/Pagination/page-items.js +40 -0
- package/dist/patterns/PhoneField/FormPhoneField.d.ts +22 -0
- package/dist/patterns/PhoneField/FormPhoneField.js +97 -0
- package/dist/patterns/PhoneField/PhoneField.d.ts +60 -0
- package/dist/patterns/PhoneField/PhoneField.js +448 -0
- package/dist/patterns/PhoneField/phone-value.d.ts +26 -0
- package/dist/patterns/PhoneField/phone-value.js +38 -0
- package/dist/patterns/QRCode/QRCode.d.ts +37 -0
- package/dist/patterns/QRCode/QRCode.js +120 -0
- package/dist/patterns/QRCode/qr-path.d.ts +7 -0
- package/dist/patterns/QRCode/qr-path.js +25 -0
- package/dist/patterns/ResizablePanels/ResizablePanels.d.ts +34 -0
- package/dist/patterns/ResizablePanels/ResizablePanels.js +175 -0
- package/dist/patterns/ResizablePanels/panel-sizes.d.ts +31 -0
- package/dist/patterns/ResizablePanels/panel-sizes.js +54 -0
- package/dist/patterns/RichTextEditor/FormRichTextField.d.ts +18 -0
- package/dist/patterns/RichTextEditor/FormRichTextField.js +118 -0
- package/dist/patterns/RichTextEditor/RichTextEditor.d.ts +71 -0
- package/dist/patterns/RichTextEditor/RichTextEditor.js +453 -0
- package/dist/patterns/SearchInput/SearchInput.d.ts +26 -0
- package/dist/patterns/SearchInput/SearchInput.js +98 -0
- package/dist/patterns/SideNav/SideNav.d.ts +50 -0
- package/dist/patterns/SideNav/SideNav.js +269 -0
- package/dist/patterns/Stat/Stat.d.ts +51 -0
- package/dist/patterns/Stat/Stat.js +292 -0
- package/dist/patterns/Stepper/Stepper.d.ts +35 -0
- package/dist/patterns/Stepper/Stepper.js +110 -0
- package/dist/patterns/TagGroup/TagGroup.d.ts +44 -0
- package/dist/patterns/TagGroup/TagGroup.js +151 -0
- package/dist/patterns/TagsInput/FormTagsInputField.d.ts +18 -0
- package/dist/patterns/TagsInput/FormTagsInputField.js +124 -0
- package/dist/patterns/TagsInput/TagsInput.d.ts +51 -0
- package/dist/patterns/TagsInput/TagsInput.js +97 -0
- package/dist/patterns/Timeline/Timeline.d.ts +29 -0
- package/dist/patterns/Timeline/Timeline.js +85 -0
- package/dist/patterns/Toolbar/Toolbar.d.ts +31 -0
- package/dist/patterns/Toolbar/Toolbar.js +105 -0
- package/dist/patterns/Tour/Tour.d.ts +38 -0
- package/dist/patterns/Tour/Tour.js +333 -0
- package/dist/patterns/TransferList/FormTransferListField.d.ts +19 -0
- package/dist/patterns/TransferList/FormTransferListField.js +117 -0
- package/dist/patterns/TransferList/TransferList.d.ts +53 -0
- package/dist/patterns/TransferList/TransferList.js +441 -0
- package/dist/patterns/TreeSelect/FormTreeSelectField.d.ts +28 -0
- package/dist/patterns/TreeSelect/FormTreeSelectField.js +88 -0
- package/dist/patterns/TreeSelect/TreeSelect.d.ts +49 -0
- package/dist/patterns/TreeSelect/TreeSelect.js +375 -0
- package/dist/patterns/TreeView/TreeView.d.ts +40 -0
- package/dist/patterns/TreeView/TreeView.js +296 -0
- package/dist/provider/DesignSystemProvider.d.ts +54 -0
- package/dist/provider/DesignSystemProvider.js +270 -0
- package/dist/provider/nonce.d.ts +7 -0
- package/dist/provider/nonce.js +13 -0
- package/dist/styles.css +2 -0
- package/dist/theme/chart-palette.d.ts +51 -0
- package/dist/theme/chart-palette.js +112 -0
- package/dist/theme/create-theme.d.ts +52 -0
- package/dist/theme/create-theme.js +75 -0
- package/dist/theme/style-element.d.ts +28 -0
- package/dist/theme/style-element.js +79 -0
- package/dist/theme/tenant-branding.d.ts +48 -0
- package/dist/theme/tenant-branding.js +65 -0
- package/dist/theme/theme-switch.d.ts +25 -0
- package/dist/theme/theme-switch.js +90 -0
- package/dist/theme/token-names.d.ts +3 -0
- package/dist/theme/token-names.js +166 -0
- package/dist/theme.css +241 -0
- package/dist/tokens.css +383 -0
- package/dist/types/direction.d.ts +4 -0
- package/dist/types/tone.d.ts +7 -0
- package/dist/utils/cn.d.ts +7 -0
- package/dist/utils/cn.js +50 -0
- package/dist/utils/first-field.d.ts +8 -0
- package/dist/utils/first-field.js +10 -0
- package/dist/utils/layout.d.ts +33 -0
- package/dist/utils/layout.js +30 -0
- package/dist/utils/popup.d.ts +12 -0
- package/dist/utils/popup.js +27 -0
- package/docs/accessibility.md +61 -0
- package/docs/advanced-components.md +38 -0
- package/docs/ai-assistants.md +44 -0
- package/docs/architecture.md +65 -0
- package/docs/browser-support.md +30 -0
- package/docs/charts.md +56 -0
- package/docs/components.md +2928 -0
- package/docs/conventions.md +19 -0
- package/docs/customization.md +79 -0
- package/docs/dates-files-data.md +48 -0
- package/docs/design-principles.md +50 -0
- package/docs/faq.md +68 -0
- package/docs/forms.md +114 -0
- package/docs/getting-started.md +64 -0
- package/docs/icons.md +48 -0
- package/docs/internationalization.md +64 -0
- package/docs/layout-and-navigation.md +51 -0
- package/docs/nextjs.md +69 -0
- package/docs/releasing.md +41 -0
- package/docs/testing.md +242 -0
- package/docs/theming.md +118 -0
- package/docs/typescript.md +62 -0
- package/llms-full.txt +4574 -0
- package/llms.txt +52 -0
- package/package.json +166 -6
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { NumberField as NumberField$1 } from "@base-ui/react/number-field";
|
|
4
|
+
import { Minus, Plus } from "lucide-react";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { fieldControl, fieldInput } from "../FormField/field-styles.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/patterns/NumberField/NumberField.tsx
|
|
9
|
+
var STEP_BUTTON = "inline-flex w-9 shrink-0 cursor-pointer items-center justify-center self-stretch border-0 bg-transparent p-0 text-fg-secondary outline-none hover:bg-primary-pale hover:text-primary-text disabled:cursor-not-allowed disabled:text-fg-disabled disabled:hover:bg-transparent [&_svg]:size-3.5";
|
|
10
|
+
/**
|
|
11
|
+
* A number input with a button at each end to step it. Typing is free and checked on leaving (a number out of
|
|
12
|
+
* `min` and `max` snaps back), the up and down arrow keys step, and `format` and `locale` write the number the
|
|
13
|
+
* way the user reads it. The number reads left to right in a right-to-left language too, while the buttons follow
|
|
14
|
+
* the page. Inside a FormNumberField it is labelled and described by the field.
|
|
15
|
+
*/
|
|
16
|
+
var NumberField = (t0) => {
|
|
17
|
+
const $ = c(67);
|
|
18
|
+
const { value, onValueChange, labels, min, max, step: t1, largeStep, format, locale, placeholder, disabled: t2, readOnly: t3, invalid: t4, required: t5, size: t6, contentBefore, name, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onBlur, inputRef, className } = t0;
|
|
19
|
+
const step = t1 === void 0 ? 1 : t1;
|
|
20
|
+
const disabled = t2 === void 0 ? false : t2;
|
|
21
|
+
const readOnly = t3 === void 0 ? false : t3;
|
|
22
|
+
const invalid = t4 === void 0 ? false : t4;
|
|
23
|
+
const required = t5 === void 0 ? false : t5;
|
|
24
|
+
const size = t6 === void 0 ? "medium" : t6;
|
|
25
|
+
let t7;
|
|
26
|
+
if ($[0] !== onValueChange) {
|
|
27
|
+
t7 = (next) => {
|
|
28
|
+
onValueChange(next);
|
|
29
|
+
};
|
|
30
|
+
$[0] = onValueChange;
|
|
31
|
+
$[1] = t7;
|
|
32
|
+
} else t7 = $[1];
|
|
33
|
+
let t8;
|
|
34
|
+
if ($[2] !== min) {
|
|
35
|
+
t8 = min === void 0 ? {} : { min };
|
|
36
|
+
$[2] = min;
|
|
37
|
+
$[3] = t8;
|
|
38
|
+
} else t8 = $[3];
|
|
39
|
+
let t9;
|
|
40
|
+
if ($[4] !== max) {
|
|
41
|
+
t9 = max === void 0 ? {} : { max };
|
|
42
|
+
$[4] = max;
|
|
43
|
+
$[5] = t9;
|
|
44
|
+
} else t9 = $[5];
|
|
45
|
+
let t10;
|
|
46
|
+
if ($[6] !== largeStep) {
|
|
47
|
+
t10 = largeStep === void 0 ? {} : { largeStep };
|
|
48
|
+
$[6] = largeStep;
|
|
49
|
+
$[7] = t10;
|
|
50
|
+
} else t10 = $[7];
|
|
51
|
+
let t11;
|
|
52
|
+
if ($[8] !== format) {
|
|
53
|
+
t11 = format ? { format } : {};
|
|
54
|
+
$[8] = format;
|
|
55
|
+
$[9] = t11;
|
|
56
|
+
} else t11 = $[9];
|
|
57
|
+
let t12;
|
|
58
|
+
if ($[10] !== locale) {
|
|
59
|
+
t12 = locale === void 0 ? {} : { locale };
|
|
60
|
+
$[10] = locale;
|
|
61
|
+
$[11] = t12;
|
|
62
|
+
} else t12 = $[11];
|
|
63
|
+
let t13;
|
|
64
|
+
if ($[12] !== name) {
|
|
65
|
+
t13 = name ? { name } : {};
|
|
66
|
+
$[12] = name;
|
|
67
|
+
$[13] = t13;
|
|
68
|
+
} else t13 = $[13];
|
|
69
|
+
let t14;
|
|
70
|
+
if ($[14] !== size) {
|
|
71
|
+
t14 = cn(fieldControl({ size }), "gap-0 overflow-hidden px-0");
|
|
72
|
+
$[14] = size;
|
|
73
|
+
$[15] = t14;
|
|
74
|
+
} else t14 = $[15];
|
|
75
|
+
const t15 = invalid || void 0;
|
|
76
|
+
const t16 = disabled || void 0;
|
|
77
|
+
const t17 = labels.decrement;
|
|
78
|
+
let t18;
|
|
79
|
+
let t19;
|
|
80
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
81
|
+
t18 = cn(STEP_BUTTON, "border-e border-line");
|
|
82
|
+
t19 = /* @__PURE__ */ jsx(Minus, { "aria-hidden": "true" });
|
|
83
|
+
$[16] = t18;
|
|
84
|
+
$[17] = t19;
|
|
85
|
+
} else {
|
|
86
|
+
t18 = $[16];
|
|
87
|
+
t19 = $[17];
|
|
88
|
+
}
|
|
89
|
+
let t20;
|
|
90
|
+
if ($[18] !== labels.decrement) {
|
|
91
|
+
t20 = /* @__PURE__ */ jsx(NumberField$1.Decrement, {
|
|
92
|
+
"aria-label": t17,
|
|
93
|
+
className: t18,
|
|
94
|
+
children: t19
|
|
95
|
+
});
|
|
96
|
+
$[18] = labels.decrement;
|
|
97
|
+
$[19] = t20;
|
|
98
|
+
} else t20 = $[19];
|
|
99
|
+
let t21;
|
|
100
|
+
if ($[20] !== contentBefore) {
|
|
101
|
+
t21 = contentBefore ? /* @__PURE__ */ jsx("span", {
|
|
102
|
+
className: "ps-2.5 inline-flex shrink-0 text-fg-tertiary [&_svg]:size-4",
|
|
103
|
+
children: contentBefore
|
|
104
|
+
}) : null;
|
|
105
|
+
$[20] = contentBefore;
|
|
106
|
+
$[21] = t21;
|
|
107
|
+
} else t21 = $[21];
|
|
108
|
+
let t22;
|
|
109
|
+
if ($[22] !== id) {
|
|
110
|
+
t22 = id ? { id } : {};
|
|
111
|
+
$[22] = id;
|
|
112
|
+
$[23] = t22;
|
|
113
|
+
} else t22 = $[23];
|
|
114
|
+
let t23;
|
|
115
|
+
if ($[24] !== ariaLabel) {
|
|
116
|
+
t23 = ariaLabel ? { "aria-label": ariaLabel } : {};
|
|
117
|
+
$[24] = ariaLabel;
|
|
118
|
+
$[25] = t23;
|
|
119
|
+
} else t23 = $[25];
|
|
120
|
+
let t24;
|
|
121
|
+
if ($[26] !== ariaLabelledBy) {
|
|
122
|
+
t24 = ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {};
|
|
123
|
+
$[26] = ariaLabelledBy;
|
|
124
|
+
$[27] = t24;
|
|
125
|
+
} else t24 = $[27];
|
|
126
|
+
let t25;
|
|
127
|
+
if ($[28] !== invalid) {
|
|
128
|
+
t25 = invalid ? { "aria-invalid": true } : {};
|
|
129
|
+
$[28] = invalid;
|
|
130
|
+
$[29] = t25;
|
|
131
|
+
} else t25 = $[29];
|
|
132
|
+
const t26 = required || void 0;
|
|
133
|
+
let t27;
|
|
134
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
135
|
+
t27 = cn(fieldInput, "px-2.5 text-center tabular-nums");
|
|
136
|
+
$[30] = t27;
|
|
137
|
+
} else t27 = $[30];
|
|
138
|
+
let t28;
|
|
139
|
+
if ($[31] !== inputRef || $[32] !== onBlur || $[33] !== placeholder || $[34] !== t22 || $[35] !== t23 || $[36] !== t24 || $[37] !== t25 || $[38] !== t26) {
|
|
140
|
+
t28 = /* @__PURE__ */ jsx(NumberField$1.Input, {
|
|
141
|
+
ref: inputRef,
|
|
142
|
+
...t22,
|
|
143
|
+
...t23,
|
|
144
|
+
...t24,
|
|
145
|
+
...t25,
|
|
146
|
+
"aria-required": t26,
|
|
147
|
+
placeholder,
|
|
148
|
+
dir: "ltr",
|
|
149
|
+
className: t27,
|
|
150
|
+
onBlur
|
|
151
|
+
});
|
|
152
|
+
$[31] = inputRef;
|
|
153
|
+
$[32] = onBlur;
|
|
154
|
+
$[33] = placeholder;
|
|
155
|
+
$[34] = t22;
|
|
156
|
+
$[35] = t23;
|
|
157
|
+
$[36] = t24;
|
|
158
|
+
$[37] = t25;
|
|
159
|
+
$[38] = t26;
|
|
160
|
+
$[39] = t28;
|
|
161
|
+
} else t28 = $[39];
|
|
162
|
+
const t29 = labels.increment;
|
|
163
|
+
let t30;
|
|
164
|
+
let t31;
|
|
165
|
+
if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
|
|
166
|
+
t30 = cn(STEP_BUTTON, "border-s border-line");
|
|
167
|
+
t31 = /* @__PURE__ */ jsx(Plus, { "aria-hidden": "true" });
|
|
168
|
+
$[40] = t30;
|
|
169
|
+
$[41] = t31;
|
|
170
|
+
} else {
|
|
171
|
+
t30 = $[40];
|
|
172
|
+
t31 = $[41];
|
|
173
|
+
}
|
|
174
|
+
let t32;
|
|
175
|
+
if ($[42] !== labels.increment) {
|
|
176
|
+
t32 = /* @__PURE__ */ jsx(NumberField$1.Increment, {
|
|
177
|
+
"aria-label": t29,
|
|
178
|
+
className: t30,
|
|
179
|
+
children: t31
|
|
180
|
+
});
|
|
181
|
+
$[42] = labels.increment;
|
|
182
|
+
$[43] = t32;
|
|
183
|
+
} else t32 = $[43];
|
|
184
|
+
let t33;
|
|
185
|
+
if ($[44] !== t14 || $[45] !== t15 || $[46] !== t16 || $[47] !== t20 || $[48] !== t21 || $[49] !== t28 || $[50] !== t32) {
|
|
186
|
+
t33 = /* @__PURE__ */ jsxs(NumberField$1.Group, {
|
|
187
|
+
className: t14,
|
|
188
|
+
"data-invalid": t15,
|
|
189
|
+
"data-disabled": t16,
|
|
190
|
+
children: [
|
|
191
|
+
t20,
|
|
192
|
+
t21,
|
|
193
|
+
t28,
|
|
194
|
+
t32
|
|
195
|
+
]
|
|
196
|
+
});
|
|
197
|
+
$[44] = t14;
|
|
198
|
+
$[45] = t15;
|
|
199
|
+
$[46] = t16;
|
|
200
|
+
$[47] = t20;
|
|
201
|
+
$[48] = t21;
|
|
202
|
+
$[49] = t28;
|
|
203
|
+
$[50] = t32;
|
|
204
|
+
$[51] = t33;
|
|
205
|
+
} else t33 = $[51];
|
|
206
|
+
let t34;
|
|
207
|
+
if ($[52] !== className || $[53] !== disabled || $[54] !== readOnly || $[55] !== required || $[56] !== step || $[57] !== t10 || $[58] !== t11 || $[59] !== t12 || $[60] !== t13 || $[61] !== t33 || $[62] !== t7 || $[63] !== t8 || $[64] !== t9 || $[65] !== value) {
|
|
208
|
+
t34 = /* @__PURE__ */ jsx(NumberField$1.Root, {
|
|
209
|
+
value,
|
|
210
|
+
onValueChange: t7,
|
|
211
|
+
step,
|
|
212
|
+
...t8,
|
|
213
|
+
...t9,
|
|
214
|
+
...t10,
|
|
215
|
+
...t11,
|
|
216
|
+
...t12,
|
|
217
|
+
...t13,
|
|
218
|
+
disabled,
|
|
219
|
+
readOnly,
|
|
220
|
+
required,
|
|
221
|
+
className,
|
|
222
|
+
children: t33
|
|
223
|
+
});
|
|
224
|
+
$[52] = className;
|
|
225
|
+
$[53] = disabled;
|
|
226
|
+
$[54] = readOnly;
|
|
227
|
+
$[55] = required;
|
|
228
|
+
$[56] = step;
|
|
229
|
+
$[57] = t10;
|
|
230
|
+
$[58] = t11;
|
|
231
|
+
$[59] = t12;
|
|
232
|
+
$[60] = t13;
|
|
233
|
+
$[61] = t33;
|
|
234
|
+
$[62] = t7;
|
|
235
|
+
$[63] = t8;
|
|
236
|
+
$[64] = t9;
|
|
237
|
+
$[65] = value;
|
|
238
|
+
$[66] = t34;
|
|
239
|
+
} else t34 = $[66];
|
|
240
|
+
return t34;
|
|
241
|
+
};
|
|
242
|
+
export { NumberField };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** The texts of the pagination bar. The design system has no i18n, so the caller supplies them. */
|
|
2
|
+
export interface PaginationLabels {
|
|
3
|
+
/** Accessible name of the bar, e.g. "Pagination". */
|
|
4
|
+
navigation: string;
|
|
5
|
+
previous: string;
|
|
6
|
+
next: string;
|
|
7
|
+
/** Accessible name of the page-size select, e.g. "Rows per page". */
|
|
8
|
+
pageSize: string;
|
|
9
|
+
/** The page button's accessible name, e.g. `Page ${page}`. */
|
|
10
|
+
page: (page: number) => string;
|
|
11
|
+
/** The range in view, e.g. `Showing ${from}–${to} of ${total}`. */
|
|
12
|
+
summary: (range: {
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
total: number;
|
|
16
|
+
}) => string;
|
|
17
|
+
}
|
|
18
|
+
interface PaginationProps {
|
|
19
|
+
/** The current page, counting from 1. */
|
|
20
|
+
page: number;
|
|
21
|
+
pageSize: number;
|
|
22
|
+
totalItems: number;
|
|
23
|
+
onPageChange: (page: number) => void;
|
|
24
|
+
/** With `pageSizeOptions`, shows a page-size select. */
|
|
25
|
+
onPageSizeChange?: ((pageSize: number) => void) | undefined;
|
|
26
|
+
pageSizeOptions?: readonly number[] | undefined;
|
|
27
|
+
labels: PaginationLabels;
|
|
28
|
+
}
|
|
29
|
+
/** Previous, page numbers, next, a page-size select and a "Showing 1–20 of 250" summary. */
|
|
30
|
+
export declare const Pagination: ({ page, pageSize, totalItems, onPageChange, onPageSizeChange, pageSizeOptions, labels, }: PaginationProps) => import("react").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { getPageItems } from "./page-items.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/patterns/Pagination/Pagination.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Figma's pagination buttons, 11px on an 8px radius: Prev and Next are
|
|
10
|
+
* `px-2 py-1` text, a page number is a `size-7` square (it grows with a long
|
|
11
|
+
* number), and the current page is the teal fill.
|
|
12
|
+
*/
|
|
13
|
+
var paginationButtonVariants = cva([
|
|
14
|
+
"inline-flex items-center justify-center rounded-md border-0 text-tiny transition-colors duration-150 ease-standard",
|
|
15
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",
|
|
16
|
+
"aria-disabled:cursor-not-allowed aria-disabled:text-fg-disabled"
|
|
17
|
+
], {
|
|
18
|
+
variants: {
|
|
19
|
+
kind: {
|
|
20
|
+
step: "gap-1 px-2 py-1",
|
|
21
|
+
page: "h-7 min-w-7 px-1 font-semibold"
|
|
22
|
+
},
|
|
23
|
+
current: {
|
|
24
|
+
true: "",
|
|
25
|
+
false: ""
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
compoundVariants: [
|
|
29
|
+
{
|
|
30
|
+
kind: "step",
|
|
31
|
+
className: "bg-transparent text-fg-secondary not-aria-disabled:hover:bg-subtle"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
kind: "page",
|
|
35
|
+
current: true,
|
|
36
|
+
className: "bg-primary text-on-primary"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
kind: "page",
|
|
40
|
+
current: false,
|
|
41
|
+
className: "bg-transparent text-fg-secondary hover:bg-subtle"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
kind: "page",
|
|
46
|
+
current: false
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
/** The chevron points at the start edge, so it mirrors in right-to-left. */
|
|
50
|
+
var CHEVRON = "size-3.5 rtl:-scale-x-100";
|
|
51
|
+
/** Previous, page numbers, next, a page-size select and a "Showing 1–20 of 250" summary. */
|
|
52
|
+
var Pagination = (t0) => {
|
|
53
|
+
const $ = c(58);
|
|
54
|
+
const { page, pageSize, totalItems, onPageChange, onPageSizeChange, pageSizeOptions, labels } = t0;
|
|
55
|
+
let t1;
|
|
56
|
+
if ($[0] !== pageSize) {
|
|
57
|
+
t1 = Number.isFinite(pageSize) && pageSize >= 1 ? Math.floor(pageSize) : 1;
|
|
58
|
+
$[0] = pageSize;
|
|
59
|
+
$[1] = t1;
|
|
60
|
+
} else t1 = $[1];
|
|
61
|
+
const size = t1;
|
|
62
|
+
let t2;
|
|
63
|
+
if ($[2] !== totalItems) {
|
|
64
|
+
t2 = Number.isFinite(totalItems) && totalItems > 0 ? Math.floor(totalItems) : 0;
|
|
65
|
+
$[2] = totalItems;
|
|
66
|
+
$[3] = t2;
|
|
67
|
+
} else t2 = $[3];
|
|
68
|
+
const total = t2;
|
|
69
|
+
const pageCount = Math.max(1, Math.ceil(total / size));
|
|
70
|
+
let t3;
|
|
71
|
+
if ($[4] !== page) {
|
|
72
|
+
t3 = Number.isFinite(page) ? Math.trunc(page) : 1;
|
|
73
|
+
$[4] = page;
|
|
74
|
+
$[5] = t3;
|
|
75
|
+
} else t3 = $[5];
|
|
76
|
+
const current = Math.min(Math.max(t3, 1), pageCount);
|
|
77
|
+
const from = total === 0 ? 0 : (current - 1) * size + 1;
|
|
78
|
+
const to = Math.min(current * size, total);
|
|
79
|
+
const isFirst = current <= 1;
|
|
80
|
+
const isLast = current >= pageCount;
|
|
81
|
+
let t4;
|
|
82
|
+
if ($[6] !== labels.pageSize || $[7] !== onPageSizeChange || $[8] !== pageSize || $[9] !== pageSizeOptions) {
|
|
83
|
+
t4 = onPageSizeChange && pageSizeOptions ? /* @__PURE__ */ jsx("select", {
|
|
84
|
+
className: "cursor-pointer rounded-md border border-line bg-surface px-2 py-1 text-tiny text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",
|
|
85
|
+
"aria-label": labels.pageSize,
|
|
86
|
+
value: pageSize,
|
|
87
|
+
onChange: (event) => {
|
|
88
|
+
onPageSizeChange(Number(event.target.value));
|
|
89
|
+
},
|
|
90
|
+
children: pageSizeOptions.map(_temp)
|
|
91
|
+
}) : null;
|
|
92
|
+
$[6] = labels.pageSize;
|
|
93
|
+
$[7] = onPageSizeChange;
|
|
94
|
+
$[8] = pageSize;
|
|
95
|
+
$[9] = pageSizeOptions;
|
|
96
|
+
$[10] = t4;
|
|
97
|
+
} else t4 = $[10];
|
|
98
|
+
let t5;
|
|
99
|
+
if ($[11] !== from || $[12] !== labels || $[13] !== to || $[14] !== total) {
|
|
100
|
+
t5 = labels.summary({
|
|
101
|
+
from,
|
|
102
|
+
to,
|
|
103
|
+
total
|
|
104
|
+
});
|
|
105
|
+
$[11] = from;
|
|
106
|
+
$[12] = labels;
|
|
107
|
+
$[13] = to;
|
|
108
|
+
$[14] = total;
|
|
109
|
+
$[15] = t5;
|
|
110
|
+
} else t5 = $[15];
|
|
111
|
+
let t6;
|
|
112
|
+
if ($[16] !== t5) {
|
|
113
|
+
t6 = /* @__PURE__ */ jsx("span", {
|
|
114
|
+
"aria-live": "polite",
|
|
115
|
+
children: t5
|
|
116
|
+
});
|
|
117
|
+
$[16] = t5;
|
|
118
|
+
$[17] = t6;
|
|
119
|
+
} else t6 = $[17];
|
|
120
|
+
let t7;
|
|
121
|
+
if ($[18] !== t4 || $[19] !== t6) {
|
|
122
|
+
t7 = /* @__PURE__ */ jsxs("div", {
|
|
123
|
+
className: "flex items-center gap-2",
|
|
124
|
+
children: [t4, t6]
|
|
125
|
+
});
|
|
126
|
+
$[18] = t4;
|
|
127
|
+
$[19] = t6;
|
|
128
|
+
$[20] = t7;
|
|
129
|
+
} else t7 = $[20];
|
|
130
|
+
const t8 = labels.navigation;
|
|
131
|
+
let t9;
|
|
132
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
133
|
+
t9 = paginationButtonVariants({ kind: "step" });
|
|
134
|
+
$[21] = t9;
|
|
135
|
+
} else t9 = $[21];
|
|
136
|
+
const t10 = isFirst || void 0;
|
|
137
|
+
let t11;
|
|
138
|
+
if ($[22] !== current || $[23] !== isFirst || $[24] !== onPageChange) {
|
|
139
|
+
t11 = () => {
|
|
140
|
+
if (!isFirst) onPageChange(current - 1);
|
|
141
|
+
};
|
|
142
|
+
$[22] = current;
|
|
143
|
+
$[23] = isFirst;
|
|
144
|
+
$[24] = onPageChange;
|
|
145
|
+
$[25] = t11;
|
|
146
|
+
} else t11 = $[25];
|
|
147
|
+
let t12;
|
|
148
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
149
|
+
t12 = /* @__PURE__ */ jsx(ChevronLeft, {
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
className: CHEVRON
|
|
152
|
+
});
|
|
153
|
+
$[26] = t12;
|
|
154
|
+
} else t12 = $[26];
|
|
155
|
+
let t13;
|
|
156
|
+
if ($[27] !== labels.previous || $[28] !== t10 || $[29] !== t11) {
|
|
157
|
+
t13 = /* @__PURE__ */ jsxs("button", {
|
|
158
|
+
type: "button",
|
|
159
|
+
className: t9,
|
|
160
|
+
"aria-disabled": t10,
|
|
161
|
+
onClick: t11,
|
|
162
|
+
children: [t12, labels.previous]
|
|
163
|
+
});
|
|
164
|
+
$[27] = labels.previous;
|
|
165
|
+
$[28] = t10;
|
|
166
|
+
$[29] = t11;
|
|
167
|
+
$[30] = t13;
|
|
168
|
+
} else t13 = $[30];
|
|
169
|
+
let t14;
|
|
170
|
+
if ($[31] !== current || $[32] !== labels || $[33] !== onPageChange || $[34] !== pageCount) {
|
|
171
|
+
let t15;
|
|
172
|
+
if ($[36] !== current || $[37] !== labels || $[38] !== onPageChange) {
|
|
173
|
+
t15 = (item) => item.type === "gap" ? /* @__PURE__ */ jsx("span", {
|
|
174
|
+
"aria-hidden": "true",
|
|
175
|
+
className: "px-1",
|
|
176
|
+
children: "…"
|
|
177
|
+
}, item.key) : /* @__PURE__ */ jsx("button", {
|
|
178
|
+
type: "button",
|
|
179
|
+
className: paginationButtonVariants({
|
|
180
|
+
kind: "page",
|
|
181
|
+
current: item.page === current
|
|
182
|
+
}),
|
|
183
|
+
"aria-label": labels.page(item.page),
|
|
184
|
+
"aria-current": item.page === current ? "page" : void 0,
|
|
185
|
+
onClick: () => {
|
|
186
|
+
onPageChange(item.page);
|
|
187
|
+
},
|
|
188
|
+
children: item.page
|
|
189
|
+
}, item.page);
|
|
190
|
+
$[36] = current;
|
|
191
|
+
$[37] = labels;
|
|
192
|
+
$[38] = onPageChange;
|
|
193
|
+
$[39] = t15;
|
|
194
|
+
} else t15 = $[39];
|
|
195
|
+
t14 = getPageItems(current, pageCount).map(t15);
|
|
196
|
+
$[31] = current;
|
|
197
|
+
$[32] = labels;
|
|
198
|
+
$[33] = onPageChange;
|
|
199
|
+
$[34] = pageCount;
|
|
200
|
+
$[35] = t14;
|
|
201
|
+
} else t14 = $[35];
|
|
202
|
+
let t15;
|
|
203
|
+
if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
|
|
204
|
+
t15 = paginationButtonVariants({ kind: "step" });
|
|
205
|
+
$[40] = t15;
|
|
206
|
+
} else t15 = $[40];
|
|
207
|
+
const t16 = isLast || void 0;
|
|
208
|
+
let t17;
|
|
209
|
+
if ($[41] !== current || $[42] !== isLast || $[43] !== onPageChange) {
|
|
210
|
+
t17 = () => {
|
|
211
|
+
if (!isLast) onPageChange(current + 1);
|
|
212
|
+
};
|
|
213
|
+
$[41] = current;
|
|
214
|
+
$[42] = isLast;
|
|
215
|
+
$[43] = onPageChange;
|
|
216
|
+
$[44] = t17;
|
|
217
|
+
} else t17 = $[44];
|
|
218
|
+
let t18;
|
|
219
|
+
if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
|
|
220
|
+
t18 = /* @__PURE__ */ jsx(ChevronRight, {
|
|
221
|
+
"aria-hidden": "true",
|
|
222
|
+
className: CHEVRON
|
|
223
|
+
});
|
|
224
|
+
$[45] = t18;
|
|
225
|
+
} else t18 = $[45];
|
|
226
|
+
let t19;
|
|
227
|
+
if ($[46] !== labels.next || $[47] !== t16 || $[48] !== t17) {
|
|
228
|
+
t19 = /* @__PURE__ */ jsxs("button", {
|
|
229
|
+
type: "button",
|
|
230
|
+
className: t15,
|
|
231
|
+
"aria-disabled": t16,
|
|
232
|
+
onClick: t17,
|
|
233
|
+
children: [labels.next, t18]
|
|
234
|
+
});
|
|
235
|
+
$[46] = labels.next;
|
|
236
|
+
$[47] = t16;
|
|
237
|
+
$[48] = t17;
|
|
238
|
+
$[49] = t19;
|
|
239
|
+
} else t19 = $[49];
|
|
240
|
+
let t20;
|
|
241
|
+
if ($[50] !== labels.navigation || $[51] !== t13 || $[52] !== t14 || $[53] !== t19) {
|
|
242
|
+
t20 = /* @__PURE__ */ jsxs("nav", {
|
|
243
|
+
"aria-label": t8,
|
|
244
|
+
className: "flex items-center gap-1",
|
|
245
|
+
children: [
|
|
246
|
+
t13,
|
|
247
|
+
t14,
|
|
248
|
+
t19
|
|
249
|
+
]
|
|
250
|
+
});
|
|
251
|
+
$[50] = labels.navigation;
|
|
252
|
+
$[51] = t13;
|
|
253
|
+
$[52] = t14;
|
|
254
|
+
$[53] = t19;
|
|
255
|
+
$[54] = t20;
|
|
256
|
+
} else t20 = $[54];
|
|
257
|
+
let t21;
|
|
258
|
+
if ($[55] !== t20 || $[56] !== t7) {
|
|
259
|
+
t21 = /* @__PURE__ */ jsxs("div", {
|
|
260
|
+
className: "flex flex-wrap items-center justify-between gap-3 border-t border-line bg-surface px-4 py-3 text-tiny text-fg-secondary",
|
|
261
|
+
children: [t7, t20]
|
|
262
|
+
});
|
|
263
|
+
$[55] = t20;
|
|
264
|
+
$[56] = t7;
|
|
265
|
+
$[57] = t21;
|
|
266
|
+
} else t21 = $[57];
|
|
267
|
+
return t21;
|
|
268
|
+
};
|
|
269
|
+
function _temp(option) {
|
|
270
|
+
return /* @__PURE__ */ jsx("option", {
|
|
271
|
+
value: option,
|
|
272
|
+
children: option
|
|
273
|
+
}, option);
|
|
274
|
+
}
|
|
275
|
+
export { Pagination };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type PageItem = {
|
|
2
|
+
type: "page";
|
|
3
|
+
page: number;
|
|
4
|
+
} | {
|
|
5
|
+
type: "gap";
|
|
6
|
+
key: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The page buttons to show: always the first and last page and the current one
|
|
10
|
+
* with a neighbour on each side, with a gap where pages are left out. A gap that
|
|
11
|
+
* would hide a single page shows that page instead.
|
|
12
|
+
*
|
|
13
|
+
* current 1 of 7 → 1 2 … 7
|
|
14
|
+
* current 5 of 9 → 1 … 4 5 6 … 9
|
|
15
|
+
* current 4 of 9 → 1 2 3 4 5 … 9 (the gap would hide only 2, so 2 shows)
|
|
16
|
+
* current 3 of 9 → 1 2 3 4 … 9
|
|
17
|
+
*/
|
|
18
|
+
export declare const getPageItems: (current: number, pageCount: number) => PageItem[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/patterns/Pagination/page-items.ts
|
|
2
|
+
/**
|
|
3
|
+
* The page buttons to show: always the first and last page and the current one
|
|
4
|
+
* with a neighbour on each side, with a gap where pages are left out. A gap that
|
|
5
|
+
* would hide a single page shows that page instead.
|
|
6
|
+
*
|
|
7
|
+
* current 1 of 7 → 1 2 … 7
|
|
8
|
+
* current 5 of 9 → 1 … 4 5 6 … 9
|
|
9
|
+
* current 4 of 9 → 1 2 3 4 5 … 9 (the gap would hide only 2, so 2 shows)
|
|
10
|
+
* current 3 of 9 → 1 2 3 4 … 9
|
|
11
|
+
*/
|
|
12
|
+
var getPageItems = (current, pageCount) => {
|
|
13
|
+
const wanted = [.../* @__PURE__ */ new Set([
|
|
14
|
+
1,
|
|
15
|
+
current - 1,
|
|
16
|
+
current,
|
|
17
|
+
current + 1,
|
|
18
|
+
pageCount
|
|
19
|
+
])].filter((page) => page >= 1 && page <= pageCount).sort((a, b) => a - b);
|
|
20
|
+
const items = [];
|
|
21
|
+
wanted.forEach((page, index) => {
|
|
22
|
+
const previous = wanted[index - 1];
|
|
23
|
+
if (previous !== void 0) {
|
|
24
|
+
if (page - previous === 2) items.push({
|
|
25
|
+
type: "page",
|
|
26
|
+
page: previous + 1
|
|
27
|
+
});
|
|
28
|
+
else if (page - previous > 2) items.push({
|
|
29
|
+
type: "gap",
|
|
30
|
+
key: `after-${previous}`
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
items.push({
|
|
34
|
+
type: "page",
|
|
35
|
+
page
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
return items;
|
|
39
|
+
};
|
|
40
|
+
export { getPageItems };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Control, type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
|
|
2
|
+
import { type PhoneFieldProps } from "./PhoneField.js";
|
|
3
|
+
export type { PhoneCountry, PhoneFieldLabels } from "./PhoneField.js";
|
|
4
|
+
export interface FormPhoneFieldProps<TValues extends FieldValues> extends Omit<PhoneFieldProps, "name" | "value" | "onValueChange" | "onBlur" | "errorMessage" | "invalid" | "inputRef"> {
|
|
5
|
+
control: Control<TValues>;
|
|
6
|
+
name: FieldPath<TValues>;
|
|
7
|
+
/**
|
|
8
|
+
* react-hook-form validation rules, for forms that do not use a schema resolver (e.g. `{ required: "namespace:key" }`):
|
|
9
|
+
* the message is shown as the field's error, through `formatError`.
|
|
10
|
+
*/
|
|
11
|
+
rules?: ControllerProps<TValues, FieldPath<TValues>>["rules"] | undefined;
|
|
12
|
+
/** Turns a stored schema message (an i18n key) into display text. */
|
|
13
|
+
formatError?: ((message: string) => string) | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A PhoneField bound to a react-hook-form string field holding the number in E.164:
|
|
17
|
+
* the calling code and the digits with nothing between, e.g. "+12025550123"
|
|
18
|
+
* (`joinPhone` and `splitPhone` convert it). A searchable calling-code picker and a digits-only
|
|
19
|
+
* number share one box. The box is always left to right: numbers read that way
|
|
20
|
+
* in a right-to-left language too.
|
|
21
|
+
*/
|
|
22
|
+
export declare const FormPhoneField: <TValues extends FieldValues>({ control, name, rules, formatError, maxDigits, disabled, size, ...phoneProps }: FormPhoneFieldProps<TValues>) => import("react").JSX.Element;
|