@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/dist/toast/Toast.css
CHANGED
|
@@ -1,32 +1,59 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/*
|
|
2
|
+
* The region carries the root's class (tokens), since React Aria renders it in the body. Toasts show
|
|
3
|
+
* at the bottom, centered, above what sticks to the bottom of the page (--panneau-bottom-offset,
|
|
4
|
+
* set by useToastOffset()), or at the bottom or top of the end side (data-placement). React Aria
|
|
5
|
+
* renders them newest first, each in a list item with `display: contents`.
|
|
6
|
+
*/
|
|
2
7
|
.panneau-toast-region.panneau-toast-region {
|
|
3
8
|
position: fixed;
|
|
4
|
-
inset-block-end: var(--panneau-space-4);
|
|
5
|
-
inset-inline
|
|
9
|
+
inset-block-end: calc(var(--panneau-bottom-offset, 0px) + var(--panneau-space-4));
|
|
10
|
+
inset-inline: 0;
|
|
6
11
|
z-index: var(--panneau-z-toast);
|
|
7
|
-
display:
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: minmax(0, 1fr);
|
|
14
|
+
align-items: end;
|
|
10
15
|
width: min(var(--panneau-toast-width, 24rem), calc(100vw - 2 * var(--panneau-space-4)));
|
|
16
|
+
margin-inline: auto;
|
|
11
17
|
background: transparent;
|
|
12
18
|
outline: none;
|
|
13
19
|
}
|
|
14
20
|
|
|
21
|
+
.panneau-toast-region[data-placement='bottom-end'] {
|
|
22
|
+
inset-inline: auto var(--panneau-space-4);
|
|
23
|
+
margin-inline: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.panneau-toast-region[data-placement='top-end'] {
|
|
27
|
+
inset-block: var(--panneau-space-4) auto;
|
|
28
|
+
inset-inline: auto var(--panneau-space-4);
|
|
29
|
+
align-items: start;
|
|
30
|
+
margin-inline: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
15
33
|
.panneau-toast-region[data-focus-visible] {
|
|
16
34
|
outline: var(--panneau-focus-width) solid var(--panneau-color-focus);
|
|
17
35
|
outline-offset: 4px;
|
|
18
36
|
}
|
|
19
37
|
|
|
38
|
+
/* On a phone, the whole width at the bottom (or the top). */
|
|
20
39
|
@media (max-width: 30rem) {
|
|
21
|
-
.panneau-toast-region.panneau-toast-region
|
|
40
|
+
.panneau-toast-region.panneau-toast-region,
|
|
41
|
+
.panneau-toast-region.panneau-toast-region[data-placement] {
|
|
22
42
|
inset-inline: var(--panneau-space-2);
|
|
23
|
-
inset-block-end: var(--panneau-space-2);
|
|
24
43
|
width: auto;
|
|
44
|
+
margin-inline: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.panneau-toast-region.panneau-toast-region:not([data-placement='top-end']) {
|
|
48
|
+
inset-block: auto calc(var(--panneau-bottom-offset, 0px) + var(--panneau-space-2));
|
|
25
49
|
}
|
|
26
50
|
}
|
|
27
51
|
|
|
28
52
|
.panneau-toast {
|
|
53
|
+
--toast-rise: 1rem;
|
|
54
|
+
|
|
29
55
|
display: flex;
|
|
56
|
+
grid-area: 1 / 1;
|
|
30
57
|
align-items: flex-start;
|
|
31
58
|
gap: var(--panneau-space-3);
|
|
32
59
|
padding: var(--panneau-space-3) var(--panneau-space-3) var(--panneau-space-3)
|
|
@@ -35,10 +62,100 @@
|
|
|
35
62
|
background-color: var(--panneau-toast-bg, var(--panneau-color-surface-raised));
|
|
36
63
|
border: var(--panneau-border-width) solid
|
|
37
64
|
var(--panneau-toast-border-color, var(--panneau-color-border));
|
|
38
|
-
border-inline-start-width: var(--panneau-toast-tone-width, 4px);
|
|
39
65
|
border-radius: var(--panneau-toast-radius, var(--panneau-radius-lg));
|
|
40
66
|
box-shadow: var(--panneau-toast-shadow, var(--panneau-shadow-lg));
|
|
41
67
|
outline: none;
|
|
68
|
+
transition:
|
|
69
|
+
transform var(--panneau-duration) ease-out,
|
|
70
|
+
opacity var(--panneau-duration) ease-out;
|
|
71
|
+
animation: panneau-toast-rise calc(2 * var(--panneau-duration)) ease-out;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.panneau-toast-region[data-placement='top-end'] .panneau-toast {
|
|
75
|
+
--toast-rise: -1rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@keyframes panneau-toast-rise {
|
|
79
|
+
from {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
transform: translateY(var(--toast-rise));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* Folded: the newest in front, the older ones behind it, peeking out a little. Hovered or focused,
|
|
87
|
+
* the region unfolds them in a column, the newest closest to the edge of the screen.
|
|
88
|
+
*/
|
|
89
|
+
.panneau-toast-region li:nth-child(1) > .panneau-toast {
|
|
90
|
+
z-index: 3;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.panneau-toast-region li:nth-child(2) > .panneau-toast {
|
|
94
|
+
z-index: 2;
|
|
95
|
+
transform: translateY(calc(-1 * var(--panneau-space-2))) scale(0.95);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.panneau-toast-region li:nth-child(3) > .panneau-toast {
|
|
99
|
+
z-index: 1;
|
|
100
|
+
transform: translateY(calc(-2 * var(--panneau-space-2))) scale(0.9);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.panneau-toast-region[data-placement='top-end'] li:nth-child(2) > .panneau-toast {
|
|
104
|
+
transform: translateY(var(--panneau-space-2)) scale(0.95);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.panneau-toast-region[data-placement='top-end'] li:nth-child(3) > .panneau-toast {
|
|
108
|
+
transform: translateY(calc(2 * var(--panneau-space-2))) scale(0.9);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.panneau-toast-region li:nth-child(n + 2) > .panneau-toast > * {
|
|
112
|
+
opacity: 0;
|
|
113
|
+
transition: opacity var(--panneau-duration) ease-out;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.panneau-toast-region:is(:hover, :focus-within, [data-hovered], [data-focused]) {
|
|
117
|
+
gap: var(--panneau-space-2);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.panneau-toast-region:is(:hover, :focus-within, [data-hovered], [data-focused]) li > .panneau-toast {
|
|
121
|
+
transform: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.panneau-toast-region:is(:hover, :focus-within, [data-hovered], [data-focused]) li > .panneau-toast > * {
|
|
125
|
+
opacity: 1;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.panneau-toast-region:not([data-placement='top-end']):is(:hover, :focus-within, [data-hovered], [data-focused])
|
|
129
|
+
li:nth-child(1)
|
|
130
|
+
> .panneau-toast {
|
|
131
|
+
grid-area: 3 / 1;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.panneau-toast-region:not([data-placement='top-end']):is(:hover, :focus-within, [data-hovered], [data-focused])
|
|
135
|
+
li:nth-child(2)
|
|
136
|
+
> .panneau-toast {
|
|
137
|
+
grid-area: 2 / 1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.panneau-toast-region:not([data-placement='top-end']):is(:hover, :focus-within, [data-hovered], [data-focused])
|
|
141
|
+
li:nth-child(3)
|
|
142
|
+
> .panneau-toast {
|
|
143
|
+
grid-area: 1 / 1;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.panneau-toast-region[data-placement='top-end']:is(:hover, :focus-within, [data-hovered], [data-focused])
|
|
147
|
+
li
|
|
148
|
+
> .panneau-toast {
|
|
149
|
+
grid-area: auto;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Without motion when the system asks for less. */
|
|
153
|
+
@media (prefers-reduced-motion: reduce) {
|
|
154
|
+
.panneau-toast,
|
|
155
|
+
.panneau-toast-region li > .panneau-toast > * {
|
|
156
|
+
transition: none;
|
|
157
|
+
animation: none;
|
|
158
|
+
}
|
|
42
159
|
}
|
|
43
160
|
|
|
44
161
|
.panneau-toast[data-focus-visible] {
|
|
@@ -46,17 +163,16 @@
|
|
|
46
163
|
outline-offset: 2px;
|
|
47
164
|
}
|
|
48
165
|
|
|
166
|
+
/* A success or an info keeps the neutral look, with its icon in the color of its tone. */
|
|
49
167
|
.panneau-toast-icon {
|
|
50
168
|
margin-top: 0.125rem;
|
|
169
|
+
color: var(--panneau-tone-text);
|
|
51
170
|
}
|
|
52
171
|
|
|
53
|
-
/*
|
|
54
|
-
.panneau-toast-
|
|
172
|
+
/* Only what needs a look, a warning or an error, colors the edge. */
|
|
173
|
+
.panneau-toast-edge {
|
|
55
174
|
border-inline-start-color: var(--panneau-tone-text);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.panneau-toast-toned .panneau-toast-icon {
|
|
59
|
-
color: var(--panneau-tone-text);
|
|
175
|
+
border-inline-start-width: var(--panneau-toast-tone-width, 4px);
|
|
60
176
|
}
|
|
61
177
|
|
|
62
178
|
.panneau-toast-content {
|
package/dist/toast/Toast.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import type { Tone } from '../theme/tones';
|
|
1
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
2
|
+
import type { Tone } from '../theme/tones.js';
|
|
3
3
|
/** @deprecated Use `Tone`. */
|
|
4
4
|
export type ToastTone = Tone;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* What a toast says: what was done to what ("“Spring contest” saved", "3 entries archived"), and
|
|
7
|
+
* the next step when there is one.
|
|
8
|
+
*/
|
|
6
9
|
export interface ToastContent {
|
|
7
10
|
title: string;
|
|
8
11
|
description?: string;
|
|
9
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Defaults to `neutral`. A success keeps the neutral look with its icon; only `warning` and
|
|
14
|
+
* `danger` color the edge.
|
|
15
|
+
*/
|
|
10
16
|
tone?: Tone;
|
|
11
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* A button in the toast that leads to the result ("Open", "Show", "Download") or undoes what was
|
|
19
|
+
* done ("Undo"). The toast closes when it is pressed.
|
|
20
|
+
*/
|
|
12
21
|
action?: {
|
|
13
22
|
label: string;
|
|
14
23
|
onAction: () => void;
|
|
@@ -16,26 +25,54 @@ export interface ToastContent {
|
|
|
16
25
|
}
|
|
17
26
|
export interface ToastOptions {
|
|
18
27
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
28
|
+
* A toast with the key of one already shown replaces it instead of adding another: "Saved"
|
|
29
|
+
* once, however many saves. `show()` returns it.
|
|
30
|
+
*/
|
|
31
|
+
key?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Milliseconds before the toast closes by itself, or `null` to keep it until it is closed.
|
|
34
|
+
* Defaults to what the toast holds (`getToastTimeout()`): about 5 seconds, longer for a longer
|
|
35
|
+
* text, about 10 seconds with an action, and none for an error.
|
|
21
36
|
*/
|
|
22
37
|
timeout?: number | null;
|
|
23
38
|
onClose?: () => void;
|
|
24
39
|
}
|
|
25
40
|
export interface Toasts {
|
|
26
|
-
/** Shows a toast. Returns its key. */
|
|
41
|
+
/** Shows a toast. Returns its key: the one given in its options, or a new one. */
|
|
27
42
|
show(content: ToastContent, options?: ToastOptions): string;
|
|
28
43
|
/** Closes a toast by key. */
|
|
29
44
|
close(key: string): void;
|
|
30
45
|
}
|
|
46
|
+
/** Where toasts show: `bottom` (centered, the default), `bottom-end` or `top-end`. */
|
|
47
|
+
export type ToastPlacement = 'bottom' | 'bottom-end' | 'top-end';
|
|
48
|
+
/** At most this many toasts show at once: older ones wait for a place. */
|
|
49
|
+
export declare const MAX_VISIBLE_TOASTS = 3;
|
|
50
|
+
/**
|
|
51
|
+
* How long a toast stays, from what it holds: about 5 seconds, longer for a longer text; about 10
|
|
52
|
+
* seconds with an action, which must be reached in that time (an action to reach later belongs in
|
|
53
|
+
* the page, not in a toast that stays); and `null`, no timeout, for an error the user must read.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getToastTimeout(content: ToastContent): number | null;
|
|
31
56
|
/** Shows toasts in the closest `PanneauRoot`. */
|
|
32
57
|
export declare function useToast(): Toasts;
|
|
58
|
+
/**
|
|
59
|
+
* Raises the toasts above an element that sticks to the bottom of the page, such as the footer of
|
|
60
|
+
* a form, while it is mounted and `active`: its height becomes the `--panneau-bottom-offset` of the
|
|
61
|
+
* region. Toasts at the top ignore it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function useToastOffset(ref: RefObject<HTMLElement | null>, active?: boolean): void;
|
|
33
64
|
export interface ToastProviderProps {
|
|
34
65
|
children?: ReactNode;
|
|
66
|
+
/** Where the toasts show. Defaults to `bottom`. */
|
|
67
|
+
placement?: ToastPlacement;
|
|
35
68
|
/** Class names that give the region its tokens, since it renders in the body. */
|
|
36
69
|
regionClassName?: string;
|
|
37
70
|
regionProps?: Record<`data-${string}`, string | undefined>;
|
|
38
71
|
}
|
|
39
|
-
/**
|
|
40
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Holds the toasts of a `PanneauRoot` and renders them in an accessible region (decision 0062): at
|
|
74
|
+
* the bottom by default, one per key, at most three, the older ones folded behind the newest until
|
|
75
|
+
* the region is hovered or focused, where their timers pause.
|
|
76
|
+
*/
|
|
77
|
+
export declare function ToastProvider({ children, placement, regionClassName, regionProps, }: ToastProviderProps): import("react").JSX.Element;
|
|
41
78
|
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/toast/Toast.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/toast/Toast.tsx"],"names":[],"mappings":"AACA,OAAO,EAGH,KAAK,SAAS,EACd,KAAK,SAAS,EAMjB,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAI3C,8BAA8B;AAC9B,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC;AAE7B;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;;OAGG;IACH,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CACpD;AAED,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,MAAM;IACnB,kFAAkF;IAClF,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAC5D,6BAA6B;IAC7B,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,sFAAsF;AACtF,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC;AAEjE,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAWpC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAWpE;AAoBD,iDAAiD;AACjD,wBAAgB,QAAQ,IAAI,MAAM,CAMjC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,MAAM,UAAO,GAAG,IAAI,CAiBtF;AA4DD,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mDAAmD;IACnD,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC9D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC1B,QAAQ,EACR,SAAoB,EACpB,eAAe,EACf,WAAW,GACd,EAAE,kBAAkB,+BAwEpB"}
|
package/dist/toast/Toast.js
CHANGED
|
@@ -6,12 +6,32 @@ import { toneClass } from "../theme/toneClass.js";
|
|
|
6
6
|
import { Button as Button$1 } from "../button/Button.js";
|
|
7
7
|
import Toast_module_default from "./Toast.module.js";
|
|
8
8
|
import { IconButton } from "../icon-button/IconButton.js";
|
|
9
|
+
import { c } from "react/compiler-runtime";
|
|
9
10
|
import { CircleAlert, CircleCheck, Info, TriangleAlert, X } from "lucide-react";
|
|
10
11
|
import { Text, UNSTABLE_Toast, UNSTABLE_ToastContent, UNSTABLE_ToastQueue, UNSTABLE_ToastRegion } from "react-aria-components";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { createContext, use, useState } from "react";
|
|
13
|
-
import { c } from "react/compiler-runtime";
|
|
13
|
+
import { createContext, use, useEffect, useState } from "react";
|
|
14
14
|
//#region src/toast/Toast.tsx
|
|
15
|
+
/** At most this many toasts show at once: older ones wait for a place. */
|
|
16
|
+
var MAX_VISIBLE_TOASTS = 3;
|
|
17
|
+
/** Reading time of a toast without an action: at least 5 seconds, at most 10. */
|
|
18
|
+
var MIN_TIMEOUT = 5e3;
|
|
19
|
+
/** A toast with an action stays about 10 seconds, longer for a longer text. */
|
|
20
|
+
var ACTION_TIMEOUT = 1e4;
|
|
21
|
+
var MAX_TIMEOUT = 15e3;
|
|
22
|
+
/** About 200 words a minute, plus the time to notice the toast. */
|
|
23
|
+
var PER_WORD = 300;
|
|
24
|
+
var NOTICE = 2e3;
|
|
25
|
+
/**
|
|
26
|
+
* How long a toast stays, from what it holds: about 5 seconds, longer for a longer text; about 10
|
|
27
|
+
* seconds with an action, which must be reached in that time (an action to reach later belongs in
|
|
28
|
+
* the page, not in a toast that stays); and `null`, no timeout, for an error the user must read.
|
|
29
|
+
*/
|
|
30
|
+
function getToastTimeout(content) {
|
|
31
|
+
if (content.tone === "danger") return null;
|
|
32
|
+
const reading = NOTICE + `${content.title} ${content.description ?? ""} ${content.action?.label ?? ""}`.split(/\s+/).filter((word) => word !== "").length * PER_WORD;
|
|
33
|
+
return content.action !== void 0 ? Math.min(Math.max(ACTION_TIMEOUT, reading), MAX_TIMEOUT) : Math.min(Math.max(MIN_TIMEOUT, reading), ACTION_TIMEOUT);
|
|
34
|
+
}
|
|
15
35
|
var TONE_ICONS = {
|
|
16
36
|
neutral: null,
|
|
17
37
|
success: CircleCheck,
|
|
@@ -19,6 +39,8 @@ var TONE_ICONS = {
|
|
|
19
39
|
warning: TriangleAlert,
|
|
20
40
|
info: Info
|
|
21
41
|
};
|
|
42
|
+
/** Tones that color the edge of a toast: what needs a look. */
|
|
43
|
+
var EDGE_TONES = /* @__PURE__ */ new Set(["warning", "danger"]);
|
|
22
44
|
var ToastContext = createContext(null);
|
|
23
45
|
/** Shows toasts in the closest `PanneauRoot`. */
|
|
24
46
|
function useToast() {
|
|
@@ -26,53 +48,149 @@ function useToast() {
|
|
|
26
48
|
if (toasts === null) throw new Error("useToast() must be used inside <PanneauRoot>.");
|
|
27
49
|
return toasts;
|
|
28
50
|
}
|
|
29
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Raises the toasts above an element that sticks to the bottom of the page, such as the footer of
|
|
53
|
+
* a form, while it is mounted and `active`: its height becomes the `--panneau-bottom-offset` of the
|
|
54
|
+
* region. Toasts at the top ignore it.
|
|
55
|
+
*/
|
|
56
|
+
function useToastOffset(ref, t0) {
|
|
57
|
+
const $ = c(5);
|
|
58
|
+
const active = t0 === void 0 ? true : t0;
|
|
59
|
+
const toasts = use(ToastContext);
|
|
60
|
+
let t1;
|
|
61
|
+
let t2;
|
|
62
|
+
if ($[0] !== active || $[1] !== ref || $[2] !== toasts) {
|
|
63
|
+
t1 = () => {
|
|
64
|
+
const element = ref.current;
|
|
65
|
+
if (toasts === null || element === null || !active) return;
|
|
66
|
+
const id = {};
|
|
67
|
+
const measure = () => toasts.setOffset(id, element.getBoundingClientRect().height);
|
|
68
|
+
measure();
|
|
69
|
+
const observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(measure) : null;
|
|
70
|
+
observer?.observe(element);
|
|
71
|
+
return () => {
|
|
72
|
+
observer?.disconnect();
|
|
73
|
+
toasts.setOffset(id, null);
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
t2 = [
|
|
77
|
+
ref,
|
|
78
|
+
toasts,
|
|
79
|
+
active
|
|
80
|
+
];
|
|
81
|
+
$[0] = active;
|
|
82
|
+
$[1] = ref;
|
|
83
|
+
$[2] = toasts;
|
|
84
|
+
$[3] = t1;
|
|
85
|
+
$[4] = t2;
|
|
86
|
+
} else {
|
|
87
|
+
t1 = $[3];
|
|
88
|
+
t2 = $[4];
|
|
89
|
+
}
|
|
90
|
+
useEffect(t1, t2);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The toasts of a region: `show()` with keys over React Aria's queue, and the offsets of what
|
|
94
|
+
* sticks to the bottom of the page.
|
|
95
|
+
*/
|
|
96
|
+
function createToasts(queue, setOffsets) {
|
|
97
|
+
const shown = /* @__PURE__ */ new Map();
|
|
98
|
+
const keys = /* @__PURE__ */ new Map();
|
|
99
|
+
const forget = (added) => {
|
|
100
|
+
const own = keys.get(added);
|
|
101
|
+
if (own !== void 0 && shown.get(own) === added) shown.delete(own);
|
|
102
|
+
keys.delete(added);
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
show(content, { key, timeout, onClose } = {}) {
|
|
106
|
+
const delay = timeout === void 0 ? getToastTimeout(content) : timeout;
|
|
107
|
+
const previous = key !== void 0 ? shown.get(key) : void 0;
|
|
108
|
+
if (previous !== void 0) {
|
|
109
|
+
keys.delete(previous);
|
|
110
|
+
queue.close(previous);
|
|
111
|
+
}
|
|
112
|
+
let added = "";
|
|
113
|
+
added = queue.add(content, {
|
|
114
|
+
...delay !== null ? { timeout: delay } : {},
|
|
115
|
+
onClose: () => {
|
|
116
|
+
forget(added);
|
|
117
|
+
onClose?.();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
if (key === void 0) return added;
|
|
121
|
+
shown.set(key, added);
|
|
122
|
+
keys.set(added, key);
|
|
123
|
+
return key;
|
|
124
|
+
},
|
|
125
|
+
close(key) {
|
|
126
|
+
queue.close(shown.get(key) ?? key);
|
|
127
|
+
},
|
|
128
|
+
setOffset(id, height) {
|
|
129
|
+
setOffsets((current) => {
|
|
130
|
+
const next = new Map(current);
|
|
131
|
+
if (height === null) next.delete(id);
|
|
132
|
+
else next.set(id, height);
|
|
133
|
+
return next;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Holds the toasts of a `PanneauRoot` and renders them in an accessible region (decision 0062): at
|
|
140
|
+
* the bottom by default, one per key, at most three, the older ones folded behind the newest until
|
|
141
|
+
* the region is hovered or focused, where their timers pause.
|
|
142
|
+
*/
|
|
30
143
|
function ToastProvider(t0) {
|
|
31
|
-
const $ = c(
|
|
32
|
-
const { children, regionClassName, regionProps } = t0;
|
|
144
|
+
const $ = c(25);
|
|
145
|
+
const { children, placement: t1, regionClassName, regionProps } = t0;
|
|
146
|
+
const placement = t1 === void 0 ? "bottom" : t1;
|
|
33
147
|
const intl = usePanneauIntl();
|
|
34
148
|
const [queue] = useState(_temp);
|
|
35
|
-
|
|
149
|
+
const [offsets, setOffsets] = useState(_temp2);
|
|
150
|
+
let t2;
|
|
36
151
|
if ($[0] !== queue) {
|
|
37
|
-
|
|
38
|
-
show(content, t2) {
|
|
39
|
-
const { timeout, onClose } = t2 === void 0 ? {} : t2;
|
|
40
|
-
const delay = timeout === void 0 ? content.action ? null : 5e3 : timeout;
|
|
41
|
-
return queue.add(content, {
|
|
42
|
-
...delay !== null ? { timeout: delay } : {},
|
|
43
|
-
...onClose !== void 0 ? { onClose } : {}
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
close(key) {
|
|
47
|
-
queue.close(key);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
152
|
+
t2 = () => createToasts(queue, setOffsets);
|
|
50
153
|
$[0] = queue;
|
|
51
|
-
$[1] =
|
|
52
|
-
} else
|
|
53
|
-
const [toasts] = useState(
|
|
54
|
-
let t2;
|
|
55
|
-
if ($[2] !== intl) {
|
|
56
|
-
t2 = intl.formatMessage(messages.notifications);
|
|
57
|
-
$[2] = intl;
|
|
58
|
-
$[3] = t2;
|
|
59
|
-
} else t2 = $[3];
|
|
154
|
+
$[1] = t2;
|
|
155
|
+
} else t2 = $[1];
|
|
156
|
+
const [toasts] = useState(t2);
|
|
60
157
|
let t3;
|
|
61
|
-
if ($[
|
|
62
|
-
t3 =
|
|
63
|
-
$[
|
|
64
|
-
$[
|
|
65
|
-
} else t3 = $[
|
|
158
|
+
if ($[2] !== offsets) {
|
|
159
|
+
t3 = Math.max(0, ...offsets.values());
|
|
160
|
+
$[2] = offsets;
|
|
161
|
+
$[3] = t3;
|
|
162
|
+
} else t3 = $[3];
|
|
163
|
+
const offset = t3;
|
|
66
164
|
let t4;
|
|
67
|
-
if ($[
|
|
68
|
-
t4 = (
|
|
69
|
-
|
|
165
|
+
if ($[4] !== intl) {
|
|
166
|
+
t4 = intl.formatMessage(messages.notifications);
|
|
167
|
+
$[4] = intl;
|
|
168
|
+
$[5] = t4;
|
|
169
|
+
} else t4 = $[5];
|
|
170
|
+
let t5;
|
|
171
|
+
if ($[6] !== regionClassName) {
|
|
172
|
+
t5 = cx("panneau-toast-region", regionClassName, Toast_module_default.region);
|
|
173
|
+
$[6] = regionClassName;
|
|
174
|
+
$[7] = t5;
|
|
175
|
+
} else t5 = $[7];
|
|
176
|
+
const t6 = `${offset}px`;
|
|
177
|
+
let t7;
|
|
178
|
+
if ($[8] !== t6) {
|
|
179
|
+
t7 = { "--panneau-bottom-offset": t6 };
|
|
180
|
+
$[8] = t6;
|
|
181
|
+
$[9] = t7;
|
|
182
|
+
} else t7 = $[9];
|
|
183
|
+
const t8 = t7;
|
|
184
|
+
let t9;
|
|
185
|
+
if ($[10] !== intl || $[11] !== queue) {
|
|
186
|
+
t9 = (t10) => {
|
|
187
|
+
const { toast } = t10;
|
|
70
188
|
const tone = toast.content.tone ?? "neutral";
|
|
71
189
|
const icon = TONE_ICONS[tone] ?? null;
|
|
72
190
|
const { action } = toast.content;
|
|
73
191
|
return /* @__PURE__ */ jsxs(UNSTABLE_Toast, {
|
|
74
192
|
toast,
|
|
75
|
-
className: cx("panneau-toast", Toast_module_default.toast, toneClass(tone), tone
|
|
193
|
+
className: cx("panneau-toast", Toast_module_default.toast, toneClass(tone), EDGE_TONES.has(tone) && Toast_module_default.edge),
|
|
76
194
|
children: [
|
|
77
195
|
icon !== null ? /* @__PURE__ */ jsx(Icon, {
|
|
78
196
|
icon,
|
|
@@ -111,43 +229,50 @@ function ToastProvider(t0) {
|
|
|
111
229
|
]
|
|
112
230
|
});
|
|
113
231
|
};
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
} else
|
|
118
|
-
let
|
|
119
|
-
if ($[
|
|
120
|
-
|
|
232
|
+
$[10] = intl;
|
|
233
|
+
$[11] = queue;
|
|
234
|
+
$[12] = t9;
|
|
235
|
+
} else t9 = $[12];
|
|
236
|
+
let t10;
|
|
237
|
+
if ($[13] !== placement || $[14] !== queue || $[15] !== regionProps || $[16] !== t4 || $[17] !== t5 || $[18] !== t8 || $[19] !== t9) {
|
|
238
|
+
t10 = /* @__PURE__ */ jsx(UNSTABLE_ToastRegion, {
|
|
121
239
|
queue,
|
|
122
|
-
"aria-label":
|
|
123
|
-
className:
|
|
240
|
+
"aria-label": t4,
|
|
241
|
+
className: t5,
|
|
242
|
+
"data-placement": placement,
|
|
243
|
+
style: t8,
|
|
124
244
|
...regionProps,
|
|
125
|
-
children:
|
|
245
|
+
children: t9
|
|
126
246
|
});
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
247
|
+
$[13] = placement;
|
|
248
|
+
$[14] = queue;
|
|
249
|
+
$[15] = regionProps;
|
|
250
|
+
$[16] = t4;
|
|
251
|
+
$[17] = t5;
|
|
252
|
+
$[18] = t8;
|
|
253
|
+
$[19] = t9;
|
|
254
|
+
$[20] = t10;
|
|
255
|
+
} else t10 = $[20];
|
|
256
|
+
let t11;
|
|
257
|
+
if ($[21] !== children || $[22] !== t10 || $[23] !== toasts) {
|
|
258
|
+
t11 = /* @__PURE__ */ jsxs(ToastContext, {
|
|
137
259
|
value: toasts,
|
|
138
|
-
children: [children,
|
|
260
|
+
children: [children, t10]
|
|
139
261
|
});
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
} else
|
|
145
|
-
return
|
|
262
|
+
$[21] = children;
|
|
263
|
+
$[22] = t10;
|
|
264
|
+
$[23] = toasts;
|
|
265
|
+
$[24] = t11;
|
|
266
|
+
} else t11 = $[24];
|
|
267
|
+
return t11;
|
|
268
|
+
}
|
|
269
|
+
function _temp2() {
|
|
270
|
+
return /* @__PURE__ */ new Map();
|
|
146
271
|
}
|
|
147
272
|
function _temp() {
|
|
148
|
-
return new UNSTABLE_ToastQueue({ maxVisibleToasts:
|
|
273
|
+
return new UNSTABLE_ToastQueue({ maxVisibleToasts: 3 });
|
|
149
274
|
}
|
|
150
275
|
//#endregion
|
|
151
|
-
export { ToastProvider, useToast };
|
|
276
|
+
export { MAX_VISIBLE_TOASTS, ToastProvider, getToastTimeout, useToast, useToastOffset };
|
|
152
277
|
|
|
153
278
|
//# sourceMappingURL=Toast.js.map
|