@arshad-shah/cynosure 0.2.0 → 0.4.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 +5 -5
- package/dist/adapters/astro/index.d.ts +52 -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 +14 -0
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Announcer/Announcer.d.ts +1 -0
- package/dist/components/Announcer/Announcer.js +5 -5
- package/dist/components/Announcer/Announcer.js.map +1 -1
- package/dist/components/AppShell/AppShell.d.ts +22 -1
- package/dist/components/AppShell/AppShell.js +92 -83
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/AppShell/index.d.ts +1 -1
- package/dist/components/AspectRatio/AspectRatio.d.ts +29 -0
- package/dist/components/AspectRatio/AspectRatio.js +21 -0
- package/dist/components/AspectRatio/AspectRatio.js.map +1 -0
- package/dist/components/AspectRatio/index.d.ts +1 -0
- package/dist/components/Avatar/Avatar.d.ts +96 -0
- package/dist/components/Avatar/Avatar.js +90 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Badge/Badge.d.ts +6 -0
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +55 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +85 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +27 -2
- package/dist/components/Button/Button.js +62 -53
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +65 -7
- package/dist/components/Calendar/Calendar.js +209 -97
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/dates.d.ts +4 -0
- package/dist/components/Calendar/dates.js +41 -27
- package/dist/components/Calendar/dates.js.map +1 -1
- package/dist/components/Calendar/index.d.ts +1 -1
- package/dist/components/Card/Card.d.ts +35 -1
- package/dist/components/Card/Card.js +48 -36
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +11 -4
- package/dist/components/Checkbox/Checkbox.js +33 -7
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checklist/Checklist.d.ts +65 -0
- package/dist/components/Checklist/Checklist.js +163 -0
- package/dist/components/Checklist/Checklist.js.map +1 -0
- package/dist/components/Checklist/index.d.ts +1 -0
- 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 +5 -0
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/components/ColorField/ColorField.d.ts +12 -0
- package/dist/components/ColorField/ColorField.js +199 -208
- package/dist/components/ColorField/ColorField.js.map +1 -1
- package/dist/components/ColorSwatches/ColorSwatches.d.ts +5 -0
- package/dist/components/ColorSwatches/ColorSwatches.js +6 -6
- package/dist/components/ColorSwatches/ColorSwatches.js.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +20 -1
- package/dist/components/Combobox/Combobox.js +86 -111
- package/dist/components/Combobox/Combobox.js.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts +9 -0
- package/dist/components/CommandPalette/CommandPalette.js +10 -10
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
- package/dist/components/CompareSlider/CompareSlider.d.ts +4 -0
- package/dist/components/CompareSlider/CompareSlider.js +4 -4
- package/dist/components/CompareSlider/CompareSlider.js.map +1 -1
- package/dist/components/Container/Container.d.ts +44 -0
- package/dist/components/Container/Container.js +28 -0
- package/dist/components/Container/Container.js.map +1 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +11 -0
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.d.ts +8 -0
- package/dist/components/CopyButton/CopyButton.js +29 -28
- package/dist/components/CopyButton/CopyButton.js.map +1 -1
- package/dist/components/DateField/DateField.d.ts +17 -0
- package/dist/components/DateField/DateField.js +6 -6
- package/dist/components/DateField/DateField.js.map +1 -1
- package/dist/components/DescriptionList/DescriptionList.d.ts +3 -0
- package/dist/components/DescriptionList/DescriptionList.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 +25 -2
- package/dist/components/Dialog/Dialog.js +89 -72
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Disclosure/Disclosure.d.ts +7 -0
- package/dist/components/Disclosure/Disclosure.js.map +1 -1
- package/dist/components/Divider/Divider.d.ts +59 -0
- package/dist/components/Divider/Divider.js +32 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/DocumentViewport/DocumentViewport.d.ts +8 -0
- package/dist/components/DocumentViewport/DocumentViewport.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +8 -2
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/Field/Field.d.ts +6 -0
- package/dist/components/Field/Field.js +31 -33
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/FileDrop/FileDrop.d.ts +8 -0
- package/dist/components/FileDrop/FileDrop.js +14 -14
- package/dist/components/FileDrop/FileDrop.js.map +1 -1
- package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +4 -0
- package/dist/components/FloatingToolbar/FloatingToolbar.js +11 -10
- package/dist/components/FloatingToolbar/FloatingToolbar.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +57 -10
- package/dist/components/Grid/Grid.js +71 -28
- 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 +59 -0
- package/dist/components/Heading/Heading.js +33 -0
- package/dist/components/Heading/Heading.js.map +1 -0
- package/dist/components/Heading/index.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +17 -1
- package/dist/components/IconButton/IconButton.js +14 -10
- 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.d.ts +62 -0
- package/dist/components/Image/Image.js +75 -0
- package/dist/components/Image/Image.js.map +1 -0
- package/dist/components/Image/index.d.ts +1 -0
- package/dist/components/Inline/Inline.d.ts +8 -4
- package/dist/components/Inline/Inline.js +12 -16
- package/dist/components/Inline/Inline.js.map +1 -1
- package/dist/components/Kbd/Kbd.d.ts +2 -0
- package/dist/components/Kbd/Kbd.js.map +1 -1
- package/dist/components/KeyValueEditor/KeyValueEditor.d.ts +7 -0
- package/dist/components/KeyValueEditor/KeyValueEditor.js +43 -42
- package/dist/components/KeyValueEditor/KeyValueEditor.js.map +1 -1
- package/dist/components/Link/Link.d.ts +16 -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/LoadingDots/LoadingDots.d.ts +2 -0
- package/dist/components/LoadingDots/LoadingDots.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +13 -1
- package/dist/components/Menu/Menu.js +37 -35
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Notice/Notice.d.ts +5 -0
- package/dist/components/Notice/Notice.js +12 -11
- package/dist/components/Notice/Notice.js.map +1 -1
- package/dist/components/NumberField/NumberField.d.ts +17 -0
- package/dist/components/NumberField/NumberField.js +8 -8
- package/dist/components/NumberField/NumberField.js.map +1 -1
- package/dist/components/OptionList/OptionList.d.ts +69 -0
- package/dist/components/OptionList/OptionList.js +75 -0
- package/dist/components/OptionList/OptionList.js.map +1 -0
- package/dist/components/OptionList/index.d.ts +1 -0
- package/dist/components/PageHeader/PageHeader.d.ts +67 -0
- package/dist/components/PageHeader/PageHeader.js +63 -0
- package/dist/components/PageHeader/PageHeader.js.map +1 -0
- package/dist/components/PageHeader/index.d.ts +1 -0
- package/dist/components/Pagination/Pagination.d.ts +77 -0
- package/dist/components/Pagination/Pagination.js +121 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/PanZoomCanvas/PanZoomCanvas.d.ts +4 -0
- package/dist/components/PanZoomCanvas/PanZoomCanvas.js.map +1 -1
- package/dist/components/Popover/Popover.d.ts +10 -0
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/ProgressOverlay/ProgressOverlay.d.ts +3 -0
- package/dist/components/ProgressOverlay/ProgressOverlay.js.map +1 -1
- package/dist/components/Prose/Prose.d.ts +1 -0
- package/dist/components/Prose/Prose.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.d.ts +13 -0
- package/dist/components/RadioGroup/RadioGroup.js +32 -24
- package/dist/components/RadioGroup/RadioGroup.js.map +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 +9 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +12 -12
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/Select/Select.d.ts +18 -1
- package/dist/components/Select/Select.js +107 -125
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/SelectionFrame/SelectionFrame.d.ts +6 -0
- package/dist/components/SelectionFrame/SelectionFrame.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 +37 -1
- package/dist/components/SideNav/SideNav.js +103 -74
- package/dist/components/SideNav/SideNav.js.map +1 -1
- package/dist/components/SideNav/index.d.ts +1 -1
- package/dist/components/SignaturePad/SignaturePad.d.ts +3 -0
- package/dist/components/SignaturePad/SignaturePad.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/Skeleton/Skeleton.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- 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.d.ts +11 -0
- package/dist/components/Slider/Slider.js +6 -6
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/SortableList/SortableList.d.ts +6 -0
- package/dist/components/SortableList/SortableList.js +13 -13
- package/dist/components/SortableList/SortableList.js.map +1 -1
- package/dist/components/SplitPane/SplitPane.d.ts +5 -0
- package/dist/components/SplitPane/SplitPane.js +4 -4
- package/dist/components/SplitPane/SplitPane.js.map +1 -1
- package/dist/components/Stack/Stack.d.ts +19 -6
- package/dist/components/Stack/Stack.js +26 -13
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/index.d.ts +1 -0
- package/dist/components/Stack/space.d.ts +47 -0
- package/dist/components/Stack/space.js +23 -0
- package/dist/components/Stack/space.js.map +1 -0
- 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/Steps/Steps.d.ts +14 -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 +12 -0
- package/dist/components/Table/Table.js +11 -12
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +18 -1
- package/dist/components/Tabs/Tabs.js +74 -73
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/TagInput/TagInput.d.ts +18 -0
- package/dist/components/TagInput/TagInput.js +79 -100
- package/dist/components/TagInput/TagInput.js.map +1 -1
- package/dist/components/Text/Text.d.ts +72 -0
- package/dist/components/Text/Text.js +30 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Text/index.d.ts +1 -0
- package/dist/components/TextArea/TextArea.d.ts +10 -0
- package/dist/components/TextArea/TextArea.js +4 -4
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +17 -0
- package/dist/components/TextField/TextField.js +28 -27
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ThemeToggle/ThemeToggle.d.ts +11 -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 +62 -8
- package/dist/components/TimeField/TimeField.js +308 -72
- package/dist/components/TimeField/TimeField.js.map +1 -1
- package/dist/components/Toast/Toast.d.ts +25 -1
- package/dist/components/Toast/Toast.js +137 -126
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Toast/index.d.ts +1 -1
- package/dist/components/Toolbar/Toolbar.d.ts +3 -0
- package/dist/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +7 -1
- package/dist/components/Tooltip/Tooltip.js +19 -19
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tree/Tree.d.ts +8 -0
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/VirtualList/VirtualList.d.ts +8 -0
- package/dist/components/VirtualList/VirtualList.js +4 -4
- package/dist/components/VirtualList/VirtualList.js.map +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 +4 -0
- package/dist/components/ZoomControls/ZoomControls.js.map +1 -1
- package/dist/foundations/ChoiceBase/ChoiceBase.d.ts +1 -0
- package/dist/foundations/ChoiceBase/ChoiceBase.js +8 -8
- package/dist/foundations/ChoiceBase/ChoiceBase.js.map +1 -1
- package/dist/foundations/HiddenValue/HiddenValue.d.ts +3 -0
- package/dist/foundations/HiddenValue/HiddenValue.js +5 -5
- package/dist/foundations/HiddenValue/HiddenValue.js.map +1 -1
- package/dist/foundations/Icon/Icon.d.ts +9 -1
- package/dist/foundations/Icon/Icon.js +15 -14
- package/dist/foundations/Icon/Icon.js.map +1 -1
- package/dist/foundations/image-outcome.d.ts +20 -0
- package/dist/foundations/image-outcome.js +43 -0
- package/dist/foundations/image-outcome.js.map +1 -0
- package/dist/foundations/option-icon.d.ts +26 -0
- package/dist/foundations/option-icon.js +16 -0
- package/dist/foundations/option-icon.js.map +1 -0
- 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 +246 -0
- package/dist/foundations/qr.js.map +1 -0
- 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/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-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/crescent.d.ts +2 -0
- package/dist/icons/crescent.js +14 -0
- package/dist/icons/crescent.js.map +1 -0
- package/dist/icons/index.d.ts +11 -0
- package/dist/icons/index.js +502 -480
- 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 +259 -0
- package/dist/icons/keywords.js +1816 -0
- package/dist/icons/keywords.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/mosque.d.ts +2 -0
- package/dist/icons/mosque.js +14 -0
- package/dist/icons/mosque.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/types.d.ts +1 -1
- package/dist/icons/types.js +2 -1
- package/dist/icons/types.js.map +1 -1
- package/dist/index.d.ts +35 -10
- package/dist/index.js +280 -220
- package/dist/styles/announcer.css +1 -1
- package/dist/styles/app-shell.css +1 -1
- package/dist/styles/aspect-ratio.css +1 -0
- package/dist/styles/avatar.css +1 -0
- package/dist/styles/base.css +1 -1
- package/dist/styles/breadcrumbs.css +1 -0
- package/dist/styles/button.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/checklist.css +1 -0
- package/dist/styles/choice-base.css +1 -0
- package/dist/styles/choice.css +1 -1
- package/dist/styles/color-field.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/container.css +1 -0
- package/dist/styles/copy-button.css +1 -1
- 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/divider.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 +1 -1
- package/dist/styles/generated-css.js.map +1 -1
- package/dist/styles/grid.css +1 -1
- package/dist/styles/heading.css +1 -0
- package/dist/styles/icon-tile.css +1 -0
- package/dist/styles/icon.css +1 -1
- package/dist/styles/image.css +1 -0
- 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.css +1 -0
- package/dist/styles/manifest.json +715 -0
- package/dist/styles/menu.css +1 -1
- 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/page-header.css +1 -0
- package/dist/styles/pagination.css +1 -0
- package/dist/styles/qr-code.css +1 -0
- package/dist/styles/radio-group.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/sortable-list.css +1 -1
- package/dist/styles/stack.css +1 -1
- package/dist/styles/stat.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-field.css +1 -1
- package/dist/styles/text.css +1 -0
- package/dist/styles/time-field.css +1 -1
- package/dist/styles/toast.css +1 -1
- package/dist/styles/visually-hidden.css +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme/CynosureTheme.d.ts +4 -0
- package/dist/theme/CynosureTheme.js.map +1 -1
- package/dist/tokens/create-theme.js +137 -108
- package/dist/tokens/create-theme.js.map +1 -1
- package/dist/tokens/to-css.js +12 -12
- package/dist/tokens/to-css.js.map +1 -1
- package/package.json +8 -3
- package/dist/components/Checkbox/ChoiceRow.d.ts +0 -23
- package/dist/components/Checkbox/ChoiceRow.js +0 -57
- package/dist/components/Checkbox/ChoiceRow.js.map +0 -1
- package/dist/styles/hidden-value.css +0 -1
- package/dist/styles/iconbutton.css +0 -1
- package/dist/styles/search-field.css +0 -1
|
@@ -1,42 +1,56 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var s = /^(\d{4})-(\d{2})-(\d{2})$/,
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
6
|
-
const [t,
|
|
7
|
-
Number(
|
|
8
|
-
Number(
|
|
9
|
-
Number(
|
|
10
|
-
], o = new Date(t,
|
|
11
|
-
return o.setFullYear(t), o.getMonth() ===
|
|
2
|
+
var s = /^(\d{4})-(\d{2})-(\d{2})$/, c = (e, n = 2) => String(e).padStart(n, "0"), l = (e) => `${c(e.getFullYear(), 4)}-${c(e.getMonth() + 1)}-${c(e.getDate())}`;
|
|
3
|
+
function u(e) {
|
|
4
|
+
const n = s.exec(e.trim());
|
|
5
|
+
if (!n) return null;
|
|
6
|
+
const [t, a, r] = [
|
|
7
|
+
Number(n[1]),
|
|
8
|
+
Number(n[2]),
|
|
9
|
+
Number(n[3])
|
|
10
|
+
], o = new Date(t, a - 1, r);
|
|
11
|
+
return o.setFullYear(t), o.getMonth() === a - 1 && o.getDate() === r ? o : null;
|
|
12
12
|
}
|
|
13
|
-
var
|
|
14
|
-
const t =
|
|
15
|
-
return t.setDate(t.getDate() +
|
|
13
|
+
var g = (e) => u(e) !== null, D = (e, n) => {
|
|
14
|
+
const t = u(e);
|
|
15
|
+
return t.setDate(t.getDate() + n), l(t);
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
const t =
|
|
19
|
-
t.setDate(1), t.setMonth(t.getMonth() +
|
|
17
|
+
function f(e, n) {
|
|
18
|
+
const t = u(e), a = t.getDate();
|
|
19
|
+
t.setDate(1), t.setMonth(t.getMonth() + n);
|
|
20
20
|
const r = new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate();
|
|
21
|
-
return t.setDate(Math.min(
|
|
21
|
+
return t.setDate(Math.min(a, r)), l(t);
|
|
22
22
|
}
|
|
23
|
-
var
|
|
24
|
-
function
|
|
23
|
+
var i = (e, n, t) => n && e < n ? n : t && e > t ? t : e;
|
|
24
|
+
function d(e) {
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
26
|
+
const n = new Intl.Locale(e ?? navigator.language), t = n.getWeekInfo?.() ?? n.weekInfo;
|
|
27
27
|
if (t) return t.firstDay % 7;
|
|
28
28
|
} catch {
|
|
29
29
|
}
|
|
30
30
|
return 1;
|
|
31
31
|
}
|
|
32
|
+
function h(e, n) {
|
|
33
|
+
const t = u(`${n}-01`), a = new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate();
|
|
34
|
+
return `${n}-${c(Math.min(Number(e.slice(8)), a))}`;
|
|
35
|
+
}
|
|
36
|
+
function w(e) {
|
|
37
|
+
try {
|
|
38
|
+
const n = new Intl.Locale(e ?? navigator.language), t = (n.getWeekInfo?.() ?? n.weekInfo)?.weekend;
|
|
39
|
+
if (t) return t.map((a) => a % 7);
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
return [6, 0];
|
|
43
|
+
}
|
|
32
44
|
export {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
D as addDays,
|
|
46
|
+
f as addMonths,
|
|
47
|
+
i as clampDate,
|
|
48
|
+
d as firstDayOfWeek,
|
|
49
|
+
u as fromISODate,
|
|
50
|
+
h as inMonth,
|
|
51
|
+
g as isISODate,
|
|
52
|
+
l as toISODate,
|
|
53
|
+
w as weekendDays
|
|
40
54
|
};
|
|
41
55
|
|
|
42
56
|
//# sourceMappingURL=dates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dates.js","names":["ISO","pad","n","width","toISODate","date","fromISODate","iso","m","y","mo","d","isISODate","addDays","days","addMonths","months","day","last","clampDate","min","max","firstDayOfWeek","locale","loc","info"],"sources":["../../../src/components/Calendar/dates.ts"],"sourcesContent":["/**\n * Plain calendar dates as ISO strings (`2026-11-10`): no time and no time zone, so a date picked in Dublin is the same\n * date in Lahore. Strings compare in date order, and they are what forms and APIs already exchange.\n */\n\nconst ISO = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst pad = (n: number, width = 2) => String(n).padStart(width, \"0\");\n\n/** `2026-11-10` from a Date's local year, month and day. */\nexport const toISODate = (date: Date) =>\n `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n\n/** A Date at local midnight, or null when `iso` is not a real date (2026-02-30 is not). */\nexport function fromISODate(iso: string): Date | null {\n const m = ISO.exec(iso.trim());\n if (!m) return null;\n const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];\n const date = new Date(y, mo - 1, d);\n date.setFullYear(y); // years below 100 would otherwise be read as 19xx\n return date.getMonth() === mo - 1 && date.getDate() === d ? date : null;\n}\n\n/** Whether `iso` is a real date, written `YYYY-MM-DD`. */\nexport const isISODate = (iso: string) => fromISODate(iso) !== null;\n\nexport const addDays = (iso: string, days: number) => {\n const date = fromISODate(iso) as Date;\n date.setDate(date.getDate() + days);\n return toISODate(date);\n};\n\n/** Months later (or earlier), keeping the day where it exists: 31 January plus a month is 28 or 29 February. */\nexport function addMonths(iso: string, months: number) {\n const date = fromISODate(iso) as Date;\n const day = date.getDate();\n date.setDate(1);\n date.setMonth(date.getMonth() + months);\n const last = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();\n date.setDate(Math.min(day, last));\n return toISODate(date);\n}\n\n/** `iso` kept within `min` and `max` (either may be absent). */\nexport const clampDate = (iso: string, min?: string, max?: string) =>\n min && iso < min ? min : max && iso > max ? max : iso;\n\n/** The weekday a week starts on in `locale` (0 Sunday to 6 Saturday), where the browser knows it; else Monday. */\nexport function firstDayOfWeek(locale?: string): number {\n try {\n // `getWeekInfo()` is the standard; `weekInfo` is the older accessor some engines still have.\n const loc = new Intl.Locale(locale ?? navigator.language) as Intl.Locale & {\n getWeekInfo?: () => { firstDay: number };\n weekInfo?: { firstDay: number };\n };\n const info = loc.getWeekInfo?.() ?? loc.weekInfo;\n if (info) return info.firstDay % 7;\n } catch {\n // An unknown locale falls through to Monday.\n }\n return 1;\n}\n"],"mappings":";AAKA,IAAMA,IAAM,6BACNC,IAAA,CAAOC,GAAWC,IAAQ,MAAM,OAAOD,CAAC,EAAE,SAASC,GAAO,GAAG,GAGtDC,IAAA,CAAaC,MACxB,GAAGJ,EAAII,EAAK,YAAY,GAAG,CAAC,CAAA,IAAKJ,EAAII,EAAK,SAAS,IAAI,CAAC,CAAA,IAAKJ,EAAII,EAAK,QAAQ,CAAC,CAAA;AAGjF,SAAgBC,EAAYC,GAA0B;AACpD,QAAMC,IAAIR,EAAI,KAAKO,EAAI,KAAK,CAAC;AAC7B,MAAI,CAACC,EAAG,QAAO;AACf,QAAM,CAACC,GAAGC,GAAIC,CAAA,IAAK;AAAA,IAAC,OAAOH,EAAE,CAAA,CAAE;AAAA,IAAG,OAAOA,EAAE,CAAA,CAAE;AAAA,IAAG,OAAOA,EAAE,CAAA,CAAE;AAAA,EAAC,GACtDH,IAAO,IAAI,KAAKI,GAAGC,IAAK,GAAGC,CAAC;AAClC,SAAAN,EAAK,YAAYI,CAAC,GACXJ,EAAK,SAAS,MAAMK,IAAK,KAAKL,EAAK,QAAQ,MAAMM,IAAIN,IAAO;AACrE;AAGA,IAAaO,IAAA,CAAaL,MAAgBD,EAAYC,CAAG,MAAM,MAElDM,IAAA,CAAWN,GAAaO,MAAiB;AACpD,QAAMT,IAAOC,EAAYC,CAAG;AAC5B,SAAAF,EAAK,QAAQA,EAAK,QAAQ,IAAIS,CAAI,GAC3BV,EAAUC,CAAI;AACvB;AAGA,SAAgBU,EAAUR,GAAaS,GAAgB;AACrD,QAAMX,IAAOC,EAAYC,CAAG,GACtBU,IAAMZ,EAAK,QAAQ;AACzB,EAAAA,EAAK,QAAQ,CAAC,GACdA,EAAK,SAASA,EAAK,SAAS,IAAIW,CAAM;AACtC,QAAME,IAAO,IAAI,KAAKb,EAAK,YAAY,GAAGA,EAAK,SAAS,IAAI,GAAG,CAAC,EAAE,QAAQ;AAC1E,SAAAA,EAAK,QAAQ,KAAK,IAAIY,GAAKC,CAAI,CAAC,GACzBd,EAAUC,CAAI;AACvB;AAGA,IAAac,IAAA,CAAaZ,GAAaa,GAAcC,MACnDD,KAAOb,IAAMa,IAAMA,IAAMC,KAAOd,IAAMc,IAAMA,IAAMd;AAGpD,SAAgBe,EAAeC,GAAyB;AACtD,MAAI;AAEF,UAAMC,IAAM,IAAI,KAAK,OAAOD,KAAU,UAAU,QAAQ,GAIlDE,IAAOD,EAAI,cAAc,KAAKA,EAAI;AACxC,QAAIC,EAAM,QAAOA,EAAK,WAAW;AAAA,EACnC,QAAQ;AAAA,EAER;AACA,SAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"dates.js","names":["ISO","pad","n","width","toISODate","date","fromISODate","iso","m","y","mo","d","isISODate","addDays","days","addMonths","months","day","last","clampDate","min","max","firstDayOfWeek","locale","loc","info","inMonth","month","first","weekendDays","weekend"],"sources":["../../../src/components/Calendar/dates.ts"],"sourcesContent":["/**\n * Plain calendar dates as ISO strings (`2026-11-10`): no time and no time zone, so a date picked in Dublin is the same\n * date in Lahore. Strings compare in date order, and they are what forms and APIs already exchange.\n */\n\nconst ISO = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst pad = (n: number, width = 2) => String(n).padStart(width, \"0\");\n\n/** `2026-11-10` from a Date's local year, month and day. */\nexport const toISODate = (date: Date) =>\n `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n\n/** A Date at local midnight, or null when `iso` is not a real date (2026-02-30 is not). */\nexport function fromISODate(iso: string): Date | null {\n const m = ISO.exec(iso.trim());\n if (!m) return null;\n const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];\n const date = new Date(y, mo - 1, d);\n date.setFullYear(y); // years below 100 would otherwise be read as 19xx\n return date.getMonth() === mo - 1 && date.getDate() === d ? date : null;\n}\n\n/** Whether `iso` is a real date, written `YYYY-MM-DD`. */\nexport const isISODate = (iso: string) => fromISODate(iso) !== null;\n\nexport const addDays = (iso: string, days: number) => {\n const date = fromISODate(iso) as Date;\n date.setDate(date.getDate() + days);\n return toISODate(date);\n};\n\n/** Months later (or earlier), keeping the day where it exists: 31 January plus a month is 28 or 29 February. */\nexport function addMonths(iso: string, months: number) {\n const date = fromISODate(iso) as Date;\n const day = date.getDate();\n date.setDate(1);\n date.setMonth(date.getMonth() + months);\n const last = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();\n date.setDate(Math.min(day, last));\n return toISODate(date);\n}\n\n/** `iso` kept within `min` and `max` (either may be absent). */\nexport const clampDate = (iso: string, min?: string, max?: string) =>\n min && iso < min ? min : max && iso > max ? max : iso;\n\n/** The weekday a week starts on in `locale` (0 Sunday to 6 Saturday), where the browser knows it; else Monday. */\nexport function firstDayOfWeek(locale?: string): number {\n try {\n // `getWeekInfo()` is the standard; `weekInfo` is the older accessor some engines still have.\n const loc = new Intl.Locale(locale ?? navigator.language) as Intl.Locale & {\n getWeekInfo?: () => { firstDay: number };\n weekInfo?: { firstDay: number };\n };\n const info = loc.getWeekInfo?.() ?? loc.weekInfo;\n if (info) return info.firstDay % 7;\n } catch {\n // An unknown locale falls through to Monday.\n }\n return 1;\n}\n\n/** The day of `iso` in `month` (`YYYY-MM`), or that month's last day when it is shorter. */\nexport function inMonth(iso: string, month: string) {\n const first = fromISODate(`${month}-01`) as Date;\n const last = new Date(first.getFullYear(), first.getMonth() + 1, 0).getDate();\n return `${month}-${pad(Math.min(Number(iso.slice(8)), last))}`;\n}\n\n/** The weekend's weekdays in `locale` (0 Sunday to 6 Saturday), where the browser knows them; else Saturday and Sunday. */\nexport function weekendDays(locale?: string): number[] {\n try {\n const loc = new Intl.Locale(locale ?? navigator.language) as Intl.Locale & {\n getWeekInfo?: () => { weekend?: number[] };\n weekInfo?: { weekend?: number[] };\n };\n const weekend = (loc.getWeekInfo?.() ?? loc.weekInfo)?.weekend;\n if (weekend) return weekend.map((day) => day % 7);\n } catch {\n // An unknown locale falls through to Saturday and Sunday.\n }\n return [6, 0];\n}\n"],"mappings":";AAKA,IAAMA,IAAM,6BACNC,IAAA,CAAOC,GAAWC,IAAQ,MAAM,OAAOD,CAAC,EAAE,SAASC,GAAO,GAAG,GAGtDC,IAAA,CAAaC,MACxB,GAAGJ,EAAII,EAAK,YAAY,GAAG,CAAC,CAAA,IAAKJ,EAAII,EAAK,SAAS,IAAI,CAAC,CAAA,IAAKJ,EAAII,EAAK,QAAQ,CAAC,CAAA;AAGjF,SAAgBC,EAAYC,GAA0B;AACpD,QAAMC,IAAIR,EAAI,KAAKO,EAAI,KAAK,CAAC;AAC7B,MAAI,CAACC,EAAG,QAAO;AACf,QAAM,CAACC,GAAGC,GAAIC,CAAA,IAAK;AAAA,IAAC,OAAOH,EAAE,CAAA,CAAE;AAAA,IAAG,OAAOA,EAAE,CAAA,CAAE;AAAA,IAAG,OAAOA,EAAE,CAAA,CAAE;AAAA,EAAC,GACtDH,IAAO,IAAI,KAAKI,GAAGC,IAAK,GAAGC,CAAC;AAClC,SAAAN,EAAK,YAAYI,CAAC,GACXJ,EAAK,SAAS,MAAMK,IAAK,KAAKL,EAAK,QAAQ,MAAMM,IAAIN,IAAO;AACrE;AAGA,IAAaO,IAAA,CAAaL,MAAgBD,EAAYC,CAAG,MAAM,MAElDM,IAAA,CAAWN,GAAaO,MAAiB;AACpD,QAAMT,IAAOC,EAAYC,CAAG;AAC5B,SAAAF,EAAK,QAAQA,EAAK,QAAQ,IAAIS,CAAI,GAC3BV,EAAUC,CAAI;AACvB;AAGA,SAAgBU,EAAUR,GAAaS,GAAgB;AACrD,QAAMX,IAAOC,EAAYC,CAAG,GACtBU,IAAMZ,EAAK,QAAQ;AACzB,EAAAA,EAAK,QAAQ,CAAC,GACdA,EAAK,SAASA,EAAK,SAAS,IAAIW,CAAM;AACtC,QAAME,IAAO,IAAI,KAAKb,EAAK,YAAY,GAAGA,EAAK,SAAS,IAAI,GAAG,CAAC,EAAE,QAAQ;AAC1E,SAAAA,EAAK,QAAQ,KAAK,IAAIY,GAAKC,CAAI,CAAC,GACzBd,EAAUC,CAAI;AACvB;AAGA,IAAac,IAAA,CAAaZ,GAAaa,GAAcC,MACnDD,KAAOb,IAAMa,IAAMA,IAAMC,KAAOd,IAAMc,IAAMA,IAAMd;AAGpD,SAAgBe,EAAeC,GAAyB;AACtD,MAAI;AAEF,UAAMC,IAAM,IAAI,KAAK,OAAOD,KAAU,UAAU,QAAQ,GAIlDE,IAAOD,EAAI,cAAc,KAAKA,EAAI;AACxC,QAAIC,EAAM,QAAOA,EAAK,WAAW;AAAA,EACnC,QAAQ;AAAA,EAER;AACA,SAAO;AACT;AAGA,SAAgBC,EAAQnB,GAAaoB,GAAe;AAClD,QAAMC,IAAQtB,EAAY,GAAGqB,CAAA,KAAU,GACjCT,IAAO,IAAI,KAAKU,EAAM,YAAY,GAAGA,EAAM,SAAS,IAAI,GAAG,CAAC,EAAE,QAAQ;AAC5E,SAAO,GAAGD,CAAA,IAAS1B,EAAI,KAAK,IAAI,OAAOM,EAAI,MAAM,CAAC,CAAC,GAAGW,CAAI,CAAC,CAAA;AAC7D;AAGA,SAAgBW,EAAYN,GAA2B;AACrD,MAAI;AACF,UAAMC,IAAM,IAAI,KAAK,OAAOD,KAAU,UAAU,QAAQ,GAIlDO,KAAWN,EAAI,cAAc,KAAKA,EAAI,WAAW;AACvD,QAAIM,EAAS,QAAOA,EAAQ,IAAA,CAAKb,MAAQA,IAAM,CAAC;AAAA,EAClD,QAAQ;AAAA,EAER;AACA,SAAO,CAAC,GAAG,CAAC;AACd"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Calendar, type CalendarDayState, type CalendarLabels, type CalendarProps, type CalendarTokens, } from "./Calendar.js";
|
|
1
|
+
export { Calendar, type CalendarDayMark, type CalendarDayState, type CalendarLabels, type CalendarProps, type CalendarTokens, } from "./Calendar.js";
|
|
2
2
|
export { addDays, addMonths, fromISODate, isISODate, toISODate } from "./dates.js";
|
|
@@ -1,28 +1,62 @@
|
|
|
1
|
-
import { type CSSProperties, type MouseEventHandler, type ReactNode } from "react";
|
|
1
|
+
import { type AriaAttributes, type CSSProperties, type MouseEventHandler, type ReactNode } from "react";
|
|
2
2
|
import type { Tone } from "../../tokens/schema.js";
|
|
3
|
+
export interface CardTokens {
|
|
4
|
+
/** Border colour of the current card of a set (`aria-current`). Default: the accent. */
|
|
5
|
+
currentBorder: string;
|
|
6
|
+
bg: string;
|
|
7
|
+
border: string;
|
|
8
|
+
radius: string;
|
|
9
|
+
shadow: string;
|
|
10
|
+
softMix: string;
|
|
11
|
+
edgeWidth: string;
|
|
12
|
+
}
|
|
13
|
+
declare module "../../tokens/schema.js" {
|
|
14
|
+
interface ComponentTokens {
|
|
15
|
+
card: CardTokens;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
3
18
|
export interface CardProps {
|
|
4
19
|
/** `surface` raised panel, `outline` border only, `soft` tone-tinted fill. */
|
|
5
20
|
variant?: "surface" | "outline" | "soft";
|
|
21
|
+
/** Space between the card's edge and its content. Default "md". */
|
|
6
22
|
padding?: "none" | "sm" | "md" | "lg";
|
|
23
|
+
/** Semantic colour. Default "neutral". */
|
|
7
24
|
tone?: Tone;
|
|
25
|
+
/**
|
|
26
|
+
* A coloured edge on the card's inline-start side (left in left-to-right text), e.g. a task's category. A tone name
|
|
27
|
+
* uses that tone's colour; any other string is a CSS colour. Colour alone carries no meaning for many people: say
|
|
28
|
+
* the same thing in the card's text or a Badge. Default: no edge.
|
|
29
|
+
*/
|
|
30
|
+
edge?: Tone | (string & {});
|
|
8
31
|
/** Element for a static card. Ignored when `href` or `onClick` makes the whole card interactive. */
|
|
9
32
|
as?: "div" | "section" | "article" | "li" | "aside";
|
|
10
33
|
/** Makes the whole card a link (rendered through LinkBase, so unsafe schemes are not linked). */
|
|
11
34
|
href?: string;
|
|
35
|
+
/** With `href`: where it opens, e.g. `_blank`. */
|
|
12
36
|
target?: string;
|
|
13
37
|
/** Makes the whole card a button. */
|
|
14
38
|
onClick?: MouseEventHandler<HTMLElement>;
|
|
39
|
+
/** With `onClick` (and no `href`): the card cannot be pressed. */
|
|
15
40
|
disabled?: boolean;
|
|
16
41
|
/**
|
|
17
42
|
* Buttons that sit on the card but act on their own (a game card's 2-player mode, a file card's menu). They are placed
|
|
18
43
|
* over the card's top end, outside its one link or button, so nothing interactive is nested.
|
|
19
44
|
*/
|
|
20
45
|
actions?: ReactNode;
|
|
46
|
+
/** Added to the card element, for layout. */
|
|
21
47
|
className?: string;
|
|
22
48
|
/** Layout only. */
|
|
23
49
|
style?: CSSProperties;
|
|
50
|
+
/** The card's content. Keep it non-interactive when the card is a link or a button. */
|
|
24
51
|
children?: ReactNode;
|
|
52
|
+
/** Accessible name of the card, set on the card element. */
|
|
25
53
|
"aria-label"?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Marks a link or button card as the current one of a set: `"page"` for the page being shown (a card grid of
|
|
56
|
+
* sections), or `"step"`, `"location"`, `true`. Read by screen readers, and the card's border takes the accent.
|
|
57
|
+
*/
|
|
58
|
+
"aria-current"?: AriaAttributes["aria-current"];
|
|
59
|
+
/** Set on the card element, to find it in tests. */
|
|
26
60
|
"data-testid"?: string;
|
|
27
61
|
}
|
|
28
62
|
/** Content container. With `href` or `onClick` the whole card is one link or button (no nested controls). */
|
|
@@ -1,57 +1,69 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ButtonBase as
|
|
3
|
-
import { LinkBase as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { jsx as
|
|
6
|
-
var
|
|
2
|
+
import { ButtonBase as w } from "../../foundations/ButtonBase/ButtonBase.js";
|
|
3
|
+
import { LinkBase as R } from "../../foundations/LinkBase/LinkBase.js";
|
|
4
|
+
import { forwardRef as b } from "react";
|
|
5
|
+
import { jsx as t, jsxs as v } from "react/jsx-runtime";
|
|
6
|
+
var E = [
|
|
7
|
+
"accent",
|
|
8
|
+
"neutral",
|
|
9
|
+
"danger",
|
|
10
|
+
"success",
|
|
11
|
+
"warning",
|
|
12
|
+
"info"
|
|
13
|
+
], u = b(function(a, c) {
|
|
7
14
|
if (a.actions !== void 0 && (a.href !== void 0 || a.onClick)) {
|
|
8
|
-
const { actions:
|
|
9
|
-
return /* @__PURE__ */
|
|
15
|
+
const { actions: x, style: B, ...j } = a;
|
|
16
|
+
return /* @__PURE__ */ v("div", {
|
|
10
17
|
className: "cy-card-frame cy-reset",
|
|
11
|
-
style:
|
|
12
|
-
children: [/* @__PURE__ */
|
|
13
|
-
ref:
|
|
14
|
-
...
|
|
15
|
-
}), /* @__PURE__ */
|
|
18
|
+
style: B,
|
|
19
|
+
children: [/* @__PURE__ */ t(u, {
|
|
20
|
+
ref: c,
|
|
21
|
+
...j
|
|
22
|
+
}), /* @__PURE__ */ t("div", {
|
|
16
23
|
className: "cy-card-actions cy-reset",
|
|
17
|
-
children:
|
|
24
|
+
children: x
|
|
18
25
|
})]
|
|
19
26
|
});
|
|
20
27
|
}
|
|
21
|
-
const { variant:
|
|
22
|
-
...
|
|
23
|
-
className:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
const { variant: f = "surface", padding: y = "md", tone: g = "neutral", as: h = "div", href: n, target: N, onClick: r, disabled: C, actions: s, edge: e, className: o, style: l, children: d, ...k } = a, m = !!e && !E.includes(e), i = {
|
|
29
|
+
...k,
|
|
30
|
+
className: o ? `cy-card ${o}` : "cy-card",
|
|
31
|
+
style: m ? {
|
|
32
|
+
"--_edge": e,
|
|
33
|
+
...l
|
|
34
|
+
} : l,
|
|
35
|
+
"data-edge": e ? m ? "custom" : e : void 0,
|
|
36
|
+
"data-variant": f,
|
|
37
|
+
"data-padding": y,
|
|
38
|
+
"data-tone": g
|
|
27
39
|
};
|
|
28
|
-
return
|
|
29
|
-
ref:
|
|
40
|
+
return n !== void 0 ? /* @__PURE__ */ t(R, {
|
|
41
|
+
ref: c,
|
|
30
42
|
...i,
|
|
31
|
-
href:
|
|
32
|
-
target:
|
|
43
|
+
href: n,
|
|
44
|
+
target: N,
|
|
33
45
|
"data-interactive": "",
|
|
34
|
-
onClick:
|
|
35
|
-
children:
|
|
36
|
-
}) :
|
|
37
|
-
ref:
|
|
46
|
+
onClick: r,
|
|
47
|
+
children: d
|
|
48
|
+
}) : r ? /* @__PURE__ */ t(w, {
|
|
49
|
+
ref: c,
|
|
38
50
|
...i,
|
|
39
|
-
onClick:
|
|
40
|
-
disabled:
|
|
51
|
+
onClick: r,
|
|
52
|
+
disabled: C,
|
|
41
53
|
"data-interactive": "",
|
|
42
|
-
children:
|
|
43
|
-
}) : /* @__PURE__ */
|
|
44
|
-
ref:
|
|
54
|
+
children: d
|
|
55
|
+
}) : /* @__PURE__ */ v(h, {
|
|
56
|
+
ref: c,
|
|
45
57
|
...i,
|
|
46
|
-
children: [
|
|
58
|
+
children: [d, s !== void 0 && /* @__PURE__ */ t("div", {
|
|
47
59
|
className: "cy-card-actions cy-reset",
|
|
48
|
-
children:
|
|
60
|
+
children: s
|
|
49
61
|
})]
|
|
50
62
|
});
|
|
51
63
|
});
|
|
52
|
-
|
|
64
|
+
u.displayName = "Card";
|
|
53
65
|
export {
|
|
54
|
-
|
|
66
|
+
u as Card
|
|
55
67
|
};
|
|
56
68
|
|
|
57
69
|
//# sourceMappingURL=Card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","names":["Tag","ButtonBase","LinkBase","forwardRef","jsx","jsxs","Card","props","ref","actions","style","card","variant","padding","tone","as","href","target","onClick","disabled","className","children","rest","common"],"sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type ElementType,\n forwardRef,\n type MouseEventHandler,\n type ReactNode,\n} from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport type { Tone } from \"../../tokens/schema.js\";\n\nexport interface CardProps {\n /** `surface` raised panel, `outline` border only, `soft` tone-tinted fill. */\n variant?: \"surface\" | \"outline\" | \"soft\";\n padding?: \"none\" | \"sm\" | \"md\" | \"lg\";\n tone?: Tone;\n /** Element for a static card. Ignored when `href` or `onClick` makes the whole card interactive. */\n as?: \"div\" | \"section\" | \"article\" | \"li\" | \"aside\";\n /** Makes the whole card a link (rendered through LinkBase, so unsafe schemes are not linked). */\n href?: string;\n target?: string;\n /** Makes the whole card a button. */\n onClick?: MouseEventHandler<HTMLElement>;\n disabled?: boolean;\n /**\n * Buttons that sit on the card but act on their own (a game card's 2-player mode, a file card's menu). They are placed\n * over the card's top end, outside its one link or button, so nothing interactive is nested.\n */\n actions?: ReactNode;\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n children?: ReactNode;\n \"aria-label\"?: string;\n \"data-testid\"?: string;\n}\n\n/** Content container. With `href` or `onClick` the whole card is one link or button (no nested controls). */\nexport const Card = forwardRef<HTMLElement, CardProps>(function CardRender(props, ref) {\n // With actions, the card itself stays one target and the actions are its siblings in a shared frame. Layout\n // (`style`) goes on the frame; the card fills it.\n if (props.actions !== undefined && (props.href !== undefined || props.onClick)) {\n const { actions, style, ...card } = props;\n return (\n <div className=\"cy-card-frame cy-reset\" style={style}>\n <Card ref={ref} {...card} />\n <div className=\"cy-card-actions cy-reset\">{actions}</div>\n </div>\n );\n }\n const {\n variant = \"surface\",\n padding = \"md\",\n tone = \"neutral\",\n as = \"div\",\n href,\n target,\n onClick,\n disabled,\n actions,\n className,\n children,\n ...rest\n } = props;\n const common = {\n ...rest,\n className: className ? `cy-card ${className}` : \"cy-card\",\n \"data-variant\": variant,\n \"data-padding\": padding,\n \"data-tone\": tone,\n };\n if (href !== undefined)\n return (\n <LinkBase\n ref={ref as never}\n {...common}\n href={href}\n target={target}\n data-interactive=\"\"\n onClick={onClick}\n >\n {children}\n </LinkBase>\n );\n if (onClick)\n return (\n <ButtonBase ref={ref as never} {...common} onClick={onClick} disabled={disabled} data-interactive=\"\">\n {children}\n </ButtonBase>\n );\n const Tag = as as ElementType;\n return (\n <Tag ref={ref} {...common}>\n {children}\n {actions !== undefined && <div className=\"cy-card-actions cy-reset\">{actions}</div>}\n </Tag>\n );\n});\nCard.displayName = \"Card\";\n"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Card.js","names":["Tag","ButtonBase","LinkBase","forwardRef","jsx","jsxs","TONES","Card","props","ref","actions","style","card","variant","padding","tone","as","href","target","onClick","disabled","edge","className","children","rest","custom","common"],"sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["import {\n type AriaAttributes,\n type CSSProperties,\n type ElementType,\n forwardRef,\n type MouseEventHandler,\n type ReactNode,\n} from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport type { Tone } from \"../../tokens/schema.js\";\n\nexport interface CardTokens {\n /** Border colour of the current card of a set (`aria-current`). Default: the accent. */\n currentBorder: string;\n bg: string;\n border: string;\n radius: string;\n shadow: string;\n softMix: string;\n edgeWidth: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n card: CardTokens;\n }\n}\n\nconst TONES: readonly string[] = [\"accent\", \"neutral\", \"danger\", \"success\", \"warning\", \"info\"];\n\nexport interface CardProps {\n /** `surface` raised panel, `outline` border only, `soft` tone-tinted fill. */\n variant?: \"surface\" | \"outline\" | \"soft\";\n /** Space between the card's edge and its content. Default \"md\". */\n padding?: \"none\" | \"sm\" | \"md\" | \"lg\";\n /** Semantic colour. Default \"neutral\". */\n tone?: Tone;\n /**\n * A coloured edge on the card's inline-start side (left in left-to-right text), e.g. a task's category. A tone name\n * uses that tone's colour; any other string is a CSS colour. Colour alone carries no meaning for many people: say\n * the same thing in the card's text or a Badge. Default: no edge.\n */\n edge?: Tone | (string & {});\n /** Element for a static card. Ignored when `href` or `onClick` makes the whole card interactive. */\n as?: \"div\" | \"section\" | \"article\" | \"li\" | \"aside\";\n /** Makes the whole card a link (rendered through LinkBase, so unsafe schemes are not linked). */\n href?: string;\n /** With `href`: where it opens, e.g. `_blank`. */\n target?: string;\n /** Makes the whole card a button. */\n onClick?: MouseEventHandler<HTMLElement>;\n /** With `onClick` (and no `href`): the card cannot be pressed. */\n disabled?: boolean;\n /**\n * Buttons that sit on the card but act on their own (a game card's 2-player mode, a file card's menu). They are placed\n * over the card's top end, outside its one link or button, so nothing interactive is nested.\n */\n actions?: ReactNode;\n /** Added to the card element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n /** The card's content. Keep it non-interactive when the card is a link or a button. */\n children?: ReactNode;\n /** Accessible name of the card, set on the card element. */\n \"aria-label\"?: string;\n /**\n * Marks a link or button card as the current one of a set: `\"page\"` for the page being shown (a card grid of\n * sections), or `\"step\"`, `\"location\"`, `true`. Read by screen readers, and the card's border takes the accent.\n */\n \"aria-current\"?: AriaAttributes[\"aria-current\"];\n /** Set on the card element, to find it in tests. */\n \"data-testid\"?: string;\n}\n\n/** Content container. With `href` or `onClick` the whole card is one link or button (no nested controls). */\nexport const Card = forwardRef<HTMLElement, CardProps>(function CardRender(props, ref) {\n // With actions, the card itself stays one target and the actions are its siblings in a shared frame. Layout\n // (`style`) goes on the frame; the card fills it.\n if (props.actions !== undefined && (props.href !== undefined || props.onClick)) {\n const { actions, style, ...card } = props;\n return (\n <div className=\"cy-card-frame cy-reset\" style={style}>\n <Card ref={ref} {...card} />\n <div className=\"cy-card-actions cy-reset\">{actions}</div>\n </div>\n );\n }\n const {\n variant = \"surface\",\n padding = \"md\",\n tone = \"neutral\",\n as = \"div\",\n href,\n target,\n onClick,\n disabled,\n actions,\n edge,\n className,\n style,\n children,\n ...rest\n } = props;\n // A tone name is mapped to its token in CSS; any other colour is handed over as a private custom property.\n const custom = !!edge && !TONES.includes(edge);\n const common = {\n ...rest,\n className: className ? `cy-card ${className}` : \"cy-card\",\n style: custom ? ({ \"--_edge\": edge, ...style } as CSSProperties) : style,\n \"data-edge\": edge ? (custom ? \"custom\" : edge) : undefined,\n \"data-variant\": variant,\n \"data-padding\": padding,\n \"data-tone\": tone,\n };\n if (href !== undefined)\n return (\n <LinkBase\n ref={ref as never}\n {...common}\n href={href}\n target={target}\n data-interactive=\"\"\n onClick={onClick}\n >\n {children}\n </LinkBase>\n );\n if (onClick)\n return (\n <ButtonBase ref={ref as never} {...common} onClick={onClick} disabled={disabled} data-interactive=\"\">\n {children}\n </ButtonBase>\n );\n const Tag = as as ElementType;\n return (\n <Tag ref={ref} {...common}>\n {children}\n {actions !== undefined && <div className=\"cy-card-actions cy-reset\">{actions}</div>}\n </Tag>\n );\n});\nCard.displayName = \"Card\";\n"],"mappings":";;;;;AA6BA,IAAMM,IAA2B;AAAA,EAAC;AAAA,EAAU;AAAA,EAAW;AAAA,EAAU;AAAA,EAAW;AAAA,EAAW;AAAM,GAgDhFC,IAAOJ,EAAmC,SAAoBK,GAAOC,GAAK;AAGrF,MAAID,EAAM,YAAY,WAAcA,EAAM,SAAS,UAAaA,EAAM,UAAU;AAC9E,UAAM,EAAE,SAAAE,GAAS,OAAAC,GAAO,GAAGC,EAAA,IAASJ;AACpC,WACE,gBAAAH,EAAC,OAAD;AAAA,MAAK,WAAU;AAAA,MAAgC,OAAAM;AAAA,MAA/C,UAAA,CACE,gBAAAP,EAACG,GAAD;AAAA,QAAW,KAAAE;AAAA,QAAK,GAAIG;AAAA,MAAO,CAAA,GAC3B,gBAAAR,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,QAA4B,UAAAM;AAAA,MAAa,CAAA,CACrD;AAAA,I;A,EAET;AACA,QAAM,EACJ,SAAAG,IAAU,WACV,SAAAC,IAAU,MACV,MAAAC,IAAO,WACP,IAAAC,IAAK,OACL,MAAAC,GACA,QAAAC,GACA,SAAAC,GACA,UAAAC,GACA,SAAAV,GACA,MAAAW,GACA,WAAAC,GACA,OAAAX,GACA,UAAAY,GACA,GAAGC,EAAA,IACDhB,GAEEiB,IAAS,CAAC,CAACJ,KAAQ,CAACf,EAAM,SAASe,CAAI,GACvCK,IAAS;AAAA,IACb,GAAGF;AAAA,IACH,WAAWF,IAAY,WAAWA,CAAA,KAAc;AAAA,IAChD,OAAOG,IAAU;AAAA,MAAE,WAAWJ;AAAA,MAAM,GAAGV;AAAA,IAAM,IAAsBA;AAAA,IACnE,aAAaU,IAAQI,IAAS,WAAWJ,IAAQ;AAAA,IACjD,gBAAgBR;AAAA,IAChB,gBAAgBC;AAAA,IAChB,aAAaC;AAAA,EACf;AACA,SAAIE,MAAS,SAET,gBAAAb,EAACF,GAAD;AAAA,IACO,KAAAO;AAAA,IACL,GAAIiB;AAAA,IACE,MAAAT;AAAA,IACE,QAAAC;AAAA,IACR,oBAAiB;AAAA,IACR,SAAAC;AAAA,IAER,UAAAI;AAAA,EACO,CAAA,IAEVJ,IAEA,gBAAAf,EAACH,GAAD;AAAA,IAAiB,KAAAQ;AAAA,IAAc,GAAIiB;AAAA,IAAiB,SAAAP;AAAA,IAAmB,UAAAC;AAAA,IAAU,oBAAiB;AAAA,IAC/F,UAAAG;AAAA,EACS,CAAA,IAId,gBAAAlB,EAACL,GAAD;AAAA,IAAU,KAAAS;AAAA,IAAK,GAAIiB;AAAA,IAAnB,UAAA,CACGH,GACAb,MAAY,UAAa,gBAAAN,EAAC,OAAD;AAAA,MAAK,WAAU;AAAA,MAA4B,UAAAM;AAAA,IAAa,CAAA,CAC/E;AAAA,E;AAET,CAAC;AACDH,EAAK,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Card, type CardProps } from "./Card.js";
|
|
1
|
+
export { Card, type CardProps, type CardTokens } from "./Card.js";
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ChoiceControlProps } from "../Choice/Choice.js";
|
|
2
2
|
export interface CheckboxTokens {
|
|
3
3
|
size: string;
|
|
4
4
|
radius: string;
|
|
5
5
|
border: string;
|
|
6
|
+
doneColor: string;
|
|
7
|
+
strikeWidth: string;
|
|
6
8
|
}
|
|
7
9
|
declare module "../../tokens/schema.js" {
|
|
8
10
|
interface ComponentTokens {
|
|
9
11
|
checkbox: CheckboxTokens;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
|
-
export interface CheckboxProps extends
|
|
14
|
+
export interface CheckboxProps extends ChoiceControlProps {
|
|
13
15
|
/** Mixed state (announced as "mixed"), e.g. a partially selected "select all". */
|
|
14
16
|
indeterminate?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Checklist style: while the box is checked, the label is struck through and muted (and the description muted), so
|
|
19
|
+
* a done task reads as done. Not applied while `indeterminate`. Default false.
|
|
20
|
+
*/
|
|
21
|
+
strikeWhenChecked?: boolean;
|
|
15
22
|
}
|
|
16
|
-
/** Checkbox on a native input: forms, reset, required and keyboard come for free. */
|
|
17
|
-
export declare function Checkbox(props: CheckboxProps): import("react").JSX.Element;
|
|
23
|
+
/** Checkbox on a native input, in a Choice row: forms, reset, required and keyboard come for free. */
|
|
24
|
+
export declare function Checkbox({ indeterminate, strikeWhenChecked, size, tone, className, ...props }: CheckboxProps): import("react").JSX.Element;
|
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { Icon as r } from "../../foundations/Icon/Icon.js";
|
|
3
|
+
import { check as n } from "../../icons/check.js";
|
|
4
|
+
import { ChoiceBase as h } from "../../foundations/ChoiceBase/ChoiceBase.js";
|
|
5
|
+
import { minus as f } from "../../icons/minus.js";
|
|
6
|
+
import { Choice as p } from "../Choice/Choice.js";
|
|
7
|
+
import { jsx as c, jsxs as x } from "react/jsx-runtime";
|
|
8
|
+
function C({ indeterminate: m = !1, strikeWhenChecked: a = !1, size: o = "md", tone: s = "accent", className: e, ...t }) {
|
|
9
|
+
return /* @__PURE__ */ c(p, {
|
|
10
|
+
...t,
|
|
11
|
+
size: o,
|
|
12
|
+
strikeWhenChecked: a,
|
|
13
|
+
className: `cy-checkbox-row${e ? ` ${e}` : ""}`,
|
|
14
|
+
control: (i) => /* @__PURE__ */ x("span", {
|
|
15
|
+
className: "cy-checkbox",
|
|
16
|
+
"data-size": o,
|
|
17
|
+
"data-tone": s,
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ c(h, {
|
|
20
|
+
...i,
|
|
21
|
+
type: "checkbox",
|
|
22
|
+
indeterminate: m
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ c(r, {
|
|
25
|
+
icon: n,
|
|
26
|
+
className: "cy-checkbox-mark"
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ c(r, {
|
|
29
|
+
icon: f,
|
|
30
|
+
className: "cy-checkbox-dash"
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
})
|
|
8
34
|
});
|
|
9
35
|
}
|
|
10
36
|
export {
|
|
11
|
-
|
|
37
|
+
C as Checkbox
|
|
12
38
|
};
|
|
13
39
|
|
|
14
40
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","names":["
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":["Icon","check","ChoiceBase","minus","Choice","jsx","jsxs","Checkbox","indeterminate","strikeWhenChecked","size","tone","className","props","input"],"sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import { ChoiceBase } from \"../../foundations/ChoiceBase/ChoiceBase.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { check } from \"../../icons/check.js\";\nimport { minus } from \"../../icons/minus.js\";\nimport { Choice, type ChoiceControlProps } from \"../Choice/Choice.js\";\n\nexport interface CheckboxTokens {\n size: string;\n radius: string;\n border: string;\n doneColor: string;\n strikeWidth: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n checkbox: CheckboxTokens;\n }\n}\n\nexport interface CheckboxProps extends ChoiceControlProps {\n /** Mixed state (announced as \"mixed\"), e.g. a partially selected \"select all\". */\n indeterminate?: boolean;\n /**\n * Checklist style: while the box is checked, the label is struck through and muted (and the description muted), so\n * a done task reads as done. Not applied while `indeterminate`. Default false.\n */\n strikeWhenChecked?: boolean;\n}\n\n/** Checkbox on a native input, in a Choice row: forms, reset, required and keyboard come for free. */\nexport function Checkbox({\n indeterminate = false,\n strikeWhenChecked = false,\n size = \"md\",\n tone = \"accent\",\n className,\n ...props\n}: CheckboxProps) {\n return (\n <Choice\n {...props}\n size={size}\n strikeWhenChecked={strikeWhenChecked}\n // The row carries the checkbox's own class too: it maps the checkbox's done tokens onto the row's.\n className={`cy-checkbox-row${className ? ` ${className}` : \"\"}`}\n control={(input) => (\n <span className=\"cy-checkbox\" data-size={size} data-tone={tone}>\n <ChoiceBase {...input} type=\"checkbox\" indeterminate={indeterminate} />\n <Icon icon={check} className=\"cy-checkbox-mark\" />\n <Icon icon={minus} className=\"cy-checkbox-dash\" />\n </span>\n )}\n />\n );\n}\n"],"mappings":";;;;;;;AA+BA,SAAgBO,EAAS,EACvB,eAAAC,IAAgB,IAChB,mBAAAC,IAAoB,IACpB,MAAAC,IAAO,MACP,MAAAC,IAAO,UACP,WAAAC,GACA,GAAGC,EAAA,GACa;AAChB,SACE,gBAAAR,EAACD,GAAD;AAAA,IACE,GAAIS;AAAA,IACE,MAAAH;AAAA,IACa,mBAAAD;AAAA,IAEnB,WAAW,kBAAkBG,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IAC3D,SAAA,CAAUE,MACR,gBAAAR,EAAC,QAAD;AAAA,MAAM,WAAU;AAAA,MAAc,aAAWI;AAAA,MAAM,aAAWC;AAAA,MAA1D,UAAA;AAAA,QACE,gBAAAN,EAACH,GAAD;AAAA,UAAY,GAAIY;AAAA,UAAO,MAAK;AAAA,UAA0B,eAAAN;AAAA,QAAgB,CAAA;AAAA,QACtE,gBAAAH,EAACL,GAAD;AAAA,UAAM,MAAMC;AAAA,UAAO,WAAU;AAAA,QAAoB,CAAA;AAAA,QACjD,gBAAAI,EAACL,GAAD;AAAA,UAAM,MAAMG;AAAA,UAAO,WAAU;AAAA,QAAoB,CAAA;AAAA,MAC7C;AAAA,I;A,EAET,CAAA;AAEL"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
2
|
+
export interface ChecklistTokens {
|
|
3
|
+
/** Space between rows, and between the rows and the add field. */
|
|
4
|
+
gap: string;
|
|
5
|
+
/** Space between a row's checkbox, name and buttons. */
|
|
6
|
+
rowGap: string;
|
|
7
|
+
}
|
|
8
|
+
declare module "../../tokens/schema.js" {
|
|
9
|
+
interface ComponentTokens {
|
|
10
|
+
checklist: ChecklistTokens;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export interface ChecklistItem {
|
|
14
|
+
/** Stable and unique: React keys, focus and reordering follow it. */
|
|
15
|
+
id: string;
|
|
16
|
+
/** The row's name. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Whether it is ticked. */
|
|
19
|
+
done: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ChecklistLabels {
|
|
22
|
+
/** Name and placeholder of the field that adds a row. Default "Add an item". */
|
|
23
|
+
add: string;
|
|
24
|
+
/** Name of the button next to that field. Default "Add". */
|
|
25
|
+
addButton: string;
|
|
26
|
+
/** Name of a row's rename button, and of the field it opens. Default "Rename Buy milk". */
|
|
27
|
+
rename: (name: string) => string;
|
|
28
|
+
/** Name of a row's remove button. Default "Remove Buy milk". */
|
|
29
|
+
remove: (name: string) => string;
|
|
30
|
+
}
|
|
31
|
+
export interface ChecklistProps {
|
|
32
|
+
/** What the rows are ("Subtasks"). Names the list; shown above it unless `labelHidden`. */
|
|
33
|
+
label: string;
|
|
34
|
+
/** Visually hide the label (it still names the list). Default false. */
|
|
35
|
+
labelHidden?: boolean;
|
|
36
|
+
/** The rows, when you control them: `{ id, label, done }`. */
|
|
37
|
+
items?: ChecklistItem[] | undefined;
|
|
38
|
+
/** Starting rows when uncontrolled. */
|
|
39
|
+
defaultItems?: ChecklistItem[];
|
|
40
|
+
/** Called with the full list after each change: a row added, ticked, renamed, removed or moved. */
|
|
41
|
+
onChange?: ((items: ChecklistItem[]) => void) | undefined;
|
|
42
|
+
/** Makes the id of a new row. Default: `crypto.randomUUID()`, or a time-based id where that is missing. */
|
|
43
|
+
createId?: () => string;
|
|
44
|
+
/** The most rows the list may hold; the add field turns off when it is full. */
|
|
45
|
+
maxItems?: number | undefined;
|
|
46
|
+
/** Rows get a grip to drag, or to move with Space and the arrow keys (SortableList). Default false. */
|
|
47
|
+
reorderable?: boolean;
|
|
48
|
+
/** Turns off every checkbox, field and button. Default false. */
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/** Shows the rows as they are: nothing can be ticked, added, renamed, removed or moved. Default false. */
|
|
51
|
+
readOnly?: boolean;
|
|
52
|
+
/** Size of the checkboxes, text, fields and buttons. Default "md". */
|
|
53
|
+
size?: "sm" | "md";
|
|
54
|
+
/** Replace the built-in English text. */
|
|
55
|
+
labels?: Partial<ChecklistLabels>;
|
|
56
|
+
/** Added to the root element, for layout. */
|
|
57
|
+
className?: string;
|
|
58
|
+
/** Layout only. Restyle through --cy-checklist-* tokens. */
|
|
59
|
+
style?: CSSProperties;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A list of rows people add, tick, rename and remove: a task's subtasks, a packing list, the steps of a recipe.
|
|
63
|
+
* Built from Checkbox, TextField and IconButton; with `reorderable` the rows sit in a SortableList.
|
|
64
|
+
*/
|
|
65
|
+
export declare const Checklist: import("react").ForwardRefExoticComponent<ChecklistProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useControllableState as Y } from "../../foundations/controllable.js";
|
|
3
|
+
import { useClientLayoutEffect as Z } from "../../foundations/client-layout-effect.js";
|
|
4
|
+
import { IconButton as k } from "../IconButton/IconButton.js";
|
|
5
|
+
import { Checkbox as O } from "../Checkbox/Checkbox.js";
|
|
6
|
+
import { isComposing as A } from "../../foundations/keys.js";
|
|
7
|
+
import { edit as z } from "../../icons/edit.js";
|
|
8
|
+
import { plus as ee } from "../../icons/plus.js";
|
|
9
|
+
import { trash as te } from "../../icons/trash.js";
|
|
10
|
+
import { Field as ce } from "../Field/Field.js";
|
|
11
|
+
import { SortableList as re } from "../SortableList/SortableList.js";
|
|
12
|
+
import { TextField as L } from "../TextField/TextField.js";
|
|
13
|
+
import { forwardRef as le, useRef as b, useState as B } from "react";
|
|
14
|
+
import { jsx as r, jsxs as g } from "react/jsx-runtime";
|
|
15
|
+
var ne = {
|
|
16
|
+
add: "Add an item",
|
|
17
|
+
addButton: "Add",
|
|
18
|
+
rename: (d) => `Rename ${d}`,
|
|
19
|
+
remove: (d) => `Remove ${d}`
|
|
20
|
+
}, ae = 0, oe = () => typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `item-${Date.now().toString(36)}-${(++ae).toString(36)}`, F = ".cy-checklist-check input", se = ".cy-checklist-rename", U = ".cy-checklist-field input", T = `.cy-checklist-add ${U}`, De = le(function({ label: v, labelHidden: I = !1, items: K, defaultItems: H = [], onChange: j, createId: q = oe, maxItems: u, reorderable: M = !1, disabled: a = !1, readOnly: i = !1, size: n = "md", labels: P, className: C, style: V }, W) {
|
|
21
|
+
const o = {
|
|
22
|
+
...ne,
|
|
23
|
+
...P
|
|
24
|
+
}, [l, f] = Y(K, H, j), [D, E] = B(""), [_, N] = B(null), p = b(!1), w = b(null), s = b(null), R = u !== void 0 && l.length >= u;
|
|
25
|
+
Z(() => {
|
|
26
|
+
const e = s.current;
|
|
27
|
+
e !== null && (s.current = null, w.current?.querySelector(e)?.focus());
|
|
28
|
+
});
|
|
29
|
+
const m = (e, t) => `[data-item="${CSS.escape(e)}"] ${t}`, S = (e, t) => f(l.map((c) => c.id === e ? {
|
|
30
|
+
...c,
|
|
31
|
+
...t
|
|
32
|
+
} : c)), $ = () => {
|
|
33
|
+
const e = D.trim();
|
|
34
|
+
if (!e) return;
|
|
35
|
+
const t = {
|
|
36
|
+
id: q(),
|
|
37
|
+
label: e,
|
|
38
|
+
done: !1
|
|
39
|
+
};
|
|
40
|
+
s.current = u !== void 0 && l.length + 1 >= u ? m(t.id, F) : T, f([...l, t]), E("");
|
|
41
|
+
}, G = (e) => {
|
|
42
|
+
const t = l.findIndex((y) => y.id === e), c = l.filter((y) => y.id !== e), h = c[t] ?? c[t - 1];
|
|
43
|
+
s.current = h ? m(h.id, F) : T, f(c);
|
|
44
|
+
}, J = (e) => {
|
|
45
|
+
s.current = m(e, U), N(e);
|
|
46
|
+
}, Q = (e) => (t) => {
|
|
47
|
+
A(t) || t.key !== "Enter" && t.key !== "Escape" || (t.preventDefault(), t.stopPropagation(), p.current = t.key === "Escape", s.current = m(e.id, se), t.currentTarget.blur());
|
|
48
|
+
}, X = (e, t) => {
|
|
49
|
+
const c = t.trim();
|
|
50
|
+
!p.current && c && c !== e.label && S(e.id, { label: c }), p.current = !1, N(null);
|
|
51
|
+
}, x = (e) => {
|
|
52
|
+
const t = _ === e.id;
|
|
53
|
+
return /* @__PURE__ */ g("div", {
|
|
54
|
+
className: "cy-checklist-row cy-reset",
|
|
55
|
+
"data-item": e.id,
|
|
56
|
+
"data-renaming": t ? "" : void 0,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ r(O, {
|
|
59
|
+
strikeWhenChecked: !0,
|
|
60
|
+
label: t ? /* @__PURE__ */ r("span", {
|
|
61
|
+
className: "cy-visually-hidden",
|
|
62
|
+
children: e.label
|
|
63
|
+
}) : e.label,
|
|
64
|
+
checked: e.done,
|
|
65
|
+
disabled: a,
|
|
66
|
+
size: n,
|
|
67
|
+
className: "cy-checklist-check",
|
|
68
|
+
onChange: (c) => {
|
|
69
|
+
i || S(e.id, { done: c });
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
t && /* @__PURE__ */ r(L, {
|
|
73
|
+
label: o.rename(e.label),
|
|
74
|
+
labelHidden: !0,
|
|
75
|
+
defaultValue: e.label,
|
|
76
|
+
size: n,
|
|
77
|
+
className: "cy-checklist-field",
|
|
78
|
+
onFocus: (c) => c.currentTarget.select(),
|
|
79
|
+
onKeyDown: Q(e),
|
|
80
|
+
onBlur: (c) => X(e, c.currentTarget.value)
|
|
81
|
+
}),
|
|
82
|
+
!i && !t && /* @__PURE__ */ r(k, {
|
|
83
|
+
icon: z,
|
|
84
|
+
label: o.rename(e.label),
|
|
85
|
+
variant: "ghost",
|
|
86
|
+
size: n,
|
|
87
|
+
disabled: a,
|
|
88
|
+
className: "cy-checklist-rename",
|
|
89
|
+
onClick: () => J(e.id)
|
|
90
|
+
}),
|
|
91
|
+
!i && /* @__PURE__ */ r(k, {
|
|
92
|
+
icon: te,
|
|
93
|
+
label: o.remove(e.label),
|
|
94
|
+
variant: "ghost",
|
|
95
|
+
size: n,
|
|
96
|
+
disabled: a,
|
|
97
|
+
onClick: () => G(e.id)
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ r("div", {
|
|
103
|
+
ref: W,
|
|
104
|
+
className: C ? `cy-checklist ${C}` : "cy-checklist",
|
|
105
|
+
"data-size": n,
|
|
106
|
+
style: V,
|
|
107
|
+
children: /* @__PURE__ */ r(ce, {
|
|
108
|
+
group: !0,
|
|
109
|
+
label: v,
|
|
110
|
+
labelHidden: I,
|
|
111
|
+
size: n,
|
|
112
|
+
children: (e) => /* @__PURE__ */ g("div", {
|
|
113
|
+
ref: w,
|
|
114
|
+
className: "cy-checklist-body cy-reset",
|
|
115
|
+
children: [l.length > 0 && (M && !i ? /* @__PURE__ */ r(re, {
|
|
116
|
+
label: v,
|
|
117
|
+
items: l.map((t) => ({
|
|
118
|
+
id: t.id,
|
|
119
|
+
label: t.label,
|
|
120
|
+
content: x(t)
|
|
121
|
+
})),
|
|
122
|
+
onReorder: (t) => f(t.map((c) => l.find((h) => h.id === c.id))),
|
|
123
|
+
disabled: a,
|
|
124
|
+
size: n
|
|
125
|
+
}) : /* @__PURE__ */ r("ul", {
|
|
126
|
+
className: "cy-checklist-items cy-reset",
|
|
127
|
+
"aria-labelledby": e.labelId,
|
|
128
|
+
children: l.map((t) => /* @__PURE__ */ r("li", {
|
|
129
|
+
className: "cy-checklist-item cy-reset",
|
|
130
|
+
children: x(t)
|
|
131
|
+
}, t.id))
|
|
132
|
+
})), !i && /* @__PURE__ */ g("div", {
|
|
133
|
+
className: "cy-checklist-add cy-reset",
|
|
134
|
+
children: [/* @__PURE__ */ r(L, {
|
|
135
|
+
label: o.add,
|
|
136
|
+
labelHidden: !0,
|
|
137
|
+
placeholder: o.add,
|
|
138
|
+
value: D,
|
|
139
|
+
disabled: a || R,
|
|
140
|
+
size: n,
|
|
141
|
+
className: "cy-checklist-field",
|
|
142
|
+
onChange: E,
|
|
143
|
+
onKeyDown: (t) => {
|
|
144
|
+
t.key !== "Enter" || A(t) || (t.preventDefault(), $());
|
|
145
|
+
}
|
|
146
|
+
}), /* @__PURE__ */ r(k, {
|
|
147
|
+
icon: ee,
|
|
148
|
+
label: o.addButton,
|
|
149
|
+
variant: "ghost",
|
|
150
|
+
size: n,
|
|
151
|
+
disabled: a || R,
|
|
152
|
+
onClick: $
|
|
153
|
+
})]
|
|
154
|
+
})]
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
export {
|
|
160
|
+
De as Checklist
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=Checklist.js.map
|