@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checklist.js","names":["useControllableState","useClientLayoutEffect","IconButton","Checkbox","isComposing","edit","plus","trash","Field","SortableList","TextField","forwardRef","useRef","useState","jsx","jsxs","DEFAULT_LABELS","name","made","newId","CHECK","RENAME","FIELD","ADD","Checklist","label","labelHidden","items","defaultItems","onChange","createId","maxItems","reorderable","disabled","readOnly","size","labels","className","style","ref","text","rows","setRows","draft","setDraft","editing","setEditing","cancelled","body","focusNext","full","selector","inRow","id","part","update","patch","r","add","item","remove","at","rest","next","rename","onRenameKey","event","endRename","typed","row","renaming","done","field","moved"],"sources":["../../../src/components/Checklist/Checklist.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type KeyboardEvent, useRef, useState } from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { isComposing } from \"../../foundations/keys.js\";\nimport { edit } from \"../../icons/edit.js\";\nimport { plus } from \"../../icons/plus.js\";\nimport { trash } from \"../../icons/trash.js\";\nimport { Checkbox } from \"../Checkbox/Checkbox.js\";\nimport { Field } from \"../Field/Field.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { SortableList } from \"../SortableList/SortableList.js\";\nimport { TextField } from \"../TextField/TextField.js\";\n\nexport interface ChecklistTokens {\n /** Space between rows, and between the rows and the add field. */\n gap: string;\n /** Space between a row's checkbox, name and buttons. */\n rowGap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n checklist: ChecklistTokens;\n }\n}\n\nexport interface ChecklistItem {\n /** Stable and unique: React keys, focus and reordering follow it. */\n id: string;\n /** The row's name. */\n label: string;\n /** Whether it is ticked. */\n done: boolean;\n}\n\nexport interface ChecklistLabels {\n /** Name and placeholder of the field that adds a row. Default \"Add an item\". */\n add: string;\n /** Name of the button next to that field. Default \"Add\". */\n addButton: string;\n /** Name of a row's rename button, and of the field it opens. Default \"Rename Buy milk\". */\n rename: (name: string) => string;\n /** Name of a row's remove button. Default \"Remove Buy milk\". */\n remove: (name: string) => string;\n}\n\nexport interface ChecklistProps {\n /** What the rows are (\"Subtasks\"). Names the list; shown above it unless `labelHidden`. */\n label: string;\n /** Visually hide the label (it still names the list). Default false. */\n labelHidden?: boolean;\n /** The rows, when you control them: `{ id, label, done }`. */\n items?: ChecklistItem[] | undefined;\n /** Starting rows when uncontrolled. */\n defaultItems?: ChecklistItem[];\n /** Called with the full list after each change: a row added, ticked, renamed, removed or moved. */\n onChange?: ((items: ChecklistItem[]) => void) | undefined;\n /** Makes the id of a new row. Default: `crypto.randomUUID()`, or a time-based id where that is missing. */\n createId?: () => string;\n /** The most rows the list may hold; the add field turns off when it is full. */\n maxItems?: number | undefined;\n /** Rows get a grip to drag, or to move with Space and the arrow keys (SortableList). Default false. */\n reorderable?: boolean;\n /** Turns off every checkbox, field and button. Default false. */\n disabled?: boolean;\n /** Shows the rows as they are: nothing can be ticked, added, renamed, removed or moved. Default false. */\n readOnly?: boolean;\n /** Size of the checkboxes, text, fields and buttons. Default \"md\". */\n size?: \"sm\" | \"md\";\n /** Replace the built-in English text. */\n labels?: Partial<ChecklistLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-checklist-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: ChecklistLabels = {\n add: \"Add an item\",\n addButton: \"Add\",\n rename: (name) => `Rename ${name}`,\n remove: (name) => `Remove ${name}`,\n};\n\nlet made = 0;\nconst newId = () =>\n typeof crypto.randomUUID === \"function\"\n ? crypto.randomUUID()\n : `item-${Date.now().toString(36)}-${(++made).toString(36)}`;\n\n// Focus targets, found through this component's own classes on the Checkbox, TextField and IconButton it renders.\nconst CHECK = \".cy-checklist-check input\";\nconst RENAME = \".cy-checklist-rename\";\nconst FIELD = \".cy-checklist-field input\";\nconst ADD = `.cy-checklist-add ${FIELD}`;\n\n/**\n * A list of rows people add, tick, rename and remove: a task's subtasks, a packing list, the steps of a recipe.\n * Built from Checkbox, TextField and IconButton; with `reorderable` the rows sit in a SortableList.\n */\nexport const Checklist = forwardRef<HTMLDivElement, ChecklistProps>(function Checklist(\n {\n label,\n labelHidden = false,\n items,\n defaultItems = [],\n onChange,\n createId = newId,\n maxItems,\n reorderable = false,\n disabled = false,\n readOnly = false,\n size = \"md\",\n labels,\n className,\n style,\n },\n ref,\n) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const [rows, setRows] = useControllableState(items, defaultItems, onChange);\n const [draft, setDraft] = useState(\"\");\n /** The id of the row being renamed. */\n const [editing, setEditing] = useState<string | null>(null);\n /** Set by Escape, so the blur that follows throws the typed name away. */\n const cancelled = useRef(false);\n const body = useRef<HTMLDivElement>(null);\n /** Selector (inside the body) of what to focus once the rows have rendered. */\n const focusNext = useRef<string | null>(null);\n const full = maxItems !== undefined && rows.length >= maxItems;\n\n useClientLayoutEffect(() => {\n const selector = focusNext.current;\n if (selector === null) return;\n focusNext.current = null;\n body.current?.querySelector<HTMLElement>(selector)?.focus();\n });\n\n const inRow = (id: string, part: string) => `[data-item=\"${CSS.escape(id)}\"] ${part}`;\n const update = (id: string, patch: Partial<ChecklistItem>) =>\n setRows(rows.map((r) => (r.id === id ? { ...r, ...patch } : r)));\n\n const add = () => {\n const name = draft.trim();\n if (!name) return;\n const item = { id: createId(), label: name, done: false };\n // Focus stays in the add field for the next row; when the list is now full, it goes to the new row.\n focusNext.current = maxItems !== undefined && rows.length + 1 >= maxItems ? inRow(item.id, CHECK) : ADD;\n setRows([...rows, item]);\n setDraft(\"\");\n };\n const remove = (id: string) => {\n const at = rows.findIndex((r) => r.id === id);\n const rest = rows.filter((r) => r.id !== id);\n // Focus the row that took its place (or the one before it), else the add field.\n const next = rest[at] ?? rest[at - 1];\n focusNext.current = next ? inRow(next.id, CHECK) : ADD;\n setRows(rest);\n };\n const rename = (id: string) => {\n focusNext.current = inRow(id, FIELD);\n setEditing(id);\n };\n /** Enter saves and Escape cancels, both by leaving the field: its blur is the one place a rename ends. */\n const onRenameKey = (item: ChecklistItem) => (event: KeyboardEvent<HTMLInputElement>) => {\n if (isComposing(event) || (event.key !== \"Enter\" && event.key !== \"Escape\")) return;\n // Enter must not submit a form around the list, and Escape must not close a dialog around it.\n event.preventDefault();\n event.stopPropagation();\n cancelled.current = event.key === \"Escape\";\n focusNext.current = inRow(item.id, RENAME);\n event.currentTarget.blur();\n };\n const endRename = (item: ChecklistItem, typed: string) => {\n const name = typed.trim();\n // An empty name is not saved: the row keeps the name it had.\n if (!cancelled.current && name && name !== item.label) update(item.id, { label: name });\n cancelled.current = false;\n setEditing(null);\n };\n\n const row = (item: ChecklistItem) => {\n const renaming = editing === item.id;\n return (\n <div\n className=\"cy-checklist-row cy-reset\"\n data-item={item.id}\n data-renaming={renaming ? \"\" : undefined}\n >\n {/* Done rows are struck through and muted by Checkbox itself. */}\n <Checkbox\n strikeWhenChecked\n label={renaming ? <span className=\"cy-visually-hidden\">{item.label}</span> : item.label}\n checked={item.done}\n disabled={disabled}\n size={size}\n className=\"cy-checklist-check\"\n onChange={(done) => {\n if (!readOnly) update(item.id, { done });\n }}\n />\n {renaming && (\n <TextField\n label={text.rename(item.label)}\n labelHidden\n defaultValue={item.label}\n size={size}\n className=\"cy-checklist-field\"\n onFocus={(event) => event.currentTarget.select()}\n onKeyDown={onRenameKey(item)}\n onBlur={(event) => endRename(item, event.currentTarget.value)}\n />\n )}\n {!readOnly && !renaming && (\n <IconButton\n icon={edit}\n label={text.rename(item.label)}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n className=\"cy-checklist-rename\"\n onClick={() => rename(item.id)}\n />\n )}\n {!readOnly && (\n <IconButton\n icon={trash}\n label={text.remove(item.label)}\n variant=\"ghost\"\n size={size}\n disabled={disabled}\n onClick={() => remove(item.id)}\n />\n )}\n </div>\n );\n };\n\n return (\n <div\n ref={ref}\n className={className ? `cy-checklist ${className}` : \"cy-checklist\"}\n data-size={size}\n style={style}\n >\n <Field group label={label} labelHidden={labelHidden} size={size}>\n {(field) => (\n <div ref={body} className=\"cy-checklist-body cy-reset\">\n {rows.length > 0 &&\n (reorderable && !readOnly ? (\n <SortableList\n label={label}\n items={rows.map((item) => ({ id: item.id, label: item.label, content: row(item) }))}\n onReorder={(next) =>\n setRows(next.map((moved) => rows.find((r) => r.id === moved.id) as ChecklistItem))\n }\n disabled={disabled}\n size={size}\n />\n ) : (\n <ul className=\"cy-checklist-items cy-reset\" aria-labelledby={field.labelId}>\n {rows.map((item) => (\n <li key={item.id} className=\"cy-checklist-item cy-reset\">\n {row(item)}\n </li>\n ))}\n </ul>\n ))}\n {!readOnly && (\n <div className=\"cy-checklist-add cy-reset\">\n <TextField\n label={text.add}\n labelHidden\n placeholder={text.add}\n value={draft}\n disabled={disabled || full}\n size={size}\n className=\"cy-checklist-field\"\n onChange={setDraft}\n onKeyDown={(event) => {\n if (event.key !== \"Enter\" || isComposing(event)) return;\n // Enter adds a row; it must not submit a form around the list.\n event.preventDefault();\n add();\n }}\n />\n <IconButton\n icon={plus}\n label={text.addButton}\n variant=\"ghost\"\n size={size}\n disabled={disabled || full}\n onClick={add}\n />\n </div>\n )}\n </div>\n )}\n </Field>\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;AA6EA,IAAMgB,KAAkC;AAAA,EACtC,KAAK;AAAA,EACL,WAAW;AAAA,EACX,QAAA,CAASC,MAAS,UAAUA,CAAA;AAAA,EAC5B,QAAA,CAASA,MAAS,UAAUA,CAAA;AAC9B,GAEIC,KAAO,GACLC,KAAA,MACJ,OAAO,OAAO,cAAe,aACzB,OAAO,WAAW,IAClB,QAAQ,KAAK,IAAI,EAAE,SAAS,EAAE,CAAA,KAAM,EAAED,IAAM,SAAS,EAAE,CAAA,IAGvDE,IAAQ,6BACRC,KAAS,wBACTC,IAAQ,6BACRC,IAAM,qBAAqBD,CAAA,IAMpBE,KAAYb,GAA2C,SAClE,EACE,OAAAc,GACA,aAAAC,IAAc,IACd,OAAAC,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,KAAYiB;AAAA,YAChB,MAAAf;AAAA,YACN,WAAU;AAAA,YACV,UAAUS;AAAA,YACV,WAAA,CAAYsB,MAAU;AACpB,cAAIA,EAAM,QAAQ,WAAW9D,EAAY8D,CAAK,MAE9CA,EAAM,eAAe,GACrBR,EAAI;AAAA,YACN;AAAA,UACD,CAAA,GACD,gBAAA5C,EAACZ,GAAD;AAAA,YACE,MAAMI;AAAA,YACN,OAAOkC,EAAK;AAAA,YACZ,SAAQ;AAAA,YACF,MAAAL;AAAA,YACN,UAAUF,KAAYiB;AAAA,YACtB,SAASQ;AAAA,UACV,CAAA,CACE;AAAA,QAEJ,CAAA,CAAA;AAAA,M;A,IAEF,CAAA;AAAA,EACJ,CAAA;AAET,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checklist, type ChecklistItem, type ChecklistLabels, type ChecklistProps, type ChecklistTokens, } from "./Checklist.js";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ChangeEvent, CSSProperties, ReactNode } from "react";
|
|
2
|
+
import type { Size, Tone } from "../../tokens/schema.js";
|
|
3
|
+
export interface ChoiceTokens {
|
|
4
|
+
gap: string;
|
|
5
|
+
doneColor: string;
|
|
6
|
+
strikeWidth: string;
|
|
7
|
+
}
|
|
8
|
+
declare module "../../tokens/schema.js" {
|
|
9
|
+
interface ComponentTokens {
|
|
10
|
+
choice: ChoiceTokens;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** The props of a control that sits in a Choice row (Checkbox, Switch). */
|
|
14
|
+
export interface ChoiceControlProps {
|
|
15
|
+
/** The control's label. Pressing it toggles the control. */
|
|
16
|
+
label: ReactNode;
|
|
17
|
+
/** Help text shown under the label and read with the control. */
|
|
18
|
+
description?: ReactNode | undefined;
|
|
19
|
+
/** Controlled: whether it is on. */
|
|
20
|
+
checked?: boolean | undefined;
|
|
21
|
+
/** On at first, when uncontrolled. */
|
|
22
|
+
defaultChecked?: boolean | undefined;
|
|
23
|
+
/** Called when the person turns it on or off, with the new state. */
|
|
24
|
+
onChange?: ((checked: boolean) => void) | undefined;
|
|
25
|
+
/** Name it is submitted under in a form, when on. */
|
|
26
|
+
name?: string | undefined;
|
|
27
|
+
/** The value submitted with `name` when on. The browser sends "on" when this is not set. */
|
|
28
|
+
value?: string | undefined;
|
|
29
|
+
/** It must be on for the form to submit. */
|
|
30
|
+
required?: boolean | undefined;
|
|
31
|
+
/** It cannot be changed and is not submitted with a form. */
|
|
32
|
+
disabled?: boolean | undefined;
|
|
33
|
+
/** Size of the control and its text. Default "md". */
|
|
34
|
+
size?: Size | undefined;
|
|
35
|
+
/** Fill colour when on. Default "accent". */
|
|
36
|
+
tone?: Tone | undefined;
|
|
37
|
+
/** Id of the native input; one is generated when not set. */
|
|
38
|
+
id?: string | undefined;
|
|
39
|
+
/** Added to the root element (the label that wraps the row), for layout. */
|
|
40
|
+
className?: string | undefined;
|
|
41
|
+
/** Layout only, applied to the root element. */
|
|
42
|
+
style?: CSSProperties | undefined;
|
|
43
|
+
}
|
|
44
|
+
/** What a Choice hands its control: spread it onto the native checkbox or radio (`ChoiceBase`). */
|
|
45
|
+
export interface ChoiceInput {
|
|
46
|
+
id: string;
|
|
47
|
+
"aria-labelledby": string;
|
|
48
|
+
"aria-describedby": string | undefined;
|
|
49
|
+
name?: string | undefined;
|
|
50
|
+
value?: string | undefined;
|
|
51
|
+
required?: boolean | undefined;
|
|
52
|
+
disabled?: boolean | undefined;
|
|
53
|
+
checked?: boolean | undefined;
|
|
54
|
+
defaultChecked?: boolean | undefined;
|
|
55
|
+
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
56
|
+
}
|
|
57
|
+
export interface ChoiceProps extends Omit<ChoiceControlProps, "tone"> {
|
|
58
|
+
/**
|
|
59
|
+
* Draws the control, given the props for its native input. The input must be a direct child of the element this
|
|
60
|
+
* returns (the label's strike follows it).
|
|
61
|
+
*/
|
|
62
|
+
control: (input: ChoiceInput) => ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* While the control is checked (and not mixed), the label is struck through and muted, and the description muted,
|
|
65
|
+
* so a done task reads as done. Default false.
|
|
66
|
+
*/
|
|
67
|
+
strikeWhenChecked?: boolean | undefined;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The row a choice control sits in: the control, its label and its description, the whole row clickable. Checkbox,
|
|
71
|
+
* Switch and RadioGroup's options are Choice rows; each draws its own control.
|
|
72
|
+
*/
|
|
73
|
+
export declare function Choice({ control, label, description, checked, defaultChecked, onChange, strikeWhenChecked, size, id, className, style, ...input }: ChoiceProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useField as p } from "../../foundations/field.js";
|
|
3
|
+
import { jsx as l, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
function v({ control: r, label: o, description: d, checked: i, defaultChecked: t, onChange: n, strikeWhenChecked: b = !1, size: h = "md", id: m, className: a, style: y, ...c }) {
|
|
5
|
+
const e = p({
|
|
6
|
+
id: m,
|
|
7
|
+
description: d
|
|
8
|
+
});
|
|
9
|
+
return /* @__PURE__ */ s("label", {
|
|
10
|
+
htmlFor: e.id,
|
|
11
|
+
className: `cy-choice${a ? ` ${a}` : ""}`,
|
|
12
|
+
"data-size": h,
|
|
13
|
+
"data-disabled": c.disabled ? "" : void 0,
|
|
14
|
+
"data-strike": b ? "" : void 0,
|
|
15
|
+
style: y,
|
|
16
|
+
children: [r({
|
|
17
|
+
...c,
|
|
18
|
+
id: e.id,
|
|
19
|
+
"aria-labelledby": e.labelId,
|
|
20
|
+
"aria-describedby": e.describedBy,
|
|
21
|
+
...i !== void 0 ? { checked: i } : { defaultChecked: t },
|
|
22
|
+
onChange: (f) => n?.(f.currentTarget.checked)
|
|
23
|
+
}), /* @__PURE__ */ s("span", {
|
|
24
|
+
className: "cy-choice-text",
|
|
25
|
+
children: [/* @__PURE__ */ l("span", {
|
|
26
|
+
id: e.labelId,
|
|
27
|
+
className: "cy-choice-label",
|
|
28
|
+
children: o
|
|
29
|
+
}), d && /* @__PURE__ */ l("span", {
|
|
30
|
+
id: e.descriptionId,
|
|
31
|
+
className: "cy-choice-description",
|
|
32
|
+
children: d
|
|
33
|
+
})]
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
v as Choice
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=Choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Choice.js","names":["useField","jsx","jsxs","Choice","control","label","description","checked","defaultChecked","onChange","strikeWhenChecked","size","id","className","style","input","field","e"],"sources":["../../../src/components/Choice/Choice.tsx"],"sourcesContent":["import type { ChangeEvent, CSSProperties, ReactNode } from \"react\";\nimport { useField } from \"../../foundations/field.js\";\nimport type { Size, Tone } from \"../../tokens/schema.js\";\n\nexport interface ChoiceTokens {\n gap: string;\n doneColor: string;\n strikeWidth: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n choice: ChoiceTokens;\n }\n}\n\n/** The props of a control that sits in a Choice row (Checkbox, Switch). */\nexport interface ChoiceControlProps {\n /** The control's label. Pressing it toggles the control. */\n label: ReactNode;\n /** Help text shown under the label and read with the control. */\n description?: ReactNode | undefined;\n /** Controlled: whether it is on. */\n checked?: boolean | undefined;\n /** On at first, when uncontrolled. */\n defaultChecked?: boolean | undefined;\n /** Called when the person turns it on or off, with the new state. */\n onChange?: ((checked: boolean) => void) | undefined;\n /** Name it is submitted under in a form, when on. */\n name?: string | undefined;\n /** The value submitted with `name` when on. The browser sends \"on\" when this is not set. */\n value?: string | undefined;\n /** It must be on for the form to submit. */\n required?: boolean | undefined;\n /** It cannot be changed and is not submitted with a form. */\n disabled?: boolean | undefined;\n /** Size of the control and its text. Default \"md\". */\n size?: Size | undefined;\n /** Fill colour when on. Default \"accent\". */\n tone?: Tone | undefined;\n /** Id of the native input; one is generated when not set. */\n id?: string | undefined;\n /** Added to the root element (the label that wraps the row), for layout. */\n className?: string | undefined;\n /** Layout only, applied to the root element. */\n style?: CSSProperties | undefined;\n}\n\n/** What a Choice hands its control: spread it onto the native checkbox or radio (`ChoiceBase`). */\nexport interface ChoiceInput {\n id: string;\n \"aria-labelledby\": string;\n \"aria-describedby\": string | undefined;\n name?: string | undefined;\n value?: string | undefined;\n required?: boolean | undefined;\n disabled?: boolean | undefined;\n checked?: boolean | undefined;\n defaultChecked?: boolean | undefined;\n onChange: (event: ChangeEvent<HTMLInputElement>) => void;\n}\n\nexport interface ChoiceProps extends Omit<ChoiceControlProps, \"tone\"> {\n /**\n * Draws the control, given the props for its native input. The input must be a direct child of the element this\n * returns (the label's strike follows it).\n */\n control: (input: ChoiceInput) => ReactNode;\n /**\n * While the control is checked (and not mixed), the label is struck through and muted, and the description muted,\n * so a done task reads as done. Default false.\n */\n strikeWhenChecked?: boolean | undefined;\n}\n\n/**\n * The row a choice control sits in: the control, its label and its description, the whole row clickable. Checkbox,\n * Switch and RadioGroup's options are Choice rows; each draws its own control.\n */\nexport function Choice({\n control,\n label,\n description,\n checked,\n defaultChecked,\n onChange,\n strikeWhenChecked = false,\n size = \"md\",\n id,\n className,\n style,\n ...input\n}: ChoiceProps) {\n const field = useField({ id, description });\n return (\n <label\n htmlFor={field.id}\n className={`cy-choice${className ? ` ${className}` : \"\"}`}\n data-size={size}\n data-disabled={input.disabled ? \"\" : undefined}\n data-strike={strikeWhenChecked ? \"\" : undefined}\n style={style}\n >\n {control({\n ...input,\n id: field.id,\n \"aria-labelledby\": field.labelId,\n \"aria-describedby\": field.describedBy,\n ...(checked !== undefined ? { checked } : { defaultChecked }),\n onChange: (e) => onChange?.(e.currentTarget.checked),\n })}\n <span className=\"cy-choice-text\">\n <span id={field.labelId} className=\"cy-choice-label\">\n {label}\n </span>\n {description && (\n <span id={field.descriptionId} className=\"cy-choice-description\">\n {description}\n </span>\n )}\n </span>\n </label>\n );\n}\n"],"mappings":";;;AA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@ export interface CodeBlockLabels extends CopyButtonLabels {
|
|
|
21
21
|
active: (lines: readonly number[]) => string;
|
|
22
22
|
}
|
|
23
23
|
export interface CodeBlockProps {
|
|
24
|
+
/** The code to show and copy. One final new line is not shown as an empty last line. */
|
|
24
25
|
code: string;
|
|
25
26
|
/** Shown in the header (when there is no `title`) and passed to `highlight`. */
|
|
26
27
|
language?: string | undefined;
|
|
@@ -31,6 +32,7 @@ export interface CodeBlockProps {
|
|
|
31
32
|
* bundles none. Without it the code is plain text.
|
|
32
33
|
*/
|
|
33
34
|
highlight?: ((code: string, language?: string) => ReactNode) | undefined;
|
|
35
|
+
/** Show line numbers beside the code. Left out when `wrap` is on. */
|
|
34
36
|
lineNumbers?: boolean;
|
|
35
37
|
/** Lines to mark (1-based), such as the line a debugger is on. Marked behind the text and read out. */
|
|
36
38
|
activeLines?: readonly number[] | undefined;
|
|
@@ -40,8 +42,11 @@ export interface CodeBlockProps {
|
|
|
40
42
|
copyable?: boolean;
|
|
41
43
|
/** Passed to the copy button (extensions can copy through their own channel). */
|
|
42
44
|
copy?: ((text: string) => Promise<void> | void) | undefined;
|
|
45
|
+
/** Text size of the code. Default "md". */
|
|
43
46
|
size?: Size;
|
|
47
|
+
/** Replace the built-in English text: the copy button, the code region's name and the marked lines. */
|
|
44
48
|
labels?: Partial<CodeBlockLabels>;
|
|
49
|
+
/** Added to the root element, for layout. */
|
|
45
50
|
className?: string;
|
|
46
51
|
/** Layout only. Restyle through --cy-code-block-* tokens. */
|
|
47
52
|
style?: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.js","names":["CopyButton","useId","jsx","jsxs","defaultActive","lines","CodeBlock","code","language","title","highlight","lineNumbers","activeLines","wrap","copyable","copy","size","labels","className","style","id","shown","name","heading","numbered","marked","n","body","_","i"],"sources":["../../../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useId } from \"react\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { CopyButton, type CopyButtonLabels } from \"../CopyButton/CopyButton.js\";\n\nexport interface CodeBlockTokens {\n /** Background of the code. */\n background: string;\n /** Corner radius of the block. */\n radius: string;\n /** Tallest the code gets before it scrolls. */\n maxHeight: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n codeBlock: CodeBlockTokens;\n }\n}\n\nexport interface CodeBlockLabels extends CopyButtonLabels {\n /** Name of the scrollable code region when there is no `title` or `language`. Default: \"Code\". */\n region: string;\n /** Read after the code when lines are marked. Default: \"Line 3 highlighted\" / \"Lines 3, 4 highlighted\". */\n active: (lines: readonly number[]) => string;\n}\n\nconst defaultActive = (lines: readonly number[]) =>\n `${lines.length === 1 ? \"Line\" : \"Lines\"} ${lines.join(\", \")} highlighted`;\n\nexport interface CodeBlockProps {\n code: string;\n /** Shown in the header (when there is no `title`) and passed to `highlight`. */\n language?: string | undefined;\n /** A file name or caption for the header, e.g. \"vite.config.ts\". */\n title?: ReactNode;\n /**\n * Your highlighter, e.g. `(code, lang) => <span dangerouslySetInnerHTML={{ __html: shiki(code, lang) }} />`. Cynosure\n * bundles none. Without it the code is plain text.\n */\n highlight?: ((code: string, language?: string) => ReactNode) | undefined;\n lineNumbers?: boolean;\n /** Lines to mark (1-based), such as the line a debugger is on. Marked behind the text and read out. */\n activeLines?: readonly number[] | undefined;\n /** Wrap long lines instead of scrolling sideways (line numbers are then left out, as they would not line up). */\n wrap?: boolean;\n /** Show the copy button. Default true. */\n copyable?: boolean;\n /** Passed to the copy button (extensions can copy through their own channel). */\n copy?: ((text: string) => Promise<void> | void) | undefined;\n size?: Size;\n labels?: Partial<CodeBlockLabels>;\n className?: string;\n /** Layout only. Restyle through --cy-code-block-* tokens. */\n style?: CSSProperties;\n}\n\n/**\n * Code to read and copy: a header with the file name or language and a copy button, then the code with optional line\n * numbers. Bring your own highlighter through `highlight`.\n */\nexport function CodeBlock({\n code,\n language,\n title,\n highlight,\n lineNumbers = false,\n activeLines,\n wrap = false,\n copyable = true,\n copy,\n size = \"md\",\n labels,\n className,\n style,\n}: CodeBlockProps) {\n const id = useId();\n // One final new line is a file ending, not an empty last line.\n const shown = code.replace(/\\n$/, \"\");\n const lines = shown.split(\"\\n\");\n const name = typeof title === \"string\" ? title : (language ?? labels?.region ?? \"Code\");\n const heading = title ?? language;\n const numbered = lineNumbers && !wrap;\n const marked = !wrap && activeLines?.length ? activeLines.filter((n) => n >= 1 && n <= lines.length) : [];\n const body = (\n <code className=\"cy-code-block-code cy-reset\" data-language={language}>\n {highlight ? highlight(shown, language) : shown}\n </code>\n );\n return (\n <figure\n className={className ? `cy-code-block ${className}` : \"cy-code-block\"}\n data-size={size}\n data-wrap={wrap ? \"\" : undefined}\n aria-labelledby={heading ? `${id}-title` : undefined}\n aria-label={heading ? undefined : name}\n style={style}\n >\n {(heading || copyable) && (\n <div className=\"cy-code-block-header cy-reset\">\n <span className=\"cy-code-block-title cy-reset\" id={`${id}-title`}>\n {heading}\n </span>\n {copyable && (\n <CopyButton\n value={code}\n size=\"sm\"\n variant=\"ghost\"\n tooltipPlacement=\"start\"\n {...(copy ? { copy } : {})}\n {...(labels ? { labels } : {})}\n />\n )}\n </div>\n )}\n <div className=\"cy-code-block-body cy-reset\">\n {numbered && (\n <span className=\"cy-code-block-gutter cy-reset\" aria-hidden=\"true\">\n {lines.map((_, i) => (\n <span key={i} className=\"cy-reset\" data-active={marked.includes(i + 1) ? \"\" : undefined}>\n {i + 1}\n </span>\n ))}\n </span>\n )}\n {wrap ? (\n <pre className=\"cy-code-block-pre cy-reset\">{body}</pre>\n ) : (\n // A scrolling region must be reachable by keyboard: it is focusable and named.\n // biome-ignore lint/a11y/noNoninteractiveTabindex lint/a11y/useSemanticElements: the scrolling pre itself is the focusable, named region\n <pre className=\"cy-code-block-pre cy-reset\" tabIndex={0} role=\"region\" aria-label={name}>\n {marked.map((n) => (\n <span\n key={n}\n className=\"cy-code-block-mark cy-reset\"\n style={{ \"--_line\": n - 1 } as CSSProperties}\n aria-hidden=\"true\"\n />\n ))}\n {body}\n </pre>\n )}\n </div>\n {marked.length > 0 && (\n <span className=\"cy-visually-hidden\">{(labels?.active ?? defaultActive)(marked)}</span>\n )}\n </figure>\n );\n}\n"],"mappings":";;;;AA0BA,IAAMI,IAAA,CAAiBC,MACrB,GAAGA,EAAM,WAAW,IAAI,SAAS,OAAA,IAAWA,EAAM,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","names":["CopyButton","useId","jsx","jsxs","defaultActive","lines","CodeBlock","code","language","title","highlight","lineNumbers","activeLines","wrap","copyable","copy","size","labels","className","style","id","shown","name","heading","numbered","marked","n","body","_","i"],"sources":["../../../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useId } from \"react\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { CopyButton, type CopyButtonLabels } from \"../CopyButton/CopyButton.js\";\n\nexport interface CodeBlockTokens {\n /** Background of the code. */\n background: string;\n /** Corner radius of the block. */\n radius: string;\n /** Tallest the code gets before it scrolls. */\n maxHeight: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n codeBlock: CodeBlockTokens;\n }\n}\n\nexport interface CodeBlockLabels extends CopyButtonLabels {\n /** Name of the scrollable code region when there is no `title` or `language`. Default: \"Code\". */\n region: string;\n /** Read after the code when lines are marked. Default: \"Line 3 highlighted\" / \"Lines 3, 4 highlighted\". */\n active: (lines: readonly number[]) => string;\n}\n\nconst defaultActive = (lines: readonly number[]) =>\n `${lines.length === 1 ? \"Line\" : \"Lines\"} ${lines.join(\", \")} highlighted`;\n\nexport interface CodeBlockProps {\n /** The code to show and copy. One final new line is not shown as an empty last line. */\n code: string;\n /** Shown in the header (when there is no `title`) and passed to `highlight`. */\n language?: string | undefined;\n /** A file name or caption for the header, e.g. \"vite.config.ts\". */\n title?: ReactNode;\n /**\n * Your highlighter, e.g. `(code, lang) => <span dangerouslySetInnerHTML={{ __html: shiki(code, lang) }} />`. Cynosure\n * bundles none. Without it the code is plain text.\n */\n highlight?: ((code: string, language?: string) => ReactNode) | undefined;\n /** Show line numbers beside the code. Left out when `wrap` is on. */\n lineNumbers?: boolean;\n /** Lines to mark (1-based), such as the line a debugger is on. Marked behind the text and read out. */\n activeLines?: readonly number[] | undefined;\n /** Wrap long lines instead of scrolling sideways (line numbers are then left out, as they would not line up). */\n wrap?: boolean;\n /** Show the copy button. Default true. */\n copyable?: boolean;\n /** Passed to the copy button (extensions can copy through their own channel). */\n copy?: ((text: string) => Promise<void> | void) | undefined;\n /** Text size of the code. Default \"md\". */\n size?: Size;\n /** Replace the built-in English text: the copy button, the code region's name and the marked lines. */\n labels?: Partial<CodeBlockLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-code-block-* tokens. */\n style?: CSSProperties;\n}\n\n/**\n * Code to read and copy: a header with the file name or language and a copy button, then the code with optional line\n * numbers. Bring your own highlighter through `highlight`.\n */\nexport function CodeBlock({\n code,\n language,\n title,\n highlight,\n lineNumbers = false,\n activeLines,\n wrap = false,\n copyable = true,\n copy,\n size = \"md\",\n labels,\n className,\n style,\n}: CodeBlockProps) {\n const id = useId();\n // One final new line is a file ending, not an empty last line.\n const shown = code.replace(/\\n$/, \"\");\n const lines = shown.split(\"\\n\");\n const name = typeof title === \"string\" ? title : (language ?? labels?.region ?? \"Code\");\n const heading = title ?? language;\n const numbered = lineNumbers && !wrap;\n const marked = !wrap && activeLines?.length ? activeLines.filter((n) => n >= 1 && n <= lines.length) : [];\n const body = (\n <code className=\"cy-code-block-code cy-reset\" data-language={language}>\n {highlight ? highlight(shown, language) : shown}\n </code>\n );\n return (\n <figure\n className={className ? `cy-code-block ${className}` : \"cy-code-block\"}\n data-size={size}\n data-wrap={wrap ? \"\" : undefined}\n aria-labelledby={heading ? `${id}-title` : undefined}\n aria-label={heading ? undefined : name}\n style={style}\n >\n {(heading || copyable) && (\n <div className=\"cy-code-block-header cy-reset\">\n <span className=\"cy-code-block-title cy-reset\" id={`${id}-title`}>\n {heading}\n </span>\n {copyable && (\n <CopyButton\n value={code}\n size=\"sm\"\n variant=\"ghost\"\n tooltipPlacement=\"start\"\n {...(copy ? { copy } : {})}\n {...(labels ? { labels } : {})}\n />\n )}\n </div>\n )}\n <div className=\"cy-code-block-body cy-reset\">\n {numbered && (\n <span className=\"cy-code-block-gutter cy-reset\" aria-hidden=\"true\">\n {lines.map((_, i) => (\n <span key={i} className=\"cy-reset\" data-active={marked.includes(i + 1) ? \"\" : undefined}>\n {i + 1}\n </span>\n ))}\n </span>\n )}\n {wrap ? (\n <pre className=\"cy-code-block-pre cy-reset\">{body}</pre>\n ) : (\n // A scrolling region must be reachable by keyboard: it is focusable and named.\n // biome-ignore lint/a11y/noNoninteractiveTabindex lint/a11y/useSemanticElements: the scrolling pre itself is the focusable, named region\n <pre className=\"cy-code-block-pre cy-reset\" tabIndex={0} role=\"region\" aria-label={name}>\n {marked.map((n) => (\n <span\n key={n}\n className=\"cy-code-block-mark cy-reset\"\n style={{ \"--_line\": n - 1 } as CSSProperties}\n aria-hidden=\"true\"\n />\n ))}\n {body}\n </pre>\n )}\n </div>\n {marked.length > 0 && (\n <span className=\"cy-visually-hidden\">{(labels?.active ?? defaultActive)(marked)}</span>\n )}\n </figure>\n );\n}\n"],"mappings":";;;;AA0BA,IAAMI,IAAA,CAAiBC,MACrB,GAAGA,EAAM,WAAW,IAAI,SAAS,OAAA,IAAWA,EAAM,KAAK,IAAI,CAAA;AAsC7D,SAAgBC,EAAU,EACxB,MAAAC,GACA,UAAAC,GACA,OAAAC,GACA,WAAAC,GACA,aAAAC,IAAc,IACd,aAAAC,GACA,MAAAC,IAAO,IACP,UAAAC,IAAW,IACX,MAAAC,GACA,MAAAC,IAAO,MACP,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACiB;AACjB,QAAMC,IAAKnB,EAAM,GAEXoB,IAAQd,EAAK,QAAQ,OAAO,EAAE,GAC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AAY;AAAA,UACzD,UAAAG,EAAM,IAAA,CAAKuB,GAAGC,MACb,gBAAA3B,EAAC,QAAD;AAAA,YAAc,WAAU;AAAA,YAAW,eAAauB,EAAO,SAASI,IAAI,CAAC,IAAI,KAAK;AAAA,YAC3E,UAAAA,IAAI;AAAA,UACD,GAFKA,CAEL,CACP;AAAA,QACG,CAAA,GAEPhB,IACC,gBAAAX,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAA8B,UAAAyB;AAAA,QAAU,CAAA,IAIvD,gBAAAxB,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAA6B,UAAU;AAAA,UAAG,MAAK;AAAA,UAAS,cAAYmB;AAAA,UAAnF,UAAA,CACGG,EAAO,IAAA,CAAKC,MACX,gBAAAxB,EAAC,QAAD;AAAA,YAEE,WAAU;AAAA,YACV,OAAO,EAAE,WAAWwB,IAAI,EAAE;AAAA,YAC1B,eAAY;AAAA,UACb,GAJMA,CAIN,CACF,GACAC,CACE;AAAA,QAEJ,CAAA,CAAA;AAAA,M;A,MACJF,EAAO,SAAS,KACf,gBAAAvB,EAAC,QAAD;AAAA,QAAM,WAAU;AAAA,QAAuB,WAAAe,GAAQ,UAAUb,GAAeqB,CAAM;AAAA,MAAQ,CAAA;AAAA,IAElF;AAAA,E;AAEZ"}
|
|
@@ -25,13 +25,19 @@ export interface ColorFieldLabels {
|
|
|
25
25
|
invalid: string;
|
|
26
26
|
}
|
|
27
27
|
export interface ColorFieldProps {
|
|
28
|
+
/** The field's label. */
|
|
28
29
|
label: ReactNode;
|
|
30
|
+
/** Visually hide the label (it still names the control). Prefer visible labels. */
|
|
29
31
|
labelHidden?: boolean;
|
|
32
|
+
/** Help text shown below the control and read with it. */
|
|
30
33
|
description?: ReactNode;
|
|
34
|
+
/** Your own error; it replaces the field's own messages. */
|
|
31
35
|
error?: ReactNode;
|
|
32
36
|
/** Any CSS colour; reported back in `format`. */
|
|
33
37
|
value?: string;
|
|
38
|
+
/** The starting colour when uncontrolled, any CSS colour. Default "black". */
|
|
34
39
|
defaultValue?: string;
|
|
40
|
+
/** Called when the colour changes (typed, picked or chosen from a swatch), with the colour written in `format`. */
|
|
35
41
|
onChange?: (value: string) => void;
|
|
36
42
|
/** How values are written: six-digit hex, `rgb(51 102 255)` or `oklch(55% 0.21 264)`. */
|
|
37
43
|
format?: "hex" | "rgb" | "oklch";
|
|
@@ -39,11 +45,17 @@ export interface ColorFieldProps {
|
|
|
39
45
|
alpha?: boolean;
|
|
40
46
|
/** Colours offered in the picker: brand colours, presets, or recent colours you keep. */
|
|
41
47
|
swatches?: (ColorSwatch | string)[] | undefined;
|
|
48
|
+
/** Name the colour is submitted under in a form, written in `format`. */
|
|
42
49
|
name?: string;
|
|
50
|
+
/** Marks the field as required and makes its input required in a form. */
|
|
43
51
|
required?: boolean;
|
|
52
|
+
/** Turns off the input and the picker; the colour is not submitted with a form. */
|
|
44
53
|
disabled?: boolean;
|
|
54
|
+
/** Size of the field. Default "md". */
|
|
45
55
|
size?: Size;
|
|
56
|
+
/** Replace the built-in English text: the picker's controls and the error for text that is not a colour. */
|
|
46
57
|
labels?: Partial<ColorFieldLabels>;
|
|
58
|
+
/** Added to the root element, for layout. */
|
|
47
59
|
className?: string;
|
|
48
60
|
/** Layout only. */
|
|
49
61
|
style?: CSSProperties;
|