@redvars/peacock 3.4.0 → 3.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/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +202 -0
- package/dist/banner.js.map +1 -0
- package/dist/bottom-sheet.js +2 -2
- package/dist/{button-COYCtuA8.js → button-DMN1dPAg.js} +58 -75
- package/dist/button-DMN1dPAg.js.map +1 -0
- package/dist/{button-group-DsXquZQn.js → button-group-CX9CUUXk.js} +9 -14
- package/dist/button-group-CX9CUUXk.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 +15 -5
- 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.map +1 -1
- 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 +3 -3
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +2918 -1379
- package/dist/custom-elements.json +2783 -1054
- 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-C5Nzxk0E.js +497 -0
- package/dist/fab-C5Nzxk0E.js.map +1 -0
- package/dist/fab.js +11 -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/notification.js +417 -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 +32 -9
- package/dist/peacock-loader.js.map +1 -1
- package/dist/search.js +452 -0
- package/dist/search.js.map +1 -0
- package/dist/{select-C3XAzenC.js → select-4pl4XBj7.js} +778 -374
- package/dist/select-4pl4XBj7.js.map +1 -0
- package/dist/side-sheet.js +2 -2
- package/dist/spread-B5cgadZl.js +32 -0
- package/dist/spread-B5cgadZl.js.map +1 -0
- package/dist/src/__base_element/BaseHyperlink.d.ts +20 -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 +47 -0
- package/dist/src/banner/index.d.ts +1 -0
- package/dist/src/button/BaseButton.d.ts +6 -13
- package/dist/src/button/button-group/button-group.d.ts +2 -2
- package/dist/src/empty-state/empty-state.d.ts +1 -1
- package/dist/src/fab/fab.d.ts +111 -0
- package/dist/src/fab/index.d.ts +1 -0
- package/dist/src/index.d.ts +5 -0
- 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/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/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/{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/toolbar.test.d.ts +1 -0
- package/dist/throttle-C7ZAPqtu.js +24 -0
- package/dist/throttle-C7ZAPqtu.js.map +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 +2 -2
- package/scss/styles.scss +4 -0
- package/src/__base_element/BaseHyperlink.ts +42 -0
- package/src/__base_element/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 +87 -0
- package/src/banner/banner.ts +107 -0
- package/src/banner/index.ts +1 -0
- package/src/button/BaseButton.ts +14 -27
- package/src/button/button/button-colors.scss +14 -14
- package/src/button/button/button.ts +6 -5
- package/src/button/button-group/button-group.ts +3 -3
- package/src/button/icon-button/icon-button.ts +4 -11
- package/src/card/card.ts +41 -31
- package/src/chart-bar/chart-bar.ts +1 -1
- package/src/chart-bar/chart-stacked-bar.ts +3 -1
- package/src/chart-doughnut/chart-doughnut.ts +1 -1
- package/src/chart-pie/chart-pie.ts +1 -1
- package/src/checkbox/checkbox.ts +1 -1
- package/src/clock/clock.ts +1 -1
- package/src/code-editor/code-editor.ts +4 -4
- package/src/code-highlighter/code-highlighter.ts +2 -2
- package/src/date-picker/date-picker.ts +5 -2
- package/src/divider/divider.ts +3 -1
- 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 +285 -0
- package/src/fab/index.ts +1 -0
- package/src/field/field.ts +3 -1
- 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 +5 -0
- package/src/input/input.ts +5 -2
- 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/sub-menu/sub-menu.ts +1 -0
- package/src/notification/index.ts +1 -0
- package/src/notification/notification.scss +201 -0
- package/src/notification/notification.ts +206 -0
- package/src/number-counter/number-counter.ts +3 -1
- package/src/number-field/number-field.ts +4 -2
- package/src/pagination/pagination.scss +33 -24
- package/src/pagination/pagination.ts +113 -60
- package/src/peacock-loader.ts +20 -0
- 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 +240 -0
- package/src/select/option.ts +1 -1
- package/src/select/select.scss +5 -0
- package/src/select/select.ts +71 -37
- 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 +92 -12
- package/src/switch/switch.ts +3 -1
- package/src/table/table.ts +3 -1
- package/src/tabs/tab.ts +6 -3
- package/src/textarea/textarea.ts +4 -2
- package/src/time-picker/time-picker.ts +4 -2
- 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/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/utils.d.ts +0 -9
- package/src/styleMixins.css.ts +0 -55
- 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 @@
|
|
|
1
|
+
export { Notification } from './notification.js';
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
@use '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
@include mixin.base-styles;
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
--notification-container-color: var(--color-primary-container);
|
|
7
|
+
--notification-text-color: var(--color-on-primary-container);
|
|
8
|
+
--notification-leading-icon-color: var(--color-on-primary-container);
|
|
9
|
+
--notification-accent-color: var(--color-primary);
|
|
10
|
+
--notification-border-radius: var(--shape-corner-medium);
|
|
11
|
+
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host(:not([inline])) {
|
|
16
|
+
width: min(100%, 28rem);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.notification {
|
|
20
|
+
align-items: flex-start;
|
|
21
|
+
background: var(--notification-container-color);
|
|
22
|
+
border-inline-start: 4px solid var(--notification-accent-color);
|
|
23
|
+
border-radius: var(--notification-border-radius);
|
|
24
|
+
color: var(--notification-text-color);
|
|
25
|
+
display: grid;
|
|
26
|
+
gap: var(--spacing-100);
|
|
27
|
+
grid-template-columns: auto 1fr auto;
|
|
28
|
+
padding: var(--spacing-150) var(--spacing-100) var(--spacing-150) var(--spacing-150);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.state-icon {
|
|
32
|
+
align-items: center;
|
|
33
|
+
color: var(--notification-leading-icon-color);
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
min-height: 2rem;
|
|
37
|
+
|
|
38
|
+
--icon-size: 1.25rem;
|
|
39
|
+
--icon-color: var(--notification-leading-icon-color);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.content {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: var(--spacing-100);
|
|
46
|
+
min-width: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.content-text {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
gap: var(--spacing-025);
|
|
53
|
+
min-width: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.title {
|
|
57
|
+
@include mixin.get-typography(label-large);
|
|
58
|
+
color: var(--notification-text-color);
|
|
59
|
+
overflow-wrap: anywhere;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.subtitle {
|
|
63
|
+
@include mixin.get-typography(body-medium);
|
|
64
|
+
color: var(--notification-text-color);
|
|
65
|
+
opacity: 0.88;
|
|
66
|
+
overflow-wrap: anywhere;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.title ::slotted(*),
|
|
70
|
+
.subtitle ::slotted(*) {
|
|
71
|
+
margin: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.actions {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
gap: var(--spacing-100);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.action {
|
|
80
|
+
--outlined-button-label-text-color: var(--notification-text-color);
|
|
81
|
+
--outlined-button-outline-color: color-mix(in srgb, var(--notification-text-color) 40%, transparent);
|
|
82
|
+
--text-button-label-text-color: var(--notification-text-color);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.close-button-container {
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.close-button {
|
|
90
|
+
--text-button-label-text-color: var(--notification-text-color);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.notification.inline {
|
|
94
|
+
align-items: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.notification.inline .content {
|
|
98
|
+
align-items: center;
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: row;
|
|
101
|
+
gap: var(--spacing-150);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.notification.inline .content-text {
|
|
105
|
+
display: inline;
|
|
106
|
+
flex: 1;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.notification.inline .title,
|
|
110
|
+
.notification.inline .subtitle,
|
|
111
|
+
.notification.inline .title ::slotted(*),
|
|
112
|
+
.notification.inline .subtitle ::slotted(*) {
|
|
113
|
+
display: inline;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.notification:not(.has-subtitle) {
|
|
117
|
+
align-items: center;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.notification:not(.has-subtitle) .content {
|
|
121
|
+
gap: 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.notification.variant-info {
|
|
125
|
+
--notification-container-color: var(--color-primary-container);
|
|
126
|
+
--notification-text-color: var(--color-on-primary-container);
|
|
127
|
+
--notification-leading-icon-color: var(--color-on-primary-container);
|
|
128
|
+
--notification-accent-color: var(--color-primary);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.notification.variant-success {
|
|
132
|
+
--notification-container-color: var(--color-success-container);
|
|
133
|
+
--notification-text-color: var(--color-on-success-container);
|
|
134
|
+
--notification-leading-icon-color: var(--color-on-success-container);
|
|
135
|
+
--notification-accent-color: var(--color-success);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.notification.variant-warning {
|
|
139
|
+
--notification-container-color: var(--color-warning-container);
|
|
140
|
+
--notification-text-color: var(--color-on-warning-container);
|
|
141
|
+
--notification-leading-icon-color: var(--color-on-warning-container);
|
|
142
|
+
--notification-accent-color: var(--color-warning);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.notification.variant-error {
|
|
146
|
+
--notification-container-color: var(--color-error-container);
|
|
147
|
+
--notification-text-color: var(--color-on-error-container);
|
|
148
|
+
--notification-leading-icon-color: var(--color-on-error-container);
|
|
149
|
+
--notification-accent-color: var(--color-error);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.notification.high-contrast {
|
|
153
|
+
--notification-container-color: var(--color-inverse-surface);
|
|
154
|
+
--notification-text-color: var(--color-inverse-on-surface);
|
|
155
|
+
--notification-leading-icon-color: var(--color-inverse-on-surface);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.notification.high-contrast.variant-info {
|
|
159
|
+
--notification-accent-color: var(--color-primary);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.notification.high-contrast.variant-success {
|
|
163
|
+
--notification-accent-color: var(--color-success);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.notification.high-contrast.variant-warning {
|
|
167
|
+
--notification-accent-color: var(--color-warning);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.notification.high-contrast.variant-error {
|
|
171
|
+
--notification-accent-color: var(--color-error);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@media (max-width: 640px) {
|
|
175
|
+
:host(:not([inline])) {
|
|
176
|
+
width: 100%;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.notification.inline {
|
|
180
|
+
align-items: flex-start;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.notification.inline .content {
|
|
184
|
+
align-items: flex-start;
|
|
185
|
+
flex-direction: column;
|
|
186
|
+
gap: var(--spacing-100);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.notification.inline .content-text {
|
|
190
|
+
display: flex;
|
|
191
|
+
flex-direction: column;
|
|
192
|
+
gap: var(--spacing-025);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.notification.inline .title,
|
|
196
|
+
.notification.inline .subtitle,
|
|
197
|
+
.notification.inline .title ::slotted(*),
|
|
198
|
+
.notification.inline .subtitle ::slotted(*) {
|
|
199
|
+
display: initial;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { LitElement, html, nothing } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
|
|
5
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
6
|
+
import styles from './notification.scss';
|
|
7
|
+
|
|
8
|
+
type NotificationVariant = 'success' | 'error' | 'info' | 'warning';
|
|
9
|
+
|
|
10
|
+
const VARIANT_LABELS: Record<NotificationVariant, string> = {
|
|
11
|
+
success: 'Success',
|
|
12
|
+
error: 'Error',
|
|
13
|
+
info: 'Information',
|
|
14
|
+
warning: 'Warning',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const VARIANT_ICONS: Record<NotificationVariant, string> = {
|
|
18
|
+
success: 'check_circle',
|
|
19
|
+
error: 'error',
|
|
20
|
+
info: 'info',
|
|
21
|
+
warning: 'warning',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @label Notification
|
|
26
|
+
* @tag wc-notification
|
|
27
|
+
* @rawTag notification
|
|
28
|
+
* @summary Notifications communicate contextual status, errors, warnings, and success messages.
|
|
29
|
+
*
|
|
30
|
+
* @cssprop --notification-container-color - Surface color for the notification container.
|
|
31
|
+
* @cssprop --notification-text-color - Label and supporting text color.
|
|
32
|
+
* @cssprop --notification-leading-icon-color - Leading state icon color.
|
|
33
|
+
* @cssprop --notification-accent-color - Start border color for status emphasis.
|
|
34
|
+
* @cssprop --notification-border-radius - Border radius of the notification container.
|
|
35
|
+
*
|
|
36
|
+
* @fires {CustomEvent} notification-dismiss - Fired when the notification is dismissed.
|
|
37
|
+
* @fires {CustomEvent} notification-action-click - Fired when the action button is clicked.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```html
|
|
41
|
+
* <wc-notification variant="success" action="Undo" dismissible>
|
|
42
|
+
* <span slot="title">Record saved</span>
|
|
43
|
+
* </wc-notification>
|
|
44
|
+
* ```
|
|
45
|
+
* @tags display, feedback
|
|
46
|
+
*/
|
|
47
|
+
@IndividualComponent
|
|
48
|
+
export class Notification extends LitElement {
|
|
49
|
+
static styles = [styles];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* If true, content and actions are laid out in a single row.
|
|
53
|
+
*/
|
|
54
|
+
@property({ type: Boolean, reflect: true }) inline = false;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The visual variant of the notification.
|
|
58
|
+
*/
|
|
59
|
+
@property({ type: String, reflect: true })
|
|
60
|
+
variant: NotificationVariant = 'info';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Enables a high contrast appearance.
|
|
64
|
+
*/
|
|
65
|
+
@property({ type: Boolean, reflect: true, attribute: 'high-contrast' })
|
|
66
|
+
highContrast = false;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* If true, renders a dismiss icon button.
|
|
70
|
+
*/
|
|
71
|
+
@property({ type: Boolean, reflect: true }) dismissible = false;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Action label text. When provided, an action button is shown.
|
|
75
|
+
*/
|
|
76
|
+
@property({ type: String }) action = '';
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* If true, the host controls visibility when dismissed.
|
|
80
|
+
*/
|
|
81
|
+
@property({ type: Boolean, reflect: true }) managed = false;
|
|
82
|
+
|
|
83
|
+
@state() private isHidden = false;
|
|
84
|
+
|
|
85
|
+
@state() private hasSubtitle = false;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Programmatically reveals the notification.
|
|
89
|
+
*/
|
|
90
|
+
show() {
|
|
91
|
+
this.isHidden = false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Programmatically dismisses the notification.
|
|
96
|
+
*/
|
|
97
|
+
dismiss() {
|
|
98
|
+
this.hideAndEmitDismiss('programmatic');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private get variantIcon() {
|
|
102
|
+
return VARIANT_ICONS[this.variant];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private get variantLabel() {
|
|
106
|
+
return VARIANT_LABELS[this.variant];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private emitActionClick() {
|
|
110
|
+
this.dispatchEvent(
|
|
111
|
+
new CustomEvent('notification-action-click', {
|
|
112
|
+
bubbles: true,
|
|
113
|
+
composed: true,
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private hideAndEmitDismiss(reason: 'dismiss' | 'programmatic') {
|
|
119
|
+
if (!this.managed) {
|
|
120
|
+
this.isHidden = true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
this.dispatchEvent(
|
|
124
|
+
new CustomEvent('notification-dismiss', {
|
|
125
|
+
detail: { reason },
|
|
126
|
+
bubbles: true,
|
|
127
|
+
composed: true,
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private handleSubtitleSlotChange(event: Event) {
|
|
133
|
+
const slot = event.target as HTMLSlotElement;
|
|
134
|
+
this.hasSubtitle = slot
|
|
135
|
+
.assignedNodes({ flatten: true })
|
|
136
|
+
.some(node => node.textContent?.trim());
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
render() {
|
|
140
|
+
if (this.isHidden) {
|
|
141
|
+
return nothing;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return html`
|
|
145
|
+
<div
|
|
146
|
+
class=${classMap({
|
|
147
|
+
notification: true,
|
|
148
|
+
inline: this.inline,
|
|
149
|
+
'high-contrast': this.highContrast,
|
|
150
|
+
'has-subtitle': this.hasSubtitle,
|
|
151
|
+
[`variant-${this.variant}`]: true,
|
|
152
|
+
})}
|
|
153
|
+
role="alert"
|
|
154
|
+
aria-live="polite"
|
|
155
|
+
aria-label=${this.variantLabel}
|
|
156
|
+
>
|
|
157
|
+
<div class="state-icon" aria-hidden="true">
|
|
158
|
+
<slot name="icon">
|
|
159
|
+
<wc-icon name=${this.variantIcon}></wc-icon>
|
|
160
|
+
</slot>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div class="content">
|
|
164
|
+
<div class="content-text">
|
|
165
|
+
<div class="title">
|
|
166
|
+
<slot name="title"></slot>
|
|
167
|
+
<slot></slot>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<div class="subtitle">
|
|
171
|
+
<slot name="subtitle" @slotchange=${this.handleSubtitleSlotChange}></slot>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
${this.action
|
|
176
|
+
? html`<div class="actions">
|
|
177
|
+
<wc-button
|
|
178
|
+
class="action"
|
|
179
|
+
size="sm"
|
|
180
|
+
variant=${this.inline ? 'text' : 'outlined'}
|
|
181
|
+
@click=${this.emitActionClick}
|
|
182
|
+
>
|
|
183
|
+
${this.action}
|
|
184
|
+
</wc-button>
|
|
185
|
+
</div>`
|
|
186
|
+
: nothing}
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
${this.dismissible
|
|
190
|
+
? html`<div class="close-button-container">
|
|
191
|
+
<wc-icon-button
|
|
192
|
+
class="close-button"
|
|
193
|
+
variant="text"
|
|
194
|
+
size="sm"
|
|
195
|
+
aria-label="Close notification"
|
|
196
|
+
name="close"
|
|
197
|
+
@click=${() => {
|
|
198
|
+
this.hideAndEmitDismiss('dismiss');
|
|
199
|
+
}}
|
|
200
|
+
></wc-icon-button>
|
|
201
|
+
</div>`
|
|
202
|
+
: nothing}
|
|
203
|
+
</div>
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { html, LitElement, nothing } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
6
|
+
|
|
5
7
|
import styles from './number-counter.scss';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { html, nothing } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import { redispatchEvent } from '@/__utils/dispatch-event-utils.js';
|
|
6
|
+
import { spread } from '@/__directive/spread.js';
|
|
7
|
+
|
|
5
8
|
import BaseInput from '../input/BaseInput.js';
|
|
6
9
|
import styles from './number-field.scss';
|
|
7
|
-
import { spread } from '../spread.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* @label Number Field
|
|
@@ -7,44 +7,48 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.pagination {
|
|
10
|
-
background: var(--color-surface, #fff);
|
|
11
10
|
display: flex;
|
|
12
11
|
align-items: center;
|
|
12
|
+
justify-content: flex-end;
|
|
13
|
+
gap: var(--spacing-200, 1rem);
|
|
14
|
+
background: var(--color-surface, #fff);
|
|
15
|
+
padding: var(--spacing-150, 0.75rem) var(--spacing-200, 1rem);
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
@media (max-width: 48rem) {
|
|
18
|
+
flex-wrap: wrap;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
row-gap: var(--spacing-100, 0.5rem);
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
.page-size
|
|
19
|
-
display: flex;
|
|
23
|
+
.page-size {
|
|
24
|
+
display: inline-flex;
|
|
20
25
|
align-items: center;
|
|
21
26
|
gap: var(--spacing-100, 0.5rem);
|
|
22
|
-
|
|
27
|
+
min-inline-size: max-content;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.page-size-label {
|
|
31
|
+
@include mixin.get-typography-not-important('body-small');
|
|
23
32
|
color: var(--color-on-surface-variant);
|
|
24
33
|
white-space: nowrap;
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
.page-size-select {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
padding: var(--spacing-050, 0.25rem) var(--spacing-100, 0.5rem);
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
outline: none;
|
|
34
|
-
height: 2.5rem;
|
|
35
|
-
|
|
36
|
-
@include mixin.get-typography-not-important('body-medium');
|
|
37
|
-
|
|
38
|
-
&:focus {
|
|
39
|
-
outline: 2px solid var(--color-primary);
|
|
40
|
-
}
|
|
37
|
+
inline-size: 5.5rem;
|
|
38
|
+
min-inline-size: 5.5rem;
|
|
39
|
+
--field-container-height: 2.5rem;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
.pagination-item-count {
|
|
44
|
-
margin-inline-start:
|
|
45
|
-
flex: 1;
|
|
43
|
+
margin-inline-start: auto;
|
|
46
44
|
display: flex;
|
|
47
45
|
align-items: center;
|
|
46
|
+
|
|
47
|
+
@media (max-width: 48rem) {
|
|
48
|
+
order: 3;
|
|
49
|
+
margin-inline-start: 0;
|
|
50
|
+
inline-size: 100%;
|
|
51
|
+
}
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
.pagination-text {
|
|
@@ -52,8 +56,13 @@
|
|
|
52
56
|
color: var(--color-on-surface-variant);
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
.pagination-actions {
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: var(--spacing-025, 0.125rem);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.nav-button {
|
|
66
|
+
--button-container-shape: 999px;
|
|
58
67
|
}
|
|
59
68
|
}
|