@fabio.caffarello/react-design-system 3.8.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/granular/index.js +447 -0
- package/dist/granular/index.js.map +1 -0
- package/dist/granular/ui/components/Accordion/Accordion.js +105 -0
- package/dist/granular/ui/components/Accordion/Accordion.js.map +1 -0
- package/dist/granular/ui/components/Autocomplete/Autocomplete.js +133 -0
- package/dist/granular/ui/components/Autocomplete/Autocomplete.js.map +1 -0
- package/dist/granular/ui/components/Autocomplete/AutocompleteList.js +119 -0
- package/dist/granular/ui/components/Autocomplete/AutocompleteList.js.map +1 -0
- package/dist/granular/ui/components/Autocomplete/AutocompleteOption.js +42 -0
- package/dist/granular/ui/components/Autocomplete/AutocompleteOption.js.map +1 -0
- package/dist/granular/ui/components/Breadcrumb/Breadcrumb.js +100 -0
- package/dist/granular/ui/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/granular/ui/components/Card/Card.js +113 -0
- package/dist/granular/ui/components/Card/Card.js.map +1 -0
- package/dist/granular/ui/components/Card/CardActions.js +51 -0
- package/dist/granular/ui/components/Card/CardActions.js.map +1 -0
- package/dist/granular/ui/components/Card/CardBody.js +32 -0
- package/dist/granular/ui/components/Card/CardBody.js.map +1 -0
- package/dist/granular/ui/components/Card/CardHeader.js +47 -0
- package/dist/granular/ui/components/Card/CardHeader.js.map +1 -0
- package/dist/granular/ui/components/Card/CardSubtitle.js +38 -0
- package/dist/granular/ui/components/Card/CardSubtitle.js.map +1 -0
- package/dist/granular/ui/components/Card/CardTitle.js +61 -0
- package/dist/granular/ui/components/Card/CardTitle.js.map +1 -0
- package/dist/granular/ui/components/ColorPicker/ColorPicker.js +250 -0
- package/dist/granular/ui/components/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/granular/ui/components/CommandPalette/CommandPalette.js +274 -0
- package/dist/granular/ui/components/CommandPalette/CommandPalette.js.map +1 -0
- package/dist/granular/ui/components/DashboardLayout/DashboardLayout.js +37 -0
- package/dist/granular/ui/components/DashboardLayout/DashboardLayout.js.map +1 -0
- package/dist/granular/ui/components/DataGrid/DataGrid.js +155 -0
- package/dist/granular/ui/components/DataGrid/DataGrid.js.map +1 -0
- package/dist/granular/ui/components/DataTablePattern/DataTablePattern.js +113 -0
- package/dist/granular/ui/components/DataTablePattern/DataTablePattern.js.map +1 -0
- package/dist/granular/ui/components/DatePicker/DatePicker.js +126 -0
- package/dist/granular/ui/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/granular/ui/components/DatePicker/DatePickerCalendar.js +294 -0
- package/dist/granular/ui/components/DatePicker/DatePickerCalendar.js.map +1 -0
- package/dist/granular/ui/components/DatePicker/DatePickerContext.js +16 -0
- package/dist/granular/ui/components/DatePicker/DatePickerContext.js.map +1 -0
- package/dist/granular/ui/components/DatePicker/DatePickerInput.js +119 -0
- package/dist/granular/ui/components/DatePicker/DatePickerInput.js.map +1 -0
- package/dist/granular/ui/components/DatePicker/DatePickerProvider.js +47 -0
- package/dist/granular/ui/components/DatePicker/DatePickerProvider.js.map +1 -0
- package/dist/granular/ui/components/Dialog/AlertDialog.js +48 -0
- package/dist/granular/ui/components/Dialog/AlertDialog.js.map +1 -0
- package/dist/granular/ui/components/Dialog/Dialog.js +36 -0
- package/dist/granular/ui/components/Dialog/Dialog.js.map +1 -0
- package/dist/granular/ui/components/Dialog/DialogClose.js +34 -0
- package/dist/granular/ui/components/Dialog/DialogClose.js.map +1 -0
- package/dist/granular/ui/components/Dialog/DialogContent.js +114 -0
- package/dist/granular/ui/components/Dialog/DialogContent.js.map +1 -0
- package/dist/granular/ui/components/Dialog/DialogDescription.js +51 -0
- package/dist/granular/ui/components/Dialog/DialogDescription.js.map +1 -0
- package/dist/granular/ui/components/Dialog/DialogFooter.js +45 -0
- package/dist/granular/ui/components/Dialog/DialogFooter.js.map +1 -0
- package/dist/granular/ui/components/Dialog/DialogHeader.js +45 -0
- package/dist/granular/ui/components/Dialog/DialogHeader.js.map +1 -0
- package/dist/granular/ui/components/Dialog/DialogTitle.js +53 -0
- package/dist/granular/ui/components/Dialog/DialogTitle.js.map +1 -0
- package/dist/granular/ui/components/Dialog/DialogTrigger.js +28 -0
- package/dist/granular/ui/components/Dialog/DialogTrigger.js.map +1 -0
- package/dist/granular/ui/components/Drawer/Drawer.js +47 -0
- package/dist/granular/ui/components/Drawer/Drawer.js.map +1 -0
- package/dist/granular/ui/components/Drawer/DrawerContent.js +140 -0
- package/dist/granular/ui/components/Drawer/DrawerContent.js.map +1 -0
- package/dist/granular/ui/components/Drawer/DrawerContext.js +21 -0
- package/dist/granular/ui/components/Drawer/DrawerContext.js.map +1 -0
- package/dist/granular/ui/components/Drawer/DrawerFooter.js +53 -0
- package/dist/granular/ui/components/Drawer/DrawerFooter.js.map +1 -0
- package/dist/granular/ui/components/Drawer/DrawerHeader.js +50 -0
- package/dist/granular/ui/components/Drawer/DrawerHeader.js.map +1 -0
- package/dist/granular/ui/components/Dropdown/Dropdown.js +243 -0
- package/dist/granular/ui/components/Dropdown/Dropdown.js.map +1 -0
- package/dist/granular/ui/components/EmptyState/EmptyState.js +102 -0
- package/dist/granular/ui/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/granular/ui/components/FileUpload/FileUpload.js +342 -0
- package/dist/granular/ui/components/FileUpload/FileUpload.js.map +1 -0
- package/dist/granular/ui/components/FilterChips/FilterChips.js +67 -0
- package/dist/granular/ui/components/FilterChips/FilterChips.js.map +1 -0
- package/dist/granular/ui/components/Form/Form.js +184 -0
- package/dist/granular/ui/components/Form/Form.js.map +1 -0
- package/dist/granular/ui/components/Form/FormContext.js +19 -0
- package/dist/granular/ui/components/Form/FormContext.js.map +1 -0
- package/dist/granular/ui/components/Form/FormField.js +66 -0
- package/dist/granular/ui/components/Form/FormField.js.map +1 -0
- package/dist/granular/ui/components/Form/FormProvider.js +17 -0
- package/dist/granular/ui/components/Form/FormProvider.js.map +1 -0
- package/dist/granular/ui/components/Form/useFormFieldArray.js +29 -0
- package/dist/granular/ui/components/Form/useFormFieldArray.js.map +1 -0
- package/dist/granular/ui/components/FormWizardPattern/FormWizardPattern.js +121 -0
- package/dist/granular/ui/components/FormWizardPattern/FormWizardPattern.js.map +1 -0
- package/dist/granular/ui/components/Header/Header.js +98 -0
- package/dist/granular/ui/components/Header/Header.js.map +1 -0
- package/dist/granular/ui/components/Header/components/HeaderActions.js +21 -0
- package/dist/granular/ui/components/Header/components/HeaderActions.js.map +1 -0
- package/dist/granular/ui/components/Header/components/HeaderHamburger.js +31 -0
- package/dist/granular/ui/components/Header/components/HeaderHamburger.js.map +1 -0
- package/dist/granular/ui/components/Header/components/HeaderLogo.js +50 -0
- package/dist/granular/ui/components/Header/components/HeaderLogo.js.map +1 -0
- package/dist/granular/ui/components/Header/components/HeaderMobileMenu.js +38 -0
- package/dist/granular/ui/components/Header/components/HeaderMobileMenu.js.map +1 -0
- package/dist/granular/ui/components/Header/components/HeaderNavigation.js +27 -0
- package/dist/granular/ui/components/Header/components/HeaderNavigation.js.map +1 -0
- package/dist/granular/ui/components/Header/contexts/HeaderContext.js +49 -0
- package/dist/granular/ui/components/Header/contexts/HeaderContext.js.map +1 -0
- package/dist/granular/ui/components/LoginBox/LoginBox.js +84 -0
- package/dist/granular/ui/components/LoginBox/LoginBox.js.map +1 -0
- package/dist/granular/ui/components/Menu/Menu.js +45 -0
- package/dist/granular/ui/components/Menu/Menu.js.map +1 -0
- package/dist/granular/ui/components/Menu/MenuContent.js +94 -0
- package/dist/granular/ui/components/Menu/MenuContent.js.map +1 -0
- package/dist/granular/ui/components/Menu/MenuContext.js +21 -0
- package/dist/granular/ui/components/Menu/MenuContext.js.map +1 -0
- package/dist/granular/ui/components/Menu/MenuItem.js +93 -0
- package/dist/granular/ui/components/Menu/MenuItem.js.map +1 -0
- package/dist/granular/ui/components/Menu/MenuSeparator.js +46 -0
- package/dist/granular/ui/components/Menu/MenuSeparator.js.map +1 -0
- package/dist/granular/ui/components/Menu/MenuTrigger.js +71 -0
- package/dist/granular/ui/components/Menu/MenuTrigger.js.map +1 -0
- package/dist/granular/ui/components/Modal/Modal.js +171 -0
- package/dist/granular/ui/components/Modal/Modal.js.map +1 -0
- package/dist/granular/ui/components/MultiSelect/MultiSelect.js +193 -0
- package/dist/granular/ui/components/MultiSelect/MultiSelect.js.map +1 -0
- package/dist/granular/ui/components/Navigation/Navigation.js +141 -0
- package/dist/granular/ui/components/Navigation/Navigation.js.map +1 -0
- package/dist/granular/ui/components/PageHeader/PageHeader.js +95 -0
- package/dist/granular/ui/components/PageHeader/PageHeader.js.map +1 -0
- package/dist/granular/ui/components/Pagination/Pagination.js +156 -0
- package/dist/granular/ui/components/Pagination/Pagination.js.map +1 -0
- package/dist/granular/ui/components/Popover/Popover.js +171 -0
- package/dist/granular/ui/components/Popover/Popover.js.map +1 -0
- package/dist/granular/ui/components/Rating/Rating.js +110 -0
- package/dist/granular/ui/components/Rating/Rating.js.map +1 -0
- package/dist/granular/ui/components/SearchAndFilterPattern/SearchAndFilterPattern.js +120 -0
- package/dist/granular/ui/components/SearchAndFilterPattern/SearchAndFilterPattern.js.map +1 -0
- package/dist/granular/ui/components/SearchInput/SearchInput.js +103 -0
- package/dist/granular/ui/components/SearchInput/SearchInput.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/SideNavbar.js +143 -0
- package/dist/granular/ui/components/SideNavbar/SideNavbar.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/Navbar.js +173 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/Navbar.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/NavbarGroup.js +87 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/NavbarGroup.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/NavbarItem.js +242 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/NavbarItem.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/NavbarSeparator.js +66 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/NavbarSeparator.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/NavbarToggle.js +108 -0
- package/dist/granular/ui/components/SideNavbar/components/Navbar/NavbarToggle.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/SideNavbarBackdrop.js +63 -0
- package/dist/granular/ui/components/SideNavbar/components/SideNavbarBackdrop.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/SideNavbarResizeHandle.js +113 -0
- package/dist/granular/ui/components/SideNavbar/components/SideNavbarResizeHandle.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/SideNavbarRoot.js +150 -0
- package/dist/granular/ui/components/SideNavbar/components/SideNavbarRoot.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/SideNavbarToggle.js +197 -0
- package/dist/granular/ui/components/SideNavbar/components/SideNavbarToggle.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/Sidebar.js +108 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/Sidebar.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarContent.js +71 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarContent.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarFooter.js +64 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarFooter.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarGroup.js +141 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarGroup.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarHeader.js +90 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarHeader.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarSlot.js +12 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarSlot.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarSlotContent.js +13 -0
- package/dist/granular/ui/components/SideNavbar/components/Sidebar/SidebarSlotContent.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/contexts/NavbarContext.js +20 -0
- package/dist/granular/ui/components/SideNavbar/contexts/NavbarContext.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SideNavbarConfigContext.js +37 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SideNavbarConfigContext.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SideNavbarStateContext.js +20 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SideNavbarStateContext.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SideNavbarThemeContext.js +28 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SideNavbarThemeContext.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SideNavbarToggleContext.js +19 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SideNavbarToggleContext.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SidebarContext.js +20 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SidebarContext.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SidebarSlotContext.js +22 -0
- package/dist/granular/ui/components/SideNavbar/contexts/SidebarSlotContext.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useFocusManagement.js +43 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useFocusManagement.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useGroupState.js +59 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useGroupState.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useKeyboardShortcut.js +34 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useKeyboardShortcut.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useResize.js +58 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useResize.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useResponsiveSidebar.js +35 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useResponsiveSidebar.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useSideNavbar.js +21 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useSideNavbar.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useSideNavbarContent.js +19 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useSideNavbarContent.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useSideNavbarNavigation.js +21 -0
- package/dist/granular/ui/components/SideNavbar/hooks/useSideNavbarNavigation.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/providers/SideNavbarConfigProvider.js +61 -0
- package/dist/granular/ui/components/SideNavbar/providers/SideNavbarConfigProvider.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/providers/SideNavbarProvider.js +82 -0
- package/dist/granular/ui/components/SideNavbar/providers/SideNavbarProvider.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/providers/SideNavbarStateProvider.js +165 -0
- package/dist/granular/ui/components/SideNavbar/providers/SideNavbarStateProvider.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/providers/SideNavbarThemeProvider.js +34 -0
- package/dist/granular/ui/components/SideNavbar/providers/SideNavbarThemeProvider.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/providers/SidebarSlotProvider.js +28 -0
- package/dist/granular/ui/components/SideNavbar/providers/SidebarSlotProvider.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/utils/parseKeyboardShortcut.js +60 -0
- package/dist/granular/ui/components/SideNavbar/utils/parseKeyboardShortcut.js.map +1 -0
- package/dist/granular/ui/components/SideNavbar/utils/parseWidth.js +19 -0
- package/dist/granular/ui/components/SideNavbar/utils/parseWidth.js.map +1 -0
- package/dist/granular/ui/components/Stat/Stat.js +84 -0
- package/dist/granular/ui/components/Stat/Stat.js.map +1 -0
- package/dist/granular/ui/components/Stat/StatGroup.js +61 -0
- package/dist/granular/ui/components/Stat/StatGroup.js.map +1 -0
- package/dist/granular/ui/components/Stepper/Stepper.js +248 -0
- package/dist/granular/ui/components/Stepper/Stepper.js.map +1 -0
- package/dist/granular/ui/components/Table/Table.js +162 -0
- package/dist/granular/ui/components/Table/Table.js.map +1 -0
- package/dist/granular/ui/components/Table/TableActions/TableActions.js +67 -0
- package/dist/granular/ui/components/Table/TableActions/TableActions.js.map +1 -0
- package/dist/granular/ui/components/Table/TableActions.js +44 -0
- package/dist/granular/ui/components/Table/TableActions.js.map +1 -0
- package/dist/granular/ui/components/Table/TableBody.js +134 -0
- package/dist/granular/ui/components/Table/TableBody.js.map +1 -0
- package/dist/granular/ui/components/Table/TableCell.js +40 -0
- package/dist/granular/ui/components/Table/TableCell.js.map +1 -0
- package/dist/granular/ui/components/Table/TableContext.js +19 -0
- package/dist/granular/ui/components/Table/TableContext.js.map +1 -0
- package/dist/granular/ui/components/Table/TableEmptyState.js +62 -0
- package/dist/granular/ui/components/Table/TableEmptyState.js.map +1 -0
- package/dist/granular/ui/components/Table/TableFilters/TableFilters.js +189 -0
- package/dist/granular/ui/components/Table/TableFilters/TableFilters.js.map +1 -0
- package/dist/granular/ui/components/Table/TableFilters.js +48 -0
- package/dist/granular/ui/components/Table/TableFilters.js.map +1 -0
- package/dist/granular/ui/components/Table/TableHeader.js +45 -0
- package/dist/granular/ui/components/Table/TableHeader.js.map +1 -0
- package/dist/granular/ui/components/Table/TableHeaderCell.js +117 -0
- package/dist/granular/ui/components/Table/TableHeaderCell.js.map +1 -0
- package/dist/granular/ui/components/Table/TableHeaderRow.js +89 -0
- package/dist/granular/ui/components/Table/TableHeaderRow.js.map +1 -0
- package/dist/granular/ui/components/Table/TablePagination/TablePagination.js +216 -0
- package/dist/granular/ui/components/Table/TablePagination/TablePagination.js.map +1 -0
- package/dist/granular/ui/components/Table/TablePagination.js +56 -0
- package/dist/granular/ui/components/Table/TablePagination.js.map +1 -0
- package/dist/granular/ui/components/Table/TableProvider.js +244 -0
- package/dist/granular/ui/components/Table/TableProvider.js.map +1 -0
- package/dist/granular/ui/components/Table/TableRow.js +95 -0
- package/dist/granular/ui/components/Table/TableRow.js.map +1 -0
- package/dist/granular/ui/components/Table/useColumnResizing.js +71 -0
- package/dist/granular/ui/components/Table/useColumnResizing.js.map +1 -0
- package/dist/granular/ui/components/Table/useVirtualScrolling.js +50 -0
- package/dist/granular/ui/components/Table/useVirtualScrolling.js.map +1 -0
- package/dist/granular/ui/components/Tabs/Tabs.js +39 -0
- package/dist/granular/ui/components/Tabs/Tabs.js.map +1 -0
- package/dist/granular/ui/components/Tabs/TabsContent.js +59 -0
- package/dist/granular/ui/components/Tabs/TabsContent.js.map +1 -0
- package/dist/granular/ui/components/Tabs/TabsContext.js +18 -0
- package/dist/granular/ui/components/Tabs/TabsContext.js.map +1 -0
- package/dist/granular/ui/components/Tabs/TabsList.js +84 -0
- package/dist/granular/ui/components/Tabs/TabsList.js.map +1 -0
- package/dist/granular/ui/components/Tabs/TabsProvider.js +31 -0
- package/dist/granular/ui/components/Tabs/TabsProvider.js.map +1 -0
- package/dist/granular/ui/components/Tabs/TabsTrigger.js +103 -0
- package/dist/granular/ui/components/Tabs/TabsTrigger.js.map +1 -0
- package/dist/granular/ui/components/TimePicker/TimePicker.js +216 -0
- package/dist/granular/ui/components/TimePicker/TimePicker.js.map +1 -0
- package/dist/granular/ui/components/Timeline/Timeline.js +152 -0
- package/dist/granular/ui/components/Timeline/Timeline.js.map +1 -0
- package/dist/granular/ui/components/Toast/Toast.js +159 -0
- package/dist/granular/ui/components/Toast/Toast.js.map +1 -0
- package/dist/granular/ui/components/Toast/ToastContainer.js +41 -0
- package/dist/granular/ui/components/Toast/ToastContainer.js.map +1 -0
- package/dist/granular/ui/components/Toast/useToast.js +64 -0
- package/dist/granular/ui/components/Toast/useToast.js.map +1 -0
- package/dist/granular/ui/hooks/createGenericContext.js +27 -0
- package/dist/granular/ui/hooks/createGenericContext.js.map +1 -0
- package/dist/granular/ui/hooks/focusable.js +14 -0
- package/dist/granular/ui/hooks/focusable.js.map +1 -0
- package/dist/granular/ui/hooks/useAutoFocus.js +23 -0
- package/dist/granular/ui/hooks/useAutoFocus.js.map +1 -0
- package/dist/granular/ui/hooks/useCollapsible.js +37 -0
- package/dist/granular/ui/hooks/useCollapsible.js.map +1 -0
- package/dist/granular/ui/hooks/useFocusRestore.js +20 -0
- package/dist/granular/ui/hooks/useFocusRestore.js.map +1 -0
- package/dist/granular/ui/hooks/useFocusTrap.js +31 -0
- package/dist/granular/ui/hooks/useFocusTrap.js.map +1 -0
- package/dist/granular/ui/hooks/useScrollSpy.js +23 -0
- package/dist/granular/ui/hooks/useScrollSpy.js.map +1 -0
- package/dist/granular/ui/layouts/Container/Container.js +73 -0
- package/dist/granular/ui/layouts/Container/Container.js.map +1 -0
- package/dist/granular/ui/layouts/Stack/Stack.js +79 -0
- package/dist/granular/ui/layouts/Stack/Stack.js.map +1 -0
- package/dist/granular/ui/primitives/Avatar/Avatar.js +122 -0
- package/dist/granular/ui/primitives/Avatar/Avatar.js.map +1 -0
- package/dist/granular/ui/primitives/Avatar/AvatarGroup.js +97 -0
- package/dist/granular/ui/primitives/Avatar/AvatarGroup.js.map +1 -0
- package/dist/granular/ui/primitives/Badge/Badge.js +212 -0
- package/dist/granular/ui/primitives/Badge/Badge.js.map +1 -0
- package/dist/granular/ui/primitives/Button/Button.js +288 -0
- package/dist/granular/ui/primitives/Button/Button.js.map +1 -0
- package/dist/granular/ui/primitives/Checkbox/Checkbox.js +129 -0
- package/dist/granular/ui/primitives/Checkbox/Checkbox.js.map +1 -0
- package/dist/granular/ui/primitives/Chip/Chip.js +206 -0
- package/dist/granular/ui/primitives/Chip/Chip.js.map +1 -0
- package/dist/granular/ui/primitives/Collapsible/Collapsible.js +115 -0
- package/dist/granular/ui/primitives/Collapsible/Collapsible.js.map +1 -0
- package/dist/granular/ui/primitives/ErrorMessage/ErrorMessage.js +54 -0
- package/dist/granular/ui/primitives/ErrorMessage/ErrorMessage.js.map +1 -0
- package/dist/granular/ui/primitives/Info/Info.js +57 -0
- package/dist/granular/ui/primitives/Info/Info.js.map +1 -0
- package/dist/granular/ui/primitives/Input/Input.js +351 -0
- package/dist/granular/ui/primitives/Input/Input.js.map +1 -0
- package/dist/granular/ui/primitives/Label/Label.js +61 -0
- package/dist/granular/ui/primitives/Label/Label.js.map +1 -0
- package/dist/granular/ui/primitives/NavLink/NavLink.js +229 -0
- package/dist/granular/ui/primitives/NavLink/NavLink.js.map +1 -0
- package/dist/granular/ui/primitives/NavLink/hooks/useNavLink.js +15 -0
- package/dist/granular/ui/primitives/NavLink/hooks/useNavLink.js.map +1 -0
- package/dist/granular/ui/primitives/Progress/Progress.js +182 -0
- package/dist/granular/ui/primitives/Progress/Progress.js.map +1 -0
- package/dist/granular/ui/primitives/Radio/Radio.js +118 -0
- package/dist/granular/ui/primitives/Radio/Radio.js.map +1 -0
- package/dist/granular/ui/primitives/Select/Select.js +210 -0
- package/dist/granular/ui/primitives/Select/Select.js.map +1 -0
- package/dist/granular/ui/primitives/Separator/Separator.js +69 -0
- package/dist/granular/ui/primitives/Separator/Separator.js.map +1 -0
- package/dist/granular/ui/primitives/Skeleton/Skeleton.js +87 -0
- package/dist/granular/ui/primitives/Skeleton/Skeleton.js.map +1 -0
- package/dist/granular/ui/primitives/Slider/Slider.js +291 -0
- package/dist/granular/ui/primitives/Slider/Slider.js.map +1 -0
- package/dist/granular/ui/primitives/Spinner/Spinner.js +95 -0
- package/dist/granular/ui/primitives/Spinner/Spinner.js.map +1 -0
- package/dist/granular/ui/primitives/Switch/Switch.js +212 -0
- package/dist/granular/ui/primitives/Switch/Switch.js.map +1 -0
- package/dist/granular/ui/primitives/Text/Text.js +118 -0
- package/dist/granular/ui/primitives/Text/Text.js.map +1 -0
- package/dist/granular/ui/primitives/Textarea/Textarea.js +129 -0
- package/dist/granular/ui/primitives/Textarea/Textarea.js.map +1 -0
- package/dist/granular/ui/primitives/Tooltip/Tooltip.js +227 -0
- package/dist/granular/ui/primitives/Tooltip/Tooltip.js.map +1 -0
- package/dist/granular/ui/providers/AppProvider.js +50 -0
- package/dist/granular/ui/providers/AppProvider.js.map +1 -0
- package/dist/granular/ui/providers/ConfigProvider.js +95 -0
- package/dist/granular/ui/providers/ConfigProvider.js.map +1 -0
- package/dist/granular/ui/providers/DialogContext.js +20 -0
- package/dist/granular/ui/providers/DialogContext.js.map +1 -0
- package/dist/granular/ui/providers/DialogProvider.js +32 -0
- package/dist/granular/ui/providers/DialogProvider.js.map +1 -0
- package/dist/granular/ui/providers/ThemeProvider.js +56 -0
- package/dist/granular/ui/providers/ThemeProvider.js.map +1 -0
- package/dist/granular/ui/providers/ToastContext.js +20 -0
- package/dist/granular/ui/providers/ToastContext.js.map +1 -0
- package/dist/granular/ui/providers/ToastProvider.js +47 -0
- package/dist/granular/ui/providers/ToastProvider.js.map +1 -0
- package/dist/granular/ui/providers/providers-bundle.js +23 -0
- package/dist/granular/ui/providers/providers-bundle.js.map +1 -0
- package/dist/granular/ui/tokens/animations.js +106 -0
- package/dist/granular/ui/tokens/animations.js.map +1 -0
- package/dist/granular/ui/tokens/borders.js +54 -0
- package/dist/granular/ui/tokens/borders.js.map +1 -0
- package/dist/granular/ui/tokens/breakpoints.js +43 -0
- package/dist/granular/ui/tokens/breakpoints.js.map +1 -0
- package/dist/granular/ui/tokens/colors/brand.js +67 -0
- package/dist/granular/ui/tokens/colors/brand.js.map +1 -0
- package/dist/granular/ui/tokens/colors/index.js +25 -0
- package/dist/granular/ui/tokens/colors/index.js.map +1 -0
- package/dist/granular/ui/tokens/colors/primitives.js +320 -0
- package/dist/granular/ui/tokens/colors/primitives.js.map +1 -0
- package/dist/granular/ui/tokens/colors/semantic.js +212 -0
- package/dist/granular/ui/tokens/colors/semantic.js.map +1 -0
- package/dist/granular/ui/tokens/colors/types.js +18 -0
- package/dist/granular/ui/tokens/colors/types.js.map +1 -0
- package/dist/granular/ui/tokens/colors/utils.js +131 -0
- package/dist/granular/ui/tokens/colors/utils.js.map +1 -0
- package/dist/granular/ui/tokens/opacity.js +59 -0
- package/dist/granular/ui/tokens/opacity.js.map +1 -0
- package/dist/granular/ui/tokens/radius.js +76 -0
- package/dist/granular/ui/tokens/radius.js.map +1 -0
- package/dist/granular/ui/tokens/shadows.js +63 -0
- package/dist/granular/ui/tokens/shadows.js.map +1 -0
- package/dist/granular/ui/tokens/sidebar.js +92 -0
- package/dist/granular/ui/tokens/sidebar.js.map +1 -0
- package/dist/granular/ui/tokens/spacing.js +143 -0
- package/dist/granular/ui/tokens/spacing.js.map +1 -0
- package/dist/granular/ui/tokens/switch.js +51 -0
- package/dist/granular/ui/tokens/switch.js.map +1 -0
- package/dist/granular/ui/tokens/typography.js +146 -0
- package/dist/granular/ui/tokens/typography.js.map +1 -0
- package/dist/granular/ui/tokens/z-index.js +79 -0
- package/dist/granular/ui/tokens/z-index.js.map +1 -0
- package/dist/granular/ui/utils/cn.js +10 -0
- package/dist/granular/ui/utils/cn.js.map +1 -0
- package/dist/granular/ui/utils/cva.js +14 -0
- package/dist/granular/ui/utils/cva.js.map +1 -0
- package/dist/granular/ui/utils/mergeRefs.js +11 -0
- package/dist/granular/ui/utils/mergeRefs.js.map +1 -0
- package/dist/granular/vite.svg +1 -0
- package/dist/index.cjs +46 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1172 -1135
- package/dist/index.js.map +1 -1
- package/dist/react-design-system.css +1 -1
- package/dist/server/index.cjs +23 -23
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +882 -1179
- package/dist/server/index.js.map +1 -1
- package/dist/ui/components/FilterChips/FilterChips.d.ts +83 -0
- package/dist/ui/components/FilterChips/index.d.ts +2 -0
- package/dist/ui/components/index.d.ts +2 -0
- package/dist/ui/server.d.ts +2 -0
- package/package.json +9 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { createPortal as f } from "react-dom";
|
|
4
|
+
import { useToastContext as p } from "../../providers/ToastContext.js";
|
|
5
|
+
import { getZIndexClass as d } from "../../tokens/z-index.js";
|
|
6
|
+
import { Toast as u } from "./Toast.js";
|
|
7
|
+
function g({
|
|
8
|
+
position: t = "top-right",
|
|
9
|
+
maxToasts: o
|
|
10
|
+
}) {
|
|
11
|
+
const { toasts: e, removeToast: a } = p(), n = o ? e.slice(0, o) : e;
|
|
12
|
+
if (n.length === 0) return null;
|
|
13
|
+
const i = /* @__PURE__ */ s(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: `fixed inset-0 pointer-events-none ${d("toast")}`,
|
|
17
|
+
"aria-live": "polite",
|
|
18
|
+
"aria-label": "Notifications",
|
|
19
|
+
children: n.map((r, m) => {
|
|
20
|
+
const c = t.includes("top"), l = 1 + m * 5;
|
|
21
|
+
return /* @__PURE__ */ s(
|
|
22
|
+
u,
|
|
23
|
+
{
|
|
24
|
+
toast: r,
|
|
25
|
+
onDismiss: a,
|
|
26
|
+
position: t,
|
|
27
|
+
style: {
|
|
28
|
+
[c ? "top" : "bottom"]: `${l}rem`
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
r.id
|
|
32
|
+
);
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
return typeof window != "undefined" ? f(i, document.body) : i;
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
g as ToastContainer
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=ToastContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContainer.js","sources":["../../../../../src/ui/components/Toast/ToastContainer.tsx"],"sourcesContent":["\"use client\";\n\nimport { createPortal } from \"react-dom\";\nimport { useToastContext } from \"../../providers/ToastContext\";\nimport { getZIndexClass } from \"../../tokens/z-index\";\nimport { Toast } from \"./Toast\";\n\nexport interface ToastContainerProps {\n position?:\n | \"top-right\"\n | \"top-left\"\n | \"bottom-right\"\n | \"bottom-left\"\n | \"top-center\"\n | \"bottom-center\";\n maxToasts?: number;\n}\n\nexport function ToastContainer({\n position = \"top-right\",\n maxToasts,\n}: ToastContainerProps) {\n const { toasts, removeToast } = useToastContext();\n\n const toastsToShow = maxToasts ? toasts.slice(0, maxToasts) : toasts;\n\n if (toastsToShow.length === 0) return null;\n\n const container = (\n <div\n className={`fixed inset-0 pointer-events-none ${getZIndexClass(\"toast\")}`}\n aria-live=\"polite\"\n aria-label=\"Notifications\"\n >\n {toastsToShow.map((toast, index) => {\n const isTop = position.includes(\"top\");\n // Calculate offset: base 1rem + (index * 5rem for spacing)\n const offset = 1 + index * 5;\n\n return (\n <Toast\n key={toast.id}\n toast={toast}\n onDismiss={removeToast}\n position={position}\n style={{\n [isTop ? \"top\" : \"bottom\"]: `${offset}rem`,\n }}\n />\n );\n })}\n </div>\n );\n\n // Portal rendering\n if (typeof window !== \"undefined\") {\n return createPortal(container, document.body);\n }\n\n return container;\n}\n"],"names":["ToastContainer","position","maxToasts","toasts","removeToast","useToastContext","toastsToShow","container","jsx","getZIndexClass","toast","index","isTop","offset","Toast","createPortal"],"mappings":";;;;;;AAkBO,SAASA,EAAe;AAAA,EAC7B,UAAAC,IAAW;AAAA,EACX,WAAAC;AACF,GAAwB;AACtB,QAAM,EAAE,QAAAC,GAAQ,aAAAC,EAAA,IAAgBC,EAAA,GAE1BC,IAAeJ,IAAYC,EAAO,MAAM,GAAGD,CAAS,IAAIC;AAE9D,MAAIG,EAAa,WAAW,EAAG,QAAO;AAEtC,QAAMC,IACJ,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,qCAAqCC,EAAe,OAAO,CAAC;AAAA,MACvE,aAAU;AAAA,MACV,cAAW;AAAA,MAEV,UAAAH,EAAa,IAAI,CAACI,GAAOC,MAAU;AAClC,cAAMC,IAAQX,EAAS,SAAS,KAAK,GAE/BY,IAAS,IAAIF,IAAQ;AAE3B,eACE,gBAAAH;AAAA,UAACM;AAAA,UAAA;AAAA,YAEC,OAAAJ;AAAA,YACA,WAAWN;AAAA,YACX,UAAAH;AAAA,YACA,OAAO;AAAA,cACL,CAACW,IAAQ,QAAQ,QAAQ,GAAG,GAAGC,CAAM;AAAA,YAAA;AAAA,UACvC;AAAA,UANKH,EAAM;AAAA,QAAA;AAAA,MASjB,CAAC;AAAA,IAAA;AAAA,EAAA;AAKL,SAAI,OAAO,UAAW,cACbK,EAAaR,GAAW,SAAS,IAAI,IAGvCA;AACT;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var b = Object.defineProperty;
|
|
3
|
+
var u = Object.getOwnPropertySymbols;
|
|
4
|
+
var g = Object.prototype.hasOwnProperty, h = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var l = (o, t, n) => t in o ? b(o, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[t] = n, c = (o, t) => {
|
|
6
|
+
for (var n in t || (t = {}))
|
|
7
|
+
g.call(t, n) && l(o, n, t[n]);
|
|
8
|
+
if (u)
|
|
9
|
+
for (var n of u(t))
|
|
10
|
+
h.call(t, n) && l(o, n, t[n]);
|
|
11
|
+
return o;
|
|
12
|
+
};
|
|
13
|
+
import { useCallback as s } from "react";
|
|
14
|
+
import { useToastContext as k } from "../../providers/ToastContext.js";
|
|
15
|
+
function A() {
|
|
16
|
+
const { addToast: o, removeToast: t, clearAll: n } = k(), a = s(
|
|
17
|
+
(r) => o({
|
|
18
|
+
title: r.title,
|
|
19
|
+
description: r.description,
|
|
20
|
+
variant: r.variant || "info",
|
|
21
|
+
duration: r.duration,
|
|
22
|
+
action: r.action
|
|
23
|
+
}),
|
|
24
|
+
[o]
|
|
25
|
+
), d = s(
|
|
26
|
+
(r, i, e) => a(c({ title: r, description: i, variant: "success" }, e)),
|
|
27
|
+
[a]
|
|
28
|
+
), f = s(
|
|
29
|
+
(r, i, e) => a(c({ title: r, description: i, variant: "error" }, e)),
|
|
30
|
+
[a]
|
|
31
|
+
), v = s(
|
|
32
|
+
(r, i, e) => a(c({ title: r, description: i, variant: "warning" }, e)),
|
|
33
|
+
[a]
|
|
34
|
+
), m = s(
|
|
35
|
+
(r, i, e) => a(c({ title: r, description: i, variant: "info" }, e)),
|
|
36
|
+
[a]
|
|
37
|
+
), w = s(
|
|
38
|
+
(r, i, e, T = "info", C) => a({
|
|
39
|
+
title: r,
|
|
40
|
+
description: i,
|
|
41
|
+
variant: T,
|
|
42
|
+
duration: C,
|
|
43
|
+
action: {
|
|
44
|
+
label: "Undo",
|
|
45
|
+
onClick: e
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
[a]
|
|
49
|
+
);
|
|
50
|
+
return {
|
|
51
|
+
show: a,
|
|
52
|
+
success: d,
|
|
53
|
+
error: f,
|
|
54
|
+
warning: v,
|
|
55
|
+
info: m,
|
|
56
|
+
withUndo: w,
|
|
57
|
+
dismiss: t,
|
|
58
|
+
clearAll: n
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
A as useToast
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=useToast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToast.js","sources":["../../../../../src/ui/components/Toast/useToast.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback } from \"react\";\nimport {\n useToastContext,\n type ToastVariant,\n} from \"../../providers/ToastContext\";\n\nexport interface ToastOptions {\n title: string;\n description?: string;\n variant?: ToastVariant;\n duration?: number; // in milliseconds, undefined = no auto-dismiss\n action?: {\n label: string;\n onClick: () => void;\n };\n}\n\n/**\n * useToast Hook\n *\n * Hook for showing toast notifications.\n *\n * @example\n * ```tsx\n * const toast = useToast();\n *\n * toast.success('Success!', 'Operation completed successfully');\n * toast.error('Error!', 'Something went wrong');\n * toast.info('Info', 'Here is some information');\n * toast.warning('Warning', 'Please be careful');\n * ```\n */\nexport function useToast() {\n const { addToast, removeToast, clearAll } = useToastContext();\n\n const show = useCallback(\n (options: ToastOptions) => {\n return addToast({\n title: options.title,\n description: options.description,\n variant: options.variant || \"info\",\n duration: options.duration,\n action: options.action,\n });\n },\n [addToast],\n );\n\n const success = useCallback(\n (\n title: string,\n description?: string,\n options?: Omit<ToastOptions, \"title\" | \"description\" | \"variant\">,\n ) => {\n return show({ title, description, variant: \"success\", ...options });\n },\n [show],\n );\n\n const error = useCallback(\n (\n title: string,\n description?: string,\n options?: Omit<ToastOptions, \"title\" | \"description\" | \"variant\">,\n ) => {\n return show({ title, description, variant: \"error\", ...options });\n },\n [show],\n );\n\n const warning = useCallback(\n (\n title: string,\n description?: string,\n options?: Omit<ToastOptions, \"title\" | \"description\" | \"variant\">,\n ) => {\n return show({ title, description, variant: \"warning\", ...options });\n },\n [show],\n );\n\n const info = useCallback(\n (\n title: string,\n description?: string,\n options?: Omit<ToastOptions, \"title\" | \"description\" | \"variant\">,\n ) => {\n return show({ title, description, variant: \"info\", ...options });\n },\n [show],\n );\n\n const withUndo = useCallback(\n (\n title: string,\n description: string | undefined,\n onUndo: () => void,\n variant: ToastVariant = \"info\",\n duration?: number,\n ) => {\n return show({\n title,\n description,\n variant,\n duration,\n action: {\n label: \"Undo\",\n onClick: onUndo,\n },\n });\n },\n [show],\n );\n\n return {\n show,\n success,\n error,\n warning,\n info,\n withUndo,\n dismiss: removeToast,\n clearAll,\n };\n}\n"],"names":["useToast","addToast","removeToast","clearAll","useToastContext","show","useCallback","options","success","title","description","__spreadValues","error","warning","info","withUndo","onUndo","variant","duration"],"mappings":";;;;;;;;;;;;;;AAkCO,SAASA,IAAW;AACzB,QAAM,EAAE,UAAAC,GAAU,aAAAC,GAAa,UAAAC,EAAA,IAAaC,EAAA,GAEtCC,IAAOC;AAAA,IACX,CAACC,MACQN,EAAS;AAAA,MACd,OAAOM,EAAQ;AAAA,MACf,aAAaA,EAAQ;AAAA,MACrB,SAASA,EAAQ,WAAW;AAAA,MAC5B,UAAUA,EAAQ;AAAA,MAClB,QAAQA,EAAQ;AAAA,IAAA,CACjB;AAAA,IAEH,CAACN,CAAQ;AAAA,EAAA,GAGLO,IAAUF;AAAA,IACd,CACEG,GACAC,GACAH,MAEOF,EAAKM,EAAA,EAAE,OAAAF,GAAO,aAAAC,GAAa,SAAS,aAAcH,EAAS;AAAA,IAEpE,CAACF,CAAI;AAAA,EAAA,GAGDO,IAAQN;AAAA,IACZ,CACEG,GACAC,GACAH,MAEOF,EAAKM,EAAA,EAAE,OAAAF,GAAO,aAAAC,GAAa,SAAS,WAAYH,EAAS;AAAA,IAElE,CAACF,CAAI;AAAA,EAAA,GAGDQ,IAAUP;AAAA,IACd,CACEG,GACAC,GACAH,MAEOF,EAAKM,EAAA,EAAE,OAAAF,GAAO,aAAAC,GAAa,SAAS,aAAcH,EAAS;AAAA,IAEpE,CAACF,CAAI;AAAA,EAAA,GAGDS,IAAOR;AAAA,IACX,CACEG,GACAC,GACAH,MAEOF,EAAKM,EAAA,EAAE,OAAAF,GAAO,aAAAC,GAAa,SAAS,UAAWH,EAAS;AAAA,IAEjE,CAACF,CAAI;AAAA,EAAA,GAGDU,IAAWT;AAAA,IACf,CACEG,GACAC,GACAM,GACAC,IAAwB,QACxBC,MAEOb,EAAK;AAAA,MACV,OAAAI;AAAA,MACA,aAAAC;AAAA,MACA,SAAAO;AAAA,MACA,UAAAC;AAAA,MACA,QAAQ;AAAA,QACN,OAAO;AAAA,QACP,SAASF;AAAA,MAAA;AAAA,IACX,CACD;AAAA,IAEH,CAACX,CAAI;AAAA,EAAA;AAGP,SAAO;AAAA,IACL,MAAAA;AAAA,IACA,SAAAG;AAAA,IACA,OAAAI;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAASb;AAAA,IACT,UAAAC;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as a, useContext as n } from "react";
|
|
4
|
+
function f(r) {
|
|
5
|
+
const e = a(void 0);
|
|
6
|
+
e.displayName = r.displayName;
|
|
7
|
+
function o({
|
|
8
|
+
value: t,
|
|
9
|
+
children: c
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ s(e.Provider, { value: t, children: c });
|
|
12
|
+
}
|
|
13
|
+
function i() {
|
|
14
|
+
const t = n(e);
|
|
15
|
+
if (t === void 0)
|
|
16
|
+
throw new Error(r.errorMessage);
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
function u() {
|
|
20
|
+
return n(e);
|
|
21
|
+
}
|
|
22
|
+
return { Context: e, Provider: o, useContextRequired: i, useContextOptional: u };
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
f as createGenericContext
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=createGenericContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGenericContext.js","sources":["../../../../src/ui/hooks/createGenericContext.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useContext,\n type Context,\n type JSX,\n type ReactNode,\n} from \"react\";\n\n/**\n * Options for createGenericContext.\n */\nexport interface CreateGenericContextOptions {\n /**\n * displayName surfaced in React DevTools for the underlying Context.\n */\n displayName: string;\n /**\n * Error thrown by the required hook when called outside the Provider\n * tree. Keep this verbatim to whatever the legacy hook threw — it is\n * a behavioural contract consumers rely on.\n */\n errorMessage: string;\n}\n\n/**\n * Surface returned by createGenericContext.\n *\n * @typeParam TBase - The \"default\" shape stored in the underlying\n * React Context. For generic context families this is the type fully\n * instantiated at the default generic argument (e.g. for\n * `XxxContextValue<TGeneric extends Base = Base>` use\n * `XxxContextValue` — no argument — which TS resolves to the default).\n */\nexport interface GenericContext<TBase> {\n /**\n * Raw React Context object. Exposed unchanged so existing consumers\n * (especially `useContextSelector`) keep working. `useContext(Context)`\n * returns `TBase | undefined`; the typed hooks below carry the\n * per-call generic.\n */\n Context: Context<TBase | undefined>;\n /**\n * Generic Provider. Accepts `value` typed at the per-call `TSpecific`,\n * not at `TBase`, so each call site is cast-free.\n *\n * Inside, the single `as TBase` assignment encodes the cost of React's\n * invariant Context typing — see the implementation comment for the\n * full reason.\n */\n Provider: <TSpecific = TBase>(props: {\n value: TSpecific;\n children: ReactNode;\n }) => JSX.Element;\n // Note: TSpecific is intentionally unconstrained — see implementation\n // comment for the invariance reason. The two casts inside the helper\n // are the entire price; consumer sites stay cast-free.\n /**\n * Required hook. Returns the context value typed at the per-call\n * `TSpecific` (defaults to `TBase`). Throws `options.errorMessage`\n * when called outside the Provider tree.\n */\n useContextRequired: <TSpecific = TBase>() => TSpecific;\n /**\n * Optional variant — returns `undefined` outside the Provider tree\n * instead of throwing.\n */\n useContextOptional: <TSpecific = TBase>() => TSpecific | undefined;\n}\n\n/**\n * Build a React Context family where the value carries a per-call\n * generic that is preserved at the Provider and at the consuming hook\n * site, without spreading `as unknown as` casts through every consumer.\n *\n * The motivation: React's `Context<T>` is invariant in `T`. A generic\n * value type whose generic flows into an invariant inner position\n * (e.g. `UseFormReturn<T>` inside `FormContextValue<T>`, or\n * `TableColumn<T>` / `(row: T) => …` inside `TableContextValue<T>`)\n * cannot be made structurally assignable to its default-generic\n * counterpart. The cast is irreducible. This factory confines it to\n * three sites inside the helper — the Provider value and both hook\n * returns — and consumers stay cast-free.\n *\n * @example\n * ```ts\n * const formContext = createGenericContext<FormContextValue>({\n * displayName: \"FormContext\",\n * errorMessage: \"useFormContext must be used within a Form …\",\n * });\n *\n * export const FormContext = formContext.Context;\n * export function useFormContext<T extends FieldValues = FieldValues>() {\n * return formContext.useContextRequired<FormContextValue<T>>();\n * }\n * ```\n */\nexport function createGenericContext<TBase>(\n options: CreateGenericContextOptions,\n): GenericContext<TBase> {\n const Context = createContext<TBase | undefined>(undefined);\n Context.displayName = options.displayName;\n\n function Provider<TSpecific = TBase>({\n value,\n children,\n }: {\n value: TSpecific;\n children: ReactNode;\n }): JSX.Element {\n // React.Context is invariant in its value type. TSpecific is whatever\n // the per-call site uses (e.g. FormContextValue<MyForm>); TBase is\n // the same family at its default generic (FormContextValue<FieldValues>).\n // When the per-call generic flows into an invariant inner position\n // (UseFormReturn<T> inside FormContextValue<T>; TableColumn<T> inside\n // TableContextValue<T>), the two types have no structural overlap\n // from TS's perspective — TS itself recommends going through\n // `unknown`. We do, but we confine it here so every consumer site\n // stays cast-free.\n return (\n <Context.Provider value={value as unknown as TBase}>\n {children}\n </Context.Provider>\n );\n }\n\n function useContextRequired<TSpecific = TBase>(): TSpecific {\n const value = useContext(Context);\n if (value === undefined) {\n throw new Error(options.errorMessage);\n }\n // Symmetric to the Provider cast — same invariance reason.\n return value as unknown as TSpecific;\n }\n\n function useContextOptional<TSpecific = TBase>(): TSpecific | undefined {\n return useContext(Context) as unknown as TSpecific | undefined;\n }\n\n return { Context, Provider, useContextRequired, useContextOptional };\n}\n"],"names":["createGenericContext","options","Context","createContext","Provider","value","children","jsx","useContextRequired","useContext","useContextOptional"],"mappings":";;;AAkGO,SAASA,EACdC,GACuB;AACvB,QAAMC,IAAUC,EAAiC,MAAS;AAC1D,EAAAD,EAAQ,cAAcD,EAAQ;AAE9B,WAASG,EAA4B;AAAA,IACnC,OAAAC;AAAA,IACA,UAAAC;AAAA,EAAA,GAIc;AAUd,WACE,gBAAAC,EAACL,EAAQ,UAAR,EAAiB,OAAAG,GACf,UAAAC,EAAA,CACH;AAAA,EAEJ;AAEA,WAASE,IAAmD;AAC1D,UAAMH,IAAQI,EAAWP,CAAO;AAChC,QAAIG,MAAU;AACZ,YAAM,IAAI,MAAMJ,EAAQ,YAAY;AAGtC,WAAOI;AAAA,EACT;AAEA,WAASK,IAA+D;AACtE,WAAOD,EAAWP,CAAO;AAAA,EAC3B;AAEA,SAAO,EAAE,SAAAA,GAAS,UAAAE,GAAU,oBAAAI,GAAoB,oBAAAE,EAAA;AAClD;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const n = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
3
|
+
function r(t) {
|
|
4
|
+
return Array.from(
|
|
5
|
+
t.querySelectorAll(n)
|
|
6
|
+
).filter(
|
|
7
|
+
(e) => !e.disabled && e.offsetParent !== null
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
n as FOCUSABLE_SELECTOR,
|
|
12
|
+
r as getFocusableElements
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=focusable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focusable.js","sources":["../../../../src/ui/hooks/focusable.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Shared focusable-element helpers consumed by the focus-management\n * hooks (`useFocusTrap`, `useAutoFocus`). Centralised so the selector\n * and visibility filter have one definition — if the rules change\n * (a new tabbable role lands, jsdom's offsetParent quirk needs a\n * different handling pivot, etc.), there's exactly one site to edit.\n *\n * Originally lived inline in `DialogContent`'s focus trap; the trap\n * hook took ownership in Phase 3 PR 1, and PR 2 split it out again\n * once `useAutoFocus` became the second consumer.\n */\n\n/**\n * Selector covering tabbable elements per WAI-ARIA Authoring Practices.\n * Mirrors the selector DialogContent has shipped with since the dialog\n * pattern landed.\n */\nexport const FOCUSABLE_SELECTOR =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Return the focusable descendants of `container` that are eligible to\n * receive Tab focus.\n *\n * Filters out:\n * - `disabled` form controls (button/input/select/textarea expose the\n * DOM property; the cast is safe at the call site because every\n * selector match either has the property or returns `undefined`,\n * which short-circuits to falsy).\n * - hidden elements (`offsetParent === null` — covers `display: none`,\n * `visibility: hidden`, detached subtrees). In jsdom this filter\n * rejects every connected element because jsdom doesn't compute\n * layout; tests work around this by stubbing `offsetParent` on the\n * nodes they care about. Production stays correct.\n */\nexport function getFocusableElements(container: HTMLElement): HTMLElement[] {\n return Array.from(\n container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),\n ).filter(\n (el) =>\n !(el as HTMLButtonElement | HTMLInputElement).disabled &&\n el.offsetParent !== null,\n );\n}\n"],"names":["FOCUSABLE_SELECTOR","getFocusableElements","container","el"],"mappings":";AAmBO,MAAMA,IACX;AAiBK,SAASC,EAAqBC,GAAuC;AAC1E,SAAO,MAAM;AAAA,IACXA,EAAU,iBAA8BF,CAAkB;AAAA,EAAA,EAC1D;AAAA,IACA,CAACG,MACC,CAAEA,EAA4C,YAC9CA,EAAG,iBAAiB;AAAA,EAAA;AAE1B;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as n } from "react";
|
|
3
|
+
import { getFocusableElements as s } from "./focusable.js";
|
|
4
|
+
function f(e, r) {
|
|
5
|
+
n(() => {
|
|
6
|
+
if (!r) return;
|
|
7
|
+
const o = setTimeout(() => {
|
|
8
|
+
const t = e.current;
|
|
9
|
+
if (!t) return;
|
|
10
|
+
const u = s(t);
|
|
11
|
+
if (u.length > 0) {
|
|
12
|
+
u[0].focus();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
t.hasAttribute("tabindex") || t.setAttribute("tabindex", "-1"), t.focus();
|
|
16
|
+
}, 0);
|
|
17
|
+
return () => clearTimeout(o);
|
|
18
|
+
}, [r, e]);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
f as useAutoFocus
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useAutoFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoFocus.js","sources":["../../../../src/ui/hooks/useAutoFocus.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, type RefObject } from \"react\";\nimport { getFocusableElements } from \"./focusable\";\n\n/**\n * On `isActive` rising edge, move keyboard focus to the first focusable\n * element inside `containerRef`. Falls back to focusing the container\n * itself (after temporarily setting `tabindex=\"-1\"` if needed) when the\n * container has no focusable children — so the modal still owns focus\n * and Escape/Tab handlers attached to it remain reachable.\n *\n * Deferred via `setTimeout(0)`, matching the timing the existing Dialog\n * implementation proved out. Two reasons that timing matters:\n *\n * 1. The overlay's content (button, input, link) is committed to the\n * DOM in the same render that flips `isActive` true. Synchronous\n * focus from inside the effect can land on the *previous* DOM\n * snapshot in React 19's concurrent paths; the timer guarantees\n * we run after commit.\n * 2. Composes with `useFocusRestore`. Restore snapshots\n * `document.activeElement` on open *before* this hook moves focus\n * inside the overlay — order guaranteed by the snapshot running in\n * its own effect at the rising edge while auto-focus is deferred.\n *\n * Idempotent on `isActive=false`: the hook does nothing on the falling\n * edge (focus restoration is `useFocusRestore`'s concern; this hook\n * only handles the rising-edge auto-focus).\n *\n * @example\n * ```tsx\n * function MyModal({ isOpen }: { isOpen: boolean }) {\n * const contentRef = useRef<HTMLDivElement>(null);\n * useFocusRestore(isOpen);\n * useFocusTrap(contentRef, isOpen);\n * useAutoFocus(contentRef, isOpen);\n * // ...\n * }\n * ```\n */\nexport function useAutoFocus(\n containerRef: RefObject<HTMLElement | null>,\n isActive: boolean,\n): void {\n useEffect(() => {\n if (!isActive) return;\n\n const timer = setTimeout(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const focusables = getFocusableElements(container);\n if (focusables.length > 0) {\n focusables[0].focus();\n return;\n }\n\n // Container has no focusable child (e.g., a confirmation modal\n // rendered with body text only). Make the container itself\n // focusable so the trap has something to anchor to and the\n // surface receives keyboard events. We don't restore the original\n // tabindex on cleanup — the container is about to unmount with\n // the closing overlay; persisting tabindex=\"-1\" through the\n // closing frame is harmless.\n if (!container.hasAttribute(\"tabindex\")) {\n container.setAttribute(\"tabindex\", \"-1\");\n }\n container.focus();\n }, 0);\n\n return () => clearTimeout(timer);\n }, [isActive, containerRef]);\n}\n"],"names":["useAutoFocus","containerRef","isActive","useEffect","timer","container","focusables","getFocusableElements"],"mappings":";;;AAwCO,SAASA,EACdC,GACAC,GACM;AACN,EAAAC,EAAU,MAAM;AACd,QAAI,CAACD,EAAU;AAEf,UAAME,IAAQ,WAAW,MAAM;AAC7B,YAAMC,IAAYJ,EAAa;AAC/B,UAAI,CAACI,EAAW;AAEhB,YAAMC,IAAaC,EAAqBF,CAAS;AACjD,UAAIC,EAAW,SAAS,GAAG;AACzB,QAAAA,EAAW,CAAC,EAAE,MAAA;AACd;AAAA,MACF;AASA,MAAKD,EAAU,aAAa,UAAU,KACpCA,EAAU,aAAa,YAAY,IAAI,GAEzCA,EAAU,MAAA;AAAA,IACZ,GAAG,CAAC;AAEJ,WAAO,MAAM,aAAaD,CAAK;AAAA,EACjC,GAAG,CAACF,GAAUD,CAAY,CAAC;AAC7B;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback as f, useState as S, useEffect as m } from "react";
|
|
3
|
+
function v({
|
|
4
|
+
defaultOpen: e = !0,
|
|
5
|
+
open: t,
|
|
6
|
+
onOpenChange: u,
|
|
7
|
+
storageKey: i
|
|
8
|
+
}) {
|
|
9
|
+
const d = f(() => {
|
|
10
|
+
if (i && typeof window != "undefined") {
|
|
11
|
+
const l = localStorage.getItem(i);
|
|
12
|
+
if (l !== null)
|
|
13
|
+
return l === "true";
|
|
14
|
+
}
|
|
15
|
+
return e;
|
|
16
|
+
}, [e, i]), [c, o] = S(d), r = t !== void 0 ? t : c;
|
|
17
|
+
m(() => {
|
|
18
|
+
i && typeof window != "undefined" && t === void 0 && localStorage.setItem(i, String(c));
|
|
19
|
+
}, [c, i, t]);
|
|
20
|
+
const s = f(
|
|
21
|
+
(l) => {
|
|
22
|
+
t === void 0 && o(l), u == null || u(l);
|
|
23
|
+
},
|
|
24
|
+
[t, u]
|
|
25
|
+
), n = f(() => {
|
|
26
|
+
s(!r);
|
|
27
|
+
}, [r, s]);
|
|
28
|
+
return {
|
|
29
|
+
isOpen: r,
|
|
30
|
+
toggle: n,
|
|
31
|
+
setOpen: s
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
v as useCollapsible
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=useCollapsible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCollapsible.js","sources":["../../../../src/ui/hooks/useCollapsible.ts"],"sourcesContent":["\"use client\";\n\nimport { useState, useEffect, useCallback } from \"react\";\n\nexport interface UseCollapsibleOptions {\n defaultOpen?: boolean;\n open?: boolean; // Controlled mode\n onOpenChange?: (open: boolean) => void;\n storageKey?: string; // For localStorage persistence\n}\n\nexport interface UseCollapsibleReturn {\n isOpen: boolean;\n toggle: () => void;\n setOpen: (open: boolean) => void;\n}\n\n/**\n * useCollapsible Hook\n *\n * Reusable hook for collapsible component logic.\n * Supports both controlled and uncontrolled modes.\n * Optional localStorage persistence.\n *\n * @example\n * ```tsx\n * const { isOpen, toggle } = useCollapsible({\n * defaultOpen: true,\n * storageKey: 'my-collapsible-state'\n * });\n * ```\n */\nexport function useCollapsible({\n defaultOpen = true,\n open,\n onOpenChange,\n storageKey,\n}: UseCollapsibleOptions): UseCollapsibleReturn {\n // Load initial state from localStorage if storageKey is provided\n const getInitialState = useCallback((): boolean => {\n if (storageKey && typeof window !== \"undefined\") {\n const stored = localStorage.getItem(storageKey);\n if (stored !== null) {\n return stored === \"true\";\n }\n }\n return defaultOpen;\n }, [defaultOpen, storageKey]);\n\n const [internalOpen, setInternalOpen] = useState<boolean>(getInitialState);\n\n // Use controlled state if provided, otherwise use internal state\n const isOpen = open !== undefined ? open : internalOpen;\n\n // Persist to localStorage when state changes\n useEffect(() => {\n if (storageKey && typeof window !== \"undefined\" && open === undefined) {\n localStorage.setItem(storageKey, String(internalOpen));\n }\n }, [internalOpen, storageKey, open]);\n\n const setOpen = useCallback(\n (newOpen: boolean) => {\n if (open === undefined) {\n // Uncontrolled mode\n setInternalOpen(newOpen);\n }\n // In controlled mode, parent handles state\n onOpenChange?.(newOpen);\n },\n [open, onOpenChange],\n );\n\n const toggle = useCallback(() => {\n setOpen(!isOpen);\n }, [isOpen, setOpen]);\n\n return {\n isOpen,\n toggle,\n setOpen,\n };\n}\n"],"names":["useCollapsible","defaultOpen","open","onOpenChange","storageKey","getInitialState","useCallback","stored","internalOpen","setInternalOpen","useState","isOpen","useEffect","setOpen","newOpen","toggle"],"mappings":";;AAgCO,SAASA,EAAe;AAAA,EAC7B,aAAAC,IAAc;AAAA,EACd,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AACF,GAAgD;AAE9C,QAAMC,IAAkBC,EAAY,MAAe;AACjD,QAAIF,KAAc,OAAO,UAAW,aAAa;AAC/C,YAAMG,IAAS,aAAa,QAAQH,CAAU;AAC9C,UAAIG,MAAW;AACb,eAAOA,MAAW;AAAA,IAEtB;AACA,WAAON;AAAA,EACT,GAAG,CAACA,GAAaG,CAAU,CAAC,GAEtB,CAACI,GAAcC,CAAe,IAAIC,EAAkBL,CAAe,GAGnEM,IAAST,MAAS,SAAYA,IAAOM;AAG3C,EAAAI,EAAU,MAAM;AACd,IAAIR,KAAc,OAAO,UAAW,eAAeF,MAAS,UAC1D,aAAa,QAAQE,GAAY,OAAOI,CAAY,CAAC;AAAA,EAEzD,GAAG,CAACA,GAAcJ,GAAYF,CAAI,CAAC;AAEnC,QAAMW,IAAUP;AAAA,IACd,CAACQ,MAAqB;AACpB,MAAIZ,MAAS,UAEXO,EAAgBK,CAAO,GAGzBX,KAAA,QAAAA,EAAeW;AAAA,IACjB;AAAA,IACA,CAACZ,GAAMC,CAAY;AAAA,EAAA,GAGfY,IAAST,EAAY,MAAM;AAC/B,IAAAO,EAAQ,CAACF,CAAM;AAAA,EACjB,GAAG,CAACA,GAAQE,CAAO,CAAC;AAEpB,SAAO;AAAA,IACL,QAAAF;AAAA,IACA,QAAAI;AAAA,IACA,SAAAF;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as o, useEffect as r } from "react";
|
|
3
|
+
function l(t) {
|
|
4
|
+
const u = o(null);
|
|
5
|
+
r(() => {
|
|
6
|
+
var c;
|
|
7
|
+
if (t)
|
|
8
|
+
u.current = (c = document.activeElement) != null ? c : null;
|
|
9
|
+
else {
|
|
10
|
+
const e = u.current, n = setTimeout(() => {
|
|
11
|
+
e == null || e.focus();
|
|
12
|
+
}, 0);
|
|
13
|
+
return () => clearTimeout(n);
|
|
14
|
+
}
|
|
15
|
+
}, [t]);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
l as useFocusRestore
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useFocusRestore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusRestore.js","sources":["../../../../src/ui/hooks/useFocusRestore.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\n\n/**\n * Snapshot focus when an overlay opens; restore on close.\n *\n * When `isOpen` flips from false to true, snapshots\n * `document.activeElement` at that moment. When `isOpen` flips back to\n * false, restores focus to the snapshotted element in a `setTimeout(0)`\n * — matching the timing the existing DialogProvider proved out\n * (Dialog.test.tsx:221 depends on this exact shape).\n *\n * Trigger-ref-free by design: the snapshot mechanism captures whatever\n * had focus at open time, so overlays can be opened by any composition\n * (button click, programmatic call from a notification, etc.) without\n * carrying a ref to a single triggering element.\n *\n * Scope is restore only. Focus trapping (Tab cycling within an open\n * modal container) is the separate concern of `useFocusTrap`. The two\n * hooks compose: modal surfaces (Dialog, Drawer) use both; non-modal\n * surfaces (Popover) use only restore.\n *\n * @example\n * ```tsx\n * function MyOverlay({ isOpen }: { isOpen: boolean }) {\n * useFocusRestore(isOpen);\n * // ...\n * }\n * ```\n */\nexport function useFocusRestore(isOpen: boolean): void {\n const previousActiveElement = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (isOpen) {\n previousActiveElement.current =\n (document.activeElement as HTMLElement | null) ?? null;\n } else {\n const previous = previousActiveElement.current;\n // setTimeout(0) defers the restore until after React has committed\n // the close transition and removed the overlay's DOM (so the\n // restore target isn't a now-disposed element inside the overlay\n // — it's whatever had focus *before* the overlay opened).\n const timer = setTimeout(() => {\n previous?.focus();\n }, 0);\n return () => clearTimeout(timer);\n }\n }, [isOpen]);\n}\n"],"names":["useFocusRestore","isOpen","previousActiveElement","useRef","useEffect","_a","previous","timer"],"mappings":";;AA+BO,SAASA,EAAgBC,GAAuB;AACrD,QAAMC,IAAwBC,EAA2B,IAAI;AAE7D,EAAAC,EAAU,MAAM;;AACd,QAAIH;AACF,MAAAC,EAAsB,WACnBG,IAAA,SAAS,kBAAT,OAAAA,IAAiD;AAAA,SAC/C;AACL,YAAMC,IAAWJ,EAAsB,SAKjCK,IAAQ,WAAW,MAAM;AAC7B,QAAAD,KAAA,QAAAA,EAAU;AAAA,MACZ,GAAG,CAAC;AACJ,aAAO,MAAM,aAAaC,CAAK;AAAA,IACjC;AAAA,EACF,GAAG,CAACN,CAAM,CAAC;AACb;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as i } from "react";
|
|
3
|
+
import { getFocusableElements as a } from "./focusable.js";
|
|
4
|
+
function d(f, s) {
|
|
5
|
+
i(() => {
|
|
6
|
+
if (!s) return;
|
|
7
|
+
function c(e) {
|
|
8
|
+
if (e.key !== "Tab") return;
|
|
9
|
+
const n = f.current;
|
|
10
|
+
if (!n) return;
|
|
11
|
+
const t = a(n);
|
|
12
|
+
if (t.length === 0) {
|
|
13
|
+
e.preventDefault();
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const r = t[0], o = t[t.length - 1], u = document.activeElement;
|
|
17
|
+
if (!n.contains(u)) {
|
|
18
|
+
e.preventDefault(), (e.shiftKey ? o : r).focus();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
e.shiftKey ? u === r && (e.preventDefault(), o.focus()) : u === o && (e.preventDefault(), r.focus());
|
|
22
|
+
}
|
|
23
|
+
return document.addEventListener("keydown", c), () => {
|
|
24
|
+
document.removeEventListener("keydown", c);
|
|
25
|
+
};
|
|
26
|
+
}, [s, f]);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
d as useFocusTrap
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=useFocusTrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusTrap.js","sources":["../../../../src/ui/hooks/useFocusTrap.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, type RefObject } from \"react\";\nimport { getFocusableElements } from \"./focusable\";\n\n/**\n * Trap Tab / Shift+Tab cycling within `containerRef` while `isActive`.\n *\n * Boundary-only intervention: the handler intercepts Tab on the LAST\n * focusable element (cycles back to first) and Shift+Tab on the FIRST\n * focusable element (cycles back to last). Tab/Shift+Tab on any\n * intermediate element falls through to the browser's default\n * sequential focus navigation. This is the exact shape the existing\n * `DialogContent` proved out — extracting it here means there's only\n * one place to fix when the subtle parts (disabled filtering,\n * `offsetParent !== null`, zero-focusable edge case) need to evolve.\n *\n * Zero-focusable edge case: if the container has no tabbable elements,\n * Tab and Shift+Tab are both preventDefault'd, so focus can't escape\n * the trap onto the underlying page. The container can still be closed\n * via Escape (a concern of the consumer, not this hook).\n *\n * Trap is restore-only on the focus side: it does NOT auto-focus the\n * first element when activated (the consumer typically handles that\n * separately) and it does NOT snapshot/restore focus on toggle (that's\n * `useFocusRestore`'s job — the two hooks compose).\n *\n * @example\n * ```tsx\n * function MyModal({ isOpen, ... }) {\n * const contentRef = useRef<HTMLDivElement>(null);\n * useFocusTrap(contentRef, isOpen);\n * // ...\n * }\n * ```\n */\nexport function useFocusTrap(\n containerRef: RefObject<HTMLElement | null>,\n isActive: boolean,\n): void {\n useEffect(() => {\n if (!isActive) return;\n\n function handleTab(e: KeyboardEvent) {\n if (e.key !== \"Tab\") return;\n const container = containerRef.current;\n if (!container) return;\n\n const focusables = getFocusableElements(container);\n\n if (focusables.length === 0) {\n // No tabbable target inside the trap — block both directions so\n // focus can't escape onto the underlying page.\n e.preventDefault();\n return;\n }\n\n const first = focusables[0];\n const last = focusables[focusables.length - 1];\n const active = document.activeElement;\n\n // Focus is currently OUTSIDE the trap container — either it\n // hasn't entered yet (consumer hasn't auto-focused, or doesn't\n // auto-focus by design) or it escaped earlier. The boundary\n // checks below (`active === first` / `=== last`) would both miss\n // this case and let the browser advance Tab to whatever is next\n // in document order, which is an element BEHIND the overlay.\n // Pull focus back to the appropriate edge first. This was a real\n // gap in DialogContent's inline trap — DialogContent only got\n // away with it because it always auto-focused the first element\n // on open, masking the outside-focus case. Consumers of this\n // hook may decouple the auto-focus from the trap (Drawer is\n // expected to), so we close the gap here.\n if (!container.contains(active)) {\n e.preventDefault();\n (e.shiftKey ? last : first).focus();\n return;\n }\n\n if (e.shiftKey) {\n if (active === first) {\n e.preventDefault();\n last.focus();\n }\n } else {\n if (active === last) {\n e.preventDefault();\n first.focus();\n }\n }\n }\n\n document.addEventListener(\"keydown\", handleTab);\n return () => {\n document.removeEventListener(\"keydown\", handleTab);\n };\n }, [isActive, containerRef]);\n}\n"],"names":["useFocusTrap","containerRef","isActive","useEffect","handleTab","container","focusables","getFocusableElements","first","last","active"],"mappings":";;;AAoCO,SAASA,EACdC,GACAC,GACM;AACN,EAAAC,EAAU,MAAM;AACd,QAAI,CAACD,EAAU;AAEf,aAASE,EAAU,GAAkB;AACnC,UAAI,EAAE,QAAQ,MAAO;AACrB,YAAMC,IAAYJ,EAAa;AAC/B,UAAI,CAACI,EAAW;AAEhB,YAAMC,IAAaC,EAAqBF,CAAS;AAEjD,UAAIC,EAAW,WAAW,GAAG;AAG3B,UAAE,eAAA;AACF;AAAA,MACF;AAEA,YAAME,IAAQF,EAAW,CAAC,GACpBG,IAAOH,EAAWA,EAAW,SAAS,CAAC,GACvCI,IAAS,SAAS;AAcxB,UAAI,CAACL,EAAU,SAASK,CAAM,GAAG;AAC/B,UAAE,eAAA,IACD,EAAE,WAAWD,IAAOD,GAAO,MAAA;AAC5B;AAAA,MACF;AAEA,MAAI,EAAE,WACAE,MAAWF,MACb,EAAE,eAAA,GACFC,EAAK,MAAA,KAGHC,MAAWD,MACb,EAAE,eAAA,GACFD,EAAM,MAAA;AAAA,IAGZ;AAEA,oBAAS,iBAAiB,WAAWJ,CAAS,GACvC,MAAM;AACX,eAAS,oBAAoB,WAAWA,CAAS;AAAA,IACnD;AAAA,EACF,GAAG,CAACF,GAAUD,CAAY,CAAC;AAC7B;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as g, useEffect as a } from "react";
|
|
3
|
+
function v(n, l = {}) {
|
|
4
|
+
const { rootMargin: r = "0px 0px -50% 0px", threshold: o = 0 } = l, [u, d] = g(null), f = n.join("|");
|
|
5
|
+
return a(() => {
|
|
6
|
+
if (typeof window == "undefined" || typeof IntersectionObserver == "undefined")
|
|
7
|
+
return;
|
|
8
|
+
const i = n.map((e) => document.getElementById(e)).filter((e) => e !== null);
|
|
9
|
+
if (i.length === 0) return;
|
|
10
|
+
const s = new IntersectionObserver(
|
|
11
|
+
(e) => {
|
|
12
|
+
const c = e.filter((t) => t.isIntersecting).sort((t, p) => t.boundingClientRect.top - p.boundingClientRect.top);
|
|
13
|
+
c.length > 0 && d(c[0].target.id);
|
|
14
|
+
},
|
|
15
|
+
{ rootMargin: r, threshold: o }
|
|
16
|
+
);
|
|
17
|
+
return i.forEach((e) => s.observe(e)), () => s.disconnect();
|
|
18
|
+
}, [f, r, o]), u;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
v as useScrollSpy
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useScrollSpy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollSpy.js","sources":["../../../../src/ui/hooks/useScrollSpy.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Options for `useScrollSpy`.\n */\nexport interface UseScrollSpyOptions {\n /**\n * `IntersectionObserver` `rootMargin`. Shrinks the effective viewport\n * the observer reports on. The default `\"0px 0px -50% 0px\"` shrinks\n * the bottom edge by half — a section is considered \"in view\" only\n * when part of it sits in the upper half of the viewport, which is\n * the canonical \"table-of-contents follows the scroll\" behaviour. To\n * compensate for a sticky header, prefix the top with a negative\n * pixel value, e.g. `\"-56px 0px -50% 0px\"`.\n *\n * @default \"0px 0px -50% 0px\"\n */\n rootMargin?: string;\n /**\n * `IntersectionObserver` `threshold`. With the default `0`, the\n * observer fires when any part of the target enters the (margin-\n * shrunken) viewport.\n *\n * @default 0\n */\n threshold?: number | number[];\n}\n\n/**\n * Track which section of a long scroll surface is currently in view,\n * suitable for a table-of-contents nav that highlights the active section\n * (the classic \"scroll spy\" pattern).\n *\n * The hook resolves each `id` to a DOM element via\n * `document.getElementById`, observes those elements with a single\n * `IntersectionObserver`, and returns the **id of the topmost visible\n * section**. Returns `null` when nothing has reported as visible yet —\n * including on the server, during the first render before the effect\n * runs, and any frame where no observed section intersects the\n * (margin-shrunken) viewport.\n *\n * ### Behavioural contract\n *\n * - **Return value.** `string | null`. `null` until at least one section\n * has been reported intersecting; never falls back to a \"first id\"\n * heuristic. Consumers that want a default highlight should fall back\n * themselves: `active ?? ids[0]`.\n * - **Tie-breaking.** When multiple sections intersect simultaneously,\n * the hook picks the one **closest to the top of the viewport**\n * (smallest `boundingClientRect.top`). This matches the user's\n * expectation that scrolling DOWN advances the highlight forward, not\n * backward.\n * - **Missing ids.** An id that resolves to no element is skipped\n * silently. The observer is created only when at least one element\n * resolves; an empty `ids` array (or one with all-missing ids) leaves\n * `activeId` as `null` and creates no observer.\n * - **Cleanup.** The observer is disconnected on unmount and when the\n * `ids` set changes, before a new observer is created. No leaks.\n * - **Re-observation on `ids` change.** The hook detects changes via a\n * string sentinel `ids.join(\"|\")`. Pass `ids` as a stable reference\n * (constant module-scope array, or `useMemo`) to avoid recreating the\n * observer on every render. The hook does not memoise `ids` for you\n * because the consumer typically already knows whether the array is\n * stable.\n * - **SSR safety.** `IntersectionObserver` and `document` are accessed\n * only inside `useEffect`, which never runs on the server. The hook\n * returns `null` during server rendering and the first client render\n * pre-commit. A `typeof window` guard inside the effect protects\n * older runtimes that evaluate `useEffect` outside a browser.\n * - **`useState` initial value.** Always `null`. Returning the first id\n * would highlight a section that the user has not yet seen and\n * contradict the SSR/hydration contract.\n *\n * ### Why this lives in the design system as a hook, not as a component\n *\n * The visual surface (a sticky nav with highlighted active item) is\n * already covered by `Navigation` + `NavLink` with the `active` prop. A\n * `<ScrollSpy>` component would fuse behaviour and visual, restrict\n * layout choice, and couple to a sibling component (`SectionCard`) via\n * an opaque id-string convention. As a hook the consumer keeps the\n * `ids` constant in one place and composes the nav however they want:\n * vertical, horizontal, sticky, in a drawer, etc.\n *\n * @example\n * ```tsx\n * \"use client\";\n * import { useScrollSpy, Navigation, NavLink } from \"@fabio.caffarello/react-design-system\";\n *\n * const SECTIONS = [\"intro\", \"votos\", \"gastos\"];\n *\n * function ProfileToc() {\n * const active = useScrollSpy(SECTIONS, { rootMargin: \"-56px 0px -50% 0px\" });\n * return (\n * <nav className=\"sticky top-14\">\n * <Navigation orientation=\"vertical\">\n * {SECTIONS.map((id) => (\n * <NavLink\n * key={id}\n * href={`#${id}`}\n * active={id === active}\n * aria-current={id === active ? \"location\" : undefined}\n * >\n * {id}\n * </NavLink>\n * ))}\n * </Navigation>\n * </nav>\n * );\n * }\n * ```\n *\n * @param ids - Element ids to observe, in document order. Stable\n * reference recommended (constant or `useMemo`).\n * @param options - Optional `IntersectionObserver` overrides — see\n * {@link UseScrollSpyOptions}.\n * @returns The id of the topmost visible section, or `null` when\n * nothing is reported visible yet.\n */\nexport function useScrollSpy(\n ids: string[],\n options: UseScrollSpyOptions = {},\n): string | null {\n const { rootMargin = \"0px 0px -50% 0px\", threshold = 0 } = options;\n const [activeId, setActiveId] = useState<string | null>(null);\n\n // The dependency sentinel: `ids.join(\"|\")` collapses a stable array\n // content to a stable string, so passing `[\"a\",\"b\",\"c\"]` literally on\n // every render does not recreate the observer. The pipe is safe as a\n // separator because HTML id syntax does not allow it (per the HTML\n // spec, an id may not contain whitespace; pipes are not whitespace\n // but are also not produced by any conventional id-generation\n // strategy in this codebase). If a consumer ever generates ids with\n // pipes, `ids` should be memoised by the consumer and the sentinel\n // would still detect the array-identity change via render-trigger.\n const idsKey = ids.join(\"|\");\n\n useEffect(() => {\n if (\n typeof window === \"undefined\" ||\n typeof IntersectionObserver === \"undefined\"\n ) {\n return;\n }\n\n const targets = ids\n .map((id) => document.getElementById(id))\n .filter((el): el is HTMLElement => el !== null);\n\n if (targets.length === 0) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n const visible = entries\n .filter((entry) => entry.isIntersecting)\n .sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);\n if (visible.length > 0) {\n setActiveId(visible[0].target.id);\n }\n },\n { rootMargin, threshold },\n );\n\n targets.forEach((el) => observer.observe(el));\n return () => observer.disconnect();\n // The dependency list intentionally watches the string sentinel\n // (idsKey), not the array itself, so a fresh array with identical\n // content does NOT recreate the observer. rootMargin/threshold are\n // primitive comparisons.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [idsKey, rootMargin, threshold]);\n\n return activeId;\n}\n"],"names":["useScrollSpy","ids","options","rootMargin","threshold","activeId","setActiveId","useState","idsKey","useEffect","targets","id","el","observer","entries","visible","entry","a","b"],"mappings":";;AAwHO,SAASA,EACdC,GACAC,IAA+B,IAChB;AACf,QAAM,EAAE,YAAAC,IAAa,oBAAoB,WAAAC,IAAY,MAAMF,GACrD,CAACG,GAAUC,CAAW,IAAIC,EAAwB,IAAI,GAWtDC,IAASP,EAAI,KAAK,GAAG;AAE3B,SAAAQ,EAAU,MAAM;AACd,QACE,OAAO,UAAW,eAClB,OAAO,wBAAyB;AAEhC;AAGF,UAAMC,IAAUT,EACb,IAAI,CAACU,MAAO,SAAS,eAAeA,CAAE,CAAC,EACvC,OAAO,CAACC,MAA0BA,MAAO,IAAI;AAEhD,QAAIF,EAAQ,WAAW,EAAG;AAE1B,UAAMG,IAAW,IAAI;AAAA,MACnB,CAACC,MAAY;AACX,cAAMC,IAAUD,EACb,OAAO,CAACE,MAAUA,EAAM,cAAc,EACtC,KAAK,CAACC,GAAGC,MAAMD,EAAE,mBAAmB,MAAMC,EAAE,mBAAmB,GAAG;AACrE,QAAIH,EAAQ,SAAS,KACnBT,EAAYS,EAAQ,CAAC,EAAE,OAAO,EAAE;AAAA,MAEpC;AAAA,MACA,EAAE,YAAAZ,GAAY,WAAAC,EAAA;AAAA,IAAU;AAG1B,WAAAM,EAAQ,QAAQ,CAACE,MAAOC,EAAS,QAAQD,CAAE,CAAC,GACrC,MAAMC,EAAS,WAAA;AAAA,EAMxB,GAAG,CAACL,GAAQL,GAAYC,CAAS,CAAC,GAE3BC;AACT;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var g = Object.defineProperty, C = Object.defineProperties;
|
|
3
|
+
var b = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var s = Object.getOwnPropertySymbols;
|
|
5
|
+
var n = Object.prototype.hasOwnProperty, o = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
var t = (e, m, a) => m in e ? g(e, m, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[m] = a, x = (e, m) => {
|
|
7
|
+
for (var a in m || (m = {}))
|
|
8
|
+
n.call(m, a) && t(e, a, m[a]);
|
|
9
|
+
if (s)
|
|
10
|
+
for (var a of s(m))
|
|
11
|
+
o.call(m, a) && t(e, a, m[a]);
|
|
12
|
+
return e;
|
|
13
|
+
}, c = (e, m) => C(e, b(m));
|
|
14
|
+
var i = (e, m) => {
|
|
15
|
+
var a = {};
|
|
16
|
+
for (var r in e)
|
|
17
|
+
n.call(e, r) && m.indexOf(r) < 0 && (a[r] = e[r]);
|
|
18
|
+
if (e != null && s)
|
|
19
|
+
for (var r of s(e))
|
|
20
|
+
m.indexOf(r) < 0 && o.call(e, r) && (a[r] = e[r]);
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
24
|
+
import N from "react";
|
|
25
|
+
import { getSpacingClass as f } from "../../tokens/spacing.js";
|
|
26
|
+
import { cn as R } from "../../utils/cn.js";
|
|
27
|
+
const h = {
|
|
28
|
+
sm: "max-w-screen-sm",
|
|
29
|
+
md: "max-w-screen-md",
|
|
30
|
+
lg: "max-w-screen-lg",
|
|
31
|
+
xl: "max-w-screen-xl",
|
|
32
|
+
"2xl": "max-w-screen-2xl",
|
|
33
|
+
full: "max-w-full"
|
|
34
|
+
}, j = N.forwardRef(
|
|
35
|
+
(v, d) => {
|
|
36
|
+
var l = v, {
|
|
37
|
+
className: e,
|
|
38
|
+
maxWidth: m = "lg",
|
|
39
|
+
paddingX: a = "base",
|
|
40
|
+
paddingY: r = "base",
|
|
41
|
+
center: p = !0,
|
|
42
|
+
children: w
|
|
43
|
+
} = l, u = i(l, [
|
|
44
|
+
"className",
|
|
45
|
+
"maxWidth",
|
|
46
|
+
"paddingX",
|
|
47
|
+
"paddingY",
|
|
48
|
+
"center",
|
|
49
|
+
"children"
|
|
50
|
+
]);
|
|
51
|
+
return /* @__PURE__ */ y(
|
|
52
|
+
"div",
|
|
53
|
+
c(x({
|
|
54
|
+
ref: d,
|
|
55
|
+
className: R(
|
|
56
|
+
"w-full",
|
|
57
|
+
h[m],
|
|
58
|
+
f(a, "px"),
|
|
59
|
+
f(r, "py"),
|
|
60
|
+
p && "mx-auto",
|
|
61
|
+
e
|
|
62
|
+
)
|
|
63
|
+
}, u), {
|
|
64
|
+
children: w
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
j.displayName = "Container";
|
|
70
|
+
export {
|
|
71
|
+
j as Container
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=Container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.js","sources":["../../../../../src/ui/layouts/Container/Container.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn } from \"../../utils\";\nimport { getSpacingClass } from \"../../tokens/spacing\";\n\nexport interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Maximum width of the container\n * @default 'lg'\n */\n maxWidth?: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"full\";\n /**\n * Horizontal padding\n * @default 'base'\n */\n paddingX?: \"xs\" | \"sm\" | \"md\" | \"base\" | \"lg\" | \"xl\";\n /**\n * Vertical padding\n * @default 'base'\n */\n paddingY?: \"xs\" | \"sm\" | \"md\" | \"base\" | \"lg\" | \"xl\";\n /**\n * Center the container content\n * @default true\n */\n center?: boolean;\n}\n\nconst maxWidthClasses = {\n sm: \"max-w-screen-sm\",\n md: \"max-w-screen-md\",\n lg: \"max-w-screen-lg\",\n xl: \"max-w-screen-xl\",\n \"2xl\": \"max-w-screen-2xl\",\n full: \"max-w-full\",\n};\n\n/**\n * Container component for constraining content width and providing consistent padding\n *\n * @example\n * ```tsx\n * <Container maxWidth=\"lg\" paddingX=\"base\">\n * <h1>Content</h1>\n * </Container>\n * ```\n */\nexport const Container = React.forwardRef<HTMLDivElement, ContainerProps>(\n (\n {\n className,\n maxWidth = \"lg\",\n paddingX = \"base\",\n paddingY = \"base\",\n center = true,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n className={cn(\n \"w-full\",\n maxWidthClasses[maxWidth],\n getSpacingClass(paddingX, \"px\"),\n getSpacingClass(paddingY, \"py\"),\n center && \"mx-auto\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nContainer.displayName = \"Container\";\n"],"names":["maxWidthClasses","Container","React","_a","ref","_b","className","maxWidth","paddingX","paddingY","center","children","props","__objRest","jsx","__spreadProps","__spreadValues","cn","getSpacingClass"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAMA,IAAkB;AAAA,EACtB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,MAAM;AACR,GAYaC,IAAYC,EAAM;AAAA,EAC7B,CACEC,GASAC,MACG;AAVH,QAAAC,IAAAF,GACE;AAAA,iBAAAG;AAAA,MACA,UAAAC,IAAW;AAAA,MACX,UAAAC,IAAW;AAAA,MACX,UAAAC,IAAW;AAAA,MACX,QAAAC,IAAS;AAAA,MACT,UAAAC;AAAA,QANFN,GAOKO,IAAAC,EAPLR,GAOK;AAAA,MANH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,WACE,gBAAAS;AAAA,MAAC;AAAA,MAAAC,EAAAC,EAAA;AAAA,QACC,KAAAZ;AAAA,QACA,WAAWa;AAAA,UACT;AAAA,UACAjB,EAAgBO,CAAQ;AAAA,UACxBW,EAAgBV,GAAU,IAAI;AAAA,UAC9BU,EAAgBT,GAAU,IAAI;AAAA,UAC9BC,KAAU;AAAA,UACVJ;AAAA,QAAA;AAAA,SAEEM,IAVL;AAAA,QAYE,UAAAD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAV,EAAU,cAAc;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var C = Object.defineProperty, b = Object.defineProperties;
|
|
3
|
+
var h = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var n = Object.getOwnPropertySymbols;
|
|
5
|
+
var i = Object.prototype.hasOwnProperty, l = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
var o = (t, e, s) => e in t ? C(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s, m = (t, e) => {
|
|
7
|
+
for (var s in e || (e = {}))
|
|
8
|
+
i.call(e, s) && o(t, s, e[s]);
|
|
9
|
+
if (n)
|
|
10
|
+
for (var s of n(e))
|
|
11
|
+
l.call(e, s) && o(t, s, e[s]);
|
|
12
|
+
return t;
|
|
13
|
+
}, f = (t, e) => b(t, h(e));
|
|
14
|
+
var u = (t, e) => {
|
|
15
|
+
var s = {};
|
|
16
|
+
for (var r in t)
|
|
17
|
+
i.call(t, r) && e.indexOf(r) < 0 && (s[r] = t[r]);
|
|
18
|
+
if (t != null && n)
|
|
19
|
+
for (var r of n(t))
|
|
20
|
+
e.indexOf(r) < 0 && l.call(t, r) && (s[r] = t[r]);
|
|
21
|
+
return s;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as v } from "react/jsx-runtime";
|
|
24
|
+
import S from "react";
|
|
25
|
+
import { getSpacingClass as y } from "../../tokens/spacing.js";
|
|
26
|
+
import { cn as k } from "../../utils/cn.js";
|
|
27
|
+
const N = S.forwardRef(
|
|
28
|
+
(R, j) => {
|
|
29
|
+
var c = R, {
|
|
30
|
+
className: t,
|
|
31
|
+
spacing: e = "base",
|
|
32
|
+
align: s = "stretch",
|
|
33
|
+
justify: r = "start",
|
|
34
|
+
direction: a = "column",
|
|
35
|
+
children: p
|
|
36
|
+
} = c, d = u(c, [
|
|
37
|
+
"className",
|
|
38
|
+
"spacing",
|
|
39
|
+
"align",
|
|
40
|
+
"justify",
|
|
41
|
+
"direction",
|
|
42
|
+
"children"
|
|
43
|
+
]);
|
|
44
|
+
const x = a === "column" ? y(e, "gap-y") : y(e, "gap-x"), g = {
|
|
45
|
+
start: "items-start",
|
|
46
|
+
center: "items-center",
|
|
47
|
+
end: "items-end",
|
|
48
|
+
stretch: "items-stretch"
|
|
49
|
+
}, w = {
|
|
50
|
+
start: "justify-start",
|
|
51
|
+
center: "justify-center",
|
|
52
|
+
end: "justify-end",
|
|
53
|
+
between: "justify-between",
|
|
54
|
+
around: "justify-around",
|
|
55
|
+
evenly: "justify-evenly"
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ v(
|
|
58
|
+
"div",
|
|
59
|
+
f(m({
|
|
60
|
+
ref: j,
|
|
61
|
+
className: k(
|
|
62
|
+
"flex",
|
|
63
|
+
a === "column" ? "flex-col" : "flex-row",
|
|
64
|
+
x,
|
|
65
|
+
g[s],
|
|
66
|
+
w[r],
|
|
67
|
+
t
|
|
68
|
+
)
|
|
69
|
+
}, d), {
|
|
70
|
+
children: p
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
N.displayName = "Stack";
|
|
76
|
+
export {
|
|
77
|
+
N as Stack
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=Stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stack.js","sources":["../../../../../src/ui/layouts/Stack/Stack.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn } from \"../../utils\";\nimport { getSpacingClass } from \"../../tokens/spacing\";\n\nexport interface StackProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Spacing between children\n * @default 'base'\n */\n spacing?: \"xs\" | \"sm\" | \"md\" | \"base\" | \"lg\" | \"xl\" | \"2xl\";\n /**\n * Alignment of children\n * @default 'stretch'\n */\n align?: \"start\" | \"center\" | \"end\" | \"stretch\";\n /**\n * Justification of children\n * @default 'start'\n */\n justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\";\n /**\n * Direction of stack\n * @default 'column'\n */\n direction?: \"row\" | \"column\";\n}\n\n/**\n * Stack component for vertical or horizontal layout with consistent spacing\n *\n * @example\n * ```tsx\n * <Stack spacing=\"md\" align=\"center\">\n * <div>Item 1</div>\n * <div>Item 2</div>\n * </Stack>\n * ```\n */\nexport const Stack = React.forwardRef<HTMLDivElement, StackProps>(\n (\n {\n className,\n spacing = \"base\",\n align = \"stretch\",\n justify = \"start\",\n direction = \"column\",\n children,\n ...props\n },\n ref,\n ) => {\n const spacingClass =\n direction === \"column\"\n ? getSpacingClass(spacing, \"gap-y\")\n : getSpacingClass(spacing, \"gap-x\");\n\n const alignClasses = {\n start: \"items-start\",\n center: \"items-center\",\n end: \"items-end\",\n stretch: \"items-stretch\",\n };\n\n const justifyClasses = {\n start: \"justify-start\",\n center: \"justify-center\",\n end: \"justify-end\",\n between: \"justify-between\",\n around: \"justify-around\",\n evenly: \"justify-evenly\",\n };\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex\",\n direction === \"column\" ? \"flex-col\" : \"flex-row\",\n spacingClass,\n alignClasses[align],\n justifyClasses[justify],\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nStack.displayName = \"Stack\";\n"],"names":["Stack","React","_a","ref","_b","className","spacing","align","justify","direction","children","props","__objRest","spacingClass","getSpacingClass","alignClasses","justifyClasses","jsx","__spreadProps","__spreadValues","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAMA,IAAQC,EAAM;AAAA,EACzB,CACEC,GASAC,MACG;AAVH,QAAAC,IAAAF,GACE;AAAA,iBAAAG;AAAA,MACA,SAAAC,IAAU;AAAA,MACV,OAAAC,IAAQ;AAAA,MACR,SAAAC,IAAU;AAAA,MACV,WAAAC,IAAY;AAAA,MACZ,UAAAC;AAAA,QANFN,GAOKO,IAAAC,EAPLR,GAOK;AAAA,MANH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAMS,IACJJ,MAAc,WACVK,EAAgBR,GAAS,OAAO,IAChCQ,EAAgBR,GAAS,OAAO,GAEhCS,IAAe;AAAA,MACnB,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,SAAS;AAAA,IAAA,GAGLC,IAAiB;AAAA,MACrB,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,QAAQ;AAAA,IAAA;AAGV,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAAC,EAAAC,EAAA;AAAA,QACC,KAAAhB;AAAA,QACA,WAAWiB;AAAA,UACT;AAAA,UACAX,MAAc,WAAW,aAAa;AAAA,UACtCI;AAAA,UACAE,EAAaR,CAAK;AAAA,UAClBS,EAAeR,CAAO;AAAA,UACtBH;AAAA,QAAA;AAAA,SAEEM,IAVL;AAAA,QAYE,UAAAD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAV,EAAM,cAAc;"}
|