@zazz-ui/core 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORING.md +158 -0
- package/CHANGELOG.md +341 -0
- package/README.md +55 -23
- package/dist/scroll-state-C8mA5gq6.js +1 -0
- package/dist/sri.json +124 -72
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +116794 -0
- package/editor/zazz.html-data.json +1683 -0
- package/editor/zazz.language-data.json +5001 -0
- package/editor/zazz.lint-data.json +152 -0
- package/package.json +12 -5
- package/src/base/_breakpoints.css +12 -0
- package/src/base/_layers.css +8 -9
- package/src/base/_properties-2xl.css +171 -0
- package/src/base/_properties-active.css +107 -0
- package/src/base/_properties-checked.css +107 -0
- package/src/base/_properties-current.css +107 -0
- package/src/base/_properties-disabled.css +107 -0
- package/src/base/_properties-focus-visible.css +107 -0
- package/src/base/_properties-focus-within.css +107 -0
- package/src/base/_properties-hover.css +107 -0
- package/src/base/_properties-lg.css +171 -0
- package/src/base/_properties-md.css +171 -0
- package/src/base/_properties-open.css +107 -0
- package/src/base/_properties-sm.css +171 -0
- package/src/base/_properties-starting.css +55 -0
- package/src/base/_properties-stuck.css +55 -0
- package/src/base/_properties-xl.css +171 -0
- package/src/base/_properties.css +555 -0
- package/src/base/_reset.css +67 -75
- package/src/base/_switches.css +145 -0
- package/src/base/_typography.css +437 -370
- package/src/base/_utilities-box.css +142 -0
- package/src/base/_utilities-color.css +290 -0
- package/src/base/_utilities-effects.css +235 -0
- package/src/base/_utilities-flow.css +312 -0
- package/src/base/_utilities-grid.css +143 -0
- package/src/base/_utilities-margin.css +376 -0
- package/src/base/_utilities-pseudo.css +426 -0
- package/src/base/_utilities-sizing.css +259 -0
- package/src/base/_utilities-spacing.css +190 -0
- package/src/base/_utilities-tier-2xl.css +93 -0
- package/src/base/_utilities-tier-active.css +61 -0
- package/src/base/_utilities-tier-checked.css +61 -0
- package/src/base/_utilities-tier-current.css +61 -0
- package/src/base/_utilities-tier-disabled.css +61 -0
- package/src/base/_utilities-tier-focus-visible.css +61 -0
- package/src/base/_utilities-tier-focus-within.css +61 -0
- package/src/base/_utilities-tier-hover.css +63 -0
- package/src/base/_utilities-tier-lg.css +93 -0
- package/src/base/_utilities-tier-md.css +93 -0
- package/src/base/_utilities-tier-open.css +61 -0
- package/src/base/_utilities-tier-sm.css +93 -0
- package/src/base/_utilities-tier-starting.css +35 -0
- package/src/base/_utilities-tier-stuck.css +114 -0
- package/src/base/_utilities-tier-xl.css +93 -0
- package/src/base/_utilities-typography.css +141 -0
- package/src/base/_variables.css +323 -372
- package/src/base/_view-transitions.css +10 -12
- package/src/base/command-score.d.ts.map +1 -1
- package/src/base/command-score.js +1 -2
- package/src/base/command-score.ts +1 -2
- package/src/base/dialog-lifecycle.js +1 -1
- package/src/base/dialog-lifecycle.ts +1 -1
- package/src/base/embla.d.ts +6 -7
- package/src/base/embla.d.ts.map +1 -1
- package/src/base/embla.js +89 -55
- package/src/base/embla.ts +89 -55
- package/src/base/hotkeys.d.ts +0 -5
- package/src/base/hotkeys.d.ts.map +1 -1
- package/src/base/hotkeys.ts +0 -5
- package/src/base/navigation.d.ts +12 -1
- package/src/base/navigation.d.ts.map +1 -1
- package/src/base/navigation.js +229 -86
- package/src/base/navigation.ts +224 -92
- package/src/base/reveal.js +14 -14
- package/src/base/reveal.ts +14 -14
- package/src/base/scroll-state.d.ts +21 -0
- package/src/base/scroll-state.d.ts.map +1 -0
- package/src/base/scroll-state.js +177 -0
- package/src/base/scroll-state.ts +188 -0
- package/src/base/signals.d.ts +1 -2
- package/src/base/signals.d.ts.map +1 -1
- package/src/base/signals.js +4 -6
- package/src/base/signals.ts +4 -6
- package/src/base/style-format.d.ts +33 -0
- package/src/base/style-format.d.ts.map +1 -0
- package/src/base/style-format.js +160 -0
- package/src/base/style-format.ts +180 -0
- package/src/base/typeahead.d.ts +19 -4
- package/src/base/typeahead.d.ts.map +1 -1
- package/src/base/typeahead.js +68 -21
- package/src/base/typeahead.ts +73 -23
- package/src/base/utilities.d.ts +188 -0
- package/src/base/utilities.d.ts.map +1 -0
- package/src/base/utilities.js +750 -0
- package/src/base/utilities.ts +865 -0
- package/src/base/utils.d.ts +3 -7
- package/src/base/utils.d.ts.map +1 -1
- package/src/base/utils.js +4 -8
- package/src/base/utils.ts +4 -8
- package/src/base/zazz-element.d.ts +14 -8
- package/src/base/zazz-element.d.ts.map +1 -1
- package/src/base/zazz-element.js +14 -8
- package/src/base/zazz-element.ts +15 -8
- package/src/globals.d.ts +1 -1
- package/src/head.d.ts +50 -4
- package/src/head.d.ts.map +1 -1
- package/src/head.js +119 -38
- package/src/head.ts +172 -41
- package/src/index.css +57 -14
- package/src/index.js +5 -0
- package/src/index.ts +6 -0
- package/src/manifest.d.ts +36 -5
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +150 -6
- package/src/manifest.ts +167 -9
- package/src/primitives/accordion/accordion.css +18 -17
- package/src/primitives/accordion/accordion.html +42 -9
- package/src/primitives/alert-dialog/alert-dialog.css +13 -13
- package/src/primitives/alert-dialog/alert-dialog.html +26 -12
- package/src/primitives/autocomplete/autocomplete-groups.html +64 -33
- package/src/primitives/autocomplete/autocomplete.css +45 -43
- package/src/primitives/autocomplete/autocomplete.d.ts +6 -5
- package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -1
- package/src/primitives/autocomplete/autocomplete.html +38 -26
- package/src/primitives/autocomplete/autocomplete.js +6 -5
- package/src/primitives/autocomplete/autocomplete.ts +6 -5
- package/src/primitives/avatar/avatar.html +110 -15
- package/src/primitives/badge/badge-icon.html +22 -8
- package/src/primitives/badge/badge.css +401 -128
- package/src/primitives/badge/badge.html +12 -6
- package/src/primitives/breadcrumbs/breadcrumbs.html +25 -5
- package/src/primitives/button/button-icon-only.html +17 -11
- package/src/primitives/button/button-icon.html +9 -3
- package/src/primitives/button/button.css +408 -164
- package/src/primitives/button/button.html +14 -7
- package/src/primitives/button-group/button-group-vertical.html +5 -5
- package/src/primitives/button-group/button-group.css +53 -25
- package/src/primitives/button-group/button-group.html +18 -12
- package/src/primitives/callout/callout.css +114 -0
- package/src/primitives/callout/callout.html +188 -0
- package/src/primitives/card/card-subgrid.html +249 -34
- package/src/primitives/card/card.css +125 -0
- package/src/primitives/card/card.html +141 -20
- package/src/primitives/carousel/carousel.css +30 -20
- package/src/primitives/carousel/carousel.d.ts +7 -10
- package/src/primitives/carousel/carousel.d.ts.map +1 -1
- package/src/primitives/carousel/carousel.html +420 -84
- package/src/primitives/carousel/carousel.js +1 -1
- package/src/primitives/carousel/carousel.ts +8 -11
- package/src/primitives/checkbox/checkbox-tasklist.html +6 -6
- package/src/primitives/checkbox/checkbox.css +98 -40
- package/src/primitives/checkbox/checkbox.d.ts.map +1 -1
- package/src/primitives/checkbox/checkbox.html +13 -8
- package/src/primitives/checkbox/checkbox.js +7 -9
- package/src/primitives/checkbox/checkbox.ts +7 -15
- package/src/primitives/combobox/combobox-multiselect.html +53 -33
- package/src/primitives/combobox/combobox.css +147 -126
- package/src/primitives/combobox/combobox.d.ts +12 -11
- package/src/primitives/combobox/combobox.d.ts.map +1 -1
- package/src/primitives/combobox/combobox.html +48 -28
- package/src/primitives/combobox/combobox.js +46 -51
- package/src/primitives/combobox/combobox.ts +48 -55
- package/src/primitives/command/command-actions.d.ts +2 -3
- package/src/primitives/command/command-actions.d.ts.map +1 -1
- package/src/primitives/command/command-actions.html +48 -33
- package/src/primitives/command/command-actions.js +12 -10
- package/src/primitives/command/command-actions.ts +12 -13
- package/src/primitives/command/command-dialog.html +49 -25
- package/src/primitives/command/command.css +52 -42
- package/src/primitives/command/command.d.ts +10 -7
- package/src/primitives/command/command.d.ts.map +1 -1
- package/src/primitives/command/command.html +95 -46
- package/src/primitives/command/command.js +30 -13
- package/src/primitives/command/command.ts +30 -12
- package/src/primitives/debug/audit-core.d.ts +64 -0
- package/src/primitives/debug/audit-core.d.ts.map +1 -0
- package/src/primitives/debug/audit-core.js +356 -0
- package/src/primitives/debug/audit-core.ts +535 -0
- package/src/primitives/debug/debug.d.ts +50 -0
- package/src/primitives/debug/debug.d.ts.map +1 -0
- package/src/primitives/debug/debug.js +168 -0
- package/src/primitives/debug/debug.ts +211 -0
- package/src/primitives/dialog/dialog-with-form.html +67 -45
- package/src/primitives/dialog/dialog.css +87 -61
- package/src/primitives/dialog/dialog.html +25 -17
- package/src/primitives/fields/fields.css +108 -134
- package/src/primitives/fields/fields.html +39 -0
- package/src/primitives/input/input-icon-leading.html +3 -3
- package/src/primitives/input/input-icon-trailing.html +3 -3
- package/src/primitives/input/input.css +87 -49
- package/src/primitives/input/input.html +15 -15
- package/src/primitives/input-group/input-group-password-group.html +15 -15
- package/src/primitives/input-group/input-group.css +118 -75
- package/src/primitives/input-group/input-group.html +42 -30
- package/src/primitives/kbd/kbd-group.html +15 -2
- package/src/primitives/kbd/kbd.css +44 -31
- package/src/primitives/kbd/kbd.html +7 -1
- package/src/primitives/layout/layout.css +159 -0
- package/src/primitives/layout/layout.html +35 -0
- package/src/primitives/lightbox/lightbox.css +178 -105
- package/src/primitives/lightbox/lightbox.d.ts.map +1 -1
- package/src/primitives/lightbox/lightbox.html +138 -166
- package/src/primitives/lightbox/lightbox.js +10 -13
- package/src/primitives/lightbox/lightbox.ts +12 -13
- package/src/primitives/menu/menu-interest.html +60 -18
- package/src/primitives/menu/menu.css +22 -17
- package/src/primitives/menu/menu.d.ts +5 -5
- package/src/primitives/menu/menu.html +195 -40
- package/src/primitives/menu/menu.js +8 -8
- package/src/primitives/menu/menu.ts +8 -8
- package/src/primitives/menubar/menubar-help-search.html +78 -32
- package/src/primitives/menubar/menubar.html +166 -38
- package/src/primitives/meter/meter.css +41 -38
- package/src/primitives/meter/meter.html +44 -9
- package/src/primitives/mobile-menu/mobile-menu.css +47 -40
- package/src/primitives/mobile-menu/mobile-menu.html +1460 -179
- package/src/primitives/navigation-menu/navigation-menu-featured.html +155 -33
- package/src/primitives/navigation-menu/navigation-menu-icon-grid.html +222 -47
- package/src/primitives/navigation-menu/navigation-menu-interest.html +130 -38
- package/src/primitives/navigation-menu/navigation-menu-megamenu.html +402 -72
- package/src/primitives/navigation-menu/navigation-menu-simple.html +90 -40
- package/src/primitives/navigation-menu/navigation-menu.css +104 -106
- package/src/primitives/navigation-menu/navigation-menu.html +554 -158
- package/src/primitives/otp/otp.css +43 -44
- package/src/primitives/otp/otp.d.ts +4 -5
- package/src/primitives/otp/otp.d.ts.map +1 -1
- package/src/primitives/otp/otp.html +7 -6
- package/src/primitives/otp/otp.js +13 -18
- package/src/primitives/otp/otp.ts +12 -19
- package/src/primitives/password-group/password-group.css +132 -107
- package/src/primitives/password-group/password-group.d.ts.map +1 -1
- package/src/primitives/password-group/password-group.html +23 -16
- package/src/primitives/password-group/password-group.js +11 -12
- package/src/primitives/password-group/password-group.ts +11 -12
- package/src/primitives/popover/popover.css +89 -95
- package/src/primitives/popover/popover.html +18 -0
- package/src/primitives/progress/progress-indeterminate.html +1 -1
- package/src/primitives/progress/progress.css +34 -35
- package/src/primitives/progress/progress.html +18 -4
- package/src/primitives/prose/prose.html +19 -12
- package/src/primitives/radio/radio.css +83 -46
- package/src/primitives/radio/radio.html +16 -11
- package/src/primitives/reveal/reveal.css +37 -46
- package/src/primitives/reveal/reveal.html +15 -0
- package/src/primitives/scroll-fade/scroll-fade.css +115 -0
- package/src/primitives/scroll-fade/scroll-fade.html +69 -0
- package/src/primitives/select/multiselect.d.ts +8 -10
- package/src/primitives/select/multiselect.d.ts.map +1 -1
- package/src/primitives/select/multiselect.js +23 -27
- package/src/primitives/select/multiselect.ts +23 -29
- package/src/primitives/select/select-align.html +79 -16
- package/src/primitives/select/select-multiple.html +8 -4
- package/src/primitives/select/select-sides.html +104 -21
- package/src/primitives/select/select.css +299 -191
- package/src/primitives/select/select.html +24 -5
- package/src/primitives/separator/separator.css +15 -18
- package/src/primitives/separator/separator.html +37 -10
- package/src/primitives/slider/slider.css +48 -38
- package/src/primitives/slider/slider.html +9 -1
- package/src/primitives/style-guard/style-guard.d.ts +19 -0
- package/src/primitives/style-guard/style-guard.d.ts.map +1 -0
- package/src/primitives/style-guard/style-guard.js +125 -0
- package/src/primitives/style-guard/style-guard.ts +153 -0
- package/src/primitives/switch/switch.css +42 -33
- package/src/primitives/switch/switch.html +11 -6
- package/src/primitives/table/table-alternating.html +1 -1
- package/src/primitives/table/table-grid.html +5 -5
- package/src/primitives/table/table-size-sm.html +1 -1
- package/src/primitives/table/table.css +64 -61
- package/src/primitives/table/table.html +7 -7
- package/src/primitives/tabs/tabs.css +167 -166
- package/src/primitives/tabs/tabs.d.ts +10 -11
- package/src/primitives/tabs/tabs.d.ts.map +1 -1
- package/src/primitives/tabs/tabs.html +192 -36
- package/src/primitives/tabs/tabs.js +14 -15
- package/src/primitives/tabs/tabs.ts +14 -15
- package/src/primitives/textarea/textarea.css +69 -44
- package/src/primitives/textarea/textarea.html +3 -3
- package/src/primitives/toaster/toaster.css +90 -92
- package/src/primitives/toaster/toaster.d.ts +0 -6
- package/src/primitives/toaster/toaster.d.ts.map +1 -1
- package/src/primitives/toaster/toaster.html +22 -18
- package/src/primitives/toaster/toaster.js +64 -72
- package/src/primitives/toaster/toaster.ts +71 -87
- package/src/primitives/toggle/toggle.css +368 -153
- package/src/primitives/toggle/toggle.html +27 -9
- package/src/primitives/toggle-group/toggle-group-multiple.html +3 -3
- package/src/primitives/toggle-group/toggle-group-vertical.html +4 -4
- package/src/primitives/toggle-group/toggle-group.css +71 -23
- package/src/primitives/toggle-group/toggle-group.html +3 -3
- package/src/primitives/toolbar/toolbar.html +35 -13
- package/src/primitives/tooltip/tooltip-disabled.html +3 -3
- package/src/primitives/tooltip/tooltip-sides.html +36 -14
- package/src/primitives/tooltip/tooltip-with-kbd.html +5 -5
- package/src/primitives/tooltip/tooltip.css +111 -80
- package/src/primitives/tooltip/tooltip.html +3 -3
- package/src/primitives/utilities/aspect-ratio.html +51 -7
- package/src/primitives/utilities/basis.html +64 -11
- package/src/primitives/utilities/col-span.html +65 -9
- package/src/primitives/utilities/compose.html +48 -10
- package/src/primitives/utilities/flex-align.html +89 -19
- package/src/primitives/utilities/flex-direction.html +111 -13
- package/src/primitives/utilities/flex-grow.html +41 -7
- package/src/primitives/utilities/gap.html +158 -19
- package/src/primitives/utilities/grid-cols.html +75 -7
- package/src/primitives/utilities/grid-responsive.html +111 -12
- package/src/primitives/utilities/margin-auto.html +38 -7
- package/src/primitives/utilities/object-fit.html +75 -13
- package/src/primitives/utilities/order.html +40 -4
- package/src/primitives/utilities/overflow.html +74 -20
- package/src/primitives/utilities/padding-compose.html +67 -10
- package/src/primitives/utilities/padding.html +84 -13
- package/src/primitives/utilities/pile.html +29 -0
- package/src/primitives/utilities/position.html +65 -8
- package/src/primitives/utilities/responsive-flex.html +54 -7
- package/src/primitives/utilities/responsive-grid.html +115 -12
- package/src/primitives/utilities/size.html +120 -16
- package/src/primitives/utilities/width.html +123 -16
- package/examples/about.html +0 -583
- package/examples/components.html +0 -1028
- package/examples/forms.html +0 -504
- package/examples/index.html +0 -261
- package/examples/layout.html +0 -313
- package/examples/products.html +0 -839
- package/examples/responsive.html +0 -332
- package/src/base/_layout.css +0 -571
- package/src/base/_utilities.css +0 -6758
- package/src/primitives/utilities/grid-pile.html +0 -5
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* toaster.css: Toaster (ui-toaster |
|
|
2
|
+
* toaster.css: Toaster (ui-toaster | [data-ui~="toaster"], [data-toaster-slot~="toast"])
|
|
3
3
|
*
|
|
4
|
-
* Stacked toast notifications
|
|
5
|
-
*
|
|
6
|
-
* Emil Kowalski: https://sonner.emilkowal.ski (MIT).
|
|
4
|
+
* Stacked toast notifications: newest toast in front, older toasts peeking
|
|
5
|
+
* behind, expand on hover.
|
|
7
6
|
*
|
|
8
7
|
* @layer variables, components
|
|
9
|
-
* @requires
|
|
8
|
+
* @requires _layers.css, _variables.css, popover.css, button.css
|
|
10
9
|
* @uses popover="manual" + showPopover()/hidePopover(): top-layer region,
|
|
11
10
|
* driven by zazz/scripts/toaster.js (no light dismiss)
|
|
12
11
|
* @uses @starting-style: enter motion for toasts inserted into the open region
|
|
13
12
|
* @uses view-transition-name: toaster: own snapshot group, frozen in
|
|
14
13
|
* _view-transitions.css so page transitions never repaint the stack
|
|
15
|
-
* @uses JS-maintained
|
|
14
|
+
* @uses JS-maintained custom properties (--toasts-before, --offset, --initial-height,
|
|
16
15
|
* --front-toast-height + inline z-index): stack math from toaster.js
|
|
17
16
|
* @tokens --ui-toaster-* (@layer variables)
|
|
18
|
-
* @see /docs/components/toaster
|
|
19
17
|
*/
|
|
20
18
|
|
|
21
19
|
@layer variables {
|
|
22
20
|
:root {
|
|
23
21
|
/* surface */
|
|
24
|
-
--ui-toaster-
|
|
25
|
-
--ui-toaster-
|
|
26
|
-
--ui-toaster-border-color: var(--border);
|
|
27
|
-
--ui-toaster-
|
|
22
|
+
--ui-toaster-bg: var(--color-popover);
|
|
23
|
+
--ui-toaster-text: var(--color-popover-foreground);
|
|
24
|
+
--ui-toaster-border-color: var(--color-border);
|
|
25
|
+
--ui-toaster-rounded: var(--radius-md);
|
|
28
26
|
--ui-toaster-shadow: var(--shadow-md);
|
|
29
27
|
/* status accent: icon color; variants reassign */
|
|
30
|
-
--ui-toaster-accent: var(--popover-foreground);
|
|
28
|
+
--ui-toaster-accent: var(--color-popover-foreground);
|
|
31
29
|
|
|
32
30
|
/* metrics: mobile full width falls out of the min(); no media query */
|
|
33
|
-
--ui-toaster-
|
|
31
|
+
--ui-toaster-w: min(356px, calc(100vi - var(--gutters) * 2));
|
|
34
32
|
--ui-toaster-inset: var(--gutters);
|
|
35
|
-
--ui-toaster-gap: var(--
|
|
36
|
-
--ui-toaster-
|
|
37
|
-
--ui-toaster-icon-size: var(--
|
|
33
|
+
--ui-toaster-gap: calc(var(--spacing) * 3.5);
|
|
34
|
+
--ui-toaster-p: calc(var(--spacing) * 4);
|
|
35
|
+
--ui-toaster-icon-size: calc(var(--spacing) * 5);
|
|
38
36
|
|
|
39
37
|
/* type */
|
|
40
38
|
--ui-toaster-title-font-size: var(--font-size-sm);
|
|
41
39
|
--ui-toaster-title-font-weight: var(--font-weight-strong);
|
|
42
40
|
--ui-toaster-description-font-size: var(--font-size-sm);
|
|
43
|
-
--ui-toaster-description-
|
|
41
|
+
--ui-toaster-description-text: var(--color-muted-foreground);
|
|
44
42
|
|
|
45
43
|
/* stack: per-depth shrink of collapsed toasts */
|
|
46
44
|
--ui-toaster-scale-step: 0.05;
|
|
@@ -53,20 +51,15 @@
|
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
@layer
|
|
54
|
+
@layer ui.components {
|
|
57
55
|
/* ===========================================================================
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
is neutralized here. The region does not animate: JS hides it only after
|
|
63
|
-
the last toast's exit transition finishes.
|
|
64
|
-
- --_lift is an inherited coordination var (like --_gap in _utilities.css):
|
|
65
|
-
set per data-position on the region, read by every toast for the stack
|
|
66
|
-
direction (-1 = toasts travel up from the bottom edge, 1 = down from top).
|
|
56
|
+
REGION: positioning shell in the top layer, not a surface, so the shared
|
|
57
|
+
[popover] chrome is neutralized. --_lift is set on the region and read by
|
|
58
|
+
every toast for the stack direction (-1 = up from the bottom edge, 1 = down
|
|
59
|
+
from the top).
|
|
67
60
|
=========================================================================== */
|
|
68
61
|
|
|
69
|
-
:where(ui-toaster,
|
|
62
|
+
:where(ui-toaster, [data-ui~="toaster"]) {
|
|
70
63
|
/* neutralize shared [popover] chrome + UA popover styles */
|
|
71
64
|
background: none;
|
|
72
65
|
border: none;
|
|
@@ -86,66 +79,62 @@
|
|
|
86
79
|
inset: auto;
|
|
87
80
|
inset-block-end: var(--ui-toaster-inset);
|
|
88
81
|
inset-inline-end: var(--ui-toaster-inset);
|
|
89
|
-
inline-size: var(--ui-toaster-
|
|
82
|
+
inline-size: var(--ui-toaster-w);
|
|
90
83
|
--_lift: -1;
|
|
91
84
|
|
|
92
|
-
/*
|
|
93
|
-
|
|
94
|
-
active stack. One region per page: duplicate view-transition-names
|
|
95
|
-
would make the browser skip the whole transition. */
|
|
85
|
+
/* own frozen snapshot group so page transitions never repaint the stack;
|
|
86
|
+
one region per page, since duplicate names skip the whole transition */
|
|
96
87
|
view-transition-name: toaster;
|
|
97
88
|
}
|
|
98
89
|
|
|
99
|
-
:where(ui-toaster,
|
|
90
|
+
:where(ui-toaster, [data-ui~="toaster"]):popover-open {
|
|
100
91
|
display: block;
|
|
101
92
|
}
|
|
102
93
|
|
|
103
|
-
/*
|
|
94
|
+
/* logical positions flip for RTL; default is bottom-end */
|
|
104
95
|
|
|
105
|
-
:where(ui-toaster,
|
|
96
|
+
:where(ui-toaster, [data-ui~="toaster"])[data-toaster-position^="top"] {
|
|
106
97
|
inset-block-start: var(--ui-toaster-inset);
|
|
107
98
|
inset-block-end: auto;
|
|
108
99
|
--_lift: 1;
|
|
109
100
|
}
|
|
110
101
|
|
|
111
|
-
:where(ui-toaster,
|
|
102
|
+
:where(ui-toaster, [data-ui~="toaster"])[data-toaster-position$="start"] {
|
|
112
103
|
inset-inline-start: var(--ui-toaster-inset);
|
|
113
104
|
inset-inline-end: auto;
|
|
114
105
|
}
|
|
115
106
|
|
|
116
|
-
:where(ui-toaster,
|
|
117
|
-
inset-inline-start: calc(50vi - var(--ui-toaster-
|
|
107
|
+
:where(ui-toaster, [data-ui~="toaster"])[data-toaster-position$="center"] {
|
|
108
|
+
inset-inline-start: calc(50vi - var(--ui-toaster-w) / 2);
|
|
118
109
|
inset-inline-end: auto;
|
|
119
110
|
}
|
|
120
111
|
|
|
121
|
-
[data-
|
|
112
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="list"] {
|
|
122
113
|
list-style: none;
|
|
123
114
|
margin: 0;
|
|
124
115
|
padding: 0;
|
|
125
116
|
}
|
|
126
117
|
|
|
127
118
|
/* ===========================================================================
|
|
128
|
-
TOAST:
|
|
129
|
-
|
|
130
|
-
toaster.js maintains --toasts-before, --offset (cumulative expanded offset),
|
|
131
|
-
--initial-height, data-front, data-visible, data-removed, and inline z-index.
|
|
119
|
+
TOAST: placement is transform-based so enter/exit/stack shifts share one
|
|
120
|
+
transition.
|
|
132
121
|
=========================================================================== */
|
|
133
122
|
|
|
134
|
-
[data-
|
|
123
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="toast"] {
|
|
135
124
|
position: absolute;
|
|
136
125
|
inset-inline: 0;
|
|
137
126
|
inset-block-end: 0;
|
|
138
127
|
|
|
139
128
|
display: flex;
|
|
140
129
|
align-items: center;
|
|
141
|
-
gap: var(--
|
|
130
|
+
gap: calc(var(--spacing) * 2);
|
|
142
131
|
inline-size: 100%;
|
|
143
|
-
padding: var(--ui-toaster-
|
|
132
|
+
padding: var(--ui-toaster-p);
|
|
144
133
|
|
|
145
|
-
color: var(--ui-toaster-
|
|
146
|
-
background-color: var(--ui-toaster-
|
|
134
|
+
color: var(--ui-toaster-text);
|
|
135
|
+
background-color: var(--ui-toaster-bg);
|
|
147
136
|
border: 1px solid var(--ui-toaster-border-color);
|
|
148
|
-
border-radius: var(--ui-toaster-
|
|
137
|
+
border-radius: var(--ui-toaster-rounded);
|
|
149
138
|
box-shadow: var(--ui-toaster-shadow);
|
|
150
139
|
overflow-wrap: anywhere;
|
|
151
140
|
|
|
@@ -157,21 +146,21 @@
|
|
|
157
146
|
opacity var(--ui-toaster-transition-duration) var(--ui-toaster-transition-timing-function),
|
|
158
147
|
block-size var(--ui-toaster-transition-duration) var(--ui-toaster-transition-timing-function);
|
|
159
148
|
|
|
160
|
-
/*
|
|
161
|
-
already :popover-open; JS shows it before appending). */
|
|
149
|
+
/* slide in from the region's edge (JS opens the region before appending) */
|
|
162
150
|
@starting-style {
|
|
163
151
|
opacity: var(--ui-toaster-opacity--start);
|
|
164
152
|
transform: translateY(calc(var(--_lift) * -100%));
|
|
165
153
|
}
|
|
166
154
|
}
|
|
167
155
|
|
|
168
|
-
:where(ui-toaster,
|
|
156
|
+
:where(ui-toaster, [data-ui~="toaster"])[data-toaster-position^="top"]
|
|
157
|
+
[data-toaster-slot~="toast"] {
|
|
169
158
|
inset-block-end: auto;
|
|
170
159
|
inset-block-start: 0;
|
|
171
160
|
}
|
|
172
161
|
|
|
173
|
-
/*
|
|
174
|
-
[data-
|
|
162
|
+
/* content crossfades on collapse/expand */
|
|
163
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="toast"] > * {
|
|
175
164
|
transition: opacity var(--ui-toaster-transition-duration)
|
|
176
165
|
var(--ui-toaster-transition-timing-function);
|
|
177
166
|
}
|
|
@@ -182,15 +171,18 @@
|
|
|
182
171
|
their edges peek, content hidden.
|
|
183
172
|
=========================================================================== */
|
|
184
173
|
|
|
185
|
-
:where(ui-toaster,
|
|
186
|
-
[data-slot~="
|
|
174
|
+
:where(ui-toaster, [data-ui~="toaster"]):not([data-toaster-state~="expanded"])
|
|
175
|
+
[data-toaster-slot~="toast"]:not(
|
|
176
|
+
[data-toaster-state~="front"],
|
|
177
|
+
[data-toaster-state~="removed"]
|
|
178
|
+
) {
|
|
187
179
|
--_y: translateY(calc(var(--_lift) * var(--ui-toaster-gap) * var(--toasts-before, 0)))
|
|
188
180
|
scale(calc(1 - var(--ui-toaster-scale-step) * var(--toasts-before, 0)));
|
|
189
181
|
block-size: var(--front-toast-height);
|
|
190
182
|
}
|
|
191
183
|
|
|
192
|
-
:where(ui-toaster,
|
|
193
|
-
[data-slot~="
|
|
184
|
+
:where(ui-toaster, [data-ui~="toaster"]):not([data-toaster-state~="expanded"])
|
|
185
|
+
[data-toaster-slot~="toast"]:not([data-toaster-state~="front"], [data-toaster-state~="removed"])
|
|
194
186
|
> * {
|
|
195
187
|
opacity: 0;
|
|
196
188
|
}
|
|
@@ -201,11 +193,13 @@
|
|
|
201
193
|
while moving between toasts (which would collapse it).
|
|
202
194
|
=========================================================================== */
|
|
203
195
|
|
|
204
|
-
:where(ui-toaster,
|
|
196
|
+
:where(ui-toaster, [data-ui~="toaster"])[data-toaster-state~="expanded"]
|
|
197
|
+
[data-toaster-slot~="toast"] {
|
|
205
198
|
block-size: var(--initial-height, auto);
|
|
206
199
|
}
|
|
207
200
|
|
|
208
|
-
:where(ui-toaster,
|
|
201
|
+
:where(ui-toaster, [data-ui~="toaster"])[data-toaster-state~="expanded"]
|
|
202
|
+
[data-toaster-slot~="toast"]::after {
|
|
209
203
|
content: "";
|
|
210
204
|
position: absolute;
|
|
211
205
|
inset-inline: 0;
|
|
@@ -213,14 +207,18 @@
|
|
|
213
207
|
block-size: calc(var(--ui-toaster-gap) + 1px);
|
|
214
208
|
}
|
|
215
209
|
|
|
216
|
-
:where(
|
|
217
|
-
|
|
210
|
+
:where(
|
|
211
|
+
ui-toaster,
|
|
212
|
+
[data-ui~="toaster"]
|
|
213
|
+
)[data-toaster-position^="top"][data-toaster-state~="expanded"]
|
|
214
|
+
[data-toaster-slot~="toast"]::after {
|
|
218
215
|
inset-block-end: auto;
|
|
219
216
|
inset-block-start: 100%;
|
|
220
217
|
}
|
|
221
218
|
|
|
222
|
-
/*
|
|
223
|
-
[data-
|
|
219
|
+
/* beyond the visible limit: stays in the DOM but hidden */
|
|
220
|
+
:where(ui-toaster, [data-ui~="toaster"])
|
|
221
|
+
[data-toaster-slot~="toast"]:not([data-toaster-state~="visible"]) {
|
|
224
222
|
opacity: 0;
|
|
225
223
|
pointer-events: none;
|
|
226
224
|
}
|
|
@@ -231,59 +229,55 @@
|
|
|
231
229
|
and simply fade, so removal doesn't jump the stack.
|
|
232
230
|
=========================================================================== */
|
|
233
231
|
|
|
234
|
-
/*
|
|
235
|
-
mouseleave
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
/* keep the dying toast pointer-active: dropping it from hit-testing would
|
|
233
|
+
fire mouseleave and collapse an expanded stack mid-dismiss */
|
|
234
|
+
:where(ui-toaster, [data-ui~="toaster"])
|
|
235
|
+
[data-toaster-slot~="toast"][data-toaster-state~="removed"] {
|
|
238
236
|
opacity: var(--ui-toaster-opacity--start);
|
|
239
237
|
--_y: translateY(calc(var(--_lift) * var(--offset, 0px) + var(--_lift) * -100%));
|
|
240
238
|
}
|
|
241
239
|
|
|
242
|
-
:where(ui-toaster,
|
|
243
|
-
[data-slot~="
|
|
240
|
+
:where(ui-toaster, [data-ui~="toaster"]):not([data-toaster-state~="expanded"])
|
|
241
|
+
[data-toaster-slot~="toast"][data-toaster-state~="removed"]:not([data-toaster-state~="front"]) {
|
|
244
242
|
--_y: translateY(calc(var(--_lift) * var(--ui-toaster-gap) * var(--toasts-before, 0)))
|
|
245
243
|
scale(calc(1 - var(--ui-toaster-scale-step) * var(--toasts-before, 0)));
|
|
246
244
|
}
|
|
247
245
|
|
|
248
|
-
|
|
249
|
-
TOAST PARTS
|
|
250
|
-
=========================================================================== */
|
|
251
|
-
|
|
252
|
-
[data-slot~="toaster-icon"] {
|
|
246
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="icon"] {
|
|
253
247
|
flex-shrink: 0;
|
|
254
248
|
inline-size: var(--ui-toaster-icon-size);
|
|
255
249
|
block-size: var(--ui-toaster-icon-size);
|
|
256
250
|
color: var(--ui-toaster-accent);
|
|
257
251
|
}
|
|
258
252
|
|
|
259
|
-
[data-
|
|
253
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="icon"] > svg {
|
|
260
254
|
display: block;
|
|
261
255
|
inline-size: 100%;
|
|
262
256
|
block-size: 100%;
|
|
263
257
|
}
|
|
264
258
|
|
|
265
|
-
[data-
|
|
259
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="content"] {
|
|
266
260
|
flex: 1;
|
|
267
261
|
min-inline-size: 0;
|
|
268
262
|
display: flex;
|
|
269
263
|
flex-direction: column;
|
|
270
|
-
gap: var(--
|
|
264
|
+
gap: var(--spacing);
|
|
271
265
|
}
|
|
272
266
|
|
|
273
|
-
[data-
|
|
267
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="title"] {
|
|
274
268
|
font-size: var(--ui-toaster-title-font-size);
|
|
275
269
|
font-weight: var(--ui-toaster-title-font-weight);
|
|
276
270
|
line-height: var(--leading-sm);
|
|
277
271
|
}
|
|
278
272
|
|
|
279
|
-
[data-
|
|
273
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="description"] {
|
|
280
274
|
font-size: var(--ui-toaster-description-font-size);
|
|
281
275
|
line-height: var(--leading-sm);
|
|
282
|
-
color: var(--ui-toaster-description-
|
|
276
|
+
color: var(--ui-toaster-description-text);
|
|
283
277
|
}
|
|
284
278
|
|
|
285
|
-
[data-
|
|
286
|
-
[data-
|
|
279
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="action"],
|
|
280
|
+
:where(ui-toaster, [data-ui~="toaster"]) [data-toaster-slot~="close"] {
|
|
287
281
|
flex-shrink: 0;
|
|
288
282
|
}
|
|
289
283
|
|
|
@@ -291,19 +285,23 @@
|
|
|
291
285
|
VARIANTS: reassign the accent token only
|
|
292
286
|
=========================================================================== */
|
|
293
287
|
|
|
294
|
-
[data-
|
|
295
|
-
|
|
288
|
+
:where(ui-toaster, [data-ui~="toaster"])
|
|
289
|
+
[data-toaster-slot~="toast"][data-toaster-variant="success"] {
|
|
290
|
+
--ui-toaster-accent: var(--color-success);
|
|
296
291
|
}
|
|
297
292
|
|
|
298
|
-
[data-
|
|
299
|
-
|
|
293
|
+
:where(ui-toaster, [data-ui~="toaster"])
|
|
294
|
+
[data-toaster-slot~="toast"][data-toaster-variant="info"] {
|
|
295
|
+
--ui-toaster-accent: var(--color-info);
|
|
300
296
|
}
|
|
301
297
|
|
|
302
|
-
[data-
|
|
303
|
-
|
|
298
|
+
:where(ui-toaster, [data-ui~="toaster"])
|
|
299
|
+
[data-toaster-slot~="toast"][data-toaster-variant="warning"] {
|
|
300
|
+
--ui-toaster-accent: var(--color-warning);
|
|
304
301
|
}
|
|
305
302
|
|
|
306
|
-
[data-
|
|
307
|
-
|
|
303
|
+
:where(ui-toaster, [data-ui~="toaster"])
|
|
304
|
+
[data-toaster-slot~="toast"][data-toaster-variant="destructive"] {
|
|
305
|
+
--ui-toaster-accent: var(--color-destructive);
|
|
308
306
|
}
|
|
309
307
|
}
|
|
@@ -47,12 +47,6 @@ declare function computeStackLayout(heights: number[]): {
|
|
|
47
47
|
toasts: ToastStackLayout[];
|
|
48
48
|
frontToastHeightPx: number | null;
|
|
49
49
|
};
|
|
50
|
-
/**
|
|
51
|
-
* @class
|
|
52
|
-
* @description Hosts the toast stack: builds toast markup, maintains the
|
|
53
|
-
* collapsed-stack CSS custom properties, runs auto-dismiss timers, and shows or
|
|
54
|
-
* hides the `popover="manual"` region as toasts come and go.
|
|
55
|
-
*/
|
|
56
50
|
declare class UiToaster extends ZazzElement {
|
|
57
51
|
#private;
|
|
58
52
|
protected setup(signal: AbortSignal): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["toaster.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["toaster.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AA6B5E,UAAU,WAAW;IACnB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CACvC;AAED,UAAU,YAAY;IACpB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,CAAC;IACzD,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,wDAAwD;IACxD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAmBD,0EAA0E;AAC1E,UAAU,gBAAgB;IACxB,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,KAAK,EAAE,OAAO,CAAC;IACf,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAC;CAClB;AAqBD;;;;;;;;GAQG;AACH,iBAAS,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG;IAC9C,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAkBA;AAyBD,cAAM,SAAU,SAAQ,WAAW;;IA4BjC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAwFzC;IAED,SAAS,CAAC,QAAQ,IAAI,IAAI,CAKzB;IAED;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,GAAE,YAAiB,GAAG,MAAM,CAa3C;IAED;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAiCzB;IAED;;OAEG;IACH,UAAU,IAAI,IAAI,CAKjB;CA2SF;AAqCD;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,OAAO;IACX;;;;;OAKG;IACH,KAAK,WAAW,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI;IAMrD;;;;;;OAMG;IACH,OAAO,UAAU,MAAM,YAAY,YAAY,GAAG,MAAM,GAAG,IAAI;IAI/D;;;;;;OAMG;IACH,IAAI,UAAU,MAAM,YAAY,YAAY,GAAG,MAAM,GAAG,IAAI;IAI5D;;;;;;OAMG;IACH,OAAO,UAAU,MAAM,YAAY,YAAY,GAAG,MAAM,GAAG,IAAI;IAI/D;;;;;;OAMG;IACH,KAAK,UAAU,MAAM,YAAY,YAAY,GAAG,MAAM,GAAG,IAAI;IAI7D;;;;OAIG;IACH,OAAO,MAAM,MAAM,GAAG,IAAI;CAK3B,CAAC;AAQF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,52 +1,59 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div
|
|
2
|
+
style="
|
|
3
|
+
--display: flex;
|
|
4
|
+
--flex-wrap: wrap;
|
|
5
|
+
--items: center;
|
|
6
|
+
--gap: 4;
|
|
7
|
+
"
|
|
8
|
+
>
|
|
2
9
|
<button
|
|
3
|
-
|
|
10
|
+
data-ui="button"
|
|
4
11
|
type="button"
|
|
5
12
|
commandfor="toaster-example"
|
|
6
13
|
command="--toast"
|
|
7
|
-
data-title="Event created"
|
|
8
|
-
data-description="Monday, July 13 at 9:00 AM"
|
|
14
|
+
data-toaster-title="Event created"
|
|
15
|
+
data-toaster-description="Monday, July 13 at 9:00 AM"
|
|
9
16
|
>
|
|
10
17
|
Show toast
|
|
11
18
|
</button>
|
|
12
19
|
<button
|
|
13
|
-
|
|
20
|
+
data-ui="button"
|
|
14
21
|
type="button"
|
|
15
22
|
commandfor="toaster-example"
|
|
16
23
|
command="--toast-success"
|
|
17
|
-
data-title="Changes saved"
|
|
24
|
+
data-toaster-title="Changes saved"
|
|
18
25
|
>
|
|
19
26
|
Success
|
|
20
27
|
</button>
|
|
21
28
|
<button
|
|
22
|
-
|
|
29
|
+
data-ui="button"
|
|
23
30
|
type="button"
|
|
24
31
|
commandfor="toaster-example"
|
|
25
32
|
command="--toast-info"
|
|
26
|
-
data-title="Update available"
|
|
33
|
+
data-toaster-title="Update available"
|
|
27
34
|
>
|
|
28
35
|
Info
|
|
29
36
|
</button>
|
|
30
37
|
<button
|
|
31
|
-
|
|
38
|
+
data-ui="button"
|
|
32
39
|
type="button"
|
|
33
40
|
commandfor="toaster-example"
|
|
34
41
|
command="--toast-warning"
|
|
35
|
-
data-title="Storage almost full"
|
|
42
|
+
data-toaster-title="Storage almost full"
|
|
36
43
|
>
|
|
37
44
|
Warning
|
|
38
45
|
</button>
|
|
39
46
|
<button
|
|
40
|
-
|
|
47
|
+
data-ui="button"
|
|
41
48
|
type="button"
|
|
42
49
|
commandfor="toaster-example"
|
|
43
50
|
command="--toast-destructive"
|
|
44
|
-
data-title="Something went wrong"
|
|
45
|
-
data-description="The request could not be completed."
|
|
51
|
+
data-toaster-title="Something went wrong"
|
|
52
|
+
data-toaster-description="The request could not be completed."
|
|
46
53
|
>
|
|
47
54
|
Error
|
|
48
55
|
</button>
|
|
49
|
-
<button
|
|
56
|
+
<button data-ui="button" data-button-variant="primary" type="button" id="toaster-action-example">
|
|
50
57
|
With action
|
|
51
58
|
</button>
|
|
52
59
|
</div>
|
|
@@ -54,8 +61,7 @@
|
|
|
54
61
|
<ui-toaster id="toaster-example" popover="manual"></ui-toaster>
|
|
55
62
|
|
|
56
63
|
<script type="module">
|
|
57
|
-
//
|
|
58
|
-
// in a data attribute). Everything else above is wired declaratively.
|
|
64
|
+
// An action callback can't live in a data attribute, so it needs the imperative API.
|
|
59
65
|
await customElements.whenDefined("ui-toaster");
|
|
60
66
|
|
|
61
67
|
const toastTrigger = document.getElementById("toaster-action-example");
|
|
@@ -69,8 +75,6 @@
|
|
|
69
75
|
|
|
70
76
|
toastTrigger.addEventListener("click", handler);
|
|
71
77
|
|
|
72
|
-
// Optional: If you need to clean up immediately after the event or on some app shutdown:
|
|
73
|
-
// Example cleanup on page unload for demo purposes:
|
|
74
78
|
window.addEventListener("unload", () => {
|
|
75
79
|
toastTrigger.removeEventListener("click", handler);
|
|
76
80
|
});
|