@redvars/peacock 3.6.3 → 3.8.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/ButtonConstants-D06bY4uy.js +114 -0
- package/dist/ButtonConstants-D06bY4uy.js.map +1 -0
- package/dist/{BaseHyperlinkMixin-BNuwbiEf.js → NativeHyperlinkMixin-DrYXyfMQ.js} +8 -10
- package/dist/NativeHyperlinkMixin-DrYXyfMQ.js.map +1 -0
- package/dist/assets/components.css +1 -1
- package/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/{button-colors-Cg6oxiz-.js → button-colors-DSuBHd-i.js} +200 -186
- package/dist/button-colors-DSuBHd-i.js.map +1 -0
- package/dist/button-group.js +8 -8
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +224 -124
- package/dist/button.js.map +1 -1
- package/dist/calendar-column-view.js +0 -1
- package/dist/calendar-column-view.js.map +1 -1
- package/dist/calendar-month-view.js +0 -1
- package/dist/calendar-month-view.js.map +1 -1
- package/dist/card-content.js +0 -1
- package/dist/card-content.js.map +1 -1
- package/dist/card.js +96 -90
- package/dist/card.js.map +1 -1
- package/dist/cb-compound-expression.js +4 -1
- package/dist/cb-compound-expression.js.map +1 -1
- package/dist/cb-divider.js +0 -1
- package/dist/cb-divider.js.map +1 -1
- package/dist/cb-expression.js +0 -2
- package/dist/cb-expression.js.map +1 -1
- package/dist/cb-predicate.js +0 -1
- package/dist/cb-predicate.js.map +1 -1
- package/dist/code-highlighter.js +23 -6
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +5102 -18408
- package/dist/custom-elements.json +19630 -20205
- package/dist/fab.js +181 -117
- package/dist/fab.js.map +1 -1
- package/dist/{flow-designer-node-9Bqyn6qx.js → flow-designer-node-BWrPuxAR.js} +1 -2
- package/dist/flow-designer-node-BWrPuxAR.js.map +1 -0
- package/dist/flow-designer-node.js +1 -1
- package/dist/flow-designer.js +5 -5
- package/dist/icon-button-CYqrnMnF.js +318 -0
- package/dist/icon-button-CYqrnMnF.js.map +1 -0
- package/dist/index.js +8 -8
- package/dist/{navigation-rail-DAUuJ_Yp.js → navigation-rail-CM_svs5_.js} +511 -295
- package/dist/navigation-rail-CM_svs5_.js.map +1 -0
- package/dist/observe-slot-change-D8Xg-kSS.js +60 -0
- package/dist/observe-slot-change-D8Xg-kSS.js.map +1 -0
- package/dist/peacock-loader.js +7 -7
- package/dist/peacock-loader.js.map +1 -1
- package/dist/popover-content.js +0 -1
- package/dist/popover-content.js.map +1 -1
- package/dist/search.js +4 -1
- package/dist/search.js.map +1 -1
- package/dist/src/__controllers/attachable-controller.d.ts +109 -0
- package/dist/src/__mixins/{BaseButtonMixin.d.ts → NativeButtonMixin.d.ts} +3 -3
- package/dist/src/__mixins/{BaseHyperlinkMixin.d.ts → NativeHyperlinkMixin.d.ts} +3 -4
- package/dist/src/__utils/is-link.d.ts +1 -0
- package/dist/src/__utils/observe-slot-change.d.ts +1 -1
- package/dist/src/accordion/accordion-item.d.ts +0 -1
- package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +0 -1
- package/dist/src/button/ButtonConstants.d.ts +1 -0
- package/dist/src/button/GroupButtonInterface.d.ts +4 -0
- package/dist/src/button/button/button.d.ts +32 -7
- package/dist/src/button/button-group/button-group.d.ts +2 -1
- package/dist/src/button/icon-button/icon-button.d.ts +26 -5
- package/dist/src/button/index.d.ts +1 -1
- package/dist/src/calendar/calendar-column-view.d.ts +0 -1
- package/dist/src/calendar/calendar-month-view.d.ts +0 -1
- package/dist/src/card/card-content.d.ts +0 -1
- package/dist/src/card/card.d.ts +9 -6
- package/dist/src/chip/chip/chip.d.ts +22 -3
- package/dist/src/condition-builder/cb-compound-expression.d.ts +0 -1
- package/dist/src/condition-builder/cb-divider.d.ts +0 -1
- package/dist/src/condition-builder/cb-expression.d.ts +0 -1
- package/dist/src/condition-builder/cb-predicate.d.ts +0 -1
- package/dist/src/fab/fab.d.ts +20 -6
- package/dist/src/flow-designer/flow-designer-node.d.ts +0 -1
- package/dist/src/focus-ring/focus-ring.d.ts +26 -20
- package/dist/src/item/item.d.ts +2 -1
- package/dist/src/link/link.d.ts +1 -1
- package/dist/src/list/list-item.d.ts +1 -2
- package/dist/src/menu/menu-item/menu-item.d.ts +1 -2
- package/dist/src/menu/sub-menu/sub-menu.d.ts +0 -1
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +0 -2
- package/dist/src/popover/popover-content.d.ts +0 -1
- package/dist/src/ripple/ripple.d.ts +9 -1
- package/dist/src/segmented-button/segmented-button.d.ts +0 -1
- package/dist/src/select/option.d.ts +0 -1
- package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +0 -1
- package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +0 -1
- package/dist/src/tabs/tab-panel.d.ts +0 -1
- package/dist/src/tabs/tab.d.ts +4 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/readme.md +2 -2
- package/scss/components.scss +0 -1
- package/scss/mixin.scss +10 -13
- package/scss/styles.scss +1 -3
- package/src/__controllers/attachable-controller.ts +198 -0
- package/src/__mixins/NativeButtonMixin.ts +87 -0
- package/src/__mixins/{BaseHyperlinkMixin.ts → NativeHyperlinkMixin.ts} +15 -15
- package/src/__utils/is-link.ts +3 -0
- package/src/__utils/observe-slot-change.ts +46 -14
- package/src/accordion/accordion-item.scss +1 -1
- package/src/accordion/accordion-item.ts +0 -1
- package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +0 -1
- package/src/button/ButtonConstants.ts +1 -0
- package/src/button/GroupButtonInterface.ts +4 -0
- package/src/button/button/button-colors.scss +2 -2
- package/src/button/button/button-layers.scss +124 -0
- package/src/button/button/button-sizes.scss +20 -42
- package/src/button/button/button.scss +71 -169
- package/src/button/button/button.ts +229 -78
- package/src/button/button/only-button.scss +13 -0
- package/src/button/button-group/button-group.ts +59 -17
- package/src/button/icon-button/icon-button-sizes.scss +6 -21
- package/src/button/icon-button/icon-button.ts +198 -93
- package/src/button/index.ts +1 -1
- package/src/calendar/calendar-column-view.ts +0 -1
- package/src/calendar/calendar-month-view.ts +0 -1
- package/src/card/card-content.ts +2 -3
- package/src/card/card.scss +87 -95
- package/src/card/card.ts +62 -60
- package/src/chip/chip/chip.scss +65 -70
- package/src/chip/chip/chip.ts +155 -56
- package/src/code-highlighter/code-highlighter.scss +1 -1
- package/src/code-highlighter/code-highlighter.ts +20 -5
- package/src/condition-builder/cb-compound-expression.scss +4 -0
- package/src/condition-builder/cb-compound-expression.ts +0 -1
- package/src/condition-builder/cb-divider.ts +0 -1
- package/src/condition-builder/cb-expression.scss +0 -1
- package/src/condition-builder/cb-expression.ts +0 -1
- package/src/condition-builder/cb-predicate.ts +0 -1
- package/src/elevation/elevation.scss +5 -1
- package/src/fab/fab-colors.scss +2 -2
- package/src/fab/fab-sizes.scss +24 -34
- package/src/fab/fab.scss +77 -71
- package/src/fab/fab.ts +141 -65
- package/src/flow-designer/flow-designer-node.ts +0 -1
- package/src/focus-ring/focus-ring.ts +81 -72
- package/src/item/item.scss +77 -66
- package/src/item/item.ts +61 -39
- package/src/link/link.scss +1 -10
- package/src/link/link.ts +4 -2
- package/src/list/list-item.ts +8 -8
- package/src/menu/menu-item/menu-item.ts +17 -8
- package/src/menu/sub-menu/sub-menu.ts +0 -1
- package/src/navigation-rail/navigation-rail-item.scss +5 -0
- package/src/navigation-rail/navigation-rail-item.ts +10 -15
- package/src/peacock-loader.ts +1 -1
- package/src/popover/popover-content.ts +0 -1
- package/src/ripple/ripple.ts +52 -20
- package/src/search/search.scss +3 -0
- package/src/segmented-button/segmented-button.ts +0 -1
- package/src/select/option.ts +0 -1
- package/src/sidebar-menu/sidebar-menu-item.ts +0 -1
- package/src/sidebar-menu/sidebar-sub-menu.ts +0 -1
- package/src/skeleton/skeleton.scss +5 -1
- package/src/tabs/tab-panel.ts +0 -1
- package/src/tabs/tab.ts +60 -70
- package/src/text/text.css-component.scss +3 -21
- package/src/tooltip/tooltip.scss +5 -8
- package/src/tooltip/tooltip.ts +1 -2
- package/dist/BaseButton-BNFAYn-S.js +0 -219
- package/dist/BaseButton-BNFAYn-S.js.map +0 -1
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +0 -1
- package/dist/button-colors-Cg6oxiz-.js.map +0 -1
- package/dist/flow-designer-node-9Bqyn6qx.js.map +0 -1
- package/dist/icon-button-AdJBEoNy.js +0 -251
- package/dist/icon-button-AdJBEoNy.js.map +0 -1
- package/dist/navigation-rail-DAUuJ_Yp.js.map +0 -1
- package/dist/observe-slot-change-BGJfgg2E.js +0 -31
- package/dist/observe-slot-change-BGJfgg2E.js.map +0 -1
- package/dist/src/button/BaseButton.d.ts +0 -28
- package/dist/src/focus-ring/FocusAttachableController.d.ts +0 -8
- package/src/__mixins/BaseButtonMixin.ts +0 -83
- package/src/button/BaseButton.ts +0 -113
- package/src/focus-ring/FocusAttachableController.ts +0 -28
- package/src/popover/tooltip.css-component.scss +0 -19
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
1
|
+
import { html, LitElement, nothing } from 'lit';
|
|
2
|
+
import { property, query } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
import { when } from 'lit/directives/when.js';
|
|
6
|
+
import buttonLayers from '../button/button-layers.scss';
|
|
5
7
|
import styles from '../button/button.scss';
|
|
6
8
|
import colorStyles from '../button/button-colors.scss';
|
|
7
9
|
import sizeStyles from './icon-button-sizes.scss';
|
|
8
10
|
import { spread } from '@/__directive/spread.js';
|
|
9
11
|
import { throttle } from '@/__utils/throttle.js';
|
|
10
|
-
import {
|
|
12
|
+
import { isLink } from '@/__utils/is-link.js';
|
|
13
|
+
import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
|
|
14
|
+
import {
|
|
15
|
+
dispatchActivationClick,
|
|
16
|
+
isActivationClick,
|
|
17
|
+
} from '@/__utils/dispatch-event-utils.js';
|
|
18
|
+
import NativeButtonMixin from '@/__mixins/NativeButtonMixin.js';
|
|
19
|
+
import NativeHyperlinkMixin from '@/__mixins/NativeHyperlinkMixin.js';
|
|
20
|
+
import { GroupButtonInterface } from '@/button/GroupButtonInterface.js';
|
|
21
|
+
import { DISABLED_REASON_ID } from '@/button/ButtonConstants.js';
|
|
11
22
|
|
|
12
23
|
/**
|
|
13
24
|
* @label Icon Button
|
|
@@ -52,8 +63,11 @@ import { BaseButton } from '../BaseButton.js';
|
|
|
52
63
|
* ```
|
|
53
64
|
* @tags display
|
|
54
65
|
*/
|
|
55
|
-
export class IconButton
|
|
56
|
-
|
|
66
|
+
export class IconButton
|
|
67
|
+
extends NativeButtonMixin(NativeHyperlinkMixin(LitElement))
|
|
68
|
+
implements GroupButtonInterface
|
|
69
|
+
{
|
|
70
|
+
static override styles = [buttonLayers, styles, colorStyles, sizeStyles];
|
|
57
71
|
|
|
58
72
|
/**
|
|
59
73
|
* Button size.
|
|
@@ -62,39 +76,39 @@ export class IconButton extends BaseButton {
|
|
|
62
76
|
@property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
|
|
63
77
|
|
|
64
78
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
79
|
+
* Type is preset of color and variant. Type will be only applied.
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
@property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The visual style of the button.
|
|
86
|
+
*
|
|
87
|
+
* Possible variant values:
|
|
88
|
+
* `"filled"` is a filled button.
|
|
89
|
+
* `"outlined"` is an outlined button.
|
|
90
|
+
* `"text"` is a transparent button.
|
|
91
|
+
* `"tonal"` is a light color button.
|
|
92
|
+
* `"elevated"` is elevated button
|
|
93
|
+
*/
|
|
94
|
+
@property({ reflect: true }) variant:
|
|
95
|
+
| 'elevated'
|
|
96
|
+
| 'filled'
|
|
97
|
+
| 'tonal'
|
|
98
|
+
| 'outlined'
|
|
99
|
+
| 'text'
|
|
100
|
+
| 'neo' = 'filled';
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
104
|
+
*/
|
|
105
|
+
@property({ reflect: true }) color:
|
|
106
|
+
| 'primary'
|
|
107
|
+
| 'success'
|
|
108
|
+
| 'danger'
|
|
109
|
+
| 'warning'
|
|
110
|
+
| 'surface'
|
|
111
|
+
| 'on-surface' = 'primary';
|
|
98
112
|
|
|
99
113
|
/**
|
|
100
114
|
* Additional ARIA attributes to pass to the inner button/anchor element.
|
|
@@ -102,6 +116,92 @@ export class IconButton extends BaseButton {
|
|
|
102
116
|
@property({ reflect: true })
|
|
103
117
|
configAria?: { [key: string]: any };
|
|
104
118
|
|
|
119
|
+
@property({ type: Boolean, reflect: true }) skeleton: boolean = false;
|
|
120
|
+
|
|
121
|
+
@property({ type: Boolean, reflect: true }) toggle: boolean = false;
|
|
122
|
+
|
|
123
|
+
@property({ type: Boolean, reflect: true }) selected: boolean = false;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
127
|
+
*/
|
|
128
|
+
@property() throttleDelay = 200;
|
|
129
|
+
|
|
130
|
+
@property() tooltip?: string;
|
|
131
|
+
|
|
132
|
+
@property({ type: Boolean, reflect: true })
|
|
133
|
+
pressed = false;
|
|
134
|
+
|
|
135
|
+
@query('.button') readonly buttonElement!: HTMLElement | null;
|
|
136
|
+
|
|
137
|
+
override connectedCallback() {
|
|
138
|
+
super.connectedCallback();
|
|
139
|
+
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
140
|
+
window.addEventListener('mouseup', this.__handlePress);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
override disconnectedCallback() {
|
|
144
|
+
window.removeEventListener('mouseup', this.__handlePress);
|
|
145
|
+
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
146
|
+
super.disconnectedCallback();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
__handlePress = (event: KeyboardEvent | MouseEvent) => {
|
|
150
|
+
if (this.disabled || this.skeleton || this.softDisabled) return;
|
|
151
|
+
this.pressed =
|
|
152
|
+
(event instanceof KeyboardEvent &&
|
|
153
|
+
event.type === 'keydown' &&
|
|
154
|
+
(event.key === 'Enter' || event.key === ' ')) ||
|
|
155
|
+
event.type === 'mousedown';
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
__dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
|
|
159
|
+
event => {
|
|
160
|
+
this.__dispatchClick(event);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
164
|
+
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
165
|
+
// prevent the click from propagating to other event listeners as well as
|
|
166
|
+
// prevent the default action.
|
|
167
|
+
if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
|
|
168
|
+
event.stopImmediatePropagation();
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!isActivationClick(event) || !this.buttonElement) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (this.toggle) {
|
|
178
|
+
this.selected = !this.selected;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
this.focus();
|
|
182
|
+
dispatchActivationClick(this.buttonElement);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
__renderDisabledReason(softDisabled: boolean) {
|
|
186
|
+
if (softDisabled)
|
|
187
|
+
return html`<div
|
|
188
|
+
id=${DISABLED_REASON_ID}
|
|
189
|
+
role="tooltip"
|
|
190
|
+
aria-label=${this.disabledReason}
|
|
191
|
+
class="screen-reader-only"
|
|
192
|
+
>
|
|
193
|
+
${this.disabledReason}
|
|
194
|
+
</div>`;
|
|
195
|
+
return nothing;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
__renderTooltip() {
|
|
199
|
+
if (this.tooltip) {
|
|
200
|
+
return html`<wc-tooltip class="tooltip" for="button">${this.tooltip}</wc-tooltip>`;
|
|
201
|
+
}
|
|
202
|
+
return nothing;
|
|
203
|
+
}
|
|
204
|
+
|
|
105
205
|
override focus() {
|
|
106
206
|
this.buttonElement?.focus();
|
|
107
207
|
}
|
|
@@ -109,7 +209,7 @@ export class IconButton extends BaseButton {
|
|
|
109
209
|
override blur() {
|
|
110
210
|
this.buttonElement?.blur();
|
|
111
211
|
}
|
|
112
|
-
|
|
212
|
+
|
|
113
213
|
override firstUpdated() {
|
|
114
214
|
this.__dispatchClickWithThrottle = throttle(
|
|
115
215
|
this.__dispatchClick,
|
|
@@ -135,8 +235,26 @@ export class IconButton extends BaseButton {
|
|
|
135
235
|
}
|
|
136
236
|
|
|
137
237
|
override render() {
|
|
138
|
-
|
|
238
|
+
return html`
|
|
239
|
+
<wc-focus-ring class="focus-ring" for="button"></wc-focus-ring>
|
|
240
|
+
<wc-elevation class="elevation"></wc-elevation>
|
|
241
|
+
${when(
|
|
242
|
+
this.variant === 'neo',
|
|
243
|
+
() => html`<div class="neo-background"></div>`,
|
|
244
|
+
)}
|
|
245
|
+
<div class="background"></div>
|
|
246
|
+
${when(
|
|
247
|
+
this.variant === 'outlined' || this.variant === 'neo',
|
|
248
|
+
() => html`<div class="outline"></div>`,
|
|
249
|
+
)}
|
|
250
|
+
<wc-ripple class="ripple" for="button"></wc-ripple>
|
|
251
|
+
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
252
|
+
|
|
253
|
+
${this.renderButtonElement()} ${this.__renderTooltip()}
|
|
254
|
+
`;
|
|
255
|
+
}
|
|
139
256
|
|
|
257
|
+
renderButtonElement() {
|
|
140
258
|
const cssClasses = {
|
|
141
259
|
button: true,
|
|
142
260
|
'button-element': true,
|
|
@@ -144,69 +262,56 @@ export class IconButton extends BaseButton {
|
|
|
144
262
|
[`variant-${this.variant}`]: true,
|
|
145
263
|
[`color-${this.color}`]: true,
|
|
146
264
|
disabled: this.disabled || this.softDisabled,
|
|
147
|
-
pressed: this.
|
|
265
|
+
pressed: this.pressed,
|
|
148
266
|
skeleton: this.skeleton,
|
|
149
267
|
};
|
|
150
268
|
|
|
151
|
-
if (!isLink) {
|
|
269
|
+
if (!isLink(this)) {
|
|
152
270
|
cssClasses['native-button'] = true;
|
|
153
271
|
return html`<button
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
${this.__renderTooltip()}`;
|
|
171
|
-
} else {
|
|
172
|
-
cssClasses['native-link'] = true;
|
|
173
|
-
return html`<a
|
|
174
|
-
class=${classMap(cssClasses)}
|
|
175
|
-
id="button"
|
|
176
|
-
href=${this.href}
|
|
177
|
-
target=${this.target}
|
|
178
|
-
tabindex=${this.disabled ? '-1' : '0'}
|
|
179
|
-
@click=${this.__dispatchClick}
|
|
180
|
-
@mousedown=${this.__handlePress}
|
|
181
|
-
@keydown=${this.__handlePress}
|
|
182
|
-
@keyup=${this.__handlePress}
|
|
183
|
-
role="button"
|
|
184
|
-
|
|
185
|
-
aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
186
|
-
?aria-disabled=${this.softDisabled}
|
|
187
|
-
|
|
188
|
-
${spread(this.configAria)}
|
|
189
|
-
>
|
|
190
|
-
${this.renderButtonContent()}
|
|
191
|
-
</a>
|
|
192
|
-
${this.__renderTooltip()}`;
|
|
272
|
+
class=${classMap(cssClasses)}
|
|
273
|
+
id="button"
|
|
274
|
+
type=${this.htmlType}
|
|
275
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
276
|
+
@mousedown=${this.__handlePress}
|
|
277
|
+
@keydown=${this.__handlePress}
|
|
278
|
+
@keyup=${this.__handlePress}
|
|
279
|
+
aria-describedby=${ifDefined(
|
|
280
|
+
this.softDisabled ? DISABLED_REASON_ID : undefined,
|
|
281
|
+
)}
|
|
282
|
+
?aria-disabled=${this.softDisabled}
|
|
283
|
+
?disabled=${this.disabled}
|
|
284
|
+
${spread(this.configAria)}
|
|
285
|
+
>
|
|
286
|
+
${this.renderButtonContent()}
|
|
287
|
+
</button>`;
|
|
193
288
|
}
|
|
289
|
+
cssClasses['native-link'] = true;
|
|
290
|
+
return html`<a
|
|
291
|
+
class=${classMap(cssClasses)}
|
|
292
|
+
id="button"
|
|
293
|
+
href=${this.href}
|
|
294
|
+
target=${this.target}
|
|
295
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
296
|
+
@click=${this.__dispatchClick}
|
|
297
|
+
@mousedown=${this.__handlePress}
|
|
298
|
+
@keydown=${this.__handlePress}
|
|
299
|
+
@keyup=${this.__handlePress}
|
|
300
|
+
role="button"
|
|
301
|
+
aria-describedby=${ifDefined(
|
|
302
|
+
this.softDisabled ? DISABLED_REASON_ID : undefined,
|
|
303
|
+
)}
|
|
304
|
+
?aria-disabled=${this.softDisabled}
|
|
305
|
+
${spread(this.configAria)}
|
|
306
|
+
>
|
|
307
|
+
${this.renderButtonContent()}
|
|
308
|
+
</a>`;
|
|
194
309
|
}
|
|
195
310
|
|
|
196
311
|
renderButtonContent() {
|
|
197
312
|
return html`
|
|
198
|
-
<
|
|
199
|
-
<
|
|
200
|
-
<div class="neo-background"></div>
|
|
201
|
-
<div class="background"></div>
|
|
202
|
-
<div class="outline"></div>
|
|
203
|
-
<wc-ripple class="ripple"></wc-ripple>
|
|
204
|
-
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
205
|
-
|
|
206
|
-
<div class="button-content">
|
|
207
|
-
<slot></slot>
|
|
208
|
-
</div>
|
|
209
|
-
|
|
313
|
+
<slot class="icon-slot"></slot>
|
|
314
|
+
<div class="touch"></div>
|
|
210
315
|
${this.__renderDisabledReason(this.softDisabled)}
|
|
211
316
|
`;
|
|
212
317
|
}
|
package/src/button/index.ts
CHANGED
|
@@ -22,7 +22,6 @@ import styles from './calendar-column-view.scss';
|
|
|
22
22
|
* @label Calendar Column View
|
|
23
23
|
* @tag wc-calendar-column-view
|
|
24
24
|
* @rawTag calendar-column-view
|
|
25
|
-
* @parentRawTag calendar
|
|
26
25
|
* @summary Internal column view component for the calendar (day/week views).
|
|
27
26
|
*/
|
|
28
27
|
@IndividualComponent
|
|
@@ -21,7 +21,6 @@ import styles from './calendar-month-view.scss';
|
|
|
21
21
|
* @label Calendar Month View
|
|
22
22
|
* @tag wc-calendar-month-view
|
|
23
23
|
* @rawTag calendar-month-view
|
|
24
|
-
* @parentRawTag calendar
|
|
25
24
|
* @summary Internal month view component for the calendar.
|
|
26
25
|
*/
|
|
27
26
|
@IndividualComponent
|
package/src/card/card-content.ts
CHANGED
|
@@ -5,8 +5,7 @@ import IndividualComponent from '../IndividualComponent.js';
|
|
|
5
5
|
* @label Card Content
|
|
6
6
|
* @tag wc-card-content
|
|
7
7
|
* @rawTag card-content
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
*
|
|
10
9
|
* @cssprop --card-content-padding - Inner padding for the card container. Defaults to 1rem.
|
|
11
10
|
*
|
|
12
11
|
* ```
|
|
@@ -23,4 +22,4 @@ export class CardContent extends LitElement {
|
|
|
23
22
|
render() {
|
|
24
23
|
return html`<slot></slot>`;
|
|
25
24
|
}
|
|
26
|
-
}
|
|
25
|
+
}
|
package/src/card/card.scss
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
@include mixin.base-styles;
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
|
+
position: relative;
|
|
6
7
|
display: block;
|
|
7
8
|
--card-gap: 0;
|
|
8
9
|
--card-padding: 0;
|
|
@@ -11,6 +12,11 @@
|
|
|
11
12
|
--card-container-shape-start-end: unset;
|
|
12
13
|
--card-container-shape-end-start: unset;
|
|
13
14
|
--card-container-shape-end-end: unset;
|
|
15
|
+
|
|
16
|
+
--_container-shape-start-start: var(--card-container-shape-start-start, var(--card-container-shape));
|
|
17
|
+
--_container-shape-start-end: var(--card-container-shape-start-end, var(--card-container-shape));
|
|
18
|
+
--_container-shape-end-start: var(--card-container-shape-end-start, var(--card-container-shape));
|
|
19
|
+
--_container-shape-end-end: var(--card-container-shape-end-end, var(--card-container-shape));
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
/*
|
|
@@ -27,16 +33,10 @@
|
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
.card {
|
|
30
|
-
position: relative;
|
|
31
36
|
display: flex;
|
|
32
37
|
height: 100%;
|
|
33
38
|
width: 100%;
|
|
34
|
-
|
|
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));
|
|
39
|
-
|
|
39
|
+
z-index: 0;
|
|
40
40
|
|
|
41
41
|
.card-content {
|
|
42
42
|
z-index: 0;
|
|
@@ -63,83 +63,80 @@
|
|
|
63
63
|
height: 100%;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
}
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
}
|
|
68
|
+
/*
|
|
69
|
+
Background layers
|
|
70
|
+
*/
|
|
71
|
+
.focus-ring {
|
|
72
|
+
z-index: 2;
|
|
73
|
+
display: none;
|
|
74
|
+
--focus-ring-container-shape-start-start: var(--_container-shape-start-start);
|
|
75
|
+
--focus-ring-container-shape-start-end: var(--_container-shape-start-end);
|
|
76
|
+
--focus-ring-container-shape-end-start: var(--_container-shape-end-start);
|
|
77
|
+
--focus-ring-container-shape-end-end: var(--_container-shape-end-end);
|
|
78
|
+
--focus-ring-container-shape-variant: var(--_container-corner-shape-variant);
|
|
79
|
+
}
|
|
119
80
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
}
|
|
81
|
+
.ripple {
|
|
82
|
+
display: none;
|
|
83
|
+
border-start-start-radius: var(--_container-shape-start-start);
|
|
84
|
+
border-start-end-radius: var(--_container-shape-start-end);
|
|
85
|
+
border-end-start-radius: var(--_container-shape-end-start);
|
|
86
|
+
border-end-end-radius: var(--_container-shape-end-end);
|
|
87
|
+
corner-shape: var(--_container-corner-shape-variant);
|
|
88
|
+
--ripple-state-opacity: var(--_container-state-opacity, 0);
|
|
89
|
+
--ripple-pressed-color: var(--_container-state-color);
|
|
90
|
+
}
|
|
137
91
|
|
|
92
|
+
.background {
|
|
93
|
+
z-index: 0;
|
|
94
|
+
display: block;
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 0;
|
|
97
|
+
left: 0;
|
|
98
|
+
width: 100%;
|
|
99
|
+
height: 100%;
|
|
100
|
+
background-color: var(--_container-color);
|
|
101
|
+
opacity: var(--_container-opacity, 1);
|
|
102
|
+
|
|
103
|
+
border-start-start-radius: var(--_container-shape-start-start);
|
|
104
|
+
border-start-end-radius: var(--_container-shape-start-end);
|
|
105
|
+
border-end-start-radius: var(--_container-shape-end-start);
|
|
106
|
+
border-end-end-radius: var(--_container-shape-end-end);
|
|
107
|
+
corner-shape: var(--_container-corner-shape-variant);
|
|
108
|
+
pointer-events: none;
|
|
109
|
+
}
|
|
138
110
|
|
|
111
|
+
.elevation {
|
|
112
|
+
--elevation-level: var(--_container-elevation-level);
|
|
113
|
+
transition-duration: 280ms;
|
|
114
|
+
--elevation-container-shape-start-start: var(--_container-shape-start-start);
|
|
115
|
+
--elevation-container-shape-start-end: var(--_container-shape-start-end);
|
|
116
|
+
--elevation-container-shape-end-start: var(--_container-shape-end-start);
|
|
117
|
+
--elevation-container-shape-end-end: var(--_container-shape-end-end);
|
|
118
|
+
--elevation-container-shape-variant: var(--_container-corner-shape-variant);
|
|
139
119
|
}
|
|
140
120
|
|
|
141
|
-
.
|
|
121
|
+
.outline {
|
|
122
|
+
z-index: 0;
|
|
123
|
+
display: none;
|
|
124
|
+
position: absolute;
|
|
125
|
+
left: 0;
|
|
126
|
+
top: 0;
|
|
127
|
+
width: 100%;
|
|
128
|
+
height: 100%;
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
border: var(--_outline-width) solid var(--_outline-color);
|
|
131
|
+
opacity: var(--_outline-opacity, 1);
|
|
132
|
+
border-start-start-radius: var(--_container-shape-start-start);
|
|
133
|
+
border-start-end-radius: var(--_container-shape-start-end);
|
|
134
|
+
border-end-start-radius: var(--_container-shape-end-start);
|
|
135
|
+
border-end-end-radius: var(--_container-shape-end-end);
|
|
136
|
+
corner-shape: var(--_container-corner-shape-variant);
|
|
137
|
+
}
|
|
142
138
|
|
|
139
|
+
:host([actionable]) {
|
|
143
140
|
.focus-ring,
|
|
144
141
|
.ripple {
|
|
145
142
|
display: block;
|
|
@@ -150,24 +147,23 @@
|
|
|
150
147
|
}
|
|
151
148
|
}
|
|
152
149
|
|
|
153
|
-
|
|
150
|
+
:host([variant='elevated']) {
|
|
154
151
|
--_container-color: var(--elevated-card-container-color);
|
|
155
152
|
--_label-text-color: var(--elevated-card-label-text-color);
|
|
156
153
|
--_container-elevation-level: 1;
|
|
157
|
-
|
|
158
154
|
--_container-state-color: var(--_label-text-color);
|
|
159
155
|
|
|
160
|
-
&:hover:not(
|
|
156
|
+
&:hover:not([disabled]) {
|
|
161
157
|
--_container-elevation-level: 2;
|
|
162
158
|
--_container-state-opacity: 0.08;
|
|
163
159
|
}
|
|
164
160
|
|
|
165
|
-
|
|
161
|
+
&:has(.card.pressed):not([disabled]) {
|
|
166
162
|
--_container-elevation-level: 1;
|
|
167
163
|
--_container-state-opacity: 0.12;
|
|
168
164
|
}
|
|
169
165
|
|
|
170
|
-
|
|
166
|
+
&[disabled] {
|
|
171
167
|
--_container-color: var(--color-on-surface);
|
|
172
168
|
--_container-opacity: 0.1;
|
|
173
169
|
--_label-text-color: var(--color-on-surface);
|
|
@@ -179,24 +175,22 @@
|
|
|
179
175
|
}
|
|
180
176
|
}
|
|
181
177
|
|
|
182
|
-
|
|
183
|
-
.card.variant-filled {
|
|
178
|
+
:host([variant='filled']) {
|
|
184
179
|
--_container-color: var(--filled-card-container-color);
|
|
185
180
|
--_label-text-color: var(--filled-card-label-text-color);
|
|
186
181
|
--_container-state-color: var(--_label-text-color);
|
|
187
182
|
|
|
188
|
-
|
|
189
|
-
&:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
|
|
183
|
+
&:hover:not([disabled]) {
|
|
190
184
|
--_container-elevation-level: 1;
|
|
191
185
|
--_container-state-opacity: 0.08;
|
|
192
186
|
}
|
|
193
187
|
|
|
194
|
-
|
|
188
|
+
&:has(.card.pressed):not([disabled]) {
|
|
195
189
|
--_container-elevation-level: 0;
|
|
196
190
|
--_container-state-opacity: 0.1;
|
|
197
191
|
}
|
|
198
192
|
|
|
199
|
-
|
|
193
|
+
&[disabled] {
|
|
200
194
|
--_container-color: var(--color-on-surface);
|
|
201
195
|
--_container-opacity: 0.1;
|
|
202
196
|
--_label-text-color: var(--color-on-surface);
|
|
@@ -208,27 +202,25 @@
|
|
|
208
202
|
}
|
|
209
203
|
}
|
|
210
204
|
|
|
211
|
-
|
|
212
|
-
.card.variant-outlined {
|
|
205
|
+
:host([variant='outlined']) {
|
|
213
206
|
--_outline-width: var(--outlined-card-outline-width, 0.0675rem);
|
|
214
207
|
--_outline-color: var(--outlined-card-outline-color);
|
|
215
208
|
--_label-text-color: var(--outlined-card-label-text-color);
|
|
216
|
-
|
|
217
209
|
--_container-state-color: var(--_label-text-color);
|
|
218
210
|
|
|
219
211
|
.outline {
|
|
220
212
|
display: block;
|
|
221
213
|
}
|
|
222
214
|
|
|
223
|
-
&:hover:not(
|
|
215
|
+
&:hover:not([disabled]) {
|
|
224
216
|
--_container-state-opacity: 0.08;
|
|
225
217
|
}
|
|
226
218
|
|
|
227
|
-
|
|
219
|
+
&:has(.card.pressed):not([disabled]) {
|
|
228
220
|
--_container-state-opacity: 0.12;
|
|
229
221
|
}
|
|
230
222
|
|
|
231
|
-
|
|
223
|
+
&[disabled] {
|
|
232
224
|
--_outline-color: var(--color-on-surface);
|
|
233
225
|
--_label-text-color: var(--color-on-surface);
|
|
234
226
|
--_label-text-opacity: 0.38;
|
|
@@ -238,4 +230,4 @@
|
|
|
238
230
|
display: none;
|
|
239
231
|
}
|
|
240
232
|
}
|
|
241
|
-
}
|
|
233
|
+
}
|