@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,49 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--tonal-fab-container-color: var(--color-surface-container-high);
|
|
3
|
+
--tonal-fab-label-text-color: var(--color-on-surface);
|
|
4
|
+
|
|
5
|
+
--filled-fab-container-color: var(--color-surface);
|
|
6
|
+
--filled-fab-label-text-color: var(--color-on-surface);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host([color='surface']) {
|
|
10
|
+
--tonal-fab-container-color: var(--color-surface-container-high);
|
|
11
|
+
--tonal-fab-label-text-color: var(--color-on-surface);
|
|
12
|
+
|
|
13
|
+
--filled-fab-container-color: var(--color-surface);
|
|
14
|
+
--filled-fab-label-text-color: var(--color-on-surface);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host([color='primary']) {
|
|
18
|
+
--tonal-fab-container-color: var(--color-primary-container);
|
|
19
|
+
--tonal-fab-label-text-color: var(--color-on-primary-container);
|
|
20
|
+
|
|
21
|
+
--filled-fab-container-color: var(--color-primary);
|
|
22
|
+
--filled-fab-label-text-color: var(--color-on-primary);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([color='secondary']) {
|
|
26
|
+
--tonal-fab-container-color: var(--color-secondary-container);
|
|
27
|
+
--tonal-fab-label-text-color: var(--color-on-secondary-container);
|
|
28
|
+
|
|
29
|
+
--filled-fab-container-color: var(--color-secondary);
|
|
30
|
+
--filled-fab-label-text-color: var(--color-on-secondary);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([color='tertiary']) {
|
|
34
|
+
--tonal-fab-container-color: var(--color-tertiary-container);
|
|
35
|
+
--tonal-fab-label-text-color: var(--color-on-tertiary-container);
|
|
36
|
+
|
|
37
|
+
--filled-fab-container-color: var(--color-tertiary);
|
|
38
|
+
--filled-fab-label-text-color: var(--color-on-tertiary);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.fab.variant-tonal {
|
|
42
|
+
--_fab-container-color: var(--tonal-fab-container-color);
|
|
43
|
+
--_fab-label-text-color: var(--tonal-fab-label-text-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.fab.variant-filled {
|
|
47
|
+
--_fab-container-color: var(--filled-fab-container-color);
|
|
48
|
+
--_fab-label-text-color: var(--filled-fab-label-text-color);
|
|
49
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* Small FAB: 40x40dp, shape-corner-medium */
|
|
2
|
+
:host([size='sm']) {
|
|
3
|
+
--fab-container-shape: var(--shape-corner-medium);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:host([size='sm']) .fab {
|
|
7
|
+
width: 2.5rem;
|
|
8
|
+
height: 2.5rem;
|
|
9
|
+
--_fab-icon-size: 1.5rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Standard/Medium FAB: 56x56dp, shape-corner-large (default) */
|
|
13
|
+
:host([size='md']) .fab {
|
|
14
|
+
width: 3.5rem;
|
|
15
|
+
height: 3.5rem;
|
|
16
|
+
--_fab-icon-size: 1.5rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Large FAB: 96x96dp, shape-corner-extra-large */
|
|
20
|
+
:host([size='lg']) {
|
|
21
|
+
--fab-container-shape: var(--shape-corner-extra-large);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([size='lg']) .fab {
|
|
25
|
+
width: 6rem;
|
|
26
|
+
height: 6rem;
|
|
27
|
+
--_fab-icon-size: 2.25rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Extended FAB overrides (height fixed, width auto) */
|
|
31
|
+
:host([size='sm']) .fab.extended {
|
|
32
|
+
width: auto;
|
|
33
|
+
min-width: 4rem;
|
|
34
|
+
height: 2.5rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([size='md']) .fab.extended {
|
|
38
|
+
width: auto;
|
|
39
|
+
min-width: 5rem;
|
|
40
|
+
height: 3.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([size='lg']) .fab.extended {
|
|
44
|
+
width: auto;
|
|
45
|
+
min-width: 6rem;
|
|
46
|
+
height: 6rem;
|
|
47
|
+
}
|
package/src/fab/fab.scss
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
@use '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
@include mixin.base-styles;
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
|
|
8
|
+
--fab-container-shape: var(--shape-corner-large);
|
|
9
|
+
--fab-container-elevation-level: 3;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Reset native button/link styles
|
|
14
|
+
*/
|
|
15
|
+
.fab-element {
|
|
16
|
+
background: transparent;
|
|
17
|
+
border: none;
|
|
18
|
+
appearance: none;
|
|
19
|
+
margin: 0;
|
|
20
|
+
outline: none;
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.fab {
|
|
26
|
+
position: relative;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
border-radius: var(--fab-container-shape);
|
|
31
|
+
font-family: var(--font-family-sans) !important;
|
|
32
|
+
|
|
33
|
+
.fab-content {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
z-index: 0;
|
|
39
|
+
gap: 0.75rem;
|
|
40
|
+
|
|
41
|
+
color: var(--_fab-label-text-color);
|
|
42
|
+
--icon-size: var(--_fab-icon-size);
|
|
43
|
+
--icon-color: var(--_fab-label-text-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.fab-label {
|
|
47
|
+
font-size: 0.875rem;
|
|
48
|
+
font-weight: var(--font-weight-medium);
|
|
49
|
+
line-height: 1.25rem;
|
|
50
|
+
letter-spacing: 0.00625em;
|
|
51
|
+
white-space: nowrap;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.disabled {
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
Background layers
|
|
60
|
+
*/
|
|
61
|
+
.focus-ring {
|
|
62
|
+
z-index: 2;
|
|
63
|
+
--focus-ring-container-shape-start-start: var(--fab-container-shape);
|
|
64
|
+
--focus-ring-container-shape-start-end: var(--fab-container-shape);
|
|
65
|
+
--focus-ring-container-shape-end-start: var(--fab-container-shape);
|
|
66
|
+
--focus-ring-container-shape-end-end: var(--fab-container-shape);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ripple {
|
|
70
|
+
border-radius: var(--fab-container-shape);
|
|
71
|
+
--ripple-state-opacity: var(--_fab-container-state-opacity, 0);
|
|
72
|
+
--ripple-pressed-color: var(--_fab-label-text-color);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.background {
|
|
76
|
+
display: block;
|
|
77
|
+
position: absolute;
|
|
78
|
+
inset: 0;
|
|
79
|
+
background-color: var(--_fab-container-color);
|
|
80
|
+
opacity: var(--_fab-container-opacity, 1);
|
|
81
|
+
border-radius: var(--fab-container-shape);
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.elevation {
|
|
86
|
+
--elevation-level: var(--_fab-container-elevation-level, var(--fab-container-elevation-level));
|
|
87
|
+
transition-duration: 280ms;
|
|
88
|
+
--elevation-container-shape-start-start: var(--fab-container-shape);
|
|
89
|
+
--elevation-container-shape-start-end: var(--fab-container-shape);
|
|
90
|
+
--elevation-container-shape-end-start: var(--fab-container-shape);
|
|
91
|
+
--elevation-container-shape-end-end: var(--fab-container-shape);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&:hover:not(.disabled) {
|
|
95
|
+
--_fab-container-elevation-level: 4;
|
|
96
|
+
--_fab-container-state-opacity: 0.08;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&.pressed:not(.disabled) {
|
|
100
|
+
--_fab-container-elevation-level: 3;
|
|
101
|
+
--_fab-container-state-opacity: 0.12;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.lowered {
|
|
105
|
+
--fab-container-elevation-level: 1;
|
|
106
|
+
|
|
107
|
+
&:hover:not(.disabled) {
|
|
108
|
+
--_fab-container-elevation-level: 2;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&.pressed:not(.disabled) {
|
|
112
|
+
--_fab-container-elevation-level: 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.disabled {
|
|
117
|
+
--_fab-container-color: var(--color-on-surface);
|
|
118
|
+
--_fab-container-opacity: 0.12;
|
|
119
|
+
--_fab-label-text-color: var(--color-on-surface);
|
|
120
|
+
--_fab-label-text-opacity: 0.38;
|
|
121
|
+
--_fab-container-elevation-level: 0;
|
|
122
|
+
|
|
123
|
+
.ripple {
|
|
124
|
+
display: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.fab-content {
|
|
128
|
+
opacity: 0.38;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Extended FAB */
|
|
134
|
+
.fab.extended {
|
|
135
|
+
padding: 0 1rem;
|
|
136
|
+
border-radius: var(--fab-container-shape);
|
|
137
|
+
}
|
package/src/fab/fab.ts
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { html, LitElement, nothing } from 'lit';
|
|
2
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
|
|
6
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
7
|
+
import { dispatchActivationClick, isActivationClick } from '@/__utils/dispatch-event-utils.js';
|
|
8
|
+
import { throttle } from '@/__utils/throttle.js';
|
|
9
|
+
import { spread } from '@/__directive/spread.js';
|
|
10
|
+
|
|
11
|
+
import { IconProvider } from '../icon/icon.js';
|
|
12
|
+
import styles from './fab.scss';
|
|
13
|
+
import colorStyles from './fab-colors.scss';
|
|
14
|
+
import sizeStyles from './fab-sizes.scss';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @label FAB
|
|
18
|
+
* @tag wc-fab
|
|
19
|
+
* @rawTag fab
|
|
20
|
+
*
|
|
21
|
+
* @summary The FAB (Floating Action Button) represents the primary action on a screen.
|
|
22
|
+
* @overview
|
|
23
|
+
* <p>A Floating Action Button (FAB) is a circular button that represents the primary action on a screen. It follows the Material Design 3 specification and supports four color roles and two variants.</p>
|
|
24
|
+
*
|
|
25
|
+
* @cssprop --fab-container-color: Background color of the FAB container.
|
|
26
|
+
* @cssprop --fab-label-text-color: Text and icon color of the FAB label.
|
|
27
|
+
* @cssprop --fab-container-shape: Corner radius of the FAB. Defaults to var(--shape-corner-large).
|
|
28
|
+
* @cssprop --fab-container-elevation-level: Elevation level of the FAB. Defaults to 3.
|
|
29
|
+
*
|
|
30
|
+
* @fires {MouseEvent} click - Dispatched when the FAB is clicked.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```html
|
|
34
|
+
* <wc-fab name="add"></wc-fab>
|
|
35
|
+
* ```
|
|
36
|
+
* @tags controls
|
|
37
|
+
*/
|
|
38
|
+
@IndividualComponent
|
|
39
|
+
export class Fab extends LitElement {
|
|
40
|
+
static override styles = [styles, colorStyles, sizeStyles];
|
|
41
|
+
|
|
42
|
+
#id = crypto.randomUUID();
|
|
43
|
+
|
|
44
|
+
#tabindex?: number = 0;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Name of the icon to display inside the FAB.
|
|
48
|
+
*/
|
|
49
|
+
@property({ type: String, reflect: true }) name?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Source URL for a custom icon.
|
|
53
|
+
*/
|
|
54
|
+
@property({ type: String, reflect: true }) src?: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Icon provider. Defaults to `"material-symbols"`.
|
|
58
|
+
*/
|
|
59
|
+
@property({ type: String }) provider: IconProvider = 'material-symbols';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Optional label text for the extended FAB variant.
|
|
63
|
+
* When set, the FAB displays both the icon and a text label.
|
|
64
|
+
*/
|
|
65
|
+
@property({ type: String }) label?: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The color role of the FAB.
|
|
69
|
+
* `"surface"` uses the surface color role.
|
|
70
|
+
* `"primary"` uses the primary color role.
|
|
71
|
+
* `"secondary"` uses the secondary color role.
|
|
72
|
+
* `"tertiary"` uses the tertiary color role.
|
|
73
|
+
*/
|
|
74
|
+
@property({ reflect: true }) color: 'surface' | 'primary' | 'secondary' | 'tertiary' = 'surface';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The style variant of the FAB.
|
|
78
|
+
* `"tonal"` uses container colors.
|
|
79
|
+
* `"filled"` uses solid role colors.
|
|
80
|
+
*/
|
|
81
|
+
@property({ reflect: true }) variant: 'tonal' | 'filled' = 'tonal';
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The size of the FAB.
|
|
85
|
+
* `"sm"` renders a small FAB (40×40dp).
|
|
86
|
+
* `"md"` renders a standard FAB (56×56dp). This is the default.
|
|
87
|
+
* `"lg"` renders a large FAB (96×96dp).
|
|
88
|
+
*/
|
|
89
|
+
@property({ reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* If `true`, the FAB is in a lowered (resting) state with reduced elevation.
|
|
93
|
+
*/
|
|
94
|
+
@property({ type: Boolean, reflect: true }) lowered: boolean = false;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* If `true`, the user cannot interact with the FAB.
|
|
98
|
+
*/
|
|
99
|
+
@property({ type: Boolean, reflect: true }) disabled: boolean = false;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Hyperlink to navigate to on click.
|
|
103
|
+
*/
|
|
104
|
+
@property({ reflect: true }) href?: string;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Sets or retrieves the window or frame at which to target content.
|
|
108
|
+
*/
|
|
109
|
+
@property() target: string = '_self';
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Additional ARIA attributes to pass to the inner button/anchor element.
|
|
113
|
+
*/
|
|
114
|
+
@property({ reflect: true })
|
|
115
|
+
configAria?: { [key: string]: any };
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
119
|
+
*/
|
|
120
|
+
@property() throttleDelay = 200;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Tooltip text shown on hover.
|
|
124
|
+
*/
|
|
125
|
+
@property() tooltip?: string;
|
|
126
|
+
|
|
127
|
+
@state()
|
|
128
|
+
isPressed = false;
|
|
129
|
+
|
|
130
|
+
@query('.fab') readonly fabElement!: HTMLElement | null;
|
|
131
|
+
|
|
132
|
+
override focus() {
|
|
133
|
+
this.fabElement?.focus();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
override blur() {
|
|
137
|
+
this.fabElement?.blur();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
override connectedCallback() {
|
|
141
|
+
super.connectedCallback();
|
|
142
|
+
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
143
|
+
window.addEventListener('mouseup', this.__handlePress);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
override disconnectedCallback() {
|
|
147
|
+
window.removeEventListener('mouseup', this.__handlePress);
|
|
148
|
+
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
149
|
+
super.disconnectedCallback();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
override firstUpdated() {
|
|
153
|
+
this.__dispatchClickWithThrottle = throttle(
|
|
154
|
+
this.__dispatchClick,
|
|
155
|
+
this.throttleDelay,
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
__handlePress = (event: KeyboardEvent | MouseEvent) => {
|
|
160
|
+
if (this.disabled) return;
|
|
161
|
+
if (
|
|
162
|
+
event instanceof KeyboardEvent &&
|
|
163
|
+
event.type === 'keydown' &&
|
|
164
|
+
(event.key === 'Enter' || event.key === ' ')
|
|
165
|
+
) {
|
|
166
|
+
this.isPressed = true;
|
|
167
|
+
} else if (event.type === 'mousedown') {
|
|
168
|
+
this.isPressed = true;
|
|
169
|
+
} else {
|
|
170
|
+
this.isPressed = false;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
__isLink() {
|
|
175
|
+
return !!this.href;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
__dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
|
|
179
|
+
event => {
|
|
180
|
+
this.__dispatchClick(event);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
184
|
+
if (this.disabled && this.href) {
|
|
185
|
+
event.stopImmediatePropagation();
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (!isActivationClick(event) || !this.fabElement) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
this.focus();
|
|
195
|
+
dispatchActivationClick(this.fabElement);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
__getDisabledReasonID() {
|
|
199
|
+
return this.disabled ? `disabled-reason-${this.#id}` : nothing;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
override render() {
|
|
203
|
+
const isLink = this.__isLink();
|
|
204
|
+
const isExtended = !!this.label;
|
|
205
|
+
|
|
206
|
+
const cssClasses = {
|
|
207
|
+
fab: true,
|
|
208
|
+
'fab-element': true,
|
|
209
|
+
[`size-${this.size}`]: true,
|
|
210
|
+
[`color-${this.color}`]: true,
|
|
211
|
+
[`variant-${this.variant}`]: true,
|
|
212
|
+
extended: isExtended,
|
|
213
|
+
lowered: this.lowered,
|
|
214
|
+
disabled: this.disabled,
|
|
215
|
+
pressed: this.isPressed,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
if (!isLink) {
|
|
219
|
+
return html`<button
|
|
220
|
+
class=${classMap(cssClasses)}
|
|
221
|
+
id="fab"
|
|
222
|
+
tabindex=${this.#tabindex}
|
|
223
|
+
type="button"
|
|
224
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
225
|
+
@mousedown=${this.__handlePress}
|
|
226
|
+
@keydown=${this.__handlePress}
|
|
227
|
+
@keyup=${this.__handlePress}
|
|
228
|
+
aria-label=${this.label ?? this.name ?? nothing}
|
|
229
|
+
aria-disabled=${`${this.disabled}`}
|
|
230
|
+
?disabled=${this.disabled}
|
|
231
|
+
${spread(this.configAria)}
|
|
232
|
+
>
|
|
233
|
+
${this.__renderFabContent(isExtended)}
|
|
234
|
+
</button>
|
|
235
|
+
${this.__renderTooltip()}`;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return html`<a
|
|
239
|
+
class=${classMap(cssClasses)}
|
|
240
|
+
id="fab"
|
|
241
|
+
tabindex=${this.#tabindex}
|
|
242
|
+
href=${ifDefined(this.href)}
|
|
243
|
+
target=${this.target}
|
|
244
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
245
|
+
@mousedown=${this.__handlePress}
|
|
246
|
+
@keydown=${this.__handlePress}
|
|
247
|
+
@keyup=${this.__handlePress}
|
|
248
|
+
role="button"
|
|
249
|
+
aria-label=${this.label ?? this.name ?? nothing}
|
|
250
|
+
aria-disabled=${`${this.disabled}`}
|
|
251
|
+
${spread(this.configAria)}
|
|
252
|
+
>
|
|
253
|
+
${this.__renderFabContent(isExtended)}
|
|
254
|
+
</a>
|
|
255
|
+
${this.__renderTooltip()}`;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
__renderFabContent(isExtended: boolean) {
|
|
259
|
+
return html`
|
|
260
|
+
<wc-focus-ring class="focus-ring" .control=${this} .forElement=${this.fabElement}></wc-focus-ring>
|
|
261
|
+
<wc-elevation class="elevation"></wc-elevation>
|
|
262
|
+
<div class="background"></div>
|
|
263
|
+
<wc-ripple class="ripple"></wc-ripple>
|
|
264
|
+
|
|
265
|
+
<div class="fab-content">
|
|
266
|
+
<wc-icon
|
|
267
|
+
class="fab-icon"
|
|
268
|
+
name=${ifDefined(this.name)}
|
|
269
|
+
src=${ifDefined(this.src)}
|
|
270
|
+
provider=${this.provider}
|
|
271
|
+
></wc-icon>
|
|
272
|
+
${isExtended
|
|
273
|
+
? html`<span class="fab-label">${this.label}</span>`
|
|
274
|
+
: nothing}
|
|
275
|
+
</div>
|
|
276
|
+
`;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
__renderTooltip() {
|
|
280
|
+
if (this.tooltip) {
|
|
281
|
+
return html`<wc-tooltip for="fab">${this.tooltip}</wc-tooltip>`;
|
|
282
|
+
}
|
|
283
|
+
return nothing;
|
|
284
|
+
}
|
|
285
|
+
}
|
package/src/fab/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fab } from './fab.js';
|
package/src/field/field.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
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
|
+
|
|
5
|
+
import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
|
|
6
|
+
|
|
4
7
|
import styles from './field.scss';
|
|
5
|
-
import { observerSlotChangesWithCallback } from '../utils.js';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* @label Field
|
package/src/icon/datasource.ts
CHANGED
package/src/icon/icon.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
2
|
import { property, state } from 'lit/decorators.js';
|
|
3
3
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
4
|
+
|
|
5
|
+
import { sanitizeSvg } from '@/__utils/sanitize-svg.js';
|
|
6
|
+
|
|
4
7
|
import { fetchIcon, fetchSVG } from './datasource.js';
|
|
5
|
-
import { sanitizeSvg } from '../utils.js';
|
|
6
8
|
import styles from './icon.scss';
|
|
7
9
|
|
|
8
10
|
export type IconProvider = 'material-symbols' | 'material-icons';
|
package/src/image/image.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LitElement, html } from 'lit';
|
|
2
2
|
import { property, state } from 'lit/decorators.js';
|
|
3
|
-
|
|
4
|
-
import {
|
|
3
|
+
|
|
4
|
+
import { isDarkMode } from '@/__utils/is-dark-mode.js';
|
|
5
|
+
import { observeThemeChange } from '@/__utils/observe-theme-change.js';
|
|
5
6
|
|
|
6
7
|
import styles from './image.scss';
|
|
7
8
|
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { Divider } from './divider/index.js';
|
|
|
5
5
|
export { Clock } from './clock/index.js';
|
|
6
6
|
export { Elevation } from './elevation/index.js';
|
|
7
7
|
export { Button, ButtonGroup, IconButton } from './button/index.js';
|
|
8
|
+
export { Fab } from './fab/index.js';
|
|
8
9
|
export { SegmentedButton, SegmentedButtonGroup } from './segmented-button/index.js';
|
|
9
10
|
|
|
10
11
|
export { FocusRing } from './focus-ring/index.js';
|
|
@@ -45,6 +46,8 @@ export { Table } from './table/index.js';
|
|
|
45
46
|
export { Pagination } from './pagination/index.js';
|
|
46
47
|
export { TreeView, TreeNode } from './tree-view/index.js';
|
|
47
48
|
export { Card } from './card/index.js';
|
|
49
|
+
export { Banner } from './banner/index.js';
|
|
50
|
+
export { Notification } from './notification/index.js';
|
|
48
51
|
export { Snackbar } from './snackbar/index.js';
|
|
49
52
|
export { Radio } from './radio/index.js';
|
|
50
53
|
export { BottomSheet } from './bottom-sheet/index.js';
|
|
@@ -52,4 +55,6 @@ export { SideSheet } from './side-sheet/index.js';
|
|
|
52
55
|
export { Select } from './select/index.js';
|
|
53
56
|
export type { SelectOption } from './select/index.js';
|
|
54
57
|
export { SelectOptionElement } from './select/index.js';
|
|
58
|
+
export { Search } from './search/index.js';
|
|
59
|
+
export { Toolbar } from './toolbar/index.js';
|
|
55
60
|
|
package/src/input/input.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { html, nothing } 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 './BaseInput.js';
|
|
5
8
|
import styles from './input.scss';
|
|
6
|
-
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* @label Input
|
|
9
12
|
* @tag wc-input
|
package/src/link/link.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
|
-
import { property, state } from 'lit/decorators.js';
|
|
3
2
|
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
+
import BaseHyperlink from '../__base_element/BaseHyperlink.js';
|
|
4
4
|
import styles from './link.scss';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -16,22 +16,9 @@ import styles from './link.scss';
|
|
|
16
16
|
* <wc-link href="#">Link</wc-link>
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export class Link extends LitElement {
|
|
19
|
+
export class Link extends BaseHyperlink(LitElement) {
|
|
20
20
|
static styles = [styles];
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Hyperlink to navigate to on click.
|
|
24
|
-
*/
|
|
25
|
-
@property({ reflect: true }) href?: string;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Sets or retrieves the window or frame at which to target content.
|
|
29
|
-
*/
|
|
30
|
-
@property() target: '_self' | '_parent' | '_blank' | '_top' | string =
|
|
31
|
-
'_self';
|
|
32
|
-
|
|
33
|
-
@state() tabIndexValue?: number;
|
|
34
|
-
|
|
35
22
|
render() {
|
|
36
23
|
return html`<a
|
|
37
24
|
class=${classMap({
|
package/src/menu/menu/menu.scss
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
display: flex;
|
|
7
7
|
position: fixed;
|
|
8
8
|
z-index: var(--menu-z-index, 1000);
|
|
9
|
+
width: var(--menu-width, max-content);
|
|
10
|
+
max-width: 100vw;
|
|
9
11
|
min-width: 112px;
|
|
10
12
|
padding-block: var(--spacing-050);
|
|
11
13
|
transform-origin: top center;
|
|
@@ -37,6 +39,11 @@
|
|
|
37
39
|
transition-timing-function: var(--_menu-enter-easing), var(--_menu-enter-easing), linear;
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
&.preview {
|
|
43
|
+
position: relative;
|
|
44
|
+
pointer-events: auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
.menu-content {
|
|
41
48
|
display: flex;
|
|
42
49
|
flex-direction: column;
|
package/src/menu/menu/menu.ts
CHANGED
|
@@ -22,9 +22,9 @@ type CloseReason =
|
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```html
|
|
25
|
-
* <wc-menu>
|
|
25
|
+
* <wc-menu preview>
|
|
26
26
|
* <wc-menu-item>Item 1</wc-menu-item>
|
|
27
|
-
* <wc-menu-item>Item 2</wc-menu-item>
|
|
27
|
+
* <wc-menu-item selected>Item 2</wc-menu-item>
|
|
28
28
|
* </wc-menu>
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
@@ -40,6 +40,8 @@ export class Menu extends LitElement {
|
|
|
40
40
|
|
|
41
41
|
@property({ type: String }) anchor = '';
|
|
42
42
|
|
|
43
|
+
@property({ type: Boolean, reflect: true }) preview = false;
|
|
44
|
+
|
|
43
45
|
@property({ type: Boolean, attribute: 'stay-open-on-outside-click' })
|
|
44
46
|
stayOpenOnOutsideClick = false;
|
|
45
47
|
|
|
@@ -448,8 +450,9 @@ export class Menu extends LitElement {
|
|
|
448
450
|
return html`<div
|
|
449
451
|
class=${classMap({
|
|
450
452
|
'menu': true,
|
|
451
|
-
open: this.open,
|
|
452
|
-
closed: !this.open,
|
|
453
|
+
open: !this.preview && this.open,
|
|
454
|
+
closed: !this.preview && !this.open,
|
|
455
|
+
preview: this.preview,
|
|
453
456
|
[`variant-${this.variant}`]: true,
|
|
454
457
|
})}
|
|
455
458
|
aria-hidden=${String(!this.open)}
|