@arshad-shah/cynosure 0.3.0 → 0.5.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 +6 -6
- package/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/adapters/astro/index.d.ts +53 -0
- package/dist/adapters/astro/index.js +27 -0
- package/dist/adapters/astro/index.js.map +1 -0
- package/dist/adapters/vite/index.d.ts +11 -0
- package/dist/adapters/vite/index.js +33 -12
- package/dist/adapters/vite/index.js.map +1 -1
- package/dist/brands/googleplay.d.ts +2 -0
- package/dist/brands/googleplay.js +17 -0
- package/dist/brands/googleplay.js.map +1 -0
- package/dist/brands/index.d.ts +1 -0
- package/dist/brands/index.js +132 -130
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Accordion/Accordion.js +26 -26
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Announcer/Announcer.d.ts +2 -1
- package/dist/components/Announcer/Announcer.js +32 -34
- package/dist/components/Announcer/Announcer.js.map +1 -1
- package/dist/components/AppShell/AppShell.js +41 -41
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/Avatar/Avatar.js +20 -20
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Badge/Badge.d.ts +19 -5
- package/dist/components/Badge/Badge.js +19 -13
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Button/Button.d.ts +30 -6
- package/dist/components/Button/Button.js +50 -42
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.js +158 -161
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/dates.js +42 -38
- package/dist/components/Calendar/dates.js.map +1 -1
- package/dist/components/Card/Card.d.ts +22 -2
- package/dist/components/Card/Card.js +60 -52
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/ChatMessage/ChatMessage.d.ts +55 -0
- package/dist/components/ChatMessage/ChatMessage.js +50 -0
- package/dist/components/ChatMessage/ChatMessage.js.map +1 -0
- package/dist/components/ChatMessage/index.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +4 -4
- package/dist/components/Checkbox/Checkbox.js +33 -8
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checklist/Checklist.js +21 -21
- package/dist/components/Checklist/Checklist.js.map +1 -1
- package/dist/components/Choice/Choice.d.ts +73 -0
- package/dist/components/Choice/Choice.js +41 -0
- package/dist/components/Choice/Choice.js.map +1 -0
- package/dist/components/Choice/index.d.ts +1 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +6 -1
- package/dist/components/CodeBlock/CodeBlock.js +40 -37
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/components/ColorField/ColorField.d.ts +3 -2
- package/dist/components/ColorField/ColorField.js +202 -212
- package/dist/components/ColorField/ColorField.js.map +1 -1
- package/dist/components/ColorField/read-color.js +5 -6
- package/dist/components/ColorField/read-color.js.map +1 -1
- package/dist/components/ColorSwatches/ColorSwatches.js +42 -33
- package/dist/components/ColorSwatches/ColorSwatches.js.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +13 -2
- package/dist/components/Combobox/Combobox.js +118 -129
- package/dist/components/Combobox/Combobox.js.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts +14 -1
- package/dist/components/CommandPalette/CommandPalette.js +153 -109
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
- package/dist/components/CommandPalette/index.d.ts +1 -1
- package/dist/components/CompareSlider/CompareSlider.js +14 -14
- package/dist/components/CompareSlider/CompareSlider.js.map +1 -1
- package/dist/components/Container/Container.d.ts +2 -2
- package/dist/components/Container/Container.js +17 -13
- package/dist/components/Container/Container.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.d.ts +27 -13
- package/dist/components/ContextMenu/ContextMenu.js +64 -46
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.js +41 -41
- package/dist/components/CopyButton/CopyButton.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.d.ts +135 -0
- package/dist/components/DataGrid/DataGrid.js +385 -0
- package/dist/components/DataGrid/DataGrid.js.map +1 -0
- package/dist/components/DataGrid/index.d.ts +1 -0
- package/dist/components/DateField/DateField.d.ts +4 -3
- package/dist/components/DateField/DateField.js +70 -59
- package/dist/components/DateField/DateField.js.map +1 -1
- package/dist/components/DeviceFrame/DeviceFrame.d.ts +63 -0
- package/dist/components/DeviceFrame/DeviceFrame.js +54 -0
- package/dist/components/DeviceFrame/DeviceFrame.js.map +1 -0
- package/dist/components/DeviceFrame/index.d.ts +1 -0
- package/dist/components/Dialog/Dialog.d.ts +10 -1
- package/dist/components/Dialog/Dialog.js +82 -81
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Disclosure/Disclosure.d.ts +15 -1
- package/dist/components/Disclosure/Disclosure.js +37 -30
- package/dist/components/Disclosure/Disclosure.js.map +1 -1
- package/dist/components/DocumentViewport/DocumentViewport.js +54 -57
- package/dist/components/DocumentViewport/DocumentViewport.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +5 -2
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +59 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.js +53 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.js.map +1 -0
- package/dist/components/ErrorBoundary/index.d.ts +1 -0
- package/dist/components/Field/Field.d.ts +38 -5
- package/dist/components/Field/Field.js +48 -42
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/FileDrop/FileDrop.d.ts +26 -1
- package/dist/components/FileDrop/FileDrop.js +150 -99
- package/dist/components/FileDrop/FileDrop.js.map +1 -1
- package/dist/components/FloatingToolbar/FloatingToolbar.js +80 -77
- package/dist/components/FloatingToolbar/FloatingToolbar.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +32 -11
- package/dist/components/Grid/Grid.js +78 -48
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/Grid/index.d.ts +1 -1
- package/dist/components/Heading/Heading.d.ts +4 -2
- package/dist/components/Heading/Heading.js.map +1 -1
- package/dist/components/HighlightedText/HighlightedText.d.ts +40 -0
- package/dist/components/HighlightedText/HighlightedText.js +36 -0
- package/dist/components/HighlightedText/HighlightedText.js.map +1 -0
- package/dist/components/HighlightedText/index.d.ts +2 -0
- package/dist/components/HotkeyField/HotkeyField.d.ts +84 -0
- package/dist/components/HotkeyField/HotkeyField.js +161 -0
- package/dist/components/HotkeyField/HotkeyField.js.map +1 -0
- package/dist/components/HotkeyField/index.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.js +6 -6
- package/dist/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +16 -1
- package/dist/components/IconButton/IconButton.js +20 -15
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/IconTile/IconTile.d.ts +45 -0
- package/dist/components/IconTile/IconTile.js +25 -0
- package/dist/components/IconTile/IconTile.js.map +1 -0
- package/dist/components/IconTile/index.d.ts +1 -0
- package/dist/components/Image/Image.js.map +1 -1
- package/dist/components/Inline/Inline.d.ts +3 -3
- package/dist/components/Inline/Inline.js +12 -22
- package/dist/components/Inline/Inline.js.map +1 -1
- package/dist/components/Kbd/Kbd.d.ts +0 -2
- package/dist/components/Kbd/Kbd.js +16 -22
- package/dist/components/Kbd/Kbd.js.map +1 -1
- package/dist/components/KeyValueEditor/KeyValueEditor.js +37 -36
- package/dist/components/KeyValueEditor/KeyValueEditor.js.map +1 -1
- package/dist/components/KeyValueEditor/bulk.js +3 -4
- package/dist/components/KeyValueEditor/bulk.js.map +1 -1
- package/dist/components/Link/Link.d.ts +9 -1
- package/dist/components/Link/Link.js +20 -18
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/List/List.d.ts +73 -0
- package/dist/components/List/List.js +64 -0
- package/dist/components/List/List.js.map +1 -0
- package/dist/components/List/index.d.ts +1 -0
- package/dist/components/ListRow/ListRow.d.ts +105 -0
- package/dist/components/ListRow/ListRow.js +164 -0
- package/dist/components/ListRow/ListRow.js.map +1 -0
- package/dist/components/ListRow/index.d.ts +1 -0
- package/dist/components/LoadingDots/LoadingDots.d.ts +7 -2
- package/dist/components/LoadingDots/LoadingDots.js +28 -18
- package/dist/components/LoadingDots/LoadingDots.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +29 -11
- package/dist/components/Menu/Menu.js +204 -111
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Menubar/Menubar.d.ts +40 -0
- package/dist/components/Menubar/Menubar.js +82 -0
- package/dist/components/Menubar/Menubar.js.map +1 -0
- package/dist/components/Menubar/index.d.ts +1 -0
- package/dist/components/Notice/Notice.d.ts +11 -2
- package/dist/components/Notice/Notice.js +31 -27
- package/dist/components/Notice/Notice.js.map +1 -1
- package/dist/components/NumberField/NumberField.d.ts +8 -3
- package/dist/components/NumberField/NumberField.js +151 -100
- package/dist/components/NumberField/NumberField.js.map +1 -1
- package/dist/components/OptionList/OptionList.d.ts +102 -0
- package/dist/components/OptionList/OptionList.js +98 -0
- package/dist/components/OptionList/OptionList.js.map +1 -0
- package/dist/components/OptionList/index.d.ts +1 -0
- package/dist/components/OverlayFrame/OverlayFrame.d.ts +33 -0
- package/dist/components/OverlayFrame/OverlayFrame.js +20 -0
- package/dist/components/OverlayFrame/OverlayFrame.js.map +1 -0
- package/dist/components/OverlayFrame/index.d.ts +1 -0
- package/dist/components/PageHeader/PageHeader.d.ts +6 -0
- package/dist/components/PageHeader/PageHeader.js +27 -27
- package/dist/components/PageHeader/PageHeader.js.map +1 -1
- package/dist/components/Pagination/Pagination.js +31 -30
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/PanZoomCanvas/PanZoomCanvas.d.ts +71 -4
- package/dist/components/PanZoomCanvas/PanZoomCanvas.js +197 -141
- package/dist/components/PanZoomCanvas/PanZoomCanvas.js.map +1 -1
- package/dist/components/PanZoomCanvas/index.d.ts +1 -1
- package/dist/components/PathField/PathField.d.ts +68 -0
- package/dist/components/PathField/PathField.js +67 -0
- package/dist/components/PathField/PathField.js.map +1 -0
- package/dist/components/PathField/index.d.ts +1 -0
- package/dist/components/Popover/Popover.d.ts +16 -3
- package/dist/components/Popover/Popover.js +51 -42
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +4 -3
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/QRCode/QRCode.d.ts +56 -0
- package/dist/components/QRCode/QRCode.js +48 -0
- package/dist/components/QRCode/QRCode.js.map +1 -0
- package/dist/components/QRCode/index.d.ts +1 -0
- package/dist/components/RadioGroup/RadioGroup.js +32 -24
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/RowActions/RowActions.d.ts +35 -0
- package/dist/components/RowActions/RowActions.js +38 -0
- package/dist/components/RowActions/RowActions.js.map +1 -0
- package/dist/components/RowActions/index.d.ts +1 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +55 -0
- package/dist/components/ScrollArea/ScrollArea.js +55 -0
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
- package/dist/components/ScrollArea/index.d.ts +1 -0
- package/dist/components/SearchField/SearchField.d.ts +17 -0
- package/dist/components/SearchField/SearchField.js +31 -17
- package/dist/components/SearchField/SearchField.js.map +1 -1
- package/dist/components/SearchField/index.d.ts +1 -1
- package/dist/components/Section/Section.d.ts +57 -0
- package/dist/components/Section/Section.js +27 -0
- package/dist/components/Section/Section.js.map +1 -0
- package/dist/components/Section/index.d.ts +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +6 -3
- package/dist/components/SegmentedControl/SegmentedControl.js +24 -20
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/Select/Select.d.ts +22 -6
- package/dist/components/Select/Select.js +155 -156
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/SelectionFrame/frame-math.js +19 -20
- package/dist/components/SelectionFrame/frame-math.js.map +1 -1
- package/dist/components/Sheet/Sheet.js +12 -7
- package/dist/components/Sheet/Sheet.js.map +1 -1
- package/dist/components/SideNav/SideNav.d.ts +13 -1
- package/dist/components/SideNav/SideNav.js +100 -91
- package/dist/components/SideNav/SideNav.js.map +1 -1
- package/dist/components/SignaturePad/SignaturePad.js +63 -62
- package/dist/components/SignaturePad/SignaturePad.js.map +1 -1
- package/dist/components/SignaturePad/ink.js +0 -1
- package/dist/components/SignaturePad/ink.js.map +1 -1
- package/dist/components/SiteFooter/SiteFooter.d.ts +66 -0
- package/dist/components/SiteFooter/SiteFooter.js +80 -0
- package/dist/components/SiteFooter/SiteFooter.js.map +1 -0
- package/dist/components/SiteFooter/index.d.ts +1 -0
- package/dist/components/SiteHeader/SiteHeader.d.ts +78 -0
- package/dist/components/SiteHeader/SiteHeader.js +114 -0
- package/dist/components/SiteHeader/SiteHeader.js.map +1 -0
- package/dist/components/SiteHeader/index.d.ts +1 -0
- package/dist/components/SkipLink/SkipLink.d.ts +42 -0
- package/dist/components/SkipLink/SkipLink.js +43 -0
- package/dist/components/SkipLink/SkipLink.js.map +1 -0
- package/dist/components/SkipLink/index.d.ts +1 -0
- package/dist/components/Slider/Slider.js +88 -91
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/SortButton/SortButton.d.ts +36 -0
- package/dist/components/SortButton/SortButton.js +35 -0
- package/dist/components/SortButton/SortButton.js.map +1 -0
- package/dist/components/SortButton/index.d.ts +1 -0
- package/dist/components/SortableList/SortableList.js +146 -120
- package/dist/components/SortableList/SortableList.js.map +1 -1
- package/dist/components/SplitPane/SplitPane.d.ts +32 -12
- package/dist/components/SplitPane/SplitPane.js +105 -59
- package/dist/components/SplitPane/SplitPane.js.map +1 -1
- package/dist/components/Stack/Stack.d.ts +16 -7
- package/dist/components/Stack/Stack.js +32 -18
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/index.d.ts +1 -1
- package/dist/components/Stat/Stat.d.ts +88 -0
- package/dist/components/Stat/Stat.js +105 -0
- package/dist/components/Stat/Stat.js.map +1 -0
- package/dist/components/Stat/index.d.ts +1 -0
- package/dist/components/StatusBar/StatusBar.d.ts +95 -0
- package/dist/components/StatusBar/StatusBar.js +110 -0
- package/dist/components/StatusBar/StatusBar.js.map +1 -0
- package/dist/components/StatusBar/index.d.ts +1 -0
- package/dist/components/Steps/Steps.d.ts +10 -4
- package/dist/components/Steps/Steps.js +31 -30
- package/dist/components/Steps/Steps.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +4 -4
- package/dist/components/Switch/Switch.js +18 -7
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Table/Table.d.ts +6 -6
- package/dist/components/Table/Table.js +73 -102
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +55 -6
- package/dist/components/Tabs/Tabs.js +288 -169
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/TagInput/TagInput.d.ts +10 -2
- package/dist/components/TagInput/TagInput.js +137 -148
- package/dist/components/TagInput/TagInput.js.map +1 -1
- package/dist/components/Text/Text.d.ts +6 -0
- package/dist/components/Text/Text.js +18 -17
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/TextArea/TextArea.d.ts +37 -6
- package/dist/components/TextArea/TextArea.js +200 -72
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextArea/index.d.ts +1 -1
- package/dist/components/TextField/TextField.d.ts +22 -6
- package/dist/components/TextField/TextField.js +59 -53
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ThemeToggle/ThemeToggle.d.ts +7 -1
- package/dist/components/ThemeToggle/ThemeToggle.js +33 -30
- package/dist/components/ThemeToggle/ThemeToggle.js.map +1 -1
- package/dist/components/TimeField/TimeField.d.ts +4 -3
- package/dist/components/TimeField/TimeField.js +197 -183
- package/dist/components/TimeField/TimeField.js.map +1 -1
- package/dist/components/TitleBar/TitleBar.d.ts +91 -0
- package/dist/components/TitleBar/TitleBar.js +80 -0
- package/dist/components/TitleBar/TitleBar.js.map +1 -0
- package/dist/components/TitleBar/index.d.ts +1 -0
- package/dist/components/Toast/Toast.d.ts +17 -2
- package/dist/components/Toast/Toast.js +166 -147
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Toast/index.d.ts +1 -1
- package/dist/components/Toolbar/Toolbar.js +11 -12
- package/dist/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +23 -1
- package/dist/components/Tooltip/Tooltip.js +50 -31
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tree/Tree.d.ts +92 -11
- package/dist/components/Tree/Tree.js +332 -164
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/VirtualList/VirtualList.d.ts +27 -4
- package/dist/components/VirtualList/VirtualList.js +179 -145
- package/dist/components/VirtualList/VirtualList.js.map +1 -1
- package/dist/components/VirtualList/index.d.ts +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +17 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
- package/dist/components/VisuallyHidden/index.d.ts +1 -0
- package/dist/components/ZoomControls/ZoomControls.d.ts +6 -2
- package/dist/components/ZoomControls/ZoomControls.js +37 -37
- package/dist/components/ZoomControls/ZoomControls.js.map +1 -1
- package/dist/entries/tokens.js +22 -16
- package/dist/foundations/ChoiceBase/ChoiceBase.js +15 -13
- package/dist/foundations/ChoiceBase/ChoiceBase.js.map +1 -1
- package/dist/foundations/HiddenValue/HiddenValue.js +5 -5
- package/dist/foundations/HiddenValue/HiddenValue.js.map +1 -1
- package/dist/foundations/Icon/Icon.d.ts +6 -1
- package/dist/foundations/Icon/Icon.js +15 -14
- package/dist/foundations/Icon/Icon.js.map +1 -1
- package/dist/foundations/LiveRegion/LiveRegion.d.ts +33 -0
- package/dist/foundations/LiveRegion/LiveRegion.js +29 -0
- package/dist/foundations/LiveRegion/LiveRegion.js.map +1 -0
- package/dist/foundations/LiveRegion/index.d.ts +1 -0
- package/dist/foundations/canvas-size.d.ts +14 -0
- package/dist/foundations/canvas-size.js +32 -0
- package/dist/foundations/canvas-size.js.map +1 -0
- package/dist/foundations/dir.js +0 -1
- package/dist/foundations/dir.js.map +1 -1
- package/dist/foundations/draft.d.ts +14 -0
- package/dist/foundations/draft.js +22 -0
- package/dist/foundations/draft.js.map +1 -0
- package/dist/foundations/edge.d.ts +20 -0
- package/dist/foundations/edge.js +26 -0
- package/dist/foundations/edge.js.map +1 -0
- package/dist/foundations/focus.d.ts +5 -0
- package/dist/foundations/focus.js +10 -0
- package/dist/foundations/focus.js.map +1 -0
- package/dist/foundations/hotkey.d.ts +23 -1
- package/dist/foundations/hotkey.js +48 -26
- package/dist/foundations/hotkey.js.map +1 -1
- package/dist/foundations/icon-size.d.ts +7 -0
- package/dist/foundations/icon-size.js +6 -0
- package/dist/foundations/icon-size.js.map +1 -0
- package/dist/foundations/image-outcome.d.ts +8 -3
- package/dist/foundations/image-outcome.js +12 -8
- package/dist/foundations/image-outcome.js.map +1 -1
- package/dist/foundations/keys.js +12 -13
- package/dist/foundations/keys.js.map +1 -1
- package/dist/foundations/layout.d.ts +81 -0
- package/dist/foundations/layout.js +29 -0
- package/dist/foundations/layout.js.map +1 -0
- package/dist/foundations/listbox.d.ts +47 -2
- package/dist/foundations/listbox.js +56 -25
- package/dist/foundations/listbox.js.map +1 -1
- package/dist/foundations/math.d.ts +25 -0
- package/dist/foundations/math.js +14 -3
- package/dist/foundations/math.js.map +1 -1
- package/dist/foundations/media-query.d.ts +5 -0
- package/dist/foundations/media-query.js +14 -0
- package/dist/foundations/media-query.js.map +1 -0
- package/dist/foundations/motion.d.ts +12 -0
- package/dist/foundations/motion.js +21 -0
- package/dist/foundations/motion.js.map +1 -0
- package/dist/foundations/option-icon.d.ts +3 -1
- package/dist/foundations/option-icon.js +6 -6
- package/dist/foundations/option-icon.js.map +1 -1
- package/dist/foundations/printing.d.ts +6 -0
- package/dist/foundations/printing.js +17 -0
- package/dist/foundations/printing.js.map +1 -0
- package/dist/foundations/qr.d.ts +42 -0
- package/dist/foundations/qr.js +245 -0
- package/dist/foundations/qr.js.map +1 -0
- package/dist/foundations/refs.d.ts +8 -0
- package/dist/foundations/refs.js +14 -0
- package/dist/foundations/refs.js.map +1 -0
- package/dist/foundations/reorder.js +5 -6
- package/dist/foundations/reorder.js.map +1 -1
- package/dist/foundations/roving-focus.d.ts +10 -0
- package/dist/foundations/roving-focus.js +34 -31
- package/dist/foundations/roving-focus.js.map +1 -1
- package/dist/foundations/scroll-align.d.ts +11 -0
- package/dist/foundations/scroll-align.js +8 -0
- package/dist/foundations/scroll-align.js.map +1 -0
- package/dist/foundations/sort.d.ts +13 -0
- package/dist/foundations/sort.js +26 -0
- package/dist/foundations/sort.js.map +1 -0
- package/dist/foundations/text-match.d.ts +11 -0
- package/dist/foundations/text-match.js +20 -0
- package/dist/foundations/text-match.js.map +1 -0
- package/dist/foundations/tone-icons.js +4 -5
- package/dist/foundations/tone-icons.js.map +1 -1
- package/dist/foundations/use-follow.d.ts +29 -0
- package/dist/foundations/use-follow.js +51 -0
- package/dist/foundations/use-follow.js.map +1 -0
- package/dist/foundations/virtual-window.d.ts +22 -5
- package/dist/foundations/virtual-window.js +58 -54
- package/dist/foundations/virtual-window.js.map +1 -1
- package/dist/foundations/zoom-gestures.d.ts +23 -1
- package/dist/foundations/zoom-gestures.js +123 -84
- package/dist/foundations/zoom-gestures.js.map +1 -1
- package/dist/foundations/zoom.d.ts +10 -4
- package/dist/foundations/zoom.js +16 -17
- package/dist/foundations/zoom.js.map +1 -1
- package/dist/icons/book-marked.d.ts +2 -0
- package/dist/icons/book-marked.js +14 -0
- package/dist/icons/book-marked.js.map +1 -0
- package/dist/icons/boxes.d.ts +2 -0
- package/dist/icons/boxes.js +34 -0
- package/dist/icons/boxes.js.map +1 -0
- package/dist/icons/by-name.d.ts +11 -0
- package/dist/icons/by-name.js +11 -0
- package/dist/icons/by-name.js.map +1 -0
- package/dist/icons/cable.d.ts +2 -0
- package/dist/icons/cable.js +14 -0
- package/dist/icons/cable.js.map +1 -0
- package/dist/icons/calendar-days.d.ts +2 -0
- package/dist/icons/calendar-days.js +24 -0
- package/dist/icons/calendar-days.js.map +1 -0
- package/dist/icons/check-check.d.ts +2 -0
- package/dist/icons/check-check.js +17 -0
- package/dist/icons/check-check.js.map +1 -0
- package/dist/icons/check-square.d.ts +2 -0
- package/dist/icons/check-square.js +14 -0
- package/dist/icons/check-square.js.map +1 -0
- package/dist/icons/clipboard-paste.d.ts +2 -0
- package/dist/icons/clipboard-paste.js +30 -0
- package/dist/icons/clipboard-paste.js.map +1 -0
- package/dist/icons/crescent.d.ts +2 -0
- package/dist/icons/crescent.js +14 -0
- package/dist/icons/crescent.js.map +1 -0
- package/dist/icons/facet.d.ts +274 -0
- package/dist/icons/facet.js +830 -0
- package/dist/icons/facet.js.map +1 -0
- package/dist/icons/file-plus.d.ts +2 -0
- package/dist/icons/file-plus.js +14 -0
- package/dist/icons/file-plus.js.map +1 -0
- package/dist/icons/file-question.d.ts +2 -0
- package/dist/icons/file-question.js +14 -0
- package/dist/icons/file-question.js.map +1 -0
- package/dist/icons/file-search.d.ts +2 -0
- package/dist/icons/file-search.js +24 -0
- package/dist/icons/file-search.js.map +1 -0
- package/dist/icons/function.d.ts +2 -0
- package/dist/icons/function.js +20 -0
- package/dist/icons/function.js.map +1 -0
- package/dist/icons/gauge.d.ts +2 -0
- package/dist/icons/gauge.js +14 -0
- package/dist/icons/gauge.js.map +1 -0
- package/dist/icons/hourglass.d.ts +2 -0
- package/dist/icons/hourglass.js +14 -0
- package/dist/icons/hourglass.js.map +1 -0
- package/dist/icons/index.d.ts +1 -240
- package/dist/icons/index.js +546 -478
- package/dist/icons/kaaba.d.ts +2 -0
- package/dist/icons/kaaba.js +14 -0
- package/dist/icons/kaaba.js.map +1 -0
- package/dist/icons/keywords.d.ts +35 -1
- package/dist/icons/keywords.js +274 -1
- package/dist/icons/keywords.js.map +1 -1
- package/dist/icons/languages.d.ts +2 -0
- package/dist/icons/languages.js +14 -0
- package/dist/icons/languages.js.map +1 -0
- package/dist/icons/list-tree.d.ts +2 -0
- package/dist/icons/list-tree.js +14 -0
- package/dist/icons/list-tree.js.map +1 -0
- package/dist/icons/loader.d.ts +2 -0
- package/dist/icons/loader.js +14 -0
- package/dist/icons/loader.js.map +1 -0
- package/dist/icons/monitor-down.d.ts +2 -0
- package/dist/icons/monitor-down.js +24 -0
- package/dist/icons/monitor-down.js.map +1 -0
- package/dist/icons/mosque.d.ts +2 -0
- package/dist/icons/mosque.js +14 -0
- package/dist/icons/mosque.js.map +1 -0
- package/dist/icons/panel-right.d.ts +2 -0
- package/dist/icons/panel-right.js +20 -0
- package/dist/icons/panel-right.js.map +1 -0
- package/dist/icons/party-popper.d.ts +2 -0
- package/dist/icons/party-popper.js +14 -0
- package/dist/icons/party-popper.js.map +1 -0
- package/dist/icons/power-off.d.ts +2 -0
- package/dist/icons/power-off.js +14 -0
- package/dist/icons/power-off.js.map +1 -0
- package/dist/icons/prayer-beads.d.ts +2 -0
- package/dist/icons/prayer-beads.js +67 -0
- package/dist/icons/prayer-beads.js.map +1 -0
- package/dist/icons/qr-code.d.ts +2 -0
- package/dist/icons/qr-code.js +38 -0
- package/dist/icons/qr-code.js.map +1 -0
- package/dist/icons/refresh-cw.d.ts +2 -0
- package/dist/icons/refresh-cw.js +14 -0
- package/dist/icons/refresh-cw.js.map +1 -0
- package/dist/icons/rocket.d.ts +2 -0
- package/dist/icons/rocket.js +21 -0
- package/dist/icons/rocket.js.map +1 -0
- package/dist/icons/rows.d.ts +2 -0
- package/dist/icons/rows.js +20 -0
- package/dist/icons/rows.js.map +1 -0
- package/dist/icons/scissors.d.ts +2 -0
- package/dist/icons/scissors.js +26 -0
- package/dist/icons/scissors.js.map +1 -0
- package/dist/icons/shield-question.d.ts +2 -0
- package/dist/icons/shield-question.js +14 -0
- package/dist/icons/shield-question.js.map +1 -0
- package/dist/icons/square-plus.d.ts +2 -0
- package/dist/icons/square-plus.js +20 -0
- package/dist/icons/square-plus.js.map +1 -0
- package/dist/icons/text-select.d.ts +2 -0
- package/dist/icons/text-select.js +14 -0
- package/dist/icons/text-select.js.map +1 -0
- package/dist/icons/types.d.ts +1 -1
- package/dist/icons/types.js +2 -1
- package/dist/icons/types.js.map +1 -1
- package/dist/icons/window-maximize.d.ts +2 -0
- package/dist/icons/window-maximize.js +14 -0
- package/dist/icons/window-maximize.js.map +1 -0
- package/dist/icons/window-restore.d.ts +2 -0
- package/dist/icons/window-restore.js +20 -0
- package/dist/icons/window-restore.js.map +1 -0
- package/dist/index.d.ts +38 -9
- package/dist/index.js +326 -249
- package/dist/overlay/dismiss.js +15 -13
- package/dist/overlay/dismiss.js.map +1 -1
- package/dist/overlay/floating.d.ts +7 -2
- package/dist/overlay/floating.js +29 -21
- package/dist/overlay/floating.js.map +1 -1
- package/dist/overlay/listbox-layer.d.ts +3 -2
- package/dist/overlay/listbox-layer.js.map +1 -1
- package/dist/overlay/position.d.ts +5 -2
- package/dist/overlay/position.js +19 -19
- package/dist/overlay/position.js.map +1 -1
- package/dist/overlay/toast-host.js +3 -2
- package/dist/overlay/toast-host.js.map +1 -1
- package/dist/overlay/use-anchored-position.d.ts +2 -2
- package/dist/overlay/use-anchored-position.js +25 -25
- package/dist/overlay/use-anchored-position.js.map +1 -1
- package/dist/styles/announcer.css +1 -1
- package/dist/styles/app-shell.css +1 -1
- package/dist/styles/avatar.css +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/chat-message.css +1 -0
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/choice-base.css +1 -0
- package/dist/styles/choice.css +1 -1
- package/dist/styles/code-block.css +1 -1
- package/dist/styles/color-field.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/command-palette.css +1 -1
- package/dist/styles/copy-button.css +1 -1
- package/dist/styles/data-grid.css +1 -0
- package/dist/styles/date-field.css +1 -1
- package/dist/styles/device-frame.css +1 -0
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/disclosure.css +1 -1
- package/dist/styles/error-boundary.css +1 -0
- package/dist/styles/field.css +1 -1
- package/dist/styles/file-drop.css +1 -1
- package/dist/styles/floating-toolbar.css +1 -1
- package/dist/styles/generated-css.d.ts +1 -1
- package/dist/styles/generated-css.js +3 -3
- package/dist/styles/generated-css.js.map +1 -1
- package/dist/styles/grid.css +1 -1
- package/dist/styles/heading.css +1 -1
- package/dist/styles/highlighted-text.css +1 -0
- package/dist/styles/hotkey-field.css +1 -0
- package/dist/styles/icon-tile.css +1 -0
- package/dist/styles/icon.css +1 -1
- package/dist/styles/inline.css +1 -0
- package/dist/styles/key-value-editor.css +1 -1
- package/dist/styles/link.css +1 -1
- package/dist/styles/list-row.css +1 -0
- package/dist/styles/list.css +1 -0
- package/dist/styles/loading-dots.css +1 -1
- package/dist/styles/manifest.json +852 -0
- package/dist/styles/menu.css +1 -1
- package/dist/styles/menubar.css +1 -0
- package/dist/styles/notice.css +1 -1
- package/dist/styles/number-field.css +1 -1
- package/dist/styles/option-list.css +1 -0
- package/dist/styles/overlay-frame.css +1 -0
- package/dist/styles/pagination.css +1 -1
- package/dist/styles/pan-zoom-canvas.css +1 -1
- package/dist/styles/path-field.css +1 -0
- package/dist/styles/popover.css +1 -1
- package/dist/styles/progress-bar.css +1 -1
- package/dist/styles/qr-code.css +1 -0
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/row-actions.css +1 -0
- package/dist/styles/scroll-area.css +1 -0
- package/dist/styles/search-field.css +1 -1
- package/dist/styles/section.css +1 -0
- package/dist/styles/segmented-control.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/sheet.css +1 -1
- package/dist/styles/side-nav.css +1 -1
- package/dist/styles/site-footer.css +1 -0
- package/dist/styles/site-header.css +1 -0
- package/dist/styles/skip-link.css +1 -0
- package/dist/styles/sort-button.css +1 -0
- package/dist/styles/sortable-list.css +1 -1
- package/dist/styles/split-pane.css +1 -1
- package/dist/styles/stack.css +1 -1
- package/dist/styles/stat.css +1 -0
- package/dist/styles/status-bar.css +1 -0
- package/dist/styles/steps.css +1 -1
- package/dist/styles/switch.css +1 -0
- package/dist/styles/table.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/tag-input.css +1 -1
- package/dist/styles/text-area.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/text.css +1 -1
- package/dist/styles/time-field.css +1 -1
- package/dist/styles/title-bar.css +1 -0
- package/dist/styles/toast.css +1 -1
- package/dist/styles/tokens.css +3 -3
- package/dist/styles/tree.css +1 -1
- package/dist/styles/virtual-list.css +1 -1
- package/dist/styles/visually-hidden.css +1 -0
- package/dist/styles.css +3 -3
- package/dist/theme/CynosureTheme.d.ts +7 -3
- package/dist/theme/CynosureTheme.js +47 -31
- package/dist/theme/CynosureTheme.js.map +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/theme-context.d.ts +9 -0
- package/dist/theme/theme-context.js +8 -0
- package/dist/theme/theme-context.js.map +1 -0
- package/dist/theme/theme-init-script.js +0 -1
- package/dist/theme/theme-init-script.js.map +1 -1
- package/dist/theme/use-color-mode.d.ts +3 -2
- package/dist/theme/use-color-mode.js +35 -38
- package/dist/theme/use-color-mode.js.map +1 -1
- package/dist/theme/use-cynosure-theme.d.ts +18 -0
- package/dist/theme/use-cynosure-theme.js +23 -0
- package/dist/theme/use-cynosure-theme.js.map +1 -0
- package/dist/tokens/chart-themes.d.ts +38 -0
- package/dist/tokens/chart-themes.js +35 -0
- package/dist/tokens/chart-themes.js.map +1 -0
- package/dist/tokens/create-theme.d.ts +11 -1
- package/dist/tokens/create-theme.js +194 -125
- package/dist/tokens/create-theme.js.map +1 -1
- package/dist/tokens/defaults.d.ts +3 -3
- package/dist/tokens/defaults.js +1 -0
- package/dist/tokens/defaults.js.map +1 -1
- package/dist/tokens/editor-themes.d.ts +9 -2
- package/dist/tokens/editor-themes.js +43 -42
- package/dist/tokens/editor-themes.js.map +1 -1
- package/dist/tokens/index.d.ts +3 -1
- package/dist/tokens/named-themes.d.ts +41 -0
- package/dist/tokens/named-themes.js +118 -0
- package/dist/tokens/named-themes.js.map +1 -0
- package/dist/tokens/schema.d.ts +24 -1
- package/dist/tokens/schema.js +13 -0
- package/dist/tokens/schema.js.map +1 -0
- package/dist/tokens/to-css.js +34 -31
- package/dist/tokens/to-css.js.map +1 -1
- package/package.json +15 -6
- package/dist/components/Checkbox/ChoiceRow.d.ts +0 -39
- package/dist/components/Checkbox/ChoiceRow.js +0 -58
- package/dist/components/Checkbox/ChoiceRow.js.map +0 -1
- package/dist/components/Stack/space.d.ts +0 -18
- package/dist/components/Stack/space.js +0 -12
- package/dist/components/Stack/space.js.map +0 -1
- package/dist/styles/hidden-value.css +0 -1
- package/dist/styles/iconbutton.css +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
2
|
+
import type { Size } from "../../tokens/schema.js";
|
|
3
|
+
import { type MenuEntry } from "../Menu/Menu.js";
|
|
4
|
+
export interface MenubarTokens {
|
|
5
|
+
activeBg: string;
|
|
6
|
+
radius: string;
|
|
7
|
+
paddingInline: string;
|
|
8
|
+
height: string;
|
|
9
|
+
gap: string;
|
|
10
|
+
}
|
|
11
|
+
declare module "../../tokens/schema.js" {
|
|
12
|
+
interface ComponentTokens {
|
|
13
|
+
menubar: MenubarTokens;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export interface MenubarMenu {
|
|
17
|
+
/** The menu's title in the bar, and the accessible name of its list. */
|
|
18
|
+
label: string;
|
|
19
|
+
/** Its commands, exactly as Menu takes them: items (icons, shortcuts, checkable kinds) or labelled sections. */
|
|
20
|
+
items: MenuEntry[];
|
|
21
|
+
}
|
|
22
|
+
export interface MenubarProps {
|
|
23
|
+
/** Accessible name of the bar (required: a menubar must be named). */
|
|
24
|
+
label: string;
|
|
25
|
+
/** The top-level menus, in reading order. */
|
|
26
|
+
menus: MenubarMenu[];
|
|
27
|
+
/** Called with the chosen item's `value`, from whichever menu. */
|
|
28
|
+
onSelect: (value: string) => void;
|
|
29
|
+
/** Size of the menu titles (shared vocabulary: docs/conventions.md). Default "md". */
|
|
30
|
+
size?: Size;
|
|
31
|
+
/** Added to the bar, for layout. */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Layout only. Restyle through --cy-menubar-* tokens. */
|
|
34
|
+
style?: CSSProperties;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* APG menubar: a row of menu titles (File, Edit, View) each opening a Menu. One Tab stop; Left/Right move between
|
|
38
|
+
* titles, or between menus while one is open; hovering a title while a menu is open switches to it.
|
|
39
|
+
*/
|
|
40
|
+
export declare function Menubar({ label, menus, onSelect, size, className, style }: MenubarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ButtonBase as R } from "../../foundations/ButtonBase/ButtonBase.js";
|
|
3
|
+
import { isRtl as C } from "../../foundations/dir.js";
|
|
4
|
+
import { useRovingFocus as F } from "../../foundations/roving-focus.js";
|
|
5
|
+
import { MenuPanel as K } from "../Menu/Menu.js";
|
|
6
|
+
import { Fragment as z, useCallback as b, useId as B, useRef as h, useState as y } from "react";
|
|
7
|
+
import { jsx as i, jsxs as O } from "react/jsx-runtime";
|
|
8
|
+
var P = "[data-menubar-title]";
|
|
9
|
+
function N({ label: w, menus: s, onSelect: g, size: k = "md", className: f, style: x }) {
|
|
10
|
+
const D = B(), m = h(null), o = h([]), [e, p] = y(null), [T, A] = y("first");
|
|
11
|
+
F(m, {
|
|
12
|
+
orientation: "horizontal",
|
|
13
|
+
selector: P
|
|
14
|
+
});
|
|
15
|
+
for (let r = o.current.length; r < s.length; r++) o.current.push({ current: null });
|
|
16
|
+
const c = b((r, t = "first") => {
|
|
17
|
+
A(t), p(r);
|
|
18
|
+
}, []), d = b(() => p(null), []), $ = (r) => (t) => {
|
|
19
|
+
(t.key === "ArrowDown" || t.key === "ArrowUp") && (t.preventDefault(), c(r, t.key === "ArrowUp" ? "last" : "first"));
|
|
20
|
+
}, I = (r) => {
|
|
21
|
+
if (e === null || !r.target.closest('[role="menu"]')) return;
|
|
22
|
+
if (r.key === "Tab") {
|
|
23
|
+
const l = o.current[e]?.current;
|
|
24
|
+
l?.focus();
|
|
25
|
+
const u = o.current.map((a) => a.current).filter((a) => !!a);
|
|
26
|
+
for (const a of u) a.tabIndex = -1;
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
l?.isConnected && (l.tabIndex = 0);
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (r.key !== "ArrowLeft" && r.key !== "ArrowRight" || r.defaultPrevented) return;
|
|
33
|
+
r.preventDefault();
|
|
34
|
+
const t = r.key === "ArrowRight" !== C(r.currentTarget), n = (e + (t ? 1 : -1) + s.length) % s.length;
|
|
35
|
+
c(n), o.current[n]?.current?.focus({ preventScroll: !0 });
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ i("div", {
|
|
38
|
+
ref: m,
|
|
39
|
+
role: "menubar",
|
|
40
|
+
"aria-label": w,
|
|
41
|
+
"aria-orientation": "horizontal",
|
|
42
|
+
className: f ? `cy-menubar ${f}` : "cy-menubar",
|
|
43
|
+
"data-size": k,
|
|
44
|
+
style: x,
|
|
45
|
+
onKeyDown: I,
|
|
46
|
+
children: s.map((r, t) => {
|
|
47
|
+
const n = o.current[t], l = `${D}-${t}`;
|
|
48
|
+
return /* @__PURE__ */ O(z, { children: [/* @__PURE__ */ i(R, {
|
|
49
|
+
ref: n,
|
|
50
|
+
role: "menuitem",
|
|
51
|
+
"aria-haspopup": "menu",
|
|
52
|
+
"aria-expanded": e === t,
|
|
53
|
+
"aria-controls": `${l}-menu`,
|
|
54
|
+
"data-menubar-title": "",
|
|
55
|
+
className: "cy-menubar-item",
|
|
56
|
+
onClick: () => e === t ? d() : c(t),
|
|
57
|
+
onKeyDown: $(t),
|
|
58
|
+
onPointerEnter: (u) => {
|
|
59
|
+
u.pointerType !== "touch" && e !== null && e !== t && c(t);
|
|
60
|
+
},
|
|
61
|
+
children: r.label
|
|
62
|
+
}), /* @__PURE__ */ i(K, {
|
|
63
|
+
id: l,
|
|
64
|
+
label: r.label,
|
|
65
|
+
items: r.items,
|
|
66
|
+
onSelect: g,
|
|
67
|
+
open: e === t,
|
|
68
|
+
onClose: d,
|
|
69
|
+
focusOn: T,
|
|
70
|
+
anchor: n,
|
|
71
|
+
placement: "bottom",
|
|
72
|
+
inside: [n],
|
|
73
|
+
returnFocus: n
|
|
74
|
+
})] }, `${t}-${r.label}`);
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
N as Menubar
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=Menubar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menubar.js","names":["ButtonBase","isRtl","useRovingFocus","MenuPanel","Fragment","useCallback","useId","useRef","useState","jsx","jsxs","TITLE","Menubar","label","menus","onSelect","size","className","style","id","bar","titles","open","setOpen","focusOn","setFocusOn","i","show","index","at","close","onTitleKeyDown","event","onBarKeyDown","title","all","t","forward","next","menu","menuId"],"sources":["../../../src/components/Menubar/Menubar.tsx"],"sourcesContent":["import {\n type CSSProperties,\n Fragment,\n type KeyboardEvent,\n type RefObject,\n useCallback,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { isRtl } from \"../../foundations/dir.js\";\nimport { useRovingFocus } from \"../../foundations/roving-focus.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { type MenuEntry, MenuPanel } from \"../Menu/Menu.js\";\n\nexport interface MenubarTokens {\n activeBg: string;\n radius: string;\n paddingInline: string;\n height: string;\n gap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n menubar: MenubarTokens;\n }\n}\n\nexport interface MenubarMenu {\n /** The menu's title in the bar, and the accessible name of its list. */\n label: string;\n /** Its commands, exactly as Menu takes them: items (icons, shortcuts, checkable kinds) or labelled sections. */\n items: MenuEntry[];\n}\n\nexport interface MenubarProps {\n /** Accessible name of the bar (required: a menubar must be named). */\n label: string;\n /** The top-level menus, in reading order. */\n menus: MenubarMenu[];\n /** Called with the chosen item's `value`, from whichever menu. */\n onSelect: (value: string) => void;\n /** Size of the menu titles (shared vocabulary: docs/conventions.md). Default \"md\". */\n size?: Size;\n /** Added to the bar, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-menubar-* tokens. */\n style?: CSSProperties;\n}\n\nconst TITLE = \"[data-menubar-title]\";\n\n/**\n * APG menubar: a row of menu titles (File, Edit, View) each opening a Menu. One Tab stop; Left/Right move between\n * titles, or between menus while one is open; hovering a title while a menu is open switches to it.\n */\nexport function Menubar({ label, menus, onSelect, size = \"md\", className, style }: MenubarProps) {\n const id = useId();\n const bar = useRef<HTMLDivElement>(null);\n const titles = useRef<RefObject<HTMLButtonElement | null>[]>([]);\n const [open, setOpen] = useState<number | null>(null);\n const [focusOn, setFocusOn] = useState<\"first\" | \"last\">(\"first\");\n useRovingFocus(bar, { orientation: \"horizontal\", selector: TITLE });\n\n for (let i = titles.current.length; i < menus.length; i++) titles.current.push({ current: null });\n\n const show = useCallback((index: number, at: \"first\" | \"last\" = \"first\") => {\n setFocusOn(at);\n setOpen(index);\n }, []);\n const close = useCallback(() => setOpen(null), []);\n\n const onTitleKeyDown = (index: number) => (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n show(index, event.key === \"ArrowUp\" ? \"last\" : \"first\");\n }\n // Enter and Space open on the first item through the click they cause.\n };\n\n // Keys inside an open menu bubble here: Left/Right move to the neighbouring menu, Tab leaves the bar.\n const onBarKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (open === null || !(event.target as HTMLElement).closest('[role=\"menu\"]')) return;\n if (event.key === \"Tab\") {\n // The menu closes itself. Tab and Shift+Tab leave the whole bar: focus its title (the bar's tab stop from now\n // on) and take every title out of the tab order until the browser has moved focus on.\n const title = titles.current[open]?.current;\n title?.focus();\n const all = titles.current.map((t) => t.current).filter((t): t is HTMLButtonElement => !!t);\n for (const t of all) t.tabIndex = -1;\n setTimeout(() => {\n if (title?.isConnected) title.tabIndex = 0;\n });\n return;\n }\n if ((event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") || event.defaultPrevented) return;\n event.preventDefault();\n const forward = (event.key === \"ArrowRight\") !== isRtl(event.currentTarget);\n const next = (open + (forward ? 1 : -1) + menus.length) % menus.length;\n show(next);\n titles.current[next]?.current?.focus({ preventScroll: true });\n };\n\n return (\n <div\n ref={bar}\n role=\"menubar\"\n aria-label={label}\n aria-orientation=\"horizontal\"\n className={className ? `cy-menubar ${className}` : \"cy-menubar\"}\n data-size={size}\n style={style}\n onKeyDown={onBarKeyDown}\n >\n {menus.map((menu, i) => {\n const title = titles.current[i] as RefObject<HTMLButtonElement | null>;\n const menuId = `${id}-${i}`;\n return (\n <Fragment key={`${i}-${menu.label}`}>\n <ButtonBase\n ref={title}\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n aria-expanded={open === i}\n aria-controls={`${menuId}-menu`}\n data-menubar-title=\"\"\n className=\"cy-menubar-item\"\n onClick={() => (open === i ? close() : show(i))}\n onKeyDown={onTitleKeyDown(i)}\n onPointerEnter={(event) => {\n // Hovering switches menus only while one is open; at rest it opens nothing.\n if (event.pointerType !== \"touch\" && open !== null && open !== i) show(i);\n }}\n >\n {menu.label}\n </ButtonBase>\n <MenuPanel\n id={menuId}\n label={menu.label}\n items={menu.items}\n onSelect={onSelect}\n open={open === i}\n onClose={close}\n focusOn={focusOn}\n anchor={title}\n placement=\"bottom\"\n inside={[title]}\n returnFocus={title}\n />\n </Fragment>\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAoDA,IAAMW,IAAQ;AAMd,SAAgBC,EAAQ,EAAE,OAAAC,GAAO,OAAAC,GAAO,UAAAC,GAAU,MAAAC,IAAO,MAAM,WAAAC,GAAW,OAAAC,EAAA,GAAuB;AAC/F,QAAMC,IAAKb,EAAM,GACXc,IAAMb,EAAuB,IAAI,GACjCc,IAASd,EAA8C,CAAC,CAAC,GACzD,CAACe,GAAMC,CAAA,IAAWf,EAAwB,IAAI,GAC9C,CAACgB,GAASC,CAAA,IAAcjB,EAA2B,OAAO;AAChE,EAAAN,EAAekB,GAAK;AAAA,IAAE,aAAa;AAAA,IAAc,UAAUT;AAAA,EAAM,CAAC;AAElE,WAASe,IAAIL,EAAO,QAAQ,QAAQK,IAAIZ,EAAM,QAAQY,IAAK,CAAAL,EAAO,QAAQ,KAAK,EAAE,SAAS,KAAK,CAAC;AAEhG,QAAMM,IAAOtB,EAAA,CAAauB,GAAeC,IAAuB,YAAY;AAC1E,IAAAJ,EAAWI,CAAE,GACbN,EAAQK,CAAK;AAAA,EACf,GAAG,CAAC,CAAC,GACCE,IAAQzB,EAAA,MAAkBkB,EAAQ,IAAI,GAAG,CAAC,CAAC,GAE3CQ,IAAA,CAAkBH,MAAA,CAAmBI,MAA4C;AACrF,KAAIA,EAAM,QAAQ,eAAeA,EAAM,QAAQ,eAC7CA,EAAM,eAAe,GACrBL,EAAKC,GAAOI,EAAM,QAAQ,YAAY,SAAS,OAAO;AAAA,EAG1D,GAGMC,IAAA,CAAgBD,MAAyC;AAC7D,QAAIV,MAAS,QAAQ,CAAEU,EAAM,OAAuB,QAAQ,eAAe,EAAG;AAC9E,QAAIA,EAAM,QAAQ,OAAO;AAGvB,YAAME,IAAQb,EAAO,QAAQC,CAAA,GAAO;AACpC,MAAAY,GAAO,MAAM;AACb,YAAMC,IAAMd,EAAO,QAAQ,IAAA,CAAKe,MAAMA,EAAE,OAAO,EAAE,OAAA,CAAQA,MAA8B,CAAC,CAACA,CAAC;AAC1F,iBAAWA,KAAKD,EAAK,CAAAC,EAAE,WAAW;AAClC,iBAAA,MAAiB;AACf,QAAIF,GAAO,gBAAaA,EAAM,WAAW;AAAA,MAC3C,CAAC;AACD;AAAA,IACF;AACA,QAAKF,EAAM,QAAQ,eAAeA,EAAM,QAAQ,gBAAiBA,EAAM,iBAAkB;AACzF,IAAAA,EAAM,eAAe;AACrB,UAAMK,IAAWL,EAAM,QAAQ,iBAAkB/B,EAAM+B,EAAM,aAAa,GACpEM,KAAQhB,KAAQe,IAAU,IAAI,MAAMvB,EAAM,UAAUA,EAAM;AAChE,IAAAa,EAAKW,CAAI,GACTjB,EAAO,QAAQiB,CAAA,GAAO,SAAS,MAAM,EAAE,eAAe,GAAK,CAAC;AAAA,EAC9D;AAEA,SACE,gBAAA7B,EAAC,OAAD;AAAA,IACE,KAAKW;AAAA,IACL,MAAK;AAAA,IACL,cAAYP;AAAA,IACZ,oBAAiB;AAAA,IACjB,WAAWI,IAAY,cAAcA,CAAA,KAAc;AAAA,IACnD,aAAWD;AAAA,IACJ,OAAAE;AAAA,IACP,WAAWe;AAAA,IAEV,UAAAnB,EAAM,IAAA,CAAKyB,GAAMb,MAAM;AACtB,YAAMQ,IAAQb,EAAO,QAAQK,CAAA,GACvBc,IAAS,GAAGrB,CAAA,IAAMO,CAAA;AACxB,aACE,gBAAAhB,EAACN,GAAD,EAAA,UAAA,CACE,gBAAAK,EAACT,GAAD;AAAA,QACE,KAAKkC;AAAA,QACL,MAAK;AAAA,QACL,iBAAc;AAAA,QACd,iBAAeZ,MAASI;AAAA,QACxB,iBAAe,GAAGc,CAAA;AAAA,QAClB,sBAAmB;AAAA,QACnB,WAAU;AAAA,QACV,SAAA,MAAgBlB,MAASI,IAAII,EAAM,IAAIH,EAAKD,CAAC;AAAA,QAC7C,WAAWK,EAAeL,CAAC;AAAA,QAC3B,gBAAA,CAAiBM,MAAU;AAEzB,UAAIA,EAAM,gBAAgB,WAAWV,MAAS,QAAQA,MAASI,KAAGC,EAAKD,CAAC;AAAA,QAC1E;AAAA,QAEC,UAAAa,EAAK;AAAA,MACI,CAAA,GACZ,gBAAA9B,EAACN,GAAD;AAAA,QACE,IAAIqC;AAAA,QACJ,OAAOD,EAAK;AAAA,QACZ,OAAOA,EAAK;AAAA,QACF,UAAAxB;AAAA,QACV,MAAMO,MAASI;AAAA,QACf,SAASI;AAAA,QACA,SAAAN;AAAA,QACT,QAAQU;AAAA,QACR,WAAU;AAAA,QACV,QAAQ,CAACA,CAAK;AAAA,QACd,aAAaA;AAAA,MACd,CAAA,CACO,EAAA,GA/BK,GAAGR,CAAA,IAAKa,EAAK,KAAA,EA+BlB;AAAA,IAEd,CAAC;AAAA,EACE,CAAA;AAET"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Menubar, type MenubarMenu, type MenubarProps, type MenubarTokens } from "./Menubar.js";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from "react";
|
|
2
2
|
import type { IconData } from "../../icons/types.js";
|
|
3
|
-
import type { Tone } from "../../tokens/schema.js";
|
|
3
|
+
import type { Size, Tone } from "../../tokens/schema.js";
|
|
4
4
|
export interface NoticeTokens {
|
|
5
5
|
radius: string;
|
|
6
6
|
padding: string;
|
|
7
|
+
/** Padding of a small Notice (`size="sm"`). */
|
|
8
|
+
paddingSm: string;
|
|
7
9
|
softMix: string;
|
|
8
10
|
}
|
|
9
11
|
declare module "../../tokens/schema.js" {
|
|
@@ -21,6 +23,13 @@ export interface NoticeProps {
|
|
|
21
23
|
* whose content changes are announced politely.
|
|
22
24
|
*/
|
|
23
25
|
tone?: Tone;
|
|
26
|
+
/**
|
|
27
|
+
* `soft` is a tinted panel with a tone edge; `solid` is the tone's solid colour with the readable text that goes on
|
|
28
|
+
* it, for a message that must stand out (an editor's error banner). Default "soft".
|
|
29
|
+
*/
|
|
30
|
+
variant?: "soft" | "solid";
|
|
31
|
+
/** `sm`: less padding, and the title and message share one line when they fit (a status strip). Default "md". */
|
|
32
|
+
size?: Extract<Size, "sm" | "md">;
|
|
24
33
|
/** Short heading above the message. */
|
|
25
34
|
title?: ReactNode;
|
|
26
35
|
/** One or two Buttons; they move under the text in narrow containers. */
|
|
@@ -41,4 +50,4 @@ export interface NoticeProps {
|
|
|
41
50
|
children?: ReactNode;
|
|
42
51
|
}
|
|
43
52
|
/** An inline message about part of the page: a status, a warning or an error that stays until it is resolved. */
|
|
44
|
-
export declare function Notice({ tone, title, action, dismissible, onDismiss, icon, labels, className, style, children, }: NoticeProps): import("react").JSX.Element | null;
|
|
53
|
+
export declare function Notice({ tone, variant, size, title, action, dismissible, onDismiss, icon, labels, className, style, children, }: NoticeProps): import("react").JSX.Element | null;
|
|
@@ -1,47 +1,51 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { IconButton as
|
|
4
|
-
import { close as
|
|
5
|
-
import { TONE_ICONS as
|
|
6
|
-
import { useState as
|
|
7
|
-
import { jsx as e, jsxs as
|
|
8
|
-
function
|
|
9
|
-
const [
|
|
10
|
-
if (
|
|
11
|
-
const
|
|
2
|
+
import { Icon as v } from "../../foundations/Icon/Icon.js";
|
|
3
|
+
import { IconButton as h } from "../IconButton/IconButton.js";
|
|
4
|
+
import { close as x } from "../../icons/close.js";
|
|
5
|
+
import { TONE_ICONS as C } from "../../foundations/tone-icons.js";
|
|
6
|
+
import { useState as g } from "react";
|
|
7
|
+
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
8
|
+
function _({ tone: i = "info", variant: c = "soft", size: d = "md", title: s, action: t, dismissible: y = !1, onDismiss: o, icon: n, labels: f, className: r, style: p, children: a }) {
|
|
9
|
+
const [N, u] = g(!1);
|
|
10
|
+
if (N) return null;
|
|
11
|
+
const l = n === void 0 ? C[i] : n;
|
|
12
12
|
return /* @__PURE__ */ e("div", {
|
|
13
|
-
role:
|
|
14
|
-
className:
|
|
15
|
-
"data-tone":
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
role: i === "danger" ? "alert" : "status",
|
|
14
|
+
className: r ? `cy-notice ${r}` : "cy-notice",
|
|
15
|
+
"data-tone": i,
|
|
16
|
+
"data-variant": c,
|
|
17
|
+
"data-size": d,
|
|
18
|
+
style: p,
|
|
19
|
+
children: /* @__PURE__ */ m("div", {
|
|
18
20
|
className: "cy-notice-main cy-reset",
|
|
19
21
|
children: [
|
|
20
|
-
|
|
21
|
-
icon:
|
|
22
|
+
l && /* @__PURE__ */ e(v, {
|
|
23
|
+
icon: l,
|
|
22
24
|
className: "cy-notice-icon"
|
|
23
25
|
}),
|
|
24
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ m("div", {
|
|
25
27
|
className: "cy-notice-text cy-reset",
|
|
26
|
-
children: [
|
|
28
|
+
children: [s && /* @__PURE__ */ e("span", {
|
|
27
29
|
className: "cy-notice-title cy-reset",
|
|
28
|
-
children:
|
|
29
|
-
}),
|
|
30
|
+
children: s
|
|
31
|
+
}), a && /* @__PURE__ */ e("div", {
|
|
30
32
|
className: "cy-notice-body cy-reset",
|
|
31
|
-
children:
|
|
33
|
+
children: a
|
|
32
34
|
})]
|
|
33
35
|
}),
|
|
34
36
|
t && /* @__PURE__ */ e("div", {
|
|
35
37
|
className: "cy-notice-action cy-reset",
|
|
36
38
|
children: t
|
|
37
39
|
}),
|
|
38
|
-
|
|
39
|
-
icon:
|
|
40
|
-
label:
|
|
40
|
+
y && /* @__PURE__ */ e(h, {
|
|
41
|
+
icon: x,
|
|
42
|
+
label: f?.dismiss ?? "Dismiss",
|
|
41
43
|
variant: "ghost",
|
|
42
44
|
size: "sm",
|
|
45
|
+
...c === "solid" && { iconColor: "var(--_notice-on)" },
|
|
46
|
+
wrapperClassName: "cy-notice-dismiss",
|
|
43
47
|
onClick: () => {
|
|
44
|
-
|
|
48
|
+
o?.(), o || u(!0);
|
|
45
49
|
}
|
|
46
50
|
})
|
|
47
51
|
]
|
|
@@ -49,7 +53,7 @@ function S({ tone: c = "info", title: i, action: t, dismissible: m = !1, onDismi
|
|
|
49
53
|
});
|
|
50
54
|
}
|
|
51
55
|
export {
|
|
52
|
-
|
|
56
|
+
_ as Notice
|
|
53
57
|
};
|
|
54
58
|
|
|
55
59
|
//# sourceMappingURL=Notice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notice.js","names":["closeIcon","Icon","IconButton","close","TONE_ICONS","useState","jsx","jsxs","Notice","tone","title","action","dismissible","onDismiss","icon","labels","className","style","children","hidden","setHidden","glyph"],"sources":["../../../src/components/Notice/Notice.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useState } from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { TONE_ICONS } from \"../../foundations/tone-icons.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Tone } from \"../../tokens/schema.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface NoticeTokens {\n radius: string;\n padding: string;\n softMix: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n notice: NoticeTokens;\n }\n}\n\nexport interface NoticeLabels {\n /** Accessible name of the dismiss button. */\n dismiss: string;\n}\n\nexport interface NoticeProps {\n /**\n * Colour and icon. `danger` is `role=\"alert\"` (announced even when it mounts filled); the others are `role=\"status\"`,\n * whose content changes are announced politely.\n */\n tone?: Tone;\n /** Short heading above the message. */\n title?: ReactNode;\n /** One or two Buttons; they move under the text in narrow containers. */\n action?: ReactNode;\n /** Shows a close button. The Notice hides itself unless you control it with `onDismiss` and unmount it. */\n dismissible?: boolean;\n /** Called when the close button is pressed. With it, hiding the Notice is up to you. */\n onDismiss?: () => void;\n /** Replace the tone's icon, or `null` for none. */\n icon?: IconData | null;\n /** Replace the built-in English text: the dismiss button's name. */\n labels?: Partial<NoticeLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-notice-* tokens. */\n style?: CSSProperties;\n /** The message. */\n children?: ReactNode;\n}\n\n/** An inline message about part of the page: a status, a warning or an error that stays until it is resolved. */\nexport function Notice({\n tone = \"info\",\n title,\n action,\n dismissible = false,\n onDismiss,\n icon,\n labels,\n className,\n style,\n children,\n}: NoticeProps) {\n const [hidden, setHidden] = useState(false);\n if (hidden) return null;\n const glyph = icon === undefined ? TONE_ICONS[tone] : icon;\n return (\n <div\n role={tone === \"danger\" ? \"alert\" : \"status\"}\n className={className ? `cy-notice ${className}` : \"cy-notice\"}\n data-tone={tone}\n style={style}\n >\n <div className=\"cy-notice-main cy-reset\">\n {glyph && <Icon icon={glyph} className=\"cy-notice-icon\" />}\n <div className=\"cy-notice-text cy-reset\">\n {title && <span className=\"cy-notice-title cy-reset\">{title}</span>}\n {children && <div className=\"cy-notice-body cy-reset\">{children}</div>}\n </div>\n {action && <div className=\"cy-notice-action cy-reset\">{action}</div>}\n {dismissible && (\n <IconButton\n icon={closeIcon}\n label={labels?.dismiss ?? \"Dismiss\"}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n onDismiss?.();\n if (!onDismiss) setHidden(true);\n }}\n />\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"Notice.js","names":["closeIcon","Icon","IconButton","close","TONE_ICONS","useState","jsx","jsxs","Notice","tone","variant","size","title","action","dismissible","onDismiss","icon","labels","className","style","children","hidden","setHidden","glyph"],"sources":["../../../src/components/Notice/Notice.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useState } from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { TONE_ICONS } from \"../../foundations/tone-icons.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size, Tone } from \"../../tokens/schema.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface NoticeTokens {\n radius: string;\n padding: string;\n /** Padding of a small Notice (`size=\"sm\"`). */\n paddingSm: string;\n softMix: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n notice: NoticeTokens;\n }\n}\n\nexport interface NoticeLabels {\n /** Accessible name of the dismiss button. */\n dismiss: string;\n}\n\nexport interface NoticeProps {\n /**\n * Colour and icon. `danger` is `role=\"alert\"` (announced even when it mounts filled); the others are `role=\"status\"`,\n * whose content changes are announced politely.\n */\n tone?: Tone;\n /**\n * `soft` is a tinted panel with a tone edge; `solid` is the tone's solid colour with the readable text that goes on\n * it, for a message that must stand out (an editor's error banner). Default \"soft\".\n */\n variant?: \"soft\" | \"solid\";\n /** `sm`: less padding, and the title and message share one line when they fit (a status strip). Default \"md\". */\n size?: Extract<Size, \"sm\" | \"md\">;\n /** Short heading above the message. */\n title?: ReactNode;\n /** One or two Buttons; they move under the text in narrow containers. */\n action?: ReactNode;\n /** Shows a close button. The Notice hides itself unless you control it with `onDismiss` and unmount it. */\n dismissible?: boolean;\n /** Called when the close button is pressed. With it, hiding the Notice is up to you. */\n onDismiss?: () => void;\n /** Replace the tone's icon, or `null` for none. */\n icon?: IconData | null;\n /** Replace the built-in English text: the dismiss button's name. */\n labels?: Partial<NoticeLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-notice-* tokens. */\n style?: CSSProperties;\n /** The message. */\n children?: ReactNode;\n}\n\n/** An inline message about part of the page: a status, a warning or an error that stays until it is resolved. */\nexport function Notice({\n tone = \"info\",\n variant = \"soft\",\n size = \"md\",\n title,\n action,\n dismissible = false,\n onDismiss,\n icon,\n labels,\n className,\n style,\n children,\n}: NoticeProps) {\n const [hidden, setHidden] = useState(false);\n if (hidden) return null;\n const glyph = icon === undefined ? TONE_ICONS[tone] : icon;\n return (\n <div\n role={tone === \"danger\" ? \"alert\" : \"status\"}\n className={className ? `cy-notice ${className}` : \"cy-notice\"}\n data-tone={tone}\n data-variant={variant}\n data-size={size}\n style={style}\n >\n <div className=\"cy-notice-main cy-reset\">\n {glyph && <Icon icon={glyph} className=\"cy-notice-icon\" />}\n <div className=\"cy-notice-text cy-reset\">\n {title && <span className=\"cy-notice-title cy-reset\">{title}</span>}\n {children && <div className=\"cy-notice-body cy-reset\">{children}</div>}\n </div>\n {action && <div className=\"cy-notice-action cy-reset\">{action}</div>}\n {dismissible && (\n <IconButton\n icon={closeIcon}\n label={labels?.dismiss ?? \"Dismiss\"}\n variant=\"ghost\"\n size=\"sm\"\n // On a fill the close icon takes the fill's text colour; on the soft panel, the button's own.\n {...(variant === \"solid\" && { iconColor: \"var(--_notice-on)\" })}\n wrapperClassName=\"cy-notice-dismiss\"\n onClick={() => {\n onDismiss?.();\n if (!onDismiss) setHidden(true);\n }}\n />\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AA6DA,SAAgBQ,EAAO,EACrB,MAAAC,IAAO,QACP,SAAAC,IAAU,QACV,MAAAC,IAAO,MACP,OAAAC,GACA,QAAAC,GACA,aAAAC,IAAc,IACd,WAAAC,GACA,MAAAC,GACA,QAAAC,GACA,WAAAC,GACA,OAAAC,GACA,UAAAC,EAAA,GACc;AACd,QAAM,CAACC,GAAQC,CAAA,IAAajB,EAAS,EAAK;AAC1C,MAAIgB,EAAQ,QAAO;AACnB,QAAME,IAAQP,MAAS,SAAYZ,EAAWK,CAAA,IAAQO;AACtD,SACE,gBAAAV,EAAC,OAAD;AAAA,IACE,MAAMG,MAAS,WAAW,UAAU;AAAA,IACpC,WAAWS,IAAY,aAAaA,CAAA,KAAc;AAAA,IAClD,aAAWT;AAAA,IACX,gBAAcC;AAAA,IACd,aAAWC;AAAA,IACJ,OAAAQ;AAAA,IAEP,UAAA,gBAAAZ,EAAC,OAAD;AAAA,MAAK,WAAU;AAAA,MAAf,UAAA;AAAA,QACGgB,KAAS,gBAAAjB,EAACL,GAAD;AAAA,UAAM,MAAMsB;AAAA,UAAO,WAAU;AAAA,QAAkB,CAAA;AAAA,QACzD,gBAAAhB,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAAf,UAAA,CACGK,KAAS,gBAAAN,EAAC,QAAD;AAAA,YAAM,WAAU;AAAA,YAA4B,UAAAM;AAAA,UAAY,CAAA,GACjEQ,KAAY,gBAAAd,EAAC,OAAD;AAAA,YAAK,WAAU;AAAA,YAA2B,UAAAc;AAAA,UAAc,CAAA,CAClE;AAAA,Q;A,QACJP,KAAU,gBAAAP,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAA6B,UAAAO;AAAA,QAAY,CAAA;AAAA,QAClEC,KACC,gBAAAR,EAACJ,GAAD;AAAA,UACE,MAAMF;AAAAA,UACN,OAAOiB,GAAQ,WAAW;AAAA,UAC1B,SAAQ;AAAA,UACR,MAAK;AAAA,UAEL,GAAKP,MAAY,WAAW,EAAE,WAAW,oBAAoB;AAAA,UAC7D,kBAAiB;AAAA,UACjB,SAAA,MAAe;AACb,YAAAK,IAAY,GACPA,KAAWO,EAAU,EAAI;AAAA,UAChC;AAAA,QACD,CAAA;AAAA,MAEA;AAAA,I;A,EACF,CAAA;AAET"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from "react";
|
|
2
2
|
import type { Size } from "../../tokens/schema.js";
|
|
3
|
+
import type { FieldLayoutProps } from "../Field/Field.js";
|
|
3
4
|
export interface NumberFieldLabels {
|
|
4
5
|
/** Stepper button names. Defaults: "Decrease", "Increase". */
|
|
5
6
|
decrement: string;
|
|
6
7
|
increment: string;
|
|
7
8
|
}
|
|
8
|
-
export interface NumberFieldProps {
|
|
9
|
+
export interface NumberFieldProps extends FieldLayoutProps {
|
|
9
10
|
/** Visible label; it names the field. */
|
|
10
11
|
label: ReactNode;
|
|
11
12
|
/** Visually hide the label (it still names the field). Prefer visible labels. */
|
|
@@ -62,10 +63,14 @@ export interface NumberFieldProps {
|
|
|
62
63
|
/** Layout only. */
|
|
63
64
|
style?: CSSProperties;
|
|
64
65
|
}
|
|
65
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Reads what a person typed, or what the field wrote, in `locale` and `options`: the locale's digits (Arabic-Indic,
|
|
68
|
+
* Devanagari…), group separators, decimal mark and minus, a typographic minus, currency, percent and unit text, and
|
|
69
|
+
* accounting brackets.
|
|
70
|
+
*/
|
|
66
71
|
export declare function parseNumber(text: string, locale?: string, options?: Intl.NumberFormatOptions): number | null;
|
|
67
72
|
/**
|
|
68
73
|
* A number input: type it in your own format, or step it with the arrow keys, Page Up/Down, Home/End or the − and +
|
|
69
74
|
* buttons. APG spinbutton; locale-aware; takes part in forms with the plain number.
|
|
70
75
|
*/
|
|
71
|
-
export declare function NumberField({ label, labelHidden, description, error, value, defaultValue, onChange, min, max, step, largeStep, locale, formatOptions, hideSteppers, name, form, required, disabled, readOnly, placeholder, size, variant, labels, scrub, className, style, }: NumberFieldProps): import("react").JSX.Element;
|
|
76
|
+
export declare function NumberField({ label, labelHidden, layout, width, description, error, value, defaultValue, onChange, min, max, step, largeStep, locale, formatOptions, hideSteppers, name, form, required, disabled, readOnly, placeholder, size, variant, labels, scrub, className, style, }: NumberFieldProps): import("react").JSX.Element;
|
|
@@ -1,140 +1,191 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useControllableState as
|
|
3
|
-
import { useClientLayoutEffect as
|
|
4
|
-
import { clamp as
|
|
5
|
-
import { IconButton as
|
|
6
|
-
import { minus as
|
|
7
|
-
import { plus as
|
|
8
|
-
import { TextField as
|
|
9
|
-
import { useDrag as
|
|
10
|
-
import { HiddenValue as
|
|
11
|
-
import { useMemo as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
var
|
|
2
|
+
import { useControllableState as ut } from "../../foundations/controllable.js";
|
|
3
|
+
import { useClientLayoutEffect as st } from "../../foundations/client-layout-effect.js";
|
|
4
|
+
import { ariaNumber as T, clamp as ct, plainNumber as lt, roundLike as z, snapToStep as at } from "../../foundations/math.js";
|
|
5
|
+
import { IconButton as G } from "../IconButton/IconButton.js";
|
|
6
|
+
import { minus as mt } from "../../icons/minus.js";
|
|
7
|
+
import { plus as ft } from "../../icons/plus.js";
|
|
8
|
+
import { TextField as pt } from "../TextField/TextField.js";
|
|
9
|
+
import { useDrag as gt } from "../../foundations/drag.js";
|
|
10
|
+
import { HiddenValue as dt } from "../../foundations/HiddenValue/HiddenValue.js";
|
|
11
|
+
import { useMemo as bt, useRef as A, useState as vt } from "react";
|
|
12
|
+
import { Fragment as Nt, jsx as E, jsxs as H } from "react/jsx-runtime";
|
|
13
|
+
var It = {
|
|
14
14
|
decrement: "Decrease",
|
|
15
15
|
increment: "Increase"
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
}, K = /* @__PURE__ */ new Map(), St = [
|
|
17
|
+
-12345675e-1,
|
|
18
|
+
12345675e-1,
|
|
19
|
+
1,
|
|
20
|
+
2
|
|
21
|
+
];
|
|
22
|
+
function Ft(c, m) {
|
|
23
|
+
const d = JSON.stringify([c ?? "", m ?? {}]), l = K.get(d);
|
|
24
|
+
if (l) return l;
|
|
25
|
+
const b = new Intl.NumberFormat(c), F = (m?.numberingSystem ? new Intl.NumberFormat(c, m) : b).resolvedOptions().numberingSystem;
|
|
26
|
+
let v = [];
|
|
27
|
+
try {
|
|
28
|
+
v = St.flatMap((r) => new Intl.NumberFormat(c, {
|
|
29
|
+
...m,
|
|
30
|
+
minimumFractionDigits: 1,
|
|
31
|
+
maximumFractionDigits: 1,
|
|
32
|
+
minimumSignificantDigits: void 0,
|
|
33
|
+
maximumSignificantDigits: void 0
|
|
34
|
+
}).formatToParts(r));
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
const h = [...v, ...b.formatToParts(-12345.6)], e = (r, u) => h.find((s) => s.type === r)?.value ?? u, n = new Intl.NumberFormat(c, {
|
|
38
|
+
numberingSystem: F,
|
|
39
|
+
useGrouping: !1
|
|
40
|
+
}), o = {
|
|
41
|
+
group: e("group", ","),
|
|
42
|
+
decimal: e("decimal", "."),
|
|
43
|
+
minus: e("minusSign", "-"),
|
|
44
|
+
digits: Array.from({ length: 10 }, (r, u) => n.format(u)),
|
|
45
|
+
affixes: [...new Set(v.filter((r) => [
|
|
46
|
+
"currency",
|
|
47
|
+
"percentSign",
|
|
48
|
+
"unit",
|
|
49
|
+
"literal",
|
|
50
|
+
"compact"
|
|
51
|
+
].includes(r.type)).map((r) => r.value.trim()).filter(Boolean))].sort((r, u) => u.length - r.length)
|
|
52
|
+
};
|
|
53
|
+
return K.set(d, o), o;
|
|
22
54
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
55
|
+
var j = /[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
56
|
+
function R(c, m, d) {
|
|
57
|
+
const { group: l, decimal: b, minus: F, digits: v, affixes: h } = Ft(m, d);
|
|
58
|
+
let e = c.replace(j, "");
|
|
59
|
+
const n = /\(.*\)/.test(e);
|
|
60
|
+
for (const s of h) s !== l.trim() && s !== b && s !== F.replace(j, "") && (e = e.split(s).join(" "));
|
|
61
|
+
e = e.replace(/\p{Nd}/gu, (s) => {
|
|
62
|
+
const f = v.indexOf(s);
|
|
63
|
+
return f >= 0 ? String(f) : s;
|
|
64
|
+
}), e = e.replace(/[()]/g, "");
|
|
65
|
+
const o = F.replace(j, "");
|
|
66
|
+
o && o !== "-" && (e = e.split(o).join("-")), e = e.replace(/[−‒–]/g, "-"), l.trim() ? (e = e.split(l).join(""), l === "’" && (e = e.split("'").join(""))) : e = e.replace(/\s/g, "");
|
|
67
|
+
const r = e.replace(/\s/g, "").split(b).join(".").replace(/[^\d.-]/g, "");
|
|
68
|
+
if (!/^-?\d*\.?\d+$|^-?\d+\.?$/.test(r)) return null;
|
|
69
|
+
let u = Number(r);
|
|
70
|
+
return Number.isFinite(u) ? (n && u > 0 && (u = -u), d?.style === "percent" ? Number((u / 100).toPrecision(15)) : u) : null;
|
|
71
|
+
}
|
|
72
|
+
function jt({ label: c, labelHidden: m, layout: d, width: l, description: b, error: F, value: v, defaultValue: h = null, onChange: e, min: n, max: o, step: r = 1, largeStep: u, locale: s, formatOptions: f, hideSteppers: V = !1, name: Y, form: P, required: J, disabled: p, readOnly: N, placeholder: q, size: Q = "md", variant: W = "outline", labels: X, scrub: Z = !1, className: B, style: L }) {
|
|
73
|
+
const _ = {
|
|
74
|
+
...It,
|
|
75
|
+
...X
|
|
76
|
+
}, [i, O, tt] = ut(v, h, e), [w, x] = vt(null), y = A(null), et = bt(() => new Intl.NumberFormat(s, {
|
|
28
77
|
maximumFractionDigits: 20,
|
|
29
|
-
...
|
|
30
|
-
}), [
|
|
31
|
-
x(null), t !==
|
|
32
|
-
},
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
if (
|
|
38
|
-
if (
|
|
39
|
-
const t =
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
const
|
|
43
|
-
ArrowUp: () =>
|
|
44
|
-
ArrowDown: () =>
|
|
45
|
-
PageUp: () =>
|
|
46
|
-
PageDown: () =>
|
|
47
|
-
Enter:
|
|
78
|
+
...f
|
|
79
|
+
}), [s, f]), $ = (t) => t === null ? "" : et.format(t), C = (t) => ct(t, n ?? Number.NEGATIVE_INFINITY, o ?? Number.POSITIVE_INFINITY), I = (t) => {
|
|
80
|
+
x(null), t !== i && O(t);
|
|
81
|
+
}, D = (t) => {
|
|
82
|
+
if (p || N) return;
|
|
83
|
+
const a = n ?? 0, g = w !== null ? R(w, s, f) ?? i : i, S = g ?? (t > 0 ? n ?? 0 : o ?? 0);
|
|
84
|
+
I(C(g === null ? z(S, r, a) : at(S + t, r, a)));
|
|
85
|
+
}, U = () => {
|
|
86
|
+
if (w === null) return;
|
|
87
|
+
if (w.trim() === "") return I(null);
|
|
88
|
+
const t = R(w, s, f);
|
|
89
|
+
I(t === null ? i : C(t));
|
|
90
|
+
}, rt = (t) => {
|
|
91
|
+
const a = u ?? r * 10, g = {
|
|
92
|
+
ArrowUp: () => D(r),
|
|
93
|
+
ArrowDown: () => D(-r),
|
|
94
|
+
PageUp: () => D(a),
|
|
95
|
+
PageDown: () => D(-a),
|
|
96
|
+
Enter: U
|
|
48
97
|
};
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
const t =
|
|
55
|
-
|
|
98
|
+
n !== void 0 && (g.Home = () => !p && !N && I(n)), o !== void 0 && (g.End = () => !p && !N && I(o));
|
|
99
|
+
const S = g[t.key];
|
|
100
|
+
S && (t.key !== "Enter" && t.preventDefault(), S());
|
|
101
|
+
}, k = A(null);
|
|
102
|
+
st(() => {
|
|
103
|
+
const t = Z && !p && !N ? y.current?.labels?.[0] ?? null : null;
|
|
104
|
+
k.current && k.current !== t && delete k.current.dataset.scrub, t && (t.dataset.scrub = ""), k.current = t;
|
|
56
105
|
});
|
|
57
|
-
const
|
|
58
|
-
|
|
106
|
+
const M = A(null);
|
|
107
|
+
gt(k, {
|
|
59
108
|
distance: 3,
|
|
60
109
|
touchAction: "css",
|
|
61
110
|
onStart: () => {
|
|
62
|
-
|
|
111
|
+
M.current = i;
|
|
63
112
|
},
|
|
64
|
-
onMove: ({ delta: t, event:
|
|
65
|
-
const
|
|
66
|
-
|
|
113
|
+
onMove: ({ delta: t, event: a }) => {
|
|
114
|
+
const g = Math.round(t.x / 4) * (a.shiftKey ? 10 : 1), S = M.current ?? n ?? 0;
|
|
115
|
+
I(C(z(S + g * r, r, n ?? 0)));
|
|
67
116
|
},
|
|
68
|
-
onEnd: (t,
|
|
69
|
-
|
|
117
|
+
onEnd: (t, a) => {
|
|
118
|
+
a && I(M.current), y.current?.focus({ preventScroll: !0 });
|
|
70
119
|
}
|
|
71
120
|
});
|
|
72
|
-
const
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
-
ref:
|
|
75
|
-
label:
|
|
76
|
-
labelHidden:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
121
|
+
const nt = i !== null && n !== void 0 && i <= n, it = i !== null && o !== void 0 && i >= o, ot = Number.isInteger(r) && (n ?? 0) >= 0 && f?.style !== "percent";
|
|
122
|
+
return /* @__PURE__ */ H(Nt, { children: [/* @__PURE__ */ E(pt, {
|
|
123
|
+
ref: y,
|
|
124
|
+
label: c,
|
|
125
|
+
labelHidden: m,
|
|
126
|
+
layout: d,
|
|
127
|
+
width: l,
|
|
128
|
+
description: b,
|
|
129
|
+
error: F,
|
|
130
|
+
size: Q,
|
|
131
|
+
variant: W,
|
|
132
|
+
className: B ? `cy-number-field ${B}` : "cy-number-field",
|
|
133
|
+
...L ? { style: L } : {},
|
|
83
134
|
role: "spinbutton",
|
|
84
|
-
inputMode:
|
|
135
|
+
inputMode: ot ? "numeric" : "decimal",
|
|
85
136
|
autoComplete: "off",
|
|
86
137
|
autoCorrect: "off",
|
|
87
138
|
spellCheck: !1,
|
|
88
|
-
"aria-valuenow":
|
|
89
|
-
"aria-valuemin":
|
|
90
|
-
"aria-valuemax":
|
|
91
|
-
"aria-valuetext":
|
|
92
|
-
required:
|
|
93
|
-
disabled:
|
|
94
|
-
readOnly:
|
|
95
|
-
placeholder:
|
|
96
|
-
form:
|
|
97
|
-
value:
|
|
139
|
+
"aria-valuenow": T(i),
|
|
140
|
+
"aria-valuemin": T(n),
|
|
141
|
+
"aria-valuemax": T(o),
|
|
142
|
+
"aria-valuetext": i === null ? void 0 : $(i),
|
|
143
|
+
required: J,
|
|
144
|
+
disabled: p,
|
|
145
|
+
readOnly: N,
|
|
146
|
+
placeholder: q,
|
|
147
|
+
form: P,
|
|
148
|
+
value: w ?? $(i),
|
|
98
149
|
onChange: x,
|
|
99
|
-
onKeyDown:
|
|
100
|
-
onBlur:
|
|
101
|
-
addonEnd: !
|
|
150
|
+
onKeyDown: rt,
|
|
151
|
+
onBlur: U,
|
|
152
|
+
addonEnd: !V && /* @__PURE__ */ H("span", {
|
|
102
153
|
className: "cy-number-field-steppers",
|
|
103
|
-
children: [/* @__PURE__ */ E(
|
|
104
|
-
icon:
|
|
105
|
-
label:
|
|
154
|
+
children: [/* @__PURE__ */ E(G, {
|
|
155
|
+
icon: mt,
|
|
156
|
+
label: _.decrement,
|
|
106
157
|
variant: "ghost",
|
|
107
158
|
size: "sm",
|
|
108
159
|
tabIndex: -1,
|
|
109
|
-
disabled:
|
|
160
|
+
disabled: p || N || nt,
|
|
110
161
|
onClick: () => {
|
|
111
|
-
|
|
162
|
+
D(-r), y.current?.focus();
|
|
112
163
|
}
|
|
113
|
-
}), /* @__PURE__ */ E(
|
|
114
|
-
icon:
|
|
115
|
-
label:
|
|
164
|
+
}), /* @__PURE__ */ E(G, {
|
|
165
|
+
icon: ft,
|
|
166
|
+
label: _.increment,
|
|
116
167
|
variant: "ghost",
|
|
117
168
|
size: "sm",
|
|
118
169
|
tabIndex: -1,
|
|
119
|
-
disabled:
|
|
170
|
+
disabled: p || N || it,
|
|
120
171
|
onClick: () => {
|
|
121
|
-
|
|
172
|
+
D(r), y.current?.focus();
|
|
122
173
|
}
|
|
123
174
|
})]
|
|
124
175
|
})
|
|
125
|
-
}), /* @__PURE__ */ E(
|
|
126
|
-
name:
|
|
127
|
-
form:
|
|
128
|
-
value:
|
|
129
|
-
disabled:
|
|
176
|
+
}), /* @__PURE__ */ E(dt, {
|
|
177
|
+
name: Y,
|
|
178
|
+
form: P,
|
|
179
|
+
value: i === null ? "" : lt(i),
|
|
180
|
+
disabled: p,
|
|
130
181
|
onReset: () => {
|
|
131
|
-
x(null),
|
|
182
|
+
x(null), tt(h);
|
|
132
183
|
}
|
|
133
184
|
})] });
|
|
134
185
|
}
|
|
135
186
|
export {
|
|
136
|
-
|
|
137
|
-
|
|
187
|
+
jt as NumberField,
|
|
188
|
+
R as parseNumber
|
|
138
189
|
};
|
|
139
190
|
|
|
140
191
|
//# sourceMappingURL=NumberField.js.map
|