@vjdesigns/vjdesigns-ui 3.5.0 → 3.5.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/CHANGELOG.md +9 -0
- package/dist/ai/llms-full.txt +8675 -0
- package/dist/ai/llms.txt +201 -0
- package/dist/ai/mcp-server.mjs +212 -0
- package/dist/ai/registry.json +21512 -0
- package/dist/components/data-display/Accordion/Accordion.cjs.js +1 -0
- package/dist/components/data-display/Accordion/Accordion.module.css.cjs.js +1 -0
- package/dist/components/data-display/Avatar/Avatar.cjs.js +1 -0
- package/dist/components/data-display/Avatar/Avatar.module.css.cjs.js +1 -0
- package/dist/components/data-display/Badge/Badge.cjs.js +1 -0
- package/dist/components/data-display/Badge/Badge.module.css.cjs.js +1 -0
- package/dist/components/data-display/Card/Card.cjs.js +1 -0
- package/dist/components/data-display/Card/Card.module.css.cjs.js +1 -0
- package/dist/components/data-display/Carousel/Carousel.cjs.js +1 -0
- package/dist/components/data-display/Carousel/Carousel.module.css.cjs.js +1 -0
- package/dist/components/data-display/Chat/Chat.cjs.js +1 -0
- package/dist/components/data-display/Chat/Chat.module.css.cjs.js +1 -0
- package/dist/components/data-display/Chat/streams.cjs.js +4 -0
- package/dist/components/data-display/Chip/Chip.cjs.js +1 -0
- package/dist/components/data-display/Chip/Chip.module.css.cjs.js +1 -0
- package/dist/components/data-display/CodeBlock/CodeBlock.cjs.js +6 -0
- package/dist/components/data-display/CodeBlock/CodeBlock.module.css.cjs.js +1 -0
- package/dist/components/data-display/CodeBlock/tokenize.cjs.js +13 -0
- package/dist/components/data-display/CodeBlock/tokenize.d.ts +26 -0
- package/dist/components/data-display/Collapsible/Collapsible.cjs.js +1 -0
- package/dist/components/data-display/Collapsible/Collapsible.module.css.cjs.js +1 -0
- package/dist/components/data-display/Countdown/Countdown.cjs.js +1 -0
- package/dist/components/data-display/Countdown/Countdown.module.css.cjs.js +1 -0
- package/dist/components/data-display/DataGrid/DataGrid.cjs.js +1 -0
- package/dist/components/data-display/DataGrid/DataGrid.module.css.cjs.js +1 -0
- package/dist/components/data-display/DataGrid/dataGridUtils.cjs.js +1 -0
- package/dist/components/data-display/DataGrid/dataGridUtils.d.ts +46 -0
- package/dist/components/data-display/EmptyState/EmptyState.cjs.js +1 -0
- package/dist/components/data-display/EmptyState/EmptyState.module.css.cjs.js +1 -0
- package/dist/components/data-display/Image/Image.cjs.js +1 -0
- package/dist/components/data-display/Image/Image.module.css.cjs.js +1 -0
- package/dist/components/data-display/List/List.cjs.js +1 -0
- package/dist/components/data-display/List/List.module.css.cjs.js +1 -0
- package/dist/components/data-display/Stat/Stat.cjs.js +1 -0
- package/dist/components/data-display/Stat/Stat.module.css.cjs.js +1 -0
- package/dist/components/data-display/Table/Table.cjs.js +1 -0
- package/dist/components/data-display/Table/Table.module.css.cjs.js +1 -0
- package/dist/components/data-display/Table/useTable.cjs.js +1 -0
- package/dist/components/data-display/Table/useTable.d.ts +118 -0
- package/dist/components/data-display/Timeline/Timeline.cjs.js +1 -0
- package/dist/components/data-display/Timeline/Timeline.module.css.cjs.js +1 -0
- package/dist/components/data-display/TreeView/TreeView.cjs.js +1 -0
- package/dist/components/data-display/TreeView/TreeView.module.css.cjs.js +1 -0
- package/dist/components/data-display/TreeView/treeUtils.cjs.js +1 -0
- package/dist/components/data-display/TreeView/treeUtils.d.ts +82 -0
- package/dist/components/data-display/VirtualList/VirtualList.cjs.js +1 -0
- package/dist/components/data-display/VirtualList/VirtualList.module.css.cjs.js +1 -0
- package/dist/components/feedback/Alert/Alert.cjs.js +1 -0
- package/dist/components/feedback/Alert/Alert.module.css.cjs.js +1 -0
- package/dist/components/feedback/Banner/Banner.cjs.js +1 -0
- package/dist/components/feedback/Banner/Banner.module.css.cjs.js +1 -0
- package/dist/components/feedback/ErrorSummary/ErrorSummary.cjs.js +1 -0
- package/dist/components/feedback/ErrorSummary/ErrorSummary.module.css.cjs.js +1 -0
- package/dist/components/feedback/Progress/Progress.cjs.js +1 -0
- package/dist/components/feedback/Progress/Progress.module.css.cjs.js +1 -0
- package/dist/components/feedback/Skeleton/Skeleton.cjs.js +1 -0
- package/dist/components/feedback/Skeleton/Skeleton.module.css.cjs.js +1 -0
- package/dist/components/feedback/Spinner/Spinner.cjs.js +1 -0
- package/dist/components/feedback/Spinner/Spinner.module.css.cjs.js +1 -0
- package/dist/components/feedback/Toast/Toast.cjs.js +1 -0
- package/dist/components/feedback/Toast/Toast.module.css.cjs.js +1 -0
- package/dist/components/feedback/Toast/ToastItem.cjs.js +1 -0
- package/dist/components/feedback/Toast/ToastItem.d.ts +18 -0
- package/dist/components/feedback/Toast/ToastProvider.cjs.js +1 -0
- package/dist/components/feedback/Toast/ToastViewport.cjs.js +1 -0
- package/dist/components/feedback/Toast/ToastViewport.d.ts +25 -0
- package/dist/components/feedback/Toast/toastStore.cjs.js +1 -0
- package/dist/components/feedback/Toast/toastTiming.cjs.js +1 -0
- package/dist/components/feedback/Toast/toastTypes.d.ts +136 -0
- package/dist/components/feedback/Toast/useToast.cjs.js +1 -0
- package/dist/components/feedback/Toast/useToastAnnouncer.cjs.js +1 -0
- package/dist/components/feedback/Toast/useToastAnnouncer.d.ts +15 -0
- package/dist/components/forms/CheckBox/CheckBox.cjs.js +1 -0
- package/dist/components/forms/CheckBox/CheckBox.d.ts +87 -0
- package/dist/components/forms/CheckBox/CheckBox.module.css.cjs.js +1 -0
- package/dist/components/forms/ColorPicker/ColorInput.cjs.js +1 -0
- package/dist/components/forms/ColorPicker/ColorInput.d.ts +38 -0
- package/dist/components/forms/ColorPicker/ColorPicker.cjs.js +1 -0
- package/dist/components/forms/ColorPicker/ColorPicker.d.ts +129 -0
- package/dist/components/forms/ColorPicker/ColorPicker.module.css.cjs.js +1 -0
- package/dist/components/forms/ColorPicker/colorUtils.cjs.js +1 -0
- package/dist/components/forms/ColorPicker/colorUtils.d.ts +86 -0
- package/dist/components/forms/Combobox/Combobox.cjs.js +1 -0
- package/dist/components/forms/Combobox/Combobox.d.ts +172 -0
- package/dist/components/forms/Combobox/Combobox.module.css.cjs.js +1 -0
- package/dist/components/forms/Combobox/ComboboxPopup.cjs.js +1 -0
- package/dist/components/forms/Combobox/ComboboxPopup.d.ts +40 -0
- package/dist/components/forms/Combobox/comboboxUtils.cjs.js +1 -0
- package/dist/components/forms/Combobox/comboboxUtils.d.ts +73 -0
- package/dist/components/forms/DatePicker/Calendar.cjs.js +1 -0
- package/dist/components/forms/DatePicker/Calendar.d.ts +98 -0
- package/dist/components/forms/DatePicker/Calendar.module.css.cjs.js +1 -0
- package/dist/components/forms/DatePicker/DatePicker.cjs.js +1 -0
- package/dist/components/forms/DatePicker/DatePicker.d.ts +100 -0
- package/dist/components/forms/DatePicker/DatePicker.module.css.cjs.js +1 -0
- package/dist/components/forms/DatePicker/DateRangePicker.cjs.js +1 -0
- package/dist/components/forms/DatePicker/DateRangePicker.d.ts +124 -0
- package/dist/components/forms/DatePicker/DateRangePicker.module.css.cjs.js +1 -0
- package/dist/components/forms/DatePicker/dateUtils.cjs.js +1 -0
- package/dist/components/forms/DatePicker/dateUtils.d.ts +88 -0
- package/dist/components/forms/DateTimePicker/DateTimePicker.cjs.js +1 -0
- package/dist/components/forms/DateTimePicker/DateTimePicker.d.ts +101 -0
- package/dist/components/forms/DateTimePicker/DateTimePicker.module.css.cjs.js +1 -0
- package/dist/components/forms/Field/Field.cjs.js +1 -0
- package/dist/components/forms/Field/Field.d.ts +171 -0
- package/dist/components/forms/Field/Field.module.css.cjs.js +1 -0
- package/dist/components/forms/Field/FieldContext.cjs.js +1 -0
- package/dist/components/forms/Field/FieldContext.d.ts +74 -0
- package/dist/components/forms/FileUpload/FileUpload.cjs.js +1 -0
- package/dist/components/forms/FileUpload/FileUpload.d.ts +153 -0
- package/dist/components/forms/FileUpload/FileUpload.module.css.cjs.js +1 -0
- package/dist/components/forms/Input/Input.cjs.js +1 -0
- package/dist/components/forms/Input/Input.d.ts +98 -0
- package/dist/components/forms/Input/Input.module.css.cjs.js +1 -0
- package/dist/components/forms/NumberInput/NumberInput.cjs.js +1 -0
- package/dist/components/forms/NumberInput/NumberInput.d.ts +87 -0
- package/dist/components/forms/NumberInput/NumberInput.module.css.cjs.js +1 -0
- package/dist/components/forms/PasswordInput/PasswordInput.cjs.js +1 -0
- package/dist/components/forms/PasswordInput/PasswordInput.d.ts +117 -0
- package/dist/components/forms/PasswordInput/PasswordInput.module.css.cjs.js +1 -0
- package/dist/components/forms/PinInput/PinInput.cjs.js +1 -0
- package/dist/components/forms/PinInput/PinInput.d.ts +92 -0
- package/dist/components/forms/PinInput/PinInput.module.css.cjs.js +1 -0
- package/dist/components/forms/Radio/Radio.cjs.js +1 -0
- package/dist/components/forms/Radio/Radio.d.ts +119 -0
- package/dist/components/forms/Radio/Radio.module.css.cjs.js +1 -0
- package/dist/components/forms/Rating/Rating.cjs.js +1 -0
- package/dist/components/forms/Rating/Rating.d.ts +128 -0
- package/dist/components/forms/Rating/Rating.module.css.cjs.js +1 -0
- package/dist/components/forms/SearchInput/SearchInput.cjs.js +1 -0
- package/dist/components/forms/SearchInput/SearchInput.d.ts +124 -0
- package/dist/components/forms/SearchInput/SearchInput.module.css.cjs.js +1 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.cjs.js +1 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.d.ts +120 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.cjs.js +1 -0
- package/dist/components/forms/Select/Select.cjs.js +1 -0
- package/dist/components/forms/Select/Select.d.ts +86 -0
- package/dist/components/forms/Select/Select.module.css.cjs.js +1 -0
- package/dist/components/forms/Slider/Slider.cjs.js +1 -0
- package/dist/components/forms/Slider/Slider.d.ts +84 -0
- package/dist/components/forms/Slider/Slider.module.css.cjs.js +1 -0
- package/dist/components/forms/Switch/Switch.cjs.js +1 -0
- package/dist/components/forms/Switch/Switch.d.ts +62 -0
- package/dist/components/forms/Switch/Switch.module.css.cjs.js +1 -0
- package/dist/components/forms/TagInput/TagInput.cjs.js +1 -0
- package/dist/components/forms/TagInput/TagInput.d.ts +144 -0
- package/dist/components/forms/TagInput/TagInput.module.css.cjs.js +1 -0
- package/dist/components/forms/Textarea/Textarea.cjs.js +1 -0
- package/dist/components/forms/Textarea/Textarea.d.ts +62 -0
- package/dist/components/forms/Textarea/Textarea.module.css.cjs.js +1 -0
- package/dist/components/forms/TimePicker/TimePicker.cjs.js +1 -0
- package/dist/components/forms/TimePicker/TimePicker.d.ts +116 -0
- package/dist/components/forms/TimePicker/TimePicker.module.css.cjs.js +1 -0
- package/dist/components/forms/TimePicker/timeUtils.cjs.js +1 -0
- package/dist/components/forms/TimePicker/timeUtils.d.ts +26 -0
- package/dist/components/forms/ToggleGroup/ToggleGroup.cjs.js +1 -0
- package/dist/components/forms/ToggleGroup/ToggleGroup.d.ts +154 -0
- package/dist/components/forms/ToggleGroup/ToggleGroup.module.css.cjs.js +1 -0
- package/dist/components/layout/Box/Box.cjs.js +1 -0
- package/dist/components/layout/Box/Box.module.css.cjs.js +1 -0
- package/dist/components/layout/Container/Container.cjs.js +1 -0
- package/dist/components/layout/Container/Container.module.css.cjs.js +1 -0
- package/dist/components/layout/Divider/Divider.cjs.js +1 -0
- package/dist/components/layout/Divider/Divider.module.css.cjs.js +1 -0
- package/dist/components/layout/Flex/Flex.cjs.js +1 -0
- package/dist/components/layout/Flex/Flex.module.css.cjs.js +1 -0
- package/dist/components/layout/Grid/Grid.cjs.js +1 -0
- package/dist/components/layout/Grid/Grid.module.css.cjs.js +1 -0
- package/dist/components/layout/ResizablePanels/ResizablePanels.cjs.js +1 -0
- package/dist/components/layout/ResizablePanels/ResizablePanels.module.css.cjs.js +1 -0
- package/dist/components/layout/ScrollArea/ScrollArea.cjs.js +1 -0
- package/dist/components/layout/ScrollArea/ScrollArea.module.css.cjs.js +1 -0
- package/dist/components/layout/Stack/Stack.cjs.js +1 -0
- package/dist/components/layout/Stack/Stack.module.css.cjs.js +1 -0
- package/dist/components/navigation/Breadcrumbs/Breadcrumbs.cjs.js +1 -0
- package/dist/components/navigation/Breadcrumbs/Breadcrumbs.module.css.cjs.js +1 -0
- package/dist/components/navigation/ContextMenu/ContextMenu.cjs.js +1 -0
- package/dist/components/navigation/ContextMenu/ContextMenu.module.css.cjs.js +1 -0
- package/dist/components/navigation/Link/Link.cjs.js +1 -0
- package/dist/components/navigation/Link/Link.module.css.cjs.js +1 -0
- package/dist/components/navigation/Menu/Menu.cjs.js +1 -0
- package/dist/components/navigation/Menu/Menu.module.css.cjs.js +1 -0
- package/dist/components/navigation/Menu/MenuContent.cjs.js +1 -0
- package/dist/components/navigation/Menu/MenuContent.d.ts +46 -0
- package/dist/components/navigation/Menu/MenuContext.cjs.js +1 -0
- package/dist/components/navigation/Menu/MenuContext.d.ts +84 -0
- package/dist/components/navigation/Menu/MenuItem.cjs.js +1 -0
- package/dist/components/navigation/Menu/MenuItem.d.ts +133 -0
- package/dist/components/navigation/Menu/MenuSub.cjs.js +1 -0
- package/dist/components/navigation/Menu/MenuSub.d.ts +28 -0
- package/dist/components/navigation/Menu/useMenuRoot.cjs.js +1 -0
- package/dist/components/navigation/Menu/useMenuRoot.d.ts +14 -0
- package/dist/components/navigation/Navbar/Navbar.cjs.js +1 -0
- package/dist/components/navigation/Navbar/Navbar.module.css.cjs.js +1 -0
- package/dist/components/navigation/Pagination/Pagination.cjs.js +1 -0
- package/dist/components/navigation/Pagination/Pagination.d.ts +97 -0
- package/dist/components/navigation/Pagination/Pagination.module.css.cjs.js +1 -0
- package/dist/components/navigation/Sidebar/Sidebar.cjs.js +1 -0
- package/dist/components/navigation/Sidebar/Sidebar.module.css.cjs.js +1 -0
- package/dist/components/navigation/Sidebar/SidebarContext.cjs.js +1 -0
- package/dist/components/navigation/Sidebar/SidebarContext.d.ts +45 -0
- package/dist/components/navigation/Sidebar/SidebarParts.cjs.js +1 -0
- package/dist/components/navigation/Sidebar/SidebarParts.d.ts +179 -0
- package/dist/components/navigation/SkipLink/SkipLink.cjs.js +1 -0
- package/dist/components/navigation/SkipLink/SkipLink.d.ts +41 -0
- package/dist/components/navigation/SkipLink/SkipLink.module.css.cjs.js +1 -0
- package/dist/components/navigation/Stepper/Stepper.cjs.js +1 -0
- package/dist/components/navigation/Stepper/Stepper.module.css.cjs.js +1 -0
- package/dist/components/navigation/Tabs/Tabs.cjs.js +1 -0
- package/dist/components/navigation/Tabs/Tabs.d.ts +132 -0
- package/dist/components/navigation/Tabs/Tabs.module.css.cjs.js +1 -0
- package/dist/components/navigation/Toolbar/Toolbar.cjs.js +1 -0
- package/dist/components/navigation/Toolbar/Toolbar.d.ts +62 -0
- package/dist/components/navigation/Toolbar/Toolbar.module.css.cjs.js +1 -0
- package/dist/components/navigation/Toolbar/ToolbarContext.cjs.js +1 -0
- package/dist/components/navigation/Toolbar/ToolbarContext.d.ts +9 -0
- package/dist/components/overlays/CommandPalette/CommandPalette.cjs.js +1 -0
- package/dist/components/overlays/CommandPalette/CommandPalette.module.css.cjs.js +1 -0
- package/dist/components/overlays/CommandPalette/CommandPaletteContext.cjs.js +1 -0
- package/dist/components/overlays/CommandPalette/CommandPaletteContext.d.ts +96 -0
- package/dist/components/overlays/CommandPalette/CommandPaletteParts.cjs.js +1 -0
- package/dist/components/overlays/CommandPalette/CommandPaletteParts.d.ts +115 -0
- package/dist/components/overlays/CommandPalette/commandPaletteUtils.cjs.js +1 -0
- package/dist/components/overlays/CommandPalette/commandPaletteUtils.d.ts +50 -0
- package/dist/components/overlays/Drawer/Drawer.cjs.js +1 -0
- package/dist/components/overlays/Drawer/Drawer.module.css.cjs.js +1 -0
- package/dist/components/overlays/Drawer/DrawerContent.cjs.js +1 -0
- package/dist/components/overlays/Drawer/DrawerContent.d.ts +27 -0
- package/dist/components/overlays/Drawer/DrawerContext.cjs.js +1 -0
- package/dist/components/overlays/Drawer/DrawerContext.d.ts +39 -0
- package/dist/components/overlays/Drawer/DrawerParts.cjs.js +1 -0
- package/dist/components/overlays/Drawer/DrawerParts.d.ts +65 -0
- package/dist/components/overlays/Drawer/internal.cjs.js +1 -0
- package/dist/components/overlays/Drawer/internal.d.ts +1 -0
- package/dist/components/overlays/Drawer/useDragToClose.cjs.js +1 -0
- package/dist/components/overlays/Drawer/useDragToClose.d.ts +28 -0
- package/dist/components/overlays/HoverCard/HoverCard.cjs.js +1 -0
- package/dist/components/overlays/HoverCard/HoverCard.module.css.cjs.js +1 -0
- package/dist/components/overlays/Modal/ConfirmModal.cjs.js +1 -0
- package/dist/components/overlays/Modal/Modal.cjs.js +1 -0
- package/dist/components/overlays/Modal/Modal.module.css.cjs.js +1 -0
- package/dist/components/overlays/Modal/ModalContent.cjs.js +1 -0
- package/dist/components/overlays/Modal/ModalContent.d.ts +12 -0
- package/dist/components/overlays/Modal/ModalContext.cjs.js +1 -0
- package/dist/components/overlays/Modal/ModalContext.d.ts +56 -0
- package/dist/components/overlays/Modal/useScrollRegion.cjs.js +1 -0
- package/dist/components/overlays/Modal/useScrollRegion.d.ts +7 -0
- package/dist/components/overlays/Popover/Popover.cjs.js +1 -0
- package/dist/components/overlays/Popover/Popover.module.css.cjs.js +1 -0
- package/dist/components/overlays/Popover/PopoverContent.cjs.js +1 -0
- package/dist/components/overlays/Popover/PopoverContent.d.ts +41 -0
- package/dist/components/overlays/Popover/PopoverContext.cjs.js +1 -0
- package/dist/components/overlays/Popover/PopoverContext.d.ts +38 -0
- package/dist/components/overlays/Tooltip/Tooltip.cjs.js +1 -0
- package/dist/components/overlays/Tooltip/Tooltip.module.css.cjs.js +1 -0
- package/dist/components/primitives/Button/Button.cjs.js +1 -0
- package/dist/components/primitives/Button/Button.module.css.cjs.js +1 -0
- package/dist/components/primitives/CopyButton/CopyButton.cjs.js +1 -0
- package/dist/components/primitives/Icon/Icon.cjs.js +1 -0
- package/dist/components/primitives/Icon/Icon.module.css.cjs.js +1 -0
- package/dist/components/primitives/Icon/IconSvg.cjs.js +1 -0
- package/dist/components/primitives/Icon/IconSvg.d.ts +31 -0
- package/dist/components/primitives/Icon/icons.cjs.js +1 -0
- package/dist/components/primitives/Kbd/Kbd.cjs.js +1 -0
- package/dist/components/primitives/Kbd/Kbd.module.css.cjs.js +1 -0
- package/dist/components/primitives/Typography/Typography.cjs.js +1 -0
- package/dist/components/primitives/Typography/Typography.module.css.cjs.js +1 -0
- package/dist/components/utilities/LocaleProvider/LocaleProvider.cjs.js +1 -0
- package/dist/components/utilities/LocaleProvider/LocaleProvider.module.css.cjs.js +1 -0
- package/dist/components/utilities/Portal/Portal.cjs.js +1 -0
- package/dist/components/utilities/Theme/Theme.cjs.js +1 -0
- package/dist/components/utilities/Theme/Theme.module.css.cjs.js +1 -0
- package/dist/components/utilities/VisuallyHidden/VisuallyHidden.cjs.js +1 -0
- package/dist/components/utilities/VisuallyHidden/VisuallyHidden.module.css.cjs.js +1 -0
- package/dist/hooks/elementSource.cjs.js +1 -0
- package/dist/hooks/elementSource.d.ts +16 -0
- package/dist/hooks/index.d.ts +21 -0
- package/dist/hooks/useClipboard.cjs.js +1 -0
- package/dist/hooks/useClipboard.d.ts +24 -0
- package/dist/hooks/useCollapsePresence.cjs.js +1 -0
- package/dist/hooks/useCollapsePresence.d.ts +33 -0
- package/dist/hooks/useControllableState.cjs.js +1 -0
- package/dist/hooks/useControllableState.d.ts +15 -0
- package/dist/hooks/useDisclosure.cjs.js +1 -0
- package/dist/hooks/useDisclosure.d.ts +35 -0
- package/dist/hooks/useDismiss.cjs.js +1 -0
- package/dist/hooks/useDismiss.d.ts +33 -0
- package/dist/hooks/useElementObservers.cjs.js +1 -0
- package/dist/hooks/useElementObservers.d.ts +70 -0
- package/dist/hooks/useEnvironment.cjs.js +1 -0
- package/dist/hooks/useEnvironment.d.ts +42 -0
- package/dist/hooks/useFloatingPosition.cjs.js +1 -0
- package/dist/hooks/useFloatingPosition.d.ts +55 -0
- package/dist/hooks/useFocusTrap.cjs.js +1 -0
- package/dist/hooks/useFocusTrap.d.ts +52 -0
- package/dist/hooks/useFormReset.cjs.js +1 -0
- package/dist/hooks/useFormReset.d.ts +17 -0
- package/dist/hooks/useFormValidation.cjs.js +1 -0
- package/dist/hooks/useFormValidation.d.ts +101 -0
- package/dist/hooks/useHotkeys.cjs.js +1 -0
- package/dist/hooks/useHotkeys.d.ts +50 -0
- package/dist/hooks/useInertOutside.cjs.js +1 -0
- package/dist/hooks/useInertOutside.d.ts +23 -0
- package/dist/hooks/useMediaQuery.cjs.js +1 -0
- package/dist/hooks/useMediaQuery.d.ts +11 -0
- package/dist/hooks/useMergedRef.cjs.js +1 -0
- package/dist/hooks/useMergedRef.d.ts +7 -0
- package/dist/hooks/useOverlayLayer.cjs.js +1 -0
- package/dist/hooks/useOverlayLayer.d.ts +92 -0
- package/dist/hooks/useResponsiveValue.cjs.js +1 -0
- package/dist/hooks/useResponsiveValue.d.ts +10 -0
- package/dist/hooks/useScrollLock.cjs.js +1 -0
- package/dist/hooks/useScrollLock.d.ts +4 -0
- package/dist/hooks/useStorage.cjs.js +1 -0
- package/dist/hooks/useStorage.d.ts +21 -0
- package/dist/hooks/useTiming.cjs.js +1 -0
- package/dist/hooks/useTiming.d.ts +78 -0
- package/dist/hooks/useVirtualizer.cjs.js +1 -0
- package/dist/hooks/useVirtualizer.d.ts +90 -0
- package/dist/i18n/en.cjs.js +1 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/locales/ar.d.ts +3 -0
- package/dist/i18n/locales/bn.d.ts +3 -0
- package/dist/i18n/locales/cs.d.ts +3 -0
- package/dist/i18n/locales/da.d.ts +3 -0
- package/dist/i18n/locales/de.d.ts +3 -0
- package/dist/i18n/locales/el.d.ts +3 -0
- package/dist/i18n/locales/es.d.ts +3 -0
- package/dist/i18n/locales/fa.d.ts +3 -0
- package/dist/i18n/locales/fi.d.ts +3 -0
- package/dist/i18n/locales/fr.d.ts +3 -0
- package/dist/i18n/locales/he.d.ts +3 -0
- package/dist/i18n/locales/hi.d.ts +3 -0
- package/dist/i18n/locales/hu.d.ts +3 -0
- package/dist/i18n/locales/id.d.ts +3 -0
- package/dist/i18n/locales/it.d.ts +3 -0
- package/dist/i18n/locales/ja.d.ts +3 -0
- package/dist/i18n/locales/ko.d.ts +3 -0
- package/dist/i18n/locales/nb.d.ts +3 -0
- package/dist/i18n/locales/nl.d.ts +3 -0
- package/dist/i18n/locales/pl.d.ts +3 -0
- package/dist/i18n/locales/pt-BR.d.ts +3 -0
- package/dist/i18n/locales/ro.d.ts +3 -0
- package/dist/i18n/locales/ru.d.ts +3 -0
- package/dist/i18n/locales/sv.d.ts +3 -0
- package/dist/i18n/locales/th.d.ts +3 -0
- package/dist/i18n/locales/tr.d.ts +3 -0
- package/dist/i18n/locales/uk.d.ts +3 -0
- package/dist/i18n/locales/ur.d.ts +3 -0
- package/dist/i18n/locales/vi.d.ts +3 -0
- package/dist/i18n/locales/zh-Hans.d.ts +3 -0
- package/dist/i18n/locales/zh-Hant.d.ts +3 -0
- package/dist/i18n/merge.cjs.js +1 -0
- package/dist/i18n/merge.d.ts +6 -0
- package/dist/i18n/plural.cjs.js +1 -0
- package/dist/i18n/plural.d.ts +45 -0
- package/dist/i18n/types.d.ts +1168 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/locales/ar.cjs.js +1 -0
- package/dist/locales/ar.d.ts +6 -0
- package/dist/locales/bn.cjs.js +1 -0
- package/dist/locales/bn.d.ts +6 -0
- package/dist/locales/cs.cjs.js +1 -0
- package/dist/locales/cs.d.ts +6 -0
- package/dist/locales/da.cjs.js +1 -0
- package/dist/locales/da.d.ts +6 -0
- package/dist/locales/de.cjs.js +1 -0
- package/dist/locales/de.d.ts +6 -0
- package/dist/locales/el.cjs.js +1 -0
- package/dist/locales/el.d.ts +6 -0
- package/dist/locales/es.cjs.js +1 -0
- package/dist/locales/es.d.ts +6 -0
- package/dist/locales/fa.cjs.js +1 -0
- package/dist/locales/fa.d.ts +6 -0
- package/dist/locales/fi.cjs.js +1 -0
- package/dist/locales/fi.d.ts +6 -0
- package/dist/locales/fr.cjs.js +1 -0
- package/dist/locales/fr.d.ts +6 -0
- package/dist/locales/he.cjs.js +1 -0
- package/dist/locales/he.d.ts +6 -0
- package/dist/locales/hi.cjs.js +1 -0
- package/dist/locales/hi.d.ts +6 -0
- package/dist/locales/hu.cjs.js +1 -0
- package/dist/locales/hu.d.ts +6 -0
- package/dist/locales/id.cjs.js +1 -0
- package/dist/locales/id.d.ts +6 -0
- package/dist/locales/it.cjs.js +1 -0
- package/dist/locales/it.d.ts +6 -0
- package/dist/locales/ja.cjs.js +1 -0
- package/dist/locales/ja.d.ts +6 -0
- package/dist/locales/ko.cjs.js +1 -0
- package/dist/locales/ko.d.ts +6 -0
- package/dist/locales/nb.cjs.js +1 -0
- package/dist/locales/nb.d.ts +6 -0
- package/dist/locales/nl.cjs.js +1 -0
- package/dist/locales/nl.d.ts +6 -0
- package/dist/locales/pl.cjs.js +1 -0
- package/dist/locales/pl.d.ts +6 -0
- package/dist/locales/pt-BR.cjs.js +1 -0
- package/dist/locales/pt-BR.d.ts +6 -0
- package/dist/locales/ro.cjs.js +1 -0
- package/dist/locales/ro.d.ts +6 -0
- package/dist/locales/ru.cjs.js +1 -0
- package/dist/locales/ru.d.ts +6 -0
- package/dist/locales/sv.cjs.js +1 -0
- package/dist/locales/sv.d.ts +6 -0
- package/dist/locales/th.cjs.js +1 -0
- package/dist/locales/th.d.ts +6 -0
- package/dist/locales/tr.cjs.js +1 -0
- package/dist/locales/tr.d.ts +6 -0
- package/dist/locales/uk.cjs.js +1 -0
- package/dist/locales/uk.d.ts +6 -0
- package/dist/locales/ur.cjs.js +1 -0
- package/dist/locales/ur.d.ts +6 -0
- package/dist/locales/vi.cjs.js +1 -0
- package/dist/locales/vi.d.ts +6 -0
- package/dist/locales/zh-Hans.cjs.js +1 -0
- package/dist/locales/zh-Hans.d.ts +6 -0
- package/dist/locales/zh-Hant.cjs.js +1 -0
- package/dist/locales/zh-Hant.d.ts +6 -0
- package/dist/types/common.cjs.js +1 -0
- package/dist/types/common.d.ts +31 -0
- package/dist/types/style.d.ts +7 -0
- package/dist/utils/announce.cjs.js +1 -0
- package/dist/utils/announce.d.ts +1 -0
- package/dist/utils/brandPalette.cjs.js +3 -0
- package/dist/utils/brandPalette.d.ts +146 -0
- package/dist/utils/clipboard.cjs.js +1 -0
- package/dist/utils/clipboard.d.ts +6 -0
- package/dist/utils/cx.cjs.js +1 -0
- package/dist/utils/cx.d.ts +2 -0
- package/dist/utils/fillSlot.cjs.js +1 -0
- package/dist/utils/fillSlot.d.ts +9 -0
- package/dist/utils/flattenChildren.cjs.js +1 -0
- package/dist/utils/flattenChildren.d.ts +8 -0
- package/dist/utils/hotkeys.cjs.js +1 -0
- package/dist/utils/hotkeys.d.ts +27 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/intl.cjs.js +1 -0
- package/dist/utils/intl.d.ts +10 -0
- package/dist/utils/refs.cjs.js +1 -0
- package/dist/utils/refs.d.ts +15 -0
- package/dist/utils/responsive.cjs.js +1 -0
- package/dist/utils/responsive.d.ts +43 -0
- package/dist/utils/slot.cjs.js +1 -0
- package/dist/utils/slot.d.ts +11 -0
- package/dist/utils/validators.cjs.js +1 -0
- package/dist/utils/validators.d.ts +72 -0
- package/package.json +3 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { Tone } from '../../../types/common';
|
|
3
|
+
import { IconButtonProps } from '../../primitives/Button';
|
|
4
|
+
/** A count or short text shown in an item's badge. */
|
|
5
|
+
export type SidebarBadgeValue = number | string;
|
|
6
|
+
export interface SidebarHeaderProps extends ComponentPropsWithRef<"div"> {
|
|
7
|
+
/** Brand, workspace switcher, and usually a `Sidebar.Toggle`. Pinned above the scrolling body. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The pinned top area: logo, product or workspace name, and the collapse
|
|
12
|
+
* toggle. In rail mode its children stack vertically and anything wider than
|
|
13
|
+
* the rail is clipped; use `useSidebar().collapsed` to swap in a compact logo.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SidebarHeader: {
|
|
16
|
+
({ className, children, ...rest }: SidebarHeaderProps): import("react").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
export interface SidebarBodyProps extends ComponentPropsWithRef<"div"> {
|
|
20
|
+
/** `Sidebar.Section`s. Scrolls when taller than the sidebar, while the header and footer stay pinned. */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/** The scrolling middle of the sidebar, between `Sidebar.Header` and `Sidebar.Footer`. */
|
|
24
|
+
export declare const SidebarBody: {
|
|
25
|
+
({ className, children, ...rest }: SidebarBodyProps): import("react").JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
28
|
+
export interface SidebarFooterProps extends ComponentPropsWithRef<"div"> {
|
|
29
|
+
/** Account, settings, or help links (a `Sidebar.Section`), or a `Sidebar.Toggle`. Pinned to the bottom. */
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
/** The pinned bottom area, separated from the body by a divider. */
|
|
33
|
+
export declare const SidebarFooter: {
|
|
34
|
+
({ className, children, ...rest }: SidebarFooterProps): import("react").JSX.Element;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
37
|
+
/** Heading level for a section heading. Omit it to render a plain (non-heading) label. */
|
|
38
|
+
export type SidebarHeadingLevel = 2 | 3 | 4 | 5 | 6;
|
|
39
|
+
export interface SidebarSectionProps extends ComponentPropsWithRef<"div"> {
|
|
40
|
+
/**
|
|
41
|
+
* Visible group label, e.g. "Teams". The section becomes `role="group"`
|
|
42
|
+
* named by it (`aria-labelledby`). In rail mode the heading is visually
|
|
43
|
+
* hidden (still the group's name) and a divider separates sections instead.
|
|
44
|
+
*/
|
|
45
|
+
heading?: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Renders the heading as `h2`-`h6` so it appears in the page's heading
|
|
48
|
+
* outline. When omitted, the heading is a styled `div` that only names the group.
|
|
49
|
+
*/
|
|
50
|
+
headingLevel?: SidebarHeadingLevel;
|
|
51
|
+
/** `Sidebar.Item`s and `Sidebar.Group`s. Rendered inside a `<ul>`. */
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A list of items with an optional visible heading. Every `Sidebar.Item` and
|
|
56
|
+
* `Sidebar.Group` must sit in a section (use one without `heading` for an
|
|
57
|
+
* ungrouped list).
|
|
58
|
+
*/
|
|
59
|
+
export declare const SidebarSection: {
|
|
60
|
+
({ heading, headingLevel, className, children, ...rest }: SidebarSectionProps): import("react").JSX.Element;
|
|
61
|
+
displayName: string;
|
|
62
|
+
};
|
|
63
|
+
export interface SidebarItemOwnProps {
|
|
64
|
+
/** The visible label. It is the item's accessible name, including in rail mode (where it also appears as a tooltip). */
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
/** Decorative icon before the label. Required for a usable rail: it's all that shows when collapsed. */
|
|
67
|
+
icon?: ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Marks the current page: sets `aria-current="page"` and shows a soft
|
|
70
|
+
* primary tint, a start-edge indicator bar, and bold text. @default false
|
|
71
|
+
*/
|
|
72
|
+
active?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* A count (rendered with `Badge` `count`, capped at 99+, hidden at 0) or a
|
|
75
|
+
* short text such as "New". In rail mode it shrinks to a dot on the icon and
|
|
76
|
+
* the full badge shows in the tooltip.
|
|
77
|
+
*/
|
|
78
|
+
badge?: SidebarBadgeValue;
|
|
79
|
+
/** Screen-reader text for the badge, e.g. "3 unread messages". Replaces the visible badge text in the accessible name. */
|
|
80
|
+
badgeLabel?: string;
|
|
81
|
+
/** Badge color. @default "accent" */
|
|
82
|
+
badgeTone?: Tone;
|
|
83
|
+
/**
|
|
84
|
+
* Disables the item. Buttons use the native `disabled` attribute; links
|
|
85
|
+
* drop `href` and get `aria-disabled`. @default false
|
|
86
|
+
*/
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Renders a `<button>` by default, or an `<a>` when `href` is passed (the same
|
|
91
|
+
* approach as `Button`). For client-side routing, pass `href` and handle
|
|
92
|
+
* `onClick` (call `event.preventDefault()` and push the route), so the item
|
|
93
|
+
* stays a real link that can be opened in a new tab.
|
|
94
|
+
*/
|
|
95
|
+
export type SidebarItemProps = (SidebarItemOwnProps & Omit<ComponentPropsWithRef<"button">, keyof SidebarItemOwnProps | "href"> & {
|
|
96
|
+
/** Pass a URL to render the item as a link (`<a>`). */
|
|
97
|
+
href?: undefined;
|
|
98
|
+
}) | (SidebarItemOwnProps & Omit<ComponentPropsWithRef<"a">, keyof SidebarItemOwnProps> & {
|
|
99
|
+
/** Pass a URL to render the item as a link (`<a>`). */
|
|
100
|
+
href: string;
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* A navigation link (or button) inside a `Sidebar.Section` or
|
|
104
|
+
* `Sidebar.Group`. Renders `<li>` around the control; `className`, `ref`, and
|
|
105
|
+
* other props go on the `<a>` / `<button>` itself. In overlay mode,
|
|
106
|
+
* activating an item closes the drawer (see `closeOnNavigate`).
|
|
107
|
+
*/
|
|
108
|
+
export declare const SidebarItem: {
|
|
109
|
+
(props: SidebarItemProps): import("react").JSX.Element;
|
|
110
|
+
displayName: string;
|
|
111
|
+
};
|
|
112
|
+
export interface SidebarGroupProps extends Omit<ComponentPropsWithRef<"li">, "children"> {
|
|
113
|
+
/** The disclosure button's visible label, and its accessible name. */
|
|
114
|
+
label: ReactNode;
|
|
115
|
+
/** Decorative icon before the label. Shown alone in rail mode. */
|
|
116
|
+
icon?: ReactNode;
|
|
117
|
+
/** Nested `Sidebar.Item`s. Rendered in a `<ul>` that the button controls. */
|
|
118
|
+
children?: ReactNode;
|
|
119
|
+
/** Controlled open state. */
|
|
120
|
+
open?: boolean;
|
|
121
|
+
/** Initial open state when uncontrolled. @default false */
|
|
122
|
+
defaultOpen?: boolean;
|
|
123
|
+
/** Called with the next open state. */
|
|
124
|
+
onOpenChange?: (open: boolean) => void;
|
|
125
|
+
/**
|
|
126
|
+
* One of the nested items is the current page. While the group is closed
|
|
127
|
+
* (or the sidebar is a rail), the button shows the active look so users can
|
|
128
|
+
* see where they are. It doesn't set `aria-current`; the nested item does. @default false
|
|
129
|
+
*/
|
|
130
|
+
active?: boolean;
|
|
131
|
+
/** A count or short text on the group button, like `Sidebar.Item`'s `badge`. */
|
|
132
|
+
badge?: SidebarBadgeValue;
|
|
133
|
+
/** Screen-reader text for the badge. */
|
|
134
|
+
badgeLabel?: string;
|
|
135
|
+
/** Badge color. @default "accent" */
|
|
136
|
+
badgeTone?: Tone;
|
|
137
|
+
/** Disables the disclosure button. @default false */
|
|
138
|
+
disabled?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* A stable key for the group. An uncontrolled group's open state is kept
|
|
141
|
+
* by key, so it survives a `mode` switch (which remounts the nav).
|
|
142
|
+
* Defaults to `label` when that is plain text.
|
|
143
|
+
*/
|
|
144
|
+
value?: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A collapsible set of nested items: a disclosure button (`aria-expanded`,
|
|
148
|
+
* `aria-controls`) and the `<ul>` it shows and hides. Enter and Space toggle
|
|
149
|
+
* it (native button behavior). In rail mode the nested list is hidden, and
|
|
150
|
+
* pressing the button expands the sidebar and opens the group.
|
|
151
|
+
*
|
|
152
|
+
* `className` and other props go on the wrapping `<li>`.
|
|
153
|
+
*/
|
|
154
|
+
export declare const SidebarGroup: {
|
|
155
|
+
({ label, icon, children, open: openProp, defaultOpen, onOpenChange, active, badge, badgeLabel, badgeTone, disabled, value, className, ...rest }: SidebarGroupProps): import("react").JSX.Element;
|
|
156
|
+
displayName: string;
|
|
157
|
+
};
|
|
158
|
+
export type SidebarToggleProps = Omit<Extract<IconButtonProps, {
|
|
159
|
+
href?: undefined;
|
|
160
|
+
}>, "aria-label" | "children"> & {
|
|
161
|
+
/** Accessible name (and tooltip) while expanded. @default "Collapse sidebar" */
|
|
162
|
+
collapseLabel?: string;
|
|
163
|
+
/** Accessible name (and tooltip) while collapsed. @default "Expand sidebar" */
|
|
164
|
+
expandLabel?: string;
|
|
165
|
+
/** Custom icon. Defaults to a chevron that points toward the collapse direction. */
|
|
166
|
+
children?: ReactNode;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* An `IconButton` that collapses the sidebar to an icon rail and back. Its
|
|
170
|
+
* name (and tooltip) states the action, switching between "Collapse sidebar"
|
|
171
|
+
* and "Expand sidebar"; it has no `aria-expanded`, since the sidebar stays
|
|
172
|
+
* visible as a rail and the name already carries the state. `aria-controls`
|
|
173
|
+
* points at the sidebar. Renders nothing in overlay mode. Defaults to
|
|
174
|
+
* `variant="ghost"`, `tone="neutral"`, `size="sm"`.
|
|
175
|
+
*/
|
|
176
|
+
export declare const SidebarToggle: {
|
|
177
|
+
({ collapseLabel: collapseLabelProp, expandLabel: expandLabelProp, variant, tone, size, className, children, onClick, ...rest }: SidebarToggleProps): import("react").JSX.Element | null;
|
|
178
|
+
displayName: string;
|
|
179
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../../../utils/cx.cjs.js"),t=require("./SkipLink.module.css.cjs.js"),n=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js");let r=require("react"),i=require("react/jsx-runtime");var a=`a[href], area[href], button, input, select, textarea, iframe, summary, [contenteditable=''], [contenteditable='true'], [tabindex]`,o=e=>{if(!e||!e.startsWith(`#`)||e.length<2)return null;let t=e.slice(1);try{t=decodeURIComponent(t)}catch{}return document.getElementById(t)},s=null,c=e=>{s?.(),s=null;let t=!e.matches(a)&&!e.hasAttribute(`tabindex`),n=()=>{e.removeEventListener(`blur`,n),t&&e.getAttribute(`tabindex`)===`-1`&&e.removeAttribute(`tabindex`),s===n&&(s=null)};return t&&(e.setAttribute(`tabindex`,`-1`),e.addEventListener(`blur`,n),s=n),e.focus({preventScroll:!0}),document.activeElement===e?(e.scrollIntoView?.({block:`start`}),!0):(n(),!1)};function l({href:r=`#main`,children:a,className:s,onClick:l,...u}){let d=n.useMessages(),f=a??d.skipLink.label,p=e=>{if(l?.(e),e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=o(r);if(t&&c(t)){e.preventDefault();try{window.location.hash!==r&&window.history.pushState(null,``,r)}catch{}}};return(0,i.jsx)(`a`,{...u,href:r,onClick:p,className:e.cx(t.default.root,s),children:f})}function u({className:n,children:a,...o}){return(0,i.jsx)(`ul`,{role:`list`,...o,className:e.cx(t.default.group,n),children:r.Children.map(a,(e,n)=>(0,r.isValidElement)(e)?(0,i.jsx)(`li`,{className:t.default.item,children:e},e.key??n):e)})}exports.SkipLink=l,exports.SkipLinks=u;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export interface SkipLinkProps extends ComponentPropsWithRef<"a"> {
|
|
3
|
+
/**
|
|
4
|
+
* Same-page fragment of the element to skip to, such as `"#main"` (the
|
|
5
|
+
* default). The target needs a matching `id`. On activation, focus moves
|
|
6
|
+
* to it (adding a temporary `tabindex="-1"` when it isn't natively
|
|
7
|
+
* focusable) and the URL hash is updated. Non-fragment URLs navigate
|
|
8
|
+
* normally.
|
|
9
|
+
*/
|
|
10
|
+
href?: string;
|
|
11
|
+
/** Link text. Defaults to "Skip to main content". */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Bypass link (WCAG 2.4.1) that stays visually hidden until it receives
|
|
16
|
+
* keyboard focus, then springs in as a high-contrast pill at the top start
|
|
17
|
+
* corner of the viewport, above every other layer. Render it as the first
|
|
18
|
+
* focusable element on the page.
|
|
19
|
+
*
|
|
20
|
+
* With a sticky header, give the target a `scroll-margin-top` of at least
|
|
21
|
+
* the header's height (WCAG 2.4.11), so it isn't scrolled under the header.
|
|
22
|
+
*
|
|
23
|
+
* Note: the target receives programmatic focus, so browsers may draw a focus
|
|
24
|
+
* ring around it (e.g. the whole `<main>`). That ring tells keyboard users
|
|
25
|
+
* where they landed; if you want to hide it, style `[tabindex="-1"]:focus`
|
|
26
|
+
* on the target rather than removing focus.
|
|
27
|
+
*/
|
|
28
|
+
export declare function SkipLink({ href, children: childrenProp, className, onClick, ...rest }: SkipLinkProps): import("react").JSX.Element;
|
|
29
|
+
export interface SkipLinksProps extends ComponentPropsWithRef<"ul"> {
|
|
30
|
+
/**
|
|
31
|
+
* `SkipLink` elements, in Tab order. Each one is wrapped in an `<li>` and
|
|
32
|
+
* appears in the same top-start spot when it has focus.
|
|
33
|
+
*/
|
|
34
|
+
children?: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Groups several skip links (for example navigation, search, and main
|
|
38
|
+
* content) as a list. Only the focused link is visible; Tab moves through
|
|
39
|
+
* them in order. Pass an `aria-label` (such as "Skip links") to name the list.
|
|
40
|
+
*/
|
|
41
|
+
export declare function SkipLinks({ className, children, ...rest }: SkipLinksProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`_root_1f8gq_17`,t=`_group_1f8gq_165`,n=`_item_1f8gq_177`,r={root:e,group:t,item:n};exports.default=r,exports.group=t,exports.item=n,exports.root=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useResponsiveValue.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../../utils/refs.cjs.js"),i=require("../../../utils/flattenChildren.cjs.js"),a=require("../../primitives/Icon/icons.cjs.js"),o=require("../../primitives/Icon/Icon.cjs.js"),s=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),c=require("./Stepper.module.css.cjs.js"),l=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),u=require("../../../i18n/en.cjs.js");let d=require("react"),f=require("react/jsx-runtime");var p=u.en.stepper.status,m=e=>({step:t,total:n,title:r})=>t>n?e.allComplete(n):r?e.stepTitled(t,n,r):e.step(t,n),h={sm:c.default.sm,md:c.default.md,lg:c.default.lg},g={horizontal:c.default.horizontal,vertical:c.default.vertical},_={complete:c.default.statusComplete,current:c.default.statusCurrent,upcoming:c.default.statusUpcoming,error:c.default.statusError},v=6,y=(0,d.createContext)(null),b=(0,d.createContext)(0);function x(){let e=(0,d.useContext)(y);if(!e)throw Error(`Stepper.Step must be used inside a Stepper.`);return e}function S(e,t){return e<t?`complete`:e===t?`current`:`upcoming`}function C({activeStep:a,defaultActiveStep:o=0,onActiveStepChange:u,orientation:p=`horizontal`,size:_=`md`,clickable:x=!1,linear:C=!0,compact:w=`auto`,announce:T=!1,announcement:E,statusLabels:D,"aria-label":O,className:k,children:A,ref:j,...M}){let N=l.useMessages(),P=E??m(N.stepper),F=O??N.stepper.nav,[I,L]=e.useControllableState({value:a,defaultValue:o,onChange:u}),R=t.useResponsiveValue(p,`horizontal`),z=R===`horizontal`,B=x||!C,V=i.flattenChildren(A),H=V.length,U=(0,d.useRef)(null),W=(0,d.useCallback)(e=>{U.current=e,r.assignRef(j,e)},[j]),[G,K]=(0,d.useState)(!1);(0,d.useLayoutEffect)(()=>{if(!z||w!==`auto`)return;let e=U.current;if(!e)return;let t=()=>{let t=parseFloat(getComputedStyle(e).fontSize)||16,n=e.clientWidth/Math.max(H,1);K(n<v*t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[z,w,H]);let q=z&&(w===`auto`?G:w),[J,Y]=(0,d.useState)(``),X=(0,d.useRef)(!0);(0,d.useEffect)(()=>{if(X.current){X.current=!1;return}if(!T)return;let e=U.current?.querySelector(`[data-step-index="${I}"] [data-step-title]`),t=V[I];Y(P({step:I+1,total:H,title:e?.textContent?.trim()??``,status:t?t.props.status??S(I,I):void 0}))},[I]);let Z={activeStep:I,setActiveStep:L,interactive:B,linear:C,statusLabels:{...N.stepper.status,...D}},Q=V[I],$=B?`nav`:`div`;return(0,f.jsx)(y.Provider,{value:Z,children:(0,f.jsxs)($,{role:B?void 0:`group`,"aria-label":F,...M,ref:W,className:n.cx(c.default.root,g[R],h[_],q&&c.default.compact,B&&c.default.interactive,k),"data-orientation":R,children:[(0,f.jsx)(`ol`,{role:`list`,className:c.default.list,children:V.map((e,t)=>(0,f.jsx)(b.Provider,{value:t,children:e},e.key??t))}),q&&(0,f.jsxs)(`div`,{className:c.default.caption,"aria-hidden":`true`,children:[(0,f.jsx)(`span`,{className:c.default.captionCount,children:I>=H?N.stepper.count(H,H):N.stepper.step(I+1,H)}),Q&&(0,f.jsx)(`span`,{className:c.default.captionTitle,children:Q.props.title})]}),T&&(0,f.jsx)(s.VisuallyHidden,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:J})]})})}var w=()=>(0,f.jsxs)(o.Icon,{strokeWidth:3,children:[(0,f.jsx)(`path`,{d:`M12 6v7.5`}),(0,f.jsx)(`circle`,{cx:`12`,cy:`18`,r:`1.6`,fill:`currentColor`,stroke:`none`})]});function T({title:e,description:t,icon:r,status:i,disabled:o=!1,statusLabel:u,className:p,...m}){let h=l.useMessages(),{activeStep:g,setActiveStep:v,interactive:y,linear:C,statusLabels:T}=x(),E=(0,d.useContext)(b),D=i??S(E,g),O=E===g,k=u??T[D],A=y&&(!C||E<=g||D===`complete`),j;j=D===`complete`?(0,f.jsx)(a.CheckIcon,{strokeWidth:3}):D===`error`?(0,f.jsx)(w,{}):r??(0,f.jsx)(`span`,{className:c.default.number,children:E+1});let M=(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:c.default.marker,"aria-hidden":`true`,children:j}),(0,f.jsxs)(`span`,{className:c.default.text,children:[(0,f.jsx)(s.VisuallyHidden,{children:h.stepper.prefix(E+1)}),(0,f.jsx)(`span`,{className:c.default.title,"data-step-title":``,children:e}),(0,f.jsx)(s.VisuallyHidden,{children:`, ${k}`}),t!=null&&(0,f.jsx)(`span`,{className:c.default.description,children:t})]})]});return(0,f.jsxs)(`li`,{"aria-current":O&&!A?`step`:void 0,...m,className:n.cx(c.default.item,_[D],o&&A&&c.default.disabled,p),"data-status":D,"data-step-index":E,children:[A?(0,f.jsx)(`button`,{type:`button`,className:n.cx(c.default.trigger,c.default.button),"aria-current":O?`step`:void 0,disabled:o,onClick:()=>v(E),children:M}):(0,f.jsx)(`div`,{className:c.default.trigger,children:M}),(0,f.jsx)(`span`,{className:c.default.connector,"aria-hidden":`true`,children:(0,f.jsx)(`span`,{className:c.default.fill})})]})}var E=Object.assign(C,{Step:T});exports.Step=T,exports.Stepper=E,exports.defaultStepperStatusLabels=p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`_root_uas10_33`,t=`_list_uas10_67`,n=`_sm_uas10_85`,r=`_md_uas10_107`,i=`_lg_uas10_115`,a=`_item_uas10_145`,o=`_trigger_uas10_155`,s=`_button_uas10_179`,c=`_title_uas10_205`,l=`_marker_uas10_217`,u=`_text_uas10_233`,d=`_statusCurrent_uas10_267`,f=`_statusError_uas10_269`,p=`_statusUpcoming_uas10_277`,m=`_description_uas10_285`,h=`_number_uas10_353`,g=`_statusComplete_uas10_371`,_=`_disabled_uas10_453`,v=`_connector_uas10_493`,y=`_fill_uas10_509`,b=`_horizontal_uas10_529`,x=`_compact_uas10_629`,S=`_caption_uas10_671`,C=`_captionCount_uas10_689`,w=`_captionTitle_uas10_707`,T=`_vertical_uas10_731`,E={root:e,list:t,sm:n,md:r,lg:i,item:a,trigger:o,button:s,title:c,marker:l,text:u,statusCurrent:d,statusError:f,statusUpcoming:p,description:m,number:h,statusComplete:g,"stepper-pop":`_stepper-pop_uas10_1`,disabled:_,connector:v,fill:y,horizontal:b,compact:x,caption:S,captionCount:C,captionTitle:w,vertical:T};exports.button=s,exports.caption=S,exports.captionCount=C,exports.captionTitle=w,exports.compact=x,exports.connector=v,exports.default=E,exports.description=m,exports.disabled=_,exports.fill=y,exports.horizontal=b,exports.item=a,exports.lg=i,exports.list=t,exports.marker=l,exports.md=r,exports.number=h,exports.root=e,exports.sm=n,exports.statusComplete=g,exports.statusCurrent=d,exports.statusError=f,exports.statusUpcoming=p,exports.text=u,exports.title=c,exports.trigger=o,exports.vertical=T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../utils/cx.cjs.js"),n=require("../../data-display/Badge/Badge.cjs.js"),r=require("./Tabs.module.css.cjs.js");let i=require("react"),a=require("react/jsx-runtime");var o={line:r.default.line,pill:r.default.pill,enclosed:r.default.enclosed},s={sm:r.default.sm,md:r.default.md,lg:r.default.lg},c={horizontal:r.default.horizontal,vertical:r.default.vertical},l=e=>e.replace(/[^A-Za-z0-9_-]/g,e=>`_${e.charCodeAt(0).toString(16)}`);function u(){let[e,t]=(0,i.useState)({});return[e,(0,i.useCallback)((e,n)=>(t(t=>t[e]===n?t:{...t,[e]:n}),()=>t(t=>{if(t[e]!==n)return t;let r={...t};return delete r[e],r})),[])]}var d=(0,i.createContext)(null);function f(e){let t=(0,i.useContext)(d);if(!t)throw Error(`<${e}> must be used inside <Tabs>.`);return t}var p=(e,t)=>`${e}-tab-${l(t)}`,m=(e,t)=>`${e}-panel-${l(t)}`;function h({value:n,defaultValue:l,onValueChange:f,variant:p=`line`,size:m=`md`,orientation:h=`horizontal`,activationMode:g=`automatic`,fullWidth:_=!1,keepMounted:v=!1,className:y,children:b,...x}){let S=(0,i.useId)(),[C,w]=e.useControllableState({value:n,defaultValue:l,onChange:f}),[T,E]=(0,i.useState)(void 0),[D,O]=(0,i.useState)(void 0),k=(0,i.useCallback)(e=>w(e),[w]),[A,j]=u(),[M,N]=u(),P=C??D,F=(0,i.useMemo)(()=>({baseId:S,selected:P,select:k,tabStop:T,setTabStop:E,setFirstEnabled:O,orientation:h,activationMode:g,variant:p,size:m,keepMounted:v,tabIds:A,panelIds:M,registerTab:j,registerPanel:N}),[S,P,k,T,h,g,p,m,v,A,M,j,N]);return(0,a.jsx)(d.Provider,{value:F,children:(0,a.jsx)(`div`,{...x,"data-orientation":h,className:t.cx(r.default.root,o[p],s[m],c[h],_&&r.default.fullWidth,y),children:b})})}var g=`[role="tab"]`;function _({className:e,children:n,onKeyDown:o,ref:s,...c}){let{selected:l,setTabStop:u,setFirstEnabled:d,orientation:p,activationMode:m,variant:h,select:_}=f(`Tabs.List`),v=(0,i.useRef)(null),y=(0,i.useRef)(null),b=(0,i.useRef)(null),x=(0,i.useRef)(!1),S=h!==`enclosed`,C=(0,i.useCallback)(e=>{if(v.current=e,typeof s==`function`)return s(e);s&&(s.current=e)},[s]),w=(0,i.useCallback)(e=>{let t=y.current;if(!t)return[];let n=Array.from(t.querySelectorAll(g));return e?n.filter(e=>!e.disabled):n},[]),[T,E]=(0,i.useState)(0);(0,i.useLayoutEffect)(()=>{let e=y.current;if(!e||typeof MutationObserver>`u`)return;let t=new MutationObserver(()=>E(e=>e+1));return t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`disabled`,`data-value`]}),()=>t.disconnect()},[]),(0,i.useLayoutEffect)(()=>{let e=w(!0),t=e.find(e=>e.dataset.value===l)??e[0];u(t?.dataset.value),d(e[0]?.dataset.value)},[w,l,T,u,d]);let D=(0,i.useCallback)(e=>{let t=y.current,n=b.current;if(!t||!n)return;let r=t.querySelector(`${g}[aria-selected="true"]`);if(!r){n.dataset.hidden=``,x.current=!1;return}let i=e||!x.current||n.dataset.hidden!==void 0;i&&(n.dataset.instant=``),n.style.setProperty(`--_tabs-ind-x`,`${r.offsetLeft}px`),n.style.setProperty(`--_tabs-ind-y`,`${r.offsetTop}px`),n.style.setProperty(`--_tabs-ind-w`,`${r.offsetWidth}px`),n.style.setProperty(`--_tabs-ind-h`,`${r.offsetHeight}px`),delete n.dataset.hidden,i&&(n.offsetWidth,delete n.dataset.instant),x.current=!0},[]);(0,i.useLayoutEffect)(()=>{S&&D(!1)},[S,D,l,T,p,h]);let O=(0,i.useRef)(null),k=(0,i.useRef)(new WeakSet);(0,i.useEffect)(()=>{if(!S||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>D(!0));return O.current=e,()=>{e.disconnect(),O.current=null,k.current=new WeakSet}},[S,D]),(0,i.useEffect)(()=>{let e=O.current,t=y.current;if(e&&t)for(let n of[t,...t.querySelectorAll(g)])k.current.has(n)||(k.current.add(n),e.observe(n))},[S,D,T]);let A=(0,i.useRef)(!1);(0,i.useEffect)(()=>{let e=v.current,t=y.current;if(!e||!t||p!==`horizontal`||e.scrollWidth<=e.clientWidth)return;let n=t.querySelector(`${g}[aria-selected="true"]`);if(!n)return;let r=parseFloat(getComputedStyle(e).paddingInlineStart)||0,i=e.getBoundingClientRect(),a=n.getBoundingClientRect(),o=0;if(a.left<i.left+r?o=a.left-i.left-r:a.right>i.right-r&&(o=a.right-i.right+r),o!==0){let t=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;e.scrollBy({left:o,behavior:!A.current||t?`auto`:`smooth`})}A.current=!0},[l,p]);let j=e=>{if(o?.(e),e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey)return;let t=e.target.closest(g);if(!t||!y.current?.contains(t))return;let n=w(!0);if(n.length===0)return;let r=n.indexOf(t),i=getComputedStyle(e.currentTarget).direction===`rtl`,a,s=e=>n[(((r===-1?0:r)+e)%n.length+n.length)%n.length];switch(e.key){case`ArrowRight`:p===`horizontal`&&(a=s(i?-1:1));break;case`ArrowLeft`:p===`horizontal`&&(a=s(i?1:-1));break;case`ArrowDown`:p===`vertical`&&(a=s(1));break;case`ArrowUp`:p===`vertical`&&(a=s(-1));break;case`Home`:a=n[0];break;case`End`:a=n[n.length-1];break;default:return}if(!a)return;e.preventDefault(),a.focus();let c=a.dataset.value;m===`automatic`&&c!==void 0&&_(c)};return(0,a.jsx)(`div`,{...c,ref:C,role:`tablist`,"aria-orientation":p,onKeyDown:j,className:t.cx(r.default.list,e),children:(0,a.jsxs)(`div`,{ref:y,className:r.default.track,children:[n,S&&(0,a.jsx)(`span`,{ref:b,className:r.default.indicator,"data-hidden":``,"data-instant":``,"aria-hidden":`true`})]})})}function v({value:e,icon:o,badge:s,badgeLabel:c,disabled:l=!1,className:u,children:d,onClick:m,id:h,...g}){let _=f(`Tabs.Tab`),v=_.selected===e,y=d!=null,b=o!=null,x=h??p(_.baseId,e),{registerTab:S}=_;(0,i.useLayoutEffect)(()=>S(e,x),[S,e,x]);let C=typeof s==`number`?(0,a.jsx)(n.Badge,{count:s,size:`sm`,variant:v?`solid`:`soft`,tone:v?`accent`:`neutral`,label:c}):s,w=C!=null&&C!==!1;return(0,a.jsx)(`button`,{...g,type:`button`,role:`tab`,id:x,"data-value":e,"aria-selected":v,"aria-controls":_.panelIds[e],tabIndex:_.tabStop===e?0:-1,disabled:l,className:t.cx(r.default.tab,!y&&r.default.iconOnly,u),onClick:t=>{m?.(t),!t.defaultPrevented&&!l&&_.select(e)},children:(0,a.jsxs)(`span`,{className:r.default.content,children:[b&&(0,a.jsx)(`span`,{className:r.default.icon,"aria-hidden":`true`,children:o}),y&&(0,a.jsxs)(`span`,{className:r.default.labelStack,children:[(0,a.jsx)(`span`,{className:r.default.labelText,children:d}),(0,a.jsx)(`span`,{className:r.default.labelSizer,"aria-hidden":`true`,children:d})]}),w&&(0,a.jsx)(`span`,{className:r.default.badge,children:C})]})})}function y({value:e,keepMounted:n,className:o,children:s,id:c,tabIndex:l=0,"aria-labelledby":u,...d}){let h=f(`Tabs.Panel`),g=h.selected===e,_=n??h.keepMounted,v=g||_,y=c??m(h.baseId,e),{registerPanel:b}=h;return(0,i.useLayoutEffect)(()=>v?b(e,y):void 0,[v,b,e,y]),v?(0,a.jsx)(`div`,{...d,role:`tabpanel`,id:y,"aria-labelledby":u??h.tabIds[e]??p(h.baseId,e),tabIndex:l,hidden:!g,"data-selected":g||void 0,className:t.cx(r.default.panel,o),children:s}):null}var b=Object.assign(h,{List:_,Tab:v,Panel:y});exports.Tab=v,exports.TabPanel=y,exports.Tabs=b,exports.TabsList=_;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { Orientation, Size } from '../../../types/common';
|
|
3
|
+
/**
|
|
4
|
+
* Visual style of the tab list.
|
|
5
|
+
* - `line`: tabs sit on a hairline; a chunky rounded primary bar springs
|
|
6
|
+
* under (or, vertically, beside) the selected tab.
|
|
7
|
+
* - `pill`: free-floating pill tabs with no track; a solid, inverse
|
|
8
|
+
* "jersey" pill springs behind the selected tab.
|
|
9
|
+
* - `enclosed`: folder tabs. The selected tab lifts onto the panel's surface
|
|
10
|
+
* with a primary cap along its outer edge, and the panel is framed to match.
|
|
11
|
+
*/
|
|
12
|
+
export type TabsVariant = "line" | "pill" | "enclosed";
|
|
13
|
+
/**
|
|
14
|
+
* How arrow keys behave.
|
|
15
|
+
* - `automatic`: moving focus also selects the tab (best when panels render instantly).
|
|
16
|
+
* - `manual`: arrows only move focus; Enter or Space selects (best when panels are slow to load).
|
|
17
|
+
*/
|
|
18
|
+
export type TabsActivationMode = "automatic" | "manual";
|
|
19
|
+
export interface TabsProps extends Omit<ComponentPropsWithRef<"div">, "defaultValue" | "onChange"> {
|
|
20
|
+
/** Selected tab value (controlled). Use with `onValueChange`. */
|
|
21
|
+
value?: string;
|
|
22
|
+
/** Initially selected tab value (uncontrolled). When omitted, the first enabled tab starts selected. */
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
/** Called with the newly selected tab's `value`. */
|
|
25
|
+
onValueChange?: (value: string) => void;
|
|
26
|
+
/** Visual style of the tab list. See `TabsVariant`. @default "line" */
|
|
27
|
+
variant?: TabsVariant;
|
|
28
|
+
/** Tab height, padding, and type size. @default "md" */
|
|
29
|
+
size?: Size;
|
|
30
|
+
/** Tabs in a row above the panels, or in a column beside them. Sets `aria-orientation` and the arrow keys. @default "horizontal" */
|
|
31
|
+
orientation?: Orientation;
|
|
32
|
+
/** Whether arrow keys also select (`automatic`) or only move focus (`manual`, select with Enter or Space). @default "automatic" */
|
|
33
|
+
activationMode?: TabsActivationMode;
|
|
34
|
+
/** Stretch the tabs to share the list's full width equally (horizontal only). @default false */
|
|
35
|
+
fullWidth?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Keep inactive panels mounted (hidden with the `hidden` attribute) so their
|
|
38
|
+
* state survives tab switches. By default only the active panel renders.
|
|
39
|
+
* `Tabs.Panel` can override this per panel. @default false
|
|
40
|
+
*/
|
|
41
|
+
keepMounted?: boolean;
|
|
42
|
+
/** `Tabs.List` and `Tabs.Panel` parts. */
|
|
43
|
+
children?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Switches between related panels of content, one visible at a time.
|
|
47
|
+
* Compose `Tabs.List` with `Tabs.Tab` children, plus one `Tabs.Panel` per tab,
|
|
48
|
+
* matched by `value`.
|
|
49
|
+
*
|
|
50
|
+
* Follows the WAI-ARIA Tabs pattern: `tablist` / `tab` / `tabpanel` roles,
|
|
51
|
+
* roving tabindex, arrow keys (direction-aware, swapped in RTL), Home / End,
|
|
52
|
+
* and automatic or manual activation.
|
|
53
|
+
*
|
|
54
|
+
* Use `SegmentedControl` for a form value, and `ToggleGroup` for pressed buttons.
|
|
55
|
+
*/
|
|
56
|
+
declare function TabsRoot({ value: valueProp, defaultValue, onValueChange, variant, size, orientation, activationMode, fullWidth, keepMounted, className, children, ...rest }: TabsProps): import("react").JSX.Element;
|
|
57
|
+
export interface TabsListProps extends ComponentPropsWithRef<"div"> {
|
|
58
|
+
/**
|
|
59
|
+
* `Tabs.Tab` children. Name the list with `aria-label` or `aria-labelledby`
|
|
60
|
+
* when the page has more than one tab set or no heading names it.
|
|
61
|
+
*/
|
|
62
|
+
children?: ReactNode;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The `role="tablist"` row (or column) of tabs. In a horizontal list, tabs
|
|
66
|
+
* never wrap: the list scrolls sideways when it is wider than its container
|
|
67
|
+
* and keeps the selected tab in view.
|
|
68
|
+
*/
|
|
69
|
+
declare function TabsList({ className, children, onKeyDown, ref, ...rest }: TabsListProps): import("react").JSX.Element;
|
|
70
|
+
type NativeTabProps = Omit<ComponentPropsWithRef<"button">, "value" | "type" | "children" | "aria-label" | "role">;
|
|
71
|
+
interface TabBaseProps extends NativeTabProps {
|
|
72
|
+
/**
|
|
73
|
+
* Identifies the tab and matches it to the `Tabs.Panel` with the same `value`.
|
|
74
|
+
* Tab and panel ids are generated from it; if you pass your own `id`, give
|
|
75
|
+
* the panel a matching `aria-labelledby`.
|
|
76
|
+
*/
|
|
77
|
+
value: string;
|
|
78
|
+
/** Decorative icon before the label (e.g. `<Icon name="settings" />`). */
|
|
79
|
+
icon?: ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* Trailing count or tag. A number renders a small `Badge` (accent when the
|
|
82
|
+
* tab is selected, neutral otherwise); any other node renders as given.
|
|
83
|
+
* A `0` count is hidden.
|
|
84
|
+
*/
|
|
85
|
+
badge?: ReactNode;
|
|
86
|
+
/** Screen-reader text for a numeric `badge`, e.g. `"3 unread"`, so the tab is not announced as a bare number. */
|
|
87
|
+
badgeLabel?: string;
|
|
88
|
+
/** Disables the tab. Arrow keys, Home, and End skip it. */
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Props for `Tabs.Tab`. Pass the visible label as `children`, or, for an
|
|
93
|
+
* icon-only tab, pass `icon` and a required `aria-label`.
|
|
94
|
+
*/
|
|
95
|
+
export type TabProps = TabBaseProps & ({
|
|
96
|
+
/** Visible tab label. */
|
|
97
|
+
children: NonNullable<ReactNode>;
|
|
98
|
+
/** Overrides the accessible name (rarely needed). */
|
|
99
|
+
"aria-label"?: string;
|
|
100
|
+
} | {
|
|
101
|
+
children?: undefined;
|
|
102
|
+
/** The icon that stands in for the label. */
|
|
103
|
+
icon: NonNullable<ReactNode>;
|
|
104
|
+
/** Accessible name for the icon-only tab (required). */
|
|
105
|
+
"aria-label": string;
|
|
106
|
+
});
|
|
107
|
+
/** One tab: a native `<button role="tab">`. Must be inside `Tabs.List`. */
|
|
108
|
+
declare function Tab({ value, icon, badge, badgeLabel, disabled, className, children, onClick, id: idProp, ...rest }: TabProps): import("react").JSX.Element;
|
|
109
|
+
export interface TabPanelProps extends Omit<ComponentPropsWithRef<"div">, "role"> {
|
|
110
|
+
/** The `value` of the `Tabs.Tab` this panel belongs to. */
|
|
111
|
+
value: string;
|
|
112
|
+
/** Keep this panel mounted (hidden) while inactive. Overrides `Tabs`'s `keepMounted`. */
|
|
113
|
+
keepMounted?: boolean;
|
|
114
|
+
/** Panel content. */
|
|
115
|
+
children?: ReactNode;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The `role="tabpanel"` content for one tab, labelled by its tab. It is
|
|
119
|
+
* focusable (`tabIndex=0`) so keyboard users can reach content that has no
|
|
120
|
+
* focusable elements of its own.
|
|
121
|
+
*/
|
|
122
|
+
declare function TabPanel({ value, keepMounted: keepMountedProp, className, children, id: idProp, tabIndex, "aria-labelledby": ariaLabelledBy, ...rest }: TabPanelProps): import("react").JSX.Element | null;
|
|
123
|
+
/** Tabs root. See `TabsProps`; compose with `Tabs.List`, `Tabs.Tab`, and `Tabs.Panel`. */
|
|
124
|
+
export declare const Tabs: typeof TabsRoot & {
|
|
125
|
+
/** The `tablist` that holds the tabs. */
|
|
126
|
+
List: typeof TabsList;
|
|
127
|
+
/** One tab button. */
|
|
128
|
+
Tab: typeof Tab;
|
|
129
|
+
/** The content panel for one tab. */
|
|
130
|
+
Panel: typeof TabPanel;
|
|
131
|
+
};
|
|
132
|
+
export { TabsList, Tab, TabPanel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`_sm_1udqw_45`,t=`_md_1udqw_59`,n=`_lg_1udqw_73`,r=`_root_1udqw_97`,i=`_vertical_1udqw_119`,a=`_enclosed_1udqw_137`,o=`_list_1udqw_159`,s=`_horizontal_1udqw_177`,c=`_tab_1udqw_211`,l=`_track_1udqw_219`,u=`_iconOnly_1udqw_331`,d=`_fullWidth_1udqw_349`,f=`_content_1udqw_399`,p=`_icon_1udqw_331`,m=`_labelStack_1udqw_447`,h=`_labelSizer_1udqw_461`,g=`_badge_1udqw_471`,_=`_indicator_1udqw_493`,v=`_line_1udqw_535`,y=`_pill_1udqw_615`,b=`_panel_1udqw_787`,x={sm:e,md:t,lg:n,root:r,vertical:i,enclosed:a,list:o,horizontal:s,tab:c,track:l,iconOnly:u,fullWidth:d,content:f,icon:p,labelStack:m,labelSizer:h,badge:g,indicator:_,line:v,pill:y,panel:b};exports.badge=g,exports.content=f,exports.default=x,exports.enclosed=a,exports.fullWidth=d,exports.horizontal=s,exports.icon=p,exports.iconOnly=u,exports.indicator=_,exports.labelSizer=h,exports.labelStack=m,exports.lg=n,exports.line=v,exports.list=o,exports.md=t,exports.panel=b,exports.pill=y,exports.root=r,exports.sm=e,exports.tab=c,exports.track=l,exports.vertical=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../../../hooks/useMergedRef.cjs.js"),t=require("../../../utils/cx.cjs.js"),n=require("../../../utils/hotkeys.cjs.js"),r=require("../../layout/Divider/Divider.cjs.js"),i=require("./ToolbarContext.cjs.js"),a=require("./Toolbar.module.css.cjs.js");let o=require("react"),s=require("react/jsx-runtime");var c=globalThis.process?.env?.NODE_ENV!==`production`,l=`button, a[href], input:not([type="hidden"]), select, textarea, [tabindex], [contenteditable=""], [contenteditable="true"]`,u=`[role="radiogroup"], [role="tablist"], [role="listbox"], [role="grid"], [role="treegrid"], [role="tree"], [role="menu"], [role="menubar"], [role="toolbar"], [data-roving-focus]`,d=`data-toolbar-item`;function f(e,t){if(e.disabled||e.closest(`[hidden], [inert]`)||e.getAttribute(`tabindex`)===`-1`&&!e.hasAttribute(d))return!1;let n=e.parentElement?.closest(u);return!n||n===t||!t.contains(n)}function p(e){return Array.from(e.querySelectorAll(l)).filter(t=>f(t,e))}function m(e,t){let n=p(e),r=t&&n.includes(t)?t:n[0]??null;for(let e of n)e.setAttribute(d,``),e.tabIndex=e===r?0:-1;return r}var h={plain:a.default.plain,surface:a.default.surface};function g({orientation:r=`horizontal`,variant:l=`surface`,loop:u=!0,wrap:f=!1,className:g,children:_,onKeyDown:v,onFocus:y,ref:b,...x}){let S=(0,o.useRef)(null),C=e.useMergedRef(b,S),w=(0,o.useRef)(null),T=!!(x[`aria-label`]||x[`aria-labelledby`]);(0,o.useEffect)(()=>{c&&!T&&console.warn(`[Toolbar] Give it a name: aria-label or aria-labelledby.`)},[T]),(0,o.useLayoutEffect)(()=>{let e=S.current;e&&(w.current=m(e,w.current))}),(0,o.useEffect)(()=>{let e=S.current;if(!e||typeof MutationObserver>`u`)return;let t=new MutationObserver(()=>{w.current=m(e,w.current)});return t.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`disabled`,`hidden`,`inert`,`role`,`data-roving-focus`]}),()=>t.disconnect()},[]);let E=e=>{y?.(e);let t=S.current,n=e.target;t&&n.hasAttribute(d)&&n!==w.current&&(w.current=m(t,n))},D=e=>{v?.(e);let t=S.current;if(e.defaultPrevented||!t||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let i=e.target,a=p(t),o=a.indexOf(i);if(o===-1)return;let s=r===`vertical`,c=getComputedStyle(t).direction===`rtl`,l=s?`ArrowDown`:c?`ArrowLeft`:`ArrowRight`,d=s?`ArrowUp`:c?`ArrowRight`:`ArrowLeft`;if(n.isTypingTarget(i)){let t=i instanceof HTMLTextAreaElement||i instanceof HTMLSelectElement;if(!s||t||e.key===`Home`||e.key===`End`)return}let f=a.length-1,m=null;e.key===l?m=o<f?o+1:u?0:null:e.key===d?m=o>0?o-1:u?f:null:e.key===`Home`?m=0:e.key===`End`&&(m=f),m!==null&&(e.preventDefault(),a[m].focus())},O=(0,o.useMemo)(()=>({orientation:r}),[r]);return(0,s.jsx)(i.ToolbarContext.Provider,{value:O,children:(0,s.jsx)(`div`,{...x,ref:C,role:`toolbar`,"aria-orientation":r,"data-orientation":r,className:t.cx(a.default.toolbar,h[l],r===`vertical`&&a.default.vertical,f&&r===`horizontal`&&a.default.wrap,g),onKeyDown:D,onFocus:E,children:_})})}function _({className:e}){let n=(0,o.useContext)(i.ToolbarContext)?.orientation===`vertical`?`horizontal`:`vertical`;return(0,s.jsx)(r.Divider,{orientation:n,spacing:1,className:t.cx(a.default.separator,e)})}function v({className:e,children:n,...r}){return(0,s.jsx)(`div`,{...r,role:`group`,className:t.cx(a.default.group,e),children:n})}var y=g;y.Separator=_,y.Group=v,exports.Toolbar=y,exports.ToolbarGroup=v,exports.ToolbarSeparator=_;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { Orientation } from '../../../types/common';
|
|
3
|
+
/** Visual style of the toolbar container. */
|
|
4
|
+
export type ToolbarVariant = "plain" | "surface";
|
|
5
|
+
export interface ToolbarProps extends Omit<ComponentPropsWithRef<"div">, "role"> {
|
|
6
|
+
/**
|
|
7
|
+
* Direction of the controls. Also picks the arrow keys: Left/Right when
|
|
8
|
+
* horizontal (following the reading direction), Up/Down when vertical.
|
|
9
|
+
* @default "horizontal"
|
|
10
|
+
*/
|
|
11
|
+
orientation?: Orientation;
|
|
12
|
+
/** `surface`: a rounded, bordered bar. `plain`: no container styling. @default "surface" */
|
|
13
|
+
variant?: ToolbarVariant;
|
|
14
|
+
/** Arrow keys wrap from the last control to the first, and back. @default true */
|
|
15
|
+
loop?: boolean;
|
|
16
|
+
/** Let controls wrap onto more lines when there isn't room (horizontal only). @default false */
|
|
17
|
+
wrap?: boolean;
|
|
18
|
+
/** The controls: buttons, toggle groups, links, menus, inputs, `Toolbar.Separator`, and `Toolbar.Group`. */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A set of controls, such as text formatting or a table's actions, that acts
|
|
23
|
+
* as one Tab stop: the WAI-ARIA toolbar pattern.
|
|
24
|
+
*
|
|
25
|
+
* Keyboard: Tab moves into the toolbar (to the last used control) and out of
|
|
26
|
+
* it. Arrow keys move between controls (Left/Right, mirrored in right-to-left
|
|
27
|
+
* layouts, or Up/Down when vertical), and Home and End jump to the first and
|
|
28
|
+
* last. Disabled controls are skipped. In a text field, the arrow keys, Home,
|
|
29
|
+
* and End keep editing the text. A `ToggleGroup` inside joins the toolbar's
|
|
30
|
+
* arrow keys; other widgets with their own arrow keys (radio groups, tabs,
|
|
31
|
+
* `SegmentedControl`) stay a separate Tab stop.
|
|
32
|
+
*
|
|
33
|
+
* Give it a name with `aria-label` or `aria-labelledby` (e.g. "Text formatting").
|
|
34
|
+
*/
|
|
35
|
+
declare function ToolbarRoot({ orientation, variant, loop, wrap, className, children, onKeyDown, onFocus, ref, ...rest }: ToolbarProps): import("react").JSX.Element;
|
|
36
|
+
export interface ToolbarSeparatorProps {
|
|
37
|
+
/** Additional class for the separator. */
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A line between groups of controls, drawn across the toolbar's direction
|
|
42
|
+
* (`role="separator"`). It isn't focusable, and arrow keys skip it.
|
|
43
|
+
*/
|
|
44
|
+
declare function ToolbarSeparator({ className }: ToolbarSeparatorProps): import("react").JSX.Element;
|
|
45
|
+
export interface ToolbarGroupProps extends Omit<ComponentPropsWithRef<"div">, "role"> {
|
|
46
|
+
/** Related controls. Name the group with `aria-label` (e.g. "Alignment") if the controls don't make it obvious. */
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Keeps related controls together (`role="group"`), so a wrapping toolbar
|
|
51
|
+
* moves them to the next line as one. Its controls stay in the toolbar's
|
|
52
|
+
* arrow-key order.
|
|
53
|
+
*/
|
|
54
|
+
declare function ToolbarGroup({ className, children, ...rest }: ToolbarGroupProps): import("react").JSX.Element;
|
|
55
|
+
type ToolbarComponent = typeof ToolbarRoot & {
|
|
56
|
+
Separator: typeof ToolbarSeparator;
|
|
57
|
+
Group: typeof ToolbarGroup;
|
|
58
|
+
};
|
|
59
|
+
/** A row (or column) of controls that is one Tab stop, with arrow keys between controls. */
|
|
60
|
+
export declare const Toolbar: ToolbarComponent;
|
|
61
|
+
/** Named exports, for React Server Components (which can't dot into a client module). */
|
|
62
|
+
export { ToolbarSeparator, ToolbarGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`_toolbar_orlw6_15`,t=`_vertical_orlw6_31`,n=`_wrap_orlw6_43`,r=`_plain_orlw6_57`,i=`_surface_orlw6_65`,a=`_group_orlw6_85`,o=`_separator_orlw6_101`,s={toolbar:e,vertical:t,wrap:n,plain:r,surface:i,group:a,separator:o};exports.default=s,exports.group=a,exports.plain=r,exports.separator=o,exports.surface=i,exports.toolbar=e,exports.vertical=t,exports.wrap=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=(0,require("react").createContext)(null);exports.ToolbarContext=e;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Orientation } from '../../../types/common';
|
|
2
|
+
/**
|
|
3
|
+
* Internal: set by `Toolbar` so controls inside can adapt (a `ToggleGroup`
|
|
4
|
+
* turns off its own roving focus and joins the toolbar's arrow keys, and
|
|
5
|
+
* `Toolbar.Separator` draws across the toolbar's direction).
|
|
6
|
+
*/
|
|
7
|
+
export declare const ToolbarContext: import('react').Context<{
|
|
8
|
+
orientation: Orientation;
|
|
9
|
+
} | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../../../hooks/useOverlayLayer.cjs.js"),t=require("../../../hooks/useControllableState.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../primitives/Kbd/Kbd.cjs.js"),i=require("../../../utils/hotkeys.cjs.js"),a=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),o=require("../Modal/Modal.cjs.js"),ee=require("./CommandPaletteContext.cjs.js"),s=require("./CommandPaletteParts.cjs.js"),c=require("./commandPaletteUtils.cjs.js"),l=require("./CommandPalette.module.css.cjs.js"),te=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),ne=require("../../../i18n/en.cjs.js");let u=require("react"),d=require("react/jsx-runtime");function re(e){return ne.en.commandPalette.results(e)}var ie=[],ae=300,oe=10;function se({layerIdRef:t,onUnmount:n}){let r=e.useParentOverlayLayer(),i=(0,u.useRef)(n);return i.current=n,(0,u.useLayoutEffect)(()=>(t.current=r,()=>{t.current=null}),[r,t]),(0,u.useLayoutEffect)(()=>()=>i.current(),[]),null}function f({open:s,defaultOpen:ne=!1,onOpenChange:re,hotkey:f=`mod+k`,trigger:p,label:ce,search:le,defaultSearch:ue=``,onSearchChange:de,pages:fe,defaultPages:pe=ie,onPagesChange:me,filter:m,shouldFilter:he=!0,sort:ge=!0,highlightMatches:_e=!0,closeOnSelect:ve=!0,loop:ye=!0,size:be=`md`,resultsLabel:xe,instructions:Se,showHints:Ce=!0,hintLabels:h,backLabel:we,className:Te,onMouseDown:Ee,children:De,"aria-label":Oe,"aria-labelledby":ke,"aria-describedby":Ae,...je}){let g=te.useMessages(),_=ce??g.commandPalette.label,Me=xe??g.commandPalette.results,Ne=Se??g.commandPalette.instructions,Pe=we??g.commandPalette.back,[v,y]=t.useControllableState({value:s,defaultValue:ne,onChange:re}),[b,x]=t.useControllableState({value:le,defaultValue:ue,onChange:de}),[S,C]=t.useControllableState({value:fe,defaultValue:pe,onChange:me}),w=S.length>0?S[S.length-1]:null,T=(0,u.useId)(),E=`${T}-title`,D=`${T}-instructions`,[Fe,Ie]=(0,u.useState)(null),Le=Fe??`${T}-listbox`,O=(0,u.useRef)(null),k=(0,u.useRef)(null),A=(0,u.useRef)(null),Re=e.useParentOverlayLayer(),j=(0,u.useRef)(v);j.current=v;let M=(0,u.useRef)(b);M.current=b;let N=(0,u.useRef)(S);N.current=S;let P=(0,u.useRef)(new Map),[ze,Be]=(0,u.useState)(0),Ve=(0,u.useCallback)(e=>(P.current.set(e.key,e),Be(e=>e+1),()=>{P.current.get(e.key)===e&&(P.current.delete(e.key),Be(e=>e+1))}),[]),F=he&&b.trim()!==``,I=(0,u.useMemo)(()=>{let e=new Map;for(let t of P.current.values()){let n=F?m?m(t.value,b,t.keywords):c.defaultCommandScore(t.value,b,t.keywords):1;n>0&&e.set(t.key,n)}let t=F&&ge,n=t?[...new Set(e.values())].sort((e,t)=>t-e):[],r=new Map(n.map((e,t)=>[e,t])),i=new Map,a=new Map,o=new Map;for(let[n,ee]of e){let e=t?r.get(ee)??0:0;i.set(n,e);let s=P.current.get(n)?.groupKey;s&&(o.set(s,(o.get(s)??0)+1),a.set(s,Math.min(a.get(s)??1/0,e)))}return{visible:new Set(e.keys()),itemOrder:i,groupOrder:a,groupCount:o,count:e.size,ranked:t}},[ze,F,b,m,ge]),[L,He]=(0,u.useState)({}),Ue=(0,u.useCallback)((e,t)=>(He(n=>n[e]===t?n:{...n,[e]:t}),()=>He(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})),[]),R=(0,u.useCallback)(e=>{C(t=>[...t,e]),x(``)},[C,x]),z=(0,u.useCallback)(()=>{N.current.length!==0&&(C(e=>e.slice(0,-1)),x(``))},[C,x]),[We,Ge]=(0,u.useState)(0),Ke=(0,u.useRef)(g.commandPalette.loading),qe=(0,u.useCallback)(e=>(Ke.current=e,Ge(e=>e+1),()=>Ge(e=>e-1)),[]),B=We>0,[Je,Ye]=(0,u.useState)(null),[V,H]=(0,u.useState)(null),U=(0,u.useRef)(V);U.current=V;let W=(0,u.useRef)(!1),G=(0,u.useRef)(null);(0,u.useLayoutEffect)(()=>{if(!v){G.current=null;return}let e=k.current;if(!e)return;c.syncDomOrder(e);let t=c.getOrderedOptions(e),n=`${w??``}\u0000${b}`,r=n!==G.current,i=U.current,a=i!==null&&t.some(e=>e.id===i);if(r||!a){G.current=n;let a=(t.find(e=>e.getAttribute(`aria-disabled`)!==`true`)??t[0])?.id??null;a!==i&&H(a),r&&(e.scrollTop=0)}}),(0,u.useLayoutEffect)(()=>{if(!W.current||!V)return;W.current=!1;let e=document.getElementById(V);if(!e)return;e.scrollIntoView?.({block:`nearest`});let t=c.getOrderedOptions(k.current),n=t.indexOf(e),r=e.closest(`[role="group"]`),i=n<=0||t[n-1].closest(`[role="group"]`)!==r;if(n===0){let e=k.current;e&&(e.scrollTop=0)}else r&&i&&r.querySelector(`[data-command-heading]`)?.scrollIntoView?.({block:`nearest`})},[V]);let K=(0,u.useCallback)(e=>{let t=c.getOrderedOptions(k.current);if(t.length===0)return;let n=t.findIndex(e=>e.id===U.current),r;r=n===-1?e>0?0:t.length-1:ye&&Math.abs(e)===1?(n+e+t.length)%t.length:Math.min(t.length-1,Math.max(0,n+e)),W.current=!0,H(t[r].id)},[ye]),Xe=(0,u.useRef)(ve);Xe.current=ve;let q=(0,u.useCallback)(e=>{let t=[...P.current.values()].find(t=>t.domId===e);if(!t||t.disabled)return;if(t.to){R(t.to);return}let n={value:t.value,defaultPrevented:!1,preventDefault:()=>{n.defaultPrevented=!0}},r=t.onSelectRef.current?.(n);!n.defaultPrevented&&r!==!1&&Xe.current&&y(!1)},[R,y]),Ze=(0,u.useCallback)(e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let{key:t}=e,n=e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey,r=e.nativeEvent.code,i=!e.ctrlKey&&!e.metaKey&&!e.altKey;if(t===`ArrowDown`&&i||n&&(t===`n`||r===`KeyN`))e.preventDefault(),K(1);else if(t===`ArrowUp`&&i||n&&(t===`p`||r===`KeyP`))e.preventDefault(),K(-1);else if(t===`PageDown`&&i)e.preventDefault(),K(oe);else if(t===`PageUp`&&i)e.preventDefault(),K(-10);else if(t===`Enter`){if(e.repeat){e.preventDefault();return}let t=U.current;if(!t)return;e.preventDefault(),q(t)}else t===`Escape`?M.current===``?N.current.length>0&&(e.preventDefault(),z()):(e.preventDefault(),x(``)):t===`Backspace`&&!e.repeat&&M.current===``&&N.current.length>0&&(e.preventDefault(),z())},[K,q,x,z]),Qe=je.onKeyDown,$e=e=>{Qe?.(e),e.defaultPrevented||e.key!==`Escape`||e.target===O.current||(M.current===``?N.current.length>0&&(e.preventDefault(),z(),O.current?.focus()):(e.preventDefault(),x(``),O.current?.focus()))},J=(0,u.useCallback)(()=>{j.current||(M.current!==``&&x(``),N.current.length>0&&C(ie),H(null))},[x,C]),Y=r.useKbdPlatform(),et=f?i.parseHotkey(f,Y):null,tt=et?i.hotkeyToAria(et):void 0;(0,u.useEffect)(()=>{if(!f)return;let t=i.parseHotkey(f,Y);if(!t)return;let n=n=>{if(n.defaultPrevented||n.isComposing||n.repeat||!i.matchesHotkey(n,t)||n.target!==O.current&&i.isTypingTarget(n.target))return;let r=e.getOverlayLayerStack(),a=j.current?A.current:Re,o=a?r.findIndex(e=>e.id===a):-1;r.slice(o+1).some(e=>e.modal&&e.id!==A.current)||(n.preventDefault(),y(!j.current))};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[f,Y,Re,y]);let[nt,rt]=(0,u.useState)(``),X=(0,u.useRef)(null),Z=I.count,Q=w?L[w]??w:null,it=(0,u.useRef)(Me);it.current=Me,(0,u.useEffect)(()=>{if(!v){X.current=null,rt(``);return}let e=`${w??``}\u0000${b}`;if(X.current===null){X.current={trigger:e,count:-1,page:w};return}if(B){rt(Ke.current);return}let t=X.current;if(t.trigger===e&&(t.count===-1||t.count===Z))return;let n=window.setTimeout(()=>{let n=it.current(Z),r=t.page!==w;X.current={trigger:e,count:Z,page:w},rt(r&&Q?`${Q}, ${n}`:n)},ae);return()=>window.clearTimeout(n)},[v,B,w,b,Z,Q]);let at=(0,u.useMemo)(()=>({search:b,setSearch:e=>x(e),filtering:F,highlightMatches:_e,results:I,register:Ve,activeId:V,setActiveId:H,selectById:q,pages:S,currentPage:w,pushPage:R,popPage:z,pageTitles:L,registerPageTitle:Ue,loading:B,registerLoading:qe,statusSlot:Je,setStatusSlot:Ye,inputRef:O,listboxRef:k,listboxId:Le,setListboxId:Ie,titleId:E,label:_,instructionsId:D,backLabel:Pe,onInputKeyDown:Ze,reset:J}),[b,x,F,_e,I,Ve,V,q,S,w,R,z,L,Ue,B,qe,Je,Le,E,_,D,Pe,Ze,J]),ot=e=>{Ee?.(e),e.defaultPrevented||e.target.closest(`input, textarea, select, button, a[href], [contenteditable]`)||e.preventDefault()},st=p&&(0,u.isValidElement)(p)?(0,u.cloneElement)(p,{"aria-keyshortcuts":p.props[`aria-keyshortcuts`]??tt}):null,$={navigate:h?.navigate??g.commandPalette.hints.navigate,select:h?.select??g.commandPalette.hints.select,back:h?.back??g.commandPalette.hints.back,close:h?.close??g.commandPalette.hints.close};return(0,d.jsx)(ee.CommandPaletteContext.Provider,{value:at,children:(0,d.jsxs)(o.Modal,{open:v,onOpenChange:y,size:be,placement:`top`,mobileLayout:`card`,showClose:!1,initialFocusRef:O,children:[st&&(0,d.jsx)(o.Modal.Trigger,{children:st}),(0,d.jsxs)(o.Modal.Content,{...je,"aria-label":Oe,"aria-labelledby":ke??(Oe?void 0:E),"aria-describedby":Ae,className:n.cx(l.default.palette,Te),onMouseDown:ot,onKeyDown:$e,children:[(0,d.jsx)(se,{layerIdRef:A,onUnmount:J}),(0,d.jsx)(a.VisuallyHidden,{id:E,children:_}),(0,d.jsx)(a.VisuallyHidden,{id:D,children:Ne}),De,Ce&&(0,d.jsxs)(`div`,{className:l.default.footer,"aria-hidden":`true`,children:[(0,d.jsxs)(`span`,{className:l.default.hint,children:[(0,d.jsx)(r.Kbd,{size:`sm`,keyName:`up`}),(0,d.jsx)(r.Kbd,{size:`sm`,keyName:`down`}),$.navigate]}),(0,d.jsxs)(`span`,{className:l.default.hint,children:[(0,d.jsx)(r.Kbd,{size:`sm`,keyName:`enter`}),$.select]}),S.length>0&&(0,d.jsxs)(`span`,{className:l.default.hint,children:[(0,d.jsx)(r.Kbd,{size:`sm`,keyName:`backspace`}),$.back]}),(0,d.jsxs)(`span`,{className:l.default.hint,children:[(0,d.jsx)(r.Kbd,{size:`sm`,keyName:`esc`}),$.close]})]}),(0,d.jsx)(a.VisuallyHidden,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:nt})]})]})})}var p=Object.assign(f,{Input:s.CommandPaletteInput,List:s.CommandPaletteList,Group:s.CommandPaletteGroup,Item:s.CommandPaletteItem,Empty:s.CommandPaletteEmpty,Loading:s.CommandPaletteLoading,Separator:s.CommandPaletteSeparator,Page:s.CommandPalettePage});exports.CommandPalette=p,exports.CommandPaletteEmpty=s.CommandPaletteEmpty,exports.CommandPaletteGroup=s.CommandPaletteGroup,exports.CommandPaletteInput=s.CommandPaletteInput,exports.CommandPaletteItem=s.CommandPaletteItem,exports.CommandPaletteList=s.CommandPaletteList,exports.CommandPaletteLoading=s.CommandPaletteLoading,exports.CommandPalettePage=s.CommandPalettePage,exports.CommandPaletteSeparator=s.CommandPaletteSeparator,exports.defaultCommandResultsLabel=re,exports.defaultCommandScore=c.defaultCommandScore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`_palette_176zy_35`,t=`_header_176zy_49`,n=`_crumbs_176zy_67`,r=`_trail_176zy_81`,i=`_crumb_176zy_67`,a=`_crumbSeparator_176zy_127`,o=`_back_176zy_139`,s=`_field_176zy_147`,c=`_searchIcon_176zy_159`,l=`_input_176zy_177`,u=`_inputLoading_176zy_217`,d=`_inputSpinner_176zy_247`,f=`_listArea_176zy_263`,p=`_list_176zy_263`,m=`_group_176zy_315`,h=`_separator_176zy_331`,g=`_groupHeading_176zy_347`,_=`_item_176zy_377`,v=`_icon_176zy_483`,y=`_label_176zy_501`,b=`_mark_176zy_513`,x=`_shortcut_176zy_531`,S=`_chevron_176zy_549`,C=`_status_176zy_605`,w=`_empty_176zy_613`,T=`_loading_176zy_621`,E=`_footer_176zy_645`,D=`_hint_176zy_683`,O={palette:e,header:t,crumbs:n,trail:r,crumb:i,crumbSeparator:a,back:o,field:s,searchIcon:c,input:l,inputLoading:u,inputSpinner:d,listArea:f,list:p,group:m,separator:h,groupHeading:g,item:_,icon:v,label:y,mark:b,shortcut:x,chevron:S,status:C,empty:w,loading:T,footer:E,hint:D};exports.back=o,exports.chevron=S,exports.crumb=i,exports.crumbSeparator=a,exports.crumbs=n,exports.default=O,exports.empty=w,exports.field=s,exports.footer=E,exports.group=m,exports.groupHeading=g,exports.header=t,exports.hint=D,exports.icon=v,exports.input=l,exports.inputLoading=u,exports.inputSpinner=d,exports.item=_,exports.label=y,exports.list=p,exports.listArea=f,exports.loading=T,exports.mark=b,exports.palette=e,exports.searchIcon=c,exports.separator=h,exports.shortcut=x,exports.status=C,exports.trail=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";let e=require("react");var t=(0,e.createContext)(null);function n(n){let r=(0,e.useContext)(t);if(!r)throw Error(`<${n}> must be used inside <CommandPalette>.`);return r}var r=(0,e.createContext)(null),i=(0,e.createContext)(null);exports.CommandPaletteContext=t,exports.GroupContext=r,exports.PageContext=i,exports.useCommandPalette=n;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { KeyboardEvent, RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Passed to an item's `onSelect`. Call `preventDefault()` (or return
|
|
4
|
+
* `false` from the handler) to keep the palette open after this command.
|
|
5
|
+
*/
|
|
6
|
+
export interface CommandPaletteSelectEvent {
|
|
7
|
+
/** The item's `value`. */
|
|
8
|
+
value: string;
|
|
9
|
+
/** True once `preventDefault()` was called. */
|
|
10
|
+
defaultPrevented: boolean;
|
|
11
|
+
/** Keeps the palette open after this selection. */
|
|
12
|
+
preventDefault: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Custom filter: return a score for an item. `0` (or less) hides it; higher
|
|
16
|
+
* scores rank first. `search` is the raw input text.
|
|
17
|
+
*/
|
|
18
|
+
export type CommandPaletteFilter = (value: string, search: string, keywords: string[]) => number;
|
|
19
|
+
/** @internal What an item registers with the palette. */
|
|
20
|
+
export interface ItemRecord {
|
|
21
|
+
/** Internal, stable key. */
|
|
22
|
+
key: string;
|
|
23
|
+
/** Resolved DOM id of the option element. */
|
|
24
|
+
domId: string;
|
|
25
|
+
value: string;
|
|
26
|
+
keywords: string[];
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
groupKey: string | null;
|
|
29
|
+
/** Page to open instead of running a command. */
|
|
30
|
+
to?: string;
|
|
31
|
+
onSelectRef: {
|
|
32
|
+
current: ((event: CommandPaletteSelectEvent) => void | boolean) | undefined;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** @internal Filter results for the registered items. */
|
|
36
|
+
export interface Results {
|
|
37
|
+
/** Items shown with the current search. */
|
|
38
|
+
visible: Set<string>;
|
|
39
|
+
/** Rank (`data-order`) of each visible item: lower is better. */
|
|
40
|
+
itemOrder: Map<string, number>;
|
|
41
|
+
/** Rank of each group: the best rank of its visible items. */
|
|
42
|
+
groupOrder: Map<string, number>;
|
|
43
|
+
/** Visible item count per group. */
|
|
44
|
+
groupCount: Map<string, number>;
|
|
45
|
+
/** Total visible items. */
|
|
46
|
+
count: number;
|
|
47
|
+
/** Results are being ranked (searching with `sort`). */
|
|
48
|
+
ranked: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** @internal Shared state between `CommandPalette` and its parts. */
|
|
51
|
+
export interface CommandPaletteContextValue {
|
|
52
|
+
search: string;
|
|
53
|
+
setSearch: (search: string) => void;
|
|
54
|
+
/** True when the built-in (or custom) filter applies to the current search. */
|
|
55
|
+
filtering: boolean;
|
|
56
|
+
highlightMatches: boolean;
|
|
57
|
+
results: Results;
|
|
58
|
+
register: (record: ItemRecord) => () => void;
|
|
59
|
+
activeId: string | null;
|
|
60
|
+
/** Sets the active option by DOM id. */
|
|
61
|
+
setActiveId: (id: string | null) => void;
|
|
62
|
+
/** Runs (or opens the page of) the item with this DOM id. */
|
|
63
|
+
selectById: (id: string) => void;
|
|
64
|
+
pages: string[];
|
|
65
|
+
currentPage: string | null;
|
|
66
|
+
pushPage: (name: string) => void;
|
|
67
|
+
popPage: () => void;
|
|
68
|
+
pageTitles: Record<string, string>;
|
|
69
|
+
registerPageTitle: (name: string, title: string) => () => void;
|
|
70
|
+
loading: boolean;
|
|
71
|
+
/** A Loading part registers its text, which the root's live region announces. */
|
|
72
|
+
registerLoading: (label: string) => () => void;
|
|
73
|
+
/** Element after the listbox where Empty and Loading render. */
|
|
74
|
+
statusSlot: HTMLElement | null;
|
|
75
|
+
setStatusSlot: (el: HTMLElement | null) => void;
|
|
76
|
+
inputRef: RefObject<HTMLInputElement | null>;
|
|
77
|
+
listboxRef: RefObject<HTMLElement | null>;
|
|
78
|
+
listboxId: string;
|
|
79
|
+
setListboxId: (id: string | null) => void;
|
|
80
|
+
titleId: string;
|
|
81
|
+
/** The palette's accessible name (`label`). */
|
|
82
|
+
label: string;
|
|
83
|
+
instructionsId: string;
|
|
84
|
+
backLabel: string;
|
|
85
|
+
/** Keyboard handling for the search input. */
|
|
86
|
+
onInputKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
87
|
+
/** Called when the input unmounts (the palette finished closing). */
|
|
88
|
+
reset: () => void;
|
|
89
|
+
}
|
|
90
|
+
export declare const CommandPaletteContext: import('react').Context<CommandPaletteContextValue | null>;
|
|
91
|
+
/** @internal Reads the nearest `CommandPalette`; throws a helpful error outside one. */
|
|
92
|
+
export declare function useCommandPalette(part: string): CommandPaletteContextValue;
|
|
93
|
+
/** @internal The enclosing `CommandPalette.Group`, if any. */
|
|
94
|
+
export declare const GroupContext: import('react').Context<string | null>;
|
|
95
|
+
/** @internal The enclosing `CommandPalette.Page` name, or null at the root page. */
|
|
96
|
+
export declare const PageContext: import('react').Context<string | null>;
|