@panneau/ui 5.0.0-alpha.1 → 5.0.0-alpha.10
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 +370 -14
- package/bin/check-theme.js +5 -0
- package/dist/alert/Alert.css +28 -42
- package/dist/alert/Alert.d.ts +19 -5
- package/dist/alert/Alert.d.ts.map +1 -1
- package/dist/alert/Alert.js +110 -41
- package/dist/alert/Alert.js.map +1 -1
- package/dist/alert/Alert.module.js +14 -16
- package/dist/alert/Alert.module.js.map +1 -1
- package/dist/alert/tokens.d.ts +3 -0
- package/dist/alert/tokens.d.ts.map +1 -0
- package/dist/alert/tokens.js +21 -0
- package/dist/alert/tokens.js.map +1 -0
- package/dist/badge/Badge.css +24 -36
- package/dist/badge/Badge.d.ts +18 -3
- package/dist/badge/Badge.d.ts.map +1 -1
- package/dist/badge/Badge.js +35 -6
- package/dist/badge/Badge.js.map +1 -1
- package/dist/badge/Badge.module.js +9 -13
- package/dist/badge/Badge.module.js.map +1 -1
- package/dist/badge/tokens.d.ts +3 -0
- package/dist/badge/tokens.d.ts.map +1 -0
- package/dist/badge/tokens.js +23 -0
- package/dist/badge/tokens.js.map +1 -0
- package/dist/button/Button.css +58 -42
- package/dist/button/Button.d.ts +32 -5
- package/dist/button/Button.d.ts.map +1 -1
- package/dist/button/Button.js +136 -17
- package/dist/button/Button.js.map +1 -1
- package/dist/button/Button.module.js +14 -14
- package/dist/button/Button.module.js.map +1 -1
- package/dist/button/tokens.d.ts +3 -0
- package/dist/button/tokens.d.ts.map +1 -0
- package/dist/button/tokens.js +25 -0
- package/dist/button/tokens.js.map +1 -0
- package/dist/card/Card.css +27 -20
- package/dist/card/Card.js +76 -23
- package/dist/card/Card.js.map +1 -1
- package/dist/card/Card.module.js +5 -5
- package/dist/card/Card.module.js.map +1 -1
- package/dist/card/tokens.d.ts +3 -0
- package/dist/card/tokens.d.ts.map +1 -0
- package/dist/card/tokens.js +31 -0
- package/dist/card/tokens.js.map +1 -0
- package/dist/checkbox/Checkbox.css +22 -21
- package/dist/checkbox/Checkbox.d.ts +1 -1
- package/dist/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/checkbox/Checkbox.js +87 -25
- package/dist/checkbox/Checkbox.js.map +1 -1
- package/dist/checkbox/Checkbox.module.js +6 -6
- package/dist/checkbox/Checkbox.module.js.map +1 -1
- package/dist/checkbox/ChoiceChrome.d.ts +3 -1
- package/dist/checkbox/ChoiceChrome.d.ts.map +1 -1
- package/dist/checkbox/ChoiceChrome.js +82 -21
- package/dist/checkbox/ChoiceChrome.js.map +1 -1
- package/dist/checkbox/tokens.d.ts +3 -0
- package/dist/checkbox/tokens.d.ts.map +1 -0
- package/dist/checkbox/tokens.js +21 -0
- package/dist/checkbox/tokens.js.map +1 -0
- package/dist/combo-box/ComboBox.css +4 -4
- package/dist/combo-box/ComboBox.d.ts +1 -1
- package/dist/combo-box/ComboBox.js +291 -79
- package/dist/combo-box/ComboBox.js.map +1 -1
- package/dist/combo-box/ComboBox.module.js +3 -3
- package/dist/command-palette/CommandPalette.css +299 -0
- package/dist/command-palette/CommandPalette.d.ts +37 -0
- package/dist/command-palette/CommandPalette.d.ts.map +1 -0
- package/dist/command-palette/CommandPalette.js +497 -0
- package/dist/command-palette/CommandPalette.js.map +1 -0
- package/dist/command-palette/CommandPalette.module.js +62 -0
- package/dist/command-palette/CommandPalette.module.js.map +1 -0
- package/dist/command-palette/match.d.ts +39 -0
- package/dist/command-palette/match.d.ts.map +1 -0
- package/dist/command-palette/match.js +44 -0
- package/dist/command-palette/match.js.map +1 -0
- package/dist/command-palette/tokens.d.ts +3 -0
- package/dist/command-palette/tokens.d.ts.map +1 -0
- package/dist/command-palette/tokens.js +23 -0
- package/dist/command-palette/tokens.js.map +1 -0
- package/dist/command-palette/useCommandShortcut.d.ts +12 -0
- package/dist/command-palette/useCommandShortcut.d.ts.map +1 -0
- package/dist/command-palette/useCommandShortcut.js +48 -0
- package/dist/command-palette/useCommandShortcut.js.map +1 -0
- package/dist/container/Container.css +32 -0
- package/dist/container/Container.d.ts +15 -0
- package/dist/container/Container.d.ts.map +1 -0
- package/dist/container/Container.js +61 -0
- package/dist/container/Container.js.map +1 -0
- package/dist/container/Container.module.js +20 -0
- package/dist/container/Container.module.js.map +1 -0
- package/dist/container/tokens.d.ts +3 -0
- package/dist/container/tokens.d.ts.map +1 -0
- package/dist/container/tokens.js +19 -0
- package/dist/container/tokens.js.map +1 -0
- package/dist/date-picker/DatePicker.css +70 -30
- package/dist/date-picker/DatePicker.d.ts +3 -2
- package/dist/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/date-picker/DatePicker.js +279 -72
- package/dist/date-picker/DatePicker.js.map +1 -1
- package/dist/date-picker/DatePicker.module.js +16 -12
- package/dist/date-picker/DatePicker.module.js.map +1 -1
- package/dist/date-picker/calendarTokens.d.ts +3 -0
- package/dist/date-picker/calendarTokens.d.ts.map +1 -0
- package/dist/date-picker/calendarTokens.js +17 -0
- package/dist/date-picker/calendarTokens.js.map +1 -0
- package/dist/dialog/Dialog.css +80 -37
- package/dist/dialog/Dialog.d.ts +15 -3
- package/dist/dialog/Dialog.d.ts.map +1 -1
- package/dist/dialog/Dialog.js +159 -30
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/Dialog.module.js +21 -13
- package/dist/dialog/Dialog.module.js.map +1 -1
- package/dist/dialog/tokens.d.ts +3 -0
- package/dist/dialog/tokens.d.ts.map +1 -0
- package/dist/dialog/tokens.js +31 -0
- package/dist/dialog/tokens.js.map +1 -0
- package/dist/disclosure/Disclosure.css +12 -12
- package/dist/disclosure/Disclosure.d.ts.map +1 -1
- package/dist/disclosure/Disclosure.js +132 -28
- package/dist/disclosure/Disclosure.js.map +1 -1
- package/dist/disclosure/Disclosure.module.js +7 -7
- package/dist/disclosure/Disclosure.module.js.map +1 -1
- package/dist/disclosure/tokens.d.ts +3 -0
- package/dist/disclosure/tokens.d.ts.map +1 -0
- package/dist/disclosure/tokens.js +15 -0
- package/dist/disclosure/tokens.js.map +1 -0
- package/dist/divider/Divider.css +17 -0
- package/dist/divider/Divider.d.ts +8 -0
- package/dist/divider/Divider.d.ts.map +1 -0
- package/dist/divider/Divider.js +65 -0
- package/dist/divider/Divider.js.map +1 -0
- package/dist/divider/Divider.module.js +12 -0
- package/dist/divider/Divider.module.js.map +1 -0
- package/dist/divider/tokens.d.ts +3 -0
- package/dist/divider/tokens.d.ts.map +1 -0
- package/dist/divider/tokens.js +13 -0
- package/dist/divider/tokens.js.map +1 -0
- package/dist/field/Field.css +49 -37
- package/dist/field/Field.module.js +11 -11
- package/dist/field/Field.module.js.map +1 -1
- package/dist/field/FieldParts.d.ts +1 -1
- package/dist/field/FieldParts.js +69 -15
- package/dist/field/FieldParts.js.map +1 -1
- package/dist/field/Fieldset.js +99 -32
- package/dist/field/Fieldset.js.map +1 -1
- package/dist/field/inputTokens.d.ts +3 -0
- package/dist/field/inputTokens.d.ts.map +1 -0
- package/dist/field/inputTokens.js +21 -0
- package/dist/field/inputTokens.js.map +1 -0
- package/dist/field/tokens.d.ts +3 -0
- package/dist/field/tokens.d.ts.map +1 -0
- package/dist/field/tokens.js +15 -0
- package/dist/field/tokens.js.map +1 -0
- package/dist/grid/Grid.css +174 -0
- package/dist/grid/Grid.d.ts +28 -0
- package/dist/grid/Grid.d.ts.map +1 -0
- package/dist/grid/Grid.js +140 -0
- package/dist/grid/Grid.js.map +1 -0
- package/dist/grid/Grid.module.js +12 -0
- package/dist/grid/Grid.module.js.map +1 -0
- package/dist/grid/GridItem.css +59 -0
- package/dist/grid/GridItem.module.js +7 -0
- package/dist/grid/GridItem.module.js.map +1 -0
- package/dist/grid/tokens.d.ts +3 -0
- package/dist/grid/tokens.d.ts.map +1 -0
- package/dist/grid/tokens.js +10 -0
- package/dist/grid/tokens.js.map +1 -0
- package/dist/heading/Heading.css +52 -0
- package/dist/heading/Heading.d.ts +17 -0
- package/dist/heading/Heading.d.ts.map +1 -0
- package/dist/heading/Heading.js +52 -0
- package/dist/heading/Heading.js.map +1 -0
- package/dist/heading/Heading.module.js +16 -0
- package/dist/heading/Heading.module.js.map +1 -0
- package/dist/heading/tokens.d.ts +6 -0
- package/dist/heading/tokens.d.ts.map +1 -0
- package/dist/heading/tokens.js +66 -0
- package/dist/heading/tokens.js.map +1 -0
- package/dist/icon/Icon.css +1 -1
- package/dist/icon/Icon.js +36 -11
- package/dist/icon/Icon.js.map +1 -1
- package/dist/icon/Icon.module.js +1 -1
- package/dist/icon/lucideIconLoader.d.ts +9 -0
- package/dist/icon/lucideIconLoader.d.ts.map +1 -0
- package/dist/icon/lucideIconLoader.js +22 -0
- package/dist/icon/lucideIconLoader.js.map +1 -0
- package/dist/icon/namedIcons.d.ts +16 -9
- package/dist/icon/namedIcons.d.ts.map +1 -1
- package/dist/icon/namedIcons.js +121 -46
- package/dist/icon/namedIcons.js.map +1 -1
- package/dist/icon-button/IconButton.css +2 -2
- package/dist/icon-button/IconButton.d.ts +3 -3
- package/dist/icon-button/IconButton.d.ts.map +1 -1
- package/dist/icon-button/IconButton.js +70 -13
- package/dist/icon-button/IconButton.js.map +1 -1
- package/dist/icon-button/IconButton.module.js +2 -2
- package/dist/index.d.ts +61 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -5
- package/dist/inline/Inline.css +142 -0
- package/dist/inline/Inline.d.ts +17 -0
- package/dist/inline/Inline.d.ts.map +1 -0
- package/dist/inline/Inline.js +79 -0
- package/dist/inline/Inline.js.map +1 -0
- package/dist/inline/Inline.module.js +12 -0
- package/dist/inline/Inline.module.js.map +1 -0
- package/dist/inline/tokens.d.ts +3 -0
- package/dist/inline/tokens.d.ts.map +1 -0
- package/dist/inline/tokens.js +10 -0
- package/dist/inline/tokens.js.map +1 -0
- package/dist/intl/usePanneauIntl.js.map +1 -1
- package/dist/layout/responsive.d.ts +38 -0
- package/dist/layout/responsive.d.ts.map +1 -0
- package/dist/layout/responsive.js +49 -0
- package/dist/layout/responsive.js.map +1 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/menu/Menu.css +84 -0
- package/dist/menu/Menu.d.ts +34 -7
- package/dist/menu/Menu.d.ts.map +1 -1
- package/dist/menu/Menu.js +243 -32
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/Menu.module.js +22 -0
- package/dist/menu/Menu.module.js.map +1 -0
- package/dist/menu/tokens.d.ts +3 -0
- package/dist/menu/tokens.d.ts.map +1 -0
- package/dist/menu/tokens.js +31 -0
- package/dist/menu/tokens.js.map +1 -0
- package/dist/named-icons/index.d.ts +2 -0
- package/dist/named-icons/index.d.ts.map +1 -0
- package/dist/named-icons/index.js +1 -0
- package/dist/number-input/NumberInput.css +30 -12
- package/dist/number-input/NumberInput.d.ts +1 -1
- package/dist/number-input/NumberInput.js +232 -60
- package/dist/number-input/NumberInput.js.map +1 -1
- package/dist/number-input/NumberInput.module.js +7 -5
- package/dist/number-input/NumberInput.module.js.map +1 -1
- package/dist/number-input/tokens.d.ts +3 -0
- package/dist/number-input/tokens.d.ts.map +1 -0
- package/dist/number-input/tokens.js +10 -0
- package/dist/number-input/tokens.js.map +1 -0
- package/dist/pill-trigger/PillTrigger.css +104 -0
- package/dist/pill-trigger/PillTrigger.d.ts +20 -0
- package/dist/pill-trigger/PillTrigger.d.ts.map +1 -0
- package/dist/pill-trigger/PillTrigger.js +94 -0
- package/dist/pill-trigger/PillTrigger.js.map +1 -0
- package/dist/pill-trigger/PillTrigger.module.js +18 -0
- package/dist/pill-trigger/PillTrigger.module.js.map +1 -0
- package/dist/pill-trigger/tokens.d.ts +3 -0
- package/dist/pill-trigger/tokens.d.ts.map +1 -0
- package/dist/pill-trigger/tokens.js +37 -0
- package/dist/pill-trigger/tokens.js.map +1 -0
- package/dist/popover/Popover.css +18 -12
- package/dist/popover/Popover.d.ts.map +1 -1
- package/dist/popover/Popover.js +116 -20
- package/dist/popover/Popover.js.map +1 -1
- package/dist/popover/Popover.module.js +7 -5
- package/dist/popover/Popover.module.js.map +1 -1
- package/dist/popover/tokens.d.ts +3 -0
- package/dist/popover/tokens.d.ts.map +1 -0
- package/dist/popover/tokens.js +19 -0
- package/dist/popover/tokens.js.map +1 -0
- package/dist/prose/Prose.css +141 -0
- package/dist/prose/Prose.d.ts +11 -0
- package/dist/prose/Prose.d.ts.map +1 -0
- package/dist/prose/Prose.js +49 -0
- package/dist/prose/Prose.js.map +1 -0
- package/dist/prose/Prose.module.js +8 -0
- package/dist/prose/Prose.module.js.map +1 -0
- package/dist/prose/tokens.d.ts +3 -0
- package/dist/prose/tokens.d.ts.map +1 -0
- package/dist/prose/tokens.js +33 -0
- package/dist/prose/tokens.js.map +1 -0
- package/dist/radio-group/RadioGroup.css +111 -20
- package/dist/radio-group/RadioGroup.d.ts +24 -5
- package/dist/radio-group/RadioGroup.d.ts.map +1 -1
- package/dist/radio-group/RadioGroup.js +214 -43
- package/dist/radio-group/RadioGroup.js.map +1 -1
- package/dist/radio-group/RadioGroup.module.js +18 -8
- package/dist/radio-group/RadioGroup.module.js.map +1 -1
- package/dist/radio-group/tokens.d.ts +3 -0
- package/dist/radio-group/tokens.d.ts.map +1 -0
- package/dist/radio-group/tokens.js +39 -0
- package/dist/radio-group/tokens.js.map +1 -0
- package/dist/root/PanneauRoot.css +243 -20
- package/dist/root/PanneauRoot.d.ts +57 -4
- package/dist/root/PanneauRoot.d.ts.map +1 -1
- package/dist/root/PanneauRoot.js +325 -46
- package/dist/root/PanneauRoot.js.map +1 -1
- package/dist/root/PanneauRoot.module.js +11 -3
- package/dist/root/PanneauRoot.module.js.map +1 -1
- package/dist/root/ThemeScope.d.ts +24 -0
- package/dist/root/ThemeScope.d.ts.map +1 -0
- package/dist/root/ThemeScope.js +132 -0
- package/dist/root/ThemeScope.js.map +1 -0
- package/dist/segmented-control/SegmentedControl.css +83 -0
- package/dist/segmented-control/SegmentedControl.d.ts +35 -0
- package/dist/segmented-control/SegmentedControl.d.ts.map +1 -0
- package/dist/segmented-control/SegmentedControl.js +142 -0
- package/dist/segmented-control/SegmentedControl.js.map +1 -0
- package/dist/segmented-control/SegmentedControl.module.js +16 -0
- package/dist/segmented-control/SegmentedControl.module.js.map +1 -0
- package/dist/segmented-control/tokens.d.ts +3 -0
- package/dist/segmented-control/tokens.d.ts.map +1 -0
- package/dist/segmented-control/tokens.js +29 -0
- package/dist/segmented-control/tokens.js.map +1 -0
- package/dist/select/ListBox.css +46 -23
- package/dist/select/ListBox.module.js +13 -13
- package/dist/select/ListBox.module.js.map +1 -1
- package/dist/select/Select.d.ts +1 -1
- package/dist/select/Select.js +298 -92
- package/dist/select/Select.js.map +1 -1
- package/dist/select/listBoxTokens.d.ts +3 -0
- package/dist/select/listBoxTokens.d.ts.map +1 -0
- package/dist/select/listBoxTokens.js +21 -0
- package/dist/select/listBoxTokens.js.map +1 -0
- package/dist/skeleton/LoadingRegion.d.ts +16 -0
- package/dist/skeleton/LoadingRegion.d.ts.map +1 -0
- package/dist/skeleton/LoadingRegion.js +65 -0
- package/dist/skeleton/LoadingRegion.js.map +1 -0
- package/dist/skeleton/Skeleton.css +62 -0
- package/dist/skeleton/Skeleton.d.ts +25 -0
- package/dist/skeleton/Skeleton.d.ts.map +1 -0
- package/dist/skeleton/Skeleton.js +106 -0
- package/dist/skeleton/Skeleton.js.map +1 -0
- package/dist/skeleton/Skeleton.module.js +22 -0
- package/dist/skeleton/Skeleton.module.js.map +1 -0
- package/dist/skeleton/tokens.d.ts +3 -0
- package/dist/skeleton/tokens.d.ts.map +1 -0
- package/dist/skeleton/tokens.js +15 -0
- package/dist/skeleton/tokens.js.map +1 -0
- package/dist/slider/Slider.css +84 -0
- package/dist/slider/Slider.d.ts +20 -0
- package/dist/slider/Slider.d.ts.map +1 -0
- package/dist/slider/Slider.js +248 -0
- package/dist/slider/Slider.js.map +1 -0
- package/dist/slider/Slider.module.js +20 -0
- package/dist/slider/Slider.module.js.map +1 -0
- package/dist/spinner/Spinner.css +8 -8
- package/dist/spinner/Spinner.js +49 -9
- package/dist/spinner/Spinner.js.map +1 -1
- package/dist/spinner/Spinner.module.js +5 -5
- package/dist/spinner/Spinner.module.js.map +1 -1
- package/dist/spinner/tokens.d.ts +3 -0
- package/dist/spinner/tokens.d.ts.map +1 -0
- package/dist/spinner/tokens.js +10 -0
- package/dist/spinner/tokens.js.map +1 -0
- package/dist/stack/Stack.css +135 -0
- package/dist/stack/Stack.d.ts +15 -0
- package/dist/stack/Stack.d.ts.map +1 -0
- package/dist/stack/Stack.js +74 -0
- package/dist/stack/Stack.js.map +1 -0
- package/dist/stack/Stack.module.js +8 -0
- package/dist/stack/Stack.module.js.map +1 -0
- package/dist/stack/tokens.d.ts +3 -0
- package/dist/stack/tokens.d.ts.map +1 -0
- package/dist/stack/tokens.js +10 -0
- package/dist/stack/tokens.js.map +1 -0
- package/dist/switch/Switch.css +34 -25
- package/dist/switch/Switch.d.ts +1 -1
- package/dist/switch/Switch.d.ts.map +1 -1
- package/dist/switch/Switch.js +69 -11
- package/dist/switch/Switch.js.map +1 -1
- package/dist/switch/Switch.module.js +6 -5
- package/dist/switch/Switch.module.js.map +1 -1
- package/dist/switch/tokens.d.ts +3 -0
- package/dist/switch/tokens.d.ts.map +1 -0
- package/dist/switch/tokens.js +25 -0
- package/dist/switch/tokens.js.map +1 -0
- package/dist/tabs/Tabs.css +24 -23
- package/dist/tabs/Tabs.js +5 -5
- package/dist/tabs/Tabs.js.map +1 -1
- package/dist/tabs/Tabs.module.js +4 -4
- package/dist/tabs/Tabs.module.js.map +1 -1
- package/dist/tabs/tokens.d.ts +3 -0
- package/dist/tabs/tokens.d.ts.map +1 -0
- package/dist/tabs/tokens.js +25 -0
- package/dist/tabs/tokens.js.map +1 -0
- package/dist/tags-input/TagsInput.css +60 -0
- package/dist/tags-input/TagsInput.d.ts +32 -0
- package/dist/tags-input/TagsInput.d.ts.map +1 -0
- package/dist/tags-input/TagsInput.js +316 -0
- package/dist/tags-input/TagsInput.js.map +1 -0
- package/dist/tags-input/TagsInput.module.js +20 -0
- package/dist/tags-input/TagsInput.module.js.map +1 -0
- package/dist/text/Text.css +74 -0
- package/dist/text/Text.d.ts +27 -0
- package/dist/text/Text.d.ts.map +1 -0
- package/dist/text/Text.js +81 -0
- package/dist/text/Text.js.map +1 -0
- package/dist/text/Text.module.js +30 -0
- package/dist/text/Text.module.js.map +1 -0
- package/dist/text/tokens.d.ts +3 -0
- package/dist/text/tokens.d.ts.map +1 -0
- package/dist/text/tokens.js +10 -0
- package/dist/text/tokens.js.map +1 -0
- package/dist/text-area/TextArea.css +1 -1
- package/dist/text-area/TextArea.d.ts +1 -1
- package/dist/text-area/TextArea.js +135 -28
- package/dist/text-area/TextArea.js.map +1 -1
- package/dist/text-area/TextArea.module.js +3 -3
- package/dist/text-area/TextArea.module.js.map +1 -1
- package/dist/text-input/TextInput.d.ts +1 -1
- package/dist/text-input/TextInput.d.ts.map +1 -1
- package/dist/text-input/TextInput.js +164 -47
- package/dist/text-input/TextInput.js.map +1 -1
- package/dist/theme/Tone.css +70 -0
- package/dist/theme/Tone.module.js +20 -0
- package/dist/theme/Tone.module.js.map +1 -0
- package/dist/theme/bootstrap.d.ts +11 -1
- package/dist/theme/bootstrap.d.ts.map +1 -1
- package/dist/theme/bootstrap.js +48 -5
- package/dist/theme/bootstrap.js.map +1 -1
- package/dist/theme/chartColors.d.ts +23 -0
- package/dist/theme/chartColors.d.ts.map +1 -0
- package/dist/theme/chartColors.js +27 -0
- package/dist/theme/chartColors.js.map +1 -0
- package/dist/theme/checkTheme.d.ts +39 -0
- package/dist/theme/checkTheme.d.ts.map +1 -0
- package/dist/theme/checkTheme.js +132 -0
- package/dist/theme/checkTheme.js.map +1 -0
- package/dist/theme/cli.d.ts +14 -0
- package/dist/theme/cli.d.ts.map +1 -0
- package/dist/theme/cli.js +61 -0
- package/dist/theme/cli.js.map +1 -0
- package/dist/theme/color.d.ts +30 -0
- package/dist/theme/color.d.ts.map +1 -0
- package/dist/theme/color.js +94 -0
- package/dist/theme/color.js.map +1 -0
- package/dist/theme/colorVision.d.ts +23 -0
- package/dist/theme/colorVision.d.ts.map +1 -0
- package/dist/theme/colorVision.js +140 -0
- package/dist/theme/colorVision.js.map +1 -0
- package/dist/theme/componentTokens.d.ts +24 -0
- package/dist/theme/componentTokens.d.ts.map +1 -0
- package/dist/theme/componentTokens.js +20 -0
- package/dist/theme/componentTokens.js.map +1 -0
- package/dist/theme/components.d.ts +43 -0
- package/dist/theme/components.d.ts.map +1 -0
- package/dist/theme/components.js +75 -0
- package/dist/theme/components.js.map +1 -0
- package/dist/theme/defineTheme.d.ts +85 -0
- package/dist/theme/defineTheme.d.ts.map +1 -0
- package/dist/theme/defineTheme.js +130 -0
- package/dist/theme/defineTheme.js.map +1 -0
- package/dist/theme/fonts.d.ts +32 -0
- package/dist/theme/fonts.d.ts.map +1 -0
- package/dist/theme/fonts.js +36 -0
- package/dist/theme/fonts.js.map +1 -0
- package/dist/theme/index.d.ts +13 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +10 -0
- package/dist/theme/semanticTokens.d.ts +9 -0
- package/dist/theme/semanticTokens.d.ts.map +1 -0
- package/dist/theme/semanticTokens.js +110 -0
- package/dist/theme/semanticTokens.js.map +1 -0
- package/dist/theme/theme.d.ts +61 -7
- package/dist/theme/theme.d.ts.map +1 -1
- package/dist/theme/theme.js +100 -10
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/toneClass.d.ts +8 -0
- package/dist/theme/toneClass.d.ts.map +1 -0
- package/dist/theme/toneClass.js +15 -0
- package/dist/theme/toneClass.js.map +1 -0
- package/dist/theme/tones.d.ts +89 -0
- package/dist/theme/tones.d.ts.map +1 -0
- package/dist/theme/tones.js +127 -0
- package/dist/theme/tones.js.map +1 -0
- package/dist/time-input/TimeInput.d.ts +1 -1
- package/dist/time-input/TimeInput.js +138 -31
- package/dist/time-input/TimeInput.js.map +1 -1
- package/dist/toast/Toast.css +22 -44
- package/dist/toast/Toast.d.ts +5 -3
- package/dist/toast/Toast.d.ts.map +1 -1
- package/dist/toast/Toast.js +5 -4
- package/dist/toast/Toast.js.map +1 -1
- package/dist/toast/Toast.module.js +10 -16
- package/dist/toast/Toast.module.js.map +1 -1
- package/dist/toast/tokens.d.ts +3 -0
- package/dist/toast/tokens.d.ts.map +1 -0
- package/dist/toast/tokens.js +21 -0
- package/dist/toast/tokens.js.map +1 -0
- package/dist/tooltip/Tooltip.css +12 -11
- package/dist/tooltip/Tooltip.js +38 -8
- package/dist/tooltip/Tooltip.js.map +1 -1
- package/dist/tooltip/Tooltip.module.js +2 -2
- package/dist/tooltip/Tooltip.module.js.map +1 -1
- package/dist/tooltip/tokens.d.ts +3 -0
- package/dist/tooltip/tokens.d.ts.map +1 -0
- package/dist/tooltip/tokens.js +21 -0
- package/dist/tooltip/tokens.js.map +1 -0
- package/dist/utils/cx.d.ts +1 -1
- package/dist/utils/cx.d.ts.map +1 -1
- package/dist/utils/cx.js +2 -2
- package/dist/utils/cx.js.map +1 -1
- package/dist/utils/events.d.ts +4 -0
- package/dist/utils/events.d.ts.map +1 -0
- package/dist/utils/events.js +9 -0
- package/dist/utils/events.js.map +1 -0
- package/package.json +22 -5
package/README.md
CHANGED
|
@@ -15,45 +15,401 @@ import { Button, PanneauRoot, TextInput, bootstrapTheme } from '@panneau/ui';
|
|
|
15
15
|
</PanneauRoot>;
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
| Export
|
|
19
|
-
|
|
|
20
|
-
| `@panneau/ui`
|
|
21
|
-
| `@panneau/ui/
|
|
18
|
+
| Export | Content |
|
|
19
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
20
|
+
| `@panneau/ui` | `PanneauRoot`, themes, the primitives, `Icon`, `getNamedIcon()`, `useToast()`, `usePanneauIntl()` |
|
|
21
|
+
| `@panneau/ui/named-icons` | `lucideIconLoader`: loads any Lucide icon by name, for `PanneauRoot`'s `iconLoader` |
|
|
22
|
+
| `@panneau/ui/theme` | Themes as data, without components or CSS, for Node: `defineTheme()`, `checkTheme()`, `bootstrapTheme`… |
|
|
23
|
+
| `@panneau/ui/locales` | Deprecated: the UI messages by locale, `en` and `fr`. Use `@panneau/intl` |
|
|
22
24
|
|
|
23
25
|
## Root, tokens and themes
|
|
24
26
|
|
|
25
27
|
Every Panneau interface renders inside a `PanneauRoot`. It scopes the base stylesheet and the design tokens (`--panneau-*` CSS variables) to its element: Panneau adds no global CSS to the page. Overlays (dialogs, popovers, menus, tooltips) and toasts render inside it too.
|
|
26
28
|
|
|
27
29
|
- `colorScheme`: `light` (default), `dark`, or `auto`, which follows the system.
|
|
28
|
-
- `
|
|
30
|
+
- `density`: `compact`, `comfortable`, `touch`, or `auto` (default), which is `touch` on touch screens and `comfortable` otherwise. See [Density](#density).
|
|
31
|
+
- `theme`: tokens, tones and variants that override the default theme (see [Defining themes](#defining-themes)). `bootstrapTheme` follows a site's Bootstrap 5.3 variables and color mode.
|
|
29
32
|
- A project can also override any token with its own class on the root: `.my-panneau { --panneau-color-accent: #0a58ca; }`.
|
|
30
33
|
|
|
31
34
|
The default theme and the icon set are explained in [decision 0020](../../docs/decisions/0020-default-theme-and-icons.md).
|
|
32
35
|
|
|
36
|
+
### Scopes
|
|
37
|
+
|
|
38
|
+
`ThemeScope` applies a theme, a color scheme or a density to part of the page, like `data-bs-theme` on any element, without a new root:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<PanneauRoot theme={brand}>
|
|
42
|
+
<ThemeScope as="aside" colorScheme="dark">
|
|
43
|
+
<Navigation />
|
|
44
|
+
</ThemeScope>
|
|
45
|
+
<ThemeScope density="compact">
|
|
46
|
+
<ListView />
|
|
47
|
+
</ThemeScope>
|
|
48
|
+
</PanneauRoot>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
What a scope doesn't set comes from around it: a scope with only a density keeps the colors of the root's theme. Overlays opened inside a scope (dialogs, popovers, menus) render in its own container and keep its tokens. Custom color schemes, beyond light and dark, are themes applied to a scope.
|
|
52
|
+
|
|
53
|
+
### Component tokens
|
|
54
|
+
|
|
55
|
+
Every component reads its own tokens, `--panneau-<component>-<token>`, which default to semantic tokens. Set one to restyle a single component, in a theme, on the root, or on any element around the components:
|
|
56
|
+
|
|
57
|
+
```css
|
|
58
|
+
.my-panneau {
|
|
59
|
+
--panneau-badge-radius: var(--panneau-radius-sm); /* square badges, nothing else changes */
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.my-toolbar {
|
|
63
|
+
--panneau-button-padding-x: var(--panneau-space-2);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`componentTokens` lists every component token and its default, by component, and `ComponentTokenName` is their type. Some tokens style parts that several components share:
|
|
68
|
+
|
|
69
|
+
- `input`: the box of text inputs, selects, combo boxes and pickers;
|
|
70
|
+
- `field`: labels, descriptions and errors;
|
|
71
|
+
- `list-box`: options of selects, combo boxes and menus;
|
|
72
|
+
- `calendar`.
|
|
73
|
+
|
|
74
|
+
### Tones and appearances
|
|
75
|
+
|
|
76
|
+
Components with a color take a `tone`, like Bootstrap's theme colors: `neutral`, `accent`, `success`, `warning`, `danger` and `info` are built in. `Button`, `Badge` and `Alert` also take an `appearance` (`solid`, `outline`, `subtle`, and `ghost` for buttons):
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<Button tone="accent">Save</Button>
|
|
80
|
+
<Button tone="danger" appearance="outline">Remove</Button>
|
|
81
|
+
<Badge tone="success">Published</Badge>
|
|
82
|
+
<Alert tone="warning" appearance="solid" title="Scheduled" />
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The `variant` values of `Button` (`primary`, `secondary`, `ghost`, `danger`) are deprecated aliases of a tone and an appearance.
|
|
86
|
+
|
|
87
|
+
A theme adds tones, from one color (Panneau derives a readable text color, the hover, the subtle background and the border) or with every value, and named variants of components:
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
const theme = defineTheme({
|
|
91
|
+
tones: { signal: '#f25c05' },
|
|
92
|
+
components: {
|
|
93
|
+
badge: { variants: { tag: { 'panneau-badge-radius': 'var(--panneau-radius-sm)' } } },
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
declare module '@panneau/ui' {
|
|
98
|
+
interface PanneauTones {
|
|
99
|
+
signal: true;
|
|
100
|
+
}
|
|
101
|
+
interface BadgeVariants {
|
|
102
|
+
tag: true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
<Badge tone="signal" variant="tag">
|
|
107
|
+
Live
|
|
108
|
+
</Badge>;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`checkTheme(theme)` reports the colors of a theme that miss their contrast ratio (4.5:1 for text, 3:1 for control borders), like Bootstrap's `$min-contrast-ratio`. It follows references to the theme's palette and tokens.
|
|
112
|
+
|
|
113
|
+
### Defining themes
|
|
114
|
+
|
|
115
|
+
`defineTheme()` declares a theme. TypeScript checks the name of every token, semantic or component, and the console reports unknown names in Panneau's namespaces (`panneau-color-txt`), such as typos in a theme loaded from JSON. A theme can name its raw colors once in a `palette`, written as `--panneau-palette-<name>`, and build on other themes with `extends`:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { bootstrapTheme, defineTheme } from '@panneau/ui';
|
|
119
|
+
|
|
120
|
+
const brand = defineTheme({
|
|
121
|
+
label: 'Brand',
|
|
122
|
+
palette: { orange: '#f25c05', ink: '#1c1917' },
|
|
123
|
+
tokens: {
|
|
124
|
+
'panneau-color-accent': 'var(--panneau-palette-ink)',
|
|
125
|
+
'panneau-button-radius': '0',
|
|
126
|
+
},
|
|
127
|
+
dark: { 'panneau-color-accent': '#fafaf9' },
|
|
128
|
+
tones: { signal: 'var(--panneau-palette-orange)' },
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// A variation: the same theme, more compact.
|
|
132
|
+
const compact = defineTheme({ extends: brand, tokens: { 'panneau-control-height': '2rem' } });
|
|
133
|
+
|
|
134
|
+
// The brand theme, on a site that uses Bootstrap.
|
|
135
|
+
const onBootstrap = defineTheme({ extends: [bootstrapTheme, brand] });
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Values merge in this order, each overriding the ones before: the default theme, the themes a theme `extends` (in order), the theme itself, then a project's own class on the root. A token set in `tokens` but not in `dark` applies to both schemes, so it also replaces the dark value of the themes it extends. `mergeThemes()` merges themes the same way.
|
|
139
|
+
|
|
140
|
+
`defineTheme()` returns a plain `Theme`: themes are data. They can be written as JSON files, with the [`theme.schema.json`](../protocol/schema/theme.schema.json) of `@panneau/protocol`, registered by plugins of `@panneau/core`, and carried by the definition, whose `theme` extends themes of plugins by id. Tokens of a project's own components are declared in `PanneauTokens`:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
declare module '@panneau/ui' {
|
|
144
|
+
interface PanneauTokens {
|
|
145
|
+
'panneau-map-marker-color': true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`SEMANTIC_TOKENS` lists the semantic tokens, `componentTokens` the component tokens.
|
|
151
|
+
|
|
152
|
+
### Typography and fonts
|
|
153
|
+
|
|
154
|
+
The theme has four font roles: `--panneau-font-family-body`, `-heading` (the body's by default), `-display` (the heading's by default) and `-mono`. `--panneau-font-family` is a deprecated alias of the body family: set `-body` instead, so that headings follow it. `--panneau-font-numeric` (`tabular-nums`) lines up digits in stats, dates and tables.
|
|
155
|
+
|
|
156
|
+
Panneau styles no element beyond its reset, since it is often embedded in someone else's page. Three components apply the typography of the theme:
|
|
157
|
+
|
|
158
|
+
- `Heading`: a `level` (`h1`–`h6`, 2 by default) and a visual `size`, independent of it: `1` to `4`, `display-1` and `display-2`, like Bootstrap's `.h1` and `.display-1`. Its tokens (`--panneau-heading-1-font-size`, `--panneau-heading-display-1-font-weight`…) set the size, weight, line height and letter spacing of each size.
|
|
159
|
+
- `Text`: `size` (`xs` to `xl`), `weight`, `family` (a font role), `tone`, `muted`, `numeric` and `truncate`, as a `p` by default (`as="span"`).
|
|
160
|
+
- `Prose`: styles the elements of rich content inside it (headings, lists, links, quotes, code, tables), such as the output of an editor or Markdown.
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
<Heading level={1} size="display-2">
|
|
164
|
+
1,204 pages
|
|
165
|
+
</Heading>
|
|
166
|
+
<Text muted size="sm">
|
|
167
|
+
Updated today
|
|
168
|
+
</Text>
|
|
169
|
+
<Prose dangerouslySetInnerHTML={{ __html: page.body }} />
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
A theme declares its fonts: font faces, written as `@font-face` rules, or a hosted stylesheet. `PanneauRoot` adds them to the page once, however many roots use the theme.
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
const editorial = defineTheme({
|
|
176
|
+
fonts: [
|
|
177
|
+
{ family: 'Geist', src: "url(/fonts/geist.woff2) format('woff2')", weight: '100 900' },
|
|
178
|
+
{ stylesheet: 'https://fonts.googleapis.com/css2?family=Fraunces:wght@600&display=swap' },
|
|
179
|
+
],
|
|
180
|
+
tokens: {
|
|
181
|
+
'panneau-font-family-body': 'Geist, system-ui, sans-serif',
|
|
182
|
+
'panneau-font-family-heading': 'Fraunces, Georgia, serif',
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Layout
|
|
188
|
+
|
|
189
|
+
Five primitives lay out content with the space scale of the theme, without utility classes:
|
|
190
|
+
|
|
191
|
+
- `Stack`: items one under the other, like Bootstrap's `.vstack`;
|
|
192
|
+
- `Inline`: items side by side, wrapping when they don't fit, like `.hstack`;
|
|
193
|
+
- `Grid` and `GridItem`: equal columns (`columns`), or as many as fit (`minItemWidth="16rem"`), and cells that span several columns (`span`, or `span="full"`);
|
|
194
|
+
- `Container`: a centered column with a maximum width (`size`: `sm`, `md`, `lg` by default, `xl` or `full`);
|
|
195
|
+
- `Divider`: a line between groups, horizontal or vertical.
|
|
196
|
+
|
|
197
|
+
`gap` takes a step of the space scale (`gap={2}` is `--panneau-space-2`), and `align` and `justify` the alignment of the items. These props, `columns` and `span` are **responsive**: a value, or values by breakpoint, each applying from its breakpoint up.
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
<Container>
|
|
201
|
+
<Grid columns={{ base: 1, md: 2, lg: 3 }} gap={{ base: 3, lg: 4 }}>
|
|
202
|
+
<GridItem span={{ base: 1, lg: 'full' }}>
|
|
203
|
+
<Card title="Summary" />
|
|
204
|
+
</GridItem>
|
|
205
|
+
<Card title="Pages" />
|
|
206
|
+
<Card title="Articles" />
|
|
207
|
+
</Grid>
|
|
208
|
+
</Container>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Breakpoints (`BREAKPOINTS`) are `sm` 40rem, `md` 48rem, `lg` 64rem and `xl` 80rem, like `$grid-breakpoints`. They are widths of the nearest **size container**, not of the viewport, so that a grid in a narrow sidebar behaves as on a phone. `PanneauRoot` and `Container` are size containers, as are forms and lists. A size container takes its width from its parent, never from its content: in a flex row or a float, give the root a width, or it collapses.
|
|
212
|
+
|
|
213
|
+
Responsive values are inline CSS variables, read by static rules in each container query: no styles are generated per instance.
|
|
214
|
+
|
|
215
|
+
### Density
|
|
216
|
+
|
|
217
|
+
A density is a set of tokens: `--panneau-control-height` and `-sm`, `--panneau-font-size-control`, `--panneau-control-padding-x` (inputs and buttons) and `--panneau-row-padding-y` (rows of tables, options of lists). The `density` of the root picks one, and the `size` props of components (`size="sm"`) stay relative to it.
|
|
218
|
+
|
|
219
|
+
A theme redefines a density in `densities`. Density tokens set in `tokens` instead apply to every density, which then no longer changes them.
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
const roomy = defineTheme({
|
|
223
|
+
densities: {
|
|
224
|
+
comfortable: { 'panneau-control-height': '2.5rem' },
|
|
225
|
+
compact: { 'panneau-row-padding-y': '0.125rem' },
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Chart colors
|
|
231
|
+
|
|
232
|
+
Charts (dashboard widgets, reports) use only the chart tokens of the theme, in both schemes:
|
|
233
|
+
|
|
234
|
+
- `--panneau-chart-categorical-1` to `-8`: series, in a fixed order;
|
|
235
|
+
- `--panneau-chart-sequential-1` to `-5`: a ramp from low to high, for quantities;
|
|
236
|
+
- `--panneau-chart-diverging-negative`, `-neutral` and `-positive`: values below and above a reference.
|
|
237
|
+
|
|
238
|
+
`chartColors` gives them as CSS variables for `fill` and `stroke`, so that charts follow the theme, the color scheme and the scope:
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
<rect fill={chartColors.categorical(index)} />
|
|
242
|
+
<rect fill={chartColors.sequential(5)} />
|
|
243
|
+
<rect fill={chartColors.diverging.negative} />
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Each default categorical color reaches 3:1 against the surface (WCAG non-text contrast), and the eight stay distinct for people with protanopia, deuteranopia or tritanopia: a test checks it. `checkTheme()` runs the same checks on the chart colors a theme sets, and `checkColorDifferences(colors)` on any palette.
|
|
247
|
+
|
|
248
|
+
### Checking a theme
|
|
249
|
+
|
|
250
|
+
`checkTheme(theme)` reports what a theme makes hard to read: text tokens against backgrounds (4.5:1), control borders and chart colors (3:1), the text of each tone on the surface and on its subtle background, and categorical chart colors that look alike with a color vision deficiency. The `panneau-check-theme` command runs it on a JSON theme or on an export of a module, and exits with 1 when a check fails, for CI:
|
|
251
|
+
|
|
252
|
+
```sh
|
|
253
|
+
npx panneau-check-theme themes/brand.json
|
|
254
|
+
npx panneau-check-theme src/theme.mjs --export brand --json
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
`@panneau/ui/theme` exports the theme functions without components or CSS, so that Node scripts (a build step, a backend that stores themes) can import them.
|
|
258
|
+
|
|
259
|
+
### Bootstrap
|
|
260
|
+
|
|
261
|
+
`bootstrapTheme` maps Panneau's tokens to the CSS variables of Bootstrap 5.3: colors, fonts, radii, shadows, the color mode (`data-bs-theme`), and the size of controls in the comfortable density. Bootstrap's theme colors become tones: `accent` is `primary`, and `primary` and `secondary` keep their names. `bootstrapTone(color)` turns any theme color of a site, custom ones included, into a tone:
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
const site = defineTheme({ extends: bootstrapTheme, tones: { brand: bootstrapTone('brand') } });
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Bootstrap 5.3 declares the variables of its components (`--bs-btn-*`, `--bs-card-*`) on their classes, where Panneau's components can't read them: `bootstrapTheme` maps component tokens to the root variables those default to (`--bs-border-radius`, `--bs-border-color-translucent`, `--bs-heading-color`).
|
|
268
|
+
|
|
269
|
+
### Classes
|
|
270
|
+
|
|
271
|
+
Class names are stable and readable, without a hash, like Bootstrap's: target them in a project's CSS.
|
|
272
|
+
|
|
273
|
+
- The root of every component has `panneau-<component>`: `.panneau-button`, `.panneau-badge`, `.panneau-text-input`, `.panneau-card`.
|
|
274
|
+
- Its parts and modifiers are `panneau-<component>-<name>`: `.panneau-card-header`, `.panneau-button-sm`.
|
|
275
|
+
- States use standard attributes: ARIA (`[aria-invalid]`, `[aria-expanded]`, `[aria-selected]`…) and the state attributes of React Aria Components (`[data-hovered]`, `[data-focus-visible]`…).
|
|
276
|
+
|
|
277
|
+
```css
|
|
278
|
+
.my-panneau .panneau-badge {
|
|
279
|
+
letter-spacing: 0.02em;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.my-panneau .panneau-text-input [aria-invalid='true'] {
|
|
283
|
+
background-color: #fff5f5;
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
[`api/ui.classes.md`](api/ui.classes.md) lists every class. They are public API: a rename is a breaking change.
|
|
288
|
+
|
|
289
|
+
The theme model is described in [decision 0024](../../docs/decisions/0024-theme-model.md).
|
|
290
|
+
|
|
291
|
+
### Content Security Policy
|
|
292
|
+
|
|
293
|
+
Panneau runs under a strict Content Security Policy: it never needs `'unsafe-eval'` or inline scripts. For styles:
|
|
294
|
+
|
|
295
|
+
- **CSS Modules** are files of the packages, that the project's bundler serves as its other stylesheets (`style-src 'self'`).
|
|
296
|
+
- **Themes and fonts** are `<style>` elements (and a `<link>` for each font stylesheet) that `PanneauRoot` writes from the theme. With a policy without `'unsafe-inline'`, give them the page's nonce: `<PanneauRoot nonce={nonce}>`, or `nonce` of `<Panneau>` and `createPanneauApp()`. Without it, Panneau reads the nonce where React Aria does: `<meta property="csp-nonce" content="…">`, then `__webpack_nonce__`. The default theme writes no `<style>`.
|
|
297
|
+
- **React Aria** adds one `<style>` (`react-aria-pressable-style`) with the same nonce.
|
|
298
|
+
- **Inline `style` attributes** that components set (widths of progress bars, positions of popovers) go through the CSSOM, which `style-src` doesn't block.
|
|
299
|
+
|
|
300
|
+
```html
|
|
301
|
+
<meta property="csp-nonce" content="{{ $nonce }}" />
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
```text
|
|
305
|
+
Content-Security-Policy: default-src 'self'; style-src 'self' 'nonce-{{ $nonce }}'; img-src 'self' data: https:
|
|
306
|
+
```
|
|
307
|
+
|
|
33
308
|
## Primitives
|
|
34
309
|
|
|
35
|
-
`Button`, `IconButton`, `TextInput`, `TextArea`, `NumberInput`, `Select` (single or multiple), `ComboBox`, `Checkbox`, `Switch`, `RadioGroup`, `DatePicker`, `TimeInput`, `Fieldset`, `Dialog`, `Popover`, `Menu`, `Tabs`, `Tooltip`, toasts (`useToast()`), `Alert`, `Badge`, `Spinner`, `Card`, `Disclosure` and `Icon`.
|
|
310
|
+
`Heading`, `Text`, `Prose`, `Stack`, `Inline`, `Grid`, `Container`, `Divider`, `Button`, `IconButton`, `TextInput`, `TextArea`, `NumberInput`, `Slider`, `TagsInput`, `Select` (single or multiple), `ComboBox`, `Checkbox`, `Switch`, `RadioGroup`, `SegmentedControl`, `DatePicker`, `TimeInput`, `Fieldset`, `Dialog`, `Popover`, `Menu`, `PillTrigger`, `Tabs`, `Tooltip`, toasts (`useToast()`), `Alert`, `Badge`, `Spinner`, `Skeleton`, `LoadingRegion`, `Card`, `Disclosure` and `Icon`.
|
|
36
311
|
|
|
37
312
|
- Every component accepts `className`, and `xxxClassName` props for its inner elements (`labelClassName`, `inputClassName`…).
|
|
38
313
|
- Labelled controls take `label`, `description` and `errors` (a list of messages: any message makes the control invalid and describes it).
|
|
39
|
-
- They work on phones: larger touch targets on touch screens, dialogs as bottom sheets, scrolling tabs.
|
|
314
|
+
- They work on phones: larger touch targets on touch screens, dialogs as bottom sheets (or the whole screen, with `fullScreenOnPhone`), scrolling tabs.
|
|
315
|
+
|
|
316
|
+
### Rich choices
|
|
317
|
+
|
|
318
|
+
Picking one item among a few rich ones, such as an account (an avatar, a name, a handle), a plan or a template, takes a menu or radio cards.
|
|
319
|
+
|
|
320
|
+
- **`Menu`** groups its items in `MenuSection`s, whose `title` is a small muted eyebrow that labels the group, and takes a `footer`: a short note under the items, after a line, which describes the menu and can't be focused. With `selectionMode` (`single` or `multiple`) and `selectedKeys`, its items are radio or checkbox items, and the selected ones have a check at their end and a sunken background.
|
|
321
|
+
- **`MenuItem`** takes a leading `media` (an avatar or an image) instead of an `icon`: larger when the item has a `description`, and clipped to a circle by default (`--panneau-menu-media-radius`).
|
|
322
|
+
- **`PillTrigger`** is a compact rounded button that shows the current value, with an optional leading `media` and a chevron, for a `MenuTrigger` or a `PopoverTrigger`. Its accessible name is its value: give it an `aria-label` that contains the value when the value alone doesn't say what it picks.
|
|
323
|
+
|
|
324
|
+
```tsx
|
|
325
|
+
<MenuTrigger>
|
|
326
|
+
<PillTrigger size="sm" media={<Avatar user={account} />}>
|
|
327
|
+
{account.name}
|
|
328
|
+
</PillTrigger>
|
|
329
|
+
<Menu
|
|
330
|
+
aria-label="Accounts"
|
|
331
|
+
selectionMode="single"
|
|
332
|
+
selectedKeys={[account.id]}
|
|
333
|
+
onSelectionChange={(keys) => keys !== 'all' && onChange([...keys][0])}
|
|
334
|
+
footer="Only this step changes."
|
|
335
|
+
>
|
|
336
|
+
<MenuSection title="Publish on">
|
|
337
|
+
{accounts.map((item) => (
|
|
338
|
+
<MenuItem
|
|
339
|
+
key={item.id}
|
|
340
|
+
id={item.id}
|
|
341
|
+
media={<Avatar user={item} />}
|
|
342
|
+
description={item.handle}
|
|
343
|
+
>
|
|
344
|
+
{item.name}
|
|
345
|
+
</MenuItem>
|
|
346
|
+
))}
|
|
347
|
+
</MenuSection>
|
|
348
|
+
</Menu>
|
|
349
|
+
</MenuTrigger>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
- **`RadioGroup`** with `appearance="cards"` shows its options as bordered cards in a grid of `columns` (2 by default): each card has the radio, the option's `media`, its label and its description, and the selected card has a stronger border. The grid is a size container of its own, and becomes a single column when it is narrower than 28rem. Keyboard and focus work as in a list of radios.
|
|
353
|
+
|
|
354
|
+
```tsx
|
|
355
|
+
<RadioGroup
|
|
356
|
+
label="Publish on"
|
|
357
|
+
appearance="cards"
|
|
358
|
+
options={accounts.map((item) => ({
|
|
359
|
+
value: item.id,
|
|
360
|
+
label: item.name,
|
|
361
|
+
description: item.handle,
|
|
362
|
+
media: <Avatar user={item} />,
|
|
363
|
+
}))}
|
|
364
|
+
value={accountId}
|
|
365
|
+
onChange={setAccountId}
|
|
366
|
+
/>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Loading
|
|
370
|
+
|
|
371
|
+
Content that loads shows a skeleton of its shape, never a spinner in its place ([decision 0034](../../docs/decisions/0034-skeletons-while-content-loads.md)). Spinners are for operations in progress (`Button` `isPending`) and lookups inside a control (`ComboBox` `isLoading`).
|
|
372
|
+
|
|
373
|
+
- `Skeleton` is a block of the shape to come: a line of text (`lines` for several, the last one shorter), a `rect` with a `width`, a `height` or an `aspectRatio`, or a `circle`. It is `aria-hidden`, pulses unless the user prefers reduced motion, and reads the `skeleton` component tokens (`color`, `radius`, `duration`).
|
|
374
|
+
- `LoadingRegion` goes around the skeleton, in place of the content: it has `aria-busy="true"`, and a status message says once that the content loads (`label`, "Loading…" by default).
|
|
375
|
+
|
|
376
|
+
```tsx
|
|
377
|
+
function ArticleCard({ article }: { article: Article | undefined }) {
|
|
378
|
+
if (article === undefined) {
|
|
379
|
+
return (
|
|
380
|
+
<LoadingRegion label="Loading the article…">
|
|
381
|
+
<Skeleton shape="rect" aspectRatio="16 / 9" />
|
|
382
|
+
<Skeleton lines={3} />
|
|
383
|
+
</LoadingRegion>
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
return <ArticleView article={article} />;
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
A skeleton never replaces content already shown: while it is fetched again, it stays, dimmed, with `aria-busy`, as in lists.
|
|
40
391
|
|
|
41
392
|
## Icons
|
|
42
393
|
|
|
43
394
|
Components take icons as components: any Lucide icon (`icon={Pencil}`), or a component with the same props.
|
|
44
395
|
|
|
45
|
-
Definitions name their icons (`"icon": "send"`, a name of [lucide.dev/icons](https://lucide.dev/icons)). `getNamedIcon(name)` turns a name into an icon component that goes wherever an icon component goes
|
|
396
|
+
Definitions name their icons (`"icon": "send"`, a name of [lucide.dev/icons](https://lucide.dev/icons)). `getNamedIcon(name)` turns a name into an icon component that goes wherever an icon component goes, and loads it with the `iconLoader` of `PanneauRoot`:
|
|
46
397
|
|
|
47
398
|
```tsx
|
|
48
|
-
import { Button, getNamedIcon } from '@panneau/ui';
|
|
399
|
+
import { Button, PanneauRoot, getNamedIcon } from '@panneau/ui';
|
|
400
|
+
import { lucideIconLoader } from '@panneau/ui/named-icons';
|
|
49
401
|
|
|
50
|
-
<
|
|
402
|
+
<PanneauRoot iconLoader={lucideIconLoader}>
|
|
403
|
+
<Button icon={getNamedIcon('send')}>Send</Button>
|
|
404
|
+
</PanneauRoot>;
|
|
51
405
|
```
|
|
52
406
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
407
|
+
- **Loading icons by name is opt-in.** `lucideIconLoader` loads any Lucide icon, one chunk per icon the first time it renders, but bundlers emit a chunk for every Lucide icon (about 1,900) and the map of them in the runtime of every page. So it lives in its own entry point, `@panneau/ui/named-icons`: apps that only pass icon components (`icon={Send}`, `actionIcons`) don't pay for it.
|
|
408
|
+
- An app can instead load only the icons its definitions use: `iconLoader={(name) => Promise.resolve(({ send: Send, archive: Archive })[name] ?? null)}`.
|
|
409
|
+
- Without a loader, a named icon renders an empty space of the same size, with one warning in the console.
|
|
410
|
+
- `getNamedIcon()` returns the same component for the same name, renders an empty space while the icon loads, and nothing for a name the loader doesn't know (with a warning).
|
|
411
|
+
- `loadNamedIcon(name, loader)` loads an icon ahead of time, and resolves with its component (or `null`).
|
|
412
|
+
- **Vite apps, in development:** with `lucideIconLoader`, add `optimizeDeps: { exclude: ['lucide-react/dynamicIconImports.mjs'] }` to the Vite config. When Vite optimizes it together with `lucide-react`, it splits `lucide-react` into one chunk per icon (about 1,900 requests on every page load). Production builds are not affected.
|
|
57
413
|
|
|
58
414
|
## Messages
|
|
59
415
|
|
package/dist/alert/Alert.css
CHANGED
|
@@ -1,56 +1,42 @@
|
|
|
1
|
-
.panneau-alert
|
|
1
|
+
.panneau-alert {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: flex-start;
|
|
4
|
-
gap: var(--panneau-space-3);
|
|
5
|
-
padding: var(--panneau-
|
|
4
|
+
gap: var(--panneau-alert-gap, var(--panneau-space-3));
|
|
5
|
+
padding: var(--panneau-alert-padding-y, var(--panneau-space-3))
|
|
6
|
+
var(--panneau-alert-padding-x, var(--panneau-space-4));
|
|
6
7
|
color: var(--panneau-color-text);
|
|
7
|
-
|
|
8
|
-
border: var(--panneau-
|
|
9
|
-
border-radius: var(--panneau-radius-md);
|
|
8
|
+
border: var(--panneau-alert-border-width, var(--panneau-border-width)) solid transparent;
|
|
9
|
+
border-radius: var(--panneau-alert-radius, var(--panneau-radius-md));
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.panneau-
|
|
13
|
-
background-color: var(--panneau-color-success-subtle);
|
|
14
|
-
border-color: var(--panneau-color-success-border);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.panneau-danger-7fFkRR {
|
|
18
|
-
background-color: var(--panneau-color-danger-subtle);
|
|
19
|
-
border-color: var(--panneau-color-danger-border);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.panneau-warning-xvkEcQ {
|
|
23
|
-
background-color: var(--panneau-color-warning-subtle);
|
|
24
|
-
border-color: var(--panneau-color-warning-border);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.panneau-info-beWi9v {
|
|
28
|
-
background-color: var(--panneau-color-info-subtle);
|
|
29
|
-
border-color: var(--panneau-color-info-border);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.panneau-icon-blRAxm {
|
|
12
|
+
.panneau-alert-icon {
|
|
33
13
|
margin-top: 0.125rem;
|
|
34
|
-
color: var(--panneau-
|
|
14
|
+
color: var(--panneau-tone-text);
|
|
35
15
|
}
|
|
36
16
|
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
/* Appearances: they read the --panneau-tone-* variables of the tone class (decision 0024). */
|
|
18
|
+
|
|
19
|
+
.panneau-alert-subtle {
|
|
20
|
+
background-color: var(--panneau-tone-subtle);
|
|
21
|
+
border-color: var(--panneau-tone-border);
|
|
39
22
|
}
|
|
40
23
|
|
|
41
|
-
.panneau-
|
|
42
|
-
color: var(--panneau-color-
|
|
24
|
+
.panneau-alert-outline {
|
|
25
|
+
background-color: var(--panneau-color-surface);
|
|
26
|
+
border-color: var(--panneau-tone-outline);
|
|
43
27
|
}
|
|
44
28
|
|
|
45
|
-
.panneau-
|
|
46
|
-
color: var(--panneau-
|
|
29
|
+
.panneau-alert-solid {
|
|
30
|
+
color: var(--panneau-tone-solid-text);
|
|
31
|
+
background-color: var(--panneau-tone-solid);
|
|
32
|
+
border-color: var(--panneau-tone-solid);
|
|
47
33
|
}
|
|
48
34
|
|
|
49
|
-
.panneau-
|
|
50
|
-
color:
|
|
35
|
+
.panneau-alert-solid .panneau-alert-icon {
|
|
36
|
+
color: inherit;
|
|
51
37
|
}
|
|
52
38
|
|
|
53
|
-
.panneau-content
|
|
39
|
+
.panneau-alert-content {
|
|
54
40
|
display: flex;
|
|
55
41
|
flex: 1 1 auto;
|
|
56
42
|
flex-direction: column;
|
|
@@ -58,21 +44,21 @@
|
|
|
58
44
|
min-width: 0;
|
|
59
45
|
}
|
|
60
46
|
|
|
61
|
-
.panneau-title
|
|
62
|
-
font-weight: var(--panneau-font-weight-bold);
|
|
47
|
+
.panneau-alert-title {
|
|
48
|
+
font-weight: var(--panneau-alert-title-font-weight, var(--panneau-font-weight-bold));
|
|
63
49
|
}
|
|
64
50
|
|
|
65
|
-
.panneau-body
|
|
51
|
+
.panneau-alert-body {
|
|
66
52
|
overflow-wrap: anywhere;
|
|
67
53
|
}
|
|
68
54
|
|
|
69
|
-
.panneau-actions
|
|
55
|
+
.panneau-alert-actions {
|
|
70
56
|
display: flex;
|
|
71
57
|
flex-wrap: wrap;
|
|
72
58
|
gap: var(--panneau-space-2);
|
|
73
59
|
margin-top: var(--panneau-space-2);
|
|
74
60
|
}
|
|
75
61
|
|
|
76
|
-
.panneau-dismiss
|
|
62
|
+
.panneau-alert-dismiss {
|
|
77
63
|
margin: calc(-1 * var(--panneau-space-1)) calc(-1 * var(--panneau-space-2)) 0 0;
|
|
78
64
|
}
|
package/dist/alert/Alert.d.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import type { ReactNode, Ref } from 'react';
|
|
2
|
-
import { type IconComponent } from '../icon/Icon';
|
|
3
|
-
|
|
2
|
+
import { type IconComponent } from '../icon/Icon.js';
|
|
3
|
+
import type { Tone } from '../theme/tones.js';
|
|
4
|
+
/** @deprecated Use `Tone`. */
|
|
5
|
+
export type AlertTone = Tone;
|
|
6
|
+
/** How an alert uses its tone. */
|
|
7
|
+
export type AlertAppearance = 'subtle' | 'outline' | 'solid';
|
|
8
|
+
/**
|
|
9
|
+
* Named variants of `Alert`, registered by a theme (`components.alert.variants`). Declare them
|
|
10
|
+
* here so that `variant="banner"` type-checks.
|
|
11
|
+
*/
|
|
12
|
+
export interface AlertVariants {
|
|
13
|
+
}
|
|
4
14
|
export interface AlertProps {
|
|
5
15
|
/** Defaults to `neutral`. */
|
|
6
|
-
tone?:
|
|
16
|
+
tone?: Tone;
|
|
17
|
+
/** Defaults to `subtle`. */
|
|
18
|
+
appearance?: AlertAppearance;
|
|
19
|
+
/** A named variant of the theme. */
|
|
20
|
+
variant?: keyof AlertVariants & string;
|
|
7
21
|
title?: ReactNode;
|
|
8
22
|
children?: ReactNode;
|
|
9
|
-
/** Replaces the icon of the tone. `null` hides it. */
|
|
23
|
+
/** Replaces the icon of the tone (an info icon for tones added by a theme). `null` hides it. */
|
|
10
24
|
icon?: IconComponent | null;
|
|
11
25
|
/** Buttons under the message. */
|
|
12
26
|
actions?: ReactNode;
|
|
@@ -26,5 +40,5 @@ export interface AlertProps {
|
|
|
26
40
|
bodyClassName?: string;
|
|
27
41
|
}
|
|
28
42
|
/** A message inside the page: an error summary, a warning, a confirmation. */
|
|
29
|
-
export declare function Alert({ tone, title, children, icon, actions, onDismiss, role, id, tabIndex, ref, className, titleClassName, bodyClassName, }: AlertProps): import("react").JSX.Element;
|
|
43
|
+
export declare function Alert({ tone, appearance, variant, title, children, icon, actions, onDismiss, role, id, tabIndex, ref, className, titleClassName, bodyClassName, }: AlertProps): import("react").JSX.Element;
|
|
30
44
|
//# sourceMappingURL=Alert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/alert/Alert.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/alert/Alert.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAIxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAI3C,8BAA8B;AAC9B,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC;AAE7B,kCAAkC;AAClC,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE7D;;;GAGG;AAEH,MAAM,WAAW,aAAa;CAAG;AAUjC,MAAM,WAAW,UAAU;IACvB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,4BAA4B;IAC5B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,aAAa,GAAG,MAAM,CAAC;IACvC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,gGAAgG;IAChG,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,iCAAiC;IACjC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,8EAA8E;AAC9E,wBAAgB,KAAK,CAAC,EAClB,IAAgB,EAChB,UAAqB,EACrB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EACT,IAAI,EACJ,EAAE,EACF,QAAQ,EACR,GAAG,EACH,SAAS,EACT,cAAc,EACd,aAAa,GAChB,EAAE,UAAU,+BA0CZ"}
|