@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,256 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
|
+
|
|
5
|
+
function CheckIcon(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="M20 6 9 17l-5-5"/>
|
|
9
|
+
</svg>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function ChevronRightIcon(props: React.SVGProps<SVGSVGElement>) {
|
|
14
|
+
return (
|
|
15
|
+
<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}>
|
|
16
|
+
<path d="m9 18 6-6-6-6"/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function CircleIcon(props: React.SVGProps<SVGSVGElement>) {
|
|
22
|
+
return (
|
|
23
|
+
<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}>
|
|
24
|
+
<circle cx="12" cy="12" r="10"/>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const MenubarMenu: typeof MenubarPrimitive.Menu = MenubarPrimitive.Menu;
|
|
30
|
+
|
|
31
|
+
const MenubarGroup = MenubarPrimitive.Group;
|
|
32
|
+
|
|
33
|
+
const MenubarPortal = MenubarPrimitive.Portal;
|
|
34
|
+
|
|
35
|
+
const MenubarSub = MenubarPrimitive.Sub;
|
|
36
|
+
|
|
37
|
+
const MenubarRadioGroup = MenubarPrimitive.RadioGroup;
|
|
38
|
+
|
|
39
|
+
const Menubar = forwardRef<
|
|
40
|
+
React.ComponentRef<typeof MenubarPrimitive.Root>,
|
|
41
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
|
|
42
|
+
>(({ className, ...props }, ref) => (
|
|
43
|
+
<MenubarPrimitive.Root
|
|
44
|
+
ref={ref}
|
|
45
|
+
className={cn(
|
|
46
|
+
"flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
));
|
|
52
|
+
Menubar.displayName = MenubarPrimitive.Root.displayName;
|
|
53
|
+
|
|
54
|
+
const MenubarTrigger = forwardRef<
|
|
55
|
+
React.ComponentRef<typeof MenubarPrimitive.Trigger>,
|
|
56
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
|
|
57
|
+
>(({ className, ...props }, ref) => (
|
|
58
|
+
<MenubarPrimitive.Trigger
|
|
59
|
+
ref={ref}
|
|
60
|
+
className={cn(
|
|
61
|
+
"flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
));
|
|
67
|
+
MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName;
|
|
68
|
+
|
|
69
|
+
const MenubarSubTrigger = forwardRef<
|
|
70
|
+
React.ComponentRef<typeof MenubarPrimitive.SubTrigger>,
|
|
71
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
|
|
72
|
+
inset?: boolean;
|
|
73
|
+
}
|
|
74
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
75
|
+
<MenubarPrimitive.SubTrigger
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={cn(
|
|
78
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
79
|
+
inset && "pl-8",
|
|
80
|
+
className,
|
|
81
|
+
)}
|
|
82
|
+
{...props}
|
|
83
|
+
>
|
|
84
|
+
{children}
|
|
85
|
+
<ChevronRightIcon className="ml-auto h-4 w-4" />
|
|
86
|
+
</MenubarPrimitive.SubTrigger>
|
|
87
|
+
));
|
|
88
|
+
MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName;
|
|
89
|
+
|
|
90
|
+
const MenubarSubContent = forwardRef<
|
|
91
|
+
React.ComponentRef<typeof MenubarPrimitive.SubContent>,
|
|
92
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
|
|
93
|
+
>(({ className, ...props }, ref) => (
|
|
94
|
+
<MenubarPrimitive.SubContent
|
|
95
|
+
ref={ref}
|
|
96
|
+
className={cn(
|
|
97
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
98
|
+
className,
|
|
99
|
+
)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
));
|
|
103
|
+
MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName;
|
|
104
|
+
|
|
105
|
+
const MenubarContent = forwardRef<
|
|
106
|
+
React.ComponentRef<typeof MenubarPrimitive.Content>,
|
|
107
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
|
|
108
|
+
>(
|
|
109
|
+
(
|
|
110
|
+
{ className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
|
|
111
|
+
ref,
|
|
112
|
+
) => (
|
|
113
|
+
<MenubarPrimitive.Portal>
|
|
114
|
+
<MenubarPrimitive.Content
|
|
115
|
+
ref={ref}
|
|
116
|
+
align={align}
|
|
117
|
+
alignOffset={alignOffset}
|
|
118
|
+
sideOffset={sideOffset}
|
|
119
|
+
className={cn(
|
|
120
|
+
"z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
121
|
+
className,
|
|
122
|
+
)}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
</MenubarPrimitive.Portal>
|
|
126
|
+
),
|
|
127
|
+
);
|
|
128
|
+
MenubarContent.displayName = MenubarPrimitive.Content.displayName;
|
|
129
|
+
|
|
130
|
+
const MenubarItem = forwardRef<
|
|
131
|
+
React.ComponentRef<typeof MenubarPrimitive.Item>,
|
|
132
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
|
|
133
|
+
inset?: boolean;
|
|
134
|
+
}
|
|
135
|
+
>(({ className, inset, ...props }, ref) => (
|
|
136
|
+
<MenubarPrimitive.Item
|
|
137
|
+
ref={ref}
|
|
138
|
+
className={cn(
|
|
139
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
140
|
+
inset && "pl-8",
|
|
141
|
+
className,
|
|
142
|
+
)}
|
|
143
|
+
{...props}
|
|
144
|
+
/>
|
|
145
|
+
));
|
|
146
|
+
MenubarItem.displayName = MenubarPrimitive.Item.displayName;
|
|
147
|
+
|
|
148
|
+
const MenubarCheckboxItem = forwardRef<
|
|
149
|
+
React.ComponentRef<typeof MenubarPrimitive.CheckboxItem>,
|
|
150
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
|
|
151
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
152
|
+
<MenubarPrimitive.CheckboxItem
|
|
153
|
+
ref={ref}
|
|
154
|
+
className={cn(
|
|
155
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
156
|
+
className,
|
|
157
|
+
)}
|
|
158
|
+
checked={checked}
|
|
159
|
+
{...props}
|
|
160
|
+
>
|
|
161
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
162
|
+
<MenubarPrimitive.ItemIndicator>
|
|
163
|
+
<CheckIcon className="h-4 w-4" />
|
|
164
|
+
</MenubarPrimitive.ItemIndicator>
|
|
165
|
+
</span>
|
|
166
|
+
{children}
|
|
167
|
+
</MenubarPrimitive.CheckboxItem>
|
|
168
|
+
));
|
|
169
|
+
MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName;
|
|
170
|
+
|
|
171
|
+
const MenubarRadioItem = forwardRef<
|
|
172
|
+
React.ComponentRef<typeof MenubarPrimitive.RadioItem>,
|
|
173
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
|
|
174
|
+
>(({ className, children, ...props }, ref) => (
|
|
175
|
+
<MenubarPrimitive.RadioItem
|
|
176
|
+
ref={ref}
|
|
177
|
+
className={cn(
|
|
178
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
179
|
+
className,
|
|
180
|
+
)}
|
|
181
|
+
{...props}
|
|
182
|
+
>
|
|
183
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
184
|
+
<MenubarPrimitive.ItemIndicator>
|
|
185
|
+
<CircleIcon className="h-2 w-2 fill-current" />
|
|
186
|
+
</MenubarPrimitive.ItemIndicator>
|
|
187
|
+
</span>
|
|
188
|
+
{children}
|
|
189
|
+
</MenubarPrimitive.RadioItem>
|
|
190
|
+
));
|
|
191
|
+
MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName;
|
|
192
|
+
|
|
193
|
+
const MenubarLabel = forwardRef<
|
|
194
|
+
React.ComponentRef<typeof MenubarPrimitive.Label>,
|
|
195
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
|
|
196
|
+
inset?: boolean;
|
|
197
|
+
}
|
|
198
|
+
>(({ className, inset, ...props }, ref) => (
|
|
199
|
+
<MenubarPrimitive.Label
|
|
200
|
+
ref={ref}
|
|
201
|
+
className={cn(
|
|
202
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
203
|
+
inset && "pl-8",
|
|
204
|
+
className,
|
|
205
|
+
)}
|
|
206
|
+
{...props}
|
|
207
|
+
/>
|
|
208
|
+
));
|
|
209
|
+
MenubarLabel.displayName = MenubarPrimitive.Label.displayName;
|
|
210
|
+
|
|
211
|
+
const MenubarSeparator = forwardRef<
|
|
212
|
+
React.ComponentRef<typeof MenubarPrimitive.Separator>,
|
|
213
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
|
|
214
|
+
>(({ className, ...props }, ref) => (
|
|
215
|
+
<MenubarPrimitive.Separator
|
|
216
|
+
ref={ref}
|
|
217
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
218
|
+
{...props}
|
|
219
|
+
/>
|
|
220
|
+
));
|
|
221
|
+
MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName;
|
|
222
|
+
|
|
223
|
+
const MenubarShortcut = ({
|
|
224
|
+
className,
|
|
225
|
+
...props
|
|
226
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
227
|
+
return (
|
|
228
|
+
<span
|
|
229
|
+
className={cn(
|
|
230
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
231
|
+
className,
|
|
232
|
+
)}
|
|
233
|
+
{...props}
|
|
234
|
+
/>
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
MenubarShortcut.displayName = "MenubarShortcut";
|
|
238
|
+
|
|
239
|
+
export {
|
|
240
|
+
Menubar,
|
|
241
|
+
MenubarMenu,
|
|
242
|
+
MenubarTrigger,
|
|
243
|
+
MenubarContent,
|
|
244
|
+
MenubarItem,
|
|
245
|
+
MenubarSeparator,
|
|
246
|
+
MenubarLabel,
|
|
247
|
+
MenubarCheckboxItem,
|
|
248
|
+
MenubarRadioGroup,
|
|
249
|
+
MenubarRadioItem,
|
|
250
|
+
MenubarPortal,
|
|
251
|
+
MenubarSub,
|
|
252
|
+
MenubarSubContent,
|
|
253
|
+
MenubarSubTrigger,
|
|
254
|
+
MenubarGroup,
|
|
255
|
+
MenubarShortcut,
|
|
256
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export {
|
|
2
|
+
Menubar,
|
|
3
|
+
MenubarMenu,
|
|
4
|
+
MenubarTrigger,
|
|
5
|
+
MenubarContent,
|
|
6
|
+
MenubarItem,
|
|
7
|
+
MenubarSeparator,
|
|
8
|
+
MenubarSub,
|
|
9
|
+
MenubarSubTrigger,
|
|
10
|
+
MenubarSubContent,
|
|
11
|
+
MenubarCheckboxItem,
|
|
12
|
+
MenubarRadioGroup,
|
|
13
|
+
MenubarRadioItem,
|
|
14
|
+
} from "./Menubar.native";
|
|
15
|
+
export type {
|
|
16
|
+
MenubarProps,
|
|
17
|
+
MenubarMenuProps,
|
|
18
|
+
MenubarTriggerProps,
|
|
19
|
+
MenubarContentProps,
|
|
20
|
+
MenubarItemProps,
|
|
21
|
+
MenubarSeparatorProps,
|
|
22
|
+
MenubarSubProps,
|
|
23
|
+
MenubarSubTriggerProps,
|
|
24
|
+
MenubarSubContentProps,
|
|
25
|
+
MenubarCheckboxItemProps,
|
|
26
|
+
MenubarRadioGroupProps,
|
|
27
|
+
MenubarRadioItemProps,
|
|
28
|
+
} from "./Menubar.types";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from "vitest";
|
|
2
|
+
import { renderHook, act } from "@testing-library/react";
|
|
3
|
+
import { useMenubarMenu } from "./useMenubar";
|
|
4
|
+
|
|
5
|
+
describe("useMenubarMenu", () => {
|
|
6
|
+
it("defaults to closed", () => {
|
|
7
|
+
const { result } = renderHook(() => useMenubarMenu());
|
|
8
|
+
expect(result.current.open).toBe(false);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("opens via onOpenChange", () => {
|
|
12
|
+
const { result } = renderHook(() => useMenubarMenu());
|
|
13
|
+
act(() => result.current.onOpenChange(true));
|
|
14
|
+
expect(result.current.open).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("calls external onOpenChange", () => {
|
|
18
|
+
const onChange = vi.fn();
|
|
19
|
+
const { result } = renderHook(() =>
|
|
20
|
+
useMenubarMenu({ onOpenChange: onChange }),
|
|
21
|
+
);
|
|
22
|
+
act(() => result.current.onOpenChange(true));
|
|
23
|
+
expect(onChange).toHaveBeenCalledWith(true);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("works in controlled mode", () => {
|
|
27
|
+
const onChange = vi.fn();
|
|
28
|
+
const { result } = renderHook(() =>
|
|
29
|
+
useMenubarMenu({ open: false, onOpenChange: onChange }),
|
|
30
|
+
);
|
|
31
|
+
act(() => result.current.onOpenChange(true));
|
|
32
|
+
expect(result.current.open).toBe(false);
|
|
33
|
+
expect(onChange).toHaveBeenCalledWith(true);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useControllableState } from "../../hooks/useControllableState";
|
|
2
|
+
|
|
3
|
+
interface UseMenubarMenuProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function useMenubarMenu({ open: controlledOpen, onOpenChange }: UseMenubarMenuProps = {}) {
|
|
9
|
+
const [open, setOpen] = useControllableState<boolean>({
|
|
10
|
+
value: controlledOpen,
|
|
11
|
+
defaultValue: false,
|
|
12
|
+
onChange: onOpenChange,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
open,
|
|
17
|
+
onOpenChange: setOpen,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
View,
|
|
3
|
+
Text,
|
|
4
|
+
Pressable,
|
|
5
|
+
ScrollView,
|
|
6
|
+
type ViewProps,
|
|
7
|
+
} from "react-native";
|
|
8
|
+
import { cn } from "../../utils/cn";
|
|
9
|
+
import type {
|
|
10
|
+
NavigationMenuProps,
|
|
11
|
+
NavigationMenuListProps,
|
|
12
|
+
NavigationMenuItemProps,
|
|
13
|
+
NavigationMenuTriggerProps,
|
|
14
|
+
NavigationMenuContentProps,
|
|
15
|
+
NavigationMenuLinkProps,
|
|
16
|
+
} from "./NavigationMenu.types";
|
|
17
|
+
|
|
18
|
+
interface NavigationMenuNativeProps extends NavigationMenuProps {}
|
|
19
|
+
|
|
20
|
+
function NavigationMenu({ children, className }: NavigationMenuNativeProps) {
|
|
21
|
+
return (
|
|
22
|
+
<View className={cn("flex-row items-center", className)}>
|
|
23
|
+
{children}
|
|
24
|
+
</View>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
NavigationMenu.displayName = "NavigationMenu";
|
|
28
|
+
|
|
29
|
+
interface NavigationMenuListNativeProps extends NavigationMenuListProps {}
|
|
30
|
+
|
|
31
|
+
function NavigationMenuList({ children }: NavigationMenuListNativeProps) {
|
|
32
|
+
return (
|
|
33
|
+
<ScrollView
|
|
34
|
+
horizontal
|
|
35
|
+
showsHorizontalScrollIndicator={false}
|
|
36
|
+
contentContainerStyle={{ flexDirection: "row", alignItems: "center", gap: 4 }}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</ScrollView>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
NavigationMenuList.displayName = "NavigationMenuList";
|
|
43
|
+
|
|
44
|
+
interface NavigationMenuItemNativeProps extends NavigationMenuItemProps {}
|
|
45
|
+
|
|
46
|
+
function NavigationMenuItem({ children, className }: NavigationMenuItemNativeProps) {
|
|
47
|
+
return <View className={className}>{children}</View>;
|
|
48
|
+
}
|
|
49
|
+
NavigationMenuItem.displayName = "NavigationMenuItem";
|
|
50
|
+
|
|
51
|
+
interface NavigationMenuTriggerNativeProps extends NavigationMenuTriggerProps {
|
|
52
|
+
onPress?: () => void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function NavigationMenuTrigger({
|
|
56
|
+
children,
|
|
57
|
+
onPress,
|
|
58
|
+
className,
|
|
59
|
+
}: NavigationMenuTriggerNativeProps) {
|
|
60
|
+
return (
|
|
61
|
+
<Pressable
|
|
62
|
+
className={cn(
|
|
63
|
+
"px-4 py-2 rounded-md bg-transparent",
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
onPress={onPress}
|
|
67
|
+
>
|
|
68
|
+
{typeof children === "string" ? (
|
|
69
|
+
<Text className="text-sm font-medium text-foreground">
|
|
70
|
+
{children}
|
|
71
|
+
</Text>
|
|
72
|
+
) : (
|
|
73
|
+
children
|
|
74
|
+
)}
|
|
75
|
+
</Pressable>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
NavigationMenuTrigger.displayName = "NavigationMenuTrigger";
|
|
79
|
+
|
|
80
|
+
interface NavigationMenuContentNativeProps extends NavigationMenuContentProps {}
|
|
81
|
+
|
|
82
|
+
function NavigationMenuContent({ children, className }: NavigationMenuContentNativeProps) {
|
|
83
|
+
return <View className={cn("p-4", className)}>{children}</View>;
|
|
84
|
+
}
|
|
85
|
+
NavigationMenuContent.displayName = "NavigationMenuContent";
|
|
86
|
+
|
|
87
|
+
interface NavigationMenuLinkNativeProps extends NavigationMenuLinkProps {}
|
|
88
|
+
|
|
89
|
+
function NavigationMenuLink({
|
|
90
|
+
children,
|
|
91
|
+
onPress,
|
|
92
|
+
active,
|
|
93
|
+
className,
|
|
94
|
+
}: NavigationMenuLinkNativeProps) {
|
|
95
|
+
return (
|
|
96
|
+
<Pressable
|
|
97
|
+
className={cn(
|
|
98
|
+
"px-4 py-2 rounded-md",
|
|
99
|
+
active && "bg-accent",
|
|
100
|
+
className,
|
|
101
|
+
)}
|
|
102
|
+
onPress={onPress}
|
|
103
|
+
>
|
|
104
|
+
{typeof children === "string" ? (
|
|
105
|
+
<Text
|
|
106
|
+
className={cn(
|
|
107
|
+
"text-sm font-medium text-foreground",
|
|
108
|
+
active && "font-semibold",
|
|
109
|
+
)}
|
|
110
|
+
>
|
|
111
|
+
{children}
|
|
112
|
+
</Text>
|
|
113
|
+
) : (
|
|
114
|
+
children
|
|
115
|
+
)}
|
|
116
|
+
</Pressable>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
NavigationMenuLink.displayName = "NavigationMenuLink";
|
|
120
|
+
|
|
121
|
+
export {
|
|
122
|
+
NavigationMenu,
|
|
123
|
+
NavigationMenuList,
|
|
124
|
+
NavigationMenuItem,
|
|
125
|
+
NavigationMenuTrigger,
|
|
126
|
+
NavigationMenuContent,
|
|
127
|
+
NavigationMenuLink,
|
|
128
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import {
|
|
3
|
+
NavigationMenu,
|
|
4
|
+
NavigationMenuList,
|
|
5
|
+
NavigationMenuItem,
|
|
6
|
+
NavigationMenuLink,
|
|
7
|
+
} from "./NavigationMenu.web";
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof NavigationMenu> = {
|
|
10
|
+
title: "Components/NavigationMenu",
|
|
11
|
+
component: NavigationMenu,
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
parameters: { layout: "centered" },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof NavigationMenu>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
render: () => (
|
|
21
|
+
<NavigationMenu>
|
|
22
|
+
<NavigationMenuList>
|
|
23
|
+
<NavigationMenuItem>
|
|
24
|
+
<NavigationMenuLink href="#">Home</NavigationMenuLink>
|
|
25
|
+
</NavigationMenuItem>
|
|
26
|
+
<NavigationMenuItem>
|
|
27
|
+
<NavigationMenuLink href="#">About</NavigationMenuLink>
|
|
28
|
+
</NavigationMenuItem>
|
|
29
|
+
<NavigationMenuItem>
|
|
30
|
+
<NavigationMenuLink href="#">Contact</NavigationMenuLink>
|
|
31
|
+
</NavigationMenuItem>
|
|
32
|
+
</NavigationMenuList>
|
|
33
|
+
</NavigationMenu>
|
|
34
|
+
),
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export interface NavigationMenuProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface NavigationMenuListProps {
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface NavigationMenuItemProps {
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
value?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface NavigationMenuTriggerProps {
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface NavigationMenuContentProps {
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface NavigationMenuLinkProps {
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
className?: string;
|
|
32
|
+
href?: string;
|
|
33
|
+
active?: boolean;
|
|
34
|
+
onPress?: () => void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import {
|
|
4
|
+
NavigationMenu,
|
|
5
|
+
NavigationMenuList,
|
|
6
|
+
NavigationMenuItem,
|
|
7
|
+
NavigationMenuLink,
|
|
8
|
+
navigationMenuTriggerStyle,
|
|
9
|
+
} from "./NavigationMenu.web";
|
|
10
|
+
|
|
11
|
+
describe("NavigationMenu", () => {
|
|
12
|
+
it("renders a nav element", () => {
|
|
13
|
+
render(
|
|
14
|
+
<NavigationMenu>
|
|
15
|
+
<NavigationMenuList>
|
|
16
|
+
<NavigationMenuItem>
|
|
17
|
+
<NavigationMenuLink href="#">Home</NavigationMenuLink>
|
|
18
|
+
</NavigationMenuItem>
|
|
19
|
+
</NavigationMenuList>
|
|
20
|
+
</NavigationMenu>,
|
|
21
|
+
);
|
|
22
|
+
expect(screen.getByRole("navigation")).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("renders links", () => {
|
|
26
|
+
render(
|
|
27
|
+
<NavigationMenu>
|
|
28
|
+
<NavigationMenuList>
|
|
29
|
+
<NavigationMenuItem>
|
|
30
|
+
<NavigationMenuLink href="#">Home</NavigationMenuLink>
|
|
31
|
+
</NavigationMenuItem>
|
|
32
|
+
</NavigationMenuList>
|
|
33
|
+
</NavigationMenu>,
|
|
34
|
+
);
|
|
35
|
+
expect(screen.getByText("Home")).toBeDefined();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("merges custom className", () => {
|
|
39
|
+
render(
|
|
40
|
+
<NavigationMenu className="my-nav">
|
|
41
|
+
<NavigationMenuList>
|
|
42
|
+
<NavigationMenuItem>
|
|
43
|
+
<NavigationMenuLink href="#">X</NavigationMenuLink>
|
|
44
|
+
</NavigationMenuItem>
|
|
45
|
+
</NavigationMenuList>
|
|
46
|
+
</NavigationMenu>,
|
|
47
|
+
);
|
|
48
|
+
expect(screen.getByRole("navigation").className).toContain("my-nav");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("navigationMenuTriggerStyle generates classes", () => {
|
|
52
|
+
const classes = navigationMenuTriggerStyle();
|
|
53
|
+
expect(classes).toContain("inline-flex");
|
|
54
|
+
expect(classes).toContain("h-9");
|
|
55
|
+
});
|
|
56
|
+
});
|