@redvars/peacock 3.4.0 → 3.5.1
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/dist/BaseButton-DuASuVth.js +219 -0
- package/dist/BaseButton-DuASuVth.js.map +1 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
- package/dist/assets/components.css +1 -1
- package/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +187 -0
- package/dist/banner.js.map +1 -0
- package/dist/bottom-sheet.js +2 -2
- package/dist/{button-COYCtuA8.js → button-DouvOfEU.js} +92 -283
- package/dist/button-DouvOfEU.js.map +1 -0
- package/dist/{button-group-DsXquZQn.js → button-group-CEdMwvJJ.js} +72 -48
- package/dist/button-group-CEdMwvJJ.js.map +1 -0
- package/dist/button-group.js +8 -5
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +7 -4
- package/dist/button.js.map +1 -1
- package/dist/card.js +29 -74
- package/dist/card.js.map +1 -1
- package/dist/chart-bar.js +2 -2
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +2 -2
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +2 -2
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js +2 -2
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/{class-map-3TAnCMAX.js → class-map-YU7g0o3B.js} +2 -2
- package/dist/{class-map-3TAnCMAX.js.map → class-map-YU7g0o3B.js.map} +1 -1
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +4 -4
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +5 -4
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +6627 -3477
- package/dist/custom-elements.json +10954 -7810
- package/dist/directive-ZPhl09Yt.js +9 -0
- package/dist/directive-ZPhl09Yt.js.map +1 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
- package/dist/fab.js +423 -0
- package/dist/fab.js.map +1 -0
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/{observe-theme-change-DKAIv5BB.js → is-dark-mode-DicqGkCJ.js} +6 -2
- package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
- package/dist/{select-C3XAzenC.js → navigation-rail-Lxetd5-Z.js} +2426 -898
- package/dist/navigation-rail-Lxetd5-Z.js.map +1 -0
- package/dist/notification.js +418 -0
- package/dist/notification.js.map +1 -0
- package/dist/number-counter.js +2 -2
- package/dist/number-counter.js.map +1 -1
- package/dist/observe-slot-change-BGJfgg2E.js +31 -0
- package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
- package/dist/peacock-loader.js +48 -13
- package/dist/peacock-loader.js.map +1 -1
- package/dist/search.js +456 -0
- package/dist/search.js.map +1 -0
- package/dist/side-sheet.js +2 -2
- package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
- package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
- package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
- package/dist/src/__utils/cache-fetch.d.ts +1 -0
- package/dist/src/__utils/is-dark-mode.d.ts +1 -0
- package/dist/src/__utils/is-in-viewport.d.ts +1 -0
- package/dist/src/__utils/observe-slot-change.d.ts +1 -0
- package/dist/src/__utils/sanitize-svg.d.ts +1 -0
- package/dist/src/__utils/throttle.d.ts +4 -0
- package/dist/src/accordion/accordion-item.d.ts +33 -9
- package/dist/src/accordion/accordion.d.ts +21 -5
- package/dist/src/banner/banner.d.ts +43 -0
- package/dist/src/banner/index.d.ts +1 -0
- package/dist/src/button/BaseButton.d.ts +7 -57
- package/dist/src/button/button/button.d.ts +32 -3
- package/dist/src/button/button-group/button-group.d.ts +4 -4
- package/dist/src/button/icon-button/icon-button.d.ts +33 -8
- package/dist/src/card/card.d.ts +4 -15
- package/dist/src/empty-state/empty-state.d.ts +1 -1
- package/dist/src/fab/fab.d.ts +80 -0
- package/dist/src/fab/index.d.ts +1 -0
- package/dist/src/focus-ring/focus-ring.d.ts +11 -5
- package/dist/src/index.d.ts +8 -1
- package/dist/src/link/link.d.ts +3 -10
- package/dist/src/menu/menu/menu.d.ts +3 -2
- package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
- package/dist/src/navigation-rail/index.d.ts +2 -0
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
- package/dist/src/notification/index.d.ts +1 -0
- package/dist/src/notification/notification.d.ts +69 -0
- package/dist/src/pagination/pagination.d.ts +8 -1
- package/dist/src/search/index.d.ts +1 -0
- package/dist/src/search/search.d.ts +76 -0
- package/dist/src/select/select.d.ts +3 -5
- package/dist/src/sidebar-menu/index.d.ts +3 -0
- package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
- package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
- package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
- package/dist/src/slider/slider.d.ts +4 -0
- package/dist/src/snackbar/snackbar.d.ts +14 -1
- package/dist/src/toolbar/index.d.ts +1 -0
- package/dist/src/toolbar/toolbar.d.ts +86 -0
- package/dist/src/tooltip/tooltip.d.ts +3 -0
- package/dist/src/url-field/index.d.ts +1 -0
- package/dist/src/url-field/url-field.d.ts +48 -0
- package/dist/{style-map-CRFEoCEg.js → style-map-DVmWOuYy.js} +2 -2
- package/dist/{style-map-CRFEoCEg.js.map → style-map-DVmWOuYy.js.map} +1 -1
- package/dist/test/banner.test.d.ts +1 -0
- package/dist/test/search.test.d.ts +1 -0
- package/dist/test/sidebar-menu.test.d.ts +1 -0
- package/dist/test/toolbar.test.d.ts +1 -0
- package/dist/toolbar.js +306 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-D3GHRaGQ.js → unsafe-html-BsGUjx94.js} +2 -2
- package/dist/{unsafe-html-D3GHRaGQ.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
- package/package.json +1 -1
- package/readme.md +73 -65
- package/scss/mixin.scss +16 -0
- package/scss/styles.scss +4 -0
- package/src/__mixins/BaseButtonMixin.ts +83 -0
- package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
- package/src/__mixins/MixinConstructor.ts +1 -0
- package/src/__mixins/README.md +19 -0
- package/src/__utils/cache-fetch.ts +65 -0
- package/src/__utils/is-dark-mode.ts +3 -0
- package/src/__utils/is-in-viewport.ts +6 -0
- package/src/__utils/observe-slot-change.ts +38 -0
- package/src/__utils/sanitize-svg.ts +27 -0
- package/src/__utils/throttle.ts +27 -0
- package/src/accordion/accordion-item.scss +136 -65
- package/src/accordion/accordion-item.ts +117 -44
- package/src/accordion/accordion.scss +24 -5
- package/src/accordion/accordion.ts +29 -23
- package/src/accordion/demo/index.html +74 -35
- package/src/banner/banner.scss +83 -0
- package/src/banner/banner.ts +101 -0
- package/src/banner/index.ts +1 -0
- package/src/button/BaseButton.ts +13 -115
- package/src/button/button/button-colors.scss +14 -14
- package/src/button/button/button-sizes.scss +4 -2
- package/src/button/button/button.ts +80 -26
- package/src/button/button-group/button-group.ts +5 -5
- package/src/button/icon-button/icon-button.ts +79 -44
- package/src/card/card.ts +50 -100
- package/src/chart-bar/chart-bar.ts +10 -15
- package/src/chart-bar/chart-stacked-bar.ts +15 -19
- package/src/chart-doughnut/chart-doughnut.ts +24 -28
- package/src/chart-pie/chart-pie.ts +20 -24
- package/src/checkbox/checkbox.scss +17 -34
- package/src/checkbox/checkbox.ts +4 -2
- package/src/clock/clock.ts +1 -1
- package/src/code-editor/code-editor.ts +4 -4
- package/src/code-highlighter/code-highlighter.scss +1 -0
- package/src/code-highlighter/code-highlighter.ts +3 -3
- package/src/date-picker/date-picker.ts +6 -3
- package/src/divider/divider.ts +3 -1
- package/src/elevation/elevation.scss +5 -5
- package/src/empty-state/empty-state.scss +7 -9
- package/src/empty-state/empty-state.ts +1 -1
- package/src/fab/fab-colors.scss +49 -0
- package/src/fab/fab-sizes.scss +47 -0
- package/src/fab/fab.scss +137 -0
- package/src/fab/fab.ts +214 -0
- package/src/fab/index.ts +1 -0
- package/src/field/field.ts +3 -1
- package/src/focus-ring/focus-ring.ts +47 -40
- package/src/icon/datasource.ts +1 -1
- package/src/icon/icon.ts +3 -1
- package/src/image/image.ts +3 -2
- package/src/index.ts +8 -1
- package/src/input/input.ts +8 -3
- package/src/link/link.ts +2 -15
- package/src/menu/menu/menu.scss +7 -0
- package/src/menu/menu/menu.ts +7 -4
- package/src/menu/menu-item/menu-item.ts +3 -1
- package/src/menu/sub-menu/sub-menu.ts +1 -0
- package/src/navigation-rail/index.ts +2 -0
- package/src/navigation-rail/navigation-rail-item.scss +216 -0
- package/src/navigation-rail/navigation-rail-item.ts +223 -0
- package/src/navigation-rail/navigation-rail.scss +72 -0
- package/src/navigation-rail/navigation-rail.ts +149 -0
- package/src/notification/index.ts +1 -0
- package/src/notification/notification.scss +201 -0
- package/src/notification/notification.ts +207 -0
- package/src/number-counter/number-counter.ts +3 -1
- package/src/number-field/number-field.ts +10 -6
- package/src/pagination/pagination.scss +33 -24
- package/src/pagination/pagination.ts +115 -60
- package/src/peacock-loader.ts +42 -5
- package/src/radio/radio.ts +3 -1
- package/src/search/index.ts +1 -0
- package/src/search/search-colors.scss +14 -0
- package/src/search/search.scss +204 -0
- package/src/search/search.ts +244 -0
- package/src/select/option.ts +1 -1
- package/src/select/select.scss +5 -0
- package/src/select/select.ts +71 -37
- package/src/sidebar-menu/demo/index.html +68 -0
- package/src/sidebar-menu/index.ts +3 -0
- package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
- package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
- package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
- package/src/sidebar-menu/sidebar-menu.ts +182 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
- package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
- package/src/skeleton/skeleton.scss +18 -24
- package/src/slider/slider.scss +19 -0
- package/src/slider/slider.ts +30 -19
- package/src/snackbar/snackbar.scss +62 -31
- package/src/snackbar/snackbar.ts +91 -11
- package/src/switch/switch.ts +3 -1
- package/src/table/table.ts +3 -1
- package/src/tabs/tab.ts +10 -6
- package/src/text/text.css-component.scss +7 -1
- package/src/textarea/textarea.ts +4 -2
- package/src/time-picker/time-picker.ts +5 -3
- package/src/toolbar/index.ts +1 -0
- package/src/toolbar/toolbar-colors.scss +16 -0
- package/src/toolbar/toolbar.scss +165 -0
- package/src/toolbar/toolbar.ts +137 -0
- package/src/tooltip/tooltip.ts +24 -0
- package/src/url-field/index.ts +1 -0
- package/src/url-field/url-field.scss +50 -0
- package/src/url-field/url-field.ts +239 -0
- package/dist/button-COYCtuA8.js.map +0 -1
- package/dist/button-group-DsXquZQn.js.map +0 -1
- package/dist/directive-Cuw6h7YA.js +0 -9
- package/dist/directive-Cuw6h7YA.js.map +0 -1
- package/dist/dispatch-event-utils-B4odODQf.js +0 -277
- package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
- package/dist/observe-theme-change-DKAIv5BB.js.map +0 -1
- package/dist/select-C3XAzenC.js.map +0 -1
- package/dist/src/styleMixins.css.d.ts +0 -9
- package/dist/src/tree-view/index.d.ts +0 -2
- package/dist/src/tree-view/tree-node.d.ts +0 -69
- package/dist/src/tree-view/tree-view.d.ts +0 -40
- package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
- package/dist/src/utils.d.ts +0 -9
- package/dist/test/tree-view.test.d.ts +0 -1
- package/src/styleMixins.css.ts +0 -55
- package/src/tree-view/demo/index.html +0 -57
- package/src/tree-view/index.ts +0 -2
- package/src/tree-view/tree-node.scss +0 -101
- package/src/tree-view/tree-node.ts +0 -268
- package/src/tree-view/tree-view.ts +0 -182
- package/src/tree-view/wc-tree-view.ts +0 -9
- package/src/utils.ts +0 -193
- /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
- /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
- /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
- /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
- /package/src/{spread.ts → __directive/spread.ts} +0 -0
- /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
- /package/src/{utils → __utils}/dispatch-event-utils.ts +0 -0
- /package/src/{utils → __utils}/observe-theme-change.ts +0 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import { a as i, _ as __decorate, I as IndividualComponent, i as i$1, A, b } from './IndividualComponent-DUINtMGK.js';
|
|
2
|
+
import { n } from './property-1psGvXOq.js';
|
|
3
|
+
import { r } from './state-DwbEjqVk.js';
|
|
4
|
+
import { e } from './class-map-YU7g0o3B.js';
|
|
5
|
+
import './directive-ZPhl09Yt.js';
|
|
6
|
+
|
|
7
|
+
var css_248z = i`* {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.screen-reader-only {
|
|
12
|
+
display: none !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host {
|
|
16
|
+
--notification-container-color: var(--color-primary-container);
|
|
17
|
+
--notification-text-color: var(--color-on-primary-container);
|
|
18
|
+
--notification-leading-icon-color: var(--color-on-primary-container);
|
|
19
|
+
--notification-accent-color: var(--color-primary);
|
|
20
|
+
--notification-border-radius: var(--shape-corner-medium);
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host(:not([inline])) {
|
|
25
|
+
width: min(100%, 28rem);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.notification {
|
|
29
|
+
align-items: flex-start;
|
|
30
|
+
background: var(--notification-container-color);
|
|
31
|
+
border-inline-start: 4px solid var(--notification-accent-color);
|
|
32
|
+
border-radius: var(--notification-border-radius);
|
|
33
|
+
color: var(--notification-text-color);
|
|
34
|
+
display: grid;
|
|
35
|
+
gap: var(--spacing-100);
|
|
36
|
+
grid-template-columns: auto 1fr auto;
|
|
37
|
+
padding: var(--spacing-150) var(--spacing-100) var(--spacing-150) var(--spacing-150);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.state-icon {
|
|
41
|
+
align-items: center;
|
|
42
|
+
color: var(--notification-leading-icon-color);
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
min-height: 2rem;
|
|
46
|
+
--icon-size: 1.25rem;
|
|
47
|
+
--icon-color: var(--notification-leading-icon-color);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.content {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
gap: var(--spacing-100);
|
|
54
|
+
min-width: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.content-text {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
gap: var(--spacing-025);
|
|
61
|
+
min-width: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.title {
|
|
65
|
+
font-family: var(--typography-label-large-font-family) !important;
|
|
66
|
+
font-size: var(--typography-label-large-font-size) !important;
|
|
67
|
+
font-weight: var(--typography-label-large-font-weight) !important;
|
|
68
|
+
line-height: var(--typography-label-large-line-height) !important;
|
|
69
|
+
letter-spacing: var(--typography-label-large-letter-spacing) !important;
|
|
70
|
+
color: var(--notification-text-color);
|
|
71
|
+
overflow-wrap: anywhere;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.subtitle {
|
|
75
|
+
font-family: var(--typography-body-medium-font-family) !important;
|
|
76
|
+
font-size: var(--typography-body-medium-font-size) !important;
|
|
77
|
+
font-weight: var(--typography-body-medium-font-weight) !important;
|
|
78
|
+
line-height: var(--typography-body-medium-line-height) !important;
|
|
79
|
+
letter-spacing: var(--typography-body-medium-letter-spacing) !important;
|
|
80
|
+
color: var(--notification-text-color);
|
|
81
|
+
opacity: 0.88;
|
|
82
|
+
overflow-wrap: anywhere;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.title ::slotted(*),
|
|
86
|
+
.subtitle ::slotted(*) {
|
|
87
|
+
margin: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.actions {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
gap: var(--spacing-100);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.action {
|
|
96
|
+
--outlined-button-label-text-color: var(--notification-text-color);
|
|
97
|
+
--outlined-button-outline-color: color-mix(in srgb, var(--notification-text-color) 40%, transparent);
|
|
98
|
+
--text-button-label-text-color: var(--notification-text-color);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.close-button-container {
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.close-button {
|
|
106
|
+
--text-button-label-text-color: var(--notification-text-color);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.notification.inline {
|
|
110
|
+
align-items: center;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.notification.inline .content {
|
|
114
|
+
align-items: center;
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
gap: var(--spacing-150);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.notification.inline .content-text {
|
|
121
|
+
display: inline;
|
|
122
|
+
flex: 1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.notification.inline .title,
|
|
126
|
+
.notification.inline .subtitle,
|
|
127
|
+
.notification.inline .title ::slotted(*),
|
|
128
|
+
.notification.inline .subtitle ::slotted(*) {
|
|
129
|
+
display: inline;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.notification:not(.has-subtitle) {
|
|
133
|
+
align-items: center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.notification:not(.has-subtitle) .content {
|
|
137
|
+
gap: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.notification.variant-info {
|
|
141
|
+
--notification-container-color: var(--color-primary-container);
|
|
142
|
+
--notification-text-color: var(--color-on-primary-container);
|
|
143
|
+
--notification-leading-icon-color: var(--color-on-primary-container);
|
|
144
|
+
--notification-accent-color: var(--color-primary);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.notification.variant-success {
|
|
148
|
+
--notification-container-color: var(--color-success-container);
|
|
149
|
+
--notification-text-color: var(--color-on-success-container);
|
|
150
|
+
--notification-leading-icon-color: var(--color-on-success-container);
|
|
151
|
+
--notification-accent-color: var(--color-success);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.notification.variant-warning {
|
|
155
|
+
--notification-container-color: var(--color-warning-container);
|
|
156
|
+
--notification-text-color: var(--color-on-warning-container);
|
|
157
|
+
--notification-leading-icon-color: var(--color-on-warning-container);
|
|
158
|
+
--notification-accent-color: var(--color-warning);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.notification.variant-error {
|
|
162
|
+
--notification-container-color: var(--color-error-container);
|
|
163
|
+
--notification-text-color: var(--color-on-error-container);
|
|
164
|
+
--notification-leading-icon-color: var(--color-on-error-container);
|
|
165
|
+
--notification-accent-color: var(--color-error);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.notification.high-contrast {
|
|
169
|
+
--notification-container-color: var(--color-inverse-surface);
|
|
170
|
+
--notification-text-color: var(--color-inverse-on-surface);
|
|
171
|
+
--notification-leading-icon-color: var(--color-inverse-on-surface);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.notification.high-contrast.variant-info {
|
|
175
|
+
--notification-accent-color: var(--color-primary);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.notification.high-contrast.variant-success {
|
|
179
|
+
--notification-accent-color: var(--color-success);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.notification.high-contrast.variant-warning {
|
|
183
|
+
--notification-accent-color: var(--color-warning);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.notification.high-contrast.variant-error {
|
|
187
|
+
--notification-accent-color: var(--color-error);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@media (max-width: 640px) {
|
|
191
|
+
:host(:not([inline])) {
|
|
192
|
+
width: 100%;
|
|
193
|
+
}
|
|
194
|
+
.notification.inline {
|
|
195
|
+
align-items: flex-start;
|
|
196
|
+
}
|
|
197
|
+
.notification.inline .content {
|
|
198
|
+
align-items: flex-start;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
gap: var(--spacing-100);
|
|
201
|
+
}
|
|
202
|
+
.notification.inline .content-text {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
gap: var(--spacing-025);
|
|
206
|
+
}
|
|
207
|
+
.notification.inline .title,
|
|
208
|
+
.notification.inline .subtitle,
|
|
209
|
+
.notification.inline .title ::slotted(*),
|
|
210
|
+
.notification.inline .subtitle ::slotted(*) {
|
|
211
|
+
display: initial;
|
|
212
|
+
}
|
|
213
|
+
}`;
|
|
214
|
+
|
|
215
|
+
const VARIANT_LABELS = {
|
|
216
|
+
success: 'Success',
|
|
217
|
+
error: 'Error',
|
|
218
|
+
info: 'Information',
|
|
219
|
+
warning: 'Warning',
|
|
220
|
+
};
|
|
221
|
+
const VARIANT_ICONS = {
|
|
222
|
+
success: 'check_circle',
|
|
223
|
+
error: 'error',
|
|
224
|
+
info: 'info',
|
|
225
|
+
warning: 'warning',
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* @label Notification
|
|
229
|
+
* @tag wc-notification
|
|
230
|
+
* @rawTag notification
|
|
231
|
+
* @summary Notifications communicate contextual status, errors, warnings, and success messages.
|
|
232
|
+
*
|
|
233
|
+
* @cssprop --notification-container-color - Surface color for the notification container.
|
|
234
|
+
* @cssprop --notification-text-color - Label and supporting text color.
|
|
235
|
+
* @cssprop --notification-leading-icon-color - Leading state icon color.
|
|
236
|
+
* @cssprop --notification-accent-color - Start border color for status emphasis.
|
|
237
|
+
* @cssprop --notification-border-radius - Border radius of the notification container.
|
|
238
|
+
*
|
|
239
|
+
* @fires {CustomEvent} notification-dismiss - Fired when the notification is dismissed.
|
|
240
|
+
* @fires {CustomEvent} notification-action-click - Fired when the action button is clicked.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```html
|
|
244
|
+
* <wc-notification variant="success" action="Undo" dismissible>
|
|
245
|
+
* <span slot="title">Record saved</span>
|
|
246
|
+
* </wc-notification>
|
|
247
|
+
* ```
|
|
248
|
+
* @tags display, feedback
|
|
249
|
+
*/
|
|
250
|
+
let Notification = class Notification extends i$1 {
|
|
251
|
+
constructor() {
|
|
252
|
+
super(...arguments);
|
|
253
|
+
/**
|
|
254
|
+
* If true, content and actions are laid out in a single row.
|
|
255
|
+
*/
|
|
256
|
+
this.inline = false;
|
|
257
|
+
/**
|
|
258
|
+
* The visual variant of the notification.
|
|
259
|
+
*/
|
|
260
|
+
this.variant = 'info';
|
|
261
|
+
/**
|
|
262
|
+
* Enables a high contrast appearance.
|
|
263
|
+
*/
|
|
264
|
+
this.highContrast = false;
|
|
265
|
+
/**
|
|
266
|
+
* If true, renders a dismiss icon button.
|
|
267
|
+
*/
|
|
268
|
+
this.dismissible = false;
|
|
269
|
+
/**
|
|
270
|
+
* Action label text. When provided, an action button is shown.
|
|
271
|
+
*/
|
|
272
|
+
this.action = '';
|
|
273
|
+
/**
|
|
274
|
+
* If true, the host controls visibility when dismissed.
|
|
275
|
+
*/
|
|
276
|
+
this.managed = false;
|
|
277
|
+
this.isHidden = false;
|
|
278
|
+
this.hasSubtitle = false;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Programmatically reveals the notification.
|
|
282
|
+
*/
|
|
283
|
+
show() {
|
|
284
|
+
this.isHidden = false;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Programmatically dismisses the notification.
|
|
288
|
+
*/
|
|
289
|
+
dismiss() {
|
|
290
|
+
this.hideAndEmitDismiss('programmatic');
|
|
291
|
+
}
|
|
292
|
+
get variantIcon() {
|
|
293
|
+
return VARIANT_ICONS[this.variant];
|
|
294
|
+
}
|
|
295
|
+
get variantLabel() {
|
|
296
|
+
return VARIANT_LABELS[this.variant];
|
|
297
|
+
}
|
|
298
|
+
emitActionClick() {
|
|
299
|
+
this.dispatchEvent(new CustomEvent('notification-action-click', {
|
|
300
|
+
bubbles: true,
|
|
301
|
+
composed: true,
|
|
302
|
+
}));
|
|
303
|
+
}
|
|
304
|
+
hideAndEmitDismiss(reason) {
|
|
305
|
+
if (!this.managed) {
|
|
306
|
+
this.isHidden = true;
|
|
307
|
+
}
|
|
308
|
+
this.dispatchEvent(new CustomEvent('notification-dismiss', {
|
|
309
|
+
detail: { reason },
|
|
310
|
+
bubbles: true,
|
|
311
|
+
composed: true,
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
314
|
+
handleSubtitleSlotChange(event) {
|
|
315
|
+
const slot = event.target;
|
|
316
|
+
this.hasSubtitle = slot
|
|
317
|
+
.assignedNodes({ flatten: true })
|
|
318
|
+
.some(node => node.textContent?.trim());
|
|
319
|
+
}
|
|
320
|
+
render() {
|
|
321
|
+
if (this.isHidden) {
|
|
322
|
+
return A;
|
|
323
|
+
}
|
|
324
|
+
return b `
|
|
325
|
+
<div
|
|
326
|
+
class=${e({
|
|
327
|
+
notification: true,
|
|
328
|
+
inline: this.inline,
|
|
329
|
+
'high-contrast': this.highContrast,
|
|
330
|
+
'has-subtitle': this.hasSubtitle,
|
|
331
|
+
[`variant-${this.variant}`]: true,
|
|
332
|
+
})}
|
|
333
|
+
role="alert"
|
|
334
|
+
aria-live="polite"
|
|
335
|
+
aria-label=${this.variantLabel}
|
|
336
|
+
>
|
|
337
|
+
<div class="state-icon" aria-hidden="true">
|
|
338
|
+
<slot name="icon">
|
|
339
|
+
<wc-icon name=${this.variantIcon}></wc-icon>
|
|
340
|
+
</slot>
|
|
341
|
+
</div>
|
|
342
|
+
|
|
343
|
+
<div class="content">
|
|
344
|
+
<div class="content-text">
|
|
345
|
+
<div class="title">
|
|
346
|
+
<slot name="title"></slot>
|
|
347
|
+
<slot></slot>
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
<div class="subtitle">
|
|
351
|
+
<slot name="subtitle" @slotchange=${this.handleSubtitleSlotChange}></slot>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
|
|
355
|
+
${this.action
|
|
356
|
+
? b `<div class="actions">
|
|
357
|
+
<wc-button
|
|
358
|
+
class="action"
|
|
359
|
+
size="sm"
|
|
360
|
+
variant=${this.inline ? 'text' : 'outlined'}
|
|
361
|
+
@click=${this.emitActionClick}
|
|
362
|
+
>
|
|
363
|
+
${this.action}
|
|
364
|
+
</wc-button>
|
|
365
|
+
</div>`
|
|
366
|
+
: A}
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
${this.dismissible
|
|
370
|
+
? b `<div class="close-button-container">
|
|
371
|
+
<wc-icon-button
|
|
372
|
+
class="close-button"
|
|
373
|
+
variant="text"
|
|
374
|
+
size="sm"
|
|
375
|
+
aria-label="Close notification"
|
|
376
|
+
@click=${() => {
|
|
377
|
+
this.hideAndEmitDismiss('dismiss');
|
|
378
|
+
}}
|
|
379
|
+
>
|
|
380
|
+
<wc-icon name="close"></wc-icon>
|
|
381
|
+
</wc-icon-button>
|
|
382
|
+
</div>`
|
|
383
|
+
: A}
|
|
384
|
+
</div>
|
|
385
|
+
`;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
Notification.styles = [css_248z];
|
|
389
|
+
__decorate([
|
|
390
|
+
n({ type: Boolean, reflect: true })
|
|
391
|
+
], Notification.prototype, "inline", void 0);
|
|
392
|
+
__decorate([
|
|
393
|
+
n({ type: String, reflect: true })
|
|
394
|
+
], Notification.prototype, "variant", void 0);
|
|
395
|
+
__decorate([
|
|
396
|
+
n({ type: Boolean, reflect: true, attribute: 'high-contrast' })
|
|
397
|
+
], Notification.prototype, "highContrast", void 0);
|
|
398
|
+
__decorate([
|
|
399
|
+
n({ type: Boolean, reflect: true })
|
|
400
|
+
], Notification.prototype, "dismissible", void 0);
|
|
401
|
+
__decorate([
|
|
402
|
+
n({ type: String })
|
|
403
|
+
], Notification.prototype, "action", void 0);
|
|
404
|
+
__decorate([
|
|
405
|
+
n({ type: Boolean, reflect: true })
|
|
406
|
+
], Notification.prototype, "managed", void 0);
|
|
407
|
+
__decorate([
|
|
408
|
+
r()
|
|
409
|
+
], Notification.prototype, "isHidden", void 0);
|
|
410
|
+
__decorate([
|
|
411
|
+
r()
|
|
412
|
+
], Notification.prototype, "hasSubtitle", void 0);
|
|
413
|
+
Notification = __decorate([
|
|
414
|
+
IndividualComponent
|
|
415
|
+
], Notification);
|
|
416
|
+
|
|
417
|
+
export { Notification };
|
|
418
|
+
//# sourceMappingURL=notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.js","sources":["../../src/notification/notification.ts"],"sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './notification.scss';\n\ntype NotificationVariant = 'success' | 'error' | 'info' | 'warning';\n\nconst VARIANT_LABELS: Record<NotificationVariant, string> = {\n success: 'Success',\n error: 'Error',\n info: 'Information',\n warning: 'Warning',\n};\n\nconst VARIANT_ICONS: Record<NotificationVariant, string> = {\n success: 'check_circle',\n error: 'error',\n info: 'info',\n warning: 'warning',\n};\n\n/**\n * @label Notification\n * @tag wc-notification\n * @rawTag notification\n * @summary Notifications communicate contextual status, errors, warnings, and success messages.\n *\n * @cssprop --notification-container-color - Surface color for the notification container.\n * @cssprop --notification-text-color - Label and supporting text color.\n * @cssprop --notification-leading-icon-color - Leading state icon color.\n * @cssprop --notification-accent-color - Start border color for status emphasis.\n * @cssprop --notification-border-radius - Border radius of the notification container.\n *\n * @fires {CustomEvent} notification-dismiss - Fired when the notification is dismissed.\n * @fires {CustomEvent} notification-action-click - Fired when the action button is clicked.\n *\n * @example\n * ```html\n * <wc-notification variant=\"success\" action=\"Undo\" dismissible>\n * <span slot=\"title\">Record saved</span>\n * </wc-notification>\n * ```\n * @tags display, feedback\n */\n@IndividualComponent\nexport class Notification extends LitElement {\n static styles = [styles];\n\n /**\n * If true, content and actions are laid out in a single row.\n */\n @property({ type: Boolean, reflect: true }) inline = false;\n\n /**\n * The visual variant of the notification.\n */\n @property({ type: String, reflect: true })\n variant: NotificationVariant = 'info';\n\n /**\n * Enables a high contrast appearance.\n */\n @property({ type: Boolean, reflect: true, attribute: 'high-contrast' })\n highContrast = false;\n\n /**\n * If true, renders a dismiss icon button.\n */\n @property({ type: Boolean, reflect: true }) dismissible = false;\n\n /**\n * Action label text. When provided, an action button is shown.\n */\n @property({ type: String }) action = '';\n\n /**\n * If true, the host controls visibility when dismissed.\n */\n @property({ type: Boolean, reflect: true }) managed = false;\n\n @state() private isHidden = false;\n \n @state() private hasSubtitle = false;\n\n /**\n * Programmatically reveals the notification.\n */\n show() {\n this.isHidden = false;\n }\n\n /**\n * Programmatically dismisses the notification.\n */\n dismiss() {\n this.hideAndEmitDismiss('programmatic');\n }\n\n private get variantIcon() {\n return VARIANT_ICONS[this.variant];\n }\n\n private get variantLabel() {\n return VARIANT_LABELS[this.variant];\n }\n\n private emitActionClick() {\n this.dispatchEvent(\n new CustomEvent('notification-action-click', {\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private hideAndEmitDismiss(reason: 'dismiss' | 'programmatic') {\n if (!this.managed) {\n this.isHidden = true;\n }\n\n this.dispatchEvent(\n new CustomEvent('notification-dismiss', {\n detail: { reason },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private handleSubtitleSlotChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasSubtitle = slot\n .assignedNodes({ flatten: true })\n .some(node => node.textContent?.trim());\n }\n\n render() {\n if (this.isHidden) {\n return nothing;\n }\n\n return html`\n <div\n class=${classMap({\n notification: true,\n inline: this.inline,\n 'high-contrast': this.highContrast,\n 'has-subtitle': this.hasSubtitle,\n [`variant-${this.variant}`]: true,\n })}\n role=\"alert\"\n aria-live=\"polite\"\n aria-label=${this.variantLabel}\n >\n <div class=\"state-icon\" aria-hidden=\"true\">\n <slot name=\"icon\">\n <wc-icon name=${this.variantIcon}></wc-icon>\n </slot>\n </div>\n\n <div class=\"content\">\n <div class=\"content-text\">\n <div class=\"title\">\n <slot name=\"title\"></slot>\n <slot></slot>\n </div>\n\n <div class=\"subtitle\">\n <slot name=\"subtitle\" @slotchange=${this.handleSubtitleSlotChange}></slot>\n </div>\n </div>\n\n ${this.action\n ? html`<div class=\"actions\">\n <wc-button\n class=\"action\"\n size=\"sm\"\n variant=${this.inline ? 'text' : 'outlined'}\n @click=${this.emitActionClick}\n >\n ${this.action}\n </wc-button>\n </div>`\n : nothing}\n </div>\n\n ${this.dismissible\n ? html`<div class=\"close-button-container\">\n <wc-icon-button\n class=\"close-button\"\n variant=\"text\"\n size=\"sm\"\n aria-label=\"Close notification\"\n @click=${() => {\n this.hideAndEmitDismiss('dismiss');\n }}\n >\n <wc-icon name=\"close\"></wc-icon>\n </wc-icon-button>\n </div>`\n : nothing}\n </div>\n `;\n }\n}\n"],"names":["LitElement","nothing","html","classMap","styles","property","state"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,cAAc,GAAwC;AAC1D,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,KAAK,EAAE,OAA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AO,EAAE,OAAO,EAAE,IAAI,EAAE;AAAkB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAE3C,UAAA,CAAA;AAAhB,IAAAC,CAAK;AAA4B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAEjB,UAAA,CAAA;AAAhB,IAAAA,CAAK;AAA+B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AArC1B,YAAY,GAAA,UAAA,CAAA;IADxB;AACY,CAAA,EAAA,YAAY,CA+JxB;;;;"}
|
package/dist/number-counter.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as i, _ as __decorate, I as IndividualComponent, i as i$1, b, A } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
|
-
import { o } from './style-map-
|
|
4
|
-
import './directive-
|
|
3
|
+
import { o } from './style-map-DVmWOuYy.js';
|
|
4
|
+
import './directive-ZPhl09Yt.js';
|
|
5
5
|
|
|
6
6
|
var css_248z = i`* {
|
|
7
7
|
box-sizing: border-box;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-counter.js","sources":["../../src/number-counter/number-counter.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport IndividualComponent from '
|
|
1
|
+
{"version":3,"file":"number-counter.js","sources":["../../src/number-counter/number-counter.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\n\nimport IndividualComponent from '@/IndividualComponent.js';\n\nimport styles from './number-counter.scss';\n\n/**\n * @label Number Counter\n * @tag wc-number-counter\n * @rawTag number-counter\n * @summary Displays a number with commas for thousands.\n *\n * @example\n * ```html\n * <wc-number-counter id=\"number-counter\" value=\"123456789\"></wc-number-counter>\n * <script>\n * customElements.whenDefined('wc-number-counter').then(() => {\n const $counter = document.querySelector('#number-counter');\n\n setInterval(() => {\n $counter.value = $counter.value + Math.floor(Math.random() * 1000);\n }, 1000);\n });\n * </script>\n * ```\n * @tags display\n */\n@IndividualComponent\nexport class NumberCounter extends LitElement {\n static styles = [styles];\n\n @property({ type: Number }) value = 0;\n\n /**\n * Optional: Allow users to pass a locale, defaulting to 'en-US' for commas.\n */\n @property() locale = 'en-US';\n\n render() {\n return html`<div class=\"number-counter\">${this.renderDigits()}</div>`;\n }\n\n renderDigits() {\n if (this.value === undefined || this.value === null) return nothing;\n\n // 1. Format the number with commas (e.g., 1234 -> \"1,234\")\n const formattedValue = new Intl.NumberFormat(this.locale).format(\n this.value,\n );\n\n // 2. Split the string into individual characters\n const chars = formattedValue.split('');\n\n return html`${chars.map(char => {\n // 3. Check if the character is a digit or a separator (comma/dot)\n const digit = parseInt(char, 10);\n\n // eslint-disable-next-line no-restricted-globals\n if (isNaN(digit)) {\n return html`<div class=\"digit-separator\">${char}</div>`;\n }\n\n return this.renderDigit(digit);\n })}`;\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderDigit(digit: number) {\n // Each 'each-digit' is 10% of the 'digit-content' height (since there are 10 numbers)\n const offset = digit * 10;\n const style = {\n transform: `translateY(-${offset}%)`,\n };\n\n return html` <div class=\"digit\">\n <div class=\"digit-content\" style=${styleMap(style)}>\n ${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(\n n => html`<div class=\"each-digit\">${n}</div>`,\n )}\n </div>\n </div>`;\n }\n}\n"],"names":["LitElement","html","nothing","styleMap","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;;;;;;;;;;;;;;;;;;;AAoBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQA,GAAU,CAAA;AAAtC,IAAA,WAAA,GAAA;;QAGuB,IAAA,CAAA,KAAK,GAAG,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GAAG,CAClC,CAAC,IAAIF,CAAI,CAAA,CAAA,wBAAA,EAA2B,CAAC,QAAQ,CAC9C;;WAEE;IACT;;AApDO,aAAA,CAAA,MAAM,GAAG,CAACG,QAAM,CAAC;AAEI,UAAA,CAAA;AAA3B,IAAAC,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AAAY,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAK1B,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAoB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AARlB,aAAa,GAAA,UAAA,CAAA;IADzB;AACY,CAAA,EAAA,aAAa,CAsDzB;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
function hasMeaningfulContent(slotElement) {
|
|
2
|
+
const nodes = slotElement?.assignedNodes({ flatten: true }) || [];
|
|
3
|
+
for (const node of nodes) {
|
|
4
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
if (node.nodeType === Node.TEXT_NODE &&
|
|
8
|
+
(node.textContent?.trim().length || 0) > 0) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
function observerSlotChangesWithCallback(slot, callback) {
|
|
15
|
+
const observer = new MutationObserver(() => {
|
|
16
|
+
callback(hasMeaningfulContent(slot));
|
|
17
|
+
});
|
|
18
|
+
const assignedNodes = slot?.assignedNodes({ flatten: true }) || [];
|
|
19
|
+
assignedNodes.forEach(node => {
|
|
20
|
+
observer.observe(node, {
|
|
21
|
+
attributes: true,
|
|
22
|
+
childList: true,
|
|
23
|
+
characterData: true,
|
|
24
|
+
subtree: true,
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
callback(hasMeaningfulContent(slot));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { observerSlotChangesWithCallback as o };
|
|
31
|
+
//# sourceMappingURL=observe-slot-change-BGJfgg2E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-slot-change-BGJfgg2E.js","sources":["../../src/__utils/observe-slot-change.ts"],"sourcesContent":["function hasMeaningfulContent(slotElement: HTMLSlotElement | null) {\n const nodes = slotElement?.assignedNodes({ flatten: true }) || [];\n\n for (const node of nodes) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n return true;\n }\n if (\n node.nodeType === Node.TEXT_NODE &&\n (node.textContent?.trim().length || 0) > 0\n ) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function observerSlotChangesWithCallback(\n slot: HTMLSlotElement | null,\n callback: (hasContent: boolean) => void,\n) {\n const observer = new MutationObserver(() => {\n callback(hasMeaningfulContent(slot));\n });\n\n const assignedNodes = slot?.assignedNodes({ flatten: true }) || [];\n assignedNodes.forEach(node => {\n observer.observe(node, {\n attributes: true,\n childList: true,\n characterData: true,\n subtree: true,\n });\n });\n\n callback(hasMeaningfulContent(slot));\n}"],"names":[],"mappings":"AAAA,SAAS,oBAAoB,CAAC,WAAmC,EAAA;AAC/D,IAAA,MAAM,KAAK,GAAG,WAAW,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE;AAEjE,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY,EAAE;AACvC,YAAA,OAAO,IAAI;QACb;AACA,QAAA,IACE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;AAChC,YAAA,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAC1C;AACA,YAAA,OAAO,IAAI;QACb;IACF;AAEA,IAAA,OAAO,KAAK;AACd;AAEM,SAAU,+BAA+B,CAC7C,IAA4B,EAC5B,QAAuC,EAAA;AAEvC,IAAA,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,MAAK;AACzC,QAAA,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACtC,IAAA,CAAC,CAAC;AAEF,IAAA,MAAM,aAAa,GAAG,IAAI,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE;AAClE,IAAA,aAAa,CAAC,OAAO,CAAC,IAAI,IAAG;AAC3B,QAAA,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;AACrB,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,aAAa,EAAE,IAAI;AACnB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA,CAAC;AACJ,IAAA,CAAC,CAAC;AAEF,IAAA,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACtC;;;;"}
|
package/dist/peacock-loader.js
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as Button } from './button-
|
|
3
|
-
import { B as ButtonGroup, I as IconButton } from './button-group-
|
|
1
|
+
import { A as Accordion, n as NavigationRailItem, N as NavigationRail, s as SelectOptionElement, r as Select, y as Snackbar, v as SidebarSubMenu, u as SidebarMenuItem, t as SidebarMenu, P as Pagination, O as Table, x as Slider, j as Image, f as Container, G as SubMenu, m as MenuItem, M as Menu, h as EmptyState, z as Spinner, R as Radio, C as Checkbox, H as Switch, c as BreadcrumbItem, b as Breadcrumb, X as Tooltip, W as TimePicker, D as DatePicker, V as Textarea, o as NumberField, Y as UrlField, k as Input, F as Field, w as Skeleton, e as CircularProgress, L as LinearProgress, U as Tag, d as Chip, l as Link, K as TabPanel, T as Tab, J as TabGroup, Q as Tabs, p as Ripple, E as Elevation, g as Divider, q as SegmentedButtonGroup, S as SegmentedButton, B as Badge, a as Avatar, i as FocusRing, I as Icon } from './navigation-rail-Lxetd5-Z.js';
|
|
2
|
+
import { B as Button } from './button-DouvOfEU.js';
|
|
3
|
+
import { B as ButtonGroup, I as IconButton } from './button-group-CEdMwvJJ.js';
|
|
4
|
+
import { Fab } from './fab.js';
|
|
4
5
|
import { Card } from './card.js';
|
|
5
6
|
import { CardContent } from './card-content.js';
|
|
7
|
+
import { Banner } from './banner.js';
|
|
8
|
+
import { Notification } from './notification.js';
|
|
6
9
|
import { BottomSheet } from './bottom-sheet.js';
|
|
7
10
|
import { SideSheet } from './side-sheet.js';
|
|
11
|
+
import { Search } from './search.js';
|
|
12
|
+
import { Toolbar } from './toolbar.js';
|
|
8
13
|
import './IndividualComponent-DUINtMGK.js';
|
|
9
14
|
import './property-1psGvXOq.js';
|
|
10
15
|
import './state-DwbEjqVk.js';
|
|
11
|
-
import './directive-
|
|
12
|
-
import './unsafe-html-
|
|
13
|
-
import './
|
|
14
|
-
import './
|
|
16
|
+
import './directive-ZPhl09Yt.js';
|
|
17
|
+
import './unsafe-html-BsGUjx94.js';
|
|
18
|
+
import './class-map-YU7g0o3B.js';
|
|
19
|
+
import './observe-slot-change-BGJfgg2E.js';
|
|
15
20
|
import './query-QBcUV-L_.js';
|
|
16
|
-
import './
|
|
17
|
-
import './
|
|
21
|
+
import './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
22
|
+
import './style-map-DVmWOuYy.js';
|
|
23
|
+
import './dispatch-event-utils-CuEqjlPT.js';
|
|
24
|
+
import './BaseButton-DuASuVth.js';
|
|
25
|
+
import './is-dark-mode-DicqGkCJ.js';
|
|
18
26
|
|
|
19
27
|
class LoaderUtils {
|
|
20
28
|
constructor(loaderConfig) {
|
|
@@ -161,6 +169,9 @@ const loaderConfig = {
|
|
|
161
169
|
'wc-icon-button': {
|
|
162
170
|
CustomElementClass: IconButton,
|
|
163
171
|
},
|
|
172
|
+
'wc-fab': {
|
|
173
|
+
CustomElementClass: Fab,
|
|
174
|
+
},
|
|
164
175
|
'wc-button-group': {
|
|
165
176
|
CustomElementClass: ButtonGroup,
|
|
166
177
|
},
|
|
@@ -212,6 +223,12 @@ const loaderConfig = {
|
|
|
212
223
|
'wc-card-content': {
|
|
213
224
|
CustomElementClass: CardContent,
|
|
214
225
|
},
|
|
226
|
+
'wc-banner': {
|
|
227
|
+
CustomElementClass: Banner,
|
|
228
|
+
},
|
|
229
|
+
'wc-notification': {
|
|
230
|
+
CustomElementClass: Notification,
|
|
231
|
+
},
|
|
215
232
|
'wc-tag': {
|
|
216
233
|
CustomElementClass: Tag,
|
|
217
234
|
},
|
|
@@ -230,6 +247,9 @@ const loaderConfig = {
|
|
|
230
247
|
'wc-input': {
|
|
231
248
|
CustomElementClass: Input,
|
|
232
249
|
},
|
|
250
|
+
'wc-url-field': {
|
|
251
|
+
CustomElementClass: UrlField,
|
|
252
|
+
},
|
|
233
253
|
'wc-number-field': {
|
|
234
254
|
CustomElementClass: NumberField,
|
|
235
255
|
},
|
|
@@ -299,11 +319,14 @@ const loaderConfig = {
|
|
|
299
319
|
'wc-pagination': {
|
|
300
320
|
CustomElementClass: Pagination,
|
|
301
321
|
},
|
|
302
|
-
'wc-
|
|
303
|
-
CustomElementClass:
|
|
322
|
+
'wc-sidebar-menu': {
|
|
323
|
+
CustomElementClass: SidebarMenu,
|
|
324
|
+
},
|
|
325
|
+
'wc-sidebar-menu-item': {
|
|
326
|
+
CustomElementClass: SidebarMenuItem,
|
|
304
327
|
},
|
|
305
|
-
'wc-
|
|
306
|
-
CustomElementClass:
|
|
328
|
+
'wc-sidebar-sub-menu': {
|
|
329
|
+
CustomElementClass: SidebarSubMenu,
|
|
307
330
|
},
|
|
308
331
|
'wc-snackbar': {
|
|
309
332
|
CustomElementClass: Snackbar,
|
|
@@ -320,6 +343,18 @@ const loaderConfig = {
|
|
|
320
343
|
'wc-option': {
|
|
321
344
|
CustomElementClass: SelectOptionElement,
|
|
322
345
|
},
|
|
346
|
+
'wc-search': {
|
|
347
|
+
CustomElementClass: Search,
|
|
348
|
+
},
|
|
349
|
+
'wc-toolbar': {
|
|
350
|
+
CustomElementClass: Toolbar,
|
|
351
|
+
},
|
|
352
|
+
'wc-navigation-rail': {
|
|
353
|
+
CustomElementClass: NavigationRail,
|
|
354
|
+
},
|
|
355
|
+
'wc-navigation-rail-item': {
|
|
356
|
+
CustomElementClass: NavigationRailItem,
|
|
357
|
+
},
|
|
323
358
|
'wc-chart-doughnut': {
|
|
324
359
|
importPath: `${distDirectory}/chart-doughnut.js`,
|
|
325
360
|
},
|