@redvars/peacock 3.10.1 → 3.11.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/BaseInput-CV0pZgSb.js +58 -0
- package/dist/BaseInput-CV0pZgSb.js.map +1 -0
- package/dist/app-bar.js +16 -16
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/assets/theme.d.ts +66 -0
- package/dist/assets/theme.js +134 -0
- package/dist/assets/tokens.css +1 -1
- package/dist/assets/tokens.css.map +1 -1
- package/dist/base-progress-CLZTRveO.js +33 -0
- package/dist/base-progress-CLZTRveO.js.map +1 -0
- package/dist/bottom-sheet.js +1 -1
- package/dist/button-group.js +9 -7
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +225 -187
- package/dist/button.js.map +1 -1
- package/dist/{chart-bar-CapLbc2e.js → chart-bar-D5dGFJfK.js} +2 -2
- package/dist/{chart-bar-CapLbc2e.js.map → chart-bar-D5dGFJfK.js.map} +1 -1
- package/dist/chart-bar.js +1 -1
- package/dist/chart-stacked-bar.js +1 -1
- package/dist/checkbox.js +78 -53
- package/dist/checkbox.js.map +1 -1
- package/dist/chip-set.js +52 -0
- package/dist/chip-set.js.map +1 -0
- package/dist/chip.js +8 -6
- package/dist/chip.js.map +1 -1
- package/dist/circular-progress.js +177 -0
- package/dist/circular-progress.js.map +1 -0
- package/dist/code-editor.js +129 -72
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +2 -38
- package/dist/code-highlighter.js.map +1 -1
- package/dist/color-field.js +309 -0
- package/dist/color-field.js.map +1 -0
- package/dist/color-picker.js +26 -15
- package/dist/color-picker.js.map +1 -1
- package/dist/copy-to-clipboard-upGx-Ueo.js +39 -0
- package/dist/copy-to-clipboard-upGx-Ueo.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +1044 -382
- package/dist/custom-elements.json +8615 -4726
- package/dist/date-picker.js +241 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/{element-internals-2CMts_0M.js → delegate-py-Ets8N.js} +2 -43
- package/dist/delegate-py-Ets8N.js.map +1 -0
- package/dist/element-internals-QME0yEz4.js +43 -0
- package/dist/element-internals-QME0yEz4.js.map +1 -0
- package/dist/fab.js +51 -49
- package/dist/fab.js.map +1 -1
- package/dist/field.js +25 -0
- package/dist/field.js.map +1 -1
- package/dist/flow.js +5 -5
- package/dist/form-associated-Bhwwr6dT.js +162 -0
- package/dist/form-associated-Bhwwr6dT.js.map +1 -0
- package/dist/{form-associated-BXADnjOB.js → form-submitter-DPI4L6gj.js} +3 -159
- package/dist/form-submitter-DPI4L6gj.js.map +1 -0
- package/dist/html-editor.js +3 -1
- package/dist/html-editor.js.map +1 -1
- package/dist/icon-button.js +195 -156
- package/dist/icon-button.js.map +1 -1
- package/dist/image.js +2 -2
- package/dist/index.js +32 -8
- package/dist/index.js.map +1 -1
- package/dist/input.js +259 -0
- package/dist/input.js.map +1 -0
- package/dist/item.js +2 -1
- package/dist/item.js.map +1 -1
- package/dist/linear-progress.js +192 -0
- package/dist/linear-progress.js.map +1 -0
- package/dist/{list-AdO-PUq_.js → list-item.js} +12 -222
- package/dist/list-item.js.map +1 -0
- package/dist/list.js +225 -6
- package/dist/list.js.map +1 -1
- package/dist/loader-full.js +31 -8
- package/dist/loader-full.js.map +1 -1
- package/dist/loader.js +52 -12
- package/dist/loader.js.map +1 -1
- package/dist/markdown-editor.js +5 -3
- package/dist/markdown-editor.js.map +1 -1
- package/dist/menu-item.js +30 -30
- package/dist/navigation-bar-item.js +41 -0
- package/dist/navigation-bar-item.js.map +1 -0
- package/dist/navigation-bar.js +128 -0
- package/dist/navigation-bar.js.map +1 -0
- package/dist/navigation-drawer-item.js +236 -0
- package/dist/navigation-drawer-item.js.map +1 -0
- package/dist/navigation-drawer.js +293 -0
- package/dist/navigation-drawer.js.map +1 -0
- package/dist/navigation-rail.js +1 -1
- package/dist/number-field.js +280 -0
- package/dist/number-field.js.map +1 -0
- package/dist/pagination.js +1 -1
- package/dist/radio-group.js +209 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/radio.js +47 -37
- package/dist/radio.js.map +1 -1
- package/dist/segmented-button-group.js +12 -0
- package/dist/segmented-button-group.js.map +1 -1
- package/dist/segmented-button.js +10 -6
- package/dist/segmented-button.js.map +1 -1
- package/dist/select.js +653 -0
- package/dist/select.js.map +1 -0
- package/dist/side-sheet.js +1 -1
- package/dist/sidebar-menu-item.js +273 -0
- package/dist/sidebar-menu-item.js.map +1 -0
- package/dist/sidebar-menu.js +193 -0
- package/dist/sidebar-menu.js.map +1 -0
- package/dist/sidebar-sub-menu.js +301 -0
- package/dist/sidebar-sub-menu.js.map +1 -0
- package/dist/slider.js +76 -24
- package/dist/slider.js.map +1 -1
- package/dist/snackbar.js +3 -3
- package/dist/snackbar.js.map +1 -1
- package/dist/split-button.js +2 -2
- package/dist/src/__internal/utils/size.d.ts +9 -0
- package/dist/src/button/ButtonTypes.d.ts +1 -1
- package/dist/src/checkbox/checkbox.d.ts +28 -22
- package/dist/src/chip/chip/chip.d.ts +3 -0
- package/dist/src/chip/tag/tag.d.ts +5 -1
- package/dist/src/code-editor/code-editor.d.ts +37 -10
- package/dist/src/color-field/color-field.d.ts +55 -0
- package/dist/src/color-field/index.d.ts +1 -0
- package/dist/src/color-picker/color-picker.d.ts +1 -1
- package/dist/src/date-picker/date-picker.d.ts +0 -1
- package/dist/src/index.d.ts +4 -3
- package/dist/src/input/BaseInput.d.ts +21 -3
- package/dist/src/input/input.d.ts +15 -7
- package/dist/src/navigation-bar/index.d.ts +2 -0
- package/dist/src/navigation-bar/navigation-bar-item.d.ts +23 -0
- package/dist/src/navigation-bar/navigation-bar.d.ts +44 -0
- package/dist/src/navigation-drawer/index.d.ts +2 -0
- package/dist/src/navigation-drawer/navigation-drawer-item.d.ts +48 -0
- package/dist/src/navigation-drawer/navigation-drawer.d.ts +70 -0
- package/dist/src/number-field/number-field.d.ts +0 -1
- package/dist/src/radio/index.d.ts +1 -0
- package/dist/src/radio/radio-group.d.ts +50 -0
- package/dist/src/radio/radio.d.ts +18 -18
- package/dist/src/segmented-button/segmented-button-group.d.ts +5 -0
- package/dist/src/segmented-button/segmented-button.d.ts +2 -1
- package/dist/src/select/select.d.ts +6 -0
- package/dist/src/slider/slider.d.ts +14 -5
- package/dist/src/switch/switch.d.ts +22 -26
- package/dist/src/tabs/tabs.d.ts +3 -0
- package/dist/src/textarea/textarea.d.ts +0 -1
- package/dist/src/time-picker/time-picker.d.ts +0 -1
- package/dist/src/toolbar/toolbar.d.ts +7 -4
- package/dist/src/url-field/url-field.d.ts +0 -1
- package/dist/svg.js +5 -5
- package/dist/switch.js +413 -0
- package/dist/switch.js.map +1 -0
- package/dist/tab.js +2 -1
- package/dist/tab.js.map +1 -1
- package/dist/tabs.js +10 -8
- package/dist/tabs.js.map +1 -1
- package/dist/tag.js +349 -0
- package/dist/tag.js.map +1 -0
- package/dist/test/code-editor.test.d.ts +1 -0
- package/dist/test/color-field.test.d.ts +1 -0
- package/dist/test/color-picker.test.d.ts +1 -0
- package/dist/test/field.test.d.ts +1 -0
- package/dist/test/form-controls.test.d.ts +1 -0
- package/dist/test/icon.test.d.ts +1 -1
- package/dist/test/input.test.d.ts +1 -0
- package/dist/test/navigation.test.d.ts +1 -0
- package/dist/test/segmented-button.test.d.ts +1 -0
- package/dist/test/slider.test.d.ts +1 -0
- package/dist/textarea.js +237 -0
- package/dist/textarea.js.map +1 -0
- package/dist/time-picker.js +241 -0
- package/dist/time-picker.js.map +1 -0
- package/dist/toolbar.js +26 -9
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/url-field.js +298 -0
- package/dist/url-field.js.map +1 -0
- package/package.json +29 -8
- package/readme.md +2 -2
- package/scss/tokens.css +175 -18
- package/src/__internal/utils/size.ts +23 -0
- package/src/app-bar/app-bar.scss +4 -16
- package/src/bottom-sheet/bottom-sheet.scss +1 -1
- package/src/button/ButtonTypes.ts +2 -0
- package/src/button/button/button-base.scss +84 -84
- package/src/button/button/button-colors.scss +14 -2
- package/src/button/button/button-layers.scss +71 -71
- package/src/button/button/button-shapes.scss +2 -2
- package/src/button/button/button-sizes.scss +35 -35
- package/src/button/button/button.scss +1 -1
- package/src/button/button/button.ts +1 -2
- package/src/button/button-group/button-group.scss +5 -5
- package/src/button/fab/fab-sizes.scss +15 -15
- package/src/button/fab/fab.scss +32 -32
- package/src/button/icon-button/icon-button-sizes.scss +7 -7
- package/src/chart-bar/chart-bar.scss +1 -1
- package/src/checkbox/checkbox.scss +7 -6
- package/src/checkbox/checkbox.ts +92 -40
- package/src/chip/chip/chip.ts +8 -5
- package/src/chip/chip-set/chip-set.ts +2 -0
- package/src/chip/tag/tag-colors.scss +1 -1
- package/src/chip/tag/tag-sizes.scss +9 -0
- package/src/chip/tag/tag.scss +1 -1
- package/src/chip/tag/tag.ts +20 -9
- package/src/code-editor/code-editor.scss +8 -3
- package/src/code-editor/code-editor.ts +148 -79
- package/src/code-highlighter/code-highlighter.scss +1 -1
- package/src/color-field/color-field.scss +48 -0
- package/src/color-field/color-field.ts +239 -0
- package/src/color-field/index.ts +1 -0
- package/src/color-picker/color-picker.scss +33 -15
- package/src/color-picker/color-picker.ts +2 -1
- package/src/date-picker/date-picker.ts +2 -3
- package/src/field/field.scss +31 -0
- package/src/flow/flow.scss +5 -5
- package/src/image/image.scss +2 -2
- package/src/index.ts +7 -3
- package/src/input/BaseInput.ts +54 -4
- package/src/input/input.ts +104 -79
- package/src/list/list-item.ts +2 -0
- package/src/loader.ts +28 -6
- package/src/markdown-editor/markdown-editor.scss +2 -2
- package/src/menu/menu-item/menu-item.scss +30 -30
- package/src/navigation-bar/index.ts +2 -0
- package/src/navigation-bar/navigation-bar-item.ts +25 -0
- package/src/navigation-bar/navigation-bar.scss +27 -0
- package/src/navigation-bar/navigation-bar.ts +96 -0
- package/src/navigation-drawer/index.ts +2 -0
- package/src/navigation-drawer/navigation-drawer-item.scss +82 -0
- package/src/navigation-drawer/navigation-drawer-item.ts +133 -0
- package/src/navigation-drawer/navigation-drawer.scss +99 -0
- package/src/navigation-drawer/navigation-drawer.ts +196 -0
- package/src/navigation-rail/navigation-rail.scss +1 -1
- package/src/number-field/number-field.ts +2 -3
- package/src/pagination/pagination.scss +1 -1
- package/src/progress/circular-progress/circular-progress.ts +2 -0
- package/src/progress/linear-progress/linear-progress.ts +2 -0
- package/src/radio/index.ts +1 -0
- package/src/radio/radio-group.scss +39 -0
- package/src/radio/radio-group.ts +167 -0
- package/src/radio/radio.ts +74 -31
- package/src/segmented-button/segmented-button-group.ts +12 -0
- package/src/segmented-button/segmented-button.ts +12 -6
- package/src/select/select.ts +21 -1
- package/src/side-sheet/side-sheet.scss +1 -1
- package/src/sidebar-menu/sidebar-menu-item.scss +1 -1
- package/src/sidebar-menu/sidebar-menu-item.ts +2 -0
- package/src/sidebar-menu/sidebar-menu.ts +2 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +1 -1
- package/src/sidebar-menu/sidebar-sub-menu.ts +2 -0
- package/src/slider/slider.scss +3 -3
- package/src/slider/slider.ts +119 -31
- package/src/snackbar/snackbar.ts +3 -3
- package/src/split-button/split-button-colors.scss +2 -2
- package/src/svg/svg.scss +5 -5
- package/src/switch/switch.scss +0 -1
- package/src/switch/switch.ts +82 -47
- package/src/tabs/tab.scss +2 -1
- package/src/tabs/tabs.ts +14 -8
- package/src/textarea/textarea.ts +2 -3
- package/src/time-picker/time-picker.ts +2 -3
- package/src/toolbar/toolbar.scss +4 -4
- package/src/toolbar/toolbar.ts +12 -5
- package/src/url-field/url-field.ts +2 -3
- package/dist/BaseInput-CU1zZYKc.js +0 -27
- package/dist/BaseInput-CU1zZYKc.js.map +0 -1
- package/dist/brand-loader.js +0 -358
- package/dist/brand-loader.js.map +0 -1
- package/dist/element-internals-2CMts_0M.js.map +0 -1
- package/dist/form-associated-BXADnjOB.js.map +0 -1
- package/dist/list-AdO-PUq_.js.map +0 -1
- package/dist/select-DkyRqUTI.js +0 -3955
- package/dist/select-DkyRqUTI.js.map +0 -1
- package/dist/src/brand-loader/brand-loader.d.ts +0 -33
- package/dist/src/brand-loader/index.d.ts +0 -2
- package/src/brand-loader/brand-loader.scss +0 -270
- package/src/brand-loader/brand-loader.ts +0 -115
- package/src/brand-loader/index.ts +0 -2
- /package/dist/test/{brand-loader.test.d.ts → button.test.d.ts} +0 -0
package/src/radio/radio.ts
CHANGED
|
@@ -3,6 +3,14 @@ import { property, query, state } from 'lit/decorators.js';
|
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
|
|
5
5
|
import { spread } from '@/__internal/directive/spread.js';
|
|
6
|
+
import { mixinElementInternals } from '@/__internal/mixins/element-internals.js';
|
|
7
|
+
import {
|
|
8
|
+
type FormRestoreState,
|
|
9
|
+
type FormValue,
|
|
10
|
+
getFormState,
|
|
11
|
+
getFormValue,
|
|
12
|
+
mixinFormAssociated,
|
|
13
|
+
} from '@/__internal/mixins/form-associated.js';
|
|
6
14
|
|
|
7
15
|
import styles from './radio.scss';
|
|
8
16
|
import IndividualComponent from '@/IndividualComponent.js';
|
|
@@ -14,6 +22,9 @@ import IndividualComponent from '@/IndividualComponent.js';
|
|
|
14
22
|
* @summary Allows selection of a single option from a set.
|
|
15
23
|
* @overview
|
|
16
24
|
* <p>Radio buttons follow the specifications with clear focus, hover, and selected states.</p>
|
|
25
|
+
* <p>Radios that share a <code>name</code> form a group. Wrap them in <code>wc-radio-group</code> to get a
|
|
26
|
+
* group label and a single <code>change</code> event for the whole set.</p>
|
|
27
|
+
* <p>The radio is form-associated: the checked radio submits its <code>value</code> under its <code>name</code>.</p>
|
|
17
28
|
*
|
|
18
29
|
* @cssprop --radio-size: Size of the outer radio circle.
|
|
19
30
|
* @cssprop --radio-dot-size: Size of the inner dot when selected.
|
|
@@ -35,17 +46,19 @@ import IndividualComponent from '@/IndividualComponent.js';
|
|
|
35
46
|
type RadioDirection = 1 | -1;
|
|
36
47
|
|
|
37
48
|
@IndividualComponent
|
|
38
|
-
export class Radio extends
|
|
49
|
+
export class Radio extends mixinFormAssociated(
|
|
50
|
+
mixinElementInternals(LitElement),
|
|
51
|
+
) {
|
|
52
|
+
// ── Static ───────────────────────────────────────────────────────────────
|
|
53
|
+
|
|
39
54
|
private static readonly DIRECTION_NEXT: RadioDirection = 1;
|
|
55
|
+
|
|
40
56
|
private static readonly DIRECTION_PREVIOUS: RadioDirection = -1;
|
|
41
57
|
|
|
42
58
|
static styles = [styles];
|
|
43
59
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*/
|
|
47
|
-
@property({ type: String })
|
|
48
|
-
name: string = '';
|
|
60
|
+
// ── Properties ───────────────────────────────────────────────────────────
|
|
61
|
+
// `name` (which groups radios) and `disabled` come from mixinFormAssociated.
|
|
49
62
|
|
|
50
63
|
/**
|
|
51
64
|
* The submitted value when this radio is selected.
|
|
@@ -77,18 +90,14 @@ export class Radio extends LitElement {
|
|
|
77
90
|
@property({ type: Boolean, reflect: true })
|
|
78
91
|
readonly: boolean = false;
|
|
79
92
|
|
|
80
|
-
/**
|
|
81
|
-
* If true, the user cannot interact with the radio. Defaults to `false`.
|
|
82
|
-
*/
|
|
83
|
-
@property({ type: Boolean, reflect: true })
|
|
84
|
-
disabled: boolean = false;
|
|
85
|
-
|
|
86
93
|
/**
|
|
87
94
|
* Configuration object for aria attributes.
|
|
88
95
|
*/
|
|
89
96
|
@property({ type: Object })
|
|
90
97
|
configAria: Record<string, string> = {};
|
|
91
98
|
|
|
99
|
+
// ── State ────────────────────────────────────────────────────────────────
|
|
100
|
+
|
|
92
101
|
/** True while the radio container has keyboard focus. */
|
|
93
102
|
@state()
|
|
94
103
|
private hasFocus = false;
|
|
@@ -105,19 +114,24 @@ export class Radio extends LitElement {
|
|
|
105
114
|
@state()
|
|
106
115
|
private isGroupFocusTarget = false;
|
|
107
116
|
|
|
117
|
+
// ── Queries ──────────────────────────────────────────────────────────────
|
|
118
|
+
|
|
108
119
|
@query('.container')
|
|
109
120
|
private containerElement?: HTMLElement;
|
|
110
121
|
|
|
111
|
-
|
|
112
|
-
private nativeElement?: HTMLInputElement;
|
|
113
|
-
|
|
114
|
-
// ── Private fields ────────────────────────────────────────────────────────
|
|
122
|
+
// ── Private fields ───────────────────────────────────────────────────────
|
|
115
123
|
|
|
116
124
|
/** Captured `tabindex` attribute value forwarded to the inner container. */
|
|
117
125
|
private tabindex?: number;
|
|
118
126
|
|
|
127
|
+
/** `checked` when first connected; `form.reset()` returns to it. */
|
|
128
|
+
private defaultChecked?: boolean;
|
|
129
|
+
|
|
130
|
+
// ── Lifecycle ────────────────────────────────────────────────────────────
|
|
131
|
+
|
|
119
132
|
connectedCallback() {
|
|
120
133
|
super.connectedCallback();
|
|
134
|
+
this.defaultChecked ??= this.checked;
|
|
121
135
|
this.handleInitialAttributes();
|
|
122
136
|
window.addEventListener('mouseup', this.windowMouseUp);
|
|
123
137
|
window.addEventListener('keyup', this.windowKeyUp);
|
|
@@ -148,6 +162,42 @@ export class Radio extends LitElement {
|
|
|
148
162
|
}
|
|
149
163
|
}
|
|
150
164
|
|
|
165
|
+
// ── Public methods ───────────────────────────────────────────────────────
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Sets focus on the radio.
|
|
169
|
+
*/
|
|
170
|
+
focus() {
|
|
171
|
+
this.containerElement?.focus();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Removes focus from the radio.
|
|
176
|
+
*/
|
|
177
|
+
blur() {
|
|
178
|
+
this.containerElement?.blur();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// ── Form association ─────────────────────────────────────────────────────
|
|
182
|
+
|
|
183
|
+
override [getFormValue](): FormValue | null {
|
|
184
|
+
return this.checked ? this.value || 'on' : null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
override [getFormState](): FormValue | null {
|
|
188
|
+
return String(this.checked);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
formResetCallback() {
|
|
192
|
+
this.checked = this.defaultChecked ?? false;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
formStateRestoreCallback(state: FormRestoreState | null) {
|
|
196
|
+
this.checked = state === 'true';
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// ── Private methods ──────────────────────────────────────────────────────
|
|
200
|
+
|
|
151
201
|
private handleInitialAttributes() {
|
|
152
202
|
if (this.hasAttribute('tabindex')) {
|
|
153
203
|
const attrValue = this.getAttribute('tabindex');
|
|
@@ -256,9 +306,14 @@ export class Radio extends LitElement {
|
|
|
256
306
|
|
|
257
307
|
private getGroupRadios(): Radio[] {
|
|
258
308
|
if (!this.name) return [this];
|
|
259
|
-
|
|
309
|
+
// A radio group or form scopes the name; otherwise the radio's own tree (document or the
|
|
310
|
+
// shadow root it was rendered into).
|
|
311
|
+
const scopeRoot = (this.closest('wc-radio-group, form') ??
|
|
312
|
+
this.getRootNode()) as ParentNode;
|
|
260
313
|
return Array.from(
|
|
261
|
-
scopeRoot.querySelectorAll<Radio>(
|
|
314
|
+
scopeRoot.querySelectorAll<Radio>(
|
|
315
|
+
`wc-radio[name="${CSS.escape(this.name)}"]`,
|
|
316
|
+
),
|
|
262
317
|
);
|
|
263
318
|
}
|
|
264
319
|
|
|
@@ -300,19 +355,7 @@ export class Radio extends LitElement {
|
|
|
300
355
|
target.containerElement?.focus();
|
|
301
356
|
}
|
|
302
357
|
|
|
303
|
-
|
|
304
|
-
* Sets focus on the radio.
|
|
305
|
-
*/
|
|
306
|
-
focus() {
|
|
307
|
-
this.containerElement?.focus();
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Removes focus from the radio.
|
|
312
|
-
*/
|
|
313
|
-
blur() {
|
|
314
|
-
this.containerElement?.blur();
|
|
315
|
-
}
|
|
358
|
+
// ── Render ───────────────────────────────────────────────────────────────
|
|
316
359
|
|
|
317
360
|
render() {
|
|
318
361
|
const cssClasses = {
|
|
@@ -55,6 +55,7 @@ export class SegmentedButtonGroup extends LitElement {
|
|
|
55
55
|
'segmented-button--change',
|
|
56
56
|
this._onSegmentChange as EventListener,
|
|
57
57
|
);
|
|
58
|
+
this.addEventListener('change', this._stopSegmentChange, { capture: true });
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
disconnectedCallback() {
|
|
@@ -63,8 +64,19 @@ export class SegmentedButtonGroup extends LitElement {
|
|
|
63
64
|
'segmented-button--change',
|
|
64
65
|
this._onSegmentChange as EventListener,
|
|
65
66
|
);
|
|
67
|
+
this.removeEventListener('change', this._stopSegmentChange, {
|
|
68
|
+
capture: true,
|
|
69
|
+
});
|
|
66
70
|
}
|
|
67
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Swallows a segment's own `change` on the way down (capture phase), so listeners on the group
|
|
74
|
+
* and above see only the group's `change`, one per selection.
|
|
75
|
+
*/
|
|
76
|
+
private _stopSegmentChange = (ev: Event) => {
|
|
77
|
+
if (ev.target !== this) ev.stopPropagation();
|
|
78
|
+
};
|
|
79
|
+
|
|
68
80
|
private _getSegments(): SegmentedButton[] {
|
|
69
81
|
return Array.from(
|
|
70
82
|
this.querySelectorAll<SegmentedButton>('wc-segmented-button'),
|
|
@@ -19,7 +19,8 @@ import IndividualComponent from '@/IndividualComponent.js';
|
|
|
19
19
|
* @cssprop --segmented-button-outline-color: Outline / border color.
|
|
20
20
|
* @cssprop --segmented-button-disabled-opacity: Opacity when the segment is disabled.
|
|
21
21
|
*
|
|
22
|
-
* @fires {CustomEvent}
|
|
22
|
+
* @fires {CustomEvent} change - Dispatched when the segment is activated. Detail: `{ value, selected, originalEvent }`, where `selected` is the requested state. Inside a `wc-segmented-button-group` the group swallows it and fires its own `change` instead.
|
|
23
|
+
* @fires {CustomEvent} segmented-button--change - Deprecated alias of `change`, fired alongside it.
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
26
|
* ```html
|
|
@@ -102,13 +103,18 @@ export class SegmentedButton extends LitElement {
|
|
|
102
103
|
|
|
103
104
|
private _toggle(ev: MouseEvent | KeyboardEvent) {
|
|
104
105
|
if (this.disabled) return;
|
|
106
|
+
const detail = {
|
|
107
|
+
value: this.value || this.textContent?.trim(),
|
|
108
|
+
selected: !this.selected,
|
|
109
|
+
originalEvent: ev,
|
|
110
|
+
};
|
|
111
|
+
this.dispatchEvent(
|
|
112
|
+
new CustomEvent('change', { detail, bubbles: true, composed: true }),
|
|
113
|
+
);
|
|
114
|
+
// Deprecated name, still what wc-segmented-button-group listens for.
|
|
105
115
|
this.dispatchEvent(
|
|
106
116
|
new CustomEvent('segmented-button--change', {
|
|
107
|
-
detail
|
|
108
|
-
value: this.value || this.textContent?.trim(),
|
|
109
|
-
selected: !this.selected,
|
|
110
|
-
originalEvent: ev,
|
|
111
|
-
},
|
|
117
|
+
detail,
|
|
112
118
|
bubbles: true,
|
|
113
119
|
composed: true,
|
|
114
120
|
}),
|
package/src/select/select.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { html, 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 {
|
|
5
|
+
type FormValue,
|
|
6
|
+
getFormValue,
|
|
7
|
+
} from '@/__internal/mixins/form-associated.js';
|
|
8
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
4
9
|
import BaseInput from '../input/BaseInput.js';
|
|
5
10
|
import styles from './select.scss';
|
|
6
11
|
import type { Field } from '../field/field.js';
|
|
@@ -26,6 +31,10 @@ export interface SelectOption {
|
|
|
26
31
|
* - Client-side typeahead with `search="contains"`
|
|
27
32
|
* - Server-side typeahead with `search="managed"`
|
|
28
33
|
* - Multi-select chips display
|
|
34
|
+
* - Form-associated: submits the value under `name` (one entry per value with `multiple`)
|
|
35
|
+
*
|
|
36
|
+
* @fires {CustomEvent<{value: string}>} change - Dispatched when the selection changes.
|
|
37
|
+
* @fires {CustomEvent<{value: string}>} select-search - Dispatched as the user types when `search="managed"`.
|
|
29
38
|
*
|
|
30
39
|
* @example
|
|
31
40
|
* ```html
|
|
@@ -36,6 +45,7 @@ export interface SelectOption {
|
|
|
36
45
|
* ```
|
|
37
46
|
* @tags form
|
|
38
47
|
*/
|
|
48
|
+
@IndividualComponent
|
|
39
49
|
export class Select extends BaseInput {
|
|
40
50
|
static styles = [styles];
|
|
41
51
|
|
|
@@ -138,6 +148,16 @@ export class Select extends BaseInput {
|
|
|
138
148
|
this._triggerEl?.blur();
|
|
139
149
|
}
|
|
140
150
|
|
|
151
|
+
// ── Form association ──────────────────────────────────────────────────────
|
|
152
|
+
|
|
153
|
+
override [getFormValue](): FormValue | null {
|
|
154
|
+
if (!this.multiple) return this.value;
|
|
155
|
+
// One entry per selected value, like a native <select multiple>.
|
|
156
|
+
const data = new FormData();
|
|
157
|
+
for (const value of this._selectedValues) data.append(this.name, value);
|
|
158
|
+
return data;
|
|
159
|
+
}
|
|
160
|
+
|
|
141
161
|
// ── Lifecycle ─────────────────────────────────────────────────────────────
|
|
142
162
|
|
|
143
163
|
protected override updated(changedProperties: Map<string, unknown>) {
|
|
@@ -441,7 +461,7 @@ export class Select extends BaseInput {
|
|
|
441
461
|
<wc-chip
|
|
442
462
|
dismissible
|
|
443
463
|
value=${val}
|
|
444
|
-
@
|
|
464
|
+
@dismiss=${(e: CustomEvent) =>
|
|
445
465
|
this._handleChipDismiss(e, val)}
|
|
446
466
|
>${this._getLabelForValue(val)}</wc-chip
|
|
447
467
|
>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
display: contents;
|
|
7
7
|
|
|
8
8
|
--side-sheet-container-color: var(--color-surface-container-low, #f7f2fa);
|
|
9
|
-
--side-sheet-scrim-color:
|
|
9
|
+
--side-sheet-scrim-color: color-mix(in srgb, var(--color-scrim) 32%, transparent);
|
|
10
10
|
--side-sheet-shape: var(--shape-corner-extra-large, 28px);
|
|
11
11
|
--side-sheet-width: 360px;
|
|
12
12
|
--side-sheet-transition-duration: var(--duration-medium2, 300ms);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// M3 sidebar menu item sizing
|
|
9
9
|
--sidebar-menu-item-height: 3rem;
|
|
10
10
|
--sidebar-menu-item-icon-size: 1.25rem;
|
|
11
|
-
--sidebar-menu-item-border-radius: var(--
|
|
11
|
+
--sidebar-menu-item-border-radius: var(--shape-corner-full, 9999px);
|
|
12
12
|
|
|
13
13
|
// M3 color tokens
|
|
14
14
|
--sidebar-menu-item-label-color: var(--color-on-surface);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
2
3
|
import { property, query } from 'lit/decorators.js';
|
|
3
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
5
|
import styles from './sidebar-menu-item.scss';
|
|
@@ -19,6 +20,7 @@ import styles from './sidebar-menu-item.scss';
|
|
|
19
20
|
* ```
|
|
20
21
|
* @tags navigation
|
|
21
22
|
*/
|
|
23
|
+
@IndividualComponent
|
|
22
24
|
export class SidebarMenuItem extends LitElement {
|
|
23
25
|
static styles = [styles];
|
|
24
26
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
2
3
|
import { property } from 'lit/decorators.js';
|
|
3
4
|
import styles from './sidebar-menu.scss';
|
|
4
5
|
import { SidebarMenuItem } from './sidebar-menu-item.js';
|
|
@@ -23,6 +24,7 @@ type SidebarNode = SidebarMenuItem | SidebarSubMenu;
|
|
|
23
24
|
* ```
|
|
24
25
|
* @tags navigation
|
|
25
26
|
*/
|
|
27
|
+
@IndividualComponent
|
|
26
28
|
export class SidebarMenu extends LitElement {
|
|
27
29
|
static styles = [styles];
|
|
28
30
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
display: block;
|
|
7
7
|
|
|
8
8
|
--sidebar-menu-item-height: 3rem;
|
|
9
|
-
--sidebar-menu-item-border-radius: var(--
|
|
9
|
+
--sidebar-menu-item-border-radius: var(--shape-corner-full, 9999px);
|
|
10
10
|
--sidebar-menu-item-label-color: var(--color-on-surface);
|
|
11
11
|
--sidebar-menu-item-icon-color: var(--color-on-surface-variant);
|
|
12
12
|
--sidebar-menu-item-selected-background: var(--color-secondary-container);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { html, LitElement } from 'lit';
|
|
2
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
2
3
|
import { property, query } from 'lit/decorators.js';
|
|
3
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
5
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
@@ -18,6 +19,7 @@ import styles from './sidebar-sub-menu.scss';
|
|
|
18
19
|
* ```
|
|
19
20
|
* @tags navigation
|
|
20
21
|
*/
|
|
22
|
+
@IndividualComponent
|
|
21
23
|
export class SidebarSubMenu extends LitElement {
|
|
22
24
|
static styles = [styles];
|
|
23
25
|
|
package/src/slider/slider.scss
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
height: var(--_thumb-size);
|
|
74
74
|
background-color: var(--_thumb-color);
|
|
75
75
|
border-radius: 50%;
|
|
76
|
-
box-shadow: var(--
|
|
76
|
+
box-shadow: var(--elevation-level1);
|
|
77
77
|
outline: none;
|
|
78
78
|
cursor: grab;
|
|
79
79
|
transition: left 0.05s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s ease;
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
&:focus-visible::before { opacity: 0.12; }
|
|
104
104
|
&:active {
|
|
105
105
|
cursor: grabbing;
|
|
106
|
-
box-shadow: var(--
|
|
106
|
+
box-shadow: var(--elevation-level5);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// Disable transition while dragging
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
padding: 4px 8px;
|
|
121
121
|
background-color: var(--_label-color);
|
|
122
122
|
color: var(--_label-text-color);
|
|
123
|
-
border-radius:
|
|
123
|
+
border-radius: var(--shape-corner-extra-small);
|
|
124
124
|
font-size: 12px;
|
|
125
125
|
white-space: nowrap;
|
|
126
126
|
opacity: 0;
|
package/src/slider/slider.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { LitElement, html } from 'lit';
|
|
2
2
|
import { property, state, query } from 'lit/decorators.js';
|
|
3
3
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
4
|
+
import { mixinElementInternals } from '@/__internal/mixins/element-internals.js';
|
|
5
|
+
import {
|
|
6
|
+
type FormRestoreState,
|
|
7
|
+
type FormValue,
|
|
8
|
+
getFormValue,
|
|
9
|
+
mixinFormAssociated,
|
|
10
|
+
} from '@/__internal/mixins/form-associated.js';
|
|
4
11
|
import sliderStyles from './slider.scss';
|
|
5
12
|
import IndividualComponent from '@/IndividualComponent.js';
|
|
6
13
|
|
|
@@ -10,6 +17,9 @@ import IndividualComponent from '@/IndividualComponent.js';
|
|
|
10
17
|
* @rawTag slider
|
|
11
18
|
*
|
|
12
19
|
* @summary Sliders allow users to make selections from a range of values.
|
|
20
|
+
* @overview
|
|
21
|
+
* <p>The slider is form-associated: its <code>value</code> is submitted under its <code>name</code>,
|
|
22
|
+
* and <code>form.reset()</code> restores the starting value.</p>
|
|
13
23
|
*
|
|
14
24
|
* @fires {CustomEvent} input - Dispatched when the slider value changes during interaction.
|
|
15
25
|
* @fires {CustomEvent} change - Dispatched when the slider interaction ends.
|
|
@@ -18,11 +28,19 @@ import IndividualComponent from '@/IndividualComponent.js';
|
|
|
18
28
|
* ```html
|
|
19
29
|
* <wc-slider min="0" max="100" value="50"></wc-slider>
|
|
20
30
|
* ```
|
|
31
|
+
* @tags input, form
|
|
21
32
|
*/
|
|
22
33
|
@IndividualComponent
|
|
23
|
-
export class Slider extends
|
|
34
|
+
export class Slider extends mixinFormAssociated(
|
|
35
|
+
mixinElementInternals(LitElement),
|
|
36
|
+
) {
|
|
37
|
+
// ── Static ───────────────────────────────────────────────────────────────
|
|
38
|
+
|
|
24
39
|
static styles = [sliderStyles];
|
|
25
40
|
|
|
41
|
+
// ── Properties ───────────────────────────────────────────────────────────
|
|
42
|
+
// `name` and `disabled` come from mixinFormAssociated.
|
|
43
|
+
|
|
26
44
|
/**
|
|
27
45
|
* The minimum value of the slider.
|
|
28
46
|
*/
|
|
@@ -43,11 +61,6 @@ export class Slider extends LitElement {
|
|
|
43
61
|
*/
|
|
44
62
|
@property({ type: Number }) step = 1;
|
|
45
63
|
|
|
46
|
-
/**
|
|
47
|
-
* Whether the slider is disabled.
|
|
48
|
-
*/
|
|
49
|
-
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
50
|
-
|
|
51
64
|
/**
|
|
52
65
|
* Whether to show labels on the slider.
|
|
53
66
|
*/
|
|
@@ -58,46 +71,90 @@ export class Slider extends LitElement {
|
|
|
58
71
|
*/
|
|
59
72
|
@property({ type: Boolean, attribute: 'show-value' }) showValue = false;
|
|
60
73
|
|
|
74
|
+
// ── State ────────────────────────────────────────────────────────────────
|
|
75
|
+
|
|
61
76
|
/** True while the user is actively dragging the thumb. */
|
|
62
77
|
@state() private isDragging = false;
|
|
63
78
|
|
|
79
|
+
// ── Queries ──────────────────────────────────────────────────────────────
|
|
80
|
+
|
|
64
81
|
@query('.slider-container') private container!: HTMLElement;
|
|
65
82
|
|
|
66
83
|
@query('.thumb') private thumbElement!: HTMLElement;
|
|
67
84
|
|
|
85
|
+
// ── Private fields ───────────────────────────────────────────────────────
|
|
86
|
+
|
|
87
|
+
/** `value` when first connected; `form.reset()` returns to it. */
|
|
88
|
+
private defaultValue?: number;
|
|
89
|
+
|
|
90
|
+
// ── Lifecycle ────────────────────────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
override connectedCallback() {
|
|
93
|
+
super.connectedCallback();
|
|
94
|
+
this.defaultValue ??= this.value;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ── Form association ─────────────────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
override [getFormValue](): FormValue | null {
|
|
100
|
+
return String(this.value);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
formResetCallback() {
|
|
104
|
+
this.value = this.defaultValue ?? this.value;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
formStateRestoreCallback(state: FormRestoreState | null) {
|
|
108
|
+
const restored = Number(state);
|
|
109
|
+
if (typeof state === 'string' && !Number.isNaN(restored)) {
|
|
110
|
+
this.value = restored;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ── Private methods ──────────────────────────────────────────────────────
|
|
115
|
+
|
|
68
116
|
private handleInput(event: MouseEvent | TouchEvent) {
|
|
69
117
|
if (this.disabled) return;
|
|
70
|
-
|
|
118
|
+
|
|
71
119
|
const rect = this.container.getBoundingClientRect();
|
|
72
|
-
const clientX =
|
|
73
|
-
|
|
120
|
+
const clientX =
|
|
121
|
+
'touches' in event
|
|
122
|
+
? event.touches[0].clientX
|
|
123
|
+
: (event as MouseEvent).clientX;
|
|
124
|
+
|
|
74
125
|
// Calculate percentage relative to track width
|
|
75
126
|
let percentage = (clientX - rect.left) / rect.width;
|
|
76
127
|
percentage = Math.max(0, Math.min(1, percentage));
|
|
77
|
-
|
|
128
|
+
|
|
78
129
|
const rawValue = this.min + percentage * (this.max - this.min);
|
|
79
130
|
const steppedValue = Math.round(rawValue / this.step) * this.step;
|
|
80
|
-
|
|
131
|
+
|
|
81
132
|
const oldValue = this.value;
|
|
82
133
|
this.value = Math.max(this.min, Math.min(this.max, steppedValue));
|
|
83
134
|
|
|
84
135
|
if (oldValue !== this.value) {
|
|
85
|
-
this.dispatchEvent(
|
|
136
|
+
this.dispatchEvent(
|
|
137
|
+
new CustomEvent('input', {
|
|
138
|
+
detail: { value: this.value },
|
|
139
|
+
bubbles: true,
|
|
140
|
+
composed: true,
|
|
141
|
+
}),
|
|
142
|
+
);
|
|
86
143
|
}
|
|
87
144
|
}
|
|
88
145
|
|
|
89
146
|
private onMouseDown(e: MouseEvent | TouchEvent) {
|
|
90
147
|
if (this.disabled) return;
|
|
91
|
-
|
|
148
|
+
|
|
92
149
|
e.preventDefault();
|
|
93
150
|
this.isDragging = true;
|
|
94
|
-
|
|
151
|
+
|
|
95
152
|
// Add dragging class for CSS state
|
|
96
153
|
this.container.classList.add('dragging');
|
|
97
154
|
this.thumbElement.classList.add('dragging');
|
|
98
|
-
|
|
155
|
+
|
|
99
156
|
this.handleInput(e);
|
|
100
|
-
|
|
157
|
+
|
|
101
158
|
window.addEventListener('mousemove', this.onMouseMove);
|
|
102
159
|
window.addEventListener('mouseup', this.onMouseUp);
|
|
103
160
|
window.addEventListener('touchmove', this.onMouseMove, { passive: false });
|
|
@@ -114,13 +171,19 @@ export class Slider extends LitElement {
|
|
|
114
171
|
|
|
115
172
|
private onMouseUp = () => {
|
|
116
173
|
if (!this.isDragging) return;
|
|
117
|
-
|
|
174
|
+
|
|
118
175
|
this.isDragging = false;
|
|
119
176
|
this.container.classList.remove('dragging');
|
|
120
177
|
this.thumbElement.classList.remove('dragging');
|
|
121
|
-
|
|
122
|
-
this.dispatchEvent(
|
|
123
|
-
|
|
178
|
+
|
|
179
|
+
this.dispatchEvent(
|
|
180
|
+
new CustomEvent('change', {
|
|
181
|
+
detail: { value: this.value },
|
|
182
|
+
bubbles: true,
|
|
183
|
+
composed: true,
|
|
184
|
+
}),
|
|
185
|
+
);
|
|
186
|
+
|
|
124
187
|
window.removeEventListener('mousemove', this.onMouseMove);
|
|
125
188
|
window.removeEventListener('mouseup', this.onMouseUp);
|
|
126
189
|
window.removeEventListener('touchmove', this.onMouseMove);
|
|
@@ -130,7 +193,7 @@ export class Slider extends LitElement {
|
|
|
130
193
|
|
|
131
194
|
private handleKeyDown(e: KeyboardEvent) {
|
|
132
195
|
if (this.disabled) return;
|
|
133
|
-
|
|
196
|
+
|
|
134
197
|
const increment = e.shiftKey ? this.step * 10 : this.step;
|
|
135
198
|
let newValue = this.value;
|
|
136
199
|
|
|
@@ -150,27 +213,44 @@ export class Slider extends LitElement {
|
|
|
150
213
|
|
|
151
214
|
if (newValue !== this.value) {
|
|
152
215
|
this.value = newValue;
|
|
153
|
-
this.dispatchEvent(
|
|
154
|
-
|
|
216
|
+
this.dispatchEvent(
|
|
217
|
+
new CustomEvent('input', {
|
|
218
|
+
detail: { value: this.value },
|
|
219
|
+
bubbles: true,
|
|
220
|
+
composed: true,
|
|
221
|
+
}),
|
|
222
|
+
);
|
|
223
|
+
this.dispatchEvent(
|
|
224
|
+
new CustomEvent('change', {
|
|
225
|
+
detail: { value: this.value },
|
|
226
|
+
bubbles: true,
|
|
227
|
+
composed: true,
|
|
228
|
+
}),
|
|
229
|
+
);
|
|
155
230
|
}
|
|
156
231
|
}
|
|
157
232
|
|
|
233
|
+
// ── Render ───────────────────────────────────────────────────────────────
|
|
234
|
+
|
|
158
235
|
render() {
|
|
159
236
|
const percentage = ((this.value - this.min) / (this.max - this.min)) * 100;
|
|
160
237
|
|
|
161
238
|
return html`
|
|
162
239
|
<div class="slider ${this.showValue ? 'with-value' : ''}">
|
|
163
|
-
<div
|
|
240
|
+
<div
|
|
164
241
|
class="slider-container ${this.disabled ? 'disabled' : ''}"
|
|
165
242
|
@mousedown=${this.onMouseDown}
|
|
166
243
|
@touchstart=${this.onMouseDown}
|
|
167
244
|
>
|
|
168
245
|
<div class="track">
|
|
169
|
-
<div
|
|
246
|
+
<div
|
|
247
|
+
class="track-active"
|
|
248
|
+
style=${styleMap({ width: `${percentage}%` })}
|
|
249
|
+
></div>
|
|
170
250
|
</div>
|
|
171
251
|
|
|
172
|
-
<div
|
|
173
|
-
class="thumb"
|
|
252
|
+
<div
|
|
253
|
+
class="thumb"
|
|
174
254
|
role="slider"
|
|
175
255
|
aria-label="Slider"
|
|
176
256
|
tabindex="${this.disabled ? -1 : 0}"
|
|
@@ -178,15 +258,23 @@ export class Slider extends LitElement {
|
|
|
178
258
|
aria-valuemax=${this.max}
|
|
179
259
|
aria-valuenow=${this.value}
|
|
180
260
|
aria-disabled=${this.disabled}
|
|
181
|
-
style=${styleMap({
|
|
261
|
+
style=${styleMap({
|
|
262
|
+
left: `calc(${percentage}% - var(--thumb-half))`,
|
|
263
|
+
})}
|
|
182
264
|
@keydown=${this.handleKeyDown}
|
|
183
265
|
>
|
|
184
|
-
${this.labeled
|
|
266
|
+
${this.labeled
|
|
267
|
+
? html`<div class="value-label">${this.value}</div>`
|
|
268
|
+
: ''}
|
|
185
269
|
</div>
|
|
186
270
|
</div>
|
|
187
271
|
|
|
188
|
-
${this.showValue
|
|
272
|
+
${this.showValue
|
|
273
|
+
? html`<output class="value-display" aria-live="polite"
|
|
274
|
+
>${this.value}</output
|
|
275
|
+
>`
|
|
276
|
+
: ''}
|
|
189
277
|
</div>
|
|
190
278
|
`;
|
|
191
279
|
}
|
|
192
|
-
}
|
|
280
|
+
}
|