@mihcm/ui 0.14.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 +138 -0
- package/dist/AccessLevelGroup.d.ts +37 -0
- package/dist/AccessLevelGroup.d.ts.map +1 -0
- package/dist/AccessLevelGroup.js +39 -0
- package/dist/AccessLevelGroup.js.map +1 -0
- package/dist/AccessLevelGroup.native.d.ts +18 -0
- package/dist/AccessLevelGroup.native.d.ts.map +1 -0
- package/dist/AccessLevelGroup.native.js +40 -0
- package/dist/AccessLevelGroup.native.js.map +1 -0
- package/dist/Accordion.d.ts +52 -0
- package/dist/Accordion.d.ts.map +1 -0
- package/dist/Accordion.js +90 -0
- package/dist/Accordion.js.map +1 -0
- package/dist/Accordion.native.d.ts +36 -0
- package/dist/Accordion.native.d.ts.map +1 -0
- package/dist/Accordion.native.js +86 -0
- package/dist/Accordion.native.js.map +1 -0
- package/dist/Alert.d.ts +33 -0
- package/dist/Alert.d.ts.map +1 -0
- package/dist/Alert.js +45 -0
- package/dist/Alert.js.map +1 -0
- package/dist/Alert.native.d.ts +26 -0
- package/dist/Alert.native.d.ts.map +1 -0
- package/dist/Alert.native.js +41 -0
- package/dist/Alert.native.js.map +1 -0
- package/dist/AlertDialog.d.ts +57 -0
- package/dist/AlertDialog.d.ts.map +1 -0
- package/dist/AlertDialog.js +91 -0
- package/dist/AlertDialog.js.map +1 -0
- package/dist/AlertDialog.native.d.ts +66 -0
- package/dist/AlertDialog.native.d.ts.map +1 -0
- package/dist/AlertDialog.native.js +71 -0
- package/dist/AlertDialog.native.js.map +1 -0
- package/dist/AspectRatio.d.ts +18 -0
- package/dist/AspectRatio.d.ts.map +1 -0
- package/dist/AspectRatio.js +19 -0
- package/dist/AspectRatio.js.map +1 -0
- package/dist/AspectRatio.native.d.ts +7 -0
- package/dist/AspectRatio.native.d.ts.map +1 -0
- package/dist/AspectRatio.native.js +13 -0
- package/dist/AspectRatio.native.js.map +1 -0
- package/dist/Avatar.d.ts +45 -0
- package/dist/Avatar.d.ts.map +1 -0
- package/dist/Avatar.js +69 -0
- package/dist/Avatar.js.map +1 -0
- package/dist/Avatar.native.d.ts +38 -0
- package/dist/Avatar.native.d.ts.map +1 -0
- package/dist/Avatar.native.js +56 -0
- package/dist/Avatar.native.js.map +1 -0
- package/dist/AvatarGroup.d.ts +32 -0
- package/dist/AvatarGroup.d.ts.map +1 -0
- package/dist/AvatarGroup.js +45 -0
- package/dist/AvatarGroup.js.map +1 -0
- package/dist/AvatarGroup.native.d.ts +18 -0
- package/dist/AvatarGroup.native.d.ts.map +1 -0
- package/dist/AvatarGroup.native.js +35 -0
- package/dist/AvatarGroup.native.js.map +1 -0
- package/dist/Badge.d.ts +26 -0
- package/dist/Badge.d.ts.map +1 -0
- package/dist/Badge.js +44 -0
- package/dist/Badge.js.map +1 -0
- package/dist/Badge.native.d.ts +23 -0
- package/dist/Badge.native.d.ts.map +1 -0
- package/dist/Badge.native.js +49 -0
- package/dist/Badge.native.js.map +1 -0
- package/dist/Banner.d.ts +27 -0
- package/dist/Banner.d.ts.map +1 -0
- package/dist/Banner.js +41 -0
- package/dist/Banner.js.map +1 -0
- package/dist/Banner.native.d.ts +24 -0
- package/dist/Banner.native.d.ts.map +1 -0
- package/dist/Banner.native.js +39 -0
- package/dist/Banner.native.js.map +1 -0
- package/dist/BarList.d.ts +27 -0
- package/dist/BarList.d.ts.map +1 -0
- package/dist/BarList.js +25 -0
- package/dist/BarList.js.map +1 -0
- package/dist/Breadcrumb.d.ts +67 -0
- package/dist/Breadcrumb.d.ts.map +1 -0
- package/dist/Breadcrumb.js +63 -0
- package/dist/Breadcrumb.js.map +1 -0
- package/dist/Breadcrumb.native.d.ts +64 -0
- package/dist/Breadcrumb.native.d.ts.map +1 -0
- package/dist/Breadcrumb.native.js +50 -0
- package/dist/Breadcrumb.native.js.map +1 -0
- package/dist/Button.d.ts +42 -0
- package/dist/Button.d.ts.map +1 -0
- package/dist/Button.js +68 -0
- package/dist/Button.js.map +1 -0
- package/dist/Button.native.d.ts +38 -0
- package/dist/Button.native.d.ts.map +1 -0
- package/dist/Button.native.js +51 -0
- package/dist/Button.native.js.map +1 -0
- package/dist/Calendar.d.ts +16 -0
- package/dist/Calendar.d.ts.map +1 -0
- package/dist/Calendar.js +94 -0
- package/dist/Calendar.js.map +1 -0
- package/dist/Calendar.native.d.ts +21 -0
- package/dist/Calendar.native.d.ts.map +1 -0
- package/dist/Calendar.native.js +15 -0
- package/dist/Calendar.native.js.map +1 -0
- package/dist/Card.d.ts +29 -0
- package/dist/Card.d.ts.map +1 -0
- package/dist/Card.js +44 -0
- package/dist/Card.js.map +1 -0
- package/dist/Card.native.d.ts +20 -0
- package/dist/Card.native.d.ts.map +1 -0
- package/dist/Card.native.js +32 -0
- package/dist/Card.native.js.map +1 -0
- package/dist/Carousel.d.ts +46 -0
- package/dist/Carousel.d.ts.map +1 -0
- package/dist/Carousel.js +115 -0
- package/dist/Carousel.js.map +1 -0
- package/dist/Carousel.native.d.ts +59 -0
- package/dist/Carousel.native.d.ts.map +1 -0
- package/dist/Carousel.native.js +93 -0
- package/dist/Carousel.native.js.map +1 -0
- package/dist/CategoryBar.d.ts +22 -0
- package/dist/CategoryBar.d.ts.map +1 -0
- package/dist/CategoryBar.js +27 -0
- package/dist/CategoryBar.js.map +1 -0
- package/dist/Chart.d.ts +77 -0
- package/dist/Chart.d.ts.map +1 -0
- package/dist/Chart.js +197 -0
- package/dist/Chart.js.map +1 -0
- package/dist/Checkbox.d.ts +28 -0
- package/dist/Checkbox.d.ts.map +1 -0
- package/dist/Checkbox.js +44 -0
- package/dist/Checkbox.js.map +1 -0
- package/dist/Checkbox.native.d.ts +13 -0
- package/dist/Checkbox.native.d.ts.map +1 -0
- package/dist/Checkbox.native.js +34 -0
- package/dist/Checkbox.native.js.map +1 -0
- package/dist/CheckboxGrid.d.ts +49 -0
- package/dist/CheckboxGrid.d.ts.map +1 -0
- package/dist/CheckboxGrid.js +79 -0
- package/dist/CheckboxGrid.js.map +1 -0
- package/dist/CheckboxGrid.native.d.ts +14 -0
- package/dist/CheckboxGrid.native.d.ts.map +1 -0
- package/dist/CheckboxGrid.native.js +47 -0
- package/dist/CheckboxGrid.native.js.map +1 -0
- package/dist/Collapsible.d.ts +51 -0
- package/dist/Collapsible.d.ts.map +1 -0
- package/dist/Collapsible.js +101 -0
- package/dist/Collapsible.js.map +1 -0
- package/dist/Collapsible.native.d.ts +53 -0
- package/dist/Collapsible.native.d.ts.map +1 -0
- package/dist/Collapsible.native.js +109 -0
- package/dist/Collapsible.native.js.map +1 -0
- package/dist/Combobox.d.ts +42 -0
- package/dist/Combobox.d.ts.map +1 -0
- package/dist/Combobox.js +96 -0
- package/dist/Combobox.js.map +1 -0
- package/dist/Combobox.native.d.ts +21 -0
- package/dist/Combobox.native.d.ts.map +1 -0
- package/dist/Combobox.native.js +28 -0
- package/dist/Combobox.native.js.map +1 -0
- package/dist/Command.d.ts +107 -0
- package/dist/Command.d.ts.map +1 -0
- package/dist/Command.js +68 -0
- package/dist/Command.js.map +1 -0
- package/dist/Command.native.d.ts +41 -0
- package/dist/Command.native.d.ts.map +1 -0
- package/dist/Command.native.js +31 -0
- package/dist/Command.native.js.map +1 -0
- package/dist/ContextMenu.d.ts +48 -0
- package/dist/ContextMenu.d.ts.map +1 -0
- package/dist/ContextMenu.js +79 -0
- package/dist/ContextMenu.js.map +1 -0
- package/dist/ContextMenu.native.d.ts +81 -0
- package/dist/ContextMenu.native.d.ts.map +1 -0
- package/dist/ContextMenu.native.js +82 -0
- package/dist/ContextMenu.native.js.map +1 -0
- package/dist/DataTable.d.ts +98 -0
- package/dist/DataTable.d.ts.map +1 -0
- package/dist/DataTable.js +291 -0
- package/dist/DataTable.js.map +1 -0
- package/dist/DataTable.native.d.ts +31 -0
- package/dist/DataTable.native.d.ts.map +1 -0
- package/dist/DataTable.native.js +22 -0
- package/dist/DataTable.native.js.map +1 -0
- package/dist/DatePicker.d.ts +63 -0
- package/dist/DatePicker.d.ts.map +1 -0
- package/dist/DatePicker.js +106 -0
- package/dist/DatePicker.js.map +1 -0
- package/dist/DatePicker.native.d.ts +21 -0
- package/dist/DatePicker.native.d.ts.map +1 -0
- package/dist/DatePicker.native.js +15 -0
- package/dist/DatePicker.native.js.map +1 -0
- package/dist/Dialog.d.ts +52 -0
- package/dist/Dialog.d.ts.map +1 -0
- package/dist/Dialog.js +93 -0
- package/dist/Dialog.js.map +1 -0
- package/dist/Dialog.native.d.ts +57 -0
- package/dist/Dialog.native.d.ts.map +1 -0
- package/dist/Dialog.native.js +62 -0
- package/dist/Dialog.native.js.map +1 -0
- package/dist/Drawer.d.ts +36 -0
- package/dist/Drawer.d.ts.map +1 -0
- package/dist/Drawer.js +57 -0
- package/dist/Drawer.js.map +1 -0
- package/dist/Drawer.native.d.ts +50 -0
- package/dist/Drawer.native.d.ts.map +1 -0
- package/dist/Drawer.native.js +43 -0
- package/dist/Drawer.native.js.map +1 -0
- package/dist/DropdownMenu.d.ts +57 -0
- package/dist/DropdownMenu.d.ts.map +1 -0
- package/dist/DropdownMenu.js +192 -0
- package/dist/DropdownMenu.js.map +1 -0
- package/dist/DropdownMenu.native.d.ts +53 -0
- package/dist/DropdownMenu.native.d.ts.map +1 -0
- package/dist/DropdownMenu.native.js +71 -0
- package/dist/DropdownMenu.native.js.map +1 -0
- package/dist/Dropzone.d.ts +27 -0
- package/dist/Dropzone.d.ts.map +1 -0
- package/dist/Dropzone.js +33 -0
- package/dist/Dropzone.js.map +1 -0
- package/dist/EmptyState.d.ts +21 -0
- package/dist/EmptyState.d.ts.map +1 -0
- package/dist/EmptyState.js +16 -0
- package/dist/EmptyState.js.map +1 -0
- package/dist/EmptyState.native.d.ts +19 -0
- package/dist/EmptyState.native.d.ts.map +1 -0
- package/dist/EmptyState.native.js +16 -0
- package/dist/EmptyState.native.js.map +1 -0
- package/dist/Form.d.ts +310 -0
- package/dist/Form.d.ts.map +1 -0
- package/dist/Form.js +260 -0
- package/dist/Form.js.map +1 -0
- package/dist/Form.native.d.ts +36 -0
- package/dist/Form.native.d.ts.map +1 -0
- package/dist/Form.native.js +33 -0
- package/dist/Form.native.js.map +1 -0
- package/dist/HoverCard.d.ts +47 -0
- package/dist/HoverCard.d.ts.map +1 -0
- package/dist/HoverCard.js +86 -0
- package/dist/HoverCard.js.map +1 -0
- package/dist/HoverCard.native.d.ts +48 -0
- package/dist/HoverCard.native.d.ts.map +1 -0
- package/dist/HoverCard.native.js +19 -0
- package/dist/HoverCard.native.js.map +1 -0
- package/dist/IconSidebar.d.ts +50 -0
- package/dist/IconSidebar.d.ts.map +1 -0
- package/dist/IconSidebar.js +121 -0
- package/dist/IconSidebar.js.map +1 -0
- package/dist/IconSidebar.native.d.ts +40 -0
- package/dist/IconSidebar.native.d.ts.map +1 -0
- package/dist/IconSidebar.native.js +24 -0
- package/dist/IconSidebar.native.js.map +1 -0
- package/dist/Input.d.ts +52 -0
- package/dist/Input.d.ts.map +1 -0
- package/dist/Input.js +57 -0
- package/dist/Input.js.map +1 -0
- package/dist/Input.native.d.ts +37 -0
- package/dist/Input.native.d.ts.map +1 -0
- package/dist/Input.native.js +39 -0
- package/dist/Input.native.js.map +1 -0
- package/dist/InputOTP.d.ts +30 -0
- package/dist/InputOTP.d.ts.map +1 -0
- package/dist/InputOTP.js +47 -0
- package/dist/InputOTP.js.map +1 -0
- package/dist/InputOTP.native.d.ts +32 -0
- package/dist/InputOTP.native.d.ts.map +1 -0
- package/dist/InputOTP.native.js +48 -0
- package/dist/InputOTP.native.js.map +1 -0
- package/dist/Label.d.ts +26 -0
- package/dist/Label.d.ts.map +1 -0
- package/dist/Label.js +35 -0
- package/dist/Label.js.map +1 -0
- package/dist/Label.native.d.ts +26 -0
- package/dist/Label.native.d.ts.map +1 -0
- package/dist/Label.native.js +30 -0
- package/dist/Label.native.js.map +1 -0
- package/dist/Link.d.ts +21 -0
- package/dist/Link.d.ts.map +1 -0
- package/dist/Link.js +46 -0
- package/dist/Link.js.map +1 -0
- package/dist/Link.native.d.ts +23 -0
- package/dist/Link.native.d.ts.map +1 -0
- package/dist/Link.native.js +59 -0
- package/dist/Link.native.js.map +1 -0
- package/dist/Logo.d.ts +25 -0
- package/dist/Logo.d.ts.map +1 -0
- package/dist/Logo.js +58 -0
- package/dist/Logo.js.map +1 -0
- package/dist/Logo.native.d.ts +22 -0
- package/dist/Logo.native.d.ts.map +1 -0
- package/dist/Logo.native.js +46 -0
- package/dist/Logo.native.js.map +1 -0
- package/dist/MainSidebar.d.ts +2 -0
- package/dist/MainSidebar.d.ts.map +1 -0
- package/dist/MainSidebar.js +3 -0
- package/dist/MainSidebar.js.map +1 -0
- package/dist/MainSidebar.native.d.ts +2 -0
- package/dist/MainSidebar.native.d.ts.map +1 -0
- package/dist/MainSidebar.native.js +2 -0
- package/dist/MainSidebar.native.js.map +1 -0
- package/dist/Menubar.d.ts +70 -0
- package/dist/Menubar.d.ts.map +1 -0
- package/dist/Menubar.js +142 -0
- package/dist/Menubar.js.map +1 -0
- package/dist/NavigationMenu.d.ts +12 -0
- package/dist/NavigationMenu.d.ts.map +1 -0
- package/dist/NavigationMenu.js +63 -0
- package/dist/NavigationMenu.js.map +1 -0
- package/dist/NavigationMenu.native.d.ts +44 -0
- package/dist/NavigationMenu.native.d.ts.map +1 -0
- package/dist/NavigationMenu.native.js +43 -0
- package/dist/NavigationMenu.native.js.map +1 -0
- package/dist/NotificationBadge.d.ts +33 -0
- package/dist/NotificationBadge.d.ts.map +1 -0
- package/dist/NotificationBadge.js +49 -0
- package/dist/NotificationBadge.js.map +1 -0
- package/dist/NotificationBadge.native.d.ts +25 -0
- package/dist/NotificationBadge.native.d.ts.map +1 -0
- package/dist/NotificationBadge.native.js +41 -0
- package/dist/NotificationBadge.native.js.map +1 -0
- package/dist/PageShell.d.ts +24 -0
- package/dist/PageShell.d.ts.map +1 -0
- package/dist/PageShell.js +24 -0
- package/dist/PageShell.js.map +1 -0
- package/dist/PageShell.native.d.ts +21 -0
- package/dist/PageShell.native.d.ts.map +1 -0
- package/dist/PageShell.native.js +19 -0
- package/dist/PageShell.native.js.map +1 -0
- package/dist/Pagination.d.ts +53 -0
- package/dist/Pagination.d.ts.map +1 -0
- package/dist/Pagination.js +79 -0
- package/dist/Pagination.js.map +1 -0
- package/dist/Pagination.native.d.ts +48 -0
- package/dist/Pagination.native.d.ts.map +1 -0
- package/dist/Pagination.native.js +55 -0
- package/dist/Pagination.native.js.map +1 -0
- package/dist/Popover.d.ts +57 -0
- package/dist/Popover.d.ts.map +1 -0
- package/dist/Popover.js +71 -0
- package/dist/Popover.js.map +1 -0
- package/dist/Popover.native.d.ts +48 -0
- package/dist/Popover.native.d.ts.map +1 -0
- package/dist/Popover.native.js +65 -0
- package/dist/Popover.native.js.map +1 -0
- package/dist/Popper.d.ts +54 -0
- package/dist/Popper.d.ts.map +1 -0
- package/dist/Popper.js +219 -0
- package/dist/Popper.js.map +1 -0
- package/dist/Progress.d.ts +79 -0
- package/dist/Progress.d.ts.map +1 -0
- package/dist/Progress.js +110 -0
- package/dist/Progress.js.map +1 -0
- package/dist/Progress.native.d.ts +42 -0
- package/dist/Progress.native.d.ts.map +1 -0
- package/dist/Progress.native.js +91 -0
- package/dist/Progress.native.js.map +1 -0
- package/dist/ProgressCircle.d.ts +69 -0
- package/dist/ProgressCircle.d.ts.map +1 -0
- package/dist/ProgressCircle.js +78 -0
- package/dist/ProgressCircle.js.map +1 -0
- package/dist/RadioCardGroup.d.ts +26 -0
- package/dist/RadioCardGroup.d.ts.map +1 -0
- package/dist/RadioCardGroup.js +26 -0
- package/dist/RadioCardGroup.js.map +1 -0
- package/dist/RadioGroup.d.ts +35 -0
- package/dist/RadioGroup.d.ts.map +1 -0
- package/dist/RadioGroup.js +68 -0
- package/dist/RadioGroup.js.map +1 -0
- package/dist/RadioGroup.native.d.ts +33 -0
- package/dist/RadioGroup.native.d.ts.map +1 -0
- package/dist/RadioGroup.native.js +55 -0
- package/dist/RadioGroup.native.js.map +1 -0
- package/dist/Resizable.d.ts +32 -0
- package/dist/Resizable.d.ts.map +1 -0
- package/dist/Resizable.js +31 -0
- package/dist/Resizable.js.map +1 -0
- package/dist/Resizable.native.d.ts +32 -0
- package/dist/Resizable.native.d.ts.map +1 -0
- package/dist/Resizable.native.js +23 -0
- package/dist/Resizable.native.js.map +1 -0
- package/dist/RichTextEditor.d.ts +38 -0
- package/dist/RichTextEditor.d.ts.map +1 -0
- package/dist/RichTextEditor.js +218 -0
- package/dist/RichTextEditor.js.map +1 -0
- package/dist/ScrollArea.d.ts +4 -0
- package/dist/ScrollArea.d.ts.map +1 -0
- package/dist/ScrollArea.js +26 -0
- package/dist/ScrollArea.js.map +1 -0
- package/dist/ScrollArea.native.d.ts +19 -0
- package/dist/ScrollArea.native.d.ts.map +1 -0
- package/dist/ScrollArea.native.js +19 -0
- package/dist/ScrollArea.native.js.map +1 -0
- package/dist/SearchField.d.ts +43 -0
- package/dist/SearchField.d.ts.map +1 -0
- package/dist/SearchField.js +34 -0
- package/dist/SearchField.js.map +1 -0
- package/dist/SearchField.native.d.ts +31 -0
- package/dist/SearchField.native.d.ts.map +1 -0
- package/dist/SearchField.native.js +30 -0
- package/dist/SearchField.native.js.map +1 -0
- package/dist/SectionHeader.d.ts +58 -0
- package/dist/SectionHeader.d.ts.map +1 -0
- package/dist/SectionHeader.js +95 -0
- package/dist/SectionHeader.js.map +1 -0
- package/dist/SectionHeader.native.d.ts +45 -0
- package/dist/SectionHeader.native.d.ts.map +1 -0
- package/dist/SectionHeader.native.js +92 -0
- package/dist/SectionHeader.native.js.map +1 -0
- package/dist/Select.d.ts +78 -0
- package/dist/Select.d.ts.map +1 -0
- package/dist/Select.js +310 -0
- package/dist/Select.js.map +1 -0
- package/dist/Select.native.d.ts +53 -0
- package/dist/Select.native.d.ts.map +1 -0
- package/dist/Select.native.js +86 -0
- package/dist/Select.native.js.map +1 -0
- package/dist/Separator.d.ts +20 -0
- package/dist/Separator.d.ts.map +1 -0
- package/dist/Separator.js +20 -0
- package/dist/Separator.js.map +1 -0
- package/dist/Separator.native.d.ts +8 -0
- package/dist/Separator.native.d.ts.map +1 -0
- package/dist/Separator.native.js +17 -0
- package/dist/Separator.native.js.map +1 -0
- package/dist/Sheet.d.ts +54 -0
- package/dist/Sheet.d.ts.map +1 -0
- package/dist/Sheet.js +191 -0
- package/dist/Sheet.js.map +1 -0
- package/dist/Sheet.native.d.ts +55 -0
- package/dist/Sheet.native.d.ts.map +1 -0
- package/dist/Sheet.native.js +112 -0
- package/dist/Sheet.native.js.map +1 -0
- package/dist/Sidebar.d.ts +131 -0
- package/dist/Sidebar.d.ts.map +1 -0
- package/dist/Sidebar.js +328 -0
- package/dist/Sidebar.js.map +1 -0
- package/dist/Skeleton.d.ts +14 -0
- package/dist/Skeleton.d.ts.map +1 -0
- package/dist/Skeleton.js +17 -0
- package/dist/Skeleton.js.map +1 -0
- package/dist/Skeleton.native.d.ts +6 -0
- package/dist/Skeleton.native.d.ts.map +1 -0
- package/dist/Skeleton.native.js +26 -0
- package/dist/Skeleton.native.js.map +1 -0
- package/dist/Slider.d.ts +63 -0
- package/dist/Slider.d.ts.map +1 -0
- package/dist/Slider.js +109 -0
- package/dist/Slider.js.map +1 -0
- package/dist/Slider.native.d.ts +38 -0
- package/dist/Slider.native.d.ts.map +1 -0
- package/dist/Slider.native.js +18 -0
- package/dist/Slider.native.js.map +1 -0
- package/dist/SortableList.d.ts +26 -0
- package/dist/SortableList.d.ts.map +1 -0
- package/dist/SortableList.js +44 -0
- package/dist/SortableList.js.map +1 -0
- package/dist/SparkChart.d.ts +34 -0
- package/dist/SparkChart.d.ts.map +1 -0
- package/dist/SparkChart.js +55 -0
- package/dist/SparkChart.js.map +1 -0
- package/dist/StatCard.d.ts +35 -0
- package/dist/StatCard.d.ts.map +1 -0
- package/dist/StatCard.js +37 -0
- package/dist/StatCard.js.map +1 -0
- package/dist/StatCard.native.d.ts +28 -0
- package/dist/StatCard.native.d.ts.map +1 -0
- package/dist/StatCard.native.js +31 -0
- package/dist/StatCard.native.js.map +1 -0
- package/dist/StatusBadge.d.ts +23 -0
- package/dist/StatusBadge.d.ts.map +1 -0
- package/dist/StatusBadge.js +33 -0
- package/dist/StatusBadge.js.map +1 -0
- package/dist/StatusBadge.native.d.ts +21 -0
- package/dist/StatusBadge.native.d.ts.map +1 -0
- package/dist/StatusBadge.native.js +37 -0
- package/dist/StatusBadge.native.js.map +1 -0
- package/dist/Switch.d.ts +31 -0
- package/dist/Switch.d.ts.map +1 -0
- package/dist/Switch.js +46 -0
- package/dist/Switch.js.map +1 -0
- package/dist/Switch.native.d.ts +16 -0
- package/dist/Switch.native.d.ts.map +1 -0
- package/dist/Switch.native.js +41 -0
- package/dist/Switch.native.js.map +1 -0
- package/dist/TabNavigation.d.ts +49 -0
- package/dist/TabNavigation.d.ts.map +1 -0
- package/dist/TabNavigation.js +121 -0
- package/dist/TabNavigation.js.map +1 -0
- package/dist/Table.d.ts +54 -0
- package/dist/Table.d.ts.map +1 -0
- package/dist/Table.js +96 -0
- package/dist/Table.js.map +1 -0
- package/dist/Table.native.d.ts +37 -0
- package/dist/Table.native.d.ts.map +1 -0
- package/dist/Table.native.js +37 -0
- package/dist/Table.native.js.map +1 -0
- package/dist/Tabs.d.ts +45 -0
- package/dist/Tabs.d.ts.map +1 -0
- package/dist/Tabs.js +94 -0
- package/dist/Tabs.js.map +1 -0
- package/dist/Tabs.native.d.ts +47 -0
- package/dist/Tabs.native.d.ts.map +1 -0
- package/dist/Tabs.native.js +57 -0
- package/dist/Tabs.native.js.map +1 -0
- package/dist/Tag.d.ts +24 -0
- package/dist/Tag.d.ts.map +1 -0
- package/dist/Tag.js +41 -0
- package/dist/Tag.js.map +1 -0
- package/dist/Tag.native.d.ts +23 -0
- package/dist/Tag.native.d.ts.map +1 -0
- package/dist/Tag.native.js +55 -0
- package/dist/Tag.native.js.map +1 -0
- package/dist/Text.d.ts +26 -0
- package/dist/Text.d.ts.map +1 -0
- package/dist/Text.js +63 -0
- package/dist/Text.js.map +1 -0
- package/dist/Text.native.d.ts +18 -0
- package/dist/Text.native.d.ts.map +1 -0
- package/dist/Text.native.js +58 -0
- package/dist/Text.native.js.map +1 -0
- package/dist/Textarea.d.ts +23 -0
- package/dist/Textarea.d.ts.map +1 -0
- package/dist/Textarea.js +39 -0
- package/dist/Textarea.js.map +1 -0
- package/dist/Textarea.native.d.ts +16 -0
- package/dist/Textarea.native.d.ts.map +1 -0
- package/dist/Textarea.native.js +30 -0
- package/dist/Textarea.native.js.map +1 -0
- package/dist/TiptapEditor.d.ts +24 -0
- package/dist/TiptapEditor.d.ts.map +1 -0
- package/dist/TiptapEditor.js +84 -0
- package/dist/TiptapEditor.js.map +1 -0
- package/dist/TitleBar.d.ts +31 -0
- package/dist/TitleBar.d.ts.map +1 -0
- package/dist/TitleBar.js +27 -0
- package/dist/TitleBar.js.map +1 -0
- package/dist/TitleBar.native.d.ts +19 -0
- package/dist/TitleBar.native.d.ts.map +1 -0
- package/dist/TitleBar.native.js +16 -0
- package/dist/TitleBar.native.js.map +1 -0
- package/dist/Toast.d.ts +72 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +194 -0
- package/dist/Toast.js.map +1 -0
- package/dist/Toast.native.d.ts +65 -0
- package/dist/Toast.native.d.ts.map +1 -0
- package/dist/Toast.native.js +182 -0
- package/dist/Toast.native.js.map +1 -0
- package/dist/Toggle.d.ts +46 -0
- package/dist/Toggle.d.ts.map +1 -0
- package/dist/Toggle.js +70 -0
- package/dist/Toggle.js.map +1 -0
- package/dist/Toggle.native.d.ts +42 -0
- package/dist/Toggle.native.d.ts.map +1 -0
- package/dist/Toggle.native.js +56 -0
- package/dist/Toggle.native.js.map +1 -0
- package/dist/Tooltip.d.ts +32 -0
- package/dist/Tooltip.d.ts.map +1 -0
- package/dist/Tooltip.js +43 -0
- package/dist/Tooltip.js.map +1 -0
- package/dist/Tooltip.native.d.ts +25 -0
- package/dist/Tooltip.native.d.ts.map +1 -0
- package/dist/Tooltip.native.js +25 -0
- package/dist/Tooltip.native.js.map +1 -0
- package/dist/TopBar.d.ts +105 -0
- package/dist/TopBar.d.ts.map +1 -0
- package/dist/TopBar.js +90 -0
- package/dist/TopBar.js.map +1 -0
- package/dist/TopBar.native.d.ts +67 -0
- package/dist/TopBar.native.d.ts.map +1 -0
- package/dist/TopBar.native.js +41 -0
- package/dist/TopBar.native.js.map +1 -0
- package/dist/Tracker.d.ts +44 -0
- package/dist/Tracker.d.ts.map +1 -0
- package/dist/Tracker.js +92 -0
- package/dist/Tracker.js.map +1 -0
- package/dist/TransferList.d.ts +51 -0
- package/dist/TransferList.d.ts.map +1 -0
- package/dist/TransferList.js +107 -0
- package/dist/TransferList.js.map +1 -0
- package/dist/TransferList.native.d.ts +14 -0
- package/dist/TransferList.native.d.ts.map +1 -0
- package/dist/TransferList.native.js +57 -0
- package/dist/TransferList.native.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +79 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/cn.d.ts +7 -0
- package/dist/internal/cn.d.ts.map +1 -0
- package/dist/internal/cn.js +30 -0
- package/dist/internal/cn.js.map +1 -0
- package/package.json +499 -0
- package/src/AccessLevelGroup.native.tsx +103 -0
- package/src/AccessLevelGroup.tsx +103 -0
- package/src/Accordion.native.tsx +199 -0
- package/src/Accordion.tsx +279 -0
- package/src/Alert.native.tsx +100 -0
- package/src/Alert.tsx +101 -0
- package/src/AlertDialog.native.tsx +189 -0
- package/src/AlertDialog.tsx +194 -0
- package/src/AspectRatio.native.tsx +28 -0
- package/src/AspectRatio.tsx +35 -0
- package/src/Avatar.native.tsx +142 -0
- package/src/Avatar.tsx +155 -0
- package/src/AvatarGroup.native.tsx +81 -0
- package/src/AvatarGroup.tsx +114 -0
- package/src/Badge.native.tsx +85 -0
- package/src/Badge.tsx +93 -0
- package/src/Banner.native.tsx +77 -0
- package/src/Banner.tsx +95 -0
- package/src/BarList.tsx +102 -0
- package/src/Breadcrumb.native.tsx +238 -0
- package/src/Breadcrumb.tsx +258 -0
- package/src/Button.native.tsx +123 -0
- package/src/Button.tsx +153 -0
- package/src/Calendar.native.tsx +28 -0
- package/src/Calendar.tsx +211 -0
- package/src/Card.native.tsx +82 -0
- package/src/Card.tsx +94 -0
- package/src/Carousel.native.tsx +224 -0
- package/src/Carousel.tsx +292 -0
- package/src/CategoryBar.tsx +85 -0
- package/src/Chart.tsx +467 -0
- package/src/Checkbox.native.tsx +69 -0
- package/src/Checkbox.tsx +108 -0
- package/src/CheckboxGrid.native.tsx +160 -0
- package/src/CheckboxGrid.tsx +262 -0
- package/src/Collapsible.native.tsx +240 -0
- package/src/Collapsible.tsx +241 -0
- package/src/Combobox.native.tsx +171 -0
- package/src/Combobox.tsx +272 -0
- package/src/Command.native.tsx +71 -0
- package/src/Command.tsx +203 -0
- package/src/ContextMenu.native.tsx +313 -0
- package/src/ContextMenu.tsx +238 -0
- package/src/DataTable.native.tsx +70 -0
- package/src/DataTable.tsx +989 -0
- package/src/DatePicker.native.tsx +46 -0
- package/src/DatePicker.tsx +357 -0
- package/src/Dialog.native.tsx +181 -0
- package/src/Dialog.tsx +224 -0
- package/src/Drawer.native.tsx +134 -0
- package/src/Drawer.tsx +119 -0
- package/src/DropdownMenu.native.tsx +258 -0
- package/src/DropdownMenu.tsx +387 -0
- package/src/Dropzone.tsx +95 -0
- package/src/EmptyState.native.tsx +43 -0
- package/src/EmptyState.tsx +52 -0
- package/src/Form.native.tsx +94 -0
- package/src/Form.tsx +1324 -0
- package/src/HoverCard.native.tsx +63 -0
- package/src/HoverCard.tsx +181 -0
- package/src/IconSidebar.native.tsx +94 -0
- package/src/IconSidebar.tsx +448 -0
- package/src/Input.native.tsx +99 -0
- package/src/Input.tsx +132 -0
- package/src/InputOTP.native.tsx +154 -0
- package/src/InputOTP.tsx +119 -0
- package/src/Label.native.tsx +55 -0
- package/src/Label.tsx +60 -0
- package/src/Link.native.tsx +89 -0
- package/src/Link.tsx +85 -0
- package/src/Logo.native.tsx +114 -0
- package/src/Logo.tsx +153 -0
- package/src/MainSidebar.native.tsx +8 -0
- package/src/MainSidebar.tsx +10 -0
- package/src/Menubar.tsx +485 -0
- package/src/NavigationMenu.native.tsx +136 -0
- package/src/NavigationMenu.tsx +180 -0
- package/src/NotificationBadge.native.tsx +80 -0
- package/src/NotificationBadge.tsx +91 -0
- package/src/PageShell.native.tsx +43 -0
- package/src/PageShell.tsx +50 -0
- package/src/Pagination.native.tsx +217 -0
- package/src/Pagination.tsx +250 -0
- package/src/Popover.native.tsx +139 -0
- package/src/Popover.tsx +175 -0
- package/src/Popper.tsx +399 -0
- package/src/Progress.native.tsx +197 -0
- package/src/Progress.tsx +286 -0
- package/src/ProgressCircle.tsx +200 -0
- package/src/RadioCardGroup.tsx +97 -0
- package/src/RadioGroup.native.tsx +153 -0
- package/src/RadioGroup.tsx +201 -0
- package/src/Resizable.native.tsx +76 -0
- package/src/Resizable.tsx +88 -0
- package/src/RichTextEditor.tsx +513 -0
- package/src/ScrollArea.native.tsx +36 -0
- package/src/ScrollArea.tsx +62 -0
- package/src/SearchField.native.tsx +104 -0
- package/src/SearchField.tsx +136 -0
- package/src/SectionHeader.native.tsx +226 -0
- package/src/SectionHeader.tsx +250 -0
- package/src/Select.native.tsx +299 -0
- package/src/Select.tsx +710 -0
- package/src/Separator.native.tsx +38 -0
- package/src/Separator.tsx +43 -0
- package/src/Sheet.native.tsx +233 -0
- package/src/Sheet.tsx +329 -0
- package/src/Sidebar.tsx +956 -0
- package/src/Skeleton.native.tsx +47 -0
- package/src/Skeleton.tsx +29 -0
- package/src/Slider.native.tsx +64 -0
- package/src/Slider.tsx +284 -0
- package/src/SortableList.tsx +158 -0
- package/src/SparkChart.tsx +143 -0
- package/src/StatCard.native.tsx +64 -0
- package/src/StatCard.tsx +75 -0
- package/src/StatusBadge.native.tsx +57 -0
- package/src/StatusBadge.tsx +52 -0
- package/src/Switch.native.tsx +78 -0
- package/src/Switch.tsx +94 -0
- package/src/TabNavigation.tsx +329 -0
- package/src/Table.native.tsx +183 -0
- package/src/Table.tsx +260 -0
- package/src/Tabs.native.tsx +139 -0
- package/src/Tabs.tsx +216 -0
- package/src/Tag.native.tsx +87 -0
- package/src/Tag.tsx +93 -0
- package/src/Text.native.tsx +95 -0
- package/src/Text.tsx +93 -0
- package/src/Textarea.native.tsx +64 -0
- package/src/Textarea.tsx +66 -0
- package/src/TitleBar.native.tsx +46 -0
- package/src/TitleBar.tsx +64 -0
- package/src/Toast.native.tsx +366 -0
- package/src/Toast.tsx +408 -0
- package/src/Toggle.native.tsx +162 -0
- package/src/Toggle.tsx +169 -0
- package/src/Tooltip.native.tsx +62 -0
- package/src/Tooltip.tsx +88 -0
- package/src/TopBar.native.tsx +223 -0
- package/src/TopBar.tsx +436 -0
- package/src/Tracker.tsx +244 -0
- package/src/TransferList.native.tsx +180 -0
- package/src/TransferList.tsx +297 -0
- package/src/globals.d.ts +1 -0
- package/src/index.ts +502 -0
- package/src/internal/cn.ts +31 -0
package/src/Popover.tsx
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Popover (web variant — React DOM).
|
|
5
|
+
*
|
|
6
|
+
* Click-triggered floating panel anchored to a trigger element.
|
|
7
|
+
* Composes the shared Popper positioning primitive so floating-layer
|
|
8
|
+
* behavior stays consistent across Popover, Tooltip, Select, and menus.
|
|
9
|
+
*
|
|
10
|
+
* <Popover open={open} onOpenChange={setOpen}>
|
|
11
|
+
* <PopoverTrigger>
|
|
12
|
+
* <Button>Open</Button>
|
|
13
|
+
* </PopoverTrigger>
|
|
14
|
+
* <PopoverContent>
|
|
15
|
+
* <p>Popover body</p>
|
|
16
|
+
* </PopoverContent>
|
|
17
|
+
* </Popover>
|
|
18
|
+
*
|
|
19
|
+
* Wiki: docs/components/Popover.md
|
|
20
|
+
*/
|
|
21
|
+
import {
|
|
22
|
+
createContext,
|
|
23
|
+
forwardRef,
|
|
24
|
+
useContext,
|
|
25
|
+
useEffect,
|
|
26
|
+
useState,
|
|
27
|
+
type HTMLAttributes,
|
|
28
|
+
type ReactElement,
|
|
29
|
+
type ReactNode,
|
|
30
|
+
} from 'react';
|
|
31
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
32
|
+
import { cn } from './internal/cn.js';
|
|
33
|
+
import {
|
|
34
|
+
Popper,
|
|
35
|
+
PopperContent,
|
|
36
|
+
PopperTrigger,
|
|
37
|
+
type PopperPlacement,
|
|
38
|
+
type PopperStrategy,
|
|
39
|
+
} from './Popper.js';
|
|
40
|
+
|
|
41
|
+
/* ── Context ────────────────────────────────────────────────────────── */
|
|
42
|
+
|
|
43
|
+
interface PopoverContextValue {
|
|
44
|
+
setSide: (side: PopoverSide) => void;
|
|
45
|
+
setAlign: (align: PopoverAlign) => void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const PopoverContext = createContext<PopoverContextValue | null>(null);
|
|
49
|
+
|
|
50
|
+
function usePopoverContext() {
|
|
51
|
+
const ctx = useContext(PopoverContext);
|
|
52
|
+
if (!ctx) throw new Error('Popover compound components must be used within <Popover>');
|
|
53
|
+
return ctx;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* ── Root ───────────────────────────────────────────────────────────── */
|
|
57
|
+
|
|
58
|
+
export interface PopoverProps {
|
|
59
|
+
open?: boolean | undefined;
|
|
60
|
+
defaultOpen?: boolean | undefined;
|
|
61
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
className?: string;
|
|
64
|
+
arrow?: boolean | undefined;
|
|
65
|
+
offset?: [number, number] | undefined;
|
|
66
|
+
strategy?: PopperStrategy | undefined;
|
|
67
|
+
portalled?: boolean | undefined;
|
|
68
|
+
align?: PopoverAlign | undefined;
|
|
69
|
+
matchReferenceWidth?: boolean | undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type PopoverSide = 'top' | 'bottom' | 'left' | 'right';
|
|
73
|
+
type PopoverAlign = 'start' | 'center' | 'end';
|
|
74
|
+
|
|
75
|
+
export function Popover({
|
|
76
|
+
open,
|
|
77
|
+
defaultOpen,
|
|
78
|
+
onOpenChange,
|
|
79
|
+
children,
|
|
80
|
+
className,
|
|
81
|
+
arrow = false,
|
|
82
|
+
offset = [0, 8],
|
|
83
|
+
strategy,
|
|
84
|
+
portalled,
|
|
85
|
+
align: defaultAlign = 'center',
|
|
86
|
+
matchReferenceWidth = false,
|
|
87
|
+
}: PopoverProps) {
|
|
88
|
+
const [side, setSide] = useState<PopoverSide>('bottom');
|
|
89
|
+
const [align, setAlign] = useState<PopoverAlign>(defaultAlign);
|
|
90
|
+
const placement = sideToPlacement(side, align);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Popper
|
|
94
|
+
open={open}
|
|
95
|
+
defaultOpen={defaultOpen}
|
|
96
|
+
onOpenChange={onOpenChange}
|
|
97
|
+
placement={placement}
|
|
98
|
+
arrow={arrow}
|
|
99
|
+
offset={offset}
|
|
100
|
+
{...(strategy ? { strategy } : {})}
|
|
101
|
+
{...(portalled !== undefined ? { portalled } : {})}
|
|
102
|
+
matchReferenceWidth={matchReferenceWidth}
|
|
103
|
+
>
|
|
104
|
+
<PopoverContext.Provider value={{ setSide, setAlign }}>
|
|
105
|
+
<div className={cn('inline-flex', className)}>{children}</div>
|
|
106
|
+
</PopoverContext.Provider>
|
|
107
|
+
</Popper>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* ── Trigger ────────────────────────────────────────────────────────── */
|
|
112
|
+
|
|
113
|
+
export interface PopoverTriggerProps {
|
|
114
|
+
children: ReactElement;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Delegates to PopperTrigger, which clones its single child and merges
|
|
119
|
+
* trigger props onto it. This avoids nesting a `<button>` inside a
|
|
120
|
+
* `<button>` when the child is already a Button.
|
|
121
|
+
*/
|
|
122
|
+
export function PopoverTrigger({ children }: PopoverTriggerProps) {
|
|
123
|
+
return <PopperTrigger>{children}</PopperTrigger>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* ── Content ────────────────────────────────────────────────────────── */
|
|
127
|
+
|
|
128
|
+
export const popoverContentVariants = cva(
|
|
129
|
+
'rounded-xl border border-border bg-card p-4 shadow-lg animate-dropdown-in',
|
|
130
|
+
{
|
|
131
|
+
variants: {
|
|
132
|
+
size: {
|
|
133
|
+
sm: 'w-56',
|
|
134
|
+
md: 'w-72',
|
|
135
|
+
lg: 'w-96',
|
|
136
|
+
auto: 'w-auto',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
defaultVariants: { size: 'md' },
|
|
140
|
+
},
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
export interface PopoverContentProps
|
|
144
|
+
extends HTMLAttributes<HTMLDivElement>,
|
|
145
|
+
VariantProps<typeof popoverContentVariants> {
|
|
146
|
+
side?: PopoverSide | undefined;
|
|
147
|
+
align?: PopoverAlign | undefined;
|
|
148
|
+
arrowClassName?: string | undefined;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const PopoverContent = forwardRef<HTMLDivElement, PopoverContentProps>(
|
|
152
|
+
function PopoverContent({ className, side = 'bottom', align = 'center', size, arrowClassName, ...props }, ref) {
|
|
153
|
+
const ctx = usePopoverContext();
|
|
154
|
+
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
ctx.setSide(side);
|
|
157
|
+
ctx.setAlign(align);
|
|
158
|
+
}, [align, ctx, side]);
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<PopperContent
|
|
162
|
+
ref={ref}
|
|
163
|
+
size={size}
|
|
164
|
+
arrowClassName={arrowClassName}
|
|
165
|
+
className={cn(popoverContentVariants({ size }), className)}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
);
|
|
169
|
+
},
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
function sideToPlacement(side: PopoverSide, align: PopoverAlign): PopperPlacement {
|
|
173
|
+
if (align === 'center') return side;
|
|
174
|
+
return `${side}-${align}` as PopperPlacement;
|
|
175
|
+
}
|
package/src/Popper.tsx
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Popper (web variant — React DOM).
|
|
5
|
+
*
|
|
6
|
+
* Low-level positioning primitive powered by `react-popper` and
|
|
7
|
+
* `@popperjs/core`. Use it when Tooltip, Popover, DropdownMenu, or Select do
|
|
8
|
+
* not expose enough positioning control.
|
|
9
|
+
*
|
|
10
|
+
* Wiki: docs/components/Popper.md
|
|
11
|
+
*/
|
|
12
|
+
import {
|
|
13
|
+
cloneElement,
|
|
14
|
+
createContext,
|
|
15
|
+
forwardRef,
|
|
16
|
+
isValidElement,
|
|
17
|
+
useCallback,
|
|
18
|
+
useContext,
|
|
19
|
+
useEffect,
|
|
20
|
+
useMemo,
|
|
21
|
+
useRef,
|
|
22
|
+
useState,
|
|
23
|
+
type HTMLAttributes,
|
|
24
|
+
type MouseEvent,
|
|
25
|
+
type Ref,
|
|
26
|
+
type ReactElement,
|
|
27
|
+
type ReactNode,
|
|
28
|
+
} from 'react';
|
|
29
|
+
import { createPortal } from 'react-dom';
|
|
30
|
+
import { usePopper, type Modifier as ReactPopperModifier } from 'react-popper';
|
|
31
|
+
import type { Placement, PositioningStrategy, State, VirtualElement } from '@popperjs/core';
|
|
32
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
33
|
+
import { cn } from './internal/cn.js';
|
|
34
|
+
|
|
35
|
+
export type PopperPlacement = Placement;
|
|
36
|
+
export type PopperStrategy = PositioningStrategy;
|
|
37
|
+
export type PopperVirtualElement = VirtualElement;
|
|
38
|
+
export type PopperModifier<
|
|
39
|
+
Name extends string = string,
|
|
40
|
+
Options extends object = Record<string, unknown>,
|
|
41
|
+
> = ReactPopperModifier<Name, Options>;
|
|
42
|
+
|
|
43
|
+
type PopperContextValue = {
|
|
44
|
+
open: boolean;
|
|
45
|
+
setOpen: (open: boolean) => void;
|
|
46
|
+
referenceElement: Element | VirtualElement | null;
|
|
47
|
+
setReferenceElement: (element: Element | null) => void;
|
|
48
|
+
triggerElement: HTMLElement | null;
|
|
49
|
+
setTriggerElement: (element: HTMLElement | null) => void;
|
|
50
|
+
contentElement: HTMLElement | null;
|
|
51
|
+
setContentElement: (element: HTMLElement | null) => void;
|
|
52
|
+
arrowElement: HTMLElement | null;
|
|
53
|
+
setArrowElement: (element: HTMLElement | null) => void;
|
|
54
|
+
placement: Placement;
|
|
55
|
+
strategy: PositioningStrategy;
|
|
56
|
+
offset: [number, number];
|
|
57
|
+
flip: boolean;
|
|
58
|
+
preventOverflow: boolean;
|
|
59
|
+
arrow: boolean;
|
|
60
|
+
matchReferenceWidth: boolean;
|
|
61
|
+
modifiers: ReadonlyArray<PopperModifier> | undefined;
|
|
62
|
+
onFirstUpdate: ((state: Partial<State>) => void) | undefined;
|
|
63
|
+
closeOnOutsidePointerDown: boolean;
|
|
64
|
+
closeOnEscape: boolean;
|
|
65
|
+
portalled: boolean;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const PopperContext = createContext<PopperContextValue | null>(null);
|
|
69
|
+
|
|
70
|
+
function usePopperContext() {
|
|
71
|
+
const ctx = useContext(PopperContext);
|
|
72
|
+
if (!ctx) throw new Error('Popper compound components must be used within <Popper>.');
|
|
73
|
+
return ctx;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface PopperProps {
|
|
77
|
+
children: ReactNode;
|
|
78
|
+
open?: boolean | undefined;
|
|
79
|
+
defaultOpen?: boolean | undefined;
|
|
80
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
81
|
+
placement?: Placement | undefined;
|
|
82
|
+
strategy?: PositioningStrategy | undefined;
|
|
83
|
+
offset?: [number, number] | undefined;
|
|
84
|
+
flip?: boolean | undefined;
|
|
85
|
+
preventOverflow?: boolean | undefined;
|
|
86
|
+
arrow?: boolean | undefined;
|
|
87
|
+
matchReferenceWidth?: boolean | undefined;
|
|
88
|
+
modifiers?: ReadonlyArray<PopperModifier> | undefined;
|
|
89
|
+
referenceElement?: Element | VirtualElement | null | undefined;
|
|
90
|
+
onFirstUpdate?: ((state: Partial<State>) => void) | undefined;
|
|
91
|
+
closeOnOutsidePointerDown?: boolean | undefined;
|
|
92
|
+
closeOnEscape?: boolean | undefined;
|
|
93
|
+
portalled?: boolean | undefined;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function Popper({
|
|
97
|
+
children,
|
|
98
|
+
open,
|
|
99
|
+
defaultOpen = false,
|
|
100
|
+
onOpenChange,
|
|
101
|
+
placement = 'bottom-start',
|
|
102
|
+
strategy = 'absolute',
|
|
103
|
+
offset = [0, 8],
|
|
104
|
+
flip = true,
|
|
105
|
+
preventOverflow = true,
|
|
106
|
+
arrow = false,
|
|
107
|
+
matchReferenceWidth = false,
|
|
108
|
+
modifiers,
|
|
109
|
+
referenceElement: externalReferenceElement,
|
|
110
|
+
onFirstUpdate,
|
|
111
|
+
closeOnOutsidePointerDown = true,
|
|
112
|
+
closeOnEscape = true,
|
|
113
|
+
portalled = true,
|
|
114
|
+
}: PopperProps) {
|
|
115
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
116
|
+
const [triggerElement, setTriggerElement] = useState<HTMLElement | null>(null);
|
|
117
|
+
const [contentElement, setContentElement] = useState<HTMLElement | null>(null);
|
|
118
|
+
const [arrowElement, setArrowElement] = useState<HTMLElement | null>(null);
|
|
119
|
+
const [localReferenceElement, setLocalReferenceElement] = useState<Element | null>(null);
|
|
120
|
+
|
|
121
|
+
const currentOpen = open ?? internalOpen;
|
|
122
|
+
const setOpen = useCallback(
|
|
123
|
+
(nextOpen: boolean) => {
|
|
124
|
+
onOpenChange?.(nextOpen);
|
|
125
|
+
if (open === undefined) setInternalOpen(nextOpen);
|
|
126
|
+
},
|
|
127
|
+
[onOpenChange, open],
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<PopperContext.Provider
|
|
132
|
+
value={{
|
|
133
|
+
open: currentOpen,
|
|
134
|
+
setOpen,
|
|
135
|
+
referenceElement: externalReferenceElement ?? localReferenceElement,
|
|
136
|
+
setReferenceElement: setLocalReferenceElement,
|
|
137
|
+
triggerElement,
|
|
138
|
+
setTriggerElement,
|
|
139
|
+
contentElement,
|
|
140
|
+
setContentElement,
|
|
141
|
+
arrowElement,
|
|
142
|
+
setArrowElement,
|
|
143
|
+
placement,
|
|
144
|
+
strategy,
|
|
145
|
+
offset,
|
|
146
|
+
flip,
|
|
147
|
+
preventOverflow,
|
|
148
|
+
arrow,
|
|
149
|
+
matchReferenceWidth,
|
|
150
|
+
modifiers,
|
|
151
|
+
onFirstUpdate,
|
|
152
|
+
closeOnOutsidePointerDown,
|
|
153
|
+
closeOnEscape,
|
|
154
|
+
portalled,
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
{children}
|
|
158
|
+
</PopperContext.Provider>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface PopperTriggerProps {
|
|
163
|
+
children: ReactElement;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function PopperTrigger({ children }: PopperTriggerProps) {
|
|
167
|
+
const ctx = usePopperContext();
|
|
168
|
+
|
|
169
|
+
if (!isValidElement(children)) {
|
|
170
|
+
throw new Error('PopperTrigger requires a single React element child.');
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return cloneElement(children as ReactElement<Record<string, unknown>>, {
|
|
174
|
+
ref: (node: HTMLElement | null) => {
|
|
175
|
+
ctx.setTriggerElement(node);
|
|
176
|
+
ctx.setReferenceElement(node);
|
|
177
|
+
setRef((children as ReactElement<{ ref?: Ref<HTMLElement> }>).props.ref, node);
|
|
178
|
+
},
|
|
179
|
+
'aria-expanded': ctx.open,
|
|
180
|
+
'aria-haspopup': 'dialog' as const,
|
|
181
|
+
onClick: (event: MouseEvent) => {
|
|
182
|
+
const childOnClick = (children.props as Record<string, unknown>).onClick;
|
|
183
|
+
if (typeof childOnClick === 'function') childOnClick(event);
|
|
184
|
+
if (event.defaultPrevented) return;
|
|
185
|
+
ctx.setOpen(!ctx.open);
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export const popperContentVariants = cva(
|
|
191
|
+
'z-50 rounded-lg border border-border bg-popover p-3 text-popover-foreground shadow-md outline-none animate-dropdown-in',
|
|
192
|
+
{
|
|
193
|
+
variants: {
|
|
194
|
+
size: {
|
|
195
|
+
sm: 'w-56',
|
|
196
|
+
md: 'w-72',
|
|
197
|
+
lg: 'w-96',
|
|
198
|
+
auto: 'w-auto',
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
defaultVariants: { size: 'md' },
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
export interface PopperContentProps
|
|
206
|
+
extends HTMLAttributes<HTMLDivElement>,
|
|
207
|
+
VariantProps<typeof popperContentVariants> {
|
|
208
|
+
hideWhenReferenceHidden?: boolean | undefined;
|
|
209
|
+
arrowClassName?: string | undefined;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export const PopperContent = forwardRef<HTMLDivElement, PopperContentProps>(
|
|
213
|
+
function PopperContent(
|
|
214
|
+
{ className, size, hideWhenReferenceHidden = true, arrowClassName, children, style, ...props },
|
|
215
|
+
ref,
|
|
216
|
+
) {
|
|
217
|
+
const ctx = usePopperContext();
|
|
218
|
+
const contentRef = useRef<HTMLDivElement | null>(null);
|
|
219
|
+
const modifiers = useMemo(
|
|
220
|
+
() => createModifiers(ctx, hideWhenReferenceHidden),
|
|
221
|
+
[ctx, hideWhenReferenceHidden],
|
|
222
|
+
);
|
|
223
|
+
const popperOptions = useMemo(
|
|
224
|
+
() => ({
|
|
225
|
+
placement: ctx.placement,
|
|
226
|
+
strategy: ctx.strategy,
|
|
227
|
+
modifiers,
|
|
228
|
+
...(ctx.onFirstUpdate ? { onFirstUpdate: ctx.onFirstUpdate } : {}),
|
|
229
|
+
}),
|
|
230
|
+
[ctx.placement, ctx.strategy, modifiers, ctx.onFirstUpdate],
|
|
231
|
+
);
|
|
232
|
+
const { styles, attributes, state, update } = usePopper(
|
|
233
|
+
ctx.referenceElement,
|
|
234
|
+
ctx.contentElement,
|
|
235
|
+
popperOptions,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
if (!ctx.open || !ctx.closeOnOutsidePointerDown) return;
|
|
240
|
+
const handlePointerDown = (event: PointerEvent) => {
|
|
241
|
+
const target = event.target as Node;
|
|
242
|
+
if (ctx.triggerElement?.contains(target)) return;
|
|
243
|
+
if (contentRef.current?.contains(target)) return;
|
|
244
|
+
ctx.setOpen(false);
|
|
245
|
+
};
|
|
246
|
+
document.addEventListener('pointerdown', handlePointerDown);
|
|
247
|
+
return () => document.removeEventListener('pointerdown', handlePointerDown);
|
|
248
|
+
}, [ctx]);
|
|
249
|
+
|
|
250
|
+
useEffect(() => {
|
|
251
|
+
if (!ctx.open || !ctx.closeOnEscape) return;
|
|
252
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
253
|
+
if (event.key === 'Escape') {
|
|
254
|
+
ctx.setOpen(false);
|
|
255
|
+
ctx.triggerElement?.focus();
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
259
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
260
|
+
}, [ctx]);
|
|
261
|
+
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
if (!ctx.open) return;
|
|
264
|
+
void update?.();
|
|
265
|
+
}, [ctx.open, update]);
|
|
266
|
+
|
|
267
|
+
if (!ctx.open) return null;
|
|
268
|
+
|
|
269
|
+
const isReferenceHidden = state?.modifiersData.hide?.isReferenceHidden === true;
|
|
270
|
+
const content = (
|
|
271
|
+
<div
|
|
272
|
+
ref={(node) => {
|
|
273
|
+
contentRef.current = node;
|
|
274
|
+
ctx.setContentElement(node);
|
|
275
|
+
if (typeof ref === 'function') ref(node);
|
|
276
|
+
else if (ref) ref.current = node;
|
|
277
|
+
}}
|
|
278
|
+
role="dialog"
|
|
279
|
+
data-popper-placement={state?.placement ?? ctx.placement}
|
|
280
|
+
data-reference-hidden={isReferenceHidden ? 'true' : undefined}
|
|
281
|
+
className={cn(
|
|
282
|
+
popperContentVariants({ size }),
|
|
283
|
+
hideWhenReferenceHidden && isReferenceHidden && 'invisible pointer-events-none',
|
|
284
|
+
className,
|
|
285
|
+
)}
|
|
286
|
+
style={{ ...styles.popper, ...style }}
|
|
287
|
+
{...attributes.popper}
|
|
288
|
+
{...props}
|
|
289
|
+
>
|
|
290
|
+
{children}
|
|
291
|
+
{ctx.arrow ? (
|
|
292
|
+
<PopperArrow
|
|
293
|
+
placement={state?.placement ?? ctx.placement}
|
|
294
|
+
className={arrowClassName}
|
|
295
|
+
style={styles.arrow}
|
|
296
|
+
/>
|
|
297
|
+
) : null}
|
|
298
|
+
</div>
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
if (!ctx.portalled || typeof document === 'undefined') return content;
|
|
302
|
+
return createPortal(content, document.body);
|
|
303
|
+
},
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
export interface PopperArrowProps extends HTMLAttributes<HTMLDivElement> {
|
|
307
|
+
placement?: Placement | undefined;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export const PopperArrow = forwardRef<HTMLDivElement, PopperArrowProps>(
|
|
311
|
+
function PopperArrow({ className, placement = 'bottom', style, ...props }, ref) {
|
|
312
|
+
const ctx = usePopperContext();
|
|
313
|
+
const side = placement.split('-')[0] as 'top' | 'bottom' | 'left' | 'right';
|
|
314
|
+
|
|
315
|
+
return (
|
|
316
|
+
<div
|
|
317
|
+
ref={(node) => {
|
|
318
|
+
ctx.setArrowElement(node);
|
|
319
|
+
if (typeof ref === 'function') ref(node);
|
|
320
|
+
else if (ref) ref.current = node;
|
|
321
|
+
}}
|
|
322
|
+
aria-hidden="true"
|
|
323
|
+
data-side={side}
|
|
324
|
+
className={cn(
|
|
325
|
+
'pointer-events-none absolute z-[-1] size-2 rotate-45 border border-border bg-popover',
|
|
326
|
+
side === 'top' && '-bottom-1',
|
|
327
|
+
side === 'bottom' && '-top-1',
|
|
328
|
+
side === 'left' && '-right-1',
|
|
329
|
+
side === 'right' && '-left-1',
|
|
330
|
+
className,
|
|
331
|
+
)}
|
|
332
|
+
style={style}
|
|
333
|
+
{...props}
|
|
334
|
+
/>
|
|
335
|
+
);
|
|
336
|
+
},
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
function setRef<T>(ref: Ref<T> | undefined, value: T | null) {
|
|
340
|
+
if (typeof ref === 'function') ref(value);
|
|
341
|
+
else if (ref) ref.current = value;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function createModifiers(
|
|
345
|
+
ctx: PopperContextValue,
|
|
346
|
+
hideWhenReferenceHidden: boolean,
|
|
347
|
+
): ReadonlyArray<PopperModifier> {
|
|
348
|
+
const builtIn: PopperModifier[] = [
|
|
349
|
+
{
|
|
350
|
+
name: 'offset',
|
|
351
|
+
options: { offset: ctx.offset },
|
|
352
|
+
} as PopperModifier<'offset'>,
|
|
353
|
+
{
|
|
354
|
+
name: 'flip',
|
|
355
|
+
enabled: ctx.flip,
|
|
356
|
+
options: { fallbackPlacements: ['top', 'right', 'bottom', 'left'] },
|
|
357
|
+
} as PopperModifier<'flip'>,
|
|
358
|
+
{
|
|
359
|
+
name: 'preventOverflow',
|
|
360
|
+
enabled: ctx.preventOverflow,
|
|
361
|
+
options: { padding: 8, altAxis: true, tether: true },
|
|
362
|
+
} as PopperModifier<'preventOverflow'>,
|
|
363
|
+
{
|
|
364
|
+
name: 'arrow',
|
|
365
|
+
enabled: ctx.arrow,
|
|
366
|
+
options: { element: ctx.arrowElement, padding: 8 },
|
|
367
|
+
} as PopperModifier<'arrow'>,
|
|
368
|
+
{
|
|
369
|
+
name: 'hide',
|
|
370
|
+
enabled: hideWhenReferenceHidden,
|
|
371
|
+
} as PopperModifier<'hide'>,
|
|
372
|
+
];
|
|
373
|
+
|
|
374
|
+
if (ctx.matchReferenceWidth) {
|
|
375
|
+
builtIn.push(matchReferenceWidthModifier);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return [...builtIn, ...(ctx.modifiers ?? [])];
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const matchReferenceWidthModifier = {
|
|
382
|
+
name: 'matchReferenceWidth',
|
|
383
|
+
enabled: true,
|
|
384
|
+
phase: 'beforeWrite',
|
|
385
|
+
requires: ['computeStyles'],
|
|
386
|
+
fn({ state }: { state: State }) {
|
|
387
|
+
state.styles.popper = {
|
|
388
|
+
...state.styles.popper,
|
|
389
|
+
width: `${state.rects.reference.width}px`,
|
|
390
|
+
};
|
|
391
|
+
},
|
|
392
|
+
effect({ state }: { state: State }) {
|
|
393
|
+
const reference = state.elements.reference;
|
|
394
|
+
if ('getBoundingClientRect' in reference) {
|
|
395
|
+
state.elements.popper.style.width = `${reference.getBoundingClientRect().width}px`;
|
|
396
|
+
}
|
|
397
|
+
return undefined;
|
|
398
|
+
},
|
|
399
|
+
} satisfies PopperModifier<'matchReferenceWidth'>;
|