@byldpartners/ui 0.0.1
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 +284 -0
- package/dist/chunk-464G63BO.cjs +224 -0
- package/dist/chunk-464G63BO.cjs.map +1 -0
- package/dist/chunk-JFJY6DZZ.js +224 -0
- package/dist/chunk-JFJY6DZZ.js.map +1 -0
- package/dist/index.cjs +3894 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1543 -0
- package/dist/index.d.ts +1543 -0
- package/dist/index.js +3894 -0
- package/dist/index.js.map +1 -0
- package/dist/theme/web.cjs +16 -0
- package/dist/theme/web.cjs.map +1 -0
- package/dist/theme/web.d.cts +81 -0
- package/dist/theme/web.d.ts +81 -0
- package/dist/theme/web.js +16 -0
- package/dist/theme/web.js.map +1 -0
- package/package.json +117 -0
- package/src/components/Accordion/Accordion.native.tsx +195 -0
- package/src/components/Accordion/Accordion.stories.tsx +49 -0
- package/src/components/Accordion/Accordion.types.ts +28 -0
- package/src/components/Accordion/Accordion.web.tsx +61 -0
- package/src/components/Accordion/index.native.ts +12 -0
- package/src/components/Accordion/index.ts +12 -0
- package/src/components/Accordion/useAccordion.test.ts +114 -0
- package/src/components/Accordion/useAccordion.ts +65 -0
- package/src/components/Alert/Alert.native.tsx +86 -0
- package/src/components/Alert/Alert.stories.tsx +43 -0
- package/src/components/Alert/Alert.types.ts +17 -0
- package/src/components/Alert/Alert.web.test.tsx +49 -0
- package/src/components/Alert/Alert.web.tsx +59 -0
- package/src/components/Alert/index.native.ts +2 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/Alert/useAlert.test.ts +19 -0
- package/src/components/Alert/useAlert.ts +10 -0
- package/src/components/AlertDialog/AlertDialog.native.tsx +281 -0
- package/src/components/AlertDialog/AlertDialog.stories.tsx +49 -0
- package/src/components/AlertDialog/AlertDialog.types.ts +49 -0
- package/src/components/AlertDialog/AlertDialog.web.tsx +138 -0
- package/src/components/AlertDialog/index.native.ts +22 -0
- package/src/components/AlertDialog/index.ts +24 -0
- package/src/components/AlertDialog/useAlertDialog.test.ts +40 -0
- package/src/components/AlertDialog/useAlertDialog.ts +36 -0
- package/src/components/AspectRatio/AspectRatio.native.tsx +37 -0
- package/src/components/AspectRatio/AspectRatio.stories.tsx +44 -0
- package/src/components/AspectRatio/AspectRatio.types.ts +5 -0
- package/src/components/AspectRatio/AspectRatio.web.tsx +5 -0
- package/src/components/AspectRatio/index.native.ts +2 -0
- package/src/components/AspectRatio/index.ts +2 -0
- package/src/components/AspectRatio/useAspectRatio.test.ts +40 -0
- package/src/components/AspectRatio/useAspectRatio.ts +12 -0
- package/src/components/Avatar/Avatar.native.tsx +95 -0
- package/src/components/Avatar/Avatar.stories.tsx +31 -0
- package/src/components/Avatar/Avatar.types.ts +17 -0
- package/src/components/Avatar/Avatar.web.tsx +47 -0
- package/src/components/Avatar/index.native.ts +2 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Avatar/useAvatarImage.test.ts +66 -0
- package/src/components/Avatar/useAvatarImage.ts +31 -0
- package/src/components/Badge/Badge.native.tsx +64 -0
- package/src/components/Badge/Badge.stories.tsx +42 -0
- package/src/components/Badge/Badge.types.ts +7 -0
- package/src/components/Badge/Badge.web.test.tsx +40 -0
- package/src/components/Badge/Badge.web.tsx +41 -0
- package/src/components/Badge/index.native.ts +2 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/Breadcrumb/Breadcrumb.native.tsx +158 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +41 -0
- package/src/components/Breadcrumb/Breadcrumb.types.ts +37 -0
- package/src/components/Breadcrumb/Breadcrumb.web.tsx +125 -0
- package/src/components/Breadcrumb/index.native.ts +18 -0
- package/src/components/Breadcrumb/index.ts +18 -0
- package/src/components/Button/Button.native.tsx +118 -0
- package/src/components/Button/Button.stories.tsx +97 -0
- package/src/components/Button/Button.types.ts +19 -0
- package/src/components/Button/Button.web.test.tsx +69 -0
- package/src/components/Button/Button.web.tsx +55 -0
- package/src/components/Button/index.native.ts +2 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Calendar/Calendar.native.tsx +108 -0
- package/src/components/Calendar/Calendar.stories.tsx +18 -0
- package/src/components/Calendar/Calendar.types.ts +8 -0
- package/src/components/Calendar/Calendar.web.tsx +143 -0
- package/src/components/Calendar/index.native.ts +2 -0
- package/src/components/Calendar/index.ts +2 -0
- package/src/components/Calendar/useCalendar.test.ts +145 -0
- package/src/components/Calendar/useCalendar.ts +94 -0
- package/src/components/Card/Card.native.tsx +42 -0
- package/src/components/Card/Card.stories.tsx +41 -0
- package/src/components/Card/Card.types.ts +4 -0
- package/src/components/Card/Card.web.test.tsx +29 -0
- package/src/components/Card/Card.web.tsx +23 -0
- package/src/components/Card/index.native.ts +2 -0
- package/src/components/Card/index.ts +2 -0
- package/src/components/Carousel/Carousel.native.tsx +193 -0
- package/src/components/Carousel/Carousel.stories.tsx +51 -0
- package/src/components/Carousel/Carousel.types.ts +29 -0
- package/src/components/Carousel/Carousel.web.tsx +272 -0
- package/src/components/Carousel/index.native.ts +2 -0
- package/src/components/Carousel/index.ts +2 -0
- package/src/components/Carousel/useCarousel.test.ts +111 -0
- package/src/components/Carousel/useCarousel.ts +48 -0
- package/src/components/Chart/Chart.native.tsx +7 -0
- package/src/components/Chart/Chart.stories.tsx +57 -0
- package/src/components/Chart/Chart.types.ts +13 -0
- package/src/components/Chart/Chart.web.tsx +36 -0
- package/src/components/Chart/index.native.ts +2 -0
- package/src/components/Chart/index.ts +3 -0
- package/src/components/Checkbox/Checkbox.native.tsx +47 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +30 -0
- package/src/components/Checkbox/Checkbox.types.ts +12 -0
- package/src/components/Checkbox/Checkbox.web.tsx +37 -0
- package/src/components/Checkbox/index.native.ts +2 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Checkbox/useCheckbox.test.ts +66 -0
- package/src/components/Checkbox/useCheckbox.ts +37 -0
- package/src/components/Collapsible/Collapsible.native.tsx +111 -0
- package/src/components/Collapsible/Collapsible.stories.tsx +35 -0
- package/src/components/Collapsible/Collapsible.types.ts +19 -0
- package/src/components/Collapsible/Collapsible.web.tsx +9 -0
- package/src/components/Collapsible/index.native.ts +2 -0
- package/src/components/Collapsible/index.ts +2 -0
- package/src/components/Collapsible/useCollapsible.test.ts +53 -0
- package/src/components/Collapsible/useCollapsible.ts +38 -0
- package/src/components/Combobox/Combobox.native.tsx +146 -0
- package/src/components/Combobox/Combobox.stories.tsx +43 -0
- package/src/components/Combobox/Combobox.types.ts +15 -0
- package/src/components/Combobox/Combobox.web.tsx +145 -0
- package/src/components/Combobox/index.native.ts +2 -0
- package/src/components/Combobox/index.ts +2 -0
- package/src/components/Combobox/useCombobox.test.ts +59 -0
- package/src/components/Combobox/useCombobox.ts +42 -0
- package/src/components/Command/Command.native.tsx +7 -0
- package/src/components/Command/Command.stories.tsx +37 -0
- package/src/components/Command/Command.types.ts +43 -0
- package/src/components/Command/Command.web.tsx +134 -0
- package/src/components/Command/index.native.ts +2 -0
- package/src/components/Command/index.ts +18 -0
- package/src/components/ContextMenu/ContextMenu.native.tsx +241 -0
- package/src/components/ContextMenu/ContextMenu.stories.tsx +43 -0
- package/src/components/ContextMenu/ContextMenu.types.ts +69 -0
- package/src/components/ContextMenu/ContextMenu.web.tsx +220 -0
- package/src/components/ContextMenu/index.native.ts +28 -0
- package/src/components/ContextMenu/index.ts +2 -0
- package/src/components/ContextMenu/useContextMenu.test.ts +44 -0
- package/src/components/ContextMenu/useContextMenu.ts +36 -0
- package/src/components/DataTable/DataTable.native.tsx +85 -0
- package/src/components/DataTable/DataTable.stories.tsx +72 -0
- package/src/components/DataTable/DataTable.types.ts +16 -0
- package/src/components/DataTable/DataTable.web.tsx +135 -0
- package/src/components/DataTable/index.native.ts +2 -0
- package/src/components/DataTable/index.ts +3 -0
- package/src/components/DataTable/useDataTable.test.ts +98 -0
- package/src/components/DataTable/useDataTable.ts +68 -0
- package/src/components/DatePicker/DatePicker.native.tsx +82 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +68 -0
- package/src/components/DatePicker/DatePicker.types.ts +7 -0
- package/src/components/DatePicker/DatePicker.web.tsx +85 -0
- package/src/components/DatePicker/index.native.ts +2 -0
- package/src/components/DatePicker/index.ts +2 -0
- package/src/components/DatePicker/useDatePicker.test.ts +62 -0
- package/src/components/DatePicker/useDatePicker.ts +54 -0
- package/src/components/Dialog/Dialog.native.tsx +188 -0
- package/src/components/Dialog/Dialog.stories.tsx +42 -0
- package/src/components/Dialog/Dialog.types.ts +45 -0
- package/src/components/Dialog/Dialog.web.tsx +126 -0
- package/src/components/Dialog/index.native.ts +2 -0
- package/src/components/Dialog/index.ts +2 -0
- package/src/components/Dialog/useDialog.test.ts +44 -0
- package/src/components/Dialog/useDialog.ts +36 -0
- package/src/components/Drawer/Drawer.native.tsx +244 -0
- package/src/components/Drawer/Drawer.stories.tsx +39 -0
- package/src/components/Drawer/Drawer.types.ts +44 -0
- package/src/components/Drawer/Drawer.web.tsx +133 -0
- package/src/components/Drawer/index.native.ts +2 -0
- package/src/components/Drawer/index.ts +2 -0
- package/src/components/Drawer/useDrawer.test.ts +33 -0
- package/src/components/Drawer/useDrawer.ts +19 -0
- package/src/components/DropdownMenu/DropdownMenu.native.tsx +272 -0
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +36 -0
- package/src/components/DropdownMenu/DropdownMenu.types.ts +73 -0
- package/src/components/DropdownMenu/DropdownMenu.web.tsx +225 -0
- package/src/components/DropdownMenu/index.native.ts +2 -0
- package/src/components/DropdownMenu/index.ts +2 -0
- package/src/components/DropdownMenu/useDropdownMenu.test.ts +44 -0
- package/src/components/DropdownMenu/useDropdownMenu.ts +36 -0
- package/src/components/Form/Form.native.tsx +98 -0
- package/src/components/Form/Form.stories.tsx +83 -0
- package/src/components/Form/Form.types.ts +35 -0
- package/src/components/Form/Form.web.test.tsx +73 -0
- package/src/components/Form/Form.web.tsx +111 -0
- package/src/components/Form/index.native.ts +18 -0
- package/src/components/Form/index.ts +18 -0
- package/src/components/Form/useFormField.test.ts +25 -0
- package/src/components/Form/useFormField.ts +22 -0
- package/src/components/HoverCard/HoverCard.native.tsx +15 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +34 -0
- package/src/components/HoverCard/HoverCard.types.ts +18 -0
- package/src/components/HoverCard/HoverCard.web.test.tsx +35 -0
- package/src/components/HoverCard/HoverCard.web.tsx +26 -0
- package/src/components/HoverCard/index.native.ts +2 -0
- package/src/components/HoverCard/index.ts +2 -0
- package/src/components/Icon/Icon.native.tsx +27 -0
- package/src/components/Icon/index.native.ts +2 -0
- package/src/components/Input/Input.native.tsx +32 -0
- package/src/components/Input/Input.stories.tsx +42 -0
- package/src/components/Input/Input.types.ts +10 -0
- package/src/components/Input/Input.web.test.tsx +39 -0
- package/src/components/Input/Input.web.tsx +21 -0
- package/src/components/Input/index.native.ts +2 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/InputOTP/InputOTP.native.tsx +93 -0
- package/src/components/InputOTP/InputOTP.stories.tsx +56 -0
- package/src/components/InputOTP/InputOTP.types.ts +14 -0
- package/src/components/InputOTP/InputOTP.web.tsx +128 -0
- package/src/components/InputOTP/index.native.ts +2 -0
- package/src/components/InputOTP/index.ts +2 -0
- package/src/components/InputOTP/useInputOTP.test.ts +97 -0
- package/src/components/InputOTP/useInputOTP.ts +69 -0
- package/src/components/Label/Label.native.tsx +25 -0
- package/src/components/Label/Label.stories.tsx +20 -0
- package/src/components/Label/Label.types.ts +6 -0
- package/src/components/Label/Label.web.test.tsx +27 -0
- package/src/components/Label/Label.web.tsx +23 -0
- package/src/components/Label/index.native.ts +2 -0
- package/src/components/Label/index.ts +2 -0
- package/src/components/Menubar/Menubar.native.tsx +287 -0
- package/src/components/Menubar/Menubar.stories.tsx +46 -0
- package/src/components/Menubar/Menubar.types.ts +70 -0
- package/src/components/Menubar/Menubar.web.tsx +256 -0
- package/src/components/Menubar/index.native.ts +28 -0
- package/src/components/Menubar/index.ts +2 -0
- package/src/components/Menubar/useMenubar.test.ts +35 -0
- package/src/components/Menubar/useMenubar.ts +19 -0
- package/src/components/NavigationMenu/NavigationMenu.native.tsx +128 -0
- package/src/components/NavigationMenu/NavigationMenu.stories.tsx +35 -0
- package/src/components/NavigationMenu/NavigationMenu.types.ts +35 -0
- package/src/components/NavigationMenu/NavigationMenu.web.test.tsx +56 -0
- package/src/components/NavigationMenu/NavigationMenu.web.tsx +134 -0
- package/src/components/NavigationMenu/index.native.ts +16 -0
- package/src/components/NavigationMenu/index.ts +2 -0
- package/src/components/Pagination/Pagination.native.tsx +192 -0
- package/src/components/Pagination/Pagination.stories.tsx +49 -0
- package/src/components/Pagination/Pagination.types.ts +41 -0
- package/src/components/Pagination/Pagination.web.test.tsx +101 -0
- package/src/components/Pagination/Pagination.web.tsx +185 -0
- package/src/components/Pagination/index.native.ts +19 -0
- package/src/components/Pagination/index.ts +2 -0
- package/src/components/Popover/Popover.native.tsx +97 -0
- package/src/components/Popover/Popover.stories.tsx +25 -0
- package/src/components/Popover/Popover.types.ts +20 -0
- package/src/components/Popover/Popover.web.tsx +30 -0
- package/src/components/Popover/index.native.ts +2 -0
- package/src/components/Popover/index.ts +2 -0
- package/src/components/Popover/usePopover.test.ts +40 -0
- package/src/components/Popover/usePopover.ts +36 -0
- package/src/components/Progress/Progress.native.tsx +65 -0
- package/src/components/Progress/Progress.stories.tsx +36 -0
- package/src/components/Progress/Progress.types.ts +6 -0
- package/src/components/Progress/Progress.web.test.tsx +27 -0
- package/src/components/Progress/Progress.web.tsx +30 -0
- package/src/components/Progress/index.native.ts +2 -0
- package/src/components/Progress/index.ts +2 -0
- package/src/components/Progress/useProgress.test.ts +44 -0
- package/src/components/Progress/useProgress.ts +11 -0
- package/src/components/RadioGroup/RadioGroup.native.tsx +96 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +31 -0
- package/src/components/RadioGroup/RadioGroup.types.ts +16 -0
- package/src/components/RadioGroup/RadioGroup.web.tsx +47 -0
- package/src/components/RadioGroup/index.native.ts +2 -0
- package/src/components/RadioGroup/index.ts +2 -0
- package/src/components/RadioGroup/useRadioGroup.test.ts +50 -0
- package/src/components/RadioGroup/useRadioGroup.ts +40 -0
- package/src/components/ResizablePanel/ResizablePanel.native.tsx +75 -0
- package/src/components/ResizablePanel/ResizablePanel.stories.tsx +84 -0
- package/src/components/ResizablePanel/ResizablePanel.types.ts +20 -0
- package/src/components/ResizablePanel/ResizablePanel.web.test.tsx +52 -0
- package/src/components/ResizablePanel/ResizablePanel.web.tsx +77 -0
- package/src/components/ResizablePanel/index.native.ts +2 -0
- package/src/components/ResizablePanel/index.ts +2 -0
- package/src/components/ScrollArea/ScrollArea.native.tsx +43 -0
- package/src/components/ScrollArea/ScrollArea.stories.tsx +46 -0
- package/src/components/ScrollArea/ScrollArea.types.ts +11 -0
- package/src/components/ScrollArea/ScrollArea.web.test.tsx +19 -0
- package/src/components/ScrollArea/ScrollArea.web.tsx +45 -0
- package/src/components/ScrollArea/index.native.ts +2 -0
- package/src/components/ScrollArea/index.ts +2 -0
- package/src/components/Select/Select.native.tsx +203 -0
- package/src/components/Select/Select.stories.tsx +33 -0
- package/src/components/Select/Select.types.ts +14 -0
- package/src/components/Select/Select.web.tsx +204 -0
- package/src/components/Select/index.native.ts +11 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/Select/useSelect.test.ts +38 -0
- package/src/components/Select/useSelect.ts +33 -0
- package/src/components/Separator/Separator.native.tsx +38 -0
- package/src/components/Separator/Separator.stories.tsx +34 -0
- package/src/components/Separator/Separator.types.ts +7 -0
- package/src/components/Separator/Separator.web.test.tsx +32 -0
- package/src/components/Separator/Separator.web.tsx +38 -0
- package/src/components/Separator/index.native.ts +2 -0
- package/src/components/Separator/index.ts +2 -0
- package/src/components/Sheet/Sheet.native.tsx +246 -0
- package/src/components/Sheet/Sheet.stories.tsx +43 -0
- package/src/components/Sheet/Sheet.types.ts +47 -0
- package/src/components/Sheet/Sheet.web.tsx +144 -0
- package/src/components/Sheet/index.native.ts +2 -0
- package/src/components/Sheet/index.ts +2 -0
- package/src/components/Sheet/useSheet.test.ts +40 -0
- package/src/components/Sheet/useSheet.ts +19 -0
- package/src/components/Sidebar/Sidebar.native.tsx +7 -0
- package/src/components/Sidebar/Sidebar.stories.tsx +100 -0
- package/src/components/Sidebar/Sidebar.types.ts +30 -0
- package/src/components/Sidebar/Sidebar.web.test.tsx +74 -0
- package/src/components/Sidebar/Sidebar.web.tsx +200 -0
- package/src/components/Sidebar/index.native.ts +2 -0
- package/src/components/Sidebar/index.ts +2 -0
- package/src/components/Sidebar/useSidebar.test.ts +51 -0
- package/src/components/Sidebar/useSidebar.ts +26 -0
- package/src/components/Skeleton/Skeleton.native.tsx +45 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +32 -0
- package/src/components/Skeleton/Skeleton.types.ts +6 -0
- package/src/components/Skeleton/Skeleton.web.test.tsx +35 -0
- package/src/components/Skeleton/Skeleton.web.tsx +18 -0
- package/src/components/Skeleton/index.native.ts +2 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/Slider/Slider.native.tsx +98 -0
- package/src/components/Slider/Slider.stories.tsx +23 -0
- package/src/components/Slider/Slider.types.ts +10 -0
- package/src/components/Slider/Slider.web.tsx +25 -0
- package/src/components/Slider/index.native.ts +2 -0
- package/src/components/Slider/index.ts +2 -0
- package/src/components/Slider/useSlider.test.ts +68 -0
- package/src/components/Slider/useSlider.ts +55 -0
- package/src/components/Switch/Switch.native.tsx +36 -0
- package/src/components/Switch/Switch.stories.tsx +28 -0
- package/src/components/Switch/Switch.types.ts +7 -0
- package/src/components/Switch/Switch.web.test.tsx +44 -0
- package/src/components/Switch/Switch.web.tsx +26 -0
- package/src/components/Switch/index.native.ts +2 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Table/Table.native.tsx +165 -0
- package/src/components/Table/Table.stories.tsx +54 -0
- package/src/components/Table/Table.types.ts +41 -0
- package/src/components/Table/Table.web.test.tsx +77 -0
- package/src/components/Table/Table.web.tsx +119 -0
- package/src/components/Table/index.native.ts +2 -0
- package/src/components/Table/index.ts +2 -0
- package/src/components/Tabs/Tabs.native.tsx +136 -0
- package/src/components/Tabs/Tabs.stories.tsx +35 -0
- package/src/components/Tabs/Tabs.types.ts +25 -0
- package/src/components/Tabs/Tabs.web.tsx +52 -0
- package/src/components/Tabs/index.native.ts +2 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/Tabs/useTabs.test.ts +40 -0
- package/src/components/Tabs/useTabs.ts +20 -0
- package/src/components/Textarea/Textarea.native.tsx +33 -0
- package/src/components/Textarea/Textarea.stories.tsx +27 -0
- package/src/components/Textarea/Textarea.types.ts +10 -0
- package/src/components/Textarea/Textarea.web.test.tsx +33 -0
- package/src/components/Textarea/Textarea.web.tsx +21 -0
- package/src/components/Textarea/index.native.ts +2 -0
- package/src/components/Textarea/index.ts +2 -0
- package/src/components/Toast/Toast.native.tsx +267 -0
- package/src/components/Toast/Toast.stories.tsx +34 -0
- package/src/components/Toast/Toast.types.ts +50 -0
- package/src/components/Toast/Toast.web.tsx +282 -0
- package/src/components/Toast/index.native.ts +17 -0
- package/src/components/Toast/index.ts +11 -0
- package/src/components/Toast/useToast.test.ts +122 -0
- package/src/components/Toast/useToast.ts +64 -0
- package/src/components/Toggle/Toggle.native.tsx +70 -0
- package/src/components/Toggle/Toggle.stories.tsx +34 -0
- package/src/components/Toggle/Toggle.types.ts +13 -0
- package/src/components/Toggle/Toggle.web.tsx +42 -0
- package/src/components/Toggle/index.native.ts +2 -0
- package/src/components/Toggle/index.ts +2 -0
- package/src/components/Toggle/useToggle.test.ts +48 -0
- package/src/components/Toggle/useToggle.ts +37 -0
- package/src/components/ToggleGroup/ToggleGroup.native.tsx +103 -0
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +24 -0
- package/src/components/ToggleGroup/ToggleGroup.types.ts +22 -0
- package/src/components/ToggleGroup/ToggleGroup.web.tsx +56 -0
- package/src/components/ToggleGroup/index.native.ts +2 -0
- package/src/components/ToggleGroup/index.ts +2 -0
- package/src/components/ToggleGroup/useToggleGroup.test.ts +79 -0
- package/src/components/ToggleGroup/useToggleGroup.ts +63 -0
- package/src/components/Tooltip/Tooltip.native.tsx +7 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +32 -0
- package/src/components/Tooltip/Tooltip.types.ts +27 -0
- package/src/components/Tooltip/Tooltip.web.test.tsx +42 -0
- package/src/components/Tooltip/Tooltip.web.tsx +29 -0
- package/src/components/Tooltip/index.native.ts +2 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/index.native.ts +50 -0
- package/src/components/index.ts +49 -0
- package/src/hooks/useControllableState.test.ts +89 -0
- package/src/hooks/useControllableState.ts +37 -0
- package/src/index.native.ts +20 -0
- package/src/index.ts +12 -0
- package/src/theme/native.ts +211 -0
- package/src/theme/presets/aurora.ts +56 -0
- package/src/theme/presets/dark.ts +30 -0
- package/src/theme/presets/default.ts +30 -0
- package/src/theme/theme.types.ts +64 -0
- package/src/theme/tokens.ts +31 -0
- package/src/theme/web.ts +123 -0
- package/src/uniwind.d.ts +38 -0
- package/src/utils/cn.native.ts +10 -0
- package/src/utils/cn.test.ts +28 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/glass.native.ts +22 -0
- package/src/utils/withGlass.native.tsx +59 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
function ChevronDownIcon(props: React.SVGProps<SVGSVGElement>) {
|
|
6
|
+
return (
|
|
7
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" {...props}>
|
|
8
|
+
<path d="m6 9 6 6 6-6"/>
|
|
9
|
+
</svg>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
import { cn } from "../../utils/cn";
|
|
13
|
+
|
|
14
|
+
const NavigationMenu = forwardRef<
|
|
15
|
+
React.ComponentRef<typeof NavigationMenuPrimitive.Root>,
|
|
16
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
|
|
17
|
+
>(({ className, children, ...props }, ref) => (
|
|
18
|
+
<NavigationMenuPrimitive.Root
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(
|
|
21
|
+
"relative z-10 flex max-w-max flex-1 items-center justify-center",
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
<NavigationMenuViewport />
|
|
28
|
+
</NavigationMenuPrimitive.Root>
|
|
29
|
+
));
|
|
30
|
+
NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName;
|
|
31
|
+
|
|
32
|
+
const NavigationMenuList = forwardRef<
|
|
33
|
+
React.ComponentRef<typeof NavigationMenuPrimitive.List>,
|
|
34
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
|
|
35
|
+
>(({ className, ...props }, ref) => (
|
|
36
|
+
<NavigationMenuPrimitive.List
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn(
|
|
39
|
+
"group flex flex-1 list-none items-center justify-center space-x-1",
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
));
|
|
45
|
+
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
|
|
46
|
+
|
|
47
|
+
const NavigationMenuItem = NavigationMenuPrimitive.Item;
|
|
48
|
+
|
|
49
|
+
const navigationMenuTriggerStyle = cva(
|
|
50
|
+
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50",
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const NavigationMenuTrigger = forwardRef<
|
|
54
|
+
React.ComponentRef<typeof NavigationMenuPrimitive.Trigger>,
|
|
55
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
|
|
56
|
+
>(({ className, children, ...props }, ref) => (
|
|
57
|
+
<NavigationMenuPrimitive.Trigger
|
|
58
|
+
ref={ref}
|
|
59
|
+
className={cn(navigationMenuTriggerStyle(), "group", className)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
{children}{" "}
|
|
63
|
+
<ChevronDownIcon
|
|
64
|
+
className="relative top-[1px] ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180"
|
|
65
|
+
aria-hidden="true"
|
|
66
|
+
/>
|
|
67
|
+
</NavigationMenuPrimitive.Trigger>
|
|
68
|
+
));
|
|
69
|
+
NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName;
|
|
70
|
+
|
|
71
|
+
const NavigationMenuContent = forwardRef<
|
|
72
|
+
React.ComponentRef<typeof NavigationMenuPrimitive.Content>,
|
|
73
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
|
|
74
|
+
>(({ className, ...props }, ref) => (
|
|
75
|
+
<NavigationMenuPrimitive.Content
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={cn(
|
|
78
|
+
"left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto",
|
|
79
|
+
className,
|
|
80
|
+
)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
));
|
|
84
|
+
NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName;
|
|
85
|
+
|
|
86
|
+
const NavigationMenuLink = NavigationMenuPrimitive.Link;
|
|
87
|
+
|
|
88
|
+
const NavigationMenuViewport = forwardRef<
|
|
89
|
+
React.ComponentRef<typeof NavigationMenuPrimitive.Viewport>,
|
|
90
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
|
|
91
|
+
>(({ className, ...props }, ref) => (
|
|
92
|
+
<div className={cn("absolute left-0 top-full flex justify-center")}>
|
|
93
|
+
<NavigationMenuPrimitive.Viewport
|
|
94
|
+
className={cn(
|
|
95
|
+
"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
|
|
96
|
+
className,
|
|
97
|
+
)}
|
|
98
|
+
ref={ref}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
));
|
|
103
|
+
NavigationMenuViewport.displayName =
|
|
104
|
+
NavigationMenuPrimitive.Viewport.displayName;
|
|
105
|
+
|
|
106
|
+
const NavigationMenuIndicator = forwardRef<
|
|
107
|
+
React.ComponentRef<typeof NavigationMenuPrimitive.Indicator>,
|
|
108
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
|
|
109
|
+
>(({ className, ...props }, ref) => (
|
|
110
|
+
<NavigationMenuPrimitive.Indicator
|
|
111
|
+
ref={ref}
|
|
112
|
+
className={cn(
|
|
113
|
+
"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
|
|
114
|
+
className,
|
|
115
|
+
)}
|
|
116
|
+
{...props}
|
|
117
|
+
>
|
|
118
|
+
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
|
|
119
|
+
</NavigationMenuPrimitive.Indicator>
|
|
120
|
+
));
|
|
121
|
+
NavigationMenuIndicator.displayName =
|
|
122
|
+
NavigationMenuPrimitive.Indicator.displayName;
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
navigationMenuTriggerStyle,
|
|
126
|
+
NavigationMenu,
|
|
127
|
+
NavigationMenuList,
|
|
128
|
+
NavigationMenuItem,
|
|
129
|
+
NavigationMenuContent,
|
|
130
|
+
NavigationMenuTrigger,
|
|
131
|
+
NavigationMenuLink,
|
|
132
|
+
NavigationMenuIndicator,
|
|
133
|
+
NavigationMenuViewport,
|
|
134
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {
|
|
2
|
+
NavigationMenu,
|
|
3
|
+
NavigationMenuList,
|
|
4
|
+
NavigationMenuItem,
|
|
5
|
+
NavigationMenuTrigger,
|
|
6
|
+
NavigationMenuContent,
|
|
7
|
+
NavigationMenuLink,
|
|
8
|
+
} from "./NavigationMenu.native";
|
|
9
|
+
export type {
|
|
10
|
+
NavigationMenuProps,
|
|
11
|
+
NavigationMenuListProps,
|
|
12
|
+
NavigationMenuItemProps,
|
|
13
|
+
NavigationMenuTriggerProps,
|
|
14
|
+
NavigationMenuContentProps,
|
|
15
|
+
NavigationMenuLinkProps,
|
|
16
|
+
} from "./NavigationMenu.types";
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { View, Text, Pressable, type ViewProps, type PressableProps } from "react-native";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
|
+
import type {
|
|
5
|
+
PaginationProps,
|
|
6
|
+
PaginationContentProps,
|
|
7
|
+
PaginationItemProps,
|
|
8
|
+
PaginationLinkProps,
|
|
9
|
+
PaginationPreviousProps,
|
|
10
|
+
PaginationNextProps,
|
|
11
|
+
PaginationEllipsisProps,
|
|
12
|
+
} from "./Pagination.types";
|
|
13
|
+
|
|
14
|
+
interface PaginationNativeProps extends PaginationProps, ViewProps {}
|
|
15
|
+
|
|
16
|
+
function Pagination({ children, className, ...props }: PaginationNativeProps) {
|
|
17
|
+
return (
|
|
18
|
+
<View
|
|
19
|
+
className={cn("flex-row justify-center w-full", className)}
|
|
20
|
+
accessibilityRole="menu"
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</View>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
Pagination.displayName = "Pagination";
|
|
28
|
+
|
|
29
|
+
interface PaginationContentNativeProps extends PaginationContentProps, ViewProps {}
|
|
30
|
+
|
|
31
|
+
function PaginationContent({ children, className, ...props }: PaginationContentNativeProps) {
|
|
32
|
+
return (
|
|
33
|
+
<View
|
|
34
|
+
className={cn("flex-row items-center gap-1", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
PaginationContent.displayName = "PaginationContent";
|
|
42
|
+
|
|
43
|
+
interface PaginationItemNativeProps extends PaginationItemProps, ViewProps {}
|
|
44
|
+
|
|
45
|
+
function PaginationItem({ children, className, ...props }: PaginationItemNativeProps) {
|
|
46
|
+
return (
|
|
47
|
+
<View className={className} {...props}>
|
|
48
|
+
{children}
|
|
49
|
+
</View>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
PaginationItem.displayName = "PaginationItem";
|
|
53
|
+
|
|
54
|
+
const paginationLinkVariants = cva(
|
|
55
|
+
"flex-row items-center justify-center rounded-md gap-1 h-9",
|
|
56
|
+
{
|
|
57
|
+
variants: {
|
|
58
|
+
size: {
|
|
59
|
+
default: "px-4 py-2",
|
|
60
|
+
icon: "w-9",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: {
|
|
64
|
+
size: "icon",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
interface PaginationLinkNativeProps extends PaginationLinkProps, Omit<PressableProps, "children" | "onPress"> {}
|
|
70
|
+
|
|
71
|
+
function PaginationLink({
|
|
72
|
+
children,
|
|
73
|
+
isActive = false,
|
|
74
|
+
size = "icon",
|
|
75
|
+
onPress,
|
|
76
|
+
className,
|
|
77
|
+
...props
|
|
78
|
+
}: PaginationLinkNativeProps) {
|
|
79
|
+
return (
|
|
80
|
+
<Pressable
|
|
81
|
+
onPress={onPress}
|
|
82
|
+
className={cn(
|
|
83
|
+
paginationLinkVariants({ size }),
|
|
84
|
+
isActive && "border border-border bg-background shadow-sm elevation-1",
|
|
85
|
+
className,
|
|
86
|
+
)}
|
|
87
|
+
accessibilityRole="button"
|
|
88
|
+
accessibilityState={{ selected: isActive }}
|
|
89
|
+
{...props}
|
|
90
|
+
>
|
|
91
|
+
{typeof children === "string" ? (
|
|
92
|
+
<Text className="text-sm font-medium text-foreground">
|
|
93
|
+
{children}
|
|
94
|
+
</Text>
|
|
95
|
+
) : (
|
|
96
|
+
children
|
|
97
|
+
)}
|
|
98
|
+
</Pressable>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
PaginationLink.displayName = "PaginationLink";
|
|
102
|
+
|
|
103
|
+
interface PaginationPreviousNativeProps extends PaginationPreviousProps, Omit<PressableProps, "children" | "onPress"> {}
|
|
104
|
+
|
|
105
|
+
function PaginationPrevious({
|
|
106
|
+
children,
|
|
107
|
+
onPress,
|
|
108
|
+
className,
|
|
109
|
+
...props
|
|
110
|
+
}: PaginationPreviousNativeProps) {
|
|
111
|
+
return (
|
|
112
|
+
<Pressable
|
|
113
|
+
onPress={onPress}
|
|
114
|
+
className={cn(
|
|
115
|
+
"flex-row items-center justify-center rounded-md gap-1 h-9 px-4 py-2",
|
|
116
|
+
className,
|
|
117
|
+
)}
|
|
118
|
+
accessibilityRole="button"
|
|
119
|
+
accessibilityLabel="Go to previous page"
|
|
120
|
+
{...props}
|
|
121
|
+
>
|
|
122
|
+
<Text className="text-sm font-medium text-foreground">{"\u2039"}</Text>
|
|
123
|
+
<Text className="text-sm font-medium text-foreground">
|
|
124
|
+
{children ?? "Previous"}
|
|
125
|
+
</Text>
|
|
126
|
+
</Pressable>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
PaginationPrevious.displayName = "PaginationPrevious";
|
|
130
|
+
|
|
131
|
+
interface PaginationNextNativeProps extends PaginationNextProps, Omit<PressableProps, "children" | "onPress"> {}
|
|
132
|
+
|
|
133
|
+
function PaginationNext({
|
|
134
|
+
children,
|
|
135
|
+
onPress,
|
|
136
|
+
className,
|
|
137
|
+
...props
|
|
138
|
+
}: PaginationNextNativeProps) {
|
|
139
|
+
return (
|
|
140
|
+
<Pressable
|
|
141
|
+
onPress={onPress}
|
|
142
|
+
className={cn(
|
|
143
|
+
"flex-row items-center justify-center rounded-md gap-1 h-9 px-4 py-2",
|
|
144
|
+
className,
|
|
145
|
+
)}
|
|
146
|
+
accessibilityRole="button"
|
|
147
|
+
accessibilityLabel="Go to next page"
|
|
148
|
+
{...props}
|
|
149
|
+
>
|
|
150
|
+
<Text className="text-sm font-medium text-foreground">
|
|
151
|
+
{children ?? "Next"}
|
|
152
|
+
</Text>
|
|
153
|
+
<Text className="text-sm font-medium text-foreground">{"\u203A"}</Text>
|
|
154
|
+
</Pressable>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
PaginationNext.displayName = "PaginationNext";
|
|
158
|
+
|
|
159
|
+
interface PaginationEllipsisNativeProps extends PaginationEllipsisProps, ViewProps {}
|
|
160
|
+
|
|
161
|
+
function PaginationEllipsis({ className, ...props }: PaginationEllipsisNativeProps) {
|
|
162
|
+
return (
|
|
163
|
+
<View
|
|
164
|
+
className={cn("h-9 w-9 items-center justify-center", className)}
|
|
165
|
+
accessibilityElementsHidden
|
|
166
|
+
{...props}
|
|
167
|
+
>
|
|
168
|
+
<Text className="text-base text-foreground">{"\u2026"}</Text>
|
|
169
|
+
</View>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
PaginationEllipsis.displayName = "PaginationEllipsis";
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
Pagination,
|
|
176
|
+
PaginationContent,
|
|
177
|
+
PaginationItem,
|
|
178
|
+
PaginationLink,
|
|
179
|
+
PaginationPrevious,
|
|
180
|
+
PaginationNext,
|
|
181
|
+
PaginationEllipsis,
|
|
182
|
+
paginationLinkVariants,
|
|
183
|
+
};
|
|
184
|
+
export type {
|
|
185
|
+
PaginationNativeProps,
|
|
186
|
+
PaginationContentNativeProps,
|
|
187
|
+
PaginationItemNativeProps,
|
|
188
|
+
PaginationLinkNativeProps,
|
|
189
|
+
PaginationPreviousNativeProps,
|
|
190
|
+
PaginationNextNativeProps,
|
|
191
|
+
PaginationEllipsisNativeProps,
|
|
192
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import {
|
|
3
|
+
Pagination,
|
|
4
|
+
PaginationContent,
|
|
5
|
+
PaginationItem,
|
|
6
|
+
PaginationLink,
|
|
7
|
+
PaginationPrevious,
|
|
8
|
+
PaginationNext,
|
|
9
|
+
PaginationEllipsis,
|
|
10
|
+
} from "./Pagination.web";
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof Pagination> = {
|
|
13
|
+
title: "Components/Pagination",
|
|
14
|
+
component: Pagination,
|
|
15
|
+
tags: ["autodocs"],
|
|
16
|
+
parameters: { layout: "centered" },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof Pagination>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
render: () => (
|
|
24
|
+
<Pagination>
|
|
25
|
+
<PaginationContent>
|
|
26
|
+
<PaginationItem>
|
|
27
|
+
<PaginationPrevious href="#" />
|
|
28
|
+
</PaginationItem>
|
|
29
|
+
<PaginationItem>
|
|
30
|
+
<PaginationLink href="#">1</PaginationLink>
|
|
31
|
+
</PaginationItem>
|
|
32
|
+
<PaginationItem>
|
|
33
|
+
<PaginationLink href="#" isActive>
|
|
34
|
+
2
|
|
35
|
+
</PaginationLink>
|
|
36
|
+
</PaginationItem>
|
|
37
|
+
<PaginationItem>
|
|
38
|
+
<PaginationLink href="#">3</PaginationLink>
|
|
39
|
+
</PaginationItem>
|
|
40
|
+
<PaginationItem>
|
|
41
|
+
<PaginationEllipsis />
|
|
42
|
+
</PaginationItem>
|
|
43
|
+
<PaginationItem>
|
|
44
|
+
<PaginationNext href="#" />
|
|
45
|
+
</PaginationItem>
|
|
46
|
+
</PaginationContent>
|
|
47
|
+
</Pagination>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface PaginationProps {
|
|
2
|
+
children?: React.ReactNode;
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface PaginationContentProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PaginationItemProps {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface PaginationLinkProps {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
isActive?: boolean;
|
|
20
|
+
size?: "default" | "icon";
|
|
21
|
+
href?: string;
|
|
22
|
+
onPress?: () => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface PaginationPreviousProps {
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
href?: string;
|
|
29
|
+
onPress?: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface PaginationNextProps {
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
className?: string;
|
|
35
|
+
href?: string;
|
|
36
|
+
onPress?: () => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface PaginationEllipsisProps {
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import {
|
|
4
|
+
Pagination,
|
|
5
|
+
PaginationContent,
|
|
6
|
+
PaginationItem,
|
|
7
|
+
PaginationLink,
|
|
8
|
+
PaginationPrevious,
|
|
9
|
+
PaginationNext,
|
|
10
|
+
PaginationEllipsis,
|
|
11
|
+
paginationLinkVariants,
|
|
12
|
+
} from "./Pagination.web";
|
|
13
|
+
|
|
14
|
+
describe("Pagination", () => {
|
|
15
|
+
it("renders a nav with aria-label", () => {
|
|
16
|
+
render(
|
|
17
|
+
<Pagination>
|
|
18
|
+
<PaginationContent>
|
|
19
|
+
<PaginationItem>
|
|
20
|
+
<PaginationLink href="#">1</PaginationLink>
|
|
21
|
+
</PaginationItem>
|
|
22
|
+
</PaginationContent>
|
|
23
|
+
</Pagination>,
|
|
24
|
+
);
|
|
25
|
+
expect(screen.getByRole("navigation", { name: "pagination" })).toBeDefined();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("renders page links", () => {
|
|
29
|
+
render(
|
|
30
|
+
<Pagination>
|
|
31
|
+
<PaginationContent>
|
|
32
|
+
<PaginationItem>
|
|
33
|
+
<PaginationLink href="#">1</PaginationLink>
|
|
34
|
+
</PaginationItem>
|
|
35
|
+
<PaginationItem>
|
|
36
|
+
<PaginationLink href="#">2</PaginationLink>
|
|
37
|
+
</PaginationItem>
|
|
38
|
+
</PaginationContent>
|
|
39
|
+
</Pagination>,
|
|
40
|
+
);
|
|
41
|
+
expect(screen.getByText("1")).toBeDefined();
|
|
42
|
+
expect(screen.getByText("2")).toBeDefined();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("marks active page with aria-current", () => {
|
|
46
|
+
render(
|
|
47
|
+
<Pagination>
|
|
48
|
+
<PaginationContent>
|
|
49
|
+
<PaginationItem>
|
|
50
|
+
<PaginationLink href="#" isActive>1</PaginationLink>
|
|
51
|
+
</PaginationItem>
|
|
52
|
+
</PaginationContent>
|
|
53
|
+
</Pagination>,
|
|
54
|
+
);
|
|
55
|
+
expect(screen.getByText("1").getAttribute("aria-current")).toBe("page");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("renders Previous button with aria-label", () => {
|
|
59
|
+
render(
|
|
60
|
+
<Pagination>
|
|
61
|
+
<PaginationContent>
|
|
62
|
+
<PaginationItem>
|
|
63
|
+
<PaginationPrevious href="#" />
|
|
64
|
+
</PaginationItem>
|
|
65
|
+
</PaginationContent>
|
|
66
|
+
</Pagination>,
|
|
67
|
+
);
|
|
68
|
+
expect(screen.getByText("Previous")).toBeDefined();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("renders Next button with aria-label", () => {
|
|
72
|
+
render(
|
|
73
|
+
<Pagination>
|
|
74
|
+
<PaginationContent>
|
|
75
|
+
<PaginationItem>
|
|
76
|
+
<PaginationNext href="#" />
|
|
77
|
+
</PaginationItem>
|
|
78
|
+
</PaginationContent>
|
|
79
|
+
</Pagination>,
|
|
80
|
+
);
|
|
81
|
+
expect(screen.getByText("Next")).toBeDefined();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("renders ellipsis with sr-only text", () => {
|
|
85
|
+
render(
|
|
86
|
+
<Pagination>
|
|
87
|
+
<PaginationContent>
|
|
88
|
+
<PaginationItem>
|
|
89
|
+
<PaginationEllipsis />
|
|
90
|
+
</PaginationItem>
|
|
91
|
+
</PaginationContent>
|
|
92
|
+
</Pagination>,
|
|
93
|
+
);
|
|
94
|
+
expect(screen.getByText("More pages")).toBeDefined();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it("paginationLinkVariants generates correct classes", () => {
|
|
98
|
+
expect(paginationLinkVariants({ size: "default" })).toContain("px-4");
|
|
99
|
+
expect(paginationLinkVariants({ size: "icon" })).toContain("w-9");
|
|
100
|
+
});
|
|
101
|
+
});
|