@redvars/peacock 3.6.2 → 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-Dwnez1tR.js +586 -0
- 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 +236 -133
- 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/canvas.js +126 -107
- package/dist/canvas.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 +5079 -17882
- package/dist/custom-elements.json +19272 -19314
- package/dist/fab.js +181 -117
- package/dist/fab.js.map +1 -1
- package/dist/flow-designer.js +4 -4
- package/dist/icon-button-DJ0kZXYr.js +318 -0
- package/dist/icon-button-DJ0kZXYr.js.map +1 -0
- package/dist/index.js +7 -7
- package/dist/{navigation-rail-CD7IrqbN.js → navigation-rail-CM_svs5_.js} +1311 -730
- 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 +10 -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 +15 -15
- 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/canvas/canvas.d.ts +3 -3
- 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/field/field.d.ts +1 -0
- package/dist/src/focus-ring/focus-ring.d.ts +26 -20
- package/dist/src/image/image.d.ts +2 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/input/input.d.ts +1 -3
- package/dist/src/item/index.d.ts +1 -0
- package/dist/src/item/item.d.ts +49 -0
- 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 +9 -11
- package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -1
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +0 -2
- package/dist/src/navigation-rail/navigation-rail.d.ts +2 -6
- package/dist/src/popover/popover-content.d.ts +0 -1
- package/dist/src/ripple/ripple.d.ts +9 -1
- package/dist/src/search/search.d.ts +2 -6
- 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/test/item.test.d.ts +1 -0
- 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 +33 -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 +31 -53
- package/src/button/button/button.scss +139 -262
- package/src/button/button/button.ts +260 -106
- 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 +12 -27
- package/src/button/icon-button/icon-button.ts +191 -83
- 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/canvas/canvas.scss +18 -6
- package/src/canvas/canvas.ts +125 -103
- 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 +66 -71
- 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/empty-state/empty-state.scss +1 -0
- 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/field/field.ts +6 -0
- package/src/focus-ring/focus-ring.ts +81 -72
- package/src/image/image.scss +21 -16
- package/src/image/image.ts +13 -14
- package/src/index.ts +1 -0
- package/src/input/input.ts +16 -25
- package/src/item/index.ts +1 -0
- package/src/item/item.scss +195 -0
- package/src/item/item.ts +362 -0
- 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/menu.ts +5 -9
- package/src/menu/menu-item/menu-item.scss +30 -108
- package/src/menu/menu-item/menu-item.ts +102 -133
- package/src/menu/sub-menu/sub-menu.ts +6 -3
- package/src/navigation-rail/navigation-rail-item.scss +5 -0
- package/src/navigation-rail/navigation-rail-item.ts +10 -15
- package/src/navigation-rail/navigation-rail.ts +2 -6
- package/src/peacock-loader.ts +5 -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/search/search.ts +11 -16
- package/src/segmented-button/segmented-button.ts +0 -1
- package/src/select/option.ts +1 -2
- package/src/select/select.scss +1 -10
- package/src/select/select.ts +2 -0
- 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-AvGh22Zn.js +0 -561
- package/dist/button-colors-AvGh22Zn.js.map +0 -1
- package/dist/icon-button-ohxHhy4t.js +0 -247
- package/dist/icon-button-ohxHhy4t.js.map +0 -1
- package/dist/navigation-rail-CD7IrqbN.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/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';
|
|
@@ -30,6 +30,7 @@ import { Radio } from './radio/radio.js';
|
|
|
30
30
|
import { Menu } from './menu/menu/menu.js';
|
|
31
31
|
import { MenuItem } from './menu/menu-item/menu-item.js';
|
|
32
32
|
import { SubMenu } from './menu/sub-menu/sub-menu.js';
|
|
33
|
+
import { Item } from './item/item.js';
|
|
33
34
|
import { List } from './list/list.js';
|
|
34
35
|
import { ListItem } from './list/list-item.js';
|
|
35
36
|
|
|
@@ -290,6 +291,9 @@ const loaderConfig: LoaderConfig = {
|
|
|
290
291
|
'wc-list-item': {
|
|
291
292
|
CustomElementClass: ListItem,
|
|
292
293
|
},
|
|
294
|
+
'wc-item': {
|
|
295
|
+
CustomElementClass: Item,
|
|
296
|
+
},
|
|
293
297
|
'wc-container': {
|
|
294
298
|
CustomElementClass: Container,
|
|
295
299
|
},
|
|
@@ -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
|
-
* @childComponent true
|
|
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);
|
package/src/search/search.ts
CHANGED
|
@@ -97,16 +97,15 @@ export class Search extends LitElement {
|
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
override async focus() {
|
|
101
|
+
await Promise.all([
|
|
102
|
+
customElements.whenDefined('wc-input'),
|
|
103
|
+
customElements.whenDefined('wc-field'),
|
|
104
|
+
]);
|
|
105
|
+
await this.updateComplete;
|
|
102
106
|
this.inputElement?.focus();
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
/** Blurs the internal input element. */
|
|
106
|
-
override blur() {
|
|
107
|
-
this.inputElement?.blur();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
109
|
private __handleInput(event: InputEvent) {
|
|
111
110
|
const input = event.target as HTMLInputElement;
|
|
112
111
|
this.value = input.value;
|
|
@@ -150,13 +149,9 @@ export class Search extends LitElement {
|
|
|
150
149
|
}
|
|
151
150
|
}
|
|
152
151
|
|
|
153
|
-
private
|
|
154
|
-
this.focused =
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
private __handleBlur() {
|
|
158
|
-
this.focused = false;
|
|
159
|
-
}
|
|
152
|
+
private __handleFocusChange = (event: FocusEvent) => {
|
|
153
|
+
this.focused = event.type === 'focus';
|
|
154
|
+
};
|
|
160
155
|
|
|
161
156
|
private __clearValue() {
|
|
162
157
|
this.value = '';
|
|
@@ -230,8 +225,8 @@ export class Search extends LitElement {
|
|
|
230
225
|
@input=${this.__handleInput}
|
|
231
226
|
@change=${this.__handleChange}
|
|
232
227
|
@keydown=${this.__handleKeydown}
|
|
233
|
-
@focus=${this.
|
|
234
|
-
@blur=${this.
|
|
228
|
+
@focus=${this.__handleFocusChange}
|
|
229
|
+
@blur=${this.__handleFocusChange}
|
|
235
230
|
/>
|
|
236
231
|
|
|
237
232
|
<div class="trailing-actions">
|
|
@@ -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
|
*
|
package/src/select/option.ts
CHANGED
|
@@ -6,7 +6,6 @@ import type { MenuItem } from '../menu/menu-item/menu-item.js';
|
|
|
6
6
|
* @label Select Option
|
|
7
7
|
* @tag wc-option
|
|
8
8
|
* @rawTag option
|
|
9
|
-
* @parentRawTag select
|
|
10
9
|
*
|
|
11
10
|
* @summary A declarative option element for use inside wc-select.
|
|
12
11
|
*
|
|
@@ -94,7 +93,7 @@ export class SelectOptionElement extends LitElement {
|
|
|
94
93
|
?keep-open=${this.keepOpen}
|
|
95
94
|
>
|
|
96
95
|
${this.icon
|
|
97
|
-
? html`<wc-icon name=${this.icon} slot="
|
|
96
|
+
? html`<wc-icon name=${this.icon} slot="start"></wc-icon>`
|
|
98
97
|
: nothing}
|
|
99
98
|
<slot>${this.value === '' ? 'None' : ''}</slot>
|
|
100
99
|
${this.selected && this.keepOpen
|
package/src/select/select.scss
CHANGED
|
@@ -98,18 +98,9 @@
|
|
|
98
98
|
/* Multi-select chips area — single scrollable row, no vertical growth */
|
|
99
99
|
.chips-container {
|
|
100
100
|
display: flex;
|
|
101
|
-
flex-wrap: nowrap;
|
|
102
|
-
overflow-x: auto;
|
|
103
|
-
scrollbar-width: none;
|
|
104
|
-
gap: var(--spacing-050);
|
|
105
|
-
padding-block: var(--spacing-050);
|
|
106
101
|
align-items: center;
|
|
107
102
|
flex: 1;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
&::-webkit-scrollbar {
|
|
111
|
-
display: none;
|
|
112
|
-
}
|
|
103
|
+
padding-block: .5rem;
|
|
113
104
|
}
|
|
114
105
|
|
|
115
106
|
/* Disabled state */
|
package/src/select/select.ts
CHANGED
|
@@ -430,6 +430,7 @@ export class Select extends BaseInput {
|
|
|
430
430
|
// Multi-select: show chips for selected items
|
|
431
431
|
if (this.multiple && this._selectedValues.length > 0) {
|
|
432
432
|
return html`<div class="chips-container">
|
|
433
|
+
<wc-chip-set>
|
|
433
434
|
${this._selectedValues.map(
|
|
434
435
|
val => html`
|
|
435
436
|
<wc-chip
|
|
@@ -441,6 +442,7 @@ export class Select extends BaseInput {
|
|
|
441
442
|
>
|
|
442
443
|
`,
|
|
443
444
|
)}
|
|
445
|
+
</wc-chip-set>
|
|
444
446
|
</div>`;
|
|
445
447
|
}
|
|
446
448
|
|
|
@@ -7,7 +7,6 @@ import styles from './sidebar-menu-item.scss';
|
|
|
7
7
|
* @label Sidebar Menu Item
|
|
8
8
|
* @tag wc-sidebar-menu-item
|
|
9
9
|
* @rawTag sidebar-menu-item
|
|
10
|
-
* @parentRawTag sidebar-menu
|
|
11
10
|
* @summary A sidebar menu item represents a selectable leaf item in the sidebar navigation tree.
|
|
12
11
|
*
|
|
13
12
|
* @example
|
|
@@ -8,7 +8,6 @@ import styles from './sidebar-sub-menu.scss';
|
|
|
8
8
|
* @label Sidebar Sub Menu
|
|
9
9
|
* @tag wc-sidebar-sub-menu
|
|
10
10
|
* @rawTag sidebar-sub-menu
|
|
11
|
-
* @parentRawTag sidebar-menu
|
|
12
11
|
* @summary A sidebar sub menu groups sidebar menu items and handles expand/collapse behavior.
|
|
13
12
|
*
|
|
14
13
|
* @example
|
|
@@ -18,7 +18,11 @@
|
|
|
18
18
|
.skeleton::before {
|
|
19
19
|
inset: 0;
|
|
20
20
|
position: absolute;
|
|
21
|
-
|
|
21
|
+
border-start-start-radius: var(--skeleton-container-shape-start-start, var(--skeleton-container-shape));
|
|
22
|
+
border-start-end-radius: var(--skeleton-container-shape-start-end, var(--skeleton-container-shape));
|
|
23
|
+
border-end-start-radius: var(--skeleton-container-shape-end-start, var(--skeleton-container-shape));
|
|
24
|
+
border-end-end-radius: var(--skeleton-container-shape-end-end, var(--skeleton-container-shape));
|
|
25
|
+
corner-shape: var(--skeleton-container-shape-variant);
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
.skeleton {
|
package/src/tabs/tab-panel.ts
CHANGED
package/src/tabs/tab.ts
CHANGED
|
@@ -2,9 +2,13 @@ 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
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
dispatchActivationClick,
|
|
7
|
+
isActivationClick,
|
|
8
|
+
} from '@/__utils/dispatch-event-utils.js';
|
|
6
9
|
import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
|
|
7
10
|
import { throttle } from '@/__utils/throttle.js';
|
|
11
|
+
import { isLink } from '@/__utils/is-link.js';
|
|
8
12
|
import { spread } from '@/__directive/spread.js';
|
|
9
13
|
|
|
10
14
|
import styles from './tab.scss';
|
|
@@ -14,7 +18,6 @@ import type { Tabs } from './tabs.js';
|
|
|
14
18
|
* @label Tab
|
|
15
19
|
* @tag wc-tab
|
|
16
20
|
* @rawTag tab
|
|
17
|
-
* @parentRawTag tabs
|
|
18
21
|
*
|
|
19
22
|
* @summary A tab component for use within tabs.
|
|
20
23
|
* @overview
|
|
@@ -27,13 +30,12 @@ import type { Tabs } from './tabs.js';
|
|
|
27
30
|
* @tags navigation
|
|
28
31
|
*/
|
|
29
32
|
export class Tab extends LitElement {
|
|
30
|
-
|
|
31
33
|
#id = crypto.randomUUID();
|
|
32
34
|
|
|
33
35
|
static styles = [styles];
|
|
34
36
|
|
|
35
37
|
@property({ type: Boolean, reflect: true }) active = false;
|
|
36
|
-
|
|
38
|
+
|
|
37
39
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
38
40
|
|
|
39
41
|
@property({ type: String }) disabledReason = '';
|
|
@@ -43,7 +45,7 @@ export class Tab extends LitElement {
|
|
|
43
45
|
@property({ reflect: true })
|
|
44
46
|
configAria?: { [key: string]: any };
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
/**
|
|
47
49
|
* Sets or retrieves the window or frame at which to target content.
|
|
48
50
|
*/
|
|
49
51
|
@property() target: string = '_self';
|
|
@@ -63,11 +65,11 @@ export class Tab extends LitElement {
|
|
|
63
65
|
|
|
64
66
|
@state() slotHasBadge = false;
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
/**
|
|
69
|
+
* States
|
|
70
|
+
*/
|
|
71
|
+
@state()
|
|
72
|
+
isPressed = false;
|
|
71
73
|
|
|
72
74
|
private _tabindex = 0;
|
|
73
75
|
|
|
@@ -81,7 +83,6 @@ export class Tab extends LitElement {
|
|
|
81
83
|
this.tabElement?.blur();
|
|
82
84
|
}
|
|
83
85
|
|
|
84
|
-
|
|
85
86
|
constructor() {
|
|
86
87
|
super();
|
|
87
88
|
this._tabindex = 0;
|
|
@@ -118,28 +119,28 @@ export class Tab extends LitElement {
|
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
__dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
126
|
-
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
127
|
-
// prevent the click from propagating to other event listeners as well as
|
|
128
|
-
// prevent the default action.
|
|
129
|
-
if (this.disabled && this.href) {
|
|
130
|
-
event.stopImmediatePropagation();
|
|
131
|
-
event.preventDefault();
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (!isActivationClick(event) || !this.tabElement) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
this.focus();
|
|
140
|
-
dispatchActivationClick(this.tabElement);
|
|
122
|
+
event => {
|
|
123
|
+
this.__dispatchClick(event);
|
|
141
124
|
};
|
|
142
125
|
|
|
126
|
+
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
127
|
+
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
128
|
+
// prevent the click from propagating to other event listeners as well as
|
|
129
|
+
// prevent the default action.
|
|
130
|
+
if (this.disabled && this.href) {
|
|
131
|
+
event.stopImmediatePropagation();
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!isActivationClick(event) || !this.tabElement) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this.focus();
|
|
141
|
+
dispatchActivationClick(this.tabElement);
|
|
142
|
+
};
|
|
143
|
+
|
|
143
144
|
__handlePress = (event: KeyboardEvent | MouseEvent) => {
|
|
144
145
|
if (this.disabled) return;
|
|
145
146
|
if (
|
|
@@ -155,10 +156,6 @@ export class Tab extends LitElement {
|
|
|
155
156
|
}
|
|
156
157
|
};
|
|
157
158
|
|
|
158
|
-
__isLink() {
|
|
159
|
-
return !!this.href;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
159
|
__getParentTabsVariant(): Tabs['variant'] {
|
|
163
160
|
return (this.closest('wc-tabs') as Tabs | null)?.variant ?? 'primary';
|
|
164
161
|
}
|
|
@@ -172,10 +169,7 @@ export class Tab extends LitElement {
|
|
|
172
169
|
// }
|
|
173
170
|
// }
|
|
174
171
|
|
|
175
|
-
|
|
176
172
|
render() {
|
|
177
|
-
|
|
178
|
-
const isLink = this.__isLink();
|
|
179
173
|
const variant = this.__getParentTabsVariant();
|
|
180
174
|
|
|
181
175
|
const cssClasses = {
|
|
@@ -190,40 +184,39 @@ export class Tab extends LitElement {
|
|
|
190
184
|
'has-badge': this.slotHasBadge,
|
|
191
185
|
};
|
|
192
186
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return html`<button
|
|
196
|
-
id="button"
|
|
197
|
-
class=${classMap(cssClasses)}
|
|
198
|
-
tabindex="0"
|
|
199
|
-
@mousedown=${this.__handlePress}
|
|
200
|
-
@keydown=${this.__handlePress}
|
|
201
|
-
@keyup=${this.__handlePress}
|
|
202
|
-
?aria-describedby=${this.__getDisabledReasonID()}
|
|
203
|
-
aria-disabled=${`${this.disabled}`}
|
|
204
|
-
?disabled=${this.disabled}
|
|
205
|
-
${spread(this.configAria)}
|
|
206
|
-
>
|
|
207
|
-
${this.renderTabContent(variant)}
|
|
208
|
-
</button>`;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return html`<a
|
|
212
|
-
class=${classMap(cssClasses)}
|
|
187
|
+
if (!isLink(this)) {
|
|
188
|
+
return html`<button
|
|
213
189
|
id="button"
|
|
190
|
+
class=${classMap(cssClasses)}
|
|
214
191
|
tabindex="0"
|
|
215
|
-
href=${this.href}
|
|
216
|
-
target=${this.target}
|
|
217
192
|
@mousedown=${this.__handlePress}
|
|
218
193
|
@keydown=${this.__handlePress}
|
|
219
194
|
@keyup=${this.__handlePress}
|
|
220
|
-
role="button"
|
|
221
195
|
?aria-describedby=${this.__getDisabledReasonID()}
|
|
222
196
|
aria-disabled=${`${this.disabled}`}
|
|
197
|
+
?disabled=${this.disabled}
|
|
223
198
|
${spread(this.configAria)}
|
|
224
199
|
>
|
|
225
200
|
${this.renderTabContent(variant)}
|
|
226
|
-
</
|
|
201
|
+
</button>`;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return html`<a
|
|
205
|
+
class=${classMap(cssClasses)}
|
|
206
|
+
id="button"
|
|
207
|
+
tabindex="0"
|
|
208
|
+
href=${this.href}
|
|
209
|
+
target=${this.target}
|
|
210
|
+
@mousedown=${this.__handlePress}
|
|
211
|
+
@keydown=${this.__handlePress}
|
|
212
|
+
@keyup=${this.__handlePress}
|
|
213
|
+
role="button"
|
|
214
|
+
?aria-describedby=${this.__getDisabledReasonID()}
|
|
215
|
+
aria-disabled=${`${this.disabled}`}
|
|
216
|
+
${spread(this.configAria)}
|
|
217
|
+
>
|
|
218
|
+
${this.renderTabContent(variant)}
|
|
219
|
+
</a>`;
|
|
227
220
|
}
|
|
228
221
|
|
|
229
222
|
renderTabContent(variant: Tabs['variant']) {
|
|
@@ -242,14 +235,13 @@ export class Tab extends LitElement {
|
|
|
242
235
|
|
|
243
236
|
renderPrimaryTabContent() {
|
|
244
237
|
return html`
|
|
245
|
-
<wc-focus-ring class="focus-ring" for=
|
|
238
|
+
<wc-focus-ring class="focus-ring" for="button"></wc-focus-ring>
|
|
246
239
|
<wc-elevation class="elevation"></wc-elevation>
|
|
247
240
|
<div class="background"></div>
|
|
248
241
|
<div class="outline"></div>
|
|
249
242
|
<wc-ripple class="ripple"></wc-ripple>
|
|
250
|
-
|
|
251
|
-
<div class="tab-content">
|
|
252
243
|
|
|
244
|
+
<div class="tab-content">
|
|
253
245
|
<div class="icon-section">
|
|
254
246
|
<slot name="badge"></slot>
|
|
255
247
|
<slot name="icon"></slot>
|
|
@@ -259,7 +251,6 @@ export class Tab extends LitElement {
|
|
|
259
251
|
</div>
|
|
260
252
|
|
|
261
253
|
<div class="indicator"></div>
|
|
262
|
-
|
|
263
254
|
</div>
|
|
264
255
|
|
|
265
256
|
${this.__renderDisabledReason()}
|
|
@@ -268,14 +259,13 @@ export class Tab extends LitElement {
|
|
|
268
259
|
|
|
269
260
|
renderSecondaryTabContent() {
|
|
270
261
|
return html`
|
|
271
|
-
<wc-focus-ring class="focus-ring" for=
|
|
262
|
+
<wc-focus-ring class="focus-ring" for="button"></wc-focus-ring>
|
|
272
263
|
<wc-elevation class="elevation"></wc-elevation>
|
|
273
264
|
<div class="background"></div>
|
|
274
265
|
<div class="outline"></div>
|
|
275
266
|
<wc-ripple class="ripple"></wc-ripple>
|
|
276
|
-
|
|
277
|
-
<div class="tab-content">
|
|
278
267
|
|
|
268
|
+
<div class="tab-content">
|
|
279
269
|
<slot name="icon"></slot>
|
|
280
270
|
|
|
281
271
|
<div class="slot-container">
|
|
@@ -301,7 +291,7 @@ export class Tab extends LitElement {
|
|
|
301
291
|
|
|
302
292
|
renderSegmentedTabContent() {
|
|
303
293
|
return html`
|
|
304
|
-
<wc-focus-ring class="focus-ring" for=
|
|
294
|
+
<wc-focus-ring class="focus-ring" for="button"></wc-focus-ring>
|
|
305
295
|
<wc-elevation class="elevation"></wc-elevation>
|
|
306
296
|
<div class="background"></div>
|
|
307
297
|
<div class="outline"></div>
|
|
@@ -1,35 +1,17 @@
|
|
|
1
1
|
@use "../../scss/mixin";
|
|
2
|
-
@use "sass:string";
|
|
3
2
|
|
|
4
3
|
@include mixin.base-styles;
|
|
5
4
|
|
|
6
|
-
@mixin _apply-typography($value-type) {
|
|
7
|
-
@include mixin.get-typography(#{$value-type});
|
|
8
|
-
@if string.index($value-type, "body") {
|
|
9
|
-
margin-block-end: var(--spacing-200);
|
|
10
|
-
}
|
|
11
|
-
@if string.index($value-type, "headline") {
|
|
12
|
-
margin-block-end: var(--spacing-200);
|
|
13
|
-
}
|
|
14
|
-
@if string.index($value-type, "display") {
|
|
15
|
-
margin-block-end: var(--spacing-400);
|
|
16
|
-
}
|
|
17
|
-
@if string.index($value-type, "title") {
|
|
18
|
-
margin-block-end: var(--spacing-400);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
5
|
/// Mixin to define text classes for a specific type and value-type
|
|
23
6
|
/// @param {String} $type - The type name to be used in the class name (e.g., .text-#{$type})
|
|
24
|
-
/// @param {String} $value-type - The value-type name to be passed to get-typography
|
|
25
|
-
/// @param {Boolean} $important [true] - Whether to use !important in typography properties
|
|
7
|
+
/// @param {String} $value-type - The value-type name to be passed to get-typography
|
|
26
8
|
@mixin define-text-classes($type, $value-type) {
|
|
27
9
|
.text-#{$type} {
|
|
28
|
-
@include
|
|
10
|
+
@include mixin.get-typography(#{$value-type});
|
|
29
11
|
}
|
|
30
12
|
|
|
31
13
|
.text-#{$type}-emphasized {
|
|
32
|
-
@include
|
|
14
|
+
@include mixin.get-typography(#{$value-type}-emphasized);
|
|
33
15
|
}
|
|
34
16
|
}
|
|
35
17
|
|
package/src/tooltip/tooltip.scss
CHANGED
|
@@ -8,15 +8,12 @@
|
|
|
8
8
|
position: absolute;
|
|
9
9
|
top: 0;
|
|
10
10
|
left: 0;
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
transition: transform var(--duration-short2) ease-in-out, opacity var(--duration-short2) ease-in-out;
|
|
13
|
+
transform: scale(0);
|
|
14
|
+
opacity: 0;
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
pointer-events: none;
|
|
14
|
-
transition: transform var(--duration-short2) ease-in-out, opacity var(--duration-short2) ease-in-out;
|
|
15
|
-
transform: scale(0);
|
|
16
|
-
opacity: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.tooltip.open {
|
|
16
|
+
&:host([open]) {
|
|
20
17
|
pointer-events: auto;
|
|
21
18
|
transform: scale(1);
|
|
22
19
|
opacity: 1;
|
package/src/tooltip/tooltip.ts
CHANGED
|
@@ -71,7 +71,7 @@ export class Tooltip extends LitElement {
|
|
|
71
71
|
set forElement(value: HTMLElement | null) {
|
|
72
72
|
if (value) {
|
|
73
73
|
this._focusTarget = value;
|
|
74
|
-
} else {
|
|
74
|
+
} else {
|
|
75
75
|
this._focusTarget = undefined;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -153,7 +153,6 @@ export class Tooltip extends LitElement {
|
|
|
153
153
|
return html` <div
|
|
154
154
|
class=${classMap({
|
|
155
155
|
tooltip: true,
|
|
156
|
-
open: this.open,
|
|
157
156
|
[`variant-${this.variant}`]: true,
|
|
158
157
|
})}
|
|
159
158
|
id="tooltip"
|