@redvars/peacock 3.6.3 → 3.7.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-Dwnez1tR.js} +201 -186
- package/dist/button-colors-Dwnez1tR.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-DJ0kZXYr.js +318 -0
- package/dist/icon-button-DJ0kZXYr.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 +72 -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
package/src/item/item.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { property, query, state } 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
5
|
import styles from './item.scss';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import NativeButtonMixin from '@/__mixins/NativeButtonMixin.js';
|
|
7
|
+
import NativeHyperlinkMixin from '@/__mixins/NativeHyperlinkMixin.js';
|
|
8
8
|
import {
|
|
9
9
|
dispatchActivationClick,
|
|
10
10
|
isActivationClick,
|
|
11
11
|
} from '@/__utils/dispatch-event-utils.js';
|
|
12
|
+
import { isLink } from '@/__utils/is-link.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @label Item
|
|
@@ -30,7 +31,7 @@ import {
|
|
|
30
31
|
* ```
|
|
31
32
|
* @tags display
|
|
32
33
|
*/
|
|
33
|
-
export class Item extends
|
|
34
|
+
export class Item extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {
|
|
34
35
|
static styles = [styles];
|
|
35
36
|
|
|
36
37
|
static override get observedAttributes() {
|
|
@@ -57,7 +58,9 @@ export class Item extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
57
58
|
|
|
58
59
|
private __hasNamedSlot(...names: string[]) {
|
|
59
60
|
return names.some(name =>
|
|
60
|
-
Array.from(this.children).some(
|
|
61
|
+
Array.from(this.children).some(
|
|
62
|
+
child => child.getAttribute('slot') === name,
|
|
63
|
+
),
|
|
61
64
|
);
|
|
62
65
|
}
|
|
63
66
|
|
|
@@ -149,7 +152,7 @@ export class Item extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
149
152
|
return;
|
|
150
153
|
}
|
|
151
154
|
|
|
152
|
-
if (event.key === 'Enter' && !this
|
|
155
|
+
if (event.key === 'Enter' && !isLink(this)) {
|
|
153
156
|
event.preventDefault();
|
|
154
157
|
this.itemElement.click();
|
|
155
158
|
}
|
|
@@ -189,7 +192,6 @@ export class Item extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
render() {
|
|
192
|
-
const isLink = this.__isLink();
|
|
193
195
|
const role = this.__getForwardedAttribute('role');
|
|
194
196
|
const tabIndex = this.__capturedTabIndex;
|
|
195
197
|
const ariaHasPopup = this.__getForwardedAttribute('aria-haspopup');
|
|
@@ -203,7 +205,24 @@ export class Item extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
203
205
|
pressed: this.isPressed,
|
|
204
206
|
};
|
|
205
207
|
|
|
206
|
-
|
|
208
|
+
return html`
|
|
209
|
+
<wc-focus-ring class="focus-ring" for="item"></wc-focus-ring>
|
|
210
|
+
<div class="background"></div>
|
|
211
|
+
<wc-ripple class="ripple" for="item"></wc-ripple>
|
|
212
|
+
|
|
213
|
+
${this.renderItemElement(cssClasses, role, tabIndex, ariaHasPopup, ariaControls, ariaExpanded)}
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
renderItemElement(
|
|
218
|
+
cssClasses: any,
|
|
219
|
+
role: string | undefined,
|
|
220
|
+
tabIndex: string | undefined,
|
|
221
|
+
ariaHasPopup: string | undefined,
|
|
222
|
+
ariaControls: string | undefined,
|
|
223
|
+
ariaExpanded: string | undefined,
|
|
224
|
+
) {
|
|
225
|
+
if (!isLink(this)) {
|
|
207
226
|
cssClasses['native-button'] = true;
|
|
208
227
|
|
|
209
228
|
return html`
|
|
@@ -226,9 +245,9 @@ export class Item extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
226
245
|
${this.renderContent()}
|
|
227
246
|
</button>
|
|
228
247
|
`;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
248
|
+
}
|
|
249
|
+
cssClasses['native-link'] = true;
|
|
250
|
+
return html`
|
|
232
251
|
<a
|
|
233
252
|
id="item"
|
|
234
253
|
class=${classMap(cssClasses)}
|
|
@@ -250,9 +269,6 @@ export class Item extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
250
269
|
${this.renderContent()}
|
|
251
270
|
</a>
|
|
252
271
|
`;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
272
|
}
|
|
257
273
|
|
|
258
274
|
renderContent() {
|
|
@@ -267,47 +283,53 @@ export class Item extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
267
283
|
);
|
|
268
284
|
|
|
269
285
|
return html`
|
|
270
|
-
<wc-focus-ring class="focus-ring" for="item"></wc-focus-ring>
|
|
271
|
-
<div class="background"></div>
|
|
272
|
-
<wc-ripple class="ripple"></wc-ripple>
|
|
273
|
-
|
|
274
286
|
<div class="item-content">
|
|
275
287
|
${hasStart
|
|
276
|
-
|
|
288
|
+
? html`
|
|
277
289
|
<div class="start">
|
|
278
|
-
<slot
|
|
290
|
+
<slot
|
|
291
|
+
name="start"
|
|
292
|
+
@slotchange=${this.__handleSlotChange}
|
|
293
|
+
></slot>
|
|
279
294
|
</div>
|
|
280
295
|
`
|
|
281
|
-
|
|
296
|
+
: nothing}
|
|
282
297
|
<div class="content">
|
|
283
|
-
|
|
284
298
|
${hasOverline
|
|
285
|
-
|
|
299
|
+
? html`
|
|
286
300
|
<div class="overline">
|
|
287
|
-
<slot
|
|
301
|
+
<slot
|
|
302
|
+
name="overline"
|
|
303
|
+
@slotchange=${this.__handleSlotChange}
|
|
304
|
+
></slot>
|
|
288
305
|
</div>
|
|
289
306
|
`
|
|
290
|
-
|
|
307
|
+
: nothing}
|
|
291
308
|
${hasHeadline || hasDefault
|
|
292
|
-
|
|
309
|
+
? html`
|
|
293
310
|
<div class="headline-row">
|
|
294
311
|
${hasHeadline || hasDefault
|
|
295
|
-
|
|
312
|
+
? html`
|
|
296
313
|
<div class="headline">
|
|
297
314
|
${hasHeadline
|
|
298
|
-
|
|
299
|
-
|
|
315
|
+
? html`<slot
|
|
316
|
+
name="headline"
|
|
317
|
+
@slotchange=${this.__handleSlotChange}
|
|
318
|
+
></slot>`
|
|
319
|
+
: nothing}
|
|
300
320
|
${hasDefault
|
|
301
|
-
|
|
302
|
-
|
|
321
|
+
? html`<slot
|
|
322
|
+
@slotchange=${this.__handleSlotChange}
|
|
323
|
+
></slot>`
|
|
324
|
+
: nothing}
|
|
303
325
|
</div>
|
|
304
326
|
`
|
|
305
|
-
|
|
327
|
+
: nothing}
|
|
306
328
|
</div>
|
|
307
329
|
`
|
|
308
|
-
|
|
330
|
+
: nothing}
|
|
309
331
|
${hasSupportingText
|
|
310
|
-
|
|
332
|
+
? html`
|
|
311
333
|
<div class="supporting-text">
|
|
312
334
|
<slot
|
|
313
335
|
name="supporting-text"
|
|
@@ -315,10 +337,10 @@ export class Item extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
315
337
|
></slot>
|
|
316
338
|
</div>
|
|
317
339
|
`
|
|
318
|
-
|
|
340
|
+
: nothing}
|
|
319
341
|
</div>
|
|
320
342
|
${hasTrailingSupportingText
|
|
321
|
-
|
|
343
|
+
? html`
|
|
322
344
|
<div class="trailing-supporting-text">
|
|
323
345
|
<slot
|
|
324
346
|
name="trailing-supporting-text"
|
|
@@ -326,15 +348,15 @@ export class Item extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
326
348
|
></slot>
|
|
327
349
|
</div>
|
|
328
350
|
`
|
|
329
|
-
|
|
351
|
+
: nothing}
|
|
330
352
|
${hasEnd
|
|
331
|
-
|
|
353
|
+
? html`
|
|
332
354
|
<div class="end">
|
|
333
355
|
<slot name="end" @slotchange=${this.__handleSlotChange}></slot>
|
|
334
356
|
</div>
|
|
335
357
|
`
|
|
336
|
-
|
|
358
|
+
: nothing}
|
|
337
359
|
</div>
|
|
338
360
|
`;
|
|
339
361
|
}
|
|
340
|
-
}
|
|
362
|
+
}
|
package/src/link/link.scss
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
@include mixin.base-styles;
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
|
-
display: inline
|
|
7
|
-
border-radius: inherit;
|
|
8
|
-
corner-shape: inherit;
|
|
6
|
+
display: inline;
|
|
9
7
|
color: var(--color-primary);
|
|
10
8
|
}
|
|
11
9
|
|
|
@@ -25,10 +23,3 @@
|
|
|
25
23
|
color: inherit;
|
|
26
24
|
text-decoration: none !important;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
:host(.with-icon) .link {
|
|
30
|
-
display: inline-flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
gap: 0.5em;
|
|
33
|
-
}
|
|
34
|
-
|
package/src/link/link.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
2
|
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
-
import
|
|
3
|
+
import NativeHyperlinkMixin from '@/__mixins/NativeHyperlinkMixin.js';
|
|
4
4
|
import styles from './link.scss';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -16,7 +16,7 @@ import styles from './link.scss';
|
|
|
16
16
|
* <wc-link href="#">Link</wc-link>
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export class Link extends
|
|
19
|
+
export class Link extends NativeHyperlinkMixin(LitElement) {
|
|
20
20
|
static styles = [styles];
|
|
21
21
|
|
|
22
22
|
render() {
|
|
@@ -25,7 +25,9 @@ export class Link extends BaseHyperlinkMixin(LitElement) {
|
|
|
25
25
|
link: true,
|
|
26
26
|
})}
|
|
27
27
|
href=${this.href}
|
|
28
|
+
?download=${this.download}
|
|
28
29
|
target=${this.target}
|
|
30
|
+
?rel=${this.rel}
|
|
29
31
|
?tabindex=${this.parentElement?.tabIndex}
|
|
30
32
|
>
|
|
31
33
|
<slot></slot>
|
package/src/list/list-item.ts
CHANGED
|
@@ -3,8 +3,9 @@ import { property, query, state } 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
5
|
import styles from './list-item.scss';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import NativeButtonMixin from '@/__mixins/NativeButtonMixin.js';
|
|
7
|
+
import NativeHyperlinkMixin from '@/__mixins/NativeHyperlinkMixin.js';
|
|
8
|
+
import { isLink } from '@/__utils/is-link.js';
|
|
8
9
|
import {
|
|
9
10
|
dispatchActivationClick,
|
|
10
11
|
isActivationClick,
|
|
@@ -14,7 +15,6 @@ import {
|
|
|
14
15
|
* @label List Item
|
|
15
16
|
* @tag wc-list-item
|
|
16
17
|
* @rawTag list-item
|
|
17
|
-
* @parentRawTag list
|
|
18
18
|
*
|
|
19
19
|
* @summary A Material 3 list item with leading, trailing and content slots.
|
|
20
20
|
*
|
|
@@ -28,7 +28,9 @@ import {
|
|
|
28
28
|
* ```
|
|
29
29
|
* @tags display
|
|
30
30
|
*/
|
|
31
|
-
export class ListItem extends
|
|
31
|
+
export class ListItem extends NativeButtonMixin(
|
|
32
|
+
NativeHyperlinkMixin(LitElement),
|
|
33
|
+
) {
|
|
32
34
|
static styles = [styles];
|
|
33
35
|
|
|
34
36
|
@property({ type: Boolean, reflect: true }) selected = false;
|
|
@@ -82,7 +84,7 @@ export class ListItem extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
if (event.key === 'Enter' && !this
|
|
87
|
+
if (event.key === 'Enter' && !isLink(this)) {
|
|
86
88
|
event.preventDefault();
|
|
87
89
|
this.itemElement.click();
|
|
88
90
|
}
|
|
@@ -105,8 +107,6 @@ export class ListItem extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
105
107
|
};
|
|
106
108
|
|
|
107
109
|
render() {
|
|
108
|
-
const isLink = this.__isLink();
|
|
109
|
-
|
|
110
110
|
const cssClasses = {
|
|
111
111
|
'list-item': true,
|
|
112
112
|
'item-element': true,
|
|
@@ -115,7 +115,7 @@ export class ListItem extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
115
115
|
pressed: this.isPressed,
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
if (!isLink) {
|
|
118
|
+
if (!isLink(this)) {
|
|
119
119
|
return html`
|
|
120
120
|
<button
|
|
121
121
|
id="item"
|
|
@@ -3,15 +3,14 @@ import { property, query } from 'lit/decorators.js';
|
|
|
3
3
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
4
|
import styles from './menu-item.scss';
|
|
5
5
|
import colorStyles from './menu-item-colors.scss';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import NativeButtonMixin from '@/__mixins/NativeButtonMixin.js';
|
|
7
|
+
import NativeHyperlinkMixin from '@/__mixins/NativeHyperlinkMixin.js';
|
|
8
8
|
import { Item } from '@/item/item.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @label Menu Item
|
|
12
12
|
* @tag wc-menu-item
|
|
13
13
|
* @rawTag menu-item
|
|
14
|
-
* @parentRawTag menu
|
|
15
14
|
* @summary An item in a menu list.
|
|
16
15
|
* @tags navigation
|
|
17
16
|
*
|
|
@@ -20,7 +19,9 @@ import { Item } from '@/item/item.js';
|
|
|
20
19
|
* <wc-menu-item>Menu Item</wc-menu-item>
|
|
21
20
|
* ```
|
|
22
21
|
*/
|
|
23
|
-
export class MenuItem extends
|
|
22
|
+
export class MenuItem extends NativeButtonMixin(
|
|
23
|
+
NativeHyperlinkMixin(LitElement),
|
|
24
|
+
) {
|
|
24
25
|
@property({ type: String }) value = '';
|
|
25
26
|
|
|
26
27
|
@property({ type: Boolean, reflect: true }) selected = false;
|
|
@@ -80,7 +81,9 @@ export class MenuItem extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
80
81
|
|
|
81
82
|
private _hasNamedSlot(...names: string[]) {
|
|
82
83
|
return names.some(name =>
|
|
83
|
-
Array.from(this.children).some(
|
|
84
|
+
Array.from(this.children).some(
|
|
85
|
+
child => child.getAttribute('slot') === name,
|
|
86
|
+
),
|
|
84
87
|
);
|
|
85
88
|
}
|
|
86
89
|
|
|
@@ -115,8 +118,12 @@ export class MenuItem extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
115
118
|
.rel=${this.rel}
|
|
116
119
|
.download=${this.download}
|
|
117
120
|
aria-haspopup=${this.hasSubmenu ? 'menu' : nothing}
|
|
118
|
-
aria-controls=${ifDefined(
|
|
119
|
-
|
|
121
|
+
aria-controls=${ifDefined(
|
|
122
|
+
this.hasSubmenu && controls ? controls : undefined,
|
|
123
|
+
)}
|
|
124
|
+
aria-expanded=${ifDefined(
|
|
125
|
+
this.hasSubmenu ? String(this.submenuOpen) : undefined,
|
|
126
|
+
)}
|
|
120
127
|
>
|
|
121
128
|
${this.renderContent()}
|
|
122
129
|
</wc-item>
|
|
@@ -139,7 +146,9 @@ export class MenuItem extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
|
139
146
|
${hasOverline
|
|
140
147
|
? html`<slot name="overline" slot="overline"></slot>`
|
|
141
148
|
: nothing}
|
|
142
|
-
${hasHeadline
|
|
149
|
+
${hasHeadline
|
|
150
|
+
? html`<slot name="headline" slot="headline"></slot>`
|
|
151
|
+
: nothing}
|
|
143
152
|
${hasDefault ? html`<slot></slot>` : nothing}
|
|
144
153
|
${hasSupportingText
|
|
145
154
|
? html`<slot name="supporting-text" slot="supporting-text"></slot>`
|
|
@@ -99,6 +99,11 @@
|
|
|
99
99
|
font-weight var(--duration-short4, 200ms) var(--easing-standard, ease);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/* Hide label when collapsed via class */
|
|
103
|
+
.label.hidden {
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
102
107
|
/* Active icon slot: hidden by default */
|
|
103
108
|
.active-icon-slot {
|
|
104
109
|
display: none;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { html, LitElement, nothing } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
dispatchActivationClick,
|
|
6
|
+
isActivationClick,
|
|
7
|
+
} from '@/__utils/dispatch-event-utils.js';
|
|
5
8
|
import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
|
|
6
9
|
import { throttle } from '@/__utils/throttle.js';
|
|
10
|
+
import { isLink } from '@/__utils/is-link.js';
|
|
7
11
|
import styles from './navigation-rail-item.scss';
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* @label Navigation Rail Item
|
|
11
15
|
* @tag wc-navigation-rail-item
|
|
12
16
|
* @rawTag navigation-rail-item
|
|
13
|
-
* @parentRawTag navigation-rail
|
|
14
17
|
*
|
|
15
18
|
* @summary An individual item within a navigation rail.
|
|
16
19
|
* @overview
|
|
@@ -77,7 +80,7 @@ export class NavigationRailItem extends LitElement {
|
|
|
77
80
|
);
|
|
78
81
|
|
|
79
82
|
observerSlotChangesWithCallback(
|
|
80
|
-
this.renderRoot.querySelector('slot
|
|
83
|
+
this.renderRoot.querySelector('slot.label'),
|
|
81
84
|
hasContent => {
|
|
82
85
|
this._hasLabel = hasContent;
|
|
83
86
|
this.requestUpdate();
|
|
@@ -85,7 +88,7 @@ export class NavigationRailItem extends LitElement {
|
|
|
85
88
|
);
|
|
86
89
|
|
|
87
90
|
observerSlotChangesWithCallback(
|
|
88
|
-
this.renderRoot.querySelector('slot
|
|
91
|
+
this.renderRoot.querySelector('slot.active-icon-slot'),
|
|
89
92
|
hasContent => {
|
|
90
93
|
this._hasActiveIcon = hasContent;
|
|
91
94
|
this.requestUpdate();
|
|
@@ -128,10 +131,6 @@ export class NavigationRailItem extends LitElement {
|
|
|
128
131
|
}
|
|
129
132
|
};
|
|
130
133
|
|
|
131
|
-
__isLink() {
|
|
132
|
-
return !!this.href;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
134
|
__getDisabledReasonID() {
|
|
136
135
|
return this.disabled && this.disabledReason
|
|
137
136
|
? `disabled-reason-${this.#id}`
|
|
@@ -154,7 +153,7 @@ export class NavigationRailItem extends LitElement {
|
|
|
154
153
|
|
|
155
154
|
__renderItemContent() {
|
|
156
155
|
return html`
|
|
157
|
-
<wc-focus-ring class="focus-ring" for=
|
|
156
|
+
<wc-focus-ring class="focus-ring" for="item"></wc-focus-ring>
|
|
158
157
|
|
|
159
158
|
<div class="item-content">
|
|
160
159
|
<div class="indicator">
|
|
@@ -164,9 +163,7 @@ export class NavigationRailItem extends LitElement {
|
|
|
164
163
|
<slot name="icon" class="icon-slot"></slot>
|
|
165
164
|
</div>
|
|
166
165
|
</div>
|
|
167
|
-
${this.
|
|
168
|
-
? html`<div class="label"><slot></slot></div>`
|
|
169
|
-
: html`<slot class="hidden-slot"></slot>`}
|
|
166
|
+
<div class="label ${this.collapsed ? 'hidden' : ''}"><slot></slot></div>
|
|
170
167
|
</div>
|
|
171
168
|
|
|
172
169
|
${this.__renderDisabledReason()}
|
|
@@ -174,8 +171,6 @@ export class NavigationRailItem extends LitElement {
|
|
|
174
171
|
}
|
|
175
172
|
|
|
176
173
|
render() {
|
|
177
|
-
const isLink = this.__isLink();
|
|
178
|
-
|
|
179
174
|
const cssClasses = {
|
|
180
175
|
item: true,
|
|
181
176
|
'item-element': true,
|
|
@@ -186,7 +181,7 @@ export class NavigationRailItem extends LitElement {
|
|
|
186
181
|
'has-active-icon': this._hasActiveIcon,
|
|
187
182
|
};
|
|
188
183
|
|
|
189
|
-
if (!isLink) {
|
|
184
|
+
if (!isLink(this)) {
|
|
190
185
|
return html`<button
|
|
191
186
|
id="item"
|
|
192
187
|
class=${classMap(cssClasses)}
|
package/src/peacock-loader.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Avatar } from './avatar/avatar.js';
|
|
|
9
9
|
import { Badge } from './badge/badge.js';
|
|
10
10
|
import { Divider } from './divider/divider.js';
|
|
11
11
|
import { Button } from './button/button/button.js';
|
|
12
|
-
import
|
|
12
|
+
import ButtonGroup from './button/button-group/button-group.js';
|
|
13
13
|
import { IconButton } from './button/icon-button/icon-button.js';
|
|
14
14
|
import { Fab } from './fab/fab.js';
|
|
15
15
|
import { SegmentedButton } from './segmented-button/segmented-button.js';
|
|
@@ -9,7 +9,6 @@ import styles from './popover-content.scss';
|
|
|
9
9
|
* @tag wc-popover-content
|
|
10
10
|
* @rawTag popover-content
|
|
11
11
|
* @summary Content container for the wc-popover component.
|
|
12
|
-
* @parentRawTag popover
|
|
13
12
|
* @tags display
|
|
14
13
|
*
|
|
15
14
|
* @cssprop --popover-content-background - Background color of the popover content. Defaults to `var(--color-surface-container)`.
|
package/src/ripple/ripple.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { LitElement, html, css, PropertyValues } from 'lit';
|
|
1
|
+
import { LitElement, html, css, PropertyValues, isServer } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import {
|
|
5
|
+
Attachable,
|
|
6
|
+
AttachableController,
|
|
7
|
+
} from '@/__controllers/attachable-controller.js';
|
|
4
8
|
|
|
5
9
|
const PRESS_GROW_MS = 450;
|
|
6
10
|
const MINIMUM_PRESS_MS = 225;
|
|
@@ -114,7 +118,7 @@ const FORCED_COLORS = window.matchMedia('(forced-colors: active)');
|
|
|
114
118
|
* ```
|
|
115
119
|
* @tags display
|
|
116
120
|
*/
|
|
117
|
-
export class Ripple extends LitElement {
|
|
121
|
+
export class Ripple extends LitElement implements Attachable {
|
|
118
122
|
static styles = css`
|
|
119
123
|
:host {
|
|
120
124
|
display: flex;
|
|
@@ -154,13 +158,16 @@ export class Ripple extends LitElement {
|
|
|
154
158
|
&::before {
|
|
155
159
|
background-color: var(--ripple-pressed-color, var(--color-on-surface));
|
|
156
160
|
inset: 0;
|
|
157
|
-
transition:
|
|
161
|
+
transition:
|
|
162
|
+
opacity 15ms linear,
|
|
163
|
+
background-color 15ms linear;
|
|
158
164
|
}
|
|
159
165
|
|
|
160
166
|
&::after {
|
|
161
167
|
background: radial-gradient(
|
|
162
168
|
closest-side,
|
|
163
|
-
var(--ripple-pressed-color, var(--color-on-surface))
|
|
169
|
+
var(--ripple-pressed-color, var(--color-on-surface))
|
|
170
|
+
max(calc(100% - 70px), 65%),
|
|
164
171
|
transparent 100%
|
|
165
172
|
);
|
|
166
173
|
transform-origin: center center;
|
|
@@ -184,7 +191,7 @@ export class Ripple extends LitElement {
|
|
|
184
191
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
185
192
|
|
|
186
193
|
@state() private hovered = false;
|
|
187
|
-
|
|
194
|
+
|
|
188
195
|
@state() private pressed = false;
|
|
189
196
|
|
|
190
197
|
@query('.surface') private readonly mdRoot!: HTMLElement | null;
|
|
@@ -201,13 +208,36 @@ export class Ripple extends LitElement {
|
|
|
201
208
|
|
|
202
209
|
private rippleStartEvent?: PointerEvent;
|
|
203
210
|
|
|
211
|
+
private readonly _boundHandleEvent = this.handleEvent.bind(this);
|
|
212
|
+
|
|
213
|
+
get htmlFor() {
|
|
214
|
+
return this.attachableController.htmlFor;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
set htmlFor(htmlFor: string | null) {
|
|
218
|
+
this.attachableController.htmlFor = htmlFor;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
get control() {
|
|
222
|
+
return this.attachableController.control;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
set control(control: HTMLElement | null) {
|
|
226
|
+
this.attachableController.control = control;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
private readonly attachableController = new AttachableController(
|
|
230
|
+
// `LitElement` satisfies the ReactiveControllerHost & HTMLElement shape
|
|
231
|
+
// required by the controller.
|
|
232
|
+
this,
|
|
233
|
+
this.onControlChange.bind(this),
|
|
234
|
+
);
|
|
235
|
+
|
|
204
236
|
override connectedCallback() {
|
|
205
237
|
super.connectedCallback();
|
|
206
238
|
// Needed for VoiceOver, which will create a "group" if the element is a
|
|
207
239
|
// sibling to other content.
|
|
208
240
|
this.setAttribute('aria-hidden', 'true');
|
|
209
|
-
// Attach to parent
|
|
210
|
-
this.attach(this.parentElement!);
|
|
211
241
|
}
|
|
212
242
|
|
|
213
243
|
override disconnectedCallback() {
|
|
@@ -216,24 +246,26 @@ export class Ripple extends LitElement {
|
|
|
216
246
|
}
|
|
217
247
|
|
|
218
248
|
attach(control: HTMLElement) {
|
|
219
|
-
|
|
220
|
-
EVENTS.forEach(event => {
|
|
221
|
-
control.addEventListener(event, this.handleEvent.bind(this));
|
|
222
|
-
});
|
|
249
|
+
this.attachableController.attach(control);
|
|
223
250
|
}
|
|
224
251
|
|
|
225
252
|
detach() {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
253
|
+
this.attachableController.detach();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
private onControlChange(prev: HTMLElement | null, next: HTMLElement | null) {
|
|
257
|
+
if (isServer) return;
|
|
258
|
+
|
|
259
|
+
for (const event of EVENTS) {
|
|
260
|
+
prev?.removeEventListener(event, this._boundHandleEvent);
|
|
261
|
+
next?.addEventListener(event, this._boundHandleEvent);
|
|
262
|
+
}
|
|
231
263
|
}
|
|
232
264
|
|
|
233
265
|
protected override render() {
|
|
234
266
|
const classes = {
|
|
235
|
-
|
|
236
|
-
|
|
267
|
+
hovered: this.hovered,
|
|
268
|
+
pressed: this.pressed,
|
|
237
269
|
};
|
|
238
270
|
|
|
239
271
|
return html`<div class="surface ${classMap(classes)}"></div>`;
|
|
@@ -299,7 +331,7 @@ export class Ripple extends LitElement {
|
|
|
299
331
|
|
|
300
332
|
// Wait for a hold after touch delay
|
|
301
333
|
this.state = State.TOUCH_DELAY;
|
|
302
|
-
await new Promise(
|
|
334
|
+
await new Promise(resolve => {
|
|
303
335
|
setTimeout(resolve, TOUCH_DELAY_MS);
|
|
304
336
|
});
|
|
305
337
|
|
|
@@ -438,7 +470,7 @@ export class Ripple extends LitElement {
|
|
|
438
470
|
return;
|
|
439
471
|
}
|
|
440
472
|
|
|
441
|
-
await new Promise(
|
|
473
|
+
await new Promise(resolve => {
|
|
442
474
|
setTimeout(resolve, MINIMUM_PRESS_MS - pressAnimationPlayState);
|
|
443
475
|
});
|
|
444
476
|
|
package/src/search/search.scss
CHANGED
|
@@ -32,15 +32,18 @@
|
|
|
32
32
|
|
|
33
33
|
/* size-md default */
|
|
34
34
|
--_height: 3.5rem;
|
|
35
|
+
--icon-size: 1.25rem;
|
|
35
36
|
|
|
36
37
|
&.size-sm {
|
|
37
38
|
--_height: 2.5rem;
|
|
38
39
|
padding-inline: 0.75rem;
|
|
40
|
+
--icon-size: 1rem;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
&.size-lg {
|
|
42
44
|
--_height: 4rem;
|
|
43
45
|
padding-inline: 1.25rem;
|
|
46
|
+
--icon-size: 1.5rem;
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
min-height: var(--_height);
|
|
@@ -8,7 +8,6 @@ import styles from './segmented-button.scss';
|
|
|
8
8
|
* @tag wc-segmented-button
|
|
9
9
|
* @rawTag segmented-button
|
|
10
10
|
* @summary An individual segment within a segmented button group.
|
|
11
|
-
* @parentRawTag segmented-button-group
|
|
12
11
|
* @overview
|
|
13
12
|
* <p>Segmented buttons help people select options, switch views, or sort elements. They are used within a <code>wc-segmented-button-group</code>.</p>
|
|
14
13
|
*
|