@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
|
@@ -2,10 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
@include mixin.base-styles;
|
|
4
4
|
|
|
5
|
+
@keyframes snackbar-enter {
|
|
6
|
+
from {
|
|
7
|
+
opacity: 0;
|
|
8
|
+
transform: translateY(0.5rem);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
to {
|
|
12
|
+
opacity: 1;
|
|
13
|
+
transform: translateY(0);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@keyframes snackbar-exit {
|
|
18
|
+
from {
|
|
19
|
+
opacity: 1;
|
|
20
|
+
transform: translateY(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
to {
|
|
24
|
+
opacity: 0;
|
|
25
|
+
transform: translateY(0.5rem);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
5
29
|
:host {
|
|
6
|
-
display:
|
|
7
|
-
|
|
8
|
-
|
|
30
|
+
display: flex;
|
|
31
|
+
inset-block-end: calc(var(--snackbar-offset-bottom, 1rem) + env(safe-area-inset-bottom, 0px));
|
|
32
|
+
inset-inline: var(--snackbar-offset-inline, 1rem);
|
|
33
|
+
justify-content: center;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
position: fixed;
|
|
36
|
+
z-index: var(--snackbar-z-index, 1000);
|
|
9
37
|
|
|
10
38
|
--snackbar-container-color: var(--color-inverse-surface);
|
|
11
39
|
--snackbar-label-text-color: var(--color-inverse-on-surface);
|
|
@@ -20,54 +48,57 @@
|
|
|
20
48
|
background-color: var(--snackbar-container-color);
|
|
21
49
|
border-radius: var(--snackbar-border-radius);
|
|
22
50
|
color: var(--snackbar-label-text-color);
|
|
23
|
-
display:
|
|
51
|
+
display: none;
|
|
24
52
|
gap: var(--spacing-100);
|
|
53
|
+
max-width: min(42rem, 100%);
|
|
54
|
+
min-width: min(21.5rem, 100%);
|
|
25
55
|
min-height: 3rem;
|
|
26
|
-
opacity: 0;
|
|
27
56
|
padding: var(--spacing-100) var(--spacing-200);
|
|
28
57
|
pointer-events: none;
|
|
29
|
-
transform: translateY(0.5rem);
|
|
30
|
-
transition: opacity var(--duration-short2) var(--easing-standard),
|
|
31
|
-
transform var(--duration-short2) var(--easing-standard);
|
|
32
58
|
}
|
|
33
59
|
|
|
34
60
|
.snackbar.open {
|
|
35
|
-
|
|
61
|
+
animation: snackbar-enter var(--duration-medium1, 300ms) var(--easing-standard, cubic-bezier(0.2, 0, 0, 1)) both;
|
|
62
|
+
display: inline-flex;
|
|
36
63
|
pointer-events: auto;
|
|
37
|
-
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.snackbar.open.dismissing {
|
|
67
|
+
animation: snackbar-exit var(--duration-short2, 150ms) var(--easing-standard, cubic-bezier(0.2, 0, 0, 1)) forwards;
|
|
68
|
+
pointer-events: none;
|
|
38
69
|
}
|
|
39
70
|
|
|
40
71
|
.label {
|
|
41
72
|
flex: 1 1 auto;
|
|
42
73
|
color: inherit;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.action,
|
|
46
|
-
.close {
|
|
47
|
-
@include mixin.get-typography(label-large);
|
|
74
|
+
min-height: 32px;
|
|
48
75
|
align-items: center;
|
|
49
|
-
|
|
50
|
-
border: none;
|
|
51
|
-
color: var(--snackbar-action-text-color);
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
display: inline-flex;
|
|
54
|
-
justify-content: center;
|
|
55
|
-
margin: 0;
|
|
56
|
-
min-height: 2rem;
|
|
57
|
-
min-width: 2rem;
|
|
58
|
-
padding: 0 var(--spacing-100);
|
|
76
|
+
display: flex;
|
|
59
77
|
}
|
|
60
78
|
|
|
61
|
-
.
|
|
62
|
-
color: var(--snackbar-
|
|
63
|
-
padding: 0;
|
|
79
|
+
.action {
|
|
80
|
+
--text-button-label-text-color: var(--snackbar-action-text-color);
|
|
64
81
|
}
|
|
65
82
|
|
|
66
|
-
.close
|
|
67
|
-
--
|
|
68
|
-
color: inherit;
|
|
83
|
+
.close {
|
|
84
|
+
--text-button-label-text-color: var(--snackbar-close-icon-color);
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
.snackbar.multiline {
|
|
72
88
|
align-items: flex-start;
|
|
89
|
+
|
|
90
|
+
.label {
|
|
91
|
+
height: 100%;
|
|
92
|
+
}
|
|
73
93
|
}
|
|
94
|
+
|
|
95
|
+
:host([preview]) {
|
|
96
|
+
position: relative;
|
|
97
|
+
inset-inline: unset;
|
|
98
|
+
inset-block-end: unset;
|
|
99
|
+
|
|
100
|
+
.snackbar {
|
|
101
|
+
display: inline-flex;
|
|
102
|
+
pointer-events: auto;
|
|
103
|
+
}
|
|
104
|
+
}
|
package/src/snackbar/snackbar.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement, html, nothing } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import styles from './snackbar.scss';
|
|
5
5
|
|
|
@@ -16,16 +16,23 @@ type SnackbarCloseReason = 'timeout' | 'dismiss' | 'action' | 'programmatic';
|
|
|
16
16
|
* @cssprop --snackbar-action-text-color - Action text color.
|
|
17
17
|
* @cssprop --snackbar-close-icon-color - Close icon color.
|
|
18
18
|
* @cssprop --snackbar-border-radius - Border radius of the snackbar surface.
|
|
19
|
+
* @cssprop --snackbar-offset-inline - Inline offset from viewport edges.
|
|
20
|
+
* @cssprop --snackbar-offset-bottom - Bottom offset from viewport edge.
|
|
21
|
+
* @cssprop --snackbar-z-index - Stacking order for the snackbar.
|
|
19
22
|
*
|
|
20
23
|
* @example
|
|
21
24
|
* ```html
|
|
22
|
-
* <wc-snackbar
|
|
25
|
+
* <wc-snackbar preview message="Message archived" action-label="Undo"></wc-snackbar>
|
|
23
26
|
* ```
|
|
24
27
|
* @tags display, feedback
|
|
25
28
|
*/
|
|
26
29
|
export class Snackbar extends LitElement {
|
|
27
30
|
static styles = [styles];
|
|
28
31
|
|
|
32
|
+
private static readonly GLOBAL_OPEN_EVENT = 'wc-snackbar-will-open';
|
|
33
|
+
|
|
34
|
+
private static readonly EXIT_ANIMATION_MS = 180;
|
|
35
|
+
|
|
29
36
|
@property({ type: Boolean, reflect: true }) open = false;
|
|
30
37
|
|
|
31
38
|
@property({ type: String }) message = '';
|
|
@@ -39,10 +46,41 @@ export class Snackbar extends LitElement {
|
|
|
39
46
|
|
|
40
47
|
@property({ type: Boolean, reflect: true }) multiline = false;
|
|
41
48
|
|
|
49
|
+
@property({ type: Boolean, reflect: true }) preview = false;
|
|
50
|
+
|
|
51
|
+
@state() private dismissing = false;
|
|
52
|
+
|
|
53
|
+
|
|
42
54
|
private hideTimer: ReturnType<typeof setTimeout> | null = null;
|
|
43
55
|
|
|
56
|
+
private exitTimer: ReturnType<typeof setTimeout> | null = null;
|
|
57
|
+
|
|
58
|
+
private readonly handleGlobalSnackbarOpen = (
|
|
59
|
+
event: Event,
|
|
60
|
+
) => {
|
|
61
|
+
const { source } = (event as CustomEvent<{ source?: Snackbar }>).detail;
|
|
62
|
+
if (source && source !== this) {
|
|
63
|
+
this.hide();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
super.connectedCallback();
|
|
69
|
+
document.addEventListener(
|
|
70
|
+
Snackbar.GLOBAL_OPEN_EVENT,
|
|
71
|
+
this.handleGlobalSnackbarOpen,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
44
75
|
show() {
|
|
45
|
-
this.
|
|
76
|
+
this.dismissing = false;
|
|
77
|
+
this.clearExitTimer();
|
|
78
|
+
if (!this.open) {
|
|
79
|
+
this.open = true;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.scheduleAutoHide();
|
|
46
84
|
}
|
|
47
85
|
|
|
48
86
|
hide() {
|
|
@@ -50,11 +88,17 @@ export class Snackbar extends LitElement {
|
|
|
50
88
|
}
|
|
51
89
|
|
|
52
90
|
private close(reason: SnackbarCloseReason) {
|
|
53
|
-
if (!this.open) {
|
|
91
|
+
if (!this.open || this.dismissing) {
|
|
54
92
|
return;
|
|
55
93
|
}
|
|
56
94
|
|
|
57
|
-
this.
|
|
95
|
+
this.clearTimer();
|
|
96
|
+
this.dismissing = true;
|
|
97
|
+
this.clearExitTimer();
|
|
98
|
+
this.exitTimer = setTimeout(() => {
|
|
99
|
+
this.completeDismiss();
|
|
100
|
+
}, Snackbar.EXIT_ANIMATION_MS);
|
|
101
|
+
|
|
58
102
|
this.dispatchEvent(
|
|
59
103
|
new CustomEvent('snackbar-close', {
|
|
60
104
|
detail: { reason },
|
|
@@ -64,6 +108,12 @@ export class Snackbar extends LitElement {
|
|
|
64
108
|
);
|
|
65
109
|
}
|
|
66
110
|
|
|
111
|
+
private completeDismiss() {
|
|
112
|
+
this.clearExitTimer();
|
|
113
|
+
this.dismissing = false;
|
|
114
|
+
this.open = false;
|
|
115
|
+
}
|
|
116
|
+
|
|
67
117
|
private dispatchActionEvent() {
|
|
68
118
|
this.dispatchEvent(
|
|
69
119
|
new CustomEvent('snackbar-action', {
|
|
@@ -89,6 +139,19 @@ export class Snackbar extends LitElement {
|
|
|
89
139
|
}
|
|
90
140
|
}
|
|
91
141
|
|
|
142
|
+
private clearExitTimer() {
|
|
143
|
+
if (this.exitTimer !== null) {
|
|
144
|
+
clearTimeout(this.exitTimer);
|
|
145
|
+
this.exitTimer = null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private handleAnimationEnd(event: AnimationEvent) {
|
|
150
|
+
if (event.animationName === 'snackbar-exit' && this.dismissing) {
|
|
151
|
+
this.completeDismiss();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
92
155
|
private scheduleAutoHide() {
|
|
93
156
|
this.clearTimer();
|
|
94
157
|
if (!this.open || this.duration <= 0) {
|
|
@@ -102,11 +165,24 @@ export class Snackbar extends LitElement {
|
|
|
102
165
|
|
|
103
166
|
protected updated(changedProperties: Map<string, unknown>) {
|
|
104
167
|
if (changedProperties.has('open')) {
|
|
168
|
+
if (this.open) {
|
|
169
|
+
document.dispatchEvent(
|
|
170
|
+
new CustomEvent(Snackbar.GLOBAL_OPEN_EVENT, {
|
|
171
|
+
detail: { source: this },
|
|
172
|
+
}),
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
105
176
|
this.scheduleAutoHide();
|
|
106
177
|
}
|
|
107
178
|
}
|
|
108
179
|
|
|
109
180
|
disconnectedCallback() {
|
|
181
|
+
document.removeEventListener(
|
|
182
|
+
Snackbar.GLOBAL_OPEN_EVENT,
|
|
183
|
+
this.handleGlobalSnackbarOpen,
|
|
184
|
+
);
|
|
185
|
+
this.clearExitTimer();
|
|
110
186
|
this.clearTimer();
|
|
111
187
|
super.disconnectedCallback();
|
|
112
188
|
}
|
|
@@ -119,31 +195,35 @@ export class Snackbar extends LitElement {
|
|
|
119
195
|
<div
|
|
120
196
|
class=${classMap({
|
|
121
197
|
snackbar: true,
|
|
122
|
-
open: this.open,
|
|
198
|
+
open: !this.preview && this.open,
|
|
199
|
+
preview: this.preview,
|
|
200
|
+
dismissing: this.dismissing,
|
|
123
201
|
multiline: this.multiline,
|
|
124
202
|
})}
|
|
125
203
|
role=${liveRole}
|
|
126
204
|
aria-live="polite"
|
|
205
|
+
@animationend=${this.handleAnimationEnd}
|
|
127
206
|
>
|
|
128
207
|
<div class="label">
|
|
129
208
|
<slot>${this.message}</slot>
|
|
130
209
|
</div>
|
|
131
210
|
|
|
132
211
|
${this.actionLabel
|
|
133
|
-
? html`<button class="action"
|
|
212
|
+
? html`<wc-button class="action" variant='text' size='small' @click=${this.handleActionClick}>
|
|
134
213
|
${this.actionLabel}
|
|
135
|
-
</button>`
|
|
214
|
+
</wc-button>`
|
|
136
215
|
: nothing}
|
|
137
216
|
|
|
138
217
|
${this.showCloseIcon
|
|
139
|
-
? html`<button
|
|
218
|
+
? html`<wc-icon-button
|
|
140
219
|
class="close"
|
|
141
|
-
|
|
220
|
+
variant='text'
|
|
221
|
+
size='small'
|
|
142
222
|
aria-label="Dismiss notification"
|
|
143
223
|
@click=${this.handleCloseClick}
|
|
224
|
+
name="close"
|
|
144
225
|
>
|
|
145
|
-
|
|
146
|
-
</button>`
|
|
226
|
+
</wc-icon-button>`
|
|
147
227
|
: nothing}
|
|
148
228
|
</div>
|
|
149
229
|
`;
|
package/src/switch/switch.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
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 { spread } from '@/__directive/spread.js';
|
|
6
|
+
|
|
5
7
|
import styles from './switch.scss';
|
|
6
8
|
import BaseInput from '../input/BaseInput.js';
|
|
7
9
|
|
package/src/table/table.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { html, LitElement, nothing } from 'lit';
|
|
|
2
2
|
import { property, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import { throttle } from '@/__utils/throttle.js';
|
|
7
|
+
|
|
6
8
|
import styles from './table.scss';
|
|
7
9
|
|
|
8
10
|
const DEFAULT_CELL_WIDTH = 16; // in rem
|
package/src/tabs/tab.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { html, LitElement, nothing } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
|
|
5
|
+
import { dispatchActivationClick, isActivationClick } from '@/__utils/dispatch-event-utils.js';
|
|
6
|
+
import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
|
|
7
|
+
import { throttle } from '@/__utils/throttle.js';
|
|
8
|
+
import { spread } from '@/__directive/spread.js';
|
|
9
|
+
|
|
7
10
|
import styles from './tab.scss';
|
|
8
11
|
import type { Tabs } from './tabs.js';
|
|
9
12
|
|
package/src/textarea/textarea.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { redispatchEvent } from '@/__utils/dispatch-event-utils.js';
|
|
5
|
+
import { spread } from '@/__directive/spread.js';
|
|
6
|
+
|
|
4
7
|
import BaseInput from '../input/BaseInput.js';
|
|
5
8
|
import styles from './textarea.scss';
|
|
6
|
-
import { spread } from '../spread.js';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* @label Textarea
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { redispatchEvent } from '@/__utils/dispatch-event-utils.js';
|
|
5
|
+
import { spread } from '@/__directive/spread.js';
|
|
6
|
+
|
|
4
7
|
import BaseInput from '../input/BaseInput.js';
|
|
5
8
|
import styles from './time-picker.scss';
|
|
6
|
-
import { spread } from '../spread.js';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* @label Time Picker
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Toolbar } from './toolbar.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
/* Docked toolbar */
|
|
3
|
+
--toolbar-container-color: var(--color-surface-container);
|
|
4
|
+
--toolbar-title-color: var(--color-on-surface);
|
|
5
|
+
--toolbar-icon-color: var(--color-on-surface-variant);
|
|
6
|
+
|
|
7
|
+
/* Internal aliases used by styles */
|
|
8
|
+
--_toolbar-container-color: var(--toolbar-container-color);
|
|
9
|
+
--_toolbar-title-color: var(--toolbar-title-color);
|
|
10
|
+
--_toolbar-icon-color: var(--toolbar-icon-color);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Floating variant uses surface-container-high for a visible pill */
|
|
14
|
+
:host([variant='floating']) {
|
|
15
|
+
--toolbar-container-color: var(--color-surface-container-high);
|
|
16
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
@use '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
@include mixin.base-styles;
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
--toolbar-container-shape: var(--shape-corner-full);
|
|
8
|
+
--toolbar-docked-container-shape: var(--shape-corner-extra-large) var(--shape-corner-extra-large) var(--shape-corner-none) var(--shape-corner-none);
|
|
9
|
+
--toolbar-height: 5rem; /* 80dp - small/default docked */
|
|
10
|
+
--toolbar-padding-inline: 0.75rem;
|
|
11
|
+
--toolbar-gap: 0.5rem;
|
|
12
|
+
--toolbar-shadow: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* ---- Shared toolbar base ---- */
|
|
16
|
+
|
|
17
|
+
.toolbar {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: var(--toolbar-gap);
|
|
22
|
+
padding-inline: var(--toolbar-padding-inline);
|
|
23
|
+
min-height: var(--toolbar-height);
|
|
24
|
+
width: 100%;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
color: var(--_toolbar-title-color);
|
|
27
|
+
--icon-color: var(--_toolbar-icon-color);
|
|
28
|
+
box-shadow: var(--toolbar-shadow);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.toolbar-content {
|
|
32
|
+
position: relative;
|
|
33
|
+
z-index: 1;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
min-width: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.background {
|
|
40
|
+
position: absolute;
|
|
41
|
+
inset: 0;
|
|
42
|
+
background-color: var(--_toolbar-container-color);
|
|
43
|
+
pointer-events: none;
|
|
44
|
+
z-index: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ---- Docked variant ---- */
|
|
48
|
+
|
|
49
|
+
.toolbar.variant-docked {
|
|
50
|
+
width: 100%;
|
|
51
|
+
padding-inline: var(--toolbar-padding-inline);
|
|
52
|
+
padding-block-start: 0.5rem;
|
|
53
|
+
padding-block-end: calc(0.5rem + env(safe-area-inset-bottom, 0px));
|
|
54
|
+
|
|
55
|
+
.background {
|
|
56
|
+
border-radius: var(--toolbar-docked-container-shape);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.toolbar-content {
|
|
60
|
+
width: 100%;
|
|
61
|
+
justify-content: space-between;
|
|
62
|
+
gap: var(--toolbar-gap);
|
|
63
|
+
overflow-x: auto;
|
|
64
|
+
overflow-y: hidden;
|
|
65
|
+
scrollbar-width: none;
|
|
66
|
+
|
|
67
|
+
&::-webkit-scrollbar {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
::slotted(*) {
|
|
73
|
+
position: relative;
|
|
74
|
+
z-index: 1;
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
::slotted(wc-icon-button) {
|
|
79
|
+
--button-container-shape: var(--shape-corner-full);
|
|
80
|
+
--button-container-shape-variant: round;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Size variants */
|
|
84
|
+
&.size-small {
|
|
85
|
+
--toolbar-height: 5rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&.size-medium {
|
|
89
|
+
--toolbar-height: 6rem;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&.size-large {
|
|
93
|
+
--toolbar-height: 7rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&.elevated {
|
|
97
|
+
--toolbar-shadow: var(--elevation-shadow-level-3, 0 4px 8px rgba(0, 0, 0, 0.15));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* ---- Floating variant ---- */
|
|
102
|
+
|
|
103
|
+
.toolbar.variant-floating {
|
|
104
|
+
--toolbar-container-shape: var(--shape-corner-full);
|
|
105
|
+
|
|
106
|
+
border-radius: var(--toolbar-container-shape);
|
|
107
|
+
width: auto;
|
|
108
|
+
display: inline-flex;
|
|
109
|
+
padding: 0.75rem;
|
|
110
|
+
gap: 0.5rem;
|
|
111
|
+
|
|
112
|
+
.elevation {
|
|
113
|
+
--elevation-level: 3;
|
|
114
|
+
--elevation-container-shape: var(--toolbar-container-shape);
|
|
115
|
+
--elevation-container-shape-variant: round;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.background {
|
|
119
|
+
border-radius: var(--toolbar-container-shape);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.toolbar-content {
|
|
123
|
+
width: auto;
|
|
124
|
+
gap: 0.5rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
::slotted(*) {
|
|
128
|
+
position: relative;
|
|
129
|
+
z-index: 1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
::slotted(wc-icon-button) {
|
|
133
|
+
--button-container-shape: var(--shape-corner-full);
|
|
134
|
+
--button-container-shape-variant: round;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&.orientation-horizontal {
|
|
138
|
+
min-height: auto;
|
|
139
|
+
padding-block: 0.5rem;
|
|
140
|
+
padding-inline: 0.75rem;
|
|
141
|
+
|
|
142
|
+
.toolbar-content {
|
|
143
|
+
flex-direction: row;
|
|
144
|
+
align-items: center;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&.orientation-vertical {
|
|
149
|
+
min-height: auto;
|
|
150
|
+
width: auto;
|
|
151
|
+
padding-block: 0.75rem;
|
|
152
|
+
padding-inline: 0.5rem;
|
|
153
|
+
|
|
154
|
+
.toolbar-content {
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
align-items: center;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&.elevated {
|
|
161
|
+
.elevation {
|
|
162
|
+
--elevation-level: 4;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|