@editora/ui-core 0.1.24 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +339 -5
- package/dist/accordion.cjs.js +13 -12
- package/dist/accordion.esm.js +13 -12
- package/dist/alert-dialog.cjs.js +76 -45
- package/dist/alert-dialog.esm.js +179 -135
- package/dist/alert.cjs.js +41 -32
- package/dist/alert.esm.js +79 -70
- package/dist/animated-beam.cjs.js +42 -50
- package/dist/animated-beam.esm.js +47 -55
- package/dist/animated-list.cjs.js +11 -27
- package/dist/animated-list.esm.js +12 -28
- package/dist/animated-text.cjs.js +4 -4
- package/dist/animated-text.esm.js +4 -4
- package/dist/app-header.cjs.js +5 -5
- package/dist/app-header.esm.js +6 -6
- package/dist/aspect-ratio.cjs.js +10 -12
- package/dist/aspect-ratio.esm.js +11 -13
- package/dist/avatar.cjs.js +13 -17
- package/dist/avatar.esm.js +13 -17
- package/dist/badge.cjs.js +27 -22
- package/dist/badge.esm.js +32 -27
- package/dist/block-controls.cjs.js +11 -12
- package/dist/block-controls.esm.js +8 -9
- package/dist/box.cjs.js +2 -3
- package/dist/box.esm.js +2 -3
- package/dist/breadcrumb.cjs.js +12 -18
- package/dist/breadcrumb.esm.js +11 -17
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/{calendar-B3PUKHQm.mjs → calendar-DmxiZrR7.mjs} +126 -117
- package/dist/{calendar-D-mXMgqc.js → calendar-o273O28D.js} +53 -44
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +6 -7
- package/dist/card.esm.js +5 -6
- package/dist/chart.cjs.js +52 -52
- package/dist/chart.esm.js +95 -95
- package/dist/checkbox.cjs.js +19 -15
- package/dist/checkbox.esm.js +19 -15
- package/dist/collapsible.cjs.js +7 -11
- package/dist/collapsible.esm.js +7 -11
- package/dist/color-picker.cjs.js +36 -17
- package/dist/color-picker.esm.js +132 -113
- package/dist/combobox.cjs.js +57 -54
- package/dist/combobox.esm.js +62 -58
- package/dist/command-palette.cjs.js +1 -0
- package/dist/command-palette.esm.js +1 -0
- package/dist/command.cjs.js +32 -14
- package/dist/command.esm.js +46 -28
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/gantt-schedule.d.ts +79 -0
- package/dist/components/gantt-schedule.d.ts.map +1 -0
- package/dist/components/ui-accordion.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-alert.d.ts.map +1 -1
- package/dist/components/ui-animated-beam.d.ts.map +1 -1
- package/dist/components/ui-animated-list.d.ts.map +1 -1
- package/dist/components/ui-aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui-avatar.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-block-controls.d.ts.map +1 -1
- package/dist/components/ui-box.d.ts.map +1 -1
- package/dist/components/ui-breadcrumb.d.ts.map +1 -1
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-calendar.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-collapsible.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-command-palette.d.ts.map +1 -1
- package/dist/components/ui-command.d.ts.map +1 -1
- package/dist/components/ui-container.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-data-table.d.ts +7 -0
- package/dist/components/ui-data-table.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +2 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-dock.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-empty-state.d.ts.map +1 -1
- package/dist/components/ui-field.d.ts.map +1 -1
- package/dist/components/ui-fieldset.d.ts.map +1 -1
- package/dist/components/ui-file-upload.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-form.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts +186 -2
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-icon-cloud.d.ts.map +1 -1
- package/dist/components/ui-inline-edit.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-marquee.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-meter.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-pagination.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-pin-input.d.ts.map +1 -1
- package/dist/components/ui-popover.d.ts.map +1 -1
- package/dist/components/ui-progress.d.ts.map +1 -1
- package/dist/components/ui-radio-group.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-scroll-area.d.ts.map +1 -1
- package/dist/components/ui-section.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-slider.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-spinning-text.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-splitter.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-tags-input.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/components/ui-toggle-group.d.ts +2 -0
- package/dist/components/ui-toggle-group.d.ts.map +1 -1
- package/dist/components/ui-toggle.d.ts.map +1 -1
- package/dist/components/ui-toolbar.d.ts +2 -0
- package/dist/components/ui-toolbar.d.ts.map +1 -1
- package/dist/components/ui-tooltip.d.ts.map +1 -1
- package/dist/components/ui-transfer-list.d.ts.map +1 -1
- package/dist/components/ui-tree-item.d.ts.map +1 -1
- package/dist/components/ui-tree.d.ts.map +1 -1
- package/dist/components/ui-wizard.d.ts.map +1 -1
- package/dist/container.cjs.js +6 -12
- package/dist/container.esm.js +8 -14
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +42 -41
- package/dist/data-table.cjs.js +18 -15
- package/dist/data-table.esm.js +207 -187
- package/dist/date-field.cjs.js +8 -8
- package/dist/date-field.esm.js +7 -7
- package/dist/date-picker.cjs.js +27 -18
- package/dist/date-picker.esm.js +57 -48
- package/dist/date-range-picker.cjs.js +22 -17
- package/dist/date-range-picker.esm.js +31 -26
- package/dist/date-range-time-picker.cjs.js +26 -19
- package/dist/date-range-time-picker.esm.js +23 -16
- package/dist/date-time-picker.cjs.js +23 -16
- package/dist/date-time-picker.esm.js +88 -81
- package/dist/{date-time-utils-BTlxnz5j.mjs → date-time-utils-B4hAkt36.mjs} +75 -68
- package/dist/date-time-utils-DdigV4hs.js +1 -0
- package/dist/dialog.cjs.js +57 -41
- package/dist/dialog.esm.js +84 -51
- package/dist/dock.cjs.js +16 -30
- package/dist/dock.esm.js +26 -40
- package/dist/drawer.cjs.js +8 -12
- package/dist/drawer.esm.js +6 -10
- package/dist/dropdown.cjs.js +8 -6
- package/dist/dropdown.esm.js +33 -30
- package/dist/empty-state.cjs.js +17 -15
- package/dist/empty-state.esm.js +13 -11
- package/dist/field.cjs.js +22 -13
- package/dist/field.esm.js +54 -45
- package/dist/fieldset.cjs.js +18 -11
- package/dist/fieldset.esm.js +20 -13
- package/dist/file-upload.cjs.js +77 -35
- package/dist/file-upload.esm.js +152 -110
- package/dist/floating-toolbar.cjs.js +6 -7
- package/dist/floating-toolbar.esm.js +8 -9
- package/dist/form.cjs.js +20 -23
- package/dist/form.esm.js +20 -23
- package/dist/gantt.cjs.js +525 -110
- package/dist/gantt.esm.js +1882 -377
- package/dist/hover-card.cjs.js +7 -7
- package/dist/hover-card.esm.js +7 -7
- package/dist/icon-cloud.cjs.js +19 -36
- package/dist/icon-cloud.esm.js +41 -58
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +108 -104
- package/dist/inline-edit.cjs.js +47 -19
- package/dist/inline-edit.esm.js +66 -38
- package/dist/input.cjs.js +44 -37
- package/dist/input.esm.js +59 -52
- package/dist/layout.cjs.js +3 -3
- package/dist/layout.esm.js +3 -3
- package/dist/marquee.cjs.js +7 -10
- package/dist/marquee.esm.js +7 -10
- package/dist/menu.cjs.js +8 -24
- package/dist/menu.esm.js +52 -72
- package/dist/menubar.cjs.js +9 -31
- package/dist/menubar.esm.js +127 -153
- package/dist/meter.cjs.js +4 -9
- package/dist/meter.esm.js +6 -11
- package/dist/multi-select.cjs.js +48 -35
- package/dist/multi-select.esm.js +67 -53
- package/dist/navigation-menu.cjs.js +10 -10
- package/dist/navigation-menu.esm.js +33 -33
- package/dist/number-field.cjs.js +27 -16
- package/dist/number-field.esm.js +36 -25
- package/dist/odometer.cjs.js +5 -5
- package/dist/odometer.esm.js +3 -3
- package/dist/orbiter.cjs.js +11 -28
- package/dist/orbiter.esm.js +28 -45
- package/dist/overlay-motion-B56x1GoY.js +49 -0
- package/dist/overlay-motion-BX3dPLay.mjs +120 -0
- package/dist/pagination.cjs.js +28 -25
- package/dist/pagination.esm.js +54 -51
- package/dist/password-field.cjs.js +38 -33
- package/dist/password-field.esm.js +62 -57
- package/dist/pin-input.cjs.js +17 -13
- package/dist/pin-input.esm.js +23 -19
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +16 -28
- package/dist/popover.esm.js +29 -45
- package/dist/portal-DeaM1tYY.mjs +121 -0
- package/dist/portal-XbYR3m_q.js +1 -0
- package/dist/portal.d.ts +3 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/{positioner-D0VGxtYU.mjs → positioner-BE8Nbho2.mjs} +5 -3
- package/dist/{positioner-D_fqyx_j.js → positioner-DZ1FW6A9.js} +1 -1
- package/dist/positioner.cjs.js +1 -1
- package/dist/positioner.esm.js +1 -1
- package/dist/primitives/overlay-motion.d.ts +47 -0
- package/dist/primitives/overlay-motion.d.ts.map +1 -0
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/progress.cjs.js +11 -16
- package/dist/progress.esm.js +37 -42
- package/dist/quick-actions.cjs.js +13 -13
- package/dist/quick-actions.esm.js +11 -11
- package/dist/radio-group.cjs.js +50 -26
- package/dist/radio-group.esm.js +53 -29
- package/dist/radio.cjs.js +15 -12
- package/dist/radio.esm.js +15 -12
- package/dist/rating.cjs.js +11 -15
- package/dist/rating.esm.js +48 -50
- package/dist/{runtime-CFnK53iC.mjs → runtime-CQM6wZOc.mjs} +498 -514
- package/dist/runtime-DxCl0A5q.js +5 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +3 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +36 -32
- package/dist/scroll-area.cjs.js +3 -4
- package/dist/scroll-area.esm.js +3 -4
- package/dist/section.cjs.js +2 -4
- package/dist/section.esm.js +2 -4
- package/dist/select.cjs.js +40 -73
- package/dist/select.esm.js +55 -87
- package/dist/selection-popup.cjs.js +3 -4
- package/dist/selection-popup.esm.js +3 -4
- package/dist/semantic-tokens.d.ts +17 -0
- package/dist/semantic-tokens.d.ts.map +1 -0
- package/dist/sidebar.cjs.js +22 -22
- package/dist/sidebar.esm.js +25 -25
- package/dist/skeleton.cjs.js +2 -2
- package/dist/skeleton.esm.js +2 -2
- package/dist/slider.cjs.js +22 -26
- package/dist/slider.esm.js +25 -29
- package/dist/sortable.cjs.js +4 -5
- package/dist/sortable.esm.js +4 -5
- package/dist/spinning-text.cjs.js +4 -13
- package/dist/spinning-text.esm.js +4 -13
- package/dist/split-button.cjs.js +5 -5
- package/dist/split-button.esm.js +15 -14
- package/dist/splitter.cjs.js +52 -10
- package/dist/splitter.esm.js +55 -13
- package/dist/stepper.cjs.js +31 -65
- package/dist/stepper.esm.js +32 -66
- package/dist/switch.cjs.js +20 -22
- package/dist/switch.esm.js +20 -22
- package/dist/table.cjs.js +5 -5
- package/dist/table.esm.js +20 -20
- package/dist/tabs.cjs.js +91 -21
- package/dist/tabs.esm.js +182 -112
- package/dist/tags-input.cjs.js +41 -15
- package/dist/tags-input.esm.js +73 -47
- package/dist/textarea.cjs.js +32 -33
- package/dist/textarea.esm.js +38 -39
- package/dist/theme.d.ts +25 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +7 -7
- package/dist/time-field.esm.js +6 -6
- package/dist/time-picker.cjs.js +16 -13
- package/dist/time-picker.esm.js +27 -24
- package/dist/timeline.cjs.js +10 -10
- package/dist/timeline.esm.js +7 -7
- package/dist/toggle-group.cjs.js +13 -13
- package/dist/toggle-group.esm.js +66 -61
- package/dist/toggle.cjs.js +52 -34
- package/dist/toggle.esm.js +80 -62
- package/dist/toolbar.cjs.js +14 -14
- package/dist/toolbar.esm.js +41 -33
- package/dist/tooltip.cjs.js +3 -3
- package/dist/tooltip.esm.js +39 -33
- package/dist/transfer-list.cjs.js +28 -29
- package/dist/transfer-list.esm.js +28 -29
- package/dist/{tree-B_oQput6.mjs → tree-33fVNnaf.mjs} +6 -5
- package/dist/{tree-SivHxcAy.js → tree-Dc02MChE.js} +6 -5
- package/dist/tree-item.cjs.js +9 -8
- package/dist/tree-item.esm.js +13 -12
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/{ui-button-Co8Sid6t.mjs → ui-button-C3OmI7Sn.mjs} +152 -154
- package/dist/{ui-button-BPrzJScZ.js → ui-button-CnLwXBnx.js} +107 -109
- package/dist/wizard.cjs.js +39 -36
- package/dist/wizard.esm.js +39 -36
- package/package.json +1 -1
- package/dist/date-time-utils-y3AvNvGe.js +0 -1
- package/dist/portal-DgpQ3Jo1.js +0 -1
- package/dist/portal-bR42gHvG.mjs +0 -118
- package/dist/runtime-DwE-tizc.js +0 -1
package/dist/alert.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("./ElementBase-DxbvhLJs.js"),z=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
|
-
--ui-alert-radius: var(--base-alert-radius, var(--ui-radius,
|
|
4
|
+
--ui-alert-radius: var(--base-alert-radius, var(--ui-radius, 6px));
|
|
5
5
|
--ui-alert-padding-y: var(--base-alert-padding-y, 14px);
|
|
6
6
|
--ui-alert-padding-x: var(--base-alert-padding-x, 16px);
|
|
7
7
|
--ui-alert-gap: var(--base-alert-gap, var(--ui-default-gap, 8px));
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
--ui-alert-focus-ring: var(--ui-color-focus-ring, var(--ui-focus-ring, #2563eb));
|
|
21
21
|
--ui-alert-title-size: var(--ui-default-font-size, 14px);
|
|
22
22
|
--ui-alert-title-line-height: var(--ui-default-line-height, 20px);
|
|
23
|
-
--ui-alert-title-weight:
|
|
23
|
+
--ui-alert-title-weight: 600;
|
|
24
24
|
--ui-alert-description-size: 13px;
|
|
25
25
|
--ui-alert-description-line-height: 20px;
|
|
26
|
-
--ui-alert-icon-size: var(--base-alert-icon-size,
|
|
26
|
+
--ui-alert-icon-size: var(--base-alert-icon-size, 20px);
|
|
27
27
|
--ui-alert-dismiss-size: var(--base-alert-dismiss-size, 28px);
|
|
28
28
|
--ui-alert-duration: var(--ui-motion-base, 180ms);
|
|
29
29
|
--ui-alert-easing: var(--ui-motion-easing, cubic-bezier(0.2, 0.8, 0.2, 1));
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
--ui-alert-title-line-height: 18px;
|
|
40
40
|
--ui-alert-description-size: 12px;
|
|
41
41
|
--ui-alert-description-line-height: 18px;
|
|
42
|
-
--ui-alert-icon-size:
|
|
42
|
+
--ui-alert-icon-size: 18px;
|
|
43
43
|
--ui-alert-dismiss-size: 26px;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
--ui-alert-title-line-height: 22px;
|
|
60
60
|
--ui-alert-description-size: 14px;
|
|
61
61
|
--ui-alert-description-line-height: 22px;
|
|
62
|
-
--ui-alert-icon-size:
|
|
62
|
+
--ui-alert-icon-size: 22px;
|
|
63
63
|
--ui-alert-dismiss-size: 30px;
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -68,6 +68,11 @@
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.alert {
|
|
71
|
+
/* A hairline in the tone colour, no shadow. These are set here, not on the host, so they follow the tone. */
|
|
72
|
+
--ui-alert-border: var(--base-alert-border, 1px solid color-mix(in srgb, var(--ui-alert-accent) 28%, transparent));
|
|
73
|
+
--ui-alert-shadow: var(--base-alert-shadow, none);
|
|
74
|
+
--ui-alert-icon-bg: transparent;
|
|
75
|
+
--ui-alert-icon-color: color-mix(in srgb, var(--ui-alert-accent) 55%, var(--ui-color-text-strong, var(--ui-alert-color)));
|
|
71
76
|
position: relative;
|
|
72
77
|
border-radius: var(--ui-alert-radius);
|
|
73
78
|
border: var(--ui-alert-border);
|
|
@@ -88,11 +93,12 @@
|
|
|
88
93
|
inset-block: 0;
|
|
89
94
|
inset-inline-start: 0;
|
|
90
95
|
width: 3px;
|
|
91
|
-
background:
|
|
96
|
+
background: var(--ui-alert-accent);
|
|
92
97
|
pointer-events: none;
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
:
|
|
100
|
+
/* The coloured bar on the leading edge is opt-in: indicator="line". */
|
|
101
|
+
:host(:not([indicator="line"])) .alert::before {
|
|
96
102
|
display: none;
|
|
97
103
|
}
|
|
98
104
|
|
|
@@ -104,7 +110,7 @@
|
|
|
104
110
|
}
|
|
105
111
|
|
|
106
112
|
.icon-wrap {
|
|
107
|
-
margin-top:
|
|
113
|
+
margin-top: 0;
|
|
108
114
|
width: var(--ui-alert-icon-size);
|
|
109
115
|
min-width: var(--ui-alert-icon-size);
|
|
110
116
|
height: var(--ui-alert-icon-size);
|
|
@@ -114,7 +120,6 @@
|
|
|
114
120
|
display: inline-flex;
|
|
115
121
|
align-items: center;
|
|
116
122
|
justify-content: center;
|
|
117
|
-
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-alert-accent) 24%, transparent);
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
.icon {
|
|
@@ -232,41 +237,45 @@
|
|
|
232
237
|
|
|
233
238
|
:host([tone="info"]) .alert {
|
|
234
239
|
--ui-alert-accent: var(--ui-color-primary, #2563eb);
|
|
235
|
-
--ui-alert-bg:
|
|
236
|
-
180deg,
|
|
237
|
-
color-mix(in srgb, var(--ui-color-primary, #2563eb) 10%, var(--ui-color-surface, #ffffff)) 0%,
|
|
238
|
-
color-mix(in srgb, var(--ui-color-primary, #2563eb) 7%, var(--ui-color-surface, #ffffff)) 100%
|
|
239
|
-
);
|
|
240
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-color-primary, #2563eb) 12%, var(--ui-alert-surface-base));
|
|
240
241
|
--ui-alert-border: 1px solid color-mix(in srgb, var(--ui-color-primary, #2563eb) 28%, var(--ui-color-border, rgba(15, 23, 42, 0.2)));
|
|
241
242
|
}
|
|
242
243
|
:host([tone="success"]) .alert {
|
|
243
244
|
--ui-alert-accent: var(--ui-color-success, #15803d);
|
|
244
|
-
--ui-alert-bg:
|
|
245
|
-
180deg,
|
|
246
|
-
color-mix(in srgb, var(--ui-color-success, #15803d) 14%, var(--ui-color-surface, #ffffff)) 0%,
|
|
247
|
-
color-mix(in srgb, var(--ui-color-success, #15803d) 10%, var(--ui-color-surface, #ffffff)) 100%
|
|
248
|
-
);
|
|
245
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-color-success, #15803d) 12%, var(--ui-alert-surface-base));
|
|
249
246
|
--ui-alert-border: 1px solid color-mix(in srgb, var(--ui-color-success, #15803d) 30%, var(--ui-color-border, rgba(15, 23, 42, 0.2)));
|
|
250
247
|
}
|
|
251
248
|
:host([tone="warning"]) .alert {
|
|
252
249
|
--ui-alert-accent: var(--ui-color-warning, #b45309);
|
|
253
|
-
--ui-alert-bg:
|
|
254
|
-
180deg,
|
|
255
|
-
color-mix(in srgb, var(--ui-color-warning, #f59e0b) 16%, var(--ui-color-surface, #ffffff)) 0%,
|
|
256
|
-
color-mix(in srgb, var(--ui-color-warning, #f59e0b) 12%, var(--ui-color-surface, #ffffff)) 100%
|
|
257
|
-
);
|
|
250
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-color-warning, #f59e0b) 12%, var(--ui-alert-surface-base));
|
|
258
251
|
--ui-alert-border: 1px solid color-mix(in srgb, var(--ui-color-warning, #f59e0b) 34%, var(--ui-color-border, rgba(15, 23, 42, 0.2)));
|
|
259
252
|
}
|
|
260
253
|
:host([tone="danger"]) .alert {
|
|
261
254
|
--ui-alert-accent: var(--ui-color-danger, #dc2626);
|
|
262
|
-
--ui-alert-bg:
|
|
263
|
-
180deg,
|
|
264
|
-
color-mix(in srgb, var(--ui-color-danger, #dc2626) 13%, var(--ui-color-surface, #ffffff)) 0%,
|
|
265
|
-
color-mix(in srgb, var(--ui-color-danger, #dc2626) 10%, var(--ui-color-surface, #ffffff)) 100%
|
|
266
|
-
);
|
|
255
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-color-danger, #dc2626) 12%, var(--ui-alert-surface-base));
|
|
267
256
|
--ui-alert-border: 1px solid color-mix(in srgb, var(--ui-color-danger, #dc2626) 30%, var(--ui-color-border, rgba(15, 23, 42, 0.2)));
|
|
268
257
|
}
|
|
269
258
|
|
|
259
|
+
/* The tone rules above set a tinted fill; a solid alert must win over them, so these come last. */
|
|
260
|
+
:host([variant="solid"]) .alert {
|
|
261
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-alert-accent) 84%, #000000);
|
|
262
|
+
--ui-alert-border: 1px solid color-mix(in srgb, #000000 18%, transparent);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
:host([variant="solid"][tone="info"]) .alert {
|
|
266
|
+
--ui-alert-bg: var(--ui-color-primary, #2563eb);
|
|
267
|
+
--ui-alert-color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
268
|
+
--ui-alert-muted: color-mix(in srgb, var(--ui-color-foreground-on-primary, #ffffff) 82%, transparent);
|
|
269
|
+
--ui-alert-icon-color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
:host([variant="solid"][tone="warning"]) .alert {
|
|
273
|
+
--ui-alert-bg: var(--ui-color-warning, #f59e0b);
|
|
274
|
+
--ui-alert-color: var(--ui-color-foreground-on-warning, #1f1300);
|
|
275
|
+
--ui-alert-muted: color-mix(in srgb, var(--ui-color-foreground-on-warning, #1f1300) 82%, transparent);
|
|
276
|
+
--ui-alert-icon-color: var(--ui-color-foreground-on-warning, #1f1300);
|
|
277
|
+
}
|
|
278
|
+
|
|
270
279
|
:host([layout="banner"][variant="solid"]) .alert {
|
|
271
280
|
border-top: 0;
|
|
272
281
|
}
|
|
@@ -325,9 +334,9 @@
|
|
|
325
334
|
border-color: Highlight;
|
|
326
335
|
}
|
|
327
336
|
}
|
|
328
|
-
`;function n(
|
|
337
|
+
`;function n(r){return String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function k(r){return r==="neutral"||r==="success"||r==="warning"||r==="danger"?r:"info"}function _(r){return r==="surface"||r==="outline"||r==="solid"||r==="soft"?r:"surface"}function C(r){return r==="sm"||r==="lg"?r:r==="1"?"sm":r==="3"?"lg":"md"}function S(r){return r==="banner"?"banner":"inline"}function A(r){return r==="none"||r==="low"||r==="high"?r:"low"}function $(r){return r==="none"?"none":"line"}function B(r,i="var(--base-alert-radius, var(--ui-radius, 6px))"){if(!r||!r.trim())return i;const t=r.trim().toLowerCase();return t==="full"||t==="pill"?"999px":t==="square"||t==="none"?"0px":/^-?\d+(\.\d+)?$/.test(t)?`${t}px`:r.trim()}function o(r,i){return Array.from(r.children).some(t=>{if(!(t instanceof HTMLElement))return!1;const e=t.getAttribute("slot")||"";return i?e===i:e===""})}function E(r){return r==="success"?'<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M5 10.2 8.3 13.4 15 6.8"></path></svg>':r==="warning"?'<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3.6 17 16.4H3L10 3.6Z"></path><path d="M10 8v3.4"></path><circle cx="10" cy="14.1" r="0.9" fill="currentColor" stroke="none"></circle></svg>':r==="danger"?'<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="m7.5 7.5 5 5M12.5 7.5l-5 5"></path></svg>':'<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="M10 13v-3.8"></path><circle cx="10" cy="6.5" r="0.9" fill="currentColor" stroke="none"></circle></svg>'}class l extends y.ElementBase{constructor(){super(),this._dismissBtn=null,this._actionsSlot=null,this._onDismiss=this._onDismiss.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["title","description","dismissible","tone","variant","layout","headless","hidden","size","radius","elevation","indicator"]}disconnectedCallback(){this._dismissBtn&&(this._dismissBtn.removeEventListener("click",this._onDismiss),this._dismissBtn=null),this._actionsSlot&&(this._actionsSlot.removeEventListener("slotchange",this._onSlotChange),this._actionsSlot=null),super.disconnectedCallback()}get open(){return!this.hasAttribute("hidden")}set open(i){i?this.removeAttribute("hidden"):this.setAttribute("hidden","")}connectedCallback(){super.connectedCallback(),this._syncHostStyles()}attributeChangedCallback(i,t,e){if(t!==e){if(i==="radius"){this._syncHostStyles();return}super.attributeChangedCallback(i,t,e)}}_onDismiss(i){i.preventDefault();const t=new CustomEvent("close",{bubbles:!0,cancelable:!0});this.dispatchEvent(t),t.defaultPrevented||(this.open=!1)}_onSlotChange(){const i=this.root.querySelector(".actions");if(!i||!this._actionsSlot)return;const t=this._actionsSlot.assignedNodes({flatten:!0}).length>0;i.setAttribute("data-empty",t?"false":"true")}_syncHostStyles(){const i=this.getAttribute("radius");if(i&&i.trim()){this.style.setProperty("--ui-alert-radius",B(i));return}this.style.removeProperty("--ui-alert-radius")}render(){const i=this.getAttribute("title")||"",t=this.getAttribute("description")||"",e=this.hasAttribute("dismissible"),a=k(this.getAttribute("tone")),u=_(this.getAttribute("variant")),c=S(this.getAttribute("layout")),d=C(this.getAttribute("size")),h=A(this.getAttribute("elevation")),p=$(this.getAttribute("indicator")),s=a==="danger"||a==="warning"?"alert":"status",g=s==="alert"?"assertive":"polite",b=o(this,"title"),f=o(this),v=o(this,"actions"),m=i||b?`<div class="title" part="title"><slot name="title">${n(i)}</slot></div>`:"",x=t||f?`<div class="description" part="description"><slot>${n(t)}</slot></div>`:"",w=a==="danger"?"Dismiss critical alert":"Dismiss alert";this.setContent(`
|
|
329
338
|
<style>${z}</style>
|
|
330
|
-
<section class="alert tone-${a} variant-${
|
|
339
|
+
<section class="alert tone-${a} variant-${u} layout-${c} size-${d} elevation-${h} indicator-${p}" part="base" role="${s}" aria-live="${g}" aria-atomic="true">
|
|
331
340
|
<div class="row">
|
|
332
341
|
<span class="icon-wrap" part="icon-wrap" aria-hidden="true">
|
|
333
342
|
<span class="icon" part="icon">
|
|
@@ -348,4 +357,4 @@
|
|
|
348
357
|
</button>`:""}
|
|
349
358
|
</div>
|
|
350
359
|
</section>
|
|
351
|
-
`),this._dismissBtn&&this._dismissBtn.removeEventListener("click",this._onDismiss),this._dismissBtn=this.root.querySelector(".dismiss"),this._dismissBtn&&this._dismissBtn.addEventListener("click",this._onDismiss),this._actionsSlot&&this._actionsSlot.removeEventListener("slotchange",this._onSlotChange),this._actionsSlot=this.root.querySelector('slot[name="actions"]'),this._actionsSlot&&(this._actionsSlot.addEventListener("slotchange",this._onSlotChange),this._onSlotChange())}shouldRenderOnAttributeChange(
|
|
360
|
+
`),this._dismissBtn&&this._dismissBtn.removeEventListener("click",this._onDismiss),this._dismissBtn=this.root.querySelector(".dismiss"),this._dismissBtn&&this._dismissBtn.addEventListener("click",this._onDismiss),this._actionsSlot&&this._actionsSlot.removeEventListener("slotchange",this._onSlotChange),this._actionsSlot=this.root.querySelector('slot[name="actions"]'),this._actionsSlot&&(this._actionsSlot.addEventListener("slotchange",this._onSlotChange),this._onSlotChange())}shouldRenderOnAttributeChange(i,t,e){return i!=="radius"}}typeof customElements<"u"&&!customElements.get("ui-alert")&&customElements.define("ui-alert",l);exports.UIAlert=l;
|
package/dist/alert.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { E as w } from "./ElementBase-BeZT54Hj.mjs";
|
|
|
2
2
|
const y = `
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
|
-
--ui-alert-radius: var(--base-alert-radius, var(--ui-radius,
|
|
5
|
+
--ui-alert-radius: var(--base-alert-radius, var(--ui-radius, 6px));
|
|
6
6
|
--ui-alert-padding-y: var(--base-alert-padding-y, 14px);
|
|
7
7
|
--ui-alert-padding-x: var(--base-alert-padding-x, 16px);
|
|
8
8
|
--ui-alert-gap: var(--base-alert-gap, var(--ui-default-gap, 8px));
|
|
@@ -21,10 +21,10 @@ const y = `
|
|
|
21
21
|
--ui-alert-focus-ring: var(--ui-color-focus-ring, var(--ui-focus-ring, #2563eb));
|
|
22
22
|
--ui-alert-title-size: var(--ui-default-font-size, 14px);
|
|
23
23
|
--ui-alert-title-line-height: var(--ui-default-line-height, 20px);
|
|
24
|
-
--ui-alert-title-weight:
|
|
24
|
+
--ui-alert-title-weight: 600;
|
|
25
25
|
--ui-alert-description-size: 13px;
|
|
26
26
|
--ui-alert-description-line-height: 20px;
|
|
27
|
-
--ui-alert-icon-size: var(--base-alert-icon-size,
|
|
27
|
+
--ui-alert-icon-size: var(--base-alert-icon-size, 20px);
|
|
28
28
|
--ui-alert-dismiss-size: var(--base-alert-dismiss-size, 28px);
|
|
29
29
|
--ui-alert-duration: var(--ui-motion-base, 180ms);
|
|
30
30
|
--ui-alert-easing: var(--ui-motion-easing, cubic-bezier(0.2, 0.8, 0.2, 1));
|
|
@@ -40,7 +40,7 @@ const y = `
|
|
|
40
40
|
--ui-alert-title-line-height: 18px;
|
|
41
41
|
--ui-alert-description-size: 12px;
|
|
42
42
|
--ui-alert-description-line-height: 18px;
|
|
43
|
-
--ui-alert-icon-size:
|
|
43
|
+
--ui-alert-icon-size: 18px;
|
|
44
44
|
--ui-alert-dismiss-size: 26px;
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -60,7 +60,7 @@ const y = `
|
|
|
60
60
|
--ui-alert-title-line-height: 22px;
|
|
61
61
|
--ui-alert-description-size: 14px;
|
|
62
62
|
--ui-alert-description-line-height: 22px;
|
|
63
|
-
--ui-alert-icon-size:
|
|
63
|
+
--ui-alert-icon-size: 22px;
|
|
64
64
|
--ui-alert-dismiss-size: 30px;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -69,6 +69,11 @@ const y = `
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.alert {
|
|
72
|
+
/* A hairline in the tone colour, no shadow. These are set here, not on the host, so they follow the tone. */
|
|
73
|
+
--ui-alert-border: var(--base-alert-border, 1px solid color-mix(in srgb, var(--ui-alert-accent) 28%, transparent));
|
|
74
|
+
--ui-alert-shadow: var(--base-alert-shadow, none);
|
|
75
|
+
--ui-alert-icon-bg: transparent;
|
|
76
|
+
--ui-alert-icon-color: color-mix(in srgb, var(--ui-alert-accent) 55%, var(--ui-color-text-strong, var(--ui-alert-color)));
|
|
72
77
|
position: relative;
|
|
73
78
|
border-radius: var(--ui-alert-radius);
|
|
74
79
|
border: var(--ui-alert-border);
|
|
@@ -89,11 +94,12 @@ const y = `
|
|
|
89
94
|
inset-block: 0;
|
|
90
95
|
inset-inline-start: 0;
|
|
91
96
|
width: 3px;
|
|
92
|
-
background:
|
|
97
|
+
background: var(--ui-alert-accent);
|
|
93
98
|
pointer-events: none;
|
|
94
99
|
}
|
|
95
100
|
|
|
96
|
-
:
|
|
101
|
+
/* The coloured bar on the leading edge is opt-in: indicator="line". */
|
|
102
|
+
:host(:not([indicator="line"])) .alert::before {
|
|
97
103
|
display: none;
|
|
98
104
|
}
|
|
99
105
|
|
|
@@ -105,7 +111,7 @@ const y = `
|
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
.icon-wrap {
|
|
108
|
-
margin-top:
|
|
114
|
+
margin-top: 0;
|
|
109
115
|
width: var(--ui-alert-icon-size);
|
|
110
116
|
min-width: var(--ui-alert-icon-size);
|
|
111
117
|
height: var(--ui-alert-icon-size);
|
|
@@ -115,7 +121,6 @@ const y = `
|
|
|
115
121
|
display: inline-flex;
|
|
116
122
|
align-items: center;
|
|
117
123
|
justify-content: center;
|
|
118
|
-
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-alert-accent) 24%, transparent);
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
.icon {
|
|
@@ -233,41 +238,45 @@ const y = `
|
|
|
233
238
|
|
|
234
239
|
:host([tone="info"]) .alert {
|
|
235
240
|
--ui-alert-accent: var(--ui-color-primary, #2563eb);
|
|
236
|
-
--ui-alert-bg:
|
|
237
|
-
180deg,
|
|
238
|
-
color-mix(in srgb, var(--ui-color-primary, #2563eb) 10%, var(--ui-color-surface, #ffffff)) 0%,
|
|
239
|
-
color-mix(in srgb, var(--ui-color-primary, #2563eb) 7%, var(--ui-color-surface, #ffffff)) 100%
|
|
240
|
-
);
|
|
241
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-color-primary, #2563eb) 12%, var(--ui-alert-surface-base));
|
|
241
242
|
--ui-alert-border: 1px solid color-mix(in srgb, var(--ui-color-primary, #2563eb) 28%, var(--ui-color-border, rgba(15, 23, 42, 0.2)));
|
|
242
243
|
}
|
|
243
244
|
:host([tone="success"]) .alert {
|
|
244
245
|
--ui-alert-accent: var(--ui-color-success, #15803d);
|
|
245
|
-
--ui-alert-bg:
|
|
246
|
-
180deg,
|
|
247
|
-
color-mix(in srgb, var(--ui-color-success, #15803d) 14%, var(--ui-color-surface, #ffffff)) 0%,
|
|
248
|
-
color-mix(in srgb, var(--ui-color-success, #15803d) 10%, var(--ui-color-surface, #ffffff)) 100%
|
|
249
|
-
);
|
|
246
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-color-success, #15803d) 12%, var(--ui-alert-surface-base));
|
|
250
247
|
--ui-alert-border: 1px solid color-mix(in srgb, var(--ui-color-success, #15803d) 30%, var(--ui-color-border, rgba(15, 23, 42, 0.2)));
|
|
251
248
|
}
|
|
252
249
|
:host([tone="warning"]) .alert {
|
|
253
250
|
--ui-alert-accent: var(--ui-color-warning, #b45309);
|
|
254
|
-
--ui-alert-bg:
|
|
255
|
-
180deg,
|
|
256
|
-
color-mix(in srgb, var(--ui-color-warning, #f59e0b) 16%, var(--ui-color-surface, #ffffff)) 0%,
|
|
257
|
-
color-mix(in srgb, var(--ui-color-warning, #f59e0b) 12%, var(--ui-color-surface, #ffffff)) 100%
|
|
258
|
-
);
|
|
251
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-color-warning, #f59e0b) 12%, var(--ui-alert-surface-base));
|
|
259
252
|
--ui-alert-border: 1px solid color-mix(in srgb, var(--ui-color-warning, #f59e0b) 34%, var(--ui-color-border, rgba(15, 23, 42, 0.2)));
|
|
260
253
|
}
|
|
261
254
|
:host([tone="danger"]) .alert {
|
|
262
255
|
--ui-alert-accent: var(--ui-color-danger, #dc2626);
|
|
263
|
-
--ui-alert-bg:
|
|
264
|
-
180deg,
|
|
265
|
-
color-mix(in srgb, var(--ui-color-danger, #dc2626) 13%, var(--ui-color-surface, #ffffff)) 0%,
|
|
266
|
-
color-mix(in srgb, var(--ui-color-danger, #dc2626) 10%, var(--ui-color-surface, #ffffff)) 100%
|
|
267
|
-
);
|
|
256
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-color-danger, #dc2626) 12%, var(--ui-alert-surface-base));
|
|
268
257
|
--ui-alert-border: 1px solid color-mix(in srgb, var(--ui-color-danger, #dc2626) 30%, var(--ui-color-border, rgba(15, 23, 42, 0.2)));
|
|
269
258
|
}
|
|
270
259
|
|
|
260
|
+
/* The tone rules above set a tinted fill; a solid alert must win over them, so these come last. */
|
|
261
|
+
:host([variant="solid"]) .alert {
|
|
262
|
+
--ui-alert-bg: color-mix(in srgb, var(--ui-alert-accent) 84%, #000000);
|
|
263
|
+
--ui-alert-border: 1px solid color-mix(in srgb, #000000 18%, transparent);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
:host([variant="solid"][tone="info"]) .alert {
|
|
267
|
+
--ui-alert-bg: var(--ui-color-primary, #2563eb);
|
|
268
|
+
--ui-alert-color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
269
|
+
--ui-alert-muted: color-mix(in srgb, var(--ui-color-foreground-on-primary, #ffffff) 82%, transparent);
|
|
270
|
+
--ui-alert-icon-color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
:host([variant="solid"][tone="warning"]) .alert {
|
|
274
|
+
--ui-alert-bg: var(--ui-color-warning, #f59e0b);
|
|
275
|
+
--ui-alert-color: var(--ui-color-foreground-on-warning, #1f1300);
|
|
276
|
+
--ui-alert-muted: color-mix(in srgb, var(--ui-color-foreground-on-warning, #1f1300) 82%, transparent);
|
|
277
|
+
--ui-alert-icon-color: var(--ui-color-foreground-on-warning, #1f1300);
|
|
278
|
+
}
|
|
279
|
+
|
|
271
280
|
:host([layout="banner"][variant="solid"]) .alert {
|
|
272
281
|
border-top: 0;
|
|
273
282
|
}
|
|
@@ -327,41 +336,41 @@ const y = `
|
|
|
327
336
|
}
|
|
328
337
|
}
|
|
329
338
|
`;
|
|
330
|
-
function n(
|
|
331
|
-
return String(
|
|
339
|
+
function n(r) {
|
|
340
|
+
return String(r).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
332
341
|
}
|
|
333
|
-
function z(
|
|
334
|
-
return
|
|
342
|
+
function z(r) {
|
|
343
|
+
return r === "neutral" || r === "success" || r === "warning" || r === "danger" ? r : "info";
|
|
335
344
|
}
|
|
336
|
-
function k(
|
|
337
|
-
return
|
|
345
|
+
function k(r) {
|
|
346
|
+
return r === "surface" || r === "outline" || r === "solid" || r === "soft" ? r : "surface";
|
|
338
347
|
}
|
|
339
|
-
function _(
|
|
340
|
-
return
|
|
348
|
+
function _(r) {
|
|
349
|
+
return r === "sm" || r === "lg" ? r : r === "1" ? "sm" : r === "3" ? "lg" : "md";
|
|
341
350
|
}
|
|
342
|
-
function C(
|
|
343
|
-
return
|
|
351
|
+
function C(r) {
|
|
352
|
+
return r === "banner" ? "banner" : "inline";
|
|
344
353
|
}
|
|
345
|
-
function S(
|
|
346
|
-
return
|
|
354
|
+
function S(r) {
|
|
355
|
+
return r === "none" || r === "low" || r === "high" ? r : "low";
|
|
347
356
|
}
|
|
348
|
-
function A(
|
|
349
|
-
return
|
|
357
|
+
function A(r) {
|
|
358
|
+
return r === "none" ? "none" : "line";
|
|
350
359
|
}
|
|
351
|
-
function $(
|
|
352
|
-
if (!
|
|
353
|
-
const t =
|
|
354
|
-
return t === "full" || t === "pill" ? "999px" : t === "square" || t === "none" ? "0px" : /^-?\d+(\.\d+)?$/.test(t) ? `${t}px` :
|
|
360
|
+
function $(r, i = "var(--base-alert-radius, var(--ui-radius, 6px))") {
|
|
361
|
+
if (!r || !r.trim()) return i;
|
|
362
|
+
const t = r.trim().toLowerCase();
|
|
363
|
+
return t === "full" || t === "pill" ? "999px" : t === "square" || t === "none" ? "0px" : /^-?\d+(\.\d+)?$/.test(t) ? `${t}px` : r.trim();
|
|
355
364
|
}
|
|
356
|
-
function
|
|
357
|
-
return Array.from(
|
|
365
|
+
function o(r, i) {
|
|
366
|
+
return Array.from(r.children).some((t) => {
|
|
358
367
|
if (!(t instanceof HTMLElement)) return !1;
|
|
359
368
|
const e = t.getAttribute("slot") || "";
|
|
360
|
-
return
|
|
369
|
+
return i ? e === i : e === "";
|
|
361
370
|
});
|
|
362
371
|
}
|
|
363
|
-
function E(
|
|
364
|
-
return
|
|
372
|
+
function E(r) {
|
|
373
|
+
return r === "success" ? '<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M5 10.2 8.3 13.4 15 6.8"></path></svg>' : r === "warning" ? '<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3.6 17 16.4H3L10 3.6Z"></path><path d="M10 8v3.4"></path><circle cx="10" cy="14.1" r="0.9" fill="currentColor" stroke="none"></circle></svg>' : r === "danger" ? '<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="m7.5 7.5 5 5M12.5 7.5l-5 5"></path></svg>' : '<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="M10 13v-3.8"></path><circle cx="10" cy="6.5" r="0.9" fill="currentColor" stroke="none"></circle></svg>';
|
|
365
374
|
}
|
|
366
375
|
class B extends w {
|
|
367
376
|
constructor() {
|
|
@@ -376,45 +385,45 @@ class B extends w {
|
|
|
376
385
|
get open() {
|
|
377
386
|
return !this.hasAttribute("hidden");
|
|
378
387
|
}
|
|
379
|
-
set open(
|
|
380
|
-
|
|
388
|
+
set open(i) {
|
|
389
|
+
i ? this.removeAttribute("hidden") : this.setAttribute("hidden", "");
|
|
381
390
|
}
|
|
382
391
|
connectedCallback() {
|
|
383
392
|
super.connectedCallback(), this._syncHostStyles();
|
|
384
393
|
}
|
|
385
|
-
attributeChangedCallback(
|
|
394
|
+
attributeChangedCallback(i, t, e) {
|
|
386
395
|
if (t !== e) {
|
|
387
|
-
if (
|
|
396
|
+
if (i === "radius") {
|
|
388
397
|
this._syncHostStyles();
|
|
389
398
|
return;
|
|
390
399
|
}
|
|
391
|
-
super.attributeChangedCallback(
|
|
400
|
+
super.attributeChangedCallback(i, t, e);
|
|
392
401
|
}
|
|
393
402
|
}
|
|
394
|
-
_onDismiss(
|
|
395
|
-
|
|
403
|
+
_onDismiss(i) {
|
|
404
|
+
i.preventDefault();
|
|
396
405
|
const t = new CustomEvent("close", { bubbles: !0, cancelable: !0 });
|
|
397
406
|
this.dispatchEvent(t), t.defaultPrevented || (this.open = !1);
|
|
398
407
|
}
|
|
399
408
|
_onSlotChange() {
|
|
400
|
-
const
|
|
401
|
-
if (!
|
|
409
|
+
const i = this.root.querySelector(".actions");
|
|
410
|
+
if (!i || !this._actionsSlot) return;
|
|
402
411
|
const t = this._actionsSlot.assignedNodes({ flatten: !0 }).length > 0;
|
|
403
|
-
|
|
412
|
+
i.setAttribute("data-empty", t ? "false" : "true");
|
|
404
413
|
}
|
|
405
414
|
_syncHostStyles() {
|
|
406
|
-
const
|
|
407
|
-
if (
|
|
408
|
-
this.style.setProperty("--ui-alert-radius", $(
|
|
415
|
+
const i = this.getAttribute("radius");
|
|
416
|
+
if (i && i.trim()) {
|
|
417
|
+
this.style.setProperty("--ui-alert-radius", $(i));
|
|
409
418
|
return;
|
|
410
419
|
}
|
|
411
420
|
this.style.removeProperty("--ui-alert-radius");
|
|
412
421
|
}
|
|
413
422
|
render() {
|
|
414
|
-
const
|
|
423
|
+
const i = this.getAttribute("title") || "", t = this.getAttribute("description") || "", e = this.hasAttribute("dismissible"), a = z(this.getAttribute("tone")), l = k(this.getAttribute("variant")), u = C(this.getAttribute("layout")), c = _(this.getAttribute("size")), d = S(this.getAttribute("elevation")), h = A(this.getAttribute("indicator")), s = a === "danger" || a === "warning" ? "alert" : "status", p = s === "alert" ? "assertive" : "polite", g = o(this, "title"), b = o(this), f = o(this, "actions"), v = i || g ? `<div class="title" part="title"><slot name="title">${n(i)}</slot></div>` : "", m = t || b ? `<div class="description" part="description"><slot>${n(t)}</slot></div>` : "", x = a === "danger" ? "Dismiss critical alert" : "Dismiss alert";
|
|
415
424
|
this.setContent(`
|
|
416
425
|
<style>${y}</style>
|
|
417
|
-
<section class="alert tone-${a} variant-${l} layout-${
|
|
426
|
+
<section class="alert tone-${a} variant-${l} layout-${u} size-${c} elevation-${d} indicator-${h}" part="base" role="${s}" aria-live="${p}" aria-atomic="true">
|
|
418
427
|
<div class="row">
|
|
419
428
|
<span class="icon-wrap" part="icon-wrap" aria-hidden="true">
|
|
420
429
|
<span class="icon" part="icon">
|
|
@@ -424,7 +433,7 @@ class B extends w {
|
|
|
424
433
|
<div class="content">
|
|
425
434
|
${v}
|
|
426
435
|
${m}
|
|
427
|
-
<div class="actions" part="actions" data-empty="${
|
|
436
|
+
<div class="actions" part="actions" data-empty="${f ? "false" : "true"}">
|
|
428
437
|
<slot name="actions"></slot>
|
|
429
438
|
</div>
|
|
430
439
|
</div>
|
|
@@ -437,8 +446,8 @@ class B extends w {
|
|
|
437
446
|
</section>
|
|
438
447
|
`), this._dismissBtn && this._dismissBtn.removeEventListener("click", this._onDismiss), this._dismissBtn = this.root.querySelector(".dismiss"), this._dismissBtn && this._dismissBtn.addEventListener("click", this._onDismiss), this._actionsSlot && this._actionsSlot.removeEventListener("slotchange", this._onSlotChange), this._actionsSlot = this.root.querySelector('slot[name="actions"]'), this._actionsSlot && (this._actionsSlot.addEventListener("slotchange", this._onSlotChange), this._onSlotChange());
|
|
439
448
|
}
|
|
440
|
-
shouldRenderOnAttributeChange(
|
|
441
|
-
return
|
|
449
|
+
shouldRenderOnAttributeChange(i, t, e) {
|
|
450
|
+
return i !== "radius";
|
|
442
451
|
}
|
|
443
452
|
}
|
|
444
453
|
typeof customElements < "u" && !customElements.get("ui-alert") && customElements.define("ui-alert", B);
|