@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/snackbar/snackbar.ts
CHANGED
|
@@ -224,7 +224,7 @@ export class Snackbar extends LitElement {
|
|
|
224
224
|
</div>
|
|
225
225
|
|
|
226
226
|
${this.actionLabel
|
|
227
|
-
? html`<wc-button class="action" variant='text' size='
|
|
227
|
+
? html`<wc-button class="action" variant='text' size='sm' @click=${this.handleActionClick}>
|
|
228
228
|
${this.actionLabel}
|
|
229
229
|
</wc-button>`
|
|
230
230
|
: nothing}
|
|
@@ -232,8 +232,8 @@ export class Snackbar extends LitElement {
|
|
|
232
232
|
${this.showCloseIcon
|
|
233
233
|
? html`<wc-icon-button
|
|
234
234
|
class="close"
|
|
235
|
-
variant='text'
|
|
236
|
-
size='
|
|
235
|
+
variant='text'
|
|
236
|
+
size='sm'
|
|
237
237
|
aria-label="Dismiss notification"
|
|
238
238
|
@click=${this.handleCloseClick}
|
|
239
239
|
>
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
--filled-split-button-container-color: var(--color-on-surface);
|
|
38
38
|
--filled-split-button-label-text-color: var(--color-surface);
|
|
39
39
|
|
|
40
|
-
--tonal-split-button-container-color: var(--color-on-surface-
|
|
40
|
+
--tonal-split-button-container-color: var(--color-on-surface-variant);
|
|
41
41
|
--tonal-split-button-label-text-color: var(--color-surface-container-high);
|
|
42
42
|
|
|
43
43
|
--outlined-split-button-outline-color: var(--color-on-surface);
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
--filled-split-button-label-text-color: var(--color-on-surface);
|
|
50
50
|
|
|
51
51
|
--tonal-split-button-container-color: var(--color-surface-container-high);
|
|
52
|
-
--tonal-split-button-label-text-color: var(--color-on-surface
|
|
52
|
+
--tonal-split-button-label-text-color: var(--color-on-surface);
|
|
53
53
|
|
|
54
54
|
--outlined-split-button-outline-color: var(--color-on-surface);
|
|
55
55
|
--outlined-split-button-label-text-color: var(--color-on-surface);
|
package/src/svg/svg.scss
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
position: fixed;
|
|
47
47
|
inset: 0;
|
|
48
48
|
z-index: 9999;
|
|
49
|
-
background:
|
|
49
|
+
background: color-mix(in srgb, var(--color-scrim) 85%, transparent);
|
|
50
50
|
align-items: center;
|
|
51
51
|
justify-content: center;
|
|
52
52
|
cursor: zoom-out;
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
right: 1rem;
|
|
63
63
|
background: transparent;
|
|
64
64
|
border: none;
|
|
65
|
-
color:
|
|
65
|
+
color: var(--color-white);
|
|
66
66
|
font-size: 1.5rem;
|
|
67
67
|
cursor: pointer;
|
|
68
68
|
line-height: 1;
|
|
69
69
|
padding: 0.25rem 0.5rem;
|
|
70
70
|
|
|
71
71
|
&:focus-visible {
|
|
72
|
-
outline: 2px solid
|
|
72
|
+
outline: 2px solid var(--color-white);
|
|
73
73
|
outline-offset: 2px;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
svg {
|
|
86
86
|
max-width: 90vw;
|
|
87
87
|
max-height: 90vh;
|
|
88
|
-
box-shadow: 0 8px 40px
|
|
89
|
-
border-radius:
|
|
88
|
+
box-shadow: 0 8px 40px color-mix(in srgb, var(--color-shadow) 60%, transparent);
|
|
89
|
+
border-radius: var(--shape-corner-extra-small);
|
|
90
90
|
}
|
|
91
91
|
}
|
package/src/switch/switch.scss
CHANGED
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
justify-content: center;
|
|
53
53
|
border-radius: var(--shape-corner-full);
|
|
54
54
|
transition: all var(--duration-short2) var(--easing-standard);
|
|
55
|
-
background: white;
|
|
56
55
|
height: var(--switch-handle-radius);
|
|
57
56
|
width: var(--switch-handle-radius);
|
|
58
57
|
background: var(--switch-handle-color);
|
package/src/switch/switch.ts
CHANGED
|
@@ -3,6 +3,13 @@ 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 {
|
|
7
|
+
type FormRestoreState,
|
|
8
|
+
type FormValue,
|
|
9
|
+
getFormState,
|
|
10
|
+
getFormValue,
|
|
11
|
+
} from '@/__internal/mixins/form-associated.js';
|
|
12
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
6
13
|
|
|
7
14
|
import styles from './switch.scss';
|
|
8
15
|
import BaseInput from '../input/BaseInput.js';
|
|
@@ -15,6 +22,7 @@ import BaseInput from '../input/BaseInput.js';
|
|
|
15
22
|
* @summary Captures boolean input with an on/off switch interaction.
|
|
16
23
|
* @overview
|
|
17
24
|
* <p>Toggles are used to enable or disable a single option. They provide immediate feedback about whether an option is active or inactive.</p>
|
|
25
|
+
* <p>The switch is form-associated: when <code>checked</code>, it submits <code>on</code> under its <code>name</code>.</p>
|
|
18
26
|
*
|
|
19
27
|
* @cssprop --switch-track-color: Color of the switch track when checked.
|
|
20
28
|
* @cssprop --switch-track-off-color: Color of the switch track when unchecked.
|
|
@@ -23,27 +31,41 @@ import BaseInput from '../input/BaseInput.js';
|
|
|
23
31
|
* @cssprop --switch-handle-radius: Size of the switch handle.
|
|
24
32
|
* @cssprop --switch-handle-color: Color of the switch handle.
|
|
25
33
|
*
|
|
26
|
-
* @fires {CustomEvent} change - Dispatched when the switch value
|
|
34
|
+
* @fires {CustomEvent} change - Dispatched when the switch is toggled. Detail: `{ checked, value, originalEvent }`.
|
|
27
35
|
* @fires {CustomEvent} blur - Dispatched when the switch loses focus.
|
|
28
36
|
* @fires {CustomEvent} focus - Dispatched when the switch receives focus.
|
|
29
37
|
*
|
|
30
38
|
* @example
|
|
31
39
|
* ```html
|
|
32
|
-
* <wc-switch
|
|
40
|
+
* <wc-switch checked label="Wi-Fi"></wc-switch>
|
|
33
41
|
* ```
|
|
34
42
|
* @tags input, form
|
|
35
43
|
*/
|
|
44
|
+
@IndividualComponent
|
|
36
45
|
export class Switch extends BaseInput {
|
|
46
|
+
// ── Static ───────────────────────────────────────────────────────────────
|
|
47
|
+
|
|
37
48
|
static styles = [styles];
|
|
38
49
|
|
|
39
|
-
|
|
40
|
-
value: boolean = false;
|
|
50
|
+
// ── Properties ───────────────────────────────────────────────────────────
|
|
41
51
|
|
|
42
52
|
/**
|
|
43
|
-
*
|
|
53
|
+
* Whether the switch is on.
|
|
44
54
|
*/
|
|
45
|
-
@property({ type:
|
|
46
|
-
|
|
55
|
+
@property({ type: Boolean, reflect: true })
|
|
56
|
+
checked: boolean = false;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Use `checked`. Kept as an alias of `checked`.
|
|
60
|
+
*/
|
|
61
|
+
@property({ type: Boolean })
|
|
62
|
+
get value(): boolean {
|
|
63
|
+
return this.checked;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
set value(value: boolean) {
|
|
67
|
+
this.checked = Boolean(value);
|
|
68
|
+
}
|
|
47
69
|
|
|
48
70
|
/**
|
|
49
71
|
* The switch label.
|
|
@@ -57,24 +79,6 @@ export class Switch extends BaseInput {
|
|
|
57
79
|
@property({ type: Boolean })
|
|
58
80
|
rounded: boolean = true;
|
|
59
81
|
|
|
60
|
-
/**
|
|
61
|
-
* If true, required icon is shown. Defaults to `false`.
|
|
62
|
-
*/
|
|
63
|
-
@property({ type: Boolean, reflect: true })
|
|
64
|
-
required: boolean = false;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* If true, the toggle is readonly. Defaults to `false`.
|
|
68
|
-
*/
|
|
69
|
-
@property({ type: Boolean, reflect: true })
|
|
70
|
-
readonly: boolean = false;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* If true, the user cannot interact with the toggle. Defaults to `false`.
|
|
74
|
-
*/
|
|
75
|
-
@property({ type: Boolean, reflect: true })
|
|
76
|
-
disabled: boolean = false;
|
|
77
|
-
|
|
78
82
|
@property({ type: Boolean, reflect: true, attribute: 'with-icon' })
|
|
79
83
|
withIcon: boolean = false;
|
|
80
84
|
|
|
@@ -84,6 +88,8 @@ export class Switch extends BaseInput {
|
|
|
84
88
|
@property({ type: Object })
|
|
85
89
|
configAria: Record<string, string> = {};
|
|
86
90
|
|
|
91
|
+
// ── State ────────────────────────────────────────────────────────────────
|
|
92
|
+
|
|
87
93
|
@state()
|
|
88
94
|
private hasFocus = false;
|
|
89
95
|
|
|
@@ -93,14 +99,17 @@ export class Switch extends BaseInput {
|
|
|
93
99
|
@state()
|
|
94
100
|
private slotHasContent = false;
|
|
95
101
|
|
|
102
|
+
// ── Queries ──────────────────────────────────────────────────────────────
|
|
103
|
+
|
|
96
104
|
@query('.track')
|
|
97
105
|
private trackElement?: HTMLElement;
|
|
98
106
|
|
|
99
|
-
|
|
100
|
-
private nativeElement?: HTMLInputElement;
|
|
107
|
+
// ── Private fields ───────────────────────────────────────────────────────
|
|
101
108
|
|
|
102
109
|
private tabindex?: string;
|
|
103
110
|
|
|
111
|
+
// ── Lifecycle ────────────────────────────────────────────────────────────
|
|
112
|
+
|
|
104
113
|
connectedCallback() {
|
|
105
114
|
super.connectedCallback();
|
|
106
115
|
this.handleInitialAttributes();
|
|
@@ -118,6 +127,38 @@ export class Switch extends BaseInput {
|
|
|
118
127
|
this.slotHasContent = this.hasChildNodes();
|
|
119
128
|
}
|
|
120
129
|
|
|
130
|
+
// ── Public methods ───────────────────────────────────────────────────────
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Sets focus on the toggle.
|
|
134
|
+
*/
|
|
135
|
+
focus() {
|
|
136
|
+
this.trackElement?.focus();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Removes focus from the toggle.
|
|
141
|
+
*/
|
|
142
|
+
blur() {
|
|
143
|
+
this.trackElement?.blur();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// ── Form association ─────────────────────────────────────────────────────
|
|
147
|
+
|
|
148
|
+
override [getFormValue](): FormValue | null {
|
|
149
|
+
return this.checked ? 'on' : null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
override [getFormState](): FormValue | null {
|
|
153
|
+
return String(this.checked);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
override formStateRestoreCallback(state: FormRestoreState | null) {
|
|
157
|
+
this.checked = state === 'true';
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ── Private methods ──────────────────────────────────────────────────────
|
|
161
|
+
|
|
121
162
|
private handleInitialAttributes() {
|
|
122
163
|
if (this.hasAttribute('tabindex')) {
|
|
123
164
|
this.tabindex = this.getAttribute('tabindex') || undefined;
|
|
@@ -158,10 +199,14 @@ export class Switch extends BaseInput {
|
|
|
158
199
|
|
|
159
200
|
private clickHandler = (ev: MouseEvent | KeyboardEvent) => {
|
|
160
201
|
if (!this.disabled && !this.readonly) {
|
|
161
|
-
this.
|
|
202
|
+
this.checked = !this.checked;
|
|
162
203
|
this.dispatchEvent(
|
|
163
204
|
new CustomEvent('change', {
|
|
164
|
-
detail: {
|
|
205
|
+
detail: {
|
|
206
|
+
checked: this.checked,
|
|
207
|
+
value: this.checked,
|
|
208
|
+
originalEvent: ev,
|
|
209
|
+
},
|
|
165
210
|
bubbles: true,
|
|
166
211
|
composed: true,
|
|
167
212
|
}),
|
|
@@ -198,33 +243,23 @@ export class Switch extends BaseInput {
|
|
|
198
243
|
}
|
|
199
244
|
};
|
|
200
245
|
|
|
201
|
-
|
|
202
|
-
* Sets focus on the toggle.
|
|
203
|
-
*/
|
|
204
|
-
focus() {
|
|
205
|
-
this.trackElement?.focus();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Removes focus from the toggle.
|
|
210
|
-
*/
|
|
211
|
-
blur() {
|
|
212
|
-
this.trackElement?.blur();
|
|
213
|
-
}
|
|
246
|
+
// ── Render helpers ───────────────────────────────────────────────────────
|
|
214
247
|
|
|
215
248
|
__renderIcon() {
|
|
216
249
|
if (this.withIcon) {
|
|
217
|
-
if (this.
|
|
250
|
+
if (this.checked)
|
|
218
251
|
return html`<wc-icon name="check" class="icon"></wc-icon>`;
|
|
219
252
|
return html`<wc-icon name="close" class="icon"></wc-icon>`;
|
|
220
253
|
}
|
|
221
254
|
return nothing;
|
|
222
255
|
}
|
|
223
256
|
|
|
257
|
+
// ── Render ───────────────────────────────────────────────────────────────
|
|
258
|
+
|
|
224
259
|
render() {
|
|
225
260
|
const cssClasses = {
|
|
226
261
|
switch: true,
|
|
227
|
-
'state-checked': this.
|
|
262
|
+
'state-checked': this.checked,
|
|
228
263
|
'has-focus': this.hasFocus,
|
|
229
264
|
active: this.isActive,
|
|
230
265
|
disabled: this.disabled,
|
|
@@ -244,10 +279,10 @@ export class Switch extends BaseInput {
|
|
|
244
279
|
@keydown=${this.keyDownHandler}
|
|
245
280
|
@blur=${this.blurHandler}
|
|
246
281
|
@focus=${this.focusHandler}
|
|
247
|
-
role="
|
|
282
|
+
role="switch"
|
|
248
283
|
aria-disabled=${this.disabled}
|
|
249
284
|
aria-required=${this.required}
|
|
250
|
-
aria-checked=${this.
|
|
285
|
+
aria-checked=${this.checked}
|
|
251
286
|
${spread(this.configAria)}
|
|
252
287
|
>
|
|
253
288
|
<div class="handle">${this.__renderIcon()}</div>
|
|
@@ -257,7 +292,7 @@ export class Switch extends BaseInput {
|
|
|
257
292
|
type="checkbox"
|
|
258
293
|
class="input-native"
|
|
259
294
|
name=${this.name}
|
|
260
|
-
.checked=${this.
|
|
295
|
+
.checked=${this.checked}
|
|
261
296
|
aria-hidden="true"
|
|
262
297
|
?required=${this.required}
|
|
263
298
|
tabindex="-1"
|
package/src/tabs/tab.scss
CHANGED
|
@@ -150,7 +150,8 @@
|
|
|
150
150
|
--_container-shape-end-start: var(--shape-corner-small);
|
|
151
151
|
--_container-shape-end-end: var(--shape-corner-small);
|
|
152
152
|
--_active-indicator-color: var(--color-primary);
|
|
153
|
-
--_active-indicator-shape:
|
|
153
|
+
--_active-indicator-shape: var(--shape-corner-extra-small)
|
|
154
|
+
var(--shape-corner-extra-small) 0 0;
|
|
154
155
|
--_active-indicator-height: 2px;
|
|
155
156
|
|
|
156
157
|
.focus-ring {
|
package/src/tabs/tabs.ts
CHANGED
|
@@ -13,6 +13,9 @@ import IndividualComponent from '@/IndividualComponent.js';
|
|
|
13
13
|
* @overview
|
|
14
14
|
* <p>Tabs holds the tab buttons and manages their layout.</p>
|
|
15
15
|
*
|
|
16
|
+
* @fires {CustomEvent<{index: number, value: string}>} change - Dispatched when the user activates a tab.
|
|
17
|
+
* @fires {CustomEvent<{index: number, value: string}>} tab-click - Deprecated alias of `change`, fired alongside it.
|
|
18
|
+
*
|
|
16
19
|
* @example
|
|
17
20
|
* ```html
|
|
18
21
|
* <wc-tabs>
|
|
@@ -176,14 +179,17 @@ export class Tabs extends LitElement {
|
|
|
176
179
|
this.__animateIndicatorTransition(previousActiveTab, clickedTab);
|
|
177
180
|
this.__lastActiveTab = clickedTab;
|
|
178
181
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
const detail = {
|
|
183
|
+
index: clickedIndex,
|
|
184
|
+
value: (clickedTab as Tab).value,
|
|
185
|
+
};
|
|
186
|
+
this.dispatchEvent(
|
|
187
|
+
new CustomEvent('change', { bubbles: true, composed: true, detail }),
|
|
188
|
+
);
|
|
189
|
+
// Deprecated name, still what wc-tab-group listens for.
|
|
190
|
+
this.dispatchEvent(
|
|
191
|
+
new CustomEvent('tab-click', { bubbles: true, composed: true, detail }),
|
|
192
|
+
);
|
|
187
193
|
};
|
|
188
194
|
|
|
189
195
|
render() {
|
package/src/textarea/textarea.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { property, query, state } from 'lit/decorators.js';
|
|
|
4
4
|
import { redispatchEvent } from '@/__internal/utils/dispatch-event-utils.js';
|
|
5
5
|
import { spread } from '@/__internal/directive/spread.js';
|
|
6
6
|
|
|
7
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
7
8
|
import BaseInput from '../input/BaseInput.js';
|
|
8
9
|
import styles from './textarea.scss';
|
|
9
10
|
|
|
@@ -19,15 +20,13 @@ import styles from './textarea.scss';
|
|
|
19
20
|
* <wc-textarea label="Description" placeholder="Enter text"></wc-textarea>
|
|
20
21
|
* ```
|
|
21
22
|
*/
|
|
23
|
+
@IndividualComponent
|
|
22
24
|
export class Textarea extends BaseInput {
|
|
23
25
|
static styles = [styles];
|
|
24
26
|
|
|
25
27
|
@property({ type: String })
|
|
26
28
|
value = '';
|
|
27
29
|
|
|
28
|
-
@property({ type: String })
|
|
29
|
-
name: string = '';
|
|
30
|
-
|
|
31
30
|
@property({ type: String }) placeholder = '';
|
|
32
31
|
|
|
33
32
|
@property({ type: String }) label = '';
|
|
@@ -4,6 +4,7 @@ import { property, query, state } from 'lit/decorators.js';
|
|
|
4
4
|
import { redispatchEvent } from '@/__internal/utils/dispatch-event-utils.js';
|
|
5
5
|
import { spread } from '@/__internal/directive/spread.js';
|
|
6
6
|
|
|
7
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
7
8
|
import BaseInput from '../input/BaseInput.js';
|
|
8
9
|
import styles from './time-picker.scss';
|
|
9
10
|
|
|
@@ -19,15 +20,13 @@ import styles from './time-picker.scss';
|
|
|
19
20
|
* <wc-time-picker label="Time" placeholder="Select a time"></wc-time-picker>
|
|
20
21
|
* ```
|
|
21
22
|
*/
|
|
23
|
+
@IndividualComponent
|
|
22
24
|
export class TimePicker extends BaseInput {
|
|
23
25
|
static styles = [styles];
|
|
24
26
|
|
|
25
27
|
@property({ type: String })
|
|
26
28
|
value = '';
|
|
27
29
|
|
|
28
|
-
@property({ type: String })
|
|
29
|
-
name: string = '';
|
|
30
|
-
|
|
31
30
|
@property({ type: String }) placeholder = '';
|
|
32
31
|
|
|
33
32
|
@property({ type: String }) label = '';
|
package/src/toolbar/toolbar.scss
CHANGED
|
@@ -81,20 +81,20 @@
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/* Size variants */
|
|
84
|
-
&.size-
|
|
84
|
+
&.size-sm {
|
|
85
85
|
--toolbar-height: 5rem;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
&.size-
|
|
88
|
+
&.size-md {
|
|
89
89
|
--toolbar-height: 6rem;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
&.size-
|
|
92
|
+
&.size-lg {
|
|
93
93
|
--toolbar-height: 7rem;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
&.elevated {
|
|
97
|
-
--toolbar-shadow: var(--elevation-
|
|
97
|
+
--toolbar-shadow: var(--elevation-level3);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
package/src/toolbar/toolbar.ts
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import IndividualComponent from '@/IndividualComponent.js';
|
|
5
|
+
import {
|
|
6
|
+
type LegacySize,
|
|
7
|
+
normalizeSize,
|
|
8
|
+
type Size,
|
|
9
|
+
} from '@/__internal/utils/size.js';
|
|
5
10
|
import styles from './toolbar.scss';
|
|
6
11
|
import colorStyles from './toolbar-colors.scss';
|
|
7
12
|
|
|
@@ -83,12 +88,14 @@ export class Toolbar extends LitElement {
|
|
|
83
88
|
|
|
84
89
|
/**
|
|
85
90
|
* Size of the docked toolbar.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
* - `"sm"`: 80dp height (default).
|
|
92
|
+
* - `"md"`: 96dp height.
|
|
93
|
+
* - `"lg"`: 112dp height.
|
|
94
|
+
*
|
|
95
|
+
* The long names `"small"`, `"medium"` and `"large"` still work but are deprecated.
|
|
89
96
|
*/
|
|
90
97
|
@property({ type: String, reflect: true })
|
|
91
|
-
size:
|
|
98
|
+
size: Size | LegacySize = 'sm';
|
|
92
99
|
|
|
93
100
|
/**
|
|
94
101
|
* Whether the toolbar is visually elevated (adds a shadow).
|
|
@@ -101,7 +108,7 @@ export class Toolbar extends LitElement {
|
|
|
101
108
|
toolbar: true,
|
|
102
109
|
[`variant-${this.variant}`]: true,
|
|
103
110
|
[`orientation-${this.orientation}`]: true,
|
|
104
|
-
[`size-${this.size}`]: true,
|
|
111
|
+
[`size-${normalizeSize(this.size, 'sm')}`]: true,
|
|
105
112
|
elevated: this.elevated,
|
|
106
113
|
};
|
|
107
114
|
|
|
@@ -3,6 +3,7 @@ import { property, query, state } from 'lit/decorators.js';
|
|
|
3
3
|
|
|
4
4
|
import { redispatchEvent } from '@/__internal/utils/dispatch-event-utils.js';
|
|
5
5
|
|
|
6
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
6
7
|
import BaseInput from '../input/BaseInput.js';
|
|
7
8
|
import styles from './url-field.scss';
|
|
8
9
|
|
|
@@ -21,15 +22,13 @@ import styles from './url-field.scss';
|
|
|
21
22
|
* ```
|
|
22
23
|
* @tags form
|
|
23
24
|
*/
|
|
25
|
+
@IndividualComponent
|
|
24
26
|
export class UrlField extends BaseInput {
|
|
25
27
|
static styles = [styles];
|
|
26
28
|
|
|
27
29
|
@property({ type: String })
|
|
28
30
|
value: string = '';
|
|
29
31
|
|
|
30
|
-
@property({ type: String })
|
|
31
|
-
name: string = '';
|
|
32
|
-
|
|
33
32
|
@property({ type: String })
|
|
34
33
|
placeholder: string = '';
|
|
35
34
|
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { _ as __decorate, a as i } from './IndividualComponent-Bdwyrvd6.js';
|
|
2
|
-
import { n } from './property-B49QQ8pS.js';
|
|
3
|
-
|
|
4
|
-
class BaseInput extends i {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.disabled = false;
|
|
8
|
-
this.readonly = false;
|
|
9
|
-
this.required = false;
|
|
10
|
-
this.skeleton = false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
__decorate([
|
|
14
|
-
n({ type: Boolean, reflect: true })
|
|
15
|
-
], BaseInput.prototype, "disabled", void 0);
|
|
16
|
-
__decorate([
|
|
17
|
-
n({ type: Boolean, reflect: true })
|
|
18
|
-
], BaseInput.prototype, "readonly", void 0);
|
|
19
|
-
__decorate([
|
|
20
|
-
n({ type: Boolean, reflect: true })
|
|
21
|
-
], BaseInput.prototype, "required", void 0);
|
|
22
|
-
__decorate([
|
|
23
|
-
n({ type: Boolean, reflect: true })
|
|
24
|
-
], BaseInput.prototype, "skeleton", void 0);
|
|
25
|
-
|
|
26
|
-
export { BaseInput as B };
|
|
27
|
-
//# sourceMappingURL=BaseInput-CU1zZYKc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput-CU1zZYKc.js","sources":["../../src/input/BaseInput.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nexport default abstract class BaseInput extends LitElement {\n value?: any;\n\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n readonly: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n required: boolean = false;\n\n @property({ type: Boolean, reflect: true })\n skeleton = false;\n}\n"],"names":["LitElement","property"],"mappings":";;;AAGc,MAAgB,SAAU,SAAQA,CAAU,CAAA;AAA1D,IAAA,WAAA,GAAA;;QAIE,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,QAAQ,GAAY,KAAK;QAGzB,IAAA,CAAA,QAAQ,GAAG,KAAK;IAClB;AAAC;AAVC,UAAA,CAAA;IADCC,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAG1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AACzB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;;;;"}
|