@panneau/ui 5.0.0-alpha.2 → 5.0.0-alpha.20
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 +144 -15
- package/dist/alert/Alert.d.ts +2 -2
- package/dist/alert/Alert.js +108 -40
- package/dist/alert/Alert.js.map +1 -1
- package/dist/alert/tokens.d.ts +1 -1
- package/dist/alert/tokens.js.map +1 -1
- package/dist/badge/Badge.d.ts +1 -1
- package/dist/badge/Badge.js +34 -6
- package/dist/badge/Badge.js.map +1 -1
- package/dist/badge/tokens.d.ts +1 -1
- package/dist/badge/tokens.js.map +1 -1
- package/dist/button/Button.d.ts +20 -6
- package/dist/button/Button.d.ts.map +1 -1
- package/dist/button/Button.js +169 -22
- package/dist/button/Button.js.map +1 -1
- package/dist/button/LinkButton.d.ts +22 -0
- package/dist/button/LinkButton.d.ts.map +1 -0
- package/dist/button/LinkButton.js +113 -0
- package/dist/button/LinkButton.js.map +1 -0
- package/dist/button/tokens.d.ts +1 -1
- package/dist/button/tokens.js.map +1 -1
- package/dist/card/Card.js +76 -23
- package/dist/card/Card.js.map +1 -1
- package/dist/card/tokens.d.ts +1 -1
- package/dist/card/tokens.js.map +1 -1
- package/dist/checkbox/Checkbox.css +9 -9
- package/dist/checkbox/Checkbox.d.ts +1 -1
- package/dist/checkbox/Checkbox.js +87 -26
- package/dist/checkbox/Checkbox.js.map +1 -1
- package/dist/checkbox/Checkbox.module.js +3 -3
- package/dist/checkbox/Checkbox.module.js.map +1 -1
- package/dist/checkbox/ChoiceChrome.js +82 -21
- package/dist/checkbox/ChoiceChrome.js.map +1 -1
- package/dist/checkbox/tokens.d.ts +1 -1
- package/dist/checkbox/tokens.js.map +1 -1
- package/dist/combo-box/ComboBox.css +10 -0
- package/dist/combo-box/ComboBox.d.ts +7 -2
- package/dist/combo-box/ComboBox.d.ts.map +1 -1
- package/dist/combo-box/ComboBox.js +310 -78
- package/dist/combo-box/ComboBox.js.map +1 -1
- package/dist/combo-box/ComboBox.module.js +4 -2
- package/dist/combo-box/ComboBox.module.js.map +1 -1
- 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.js +48 -5
- package/dist/container/Container.js.map +1 -1
- package/dist/container/tokens.d.ts +1 -1
- package/dist/container/tokens.js.map +1 -1
- package/dist/date-picker/DatePicker.css +40 -0
- 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 +5 -1
- package/dist/date-picker/DatePicker.module.js.map +1 -1
- package/dist/date-picker/calendarTokens.d.ts +1 -1
- package/dist/date-picker/calendarTokens.js.map +1 -1
- package/dist/date-range-picker/DateRangePicker.css +37 -0
- package/dist/date-range-picker/DateRangePicker.d.ts +41 -0
- package/dist/date-range-picker/DateRangePicker.d.ts.map +1 -0
- package/dist/date-range-picker/DateRangePicker.js +438 -0
- package/dist/date-range-picker/DateRangePicker.js.map +1 -0
- package/dist/date-range-picker/DateRangePicker.module.js +20 -0
- package/dist/date-range-picker/DateRangePicker.module.js.map +1 -0
- package/dist/dialog/Dialog.css +41 -2
- package/dist/dialog/Dialog.d.ts +15 -3
- package/dist/dialog/Dialog.d.ts.map +1 -1
- package/dist/dialog/Dialog.js +161 -32
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/Dialog.module.js +10 -2
- package/dist/dialog/Dialog.module.js.map +1 -1
- package/dist/dialog/tokens.d.ts +1 -1
- package/dist/dialog/tokens.d.ts.map +1 -1
- package/dist/dialog/tokens.js +2 -0
- package/dist/dialog/tokens.js.map +1 -1
- package/dist/disclosure/Disclosure.js +132 -28
- package/dist/disclosure/Disclosure.js.map +1 -1
- package/dist/disclosure/tokens.d.ts +1 -1
- package/dist/disclosure/tokens.js.map +1 -1
- package/dist/divider/Divider.js +55 -11
- package/dist/divider/Divider.js.map +1 -1
- package/dist/divider/tokens.d.ts +1 -1
- package/dist/divider/tokens.js.map +1 -1
- package/dist/field/Field.css +26 -0
- package/dist/field/Field.module.js +6 -2
- 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.d.ts +6 -1
- package/dist/field/Fieldset.d.ts.map +1 -1
- package/dist/field/Fieldset.js +132 -33
- package/dist/field/Fieldset.js.map +1 -1
- package/dist/field/inputTokens.d.ts +1 -1
- package/dist/field/inputTokens.js.map +1 -1
- package/dist/field/tokens.d.ts +1 -1
- package/dist/field/tokens.js.map +1 -1
- package/dist/grid/Grid.d.ts +1 -1
- package/dist/grid/Grid.js +123 -14
- package/dist/grid/Grid.js.map +1 -1
- package/dist/grid/tokens.d.ts +1 -1
- package/dist/grid/tokens.js.map +1 -1
- package/dist/heading/Heading.js +41 -6
- package/dist/heading/Heading.js.map +1 -1
- package/dist/heading/tokens.d.ts +1 -1
- package/dist/heading/tokens.js.map +1 -1
- package/dist/icon/Icon.js +36 -11
- package/dist/icon/Icon.js.map +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.d.ts +2 -2
- package/dist/icon-button/IconButton.js +70 -13
- package/dist/icon-button/IconButton.js.map +1 -1
- package/dist/index.d.ts +65 -52
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -6
- package/dist/inline/Inline.d.ts +1 -1
- package/dist/inline/Inline.js +65 -7
- package/dist/inline/Inline.js.map +1 -1
- package/dist/inline/tokens.d.ts +1 -1
- package/dist/inline/tokens.js.map +1 -1
- package/dist/intl/usePanneauIntl.js.map +1 -1
- package/dist/layout/responsive.js.map +1 -1
- package/dist/line-chart/LineChart.css +84 -0
- package/dist/line-chart/LineChart.d.ts +26 -0
- package/dist/line-chart/LineChart.d.ts.map +1 -0
- package/dist/line-chart/LineChart.js +327 -0
- package/dist/line-chart/LineChart.js.map +1 -0
- package/dist/line-chart/LineChart.module.js +28 -0
- package/dist/line-chart/LineChart.module.js.map +1 -0
- package/dist/line-chart/tokens.d.ts +3 -0
- package/dist/line-chart/tokens.d.ts.map +1 -0
- package/dist/line-chart/tokens.js +19 -0
- package/dist/line-chart/tokens.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/node_modules/@internationalized/date/dist/private/CalendarDate.js +136 -0
- package/dist/node_modules/@internationalized/date/dist/private/CalendarDate.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js +117 -0
- package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/conversion.js +116 -0
- package/dist/node_modules/@internationalized/date/dist/private/conversion.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/manipulation.js +206 -0
- package/dist/node_modules/@internationalized/date/dist/private/manipulation.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/queries.js +26 -0
- package/dist/node_modules/@internationalized/date/dist/private/queries.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/string.js +19 -0
- package/dist/node_modules/@internationalized/date/dist/private/string.js.map +1 -0
- package/dist/node_modules/@internationalized/date/dist/private/utils.js +8 -0
- package/dist/node_modules/@internationalized/date/dist/private/utils.js.map +1 -0
- package/dist/number-input/NumberInput.css +18 -0
- 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 +3 -1
- package/dist/number-input/NumberInput.module.js.map +1 -1
- package/dist/number-input/tokens.d.ts +1 -1
- package/dist/number-input/tokens.js.map +1 -1
- 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 +5 -0
- 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 +4 -2
- package/dist/popover/Popover.module.js.map +1 -1
- package/dist/popover/tokens.d.ts +1 -1
- package/dist/popover/tokens.js.map +1 -1
- package/dist/prose/Prose.js +36 -5
- package/dist/prose/Prose.js.map +1 -1
- package/dist/prose/tokens.d.ts +1 -1
- package/dist/prose/tokens.js.map +1 -1
- package/dist/radio-group/RadioGroup.css +90 -0
- 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 +12 -2
- package/dist/radio-group/RadioGroup.module.js.map +1 -1
- package/dist/radio-group/tokens.d.ts +2 -2
- package/dist/radio-group/tokens.d.ts.map +1 -1
- package/dist/radio-group/tokens.js +22 -2
- package/dist/radio-group/tokens.js.map +1 -1
- package/dist/root/PanneauRoot.css +24 -0
- package/dist/root/PanneauRoot.d.ts +40 -4
- package/dist/root/PanneauRoot.d.ts.map +1 -1
- package/dist/root/PanneauRoot.js +284 -82
- package/dist/root/PanneauRoot.js.map +1 -1
- package/dist/root/PanneauRoot.module.js.map +1 -1
- package/dist/root/ThemeScope.d.ts +1 -1
- package/dist/root/ThemeScope.d.ts.map +1 -1
- package/dist/root/ThemeScope.js +110 -27
- package/dist/root/ThemeScope.js.map +1 -1
- 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 +75 -1
- package/dist/select/ListBox.module.js +9 -3
- package/dist/select/ListBox.module.js.map +1 -1
- package/dist/select/Select.d.ts +14 -1
- package/dist/select/Select.d.ts.map +1 -1
- package/dist/select/Select.js +335 -92
- package/dist/select/Select.js.map +1 -1
- package/dist/select/listBoxTokens.d.ts +1 -1
- package/dist/select/listBoxTokens.d.ts.map +1 -1
- package/dist/select/listBoxTokens.js +2 -0
- package/dist/select/listBoxTokens.js.map +1 -1
- 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.js +49 -9
- package/dist/spinner/Spinner.js.map +1 -1
- package/dist/spinner/tokens.d.ts +1 -1
- package/dist/spinner/tokens.js.map +1 -1
- package/dist/stack/Stack.d.ts +1 -1
- package/dist/stack/Stack.js +60 -7
- package/dist/stack/Stack.js.map +1 -1
- package/dist/stack/tokens.d.ts +1 -1
- package/dist/stack/tokens.js.map +1 -1
- package/dist/stat/Stat.css +45 -0
- package/dist/stat/Stat.d.ts +27 -0
- package/dist/stat/Stat.d.ts.map +1 -0
- package/dist/stat/Stat.js +87 -0
- package/dist/stat/Stat.js.map +1 -0
- package/dist/stat/Stat.module.js +18 -0
- package/dist/stat/Stat.module.js.map +1 -0
- package/dist/stat/tokens.d.ts +3 -0
- package/dist/stat/tokens.d.ts.map +1 -0
- package/dist/stat/tokens.js +21 -0
- package/dist/stat/tokens.js.map +1 -0
- package/dist/switch/Switch.css +8 -8
- package/dist/switch/Switch.d.ts +1 -1
- package/dist/switch/Switch.js +69 -12
- package/dist/switch/Switch.js.map +1 -1
- package/dist/switch/Switch.module.js +3 -2
- package/dist/switch/Switch.module.js.map +1 -1
- package/dist/switch/tokens.d.ts +1 -1
- package/dist/switch/tokens.js.map +1 -1
- package/dist/tabs/Tabs.js +1 -1
- package/dist/tabs/Tabs.js.map +1 -1
- package/dist/tabs/tokens.d.ts +1 -1
- package/dist/tabs/tokens.js.map +1 -1
- 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.d.ts +1 -1
- package/dist/text/Text.js +70 -5
- package/dist/text/Text.js.map +1 -1
- package/dist/text/tokens.d.ts +1 -1
- package/dist/text/tokens.js.map +1 -1
- 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 +7 -3
- 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 +14 -0
- package/dist/theme/Tone.module.js +4 -2
- package/dist/theme/Tone.module.js.map +1 -1
- package/dist/theme/bootstrap.d.ts +2 -2
- package/dist/theme/bootstrap.d.ts.map +1 -1
- package/dist/theme/bootstrap.js +6 -0
- package/dist/theme/bootstrap.js.map +1 -1
- package/dist/theme/chartColors.js.map +1 -1
- package/dist/theme/checkTheme.d.ts +2 -2
- package/dist/theme/checkTheme.d.ts.map +1 -1
- package/dist/theme/checkTheme.js +24 -0
- package/dist/theme/checkTheme.js.map +1 -1
- package/dist/theme/cli.d.ts +2 -2
- package/dist/theme/cli.js.map +1 -1
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/colorVision.d.ts +1 -1
- package/dist/theme/colorVision.js.map +1 -1
- package/dist/theme/componentTokens.js.map +1 -1
- package/dist/theme/components.d.ts +10 -3
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +14 -0
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/defineTheme.d.ts +5 -5
- package/dist/theme/defineTheme.js.map +1 -1
- package/dist/theme/fonts.js.map +1 -1
- package/dist/theme/index.d.ts +12 -12
- package/dist/theme/index.js +1 -1
- package/dist/theme/semanticTokens.d.ts +1 -1
- package/dist/theme/semanticTokens.d.ts.map +1 -1
- package/dist/theme/semanticTokens.js +6 -0
- package/dist/theme/semanticTokens.js.map +1 -1
- package/dist/theme/theme.d.ts +2 -2
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/toneClass.d.ts +1 -1
- package/dist/theme/toneClass.js.map +1 -1
- package/dist/theme/tones.d.ts +15 -3
- package/dist/theme/tones.d.ts.map +1 -1
- package/dist/theme/tones.js +14 -2
- package/dist/theme/tones.js.map +1 -1
- 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 +131 -15
- package/dist/toast/Toast.d.ts +47 -10
- package/dist/toast/Toast.d.ts.map +1 -1
- package/dist/toast/Toast.js +191 -66
- package/dist/toast/Toast.js.map +1 -1
- package/dist/toast/Toast.module.js +5 -3
- package/dist/toast/Toast.module.js.map +1 -1
- package/dist/toast/tokens.d.ts +1 -1
- package/dist/toast/tokens.js +1 -1
- package/dist/toast/tokens.js.map +1 -1
- package/dist/tooltip/Tooltip.js +38 -8
- package/dist/tooltip/Tooltip.js.map +1 -1
- package/dist/tooltip/tokens.d.ts +1 -1
- package/dist/tooltip/tokens.js.map +1 -1
- 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 +10 -5
package/README.md
CHANGED
|
@@ -15,11 +15,12 @@ import { Button, PanneauRoot, TextInput, bootstrapTheme } from '@panneau/ui';
|
|
|
15
15
|
</PanneauRoot>;
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
| Export
|
|
19
|
-
|
|
|
20
|
-
| `@panneau/ui`
|
|
21
|
-
| `@panneau/ui/
|
|
22
|
-
| `@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` |
|
|
23
24
|
|
|
24
25
|
## Root, tokens and themes
|
|
25
26
|
|
|
@@ -72,7 +73,7 @@ Every component reads its own tokens, `--panneau-<component>-<token>`, which def
|
|
|
72
73
|
|
|
73
74
|
### Tones and appearances
|
|
74
75
|
|
|
75
|
-
Components with a color take a `tone`, like Bootstrap's theme colors: `neutral`, `accent`, `success`, `warning`, `danger` and `
|
|
76
|
+
Components with a color take a `tone`, like Bootstrap's theme colors: `neutral`, `accent`, `success`, `warning`, `danger`, `info` and `muted` are built in. What each one means for a state (`muted` is what is over: Archived, Cancelled) is written once, in [the tones of the protocol](../../docs/protocol.md#tones): follow it, so that a user learns the colors once. `Button`, `Badge` and `Alert` also take an `appearance` (`solid`, `outline`, `subtle`, and `ghost` for buttons):
|
|
76
77
|
|
|
77
78
|
```tsx
|
|
78
79
|
<Button tone="accent">Save</Button>
|
|
@@ -244,6 +245,17 @@ Charts (dashboard widgets, reports) use only the chart tokens of the theme, in b
|
|
|
244
245
|
|
|
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.
|
|
246
247
|
|
|
248
|
+
`Stat` and `LineChart` are the charts of the dashboard ([decision 0064](../../docs/decisions/0064-dashboard-widgets.md)):
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
<Stat label="Overdue" value={3} help="Since Monday" tone="danger" href="/entries?filter[late]=1" />
|
|
252
|
+
<LineChart label="Entries per day" points={[{ label: 'Oct 5', value: 4 }, { label: 'Oct 6', value: 8 }]} />
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
- `Stat` shows a number for the locale (`format` takes the options of `Intl.NumberFormat`), what it counts above it and its help under it. A `tone` colors the number only when it calls for attention: the help says why.
|
|
256
|
+
- `LineChart` draws a line and the area under it on a categorical chart color (`color`, from 0), with the top of its scale and its first and last labels. The plot is hidden from assistive technologies, which read the values in a table.
|
|
257
|
+
- Both draw a skeleton of their shape while their `value` or `points` are `undefined`.
|
|
258
|
+
|
|
247
259
|
### Checking a theme
|
|
248
260
|
|
|
249
261
|
`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:
|
|
@@ -287,30 +299,147 @@ Class names are stable and readable, without a hash, like Bootstrap's: target th
|
|
|
287
299
|
|
|
288
300
|
The theme model is described in [decision 0024](../../docs/decisions/0024-theme-model.md).
|
|
289
301
|
|
|
302
|
+
### Content Security Policy
|
|
303
|
+
|
|
304
|
+
Panneau runs under a strict Content Security Policy: it never needs `'unsafe-eval'` or inline scripts. For styles:
|
|
305
|
+
|
|
306
|
+
- **CSS Modules** are files of the packages, that the project's bundler serves as its other stylesheets (`style-src 'self'`).
|
|
307
|
+
- **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>`.
|
|
308
|
+
- **React Aria** adds one `<style>` (`react-aria-pressable-style`) with the same nonce.
|
|
309
|
+
- **Inline `style` attributes** that components set (widths of progress bars, positions of popovers) go through the CSSOM, which `style-src` doesn't block.
|
|
310
|
+
|
|
311
|
+
```html
|
|
312
|
+
<meta property="csp-nonce" content="{{ $nonce }}" />
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
```text
|
|
316
|
+
Content-Security-Policy: default-src 'self'; style-src 'self' 'nonce-{{ $nonce }}'; img-src 'self' data: https:
|
|
317
|
+
```
|
|
318
|
+
|
|
290
319
|
## Primitives
|
|
291
320
|
|
|
292
|
-
`Heading`, `Text`, `Prose`, `Stack`, `Inline`, `Grid`, `Container`, `Divider`, `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`.
|
|
321
|
+
`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`.
|
|
293
322
|
|
|
294
323
|
- Every component accepts `className`, and `xxxClassName` props for its inner elements (`labelClassName`, `inputClassName`…).
|
|
295
324
|
- Labelled controls take `label`, `description` and `errors` (a list of messages: any message makes the control invalid and describes it).
|
|
296
|
-
- They work on phones: larger touch targets on touch screens, dialogs as bottom sheets, scrolling tabs.
|
|
325
|
+
- They work on phones: larger touch targets on touch screens, dialogs as bottom sheets (or the whole screen, with `fullScreenOnPhone`), scrolling tabs.
|
|
326
|
+
|
|
327
|
+
### Rich choices
|
|
328
|
+
|
|
329
|
+
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.
|
|
330
|
+
|
|
331
|
+
- **`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.
|
|
332
|
+
- **`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`).
|
|
333
|
+
- **`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.
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
<MenuTrigger>
|
|
337
|
+
<PillTrigger size="sm" media={<Avatar user={account} />}>
|
|
338
|
+
{account.name}
|
|
339
|
+
</PillTrigger>
|
|
340
|
+
<Menu
|
|
341
|
+
aria-label="Accounts"
|
|
342
|
+
selectionMode="single"
|
|
343
|
+
selectedKeys={[account.id]}
|
|
344
|
+
onSelectionChange={(keys) => keys !== 'all' && onChange([...keys][0])}
|
|
345
|
+
footer="Only this step changes."
|
|
346
|
+
>
|
|
347
|
+
<MenuSection title="Publish on">
|
|
348
|
+
{accounts.map((item) => (
|
|
349
|
+
<MenuItem
|
|
350
|
+
key={item.id}
|
|
351
|
+
id={item.id}
|
|
352
|
+
media={<Avatar user={item} />}
|
|
353
|
+
description={item.handle}
|
|
354
|
+
>
|
|
355
|
+
{item.name}
|
|
356
|
+
</MenuItem>
|
|
357
|
+
))}
|
|
358
|
+
</MenuSection>
|
|
359
|
+
</Menu>
|
|
360
|
+
</MenuTrigger>
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
- **`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.
|
|
364
|
+
|
|
365
|
+
```tsx
|
|
366
|
+
<RadioGroup
|
|
367
|
+
label="Publish on"
|
|
368
|
+
appearance="cards"
|
|
369
|
+
options={accounts.map((item) => ({
|
|
370
|
+
value: item.id,
|
|
371
|
+
label: item.name,
|
|
372
|
+
description: item.handle,
|
|
373
|
+
media: <Avatar user={item} />,
|
|
374
|
+
}))}
|
|
375
|
+
value={accountId}
|
|
376
|
+
onChange={setAccountId}
|
|
377
|
+
/>
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Loading
|
|
381
|
+
|
|
382
|
+
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`).
|
|
383
|
+
|
|
384
|
+
- `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`).
|
|
385
|
+
- `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).
|
|
386
|
+
|
|
387
|
+
```tsx
|
|
388
|
+
function ArticleCard({ article }: { article: Article | undefined }) {
|
|
389
|
+
if (article === undefined) {
|
|
390
|
+
return (
|
|
391
|
+
<LoadingRegion label="Loading the article…">
|
|
392
|
+
<Skeleton shape="rect" aspectRatio="16 / 9" />
|
|
393
|
+
<Skeleton lines={3} />
|
|
394
|
+
</LoadingRegion>
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
return <ArticleView article={article} />;
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
A skeleton never replaces content already shown: while it is fetched again, it stays, dimmed, with `aria-busy`, as in lists.
|
|
402
|
+
|
|
403
|
+
### Toasts
|
|
404
|
+
|
|
405
|
+
`useToast().show(content, options)` shows a toast in the region of the closest `PanneauRoot` ([decision 0062](../../docs/decisions/0062-toasts.md)):
|
|
406
|
+
|
|
407
|
+
```tsx
|
|
408
|
+
const toasts = useToast();
|
|
409
|
+
toasts.show(
|
|
410
|
+
{ title: '3 entries archived', tone: 'success', action: { label: 'Undo', onAction: undo } },
|
|
411
|
+
{ key: 'archive' },
|
|
412
|
+
);
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
- **Only when the page doesn't already say it.** A toast for what happened out of sight (a run that finished, a change made from a menu), for what can be undone, and for an error that has no place in the page (the network, a logout that failed). No toast where the page shows the result: a form says "Saved" in its footer, an error of a field stays on it, and a run that starts shows in the runs button of the shell.
|
|
416
|
+
- **Name the thing, and offer the next step**: what was done to what ("“Spring contest” saved", "3 entries archived"), and an `action` that leads to the result ("Open", "Download") or undoes it ("Undo").
|
|
417
|
+
- **One per thing**: a toast with the `key` of one already shown replaces it. At most three show at once; the older ones fold behind the newest and unfold on hover or focus.
|
|
418
|
+
- **Timeouts that match what the toast holds** (`getToastTimeout()`): about 5 seconds, longer for a longer text, about 10 seconds with an action, none for an error (`danger`). Timers pause while the region is hovered or focused. `timeout` sets another, `null` none.
|
|
419
|
+
- **Quiet**: a success has the neutral look with its icon; only warnings and errors color the edge.
|
|
420
|
+
- **At the bottom, centered**, above what sticks to the bottom of the page: such an element calls `useToastOffset(ref)`, as the footer of a form does. `PanneauRoot`'s `toastPlacement` puts them at `bottom-end` or `top-end` instead. On a phone, they take the whole width.
|
|
297
421
|
|
|
298
422
|
## Icons
|
|
299
423
|
|
|
300
424
|
Components take icons as components: any Lucide icon (`icon={Pencil}`), or a component with the same props.
|
|
301
425
|
|
|
302
|
-
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
|
|
426
|
+
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`:
|
|
303
427
|
|
|
304
428
|
```tsx
|
|
305
|
-
import { Button, getNamedIcon } from '@panneau/ui';
|
|
429
|
+
import { Button, PanneauRoot, getNamedIcon } from '@panneau/ui';
|
|
430
|
+
import { lucideIconLoader } from '@panneau/ui/named-icons';
|
|
306
431
|
|
|
307
|
-
<
|
|
432
|
+
<PanneauRoot iconLoader={lucideIconLoader}>
|
|
433
|
+
<Button icon={getNamedIcon('send')}>Send</Button>
|
|
434
|
+
</PanneauRoot>;
|
|
308
435
|
```
|
|
309
436
|
|
|
310
|
-
-
|
|
311
|
-
-
|
|
312
|
-
-
|
|
313
|
-
-
|
|
437
|
+
- **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.
|
|
438
|
+
- An app can instead load only the icons its definitions use: `iconLoader={(name) => Promise.resolve(({ send: Send, archive: Archive })[name] ?? null)}`.
|
|
439
|
+
- Without a loader, a named icon renders an empty space of the same size, with one warning in the console.
|
|
440
|
+
- `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).
|
|
441
|
+
- `loadNamedIcon(name, loader)` loads an icon ahead of time, and resolves with its component (or `null`).
|
|
442
|
+
- **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.
|
|
314
443
|
|
|
315
444
|
## Messages
|
|
316
445
|
|
package/dist/alert/Alert.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode, Ref } from 'react';
|
|
2
|
-
import { type IconComponent } from '../icon/Icon';
|
|
3
|
-
import type { Tone } from '../theme/tones';
|
|
2
|
+
import { type IconComponent } from '../icon/Icon.js';
|
|
3
|
+
import type { Tone } from '../theme/tones.js';
|
|
4
4
|
/** @deprecated Use `Tone`. */
|
|
5
5
|
export type AlertTone = Tone;
|
|
6
6
|
/** How an alert uses its tone. */
|
package/dist/alert/Alert.js
CHANGED
|
@@ -5,6 +5,7 @@ import { usePanneauIntl } from "../intl/usePanneauIntl.js";
|
|
|
5
5
|
import { toneClass } from "../theme/toneClass.js";
|
|
6
6
|
import { IconButton } from "../icon-button/IconButton.js";
|
|
7
7
|
import Alert_module_default from "./Alert.module.js";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
8
9
|
import { CircleAlert, CircleCheck, Info, TriangleAlert, X } from "lucide-react";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
//#region src/alert/Alert.tsx
|
|
@@ -16,48 +17,115 @@ var TONE_ICONS = {
|
|
|
16
17
|
info: Info
|
|
17
18
|
};
|
|
18
19
|
/** A message inside the page: an error summary, a warning, a confirmation. */
|
|
19
|
-
function Alert(
|
|
20
|
+
function Alert(t0) {
|
|
21
|
+
const $ = c(31);
|
|
22
|
+
const { tone: t1, appearance: t2, variant, title, children, icon, actions, onDismiss, role, id, tabIndex, ref, className, titleClassName, bodyClassName } = t0;
|
|
23
|
+
const tone = t1 === void 0 ? "neutral" : t1;
|
|
24
|
+
const appearance = t2 === void 0 ? "subtle" : t2;
|
|
20
25
|
const intl = usePanneauIntl();
|
|
21
26
|
const shown = icon === void 0 ? TONE_ICONS[tone] ?? Info : icon;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
]
|
|
60
|
-
}
|
|
27
|
+
let t3;
|
|
28
|
+
if ($[0] !== appearance || $[1] !== className || $[2] !== tone || $[3] !== variant) {
|
|
29
|
+
t3 = cx("panneau-alert", Alert_module_default.alert, toneClass(tone), Alert_module_default[appearance], variant !== void 0 && `panneau-alert-variant-${variant}`, className);
|
|
30
|
+
$[0] = appearance;
|
|
31
|
+
$[1] = className;
|
|
32
|
+
$[2] = tone;
|
|
33
|
+
$[3] = variant;
|
|
34
|
+
$[4] = t3;
|
|
35
|
+
} else t3 = $[4];
|
|
36
|
+
let t4;
|
|
37
|
+
if ($[5] !== shown) {
|
|
38
|
+
t4 = shown !== null ? /* @__PURE__ */ jsx(Icon, {
|
|
39
|
+
icon: shown,
|
|
40
|
+
size: "lg",
|
|
41
|
+
className: Alert_module_default.icon
|
|
42
|
+
}) : null;
|
|
43
|
+
$[5] = shown;
|
|
44
|
+
$[6] = t4;
|
|
45
|
+
} else t4 = $[6];
|
|
46
|
+
let t5;
|
|
47
|
+
if ($[7] !== title || $[8] !== titleClassName) {
|
|
48
|
+
t5 = title !== void 0 && title !== null ? /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: cx(Alert_module_default.title, titleClassName),
|
|
50
|
+
children: title
|
|
51
|
+
}) : null;
|
|
52
|
+
$[7] = title;
|
|
53
|
+
$[8] = titleClassName;
|
|
54
|
+
$[9] = t5;
|
|
55
|
+
} else t5 = $[9];
|
|
56
|
+
let t6;
|
|
57
|
+
if ($[10] !== bodyClassName || $[11] !== children) {
|
|
58
|
+
t6 = children !== void 0 && children !== null ? /* @__PURE__ */ jsx("div", {
|
|
59
|
+
className: cx(Alert_module_default.body, bodyClassName),
|
|
60
|
+
children
|
|
61
|
+
}) : null;
|
|
62
|
+
$[10] = bodyClassName;
|
|
63
|
+
$[11] = children;
|
|
64
|
+
$[12] = t6;
|
|
65
|
+
} else t6 = $[12];
|
|
66
|
+
let t7;
|
|
67
|
+
if ($[13] !== actions) {
|
|
68
|
+
t7 = actions !== void 0 && actions !== null ? /* @__PURE__ */ jsx("div", {
|
|
69
|
+
className: Alert_module_default.actions,
|
|
70
|
+
children: actions
|
|
71
|
+
}) : null;
|
|
72
|
+
$[13] = actions;
|
|
73
|
+
$[14] = t7;
|
|
74
|
+
} else t7 = $[14];
|
|
75
|
+
let t8;
|
|
76
|
+
if ($[15] !== t5 || $[16] !== t6 || $[17] !== t7) {
|
|
77
|
+
t8 = /* @__PURE__ */ jsxs("div", {
|
|
78
|
+
className: Alert_module_default.content,
|
|
79
|
+
children: [
|
|
80
|
+
t5,
|
|
81
|
+
t6,
|
|
82
|
+
t7
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
$[15] = t5;
|
|
86
|
+
$[16] = t6;
|
|
87
|
+
$[17] = t7;
|
|
88
|
+
$[18] = t8;
|
|
89
|
+
} else t8 = $[18];
|
|
90
|
+
let t9;
|
|
91
|
+
if ($[19] !== intl || $[20] !== onDismiss) {
|
|
92
|
+
t9 = onDismiss !== void 0 ? /* @__PURE__ */ jsx(IconButton, {
|
|
93
|
+
icon: X,
|
|
94
|
+
size: "sm",
|
|
95
|
+
label: intl.formatMessage(messages.close),
|
|
96
|
+
showTooltip: false,
|
|
97
|
+
onPress: onDismiss,
|
|
98
|
+
className: Alert_module_default.dismiss
|
|
99
|
+
}) : null;
|
|
100
|
+
$[19] = intl;
|
|
101
|
+
$[20] = onDismiss;
|
|
102
|
+
$[21] = t9;
|
|
103
|
+
} else t9 = $[21];
|
|
104
|
+
let t10;
|
|
105
|
+
if ($[22] !== id || $[23] !== ref || $[24] !== role || $[25] !== t3 || $[26] !== t4 || $[27] !== t8 || $[28] !== t9 || $[29] !== tabIndex) {
|
|
106
|
+
t10 = /* @__PURE__ */ jsxs("div", {
|
|
107
|
+
ref,
|
|
108
|
+
id,
|
|
109
|
+
role,
|
|
110
|
+
tabIndex,
|
|
111
|
+
className: t3,
|
|
112
|
+
children: [
|
|
113
|
+
t4,
|
|
114
|
+
t8,
|
|
115
|
+
t9
|
|
116
|
+
]
|
|
117
|
+
});
|
|
118
|
+
$[22] = id;
|
|
119
|
+
$[23] = ref;
|
|
120
|
+
$[24] = role;
|
|
121
|
+
$[25] = t3;
|
|
122
|
+
$[26] = t4;
|
|
123
|
+
$[27] = t8;
|
|
124
|
+
$[28] = t9;
|
|
125
|
+
$[29] = tabIndex;
|
|
126
|
+
$[30] = t10;
|
|
127
|
+
} else t10 = $[30];
|
|
128
|
+
return t10;
|
|
61
129
|
}
|
|
62
130
|
//#endregion
|
|
63
131
|
export { Alert };
|
package/dist/alert/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","names":["styles"],"sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { CircleAlert, CircleCheck, Info, TriangleAlert, X } from 'lucide-react';\nimport type { ReactNode, Ref } from 'react';\n\nimport { IconButton } from '../icon-button/IconButton';\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { messages } from '../intl/messages';\nimport { usePanneauIntl } from '../intl/usePanneauIntl';\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Alert.module.css';\n\n/** @deprecated Use `Tone`. */\nexport type AlertTone = Tone;\n\n/** How an alert uses its tone. */\nexport type AlertAppearance = 'subtle' | 'outline' | 'solid';\n\n/**\n * Named variants of `Alert`, registered by a theme (`components.alert.variants`). Declare them\n * here so that `variant=\"banner\"` type-checks.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface AlertVariants {}\n\nconst TONE_ICONS: Partial<Record<Tone, IconComponent>> = {\n neutral: Info,\n success: CircleCheck,\n danger: CircleAlert,\n warning: TriangleAlert,\n info: Info,\n};\n\nexport interface AlertProps {\n /** Defaults to `neutral`. */\n tone?: Tone;\n /** Defaults to `subtle`. */\n appearance?: AlertAppearance;\n /** A named variant of the theme. */\n variant?: keyof AlertVariants & string;\n title?: ReactNode;\n children?: ReactNode;\n /** Replaces the icon of the tone (an info icon for tones added by a theme). `null` hides it. */\n icon?: IconComponent | null;\n /** Buttons under the message. */\n actions?: ReactNode;\n /** Shows a close button. */\n onDismiss?: () => void;\n /**\n * `alert` announces the message as soon as it appears, for errors that need attention.\n * `status` announces it politely. Without a role, it is only read in place.\n */\n role?: 'alert' | 'status';\n id?: string;\n /** Makes the alert focusable, to move focus to it (an error summary). */\n tabIndex?: number;\n ref?: Ref<HTMLDivElement>;\n className?: string;\n titleClassName?: string;\n bodyClassName?: string;\n}\n\n/** A message inside the page: an error summary, a warning, a confirmation. */\nexport function Alert({\n tone = 'neutral',\n appearance = 'subtle',\n variant,\n title,\n children,\n icon,\n actions,\n onDismiss,\n role,\n id,\n tabIndex,\n ref,\n className,\n titleClassName,\n bodyClassName,\n}: AlertProps) {\n const intl = usePanneauIntl();\n const shown = icon === undefined ? (TONE_ICONS[tone] ?? Info) : icon;\n return (\n <div\n ref={ref}\n id={id}\n role={role}\n tabIndex={tabIndex}\n className={cx(\n 'panneau-alert',\n styles.alert,\n toneClass(tone),\n styles[appearance],\n variant !== undefined && `panneau-alert-variant-${variant}`,\n className,\n )}\n >\n {shown !== null ? <Icon icon={shown} size=\"lg\" className={styles.icon} /> : null}\n <div className={styles.content}>\n {title !== undefined && title !== null ? (\n <div className={cx(styles.title, titleClassName)}>{title}</div>\n ) : null}\n {children !== undefined && children !== null ? (\n <div className={cx(styles.body, bodyClassName)}>{children}</div>\n ) : null}\n {actions !== undefined && actions !== null ? (\n <div className={styles.actions}>{actions}</div>\n ) : null}\n </div>\n {onDismiss !== undefined ? (\n <IconButton\n icon={X}\n size=\"sm\"\n label={intl.formatMessage(messages.close)}\n showTooltip={false}\n onPress={onDismiss}\n className={styles.dismiss}\n />\n ) : null}\n </div>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Alert.js","names":["CircleAlert","CircleCheck","Info","TriangleAlert","X","ReactNode","Ref","IconButton","Icon","IconComponent","messages","usePanneauIntl","toneClass","Tone","cx","styles","AlertTone","AlertAppearance","AlertVariants","TONE_ICONS","Partial","Record","neutral","success","danger","warning","info","AlertProps","tone","appearance","variant","title","children","icon","actions","onDismiss","role","id","tabIndex","ref","HTMLDivElement","className","titleClassName","bodyClassName","Alert","t0","$","_c","t1","t2","undefined","intl","shown","t3","alert","t4","t5","t6","body","t7","t8","content","t9","formatMessage","close","dismiss","t10","_c","styles"],"sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { CircleAlert, CircleCheck, Info, TriangleAlert, X } from 'lucide-react';\nimport type { ReactNode, Ref } from 'react';\n\nimport { IconButton } from '../icon-button/IconButton';\nimport { Icon, type IconComponent } from '../icon/Icon';\nimport { messages } from '../intl/messages';\nimport { usePanneauIntl } from '../intl/usePanneauIntl';\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Alert.module.css';\n\n/** @deprecated Use `Tone`. */\nexport type AlertTone = Tone;\n\n/** How an alert uses its tone. */\nexport type AlertAppearance = 'subtle' | 'outline' | 'solid';\n\n/**\n * Named variants of `Alert`, registered by a theme (`components.alert.variants`). Declare them\n * here so that `variant=\"banner\"` type-checks.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface AlertVariants {}\n\nconst TONE_ICONS: Partial<Record<Tone, IconComponent>> = {\n neutral: Info,\n success: CircleCheck,\n danger: CircleAlert,\n warning: TriangleAlert,\n info: Info,\n};\n\nexport interface AlertProps {\n /** Defaults to `neutral`. */\n tone?: Tone;\n /** Defaults to `subtle`. */\n appearance?: AlertAppearance;\n /** A named variant of the theme. */\n variant?: keyof AlertVariants & string;\n title?: ReactNode;\n children?: ReactNode;\n /** Replaces the icon of the tone (an info icon for tones added by a theme). `null` hides it. */\n icon?: IconComponent | null;\n /** Buttons under the message. */\n actions?: ReactNode;\n /** Shows a close button. */\n onDismiss?: () => void;\n /**\n * `alert` announces the message as soon as it appears, for errors that need attention.\n * `status` announces it politely. Without a role, it is only read in place.\n */\n role?: 'alert' | 'status';\n id?: string;\n /** Makes the alert focusable, to move focus to it (an error summary). */\n tabIndex?: number;\n ref?: Ref<HTMLDivElement>;\n className?: string;\n titleClassName?: string;\n bodyClassName?: string;\n}\n\n/** A message inside the page: an error summary, a warning, a confirmation. */\nexport function Alert({\n tone = 'neutral',\n appearance = 'subtle',\n variant,\n title,\n children,\n icon,\n actions,\n onDismiss,\n role,\n id,\n tabIndex,\n ref,\n className,\n titleClassName,\n bodyClassName,\n}: AlertProps) {\n const intl = usePanneauIntl();\n const shown = icon === undefined ? (TONE_ICONS[tone] ?? Info) : icon;\n return (\n <div\n ref={ref}\n id={id}\n role={role}\n tabIndex={tabIndex}\n className={cx(\n 'panneau-alert',\n styles.alert,\n toneClass(tone),\n styles[appearance],\n variant !== undefined && `panneau-alert-variant-${variant}`,\n className,\n )}\n >\n {shown !== null ? <Icon icon={shown} size=\"lg\" className={styles.icon} /> : null}\n <div className={styles.content}>\n {title !== undefined && title !== null ? (\n <div className={cx(styles.title, titleClassName)}>{title}</div>\n ) : null}\n {children !== undefined && children !== null ? (\n <div className={cx(styles.body, bodyClassName)}>{children}</div>\n ) : null}\n {actions !== undefined && actions !== null ? (\n <div className={styles.actions}>{actions}</div>\n ) : null}\n </div>\n {onDismiss !== undefined ? (\n <IconButton\n icon={X}\n size=\"sm\"\n label={intl.formatMessage(messages.close)}\n showTooltip={false}\n onPress={onDismiss}\n className={styles.dismiss}\n />\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAyBA,IAAMmB,aAAmD;CACrDG,SAASpB;CACTqB,SAAStB;CACTuB,QAAQxB;CACRyB,SAAStB;CACTuB,MAAMxB;AACV;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AhB,EAAA;CAAA,IAAAoB;CAAA,IAAApB,EAAA,QAAAT,MAAAS,EAAA,QAAAP,OAAAO,EAAA,QAAAV,QAAAU,EAAA,QAAAO,MAAAP,EAAA,QAAAS,MAAAT,EAAA,QAAAc,MAAAd,EAAA,QAAAgB,MAAAhB,EAAA,QAAAR,UAAA;EAnCZ4B,MAAA,qBAAA,OAAA;GACS3B;GACDF;GACED;GACIE;GACC,WAAAe;GALf,UAAA;IAcKE;IACDK;IAWCE;GAUC;;EAAAhB,EAAA,MAAAT;EAAAS,EAAA,MAAAP;EAAAO,EAAA,MAAAV;EAAAU,EAAA,MAAAO;EAAAP,EAAA,MAAAS;EAAAT,EAAA,MAAAc;EAAAd,EAAA,MAAAgB;EAAAhB,EAAA,MAAAR;EAAAQ,EAAA,MAAAoB;CAAA,OAAAA,MAAApB,EAAA;CAAA,OApCNoB;AAoCM"}
|
package/dist/alert/tokens.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Tokens of Alert. */
|
|
2
|
-
export declare const alertTokens: import("
|
|
2
|
+
export declare const alertTokens: import("../index.js").ComponentTokens<"alert", "panneau-alert-radius" | "panneau-alert-gap" | "panneau-alert-padding-y" | "panneau-alert-padding-x" | "panneau-alert-border-width" | "panneau-alert-title-font-weight">;
|
|
3
3
|
//# sourceMappingURL=tokens.d.ts.map
|
package/dist/alert/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/alert/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Alert. */\nexport const alertTokens = defineComponentTokens('alert', {\n /** Space between the icon, the content and the dismiss button. */\n gap: 'var(--panneau-space-3)',\n /** Vertical padding. */\n 'padding-y': 'var(--panneau-space-3)',\n /** Horizontal padding. */\n 'padding-x': 'var(--panneau-space-4)',\n /** Width of the border. */\n 'border-width': 'var(--panneau-border-width)',\n /** Corner radius. */\n radius: 'var(--panneau-radius-md)',\n /** Font weight of the title. */\n 'title-font-weight': 'var(--panneau-font-weight-bold)',\n});\n"],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"tokens.js","names":["defineComponentTokens","alertTokens","gap","radius"],"sources":["../../src/alert/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Alert. */\nexport const alertTokens = defineComponentTokens('alert', {\n /** Space between the icon, the content and the dismiss button. */\n gap: 'var(--panneau-space-3)',\n /** Vertical padding. */\n 'padding-y': 'var(--panneau-space-3)',\n /** Horizontal padding. */\n 'padding-x': 'var(--panneau-space-4)',\n /** Width of the border. */\n 'border-width': 'var(--panneau-border-width)',\n /** Corner radius. */\n radius: 'var(--panneau-radius-md)',\n /** Font weight of the title. */\n 'title-font-weight': 'var(--panneau-font-weight-bold)',\n});\n"],"mappings":";;;AAGA,IAAaC,cAAcD,sBAAsB,SAAS;;CAEtDE,KAAK;;CAEL,aAAa;;CAEb,aAAa;;CAEb,gBAAgB;;CAEhBC,QAAQ;;CAER,qBAAqB;AACzB,CAAC"}
|
package/dist/badge/Badge.d.ts
CHANGED
package/dist/badge/Badge.js
CHANGED
|
@@ -1,20 +1,48 @@
|
|
|
1
1
|
import { cx } from "../utils/cx.js";
|
|
2
2
|
import { toneClass } from "../theme/toneClass.js";
|
|
3
3
|
import Badge_module_default from "./Badge.module.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
//#region src/badge/Badge.tsx
|
|
6
7
|
/** A short status or a count. */
|
|
7
|
-
function Badge(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
function Badge(t0) {
|
|
9
|
+
const $ = c(11);
|
|
10
|
+
const { tone: t1, appearance: t2, variant, children, label, className } = t0;
|
|
11
|
+
const tone = t1 === void 0 ? "neutral" : t1;
|
|
12
|
+
const appearance = t2 === void 0 ? "subtle" : t2;
|
|
13
|
+
let t3;
|
|
14
|
+
if ($[0] !== appearance || $[1] !== className || $[2] !== tone || $[3] !== variant) {
|
|
15
|
+
t3 = cx("panneau-badge", Badge_module_default.badge, toneClass(tone), Badge_module_default[appearance], variant !== void 0 && `panneau-badge-variant-${variant}`, className);
|
|
16
|
+
$[0] = appearance;
|
|
17
|
+
$[1] = className;
|
|
18
|
+
$[2] = tone;
|
|
19
|
+
$[3] = variant;
|
|
20
|
+
$[4] = t3;
|
|
21
|
+
} else t3 = $[4];
|
|
22
|
+
let t4;
|
|
23
|
+
if ($[5] !== children || $[6] !== label) {
|
|
24
|
+
t4 = label !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
11
25
|
"aria-hidden": "true",
|
|
12
26
|
children
|
|
13
27
|
}), /* @__PURE__ */ jsx("span", {
|
|
14
28
|
className: Badge_module_default.visuallyHidden,
|
|
15
29
|
children: label
|
|
16
|
-
})] }) : children
|
|
17
|
-
|
|
30
|
+
})] }) : children;
|
|
31
|
+
$[5] = children;
|
|
32
|
+
$[6] = label;
|
|
33
|
+
$[7] = t4;
|
|
34
|
+
} else t4 = $[7];
|
|
35
|
+
let t5;
|
|
36
|
+
if ($[8] !== t3 || $[9] !== t4) {
|
|
37
|
+
t5 = /* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: t3,
|
|
39
|
+
children: t4
|
|
40
|
+
});
|
|
41
|
+
$[8] = t3;
|
|
42
|
+
$[9] = t4;
|
|
43
|
+
$[10] = t5;
|
|
44
|
+
} else t5 = $[10];
|
|
45
|
+
return t5;
|
|
18
46
|
}
|
|
19
47
|
//#endregion
|
|
20
48
|
export { Badge };
|
package/dist/badge/Badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","names":["styles","_Fragment"],"sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Badge.module.css';\n\n/** @deprecated Use `Tone`. */\nexport type BadgeTone = Tone;\n\n/** How a badge uses its tone. */\nexport type BadgeAppearance = 'subtle' | 'solid' | 'outline';\n\n/**\n * Named variants of `Badge`, registered by a theme (`components.badge.variants`). Declare them\n * here so that `variant=\"tag\"` type-checks.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface BadgeVariants {}\n\nexport interface BadgeProps {\n /** Defaults to `neutral`. */\n tone?: Tone;\n /** Defaults to `subtle`. */\n appearance?: BadgeAppearance;\n /** A named variant of the theme. */\n variant?: keyof BadgeVariants & string;\n children?: ReactNode;\n /**\n * Accessible text, when the visible content isn't enough on its own (a count of errors: \"2\n * errors\"). The visible content is then hidden from assistive technologies.\n */\n label?: string;\n className?: string;\n}\n\n/** A short status or a count. */\nexport function Badge({\n tone = 'neutral',\n appearance = 'subtle',\n variant,\n children,\n label,\n className,\n}: BadgeProps) {\n return (\n <span\n className={cx(\n 'panneau-badge',\n styles.badge,\n toneClass(tone),\n styles[appearance],\n variant !== undefined && `panneau-badge-variant-${variant}`,\n className,\n )}\n >\n {label !== undefined ? (\n <>\n <span aria-hidden=\"true\">{children}</span>\n <span className={styles.visuallyHidden}>{label}</span>\n </>\n ) : (\n children\n )}\n </span>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Badge.js","names":["ReactNode","toneClass","Tone","cx","styles","BadgeTone","BadgeAppearance","BadgeVariants","BadgeProps","tone","appearance","variant","children","label","className","Badge","t0","$","_c","t1","t2","undefined","t3","badge","t4","visuallyHidden","t5","_c","styles","_Fragment"],"sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Badge.module.css';\n\n/** @deprecated Use `Tone`. */\nexport type BadgeTone = Tone;\n\n/** How a badge uses its tone. */\nexport type BadgeAppearance = 'subtle' | 'solid' | 'outline';\n\n/**\n * Named variants of `Badge`, registered by a theme (`components.badge.variants`). Declare them\n * here so that `variant=\"tag\"` type-checks.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface BadgeVariants {}\n\nexport interface BadgeProps {\n /** Defaults to `neutral`. */\n tone?: Tone;\n /** Defaults to `subtle`. */\n appearance?: BadgeAppearance;\n /** A named variant of the theme. */\n variant?: keyof BadgeVariants & string;\n children?: ReactNode;\n /**\n * Accessible text, when the visible content isn't enough on its own (a count of errors: \"2\n * errors\"). The visible content is then hidden from assistive technologies.\n */\n label?: string;\n className?: string;\n}\n\n/** A short status or a count. */\nexport function Badge({\n tone = 'neutral',\n appearance = 'subtle',\n variant,\n children,\n label,\n className,\n}: BadgeProps) {\n return (\n <span\n className={cx(\n 'panneau-badge',\n styles.badge,\n toneClass(tone),\n styles[appearance],\n variant !== undefined && `panneau-badge-variant-${variant}`,\n className,\n )}\n >\n {label !== undefined ? (\n <>\n <span aria-hidden=\"true\">{children}</span>\n <span className={styles.visuallyHidden}>{label}</span>\n </>\n ) : (\n children\n )}\n </span>\n );\n}\n"],"mappings":";;;;;;;AAqCA,SAAOe,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAe,MAAA,EAAAT,MAAAU,IAAAT,YAAAU,IAAAT,SAAAC,UAAAC,OAAAC,cAAAE;CAClB,MAAAP,OAAAU,OAAAE,KAAAA,IAAA,YAAAF;CACA,MAAAT,aAAAU,OAAAC,KAAAA,IAAA,WAAAD;CAAqB,IAAAE;CAAA,IAAAL,EAAA,OAAAP,cAAAO,EAAA,OAAAH,aAAAG,EAAA,OAAAR,QAAAQ,EAAA,OAAAN,SAAA;EAQFW,KAAAnB,GACP,iBACAC,qBAAMmB,OACNtB,UAAUQ,IAAI,GACdL,qBAAOM,aACPC,YAAYU,KAAAA,KAAZ,yBAAkDV,WAClDG,SACJ;EAACG,EAAA,KAAAP;EAAAO,EAAA,KAAAH;EAAAG,EAAA,KAAAR;EAAAQ,EAAA,KAAAN;EAAAM,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAL,YAAAK,EAAA,OAAAJ,OAAA;EAEAW,KAAAX,UAAUQ,KAAAA,IAAV,qBAAAQ,UAAA,EAAA,UAAA,CAEO,oBAAA,QAAA;GAAkB,eAAA;GAAQjB;EAAgB,CAAA,GAC1C,oBAAA,QAAA;GAAiB,WAAAR,qBAAMqB;GAAkBZ,UAAAA;EAAa,CAAA,CAAA,EAAA,CAAA,IAH7DD;EAOAK,EAAA,KAAAL;EAAAK,EAAA,KAAAJ;EAAAI,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAS;CAAA,IAAAT,EAAA,OAAAK,MAAAL,EAAA,OAAAO,IAAA;EAjBLE,KAAA,oBAAA,QAAA;GACe,WAAAJ;GASVE,UAAAA;EAQE,CAAA;EAAAP,EAAA,KAAAK;EAAAL,EAAA,KAAAO;EAAAP,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAlBPS;AAkBO"}
|
package/dist/badge/tokens.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Tokens of Badge. */
|
|
2
|
-
export declare const badgeTokens: import("
|
|
2
|
+
export declare const badgeTokens: import("../index.js").ComponentTokens<"badge", "panneau-badge-height" | "panneau-badge-radius" | "panneau-badge-gap" | "panneau-badge-padding-x" | "panneau-badge-border-width" | "panneau-badge-font-size" | "panneau-badge-font-weight">;
|
|
3
3
|
//# sourceMappingURL=tokens.d.ts.map
|
package/dist/badge/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/badge/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Badge. */\nexport const badgeTokens = defineComponentTokens('badge', {\n /** Space between an icon and the text. */\n gap: 'var(--panneau-space-1)',\n /** Height, and minimum width. */\n height: '1.25rem',\n /** Horizontal padding. */\n 'padding-x': 'var(--panneau-space-2)',\n /** Font size. */\n 'font-size': 'var(--panneau-font-size-xs)',\n /** Font weight. */\n 'font-weight': 'var(--panneau-font-weight-medium)',\n /** Width of the border. */\n 'border-width': 'var(--panneau-border-width)',\n /** Corner radius: a pill by default. */\n radius: 'var(--panneau-radius-full)',\n});\n"],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"tokens.js","names":["defineComponentTokens","badgeTokens","gap","height","radius"],"sources":["../../src/badge/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of Badge. */\nexport const badgeTokens = defineComponentTokens('badge', {\n /** Space between an icon and the text. */\n gap: 'var(--panneau-space-1)',\n /** Height, and minimum width. */\n height: '1.25rem',\n /** Horizontal padding. */\n 'padding-x': 'var(--panneau-space-2)',\n /** Font size. */\n 'font-size': 'var(--panneau-font-size-xs)',\n /** Font weight. */\n 'font-weight': 'var(--panneau-font-weight-medium)',\n /** Width of the border. */\n 'border-width': 'var(--panneau-border-width)',\n /** Corner radius: a pill by default. */\n radius: 'var(--panneau-radius-full)',\n});\n"],"mappings":";;;AAGA,IAAaC,cAAcD,sBAAsB,SAAS;;CAEtDE,KAAK;;CAELC,QAAQ;;CAER,aAAa;;CAEb,aAAa;;CAEb,eAAe;;CAEf,gBAAgB;;CAEhBC,QAAQ;AACZ,CAAC"}
|
package/dist/button/Button.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { type ButtonProps as AriaButtonProps } from 'react-aria-components';
|
|
3
|
-
import { type IconComponent } from '../icon/Icon';
|
|
4
|
-
import type { Tone } from '../theme/tones';
|
|
5
|
-
|
|
3
|
+
import { type IconComponent } from '../icon/Icon.js';
|
|
4
|
+
import type { Tone } from '../theme/tones.js';
|
|
5
|
+
declare const styles: Readonly<Record<string, string>>;
|
|
6
6
|
/** How a button uses its tone, like Bootstrap's `.btn-*` and `.btn-outline-*`. */
|
|
7
7
|
export type ButtonAppearance = 'solid' | 'outline' | 'subtle' | 'ghost';
|
|
8
8
|
/**
|
|
@@ -26,7 +26,8 @@ export interface ButtonVariants {
|
|
|
26
26
|
* @deprecated Use `tone` and `appearance`.
|
|
27
27
|
*/
|
|
28
28
|
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
29
|
-
|
|
29
|
+
/** The look of a button, shared by `Button` and `LinkButton`. */
|
|
30
|
+
export interface ButtonStyleProps {
|
|
30
31
|
/** Defaults to `neutral`. */
|
|
31
32
|
tone?: Tone;
|
|
32
33
|
/** Defaults to `outline` for the neutral tone, and `solid` for the others. */
|
|
@@ -40,14 +41,27 @@ export interface ButtonProps extends Omit<AriaButtonProps, 'className' | 'style'
|
|
|
40
41
|
iconEnd?: IconComponent;
|
|
41
42
|
/** Takes the full width of its container. */
|
|
42
43
|
fullWidth?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface ButtonProps extends ButtonStyleProps, Omit<AriaButtonProps, 'className' | 'style' | 'children'> {
|
|
46
|
+
/** The keys that do what the button does, such as `Control+Enter`. */
|
|
47
|
+
'aria-keyshortcuts'?: string;
|
|
43
48
|
children?: ReactNode;
|
|
44
49
|
className?: string;
|
|
45
50
|
style?: CSSProperties;
|
|
46
51
|
}
|
|
52
|
+
/** The class names of a button from its style props, for `Button` and `LinkButton`. */
|
|
53
|
+
export declare function getButtonClassName({ tone, appearance, variant, size, fullWidth, className, }: Pick<ButtonStyleProps, 'tone' | 'appearance' | 'variant' | 'size' | 'fullWidth'> & {
|
|
54
|
+
className?: string | undefined;
|
|
55
|
+
}): string;
|
|
56
|
+
/** The icons and label of a button. */
|
|
57
|
+
export declare function ButtonContent({ icon, iconEnd, size, children, }: Pick<ButtonStyleProps, 'icon' | 'iconEnd' | 'size'> & {
|
|
58
|
+
children?: ReactNode;
|
|
59
|
+
}): import("react").JSX.Element;
|
|
47
60
|
/**
|
|
48
61
|
* A button. With `isPending`, it shows a spinner, keeps its size and focus, and ignores presses
|
|
49
|
-
* while assistive technologies announce the pending state.
|
|
62
|
+
* while assistive technologies announce the pending state. `aria-keyshortcuts` gives the keys
|
|
63
|
+
* that do what it does.
|
|
50
64
|
*/
|
|
51
|
-
export declare function Button({ tone, appearance, variant, size, icon, iconEnd, fullWidth, isPending, children, className, ...props }: ButtonProps): import("react").JSX.Element;
|
|
65
|
+
export declare function Button({ tone, appearance, variant, size, icon, iconEnd, fullWidth, isPending, children, className, 'aria-keyshortcuts': keyShortcuts, render, ...props }: ButtonProps): import("react").JSX.Element;
|
|
52
66
|
export { styles as buttonStyles };
|
|
53
67
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAwB,KAAK,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,kFAAkF;AAClF,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExE;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,cAAc;CAAG;AAElC;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;AAazE,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/button/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