@redvars/peacock 3.3.3 → 3.4.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/IndividualComponent-DUINtMGK.js +67 -0
- package/dist/IndividualComponent-DUINtMGK.js.map +1 -0
- package/dist/assets/images/empty-state/no-document.svg +11 -12
- package/dist/assets/images/empty-state/page.svg +15 -9
- package/dist/bottom-sheet.js +238 -0
- package/dist/bottom-sheet.js.map +1 -0
- package/dist/{button-ClzS8JLq.js → button-COYCtuA8.js} +306 -149
- package/dist/button-COYCtuA8.js.map +1 -0
- package/dist/button-group-DsXquZQn.js +440 -0
- package/dist/button-group-DsXquZQn.js.map +1 -0
- package/dist/button-group.js +6 -4
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +5 -3
- package/dist/button.js.map +1 -1
- package/dist/card-content.js +29 -0
- package/dist/card-content.js.map +1 -0
- package/dist/card.js +418 -44
- package/dist/card.js.map +1 -1
- package/dist/{chart-bar-DbnXQgvS.js → chart-bar-cn6rrna-.js} +2 -2
- package/dist/{chart-bar-DbnXQgvS.js.map → chart-bar-cn6rrna-.js.map} +1 -1
- package/dist/chart-bar.js +4 -3
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +2 -1
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +2 -1
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js +4 -3
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/{class-map-59YGWLnx.js → class-map-3TAnCMAX.js} +3 -9
- package/dist/class-map-3TAnCMAX.js.map +1 -0
- package/dist/clock.js +2 -1
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +6 -4
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +5 -3
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +2458 -2753
- package/dist/custom-elements.json +2742 -757
- package/dist/dispatch-event-utils-B4odODQf.js.map +1 -1
- package/dist/index.js +14 -10
- package/dist/index.js.map +1 -1
- package/dist/number-counter.js +3 -2
- package/dist/number-counter.js.map +1 -1
- package/dist/{observe-theme-change-pALI5fmV.js → observe-theme-change-DKAIv5BB.js} +3 -2
- package/dist/observe-theme-change-DKAIv5BB.js.map +1 -0
- package/dist/peacock-loader.js +34 -8
- package/dist/peacock-loader.js.map +1 -1
- package/dist/property-1psGvXOq.js +10 -0
- package/dist/property-1psGvXOq.js.map +1 -0
- package/dist/{radio-b70_Ie9n.js → select-C3XAzenC.js} +1706 -192
- package/dist/select-C3XAzenC.js.map +1 -0
- package/dist/side-sheet.js +186 -0
- package/dist/side-sheet.js.map +1 -0
- package/dist/src/bottom-sheet/bottom-sheet.d.ts +42 -0
- package/dist/src/bottom-sheet/index.d.ts +1 -0
- package/dist/src/button/BaseButton.d.ts +4 -3
- package/dist/src/button/button/button.d.ts +4 -0
- package/dist/src/button/button-group/button-group.d.ts +32 -3
- package/dist/src/button/icon-button/icon-button.d.ts +4 -0
- package/dist/src/card/card-content.d.ts +15 -0
- package/dist/src/card/card.d.ts +37 -3
- package/dist/src/card/index.d.ts +1 -0
- package/dist/src/container/container.d.ts +1 -1
- package/dist/src/empty-state/empty-state.d.ts +1 -1
- package/dist/src/focus-ring/focus-ring.d.ts +4 -1
- package/dist/src/index.d.ts +6 -1
- package/dist/src/menu/menu/menu.d.ts +1 -0
- package/dist/src/menu/menu-item/menu-item.d.ts +0 -1
- package/dist/src/ripple/ripple.d.ts +19 -3
- package/dist/src/segmented-button/index.d.ts +2 -0
- package/dist/src/segmented-button/segmented-button-group.d.ts +46 -0
- package/dist/src/segmented-button/segmented-button.d.ts +65 -0
- package/dist/src/select/index.d.ts +3 -0
- package/dist/src/select/option.d.ts +55 -0
- package/dist/src/select/select.d.ts +116 -0
- package/dist/src/side-sheet/index.d.ts +1 -0
- package/dist/src/side-sheet/side-sheet.d.ts +41 -0
- package/dist/src/tabs/tab-group.d.ts +0 -1
- package/dist/src/tabs/tab.d.ts +8 -2
- package/dist/src/tabs/tabs.d.ts +13 -1
- package/dist/state-DwbEjqVk.js +10 -0
- package/dist/state-DwbEjqVk.js.map +1 -0
- package/dist/{style-map-DcB52w-l.js → style-map-CRFEoCEg.js} +2 -2
- package/dist/{style-map-DcB52w-l.js.map → style-map-CRFEoCEg.js.map} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-C2r3PyzF.js → unsafe-html-D3GHRaGQ.js} +2 -2
- package/dist/{unsafe-html-C2r3PyzF.js.map → unsafe-html-D3GHRaGQ.js.map} +1 -1
- package/package.json +1 -1
- package/readme.md +2 -2
- package/src/bottom-sheet/bottom-sheet.scss +88 -0
- package/src/bottom-sheet/bottom-sheet.ts +135 -0
- package/src/bottom-sheet/index.ts +1 -0
- package/src/button/BaseButton.ts +16 -7
- package/src/button/button/button-colors.scss +76 -5
- package/src/button/button/button-sizes.scss +39 -19
- package/src/button/button/button.scss +117 -116
- package/src/button/button/button.ts +23 -1
- package/src/button/button-group/button-group.scss +25 -22
- package/src/button/button-group/button-group.ts +121 -4
- package/src/button/icon-button/icon-button-sizes.scss +35 -15
- package/src/button/icon-button/icon-button.ts +21 -1
- package/src/card/card-colors.scss +10 -0
- package/src/card/card-content.ts +26 -0
- package/src/card/card.scss +221 -41
- package/src/card/card.ts +240 -7
- package/src/card/index.ts +1 -0
- package/src/code-editor/code-editor.ts +1 -1
- package/src/container/container.ts +1 -1
- package/src/empty-state/empty-state.scss +8 -0
- package/src/empty-state/empty-state.ts +2 -2
- package/src/focus-ring/focus-ring.ts +37 -19
- package/src/index.ts +7 -1
- package/src/menu/menu/menu.scss +24 -3
- package/src/menu/menu/menu.ts +23 -2
- package/src/menu/menu-item/menu-item.scss +1 -0
- package/src/menu/menu-item/menu-item.ts +1 -9
- package/src/peacock-loader.ts +28 -0
- package/src/ripple/ripple.ts +19 -3
- package/src/segmented-button/index.ts +2 -0
- package/src/segmented-button/segmented-button-group.scss +21 -0
- package/src/segmented-button/segmented-button-group.ts +110 -0
- package/src/segmented-button/segmented-button.scss +115 -0
- package/src/segmented-button/segmented-button.ts +175 -0
- package/src/select/index.ts +3 -0
- package/src/select/option.ts +109 -0
- package/src/select/select.scss +120 -0
- package/src/select/select.ts +486 -0
- package/src/side-sheet/index.ts +1 -0
- package/src/side-sheet/side-sheet.scss +79 -0
- package/src/side-sheet/side-sheet.ts +100 -0
- package/src/slider/slider.scss +0 -1
- package/src/tabs/demo/index.html +90 -0
- package/src/tabs/tab-group.ts +0 -3
- package/src/tabs/tab.scss +237 -25
- package/src/tabs/tab.ts +85 -11
- package/src/tabs/tabs.scss +37 -3
- package/src/tabs/tabs.ts +118 -2
- package/src/utils/dispatch-event-utils.ts +1 -0
- package/dist/IndividualComponent-Dt5xirYG.js +0 -73
- package/dist/IndividualComponent-Dt5xirYG.js.map +0 -1
- package/dist/button-ClzS8JLq.js.map +0 -1
- package/dist/button-group-BMS5WvaF.js +0 -292
- package/dist/button-group-BMS5WvaF.js.map +0 -1
- package/dist/chart-donut.js +0 -309
- package/dist/chart-donut.js.map +0 -1
- package/dist/class-map-59YGWLnx.js.map +0 -1
- package/dist/observe-theme-change-pALI5fmV.js.map +0 -1
- package/dist/radio-b70_Ie9n.js.map +0 -1
- package/dist/src/chart-donut/chart-donut.d.ts +0 -53
- package/dist/src/chart-donut/index.d.ts +0 -1
- package/dist/test/card.test.d.ts +0 -1
- package/src/chart-donut/chart-donut.scss +0 -37
- package/src/chart-donut/chart-donut.ts +0 -287
- package/src/chart-donut/demo/index.html +0 -51
- package/src/chart-donut/index.ts +0 -1
|
@@ -5,6 +5,7 @@ import IndividualComponent from 'src/IndividualComponent.js';
|
|
|
5
5
|
import styles from './button-group.scss';
|
|
6
6
|
import { Button } from '../button/button.js';
|
|
7
7
|
import { IconButton } from '../icon-button/icon-button.js';
|
|
8
|
+
import { BaseButton } from '../BaseButton.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @label Button Group
|
|
@@ -15,9 +16,9 @@ import { IconButton } from '../icon-button/icon-button.js';
|
|
|
15
16
|
|
|
16
17
|
* @example
|
|
17
18
|
* ```html
|
|
18
|
-
* <wc-button-group>
|
|
19
|
-
* <wc-icon-button name="home"></wc-icon-button>
|
|
20
|
-
* <wc-icon-button name="alarm"></wc-icon-button>
|
|
19
|
+
* <wc-button-group variant="connected">
|
|
20
|
+
* <wc-icon-button name="home" toggle selected></wc-icon-button>
|
|
21
|
+
* <wc-icon-button name="alarm" toggle></wc-icon-button>
|
|
21
22
|
* </wc-button-group>
|
|
22
23
|
* ```
|
|
23
24
|
*
|
|
@@ -40,14 +41,130 @@ export class ButtonGroup extends LitElement {
|
|
|
40
41
|
*/
|
|
41
42
|
@property() size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
|
|
42
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Layout variant of the button group.
|
|
46
|
+
* `"standard"` shows buttons with a small gap between them.
|
|
47
|
+
* `"connected"` places buttons with a 2px gap; in horizontal orientation outer buttons have fully
|
|
48
|
+
* rounded outer corners and middle buttons keep standard rounded corners. In vertical orientation
|
|
49
|
+
* all buttons keep their default corner shape.
|
|
50
|
+
* Defaults to `"standard"`.
|
|
51
|
+
*/
|
|
52
|
+
@property({ reflect: true }) variant: 'standard' | 'connected' = 'standard';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Orientation of the button group.
|
|
56
|
+
* `"horizontal"` lays buttons out in a row.
|
|
57
|
+
* `"vertical"` stacks buttons in a column.
|
|
58
|
+
* Defaults to `"horizontal"`.
|
|
59
|
+
*/
|
|
60
|
+
@property({ reflect: true }) orientation: 'horizontal' | 'vertical' = 'horizontal';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Color applied to all buttons in the group.
|
|
64
|
+
* Possible values are `"primary"`, `"success"`, `"danger"`, `"warning"`, `"light"`, `"dark"`.
|
|
65
|
+
*/
|
|
66
|
+
@property({ reflect: true }) color?: 'primary' | 'success' | 'danger' | 'warning' | 'light' | 'dark';
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Visual style applied to all buttons in the group.
|
|
70
|
+
* Possible values are `"filled"`, `"tonal"`, `"outlined"`.
|
|
71
|
+
*/
|
|
72
|
+
@property({ attribute: 'button-variant', reflect: true }) buttonVariant?: 'filled' | 'tonal' | 'outlined';
|
|
73
|
+
|
|
74
|
+
override updated() {
|
|
75
|
+
this._syncChildren();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private _getSlottedElements(): HTMLElement[] {
|
|
79
|
+
const slot = this.shadowRoot?.querySelector('slot');
|
|
80
|
+
return (slot?.assignedElements({ flatten: true }) ?? []) as HTMLElement[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private _syncChildren() {
|
|
84
|
+
const children = this._getSlottedElements();
|
|
85
|
+
const isVertical = this.orientation === 'vertical';
|
|
86
|
+
|
|
87
|
+
children.forEach((child, index) => {
|
|
88
|
+
const isFirst = index === 0;
|
|
89
|
+
const isLast = index === children.length - 1;
|
|
90
|
+
const isOnly = children.length === 1;
|
|
91
|
+
|
|
92
|
+
if (this.color && 'color' in child) {
|
|
93
|
+
(child as BaseButton).color = this.color;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (this.buttonVariant && 'variant' in child) {
|
|
97
|
+
(child as BaseButton).variant = this.buttonVariant;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (this.variant === 'connected') {
|
|
101
|
+
child.style.setProperty('--button-container-shape-variant', 'round');
|
|
102
|
+
|
|
103
|
+
if (isOnly) {
|
|
104
|
+
child.style.setProperty('--button-container-shape', 'var(--shape-corner-full)');
|
|
105
|
+
child.style.removeProperty('--button-container-shape-start-start');
|
|
106
|
+
child.style.removeProperty('--button-container-shape-end-start');
|
|
107
|
+
child.style.removeProperty('--button-container-shape-start-end');
|
|
108
|
+
child.style.removeProperty('--button-container-shape-end-end');
|
|
109
|
+
} else if (isFirst) {
|
|
110
|
+
child.style.removeProperty('--button-container-shape');
|
|
111
|
+
if (isVertical) {
|
|
112
|
+
// Top button in vertical group: leave default corner shape
|
|
113
|
+
child.style.removeProperty('--button-container-shape-start-start');
|
|
114
|
+
child.style.removeProperty('--button-container-shape-start-end');
|
|
115
|
+
child.style.removeProperty('--button-container-shape-end-start');
|
|
116
|
+
child.style.removeProperty('--button-container-shape-end-end');
|
|
117
|
+
} else {
|
|
118
|
+
// Left button in horizontal group: round left corners, standard right corners
|
|
119
|
+
child.style.setProperty('--button-container-shape-start-start', 'calc(var(--button-height) / 2)');
|
|
120
|
+
child.style.setProperty('--button-container-shape-end-start', 'calc(var(--button-height) / 2)');
|
|
121
|
+
child.style.setProperty('--button-container-shape-start-end', 'var(--shape-corner-medium)');
|
|
122
|
+
child.style.setProperty('--button-container-shape-end-end', 'var(--shape-corner-medium)');
|
|
123
|
+
}
|
|
124
|
+
} else if (isLast) {
|
|
125
|
+
child.style.removeProperty('--button-container-shape');
|
|
126
|
+
if (isVertical) {
|
|
127
|
+
// Bottom button in vertical group: leave default corner shape
|
|
128
|
+
child.style.removeProperty('--button-container-shape-start-start');
|
|
129
|
+
child.style.removeProperty('--button-container-shape-start-end');
|
|
130
|
+
child.style.removeProperty('--button-container-shape-end-start');
|
|
131
|
+
child.style.removeProperty('--button-container-shape-end-end');
|
|
132
|
+
} else {
|
|
133
|
+
// Right button in horizontal group: standard left corners, round right corners
|
|
134
|
+
child.style.setProperty('--button-container-shape-start-start', 'var(--shape-corner-medium)');
|
|
135
|
+
child.style.setProperty('--button-container-shape-end-start', 'var(--shape-corner-medium)');
|
|
136
|
+
child.style.setProperty('--button-container-shape-start-end', 'calc(var(--button-height) / 2)');
|
|
137
|
+
child.style.setProperty('--button-container-shape-end-end', 'calc(var(--button-height) / 2)');
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
// Middle buttons: standard rounded corners on all sides
|
|
141
|
+
child.style.setProperty('--button-container-shape', 'var(--shape-corner-medium)');
|
|
142
|
+
child.style.removeProperty('--button-container-shape-start-start');
|
|
143
|
+
child.style.removeProperty('--button-container-shape-end-start');
|
|
144
|
+
child.style.removeProperty('--button-container-shape-start-end');
|
|
145
|
+
child.style.removeProperty('--button-container-shape-end-end');
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
child.style.removeProperty('--button-container-shape');
|
|
149
|
+
child.style.removeProperty('--button-container-shape-start-start');
|
|
150
|
+
child.style.removeProperty('--button-container-shape-end-start');
|
|
151
|
+
child.style.removeProperty('--button-container-shape-start-end');
|
|
152
|
+
child.style.removeProperty('--button-container-shape-end-end');
|
|
153
|
+
child.style.removeProperty('--button-container-shape-variant');
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
43
158
|
render() {
|
|
44
159
|
const cssClasses = {
|
|
45
160
|
'button-group': true,
|
|
46
161
|
[`size-${this.size}`]: true,
|
|
162
|
+
[`variant-${this.variant}`]: true,
|
|
163
|
+
[`orientation-${this.orientation}`]: true,
|
|
47
164
|
};
|
|
48
165
|
return html`
|
|
49
166
|
<div class=${classMap(cssClasses)}>
|
|
50
|
-
<slot></slot>
|
|
167
|
+
<slot @slotchange=${() => this._syncChildren()}></slot>
|
|
51
168
|
</div>
|
|
52
169
|
`;
|
|
53
170
|
}
|
|
@@ -2,36 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
.button {
|
|
4
4
|
--_container-padding: 0.75rem;
|
|
5
|
-
width: var(--
|
|
5
|
+
width: var(--button-height);
|
|
6
6
|
--_container-padding: 0;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
|
|
9
|
+
:host([size='xs']),
|
|
10
|
+
:host([size='extra-small']) {
|
|
11
|
+
--button-height: 2rem;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host([size='xs']) .button,
|
|
15
|
+
:host([size='extra-small']) .button {
|
|
11
16
|
--_button-icon-size: 1rem;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
--
|
|
20
|
+
:host([size='sm']),
|
|
21
|
+
:host([size='small']) {
|
|
22
|
+
--button-height: 2.5rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([size='sm']) .button,
|
|
26
|
+
:host([size='small']) .button {
|
|
18
27
|
--_button-icon-size: 1.25rem;
|
|
19
28
|
--_button-icon-label-spacing: 0.5rem;
|
|
20
29
|
}
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
--
|
|
31
|
+
:host([size='md']),
|
|
32
|
+
:host([size='medium']) {
|
|
33
|
+
--button-height: 3.5rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:host([size='md']) .button,
|
|
37
|
+
:host([size='medium']) .button {
|
|
25
38
|
--_button-icon-size: 1.5rem;
|
|
26
39
|
}
|
|
27
40
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
--
|
|
41
|
+
:host([size='lg']),
|
|
42
|
+
:host([size='large']) {
|
|
43
|
+
--button-height: 6rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([size='lg']) .button,
|
|
47
|
+
:host([size='large']) .button {
|
|
31
48
|
--_button-icon-size: 2rem;
|
|
32
49
|
}
|
|
33
50
|
|
|
34
|
-
|
|
35
|
-
--
|
|
51
|
+
:host([size='xl']) {
|
|
52
|
+
--button-height: 8.5rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host([size='xl']) .button {
|
|
36
56
|
--_button-icon-size: 2.5rem;
|
|
37
57
|
}
|
|
@@ -65,6 +65,26 @@ export class IconButton extends BaseButton {
|
|
|
65
65
|
|
|
66
66
|
@property({ type: String }) provider: IconProvider = 'material-symbols';
|
|
67
67
|
|
|
68
|
+
override focus() {
|
|
69
|
+
this.buttonElement?.focus();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
override blur() {
|
|
73
|
+
this.buttonElement?.blur();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
override connectedCallback() {
|
|
77
|
+
super.connectedCallback();
|
|
78
|
+
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
79
|
+
window.addEventListener('mouseup', this.__handlePress);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
override disconnectedCallback() {
|
|
83
|
+
window.removeEventListener('mouseup', this.__handlePress);
|
|
84
|
+
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
85
|
+
super.disconnectedCallback();
|
|
86
|
+
}
|
|
87
|
+
|
|
68
88
|
override firstUpdated() {
|
|
69
89
|
this.__dispatchClickWithThrottle = throttle(
|
|
70
90
|
this.__dispatchClick,
|
|
@@ -133,7 +153,7 @@ export class IconButton extends BaseButton {
|
|
|
133
153
|
|
|
134
154
|
renderButtonContent() {
|
|
135
155
|
return html`
|
|
136
|
-
<wc-focus-ring class="focus-ring" .control=${this}
|
|
156
|
+
<wc-focus-ring class="focus-ring" .control=${this} .forElement=${this.buttonElement}></wc-focus-ring>
|
|
137
157
|
<wc-elevation class="elevation"></wc-elevation>
|
|
138
158
|
<div class="neo-background"></div>
|
|
139
159
|
<div class="background"></div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--filled-card-container-color: var(--color-surface-container-highest);
|
|
3
|
+
--filled-card-label-text-color: var(--color-on-surface);
|
|
4
|
+
|
|
5
|
+
--elevated-card-container-color: var(--color-surface-container-low);
|
|
6
|
+
--elevated-card-label-text-color: var(--color-on-surface);
|
|
7
|
+
|
|
8
|
+
--outlined-card-outline-color: var(--color-outline-variant);
|
|
9
|
+
--outlined-card-label-text-color: var(--color-on-surface);
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import IndividualComponent from '../IndividualComponent.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @label Card Content
|
|
6
|
+
* @tag wc-card-content
|
|
7
|
+
* @rawTag card-content
|
|
8
|
+
* @parentRawTag
|
|
9
|
+
*
|
|
10
|
+
* @cssprop --card-content-padding - Inner padding for the card container. Defaults to 1rem.
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
@IndividualComponent
|
|
15
|
+
export class CardContent extends LitElement {
|
|
16
|
+
static styles = css`
|
|
17
|
+
:host {
|
|
18
|
+
padding-inline: 1rem;
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return html`<slot></slot>`;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/card/card.scss
CHANGED
|
@@ -1,61 +1,241 @@
|
|
|
1
|
+
@use '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
@include mixin.base-styles;
|
|
4
|
+
|
|
1
5
|
:host {
|
|
2
6
|
display: block;
|
|
3
|
-
--card-background: var(--color-surface, #ffffff);
|
|
4
|
-
--card-border-color: transparent;
|
|
5
|
-
--card-shadow: none;
|
|
6
|
-
--card-shape: var(--global-shape-corner-large, 1rem);
|
|
7
|
-
--card-padding: 1rem;
|
|
8
7
|
--card-gap: 0;
|
|
8
|
+
--card-padding: 0;
|
|
9
|
+
--card-container-shape: var(--shape-corner-large);
|
|
10
|
+
--card-container-shape-start-start: unset;
|
|
11
|
+
--card-container-shape-start-end: unset;
|
|
12
|
+
--card-container-shape-end-start: unset;
|
|
13
|
+
--card-container-shape-end-end: unset;
|
|
9
14
|
}
|
|
10
15
|
|
|
16
|
+
/*
|
|
17
|
+
* Reset native button/link styles
|
|
18
|
+
*/
|
|
11
19
|
.card {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
color: var(--color-on-surface, inherit);
|
|
20
|
-
padding: var(--card-padding);
|
|
21
|
-
transition: box-shadow 150ms ease, transform 150ms ease;
|
|
20
|
+
background: transparent;
|
|
21
|
+
border: none;
|
|
22
|
+
appearance: none;
|
|
23
|
+
margin: 0;
|
|
24
|
+
outline: none;
|
|
25
|
+
text-decoration: none;
|
|
26
|
+
text-align: unset;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
.card {
|
|
30
|
+
position: relative;
|
|
31
|
+
display: flex;
|
|
32
|
+
height: 100%;
|
|
33
|
+
width: 100%;
|
|
28
34
|
|
|
29
|
-
:
|
|
30
|
-
--
|
|
31
|
-
--
|
|
32
|
-
|
|
35
|
+
--_container-shape-start-start: var(--card-container-shape-start-start, var(--card-container-shape));
|
|
36
|
+
--_container-shape-start-end: var(--card-container-shape-start-end, var(--card-container-shape));
|
|
37
|
+
--_container-shape-end-start: var(--card-container-shape-end-start, var(--card-container-shape));
|
|
38
|
+
--_container-shape-end-end: var(--card-container-shape-end-end, var(--card-container-shape));
|
|
33
39
|
|
|
34
|
-
:host([variant='outlined']) {
|
|
35
|
-
--card-border-color: var(--color-outline, rgba(0, 0, 0, 0.12));
|
|
36
|
-
--card-shadow: none;
|
|
37
|
-
}
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
.card-content {
|
|
42
|
+
z-index: 0;
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 100%;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
padding: var(--card-padding);
|
|
47
|
+
|
|
48
|
+
border: 1px solid transparent; /* Fixes overflow issues with border */
|
|
49
|
+
border-start-start-radius: var(--_container-shape-start-start);
|
|
50
|
+
border-start-end-radius: var(--_container-shape-start-end);
|
|
51
|
+
border-end-start-radius: var(--_container-shape-end-start);
|
|
52
|
+
border-end-end-radius: var(--_container-shape-end-end);
|
|
53
|
+
|
|
54
|
+
color: var(--_label-text-color);
|
|
55
|
+
opacity: var(--_label-text-opacity, 1);
|
|
56
|
+
--icon-color: var(--_label-text-color);
|
|
57
|
+
|
|
58
|
+
.slot-container {
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
gap: var(--card-gap);
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
Background layers
|
|
69
|
+
*/
|
|
70
|
+
.focus-ring {
|
|
71
|
+
z-index: 2;
|
|
72
|
+
display: none;
|
|
73
|
+
--focus-ring-container-shape-start-start: var(--_container-shape-start-start);
|
|
74
|
+
--focus-ring-container-shape-start-end: var(--_container-shape-start-end);
|
|
75
|
+
--focus-ring-container-shape-end-start: var(--_container-shape-end-start);
|
|
76
|
+
--focus-ring-container-shape-end-end: var(--_container-shape-end-end);
|
|
77
|
+
--focus-ring-container-shape-variant: var(--_container-corner-shape-variant);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ripple {
|
|
81
|
+
display: none;
|
|
82
|
+
border-start-start-radius: var(--_container-shape-start-start);
|
|
83
|
+
border-start-end-radius: var(--_container-shape-start-end);
|
|
84
|
+
border-end-start-radius: var(--_container-shape-end-start);
|
|
85
|
+
border-end-end-radius: var(--_container-shape-end-end);
|
|
86
|
+
corner-shape: var(--_container-corner-shape-variant);
|
|
87
|
+
--ripple-state-opacity: var(--_container-state-opacity, 0);
|
|
88
|
+
--ripple-pressed-color: var(--_container-state-color);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.background {
|
|
92
|
+
z-index: 0;
|
|
93
|
+
display: block;
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 0;
|
|
96
|
+
left: 0;
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: 100%;
|
|
99
|
+
background-color: var(--_container-color);
|
|
100
|
+
opacity: var(--_container-opacity, 1);
|
|
101
|
+
|
|
102
|
+
border-start-start-radius: var(--_container-shape-start-start);
|
|
103
|
+
border-start-end-radius: var(--_container-shape-start-end);
|
|
104
|
+
border-end-start-radius: var(--_container-shape-end-start);
|
|
105
|
+
border-end-end-radius: var(--_container-shape-end-end);
|
|
106
|
+
corner-shape: var(--_container-corner-shape-variant);
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.elevation {
|
|
111
|
+
--elevation-level: var(--_container-elevation-level);
|
|
112
|
+
transition-duration: 280ms;
|
|
113
|
+
--elevation-container-shape-start-start: var(--_container-shape-start-start);
|
|
114
|
+
--elevation-container-shape-start-end: var(--_container-shape-start-end);
|
|
115
|
+
--elevation-container-shape-end-start: var(--_container-shape-end-start);
|
|
116
|
+
--elevation-container-shape-end-end: var(--_container-shape-end-end);
|
|
117
|
+
--elevation-container-shape-variant: var(--_container-corner-shape-variant);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.outline {
|
|
121
|
+
z-index: 0;
|
|
122
|
+
display: none;
|
|
123
|
+
position: absolute;
|
|
124
|
+
left: 0;
|
|
125
|
+
top: 0;
|
|
126
|
+
width: 100%;
|
|
127
|
+
height: 100%;
|
|
128
|
+
pointer-events: none;
|
|
129
|
+
border: var(--_outline-width) solid var(--_outline-color);
|
|
130
|
+
opacity: var(--_outline-opacity, 1);
|
|
131
|
+
border-start-start-radius: var(--_container-shape-start-start);
|
|
132
|
+
border-start-end-radius: var(--_container-shape-start-end);
|
|
133
|
+
border-end-start-radius: var(--_container-shape-end-start);
|
|
134
|
+
border-end-end-radius: var(--_container-shape-end-end);
|
|
135
|
+
corner-shape: var(--_container-corner-shape-variant);
|
|
136
|
+
}
|
|
42
137
|
|
|
43
|
-
:host([elevation='1']) {
|
|
44
|
-
--card-shadow: var(--shadow-sm, 0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 2px rgba(16, 24, 40, 0.06));
|
|
45
|
-
}
|
|
46
138
|
|
|
47
|
-
:host([elevation='2']) {
|
|
48
|
-
--card-shadow: var(--shadow-md, 0px 4px 8px -2px rgba(16, 24, 40, 0.1), 0px 2px 4px -2px rgba(16, 24, 40, 0.06));
|
|
49
139
|
}
|
|
50
140
|
|
|
51
|
-
|
|
52
|
-
|
|
141
|
+
.card.actionable {
|
|
142
|
+
|
|
143
|
+
.focus-ring,
|
|
144
|
+
.ripple {
|
|
145
|
+
display: block;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.card-content {
|
|
149
|
+
pointer-events: none;
|
|
150
|
+
}
|
|
53
151
|
}
|
|
54
152
|
|
|
55
|
-
|
|
56
|
-
--
|
|
153
|
+
.card.variant-elevated {
|
|
154
|
+
--_container-color: var(--elevated-card-container-color);
|
|
155
|
+
--_label-text-color: var(--elevated-card-label-text-color);
|
|
156
|
+
--_container-elevation-level: 1;
|
|
157
|
+
|
|
158
|
+
--_container-state-color: var(--_label-text-color);
|
|
159
|
+
|
|
160
|
+
&:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
|
|
161
|
+
--_container-elevation-level: 2;
|
|
162
|
+
--_container-state-opacity: 0.08;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
|
|
166
|
+
--_container-elevation-level: 1;
|
|
167
|
+
--_container-state-opacity: 0.12;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&.disabled {
|
|
171
|
+
--_container-color: var(--color-on-surface);
|
|
172
|
+
--_container-opacity: 0.1;
|
|
173
|
+
--_label-text-color: var(--color-on-surface);
|
|
174
|
+
--_label-text-opacity: 0.38;
|
|
175
|
+
|
|
176
|
+
.ripple {
|
|
177
|
+
display: none;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
57
180
|
}
|
|
58
181
|
|
|
59
|
-
|
|
60
|
-
|
|
182
|
+
|
|
183
|
+
.card.variant-filled {
|
|
184
|
+
--_container-color: var(--filled-card-container-color);
|
|
185
|
+
--_label-text-color: var(--filled-card-label-text-color);
|
|
186
|
+
--_container-state-color: var(--_label-text-color);
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
&:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
|
|
190
|
+
--_container-elevation-level: 1;
|
|
191
|
+
--_container-state-opacity: 0.08;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
|
|
195
|
+
--_container-elevation-level: 0;
|
|
196
|
+
--_container-state-opacity: 0.1;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&.disabled {
|
|
200
|
+
--_container-color: var(--color-on-surface);
|
|
201
|
+
--_container-opacity: 0.1;
|
|
202
|
+
--_label-text-color: var(--color-on-surface);
|
|
203
|
+
--_label-text-opacity: 0.38;
|
|
204
|
+
|
|
205
|
+
.ripple {
|
|
206
|
+
display: none;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
61
209
|
}
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
.card.variant-outlined {
|
|
213
|
+
--_outline-width: var(--outlined-card-outline-width, 0.0675rem);
|
|
214
|
+
--_outline-color: var(--outlined-card-outline-color);
|
|
215
|
+
--_label-text-color: var(--outlined-card-label-text-color);
|
|
216
|
+
|
|
217
|
+
--_container-state-color: var(--_label-text-color);
|
|
218
|
+
|
|
219
|
+
.outline {
|
|
220
|
+
display: block;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
|
|
224
|
+
--_container-state-opacity: 0.08;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
&.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
|
|
228
|
+
--_container-state-opacity: 0.12;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&.disabled {
|
|
232
|
+
--_outline-color: var(--color-on-surface);
|
|
233
|
+
--_label-text-color: var(--color-on-surface);
|
|
234
|
+
--_label-text-opacity: 0.38;
|
|
235
|
+
--_outline-opacity: 0.12;
|
|
236
|
+
|
|
237
|
+
.ripple {
|
|
238
|
+
display: none;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|