@redvars/peacock 3.10.0 → 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 +8620 -4714
- 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 +34 -4
- 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/menu.js +1 -1
- 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/option.js +17 -0
- package/dist/option.js.map +1 -1
- 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/field/field.d.ts +2 -0
- 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 +7 -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/select.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/field/field.ts +5 -1
- 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/menu.scss +1 -1
- 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/option.ts +17 -0
- package/src/select/select.ts +33 -8
- 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-CnnPbvpQ.js +0 -3955
- package/dist/select-CnnPbvpQ.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
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { i, _ as __decorate, I as IndividualComponent, b } from './IndividualComponent-Bdwyrvd6.js';
|
|
2
|
+
import { n } from './property-B49QQ8pS.js';
|
|
3
|
+
import { r } from './state-DkTK9EGF.js';
|
|
4
|
+
import { e } from './query-CHb9Ft_d.js';
|
|
5
|
+
import { r as redispatchEvent } from './dispatch-event-utils-CuEqjlPT.js';
|
|
6
|
+
import { s as spread } from './spread-B5cgadZl.js';
|
|
7
|
+
import { B as BaseInput } from './BaseInput-CV0pZgSb.js';
|
|
8
|
+
import './base-Cl6v8-BZ.js';
|
|
9
|
+
import './directive-ZPhl09Yt.js';
|
|
10
|
+
import './element-internals-QME0yEz4.js';
|
|
11
|
+
import './form-associated-Bhwwr6dT.js';
|
|
12
|
+
|
|
13
|
+
var css_248z = i`* {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
-webkit-tap-highlight-color: transparent;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.screen-reader-only {
|
|
19
|
+
display: none !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[hidden] {
|
|
23
|
+
display: none !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.input-element {
|
|
32
|
+
border: none;
|
|
33
|
+
outline: none;
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.input-wrapper .input {
|
|
39
|
+
flex: 1;
|
|
40
|
+
width: 100%;
|
|
41
|
+
background: none;
|
|
42
|
+
cursor: inherit;
|
|
43
|
+
}
|
|
44
|
+
.input-wrapper .input::-webkit-inner-spin-button,
|
|
45
|
+
.input-wrapper .input::-webkit-calendar-picker-indicator {
|
|
46
|
+
display: none;
|
|
47
|
+
-webkit-appearance: none;
|
|
48
|
+
}`;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @label Date Picker
|
|
52
|
+
* @tag wc-date-picker
|
|
53
|
+
* @rawTag date-picker
|
|
54
|
+
* @summary The Date Picker component is used to capture date user input.
|
|
55
|
+
* @tags input
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```html
|
|
59
|
+
* <wc-date-picker label="Date" placeholder="Select a date"></wc-date-picker>
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
let DatePicker = class DatePicker extends BaseInput {
|
|
63
|
+
constructor() {
|
|
64
|
+
super(...arguments);
|
|
65
|
+
this.value = '';
|
|
66
|
+
this.placeholder = '';
|
|
67
|
+
this.label = '';
|
|
68
|
+
this.inline = false;
|
|
69
|
+
this.size = 'md';
|
|
70
|
+
this.autocomplete = 'off';
|
|
71
|
+
this.configAria = {};
|
|
72
|
+
this.variant = 'default';
|
|
73
|
+
/**
|
|
74
|
+
* Helper text to display below the input.
|
|
75
|
+
*/
|
|
76
|
+
this.helperText = '';
|
|
77
|
+
this.error = false;
|
|
78
|
+
this.errorText = '';
|
|
79
|
+
this.warning = false;
|
|
80
|
+
this.warningText = '';
|
|
81
|
+
this.focused = false;
|
|
82
|
+
this.passwordVisible = false;
|
|
83
|
+
/**
|
|
84
|
+
* Returns true when the text field has been interacted with. Native
|
|
85
|
+
* validation errors only display in response to user interactions.
|
|
86
|
+
*/
|
|
87
|
+
this.dirty = false;
|
|
88
|
+
}
|
|
89
|
+
connectedCallback() {
|
|
90
|
+
super.connectedCallback();
|
|
91
|
+
this.handleInitialAttributes();
|
|
92
|
+
}
|
|
93
|
+
handleInitialAttributes() {
|
|
94
|
+
if (this.hasAttribute('tabindex')) {
|
|
95
|
+
this.tabindex = this.getAttribute('tabindex') || undefined;
|
|
96
|
+
this.removeAttribute('tabindex');
|
|
97
|
+
}
|
|
98
|
+
Array.from(this.attributes).forEach(attr => {
|
|
99
|
+
if (attr.name.startsWith('aria-')) {
|
|
100
|
+
this.configAria[attr.name] = attr.value;
|
|
101
|
+
this.removeAttribute(attr.name);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
__handleInput(event) {
|
|
106
|
+
this.dirty = true;
|
|
107
|
+
this.value = event.target.value;
|
|
108
|
+
}
|
|
109
|
+
focus() {
|
|
110
|
+
this.inputElement?.focus();
|
|
111
|
+
}
|
|
112
|
+
blur() {
|
|
113
|
+
this.inputElement?.blur();
|
|
114
|
+
}
|
|
115
|
+
__handleFocusChange() {
|
|
116
|
+
// When calling focus() or reportValidity() during change, it's possible
|
|
117
|
+
// for blur to be called after the new focus event. Rather than set
|
|
118
|
+
// `this.focused` to true/false on focus/blur, we always set it to whether
|
|
119
|
+
// or not the input itself is focused.
|
|
120
|
+
this.focused = this.inputElement?.matches(':focus') ?? false;
|
|
121
|
+
}
|
|
122
|
+
__redispatchEvent(event) {
|
|
123
|
+
redispatchEvent(this, event);
|
|
124
|
+
}
|
|
125
|
+
render() {
|
|
126
|
+
return b `
|
|
127
|
+
<wc-field
|
|
128
|
+
?required=${this.required}
|
|
129
|
+
?disabled=${this.disabled}
|
|
130
|
+
?readonly=${this.readonly}
|
|
131
|
+
?skeleton=${this.skeleton}
|
|
132
|
+
helper-text=${this.helperText}
|
|
133
|
+
?error=${this.error}
|
|
134
|
+
error-text=${this.errorText}
|
|
135
|
+
?warning=${this.warning}
|
|
136
|
+
variant=${this.variant}
|
|
137
|
+
?populated=${!!this.value}
|
|
138
|
+
warning-text=${this.warningText}
|
|
139
|
+
label=${this.label}
|
|
140
|
+
?focused=${this.focused}
|
|
141
|
+
.host=${this}
|
|
142
|
+
class="input-wrapper"
|
|
143
|
+
>
|
|
144
|
+
<slot name="start" slot="field-start"></slot>
|
|
145
|
+
|
|
146
|
+
<input
|
|
147
|
+
class="input input-element"
|
|
148
|
+
name=${this.name}
|
|
149
|
+
type="date"
|
|
150
|
+
placeholder=${this.placeholder}
|
|
151
|
+
autocomplete=${this.autocomplete}
|
|
152
|
+
.value=${this.value}
|
|
153
|
+
?tabindex=${this.tabindex}
|
|
154
|
+
?readonly=${this.readonly}
|
|
155
|
+
?required=${this.required}
|
|
156
|
+
?disabled=${this.disabled}
|
|
157
|
+
@input=${this.__handleInput}
|
|
158
|
+
@change=${this.__redispatchEvent}
|
|
159
|
+
@focus=${this.__handleFocusChange}
|
|
160
|
+
@blur=${this.__handleFocusChange}
|
|
161
|
+
${spread(this.configAria)}
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
<slot name="end" slot="field-end"></slot>
|
|
165
|
+
|
|
166
|
+
<wc-icon-button
|
|
167
|
+
slot="field-end"
|
|
168
|
+
color="secondary"
|
|
169
|
+
variant="text"
|
|
170
|
+
?disabled=${this.disabled}
|
|
171
|
+
@click=${() => {
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
// @ts-ignore
|
|
174
|
+
this.inputElement.showPicker();
|
|
175
|
+
});
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
<wc-icon name="calendar_today"></wc-icon>
|
|
179
|
+
</wc-icon-button>
|
|
180
|
+
</wc-field>
|
|
181
|
+
`;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
DatePicker.styles = [css_248z];
|
|
185
|
+
__decorate([
|
|
186
|
+
n({ type: String })
|
|
187
|
+
], DatePicker.prototype, "value", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
n({ type: String })
|
|
190
|
+
], DatePicker.prototype, "placeholder", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
n({ type: String })
|
|
193
|
+
], DatePicker.prototype, "label", void 0);
|
|
194
|
+
__decorate([
|
|
195
|
+
n({ type: Boolean, reflect: true })
|
|
196
|
+
], DatePicker.prototype, "inline", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
n({ type: String, reflect: true })
|
|
199
|
+
], DatePicker.prototype, "size", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
n({ type: String })
|
|
202
|
+
], DatePicker.prototype, "autocomplete", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
n({ type: Object })
|
|
205
|
+
], DatePicker.prototype, "configAria", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
n({ type: String })
|
|
208
|
+
], DatePicker.prototype, "variant", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
n({ type: String, attribute: 'helper-text' })
|
|
211
|
+
], DatePicker.prototype, "helperText", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
n({ type: Boolean })
|
|
214
|
+
], DatePicker.prototype, "error", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
n({ type: String, attribute: 'error-text' })
|
|
217
|
+
], DatePicker.prototype, "errorText", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
n({ type: Boolean })
|
|
220
|
+
], DatePicker.prototype, "warning", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
n({ type: String, attribute: 'warning-text' })
|
|
223
|
+
], DatePicker.prototype, "warningText", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
r()
|
|
226
|
+
], DatePicker.prototype, "focused", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
r()
|
|
229
|
+
], DatePicker.prototype, "passwordVisible", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
r()
|
|
232
|
+
], DatePicker.prototype, "dirty", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
e('.input-element')
|
|
235
|
+
], DatePicker.prototype, "inputElement", void 0);
|
|
236
|
+
DatePicker = __decorate([
|
|
237
|
+
IndividualComponent
|
|
238
|
+
], DatePicker);
|
|
239
|
+
|
|
240
|
+
export { DatePicker };
|
|
241
|
+
//# sourceMappingURL=date-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.js","sources":["../../src/date-picker/date-picker.ts"],"sourcesContent":["import { html } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\n\nimport { redispatchEvent } from '@/__internal/utils/dispatch-event-utils.js';\nimport { spread } from '@/__internal/directive/spread.js';\n\nimport IndividualComponent from '@/IndividualComponent.js';\nimport BaseInput from '../input/BaseInput.js';\nimport styles from './date-picker.scss';\n\n/**\n * @label Date Picker\n * @tag wc-date-picker\n * @rawTag date-picker\n * @summary The Date Picker component is used to capture date user input.\n * @tags input\n *\n * @example\n * ```html\n * <wc-date-picker label=\"Date\" placeholder=\"Select a date\"></wc-date-picker>\n * ```\n */\n@IndividualComponent\nexport class DatePicker extends BaseInput {\n static styles = [styles];\n\n @property({ type: String })\n value = '';\n\n @property({ type: String }) placeholder = '';\n\n @property({ type: String }) label = '';\n\n @property({ type: Boolean, reflect: true }) inline = false;\n\n @property({ type: String, reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ type: String }) autocomplete: 'on' | 'off' = 'off';\n\n @property({ type: Object }) configAria: Record<string, string> = {};\n\n @property({ type: String })\n variant: 'filled' | 'outlined' | 'default' = 'default';\n\n /**\n * Helper text to display below the input.\n */\n @property({ type: String, attribute: 'helper-text' })\n helperText: string = '';\n\n @property({ type: Boolean })\n error: boolean = false;\n\n @property({ type: String, attribute: 'error-text' })\n errorText: string = '';\n\n @property({ type: Boolean })\n warning: boolean = false;\n\n @property({ type: String, attribute: 'warning-text' })\n warningText: string = '';\n\n @state()\n private focused = false;\n\n @state()\n private passwordVisible = false;\n\n /**\n * Returns true when the text field has been interacted with. Native\n * validation errors only display in response to user interactions.\n */\n @state() private dirty = false;\n\n @query('.input-element')\n private inputElement?: HTMLInputElement;\n\n private tabindex?: string;\n\n connectedCallback() {\n super.connectedCallback();\n this.handleInitialAttributes();\n }\n\n private handleInitialAttributes() {\n if (this.hasAttribute('tabindex')) {\n this.tabindex = this.getAttribute('tabindex') || undefined;\n this.removeAttribute('tabindex');\n }\n\n Array.from(this.attributes).forEach(attr => {\n if (attr.name.startsWith('aria-')) {\n this.configAria[attr.name] = attr.value;\n this.removeAttribute(attr.name);\n }\n });\n }\n\n private __handleInput(event: InputEvent) {\n this.dirty = true;\n this.value = (event.target as HTMLInputElement).value;\n }\n\n override focus() {\n this.inputElement?.focus();\n }\n\n override blur() {\n this.inputElement?.blur();\n }\n\n private __handleFocusChange() {\n // When calling focus() or reportValidity() during change, it's possible\n // for blur to be called after the new focus event. Rather than set\n // `this.focused` to true/false on focus/blur, we always set it to whether\n // or not the input itself is focused.\n this.focused = this.inputElement?.matches(':focus') ?? false;\n }\n\n private __redispatchEvent(event: Event) {\n redispatchEvent(this, event);\n }\n\n render() {\n return html`\n <wc-field\n ?required=${this.required}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?skeleton=${this.skeleton}\n helper-text=${this.helperText}\n ?error=${this.error}\n error-text=${this.errorText}\n ?warning=${this.warning}\n variant=${this.variant}\n ?populated=${!!this.value}\n warning-text=${this.warningText}\n label=${this.label}\n ?focused=${this.focused}\n .host=${this}\n class=\"input-wrapper\"\n >\n <slot name=\"start\" slot=\"field-start\"></slot>\n\n <input\n class=\"input input-element\"\n name=${this.name}\n type=\"date\"\n placeholder=${this.placeholder}\n autocomplete=${this.autocomplete}\n .value=${this.value}\n ?tabindex=${this.tabindex}\n ?readonly=${this.readonly}\n ?required=${this.required}\n ?disabled=${this.disabled}\n @input=${this.__handleInput}\n @change=${this.__redispatchEvent}\n @focus=${this.__handleFocusChange}\n @blur=${this.__handleFocusChange}\n ${spread(this.configAria)}\n />\n\n <slot name=\"end\" slot=\"field-end\"></slot>\n\n <wc-icon-button\n slot=\"field-end\"\n color=\"secondary\"\n variant=\"text\"\n ?disabled=${this.disabled}\n @click=${() => {\n setTimeout(() => {\n // @ts-ignore\n this.inputElement.showPicker();\n });\n }}\n >\n <wc-icon name=\"calendar_today\"></wc-icon>\n </wc-icon-button>\n </wc-field>\n `;\n }\n}\n"],"names":["html","styles","property","state","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA;;;;;;;;;;;AAWG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,SAAS,CAAA;AAAlC,IAAA,WAAA,GAAA;;QAIL,IAAA,CAAA,KAAK,GAAG,EAAE;QAEkB,IAAA,CAAA,WAAW,GAAG,EAAE;QAEhB,IAAA,CAAA,KAAK,GAAG,EAAE;QAEM,IAAA,CAAA,MAAM,GAAG,KAAK;QAEf,IAAA,CAAA,IAAI,GAAuB,IAAI;QAE9C,IAAA,CAAA,YAAY,GAAiB,KAAK;QAElC,IAAA,CAAA,UAAU,GAA2B,EAAE;QAGnE,IAAA,CAAA,OAAO,GAAsC,SAAS;AAEtD;;AAEG;QAEH,IAAA,CAAA,UAAU,GAAW,EAAE;QAGvB,IAAA,CAAA,KAAK,GAAY,KAAK;QAGtB,IAAA,CAAA,SAAS,GAAW,EAAE;QAGtB,IAAA,CAAA,OAAO,GAAY,KAAK;QAGxB,IAAA,CAAA,WAAW,GAAW,EAAE;QAGhB,IAAA,CAAA,OAAO,GAAG,KAAK;QAGf,IAAA,CAAA,eAAe,GAAG,KAAK;AAE/B;;;AAGG;QACc,IAAA,CAAA,KAAK,GAAG,KAAK;IA6GhC;IAtGE,iBAAiB,GAAA;QACf,KAAK,CAAC,iBAAiB,EAAE;QACzB,IAAI,CAAC,uBAAuB,EAAE;IAChC;IAEQ,uBAAuB,GAAA;AAC7B,QAAA,IAAI,IAAI,CAAC,Y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
|
|
252
|
-
* @example
|
|
253
|
-
* ```ts
|
|
254
|
-
* class MyElement extends mixinElementInternals(LitElement) {
|
|
255
|
-
* constructor() {
|
|
256
|
-
* super();
|
|
257
|
-
* this[internals].role = 'button';
|
|
258
|
-
* }
|
|
259
|
-
* }
|
|
260
|
-
* ```
|
|
261
|
-
*/
|
|
262
|
-
const internals = Symbol('internals');
|
|
263
|
-
// Private symbols
|
|
264
|
-
const privateInternals = Symbol('privateInternals');
|
|
265
|
-
/**
|
|
266
|
-
* Mixes in an attached `ElementInternals` instance.
|
|
267
|
-
*
|
|
268
|
-
* This mixin is only needed when other shared code needs access to a
|
|
269
|
-
* component's `ElementInternals`, such as form-associated mixins.
|
|
270
|
-
*
|
|
271
|
-
* @param base The class to mix functionality into.
|
|
272
|
-
* @return The provided class with `WithElementInternals` mixed in.
|
|
273
|
-
*/
|
|
274
|
-
function mixinElementInternals(base) {
|
|
275
|
-
class WithElementInternalsElement extends base {
|
|
276
|
-
get [internals]() {
|
|
277
|
-
// Create internals in getter so that it can be used in methods called on
|
|
278
|
-
// construction in `ReactiveElement`, such as `requestUpdate()`.
|
|
279
|
-
if (!this[privateInternals]) {
|
|
280
|
-
// Cast needed for closure
|
|
281
|
-
this[privateInternals] = this.attachInternals();
|
|
282
|
-
}
|
|
283
|
-
return this[privateInternals];
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return WithElementInternalsElement;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
export { mixinElementInternals as a, internals as i, mixinDelegatesAria as m };
|
|
290
|
-
//# sourceMappingURL=element-internals-2CMts_0M.js.map
|
|
248
|
+
export { mixinDelegatesAria as m };
|
|
249
|
+
//# sourceMappingURL=delegate-py-Ets8N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegate-py-Ets8N.js","sources":["../../src/__internal/aria/aria.ts","../../src/__internal/aria/delegate.ts"],"sourcesContent":["/**\n * Accessibility Object Model reflective aria property name types.\n */\n// eslint-disable-next-line no-undef\nexport type ARIAProperty = keyof ARIAMixin;\n\n/**\n * Accessibility Object Model reflective aria properties.\n */\nexport const ARIA_PROPERTIES: ARIAProperty[] = [\n 'role',\n 'ariaAtomic',\n 'ariaAutoComplete',\n 'ariaBusy',\n 'ariaChecked',\n 'ariaColCount',\n 'ariaColIndex',\n 'ariaColSpan',\n 'ariaCurrent',\n 'ariaDisabled',\n 'ariaExpanded',\n 'ariaHasPopup',\n 'ariaHidden',\n 'ariaInvalid',\n 'ariaKeyShortcuts',\n 'ariaLabel',\n 'ariaLevel',\n 'ariaLive',\n 'ariaModal',\n 'ariaMultiLine',\n 'ariaMultiSelectable',\n 'ariaOrientation',\n 'ariaPlaceholder',\n 'ariaPosInSet',\n 'ariaPressed',\n 'ariaReadOnly',\n 'ariaRequired',\n 'ariaRoleDescription',\n 'ariaRowCount',\n 'ariaRowIndex',\n 'ariaRowSpan',\n 'ariaSelected',\n 'ariaSetSize',\n 'ariaSort',\n 'ariaValueMax',\n 'ariaValueMin',\n 'ariaValueNow',\n 'ariaValueText',\n];\n\n/**\n * Accessibility Object Model aria attribute name types.\n */\n// eslint-disable-next-line no-use-before-define\nexport type ARIAAttribute = ARIAPropertyToAttribute<ARIAProperty>;\n\n/**\n * Accessibility Object Model aria attributes.\n */\n// eslint-disable-next-line no-use-before-define\nexport const ARIA_ATTRIBUTES = ARIA_PROPERTIES.map(ariaPropertyToAttribute);\n\n/**\n * Checks if an attribute is one of the AOM aria attributes.\n *\n * @example\n * isAriaAttribute('aria-label'); // true\n *\n * @param attribute The attribute to check.\n * @return True if the attribute is an aria attribute, or false if not.\n */\nexport function isAriaAttribute(attribute: string): attribute is ARIAAttribute {\n return ARIA_ATTRIBUTES.includes(attribute as ARIAAttribute);\n}\n\n/**\n * Converts an AOM aria property into its corresponding attribute.\n *\n * @example\n * ariaPropertyToAttribute('ariaLabel'); // 'aria-label'\n *\n * @param property The aria property.\n * @return The aria attribute.\n */\nexport function ariaPropertyToAttribute<K extends ARIAProperty>(property: K) {\n return (\n property\n .replace('aria', 'aria-')\n // IDREF attributes also include an \"Element\" or \"Elements\" suffix\n .replace(/Elements?/g, '')\n // eslint-disable-next-line no-use-before-define\n .toLowerCase() as ARIAPropertyToAttribute<K>\n );\n}\n\n// Converts an `ariaFoo` string type to an `aria-foo` string type.\n// eslint-disable-next-line no-unused-vars\ntype ARIAPropertyToAttribute<K extends string> =\n K extends `aria${infer Suffix}Element${infer OptS}` // eslint-disable-line\n ? `aria-${Lowercase<Suffix>}`\n : K extends `aria${infer Suffix}`\n ? `aria-${Lowercase<Suffix>}`\n : K;\n\n/**\n * An extension of `ARIAMixin` that enforces strict value types for aria\n * properties.\n *\n * This is needed for correct typing in render functions with lit analyzer.\n *\n * @example\n * render() {\n * const {ariaLabel} = this as ARIAMixinStrict;\n * return html`\n * <button aria-label=${ariaLabel || nothing}>\n * <slot></slot>\n * </button>\n * `;\n * }\n */\n// eslint-disable-next-line no-undef\nexport interface ARIAMixinStrict extends ARIAMixin {\n ariaAtomic: 'true' | 'false' | null;\n ariaAutoComplete: 'none' | 'inline' | 'list' | 'both' | null;\n ariaBusy: 'true' | 'false' | null;\n ariaChecked: 'true' | 'false' | null;\n ariaColCount: `${number}` | null;\n ariaColIndex: `${number}` | null;\n ariaColSpan: `${number}` | null;\n ariaCurrent:\n | 'page'\n | 'step'\n | 'location'\n | 'date'\n | 'time'\n | 'true'\n | 'false'\n | null;\n ariaDisabled: 'true' | 'false' | null;\n ariaExpanded: 'true' | 'false' | null;\n ariaHasPopup:\n | 'false'\n | 'true'\n | 'menu'\n | 'listbox'\n | 'tree'\n | 'grid'\n | 'dialog'\n | null;\n ariaHidden: 'true' | 'false' | null;\n ariaInvalid: 'true' | 'false' | null;\n ariaKeyShortcuts: string | null;\n ariaLabel: string | null;\n ariaLevel: `${number}` | null;\n ariaLive: 'assertive' | 'off' | 'polite' | null;\n ariaModal: 'true' | 'false' | null;\n ariaMultiLine: 'true' | 'false' | null;\n ariaMultiSelectable: 'true' | 'false' | null;\n ariaOrientation: 'horizontal' | 'vertical' | 'undefined' | null;\n ariaPlaceholder: string | null;\n ariaPosInSet: `${number}` | null;\n ariaPressed: 'true' | 'false' | null;\n ariaReadOnly: 'true' | 'false' | null;\n ariaRequired: 'true' | 'false' | null;\n ariaRoleDescription: string | null;\n ariaRowCount: `${number}` | null;\n ariaRowIndex: `${number}` | null;\n ariaRowSpan: `${number}` | null;\n ariaSelected: 'true' | 'false' | null;\n ariaSetSize: `${number}` | null;\n ariaSort: 'ascending' | 'descending' | 'none' | 'other' | null;\n ariaValueMax: `${number}` | null;\n ariaValueMin: `${number}` | null;\n ariaValueNow: `${number}` | null;\n ariaValueText: string | null;\n // eslint-disable-next-line no-use-before-define\n role: ARIARole | null;\n}\n\n/**\n * Valid values for `role`.\n */\nexport type ARIARole =\n | 'alert'\n | 'alertdialog'\n | 'button'\n | 'checkbox'\n | 'dialog'\n | 'gridcell'\n | 'link'\n | 'log'\n | 'marquee'\n | 'menuitem'\n | 'menuitemcheckbox'\n | 'menuitemradio'\n | 'option'\n | 'progressbar'\n | 'radio'\n | 'scrollbar'\n | 'searchbox'\n | 'slider'\n | 'spinbutton'\n | 'status'\n | 'switch'\n | 'tab'\n | 'tabpanel'\n | 'textbox'\n | 'timer'\n | 'tooltip'\n | 'treeitem'\n | 'combobox'\n | 'grid'\n | 'listbox'\n | 'menu'\n | 'menubar'\n | 'radiogroup'\n | 'tablist'\n | 'tree'\n | 'treegrid'\n | 'application'\n | 'article'\n | 'cell'\n | 'columnheader'\n | 'definition'\n | 'directory'\n | 'document'\n | 'feed'\n | 'figure'\n | 'group'\n | 'heading'\n | 'img'\n | 'list'\n | 'listitem'\n | 'math'\n | 'none'\n | 'note'\n | 'presentation'\n | 'region'\n | 'row'\n | 'rowgroup'\n | 'rowheader'\n | 'separator'\n | 'table'\n | 'term'\n | 'text'\n | 'toolbar'\n | 'banner'\n | 'complementary'\n | 'contentinfo'\n | 'form'\n | 'main'\n | 'navigation'\n | 'region'\n | 'search'\n | 'doc-abstract'\n | 'doc-acknowledgments'\n | 'doc-afterword'\n | 'doc-appendix'\n | 'doc-backlink'\n | 'doc-biblioentry'\n | 'doc-bibliography'\n | 'doc-biblioref'\n | 'doc-chapter'\n | 'doc-colophon'\n | 'doc-conclusion'\n | 'doc-cover'\n | 'doc-credit'\n | 'doc-credits'\n | 'doc-dedication'\n | 'doc-endnote'\n | 'doc-endnotes'\n | 'doc-epigraph'\n | 'doc-epilogue'\n | 'doc-errata'\n | 'doc-example'\n | 'doc-footnote'\n | 'doc-foreword'\n | 'doc-glossary'\n | 'doc-glossref'\n | 'doc-index'\n | 'doc-introduction'\n | 'doc-noteref'\n | 'doc-notice'\n | 'doc-pagebreak'\n | 'doc-pagelist'\n | 'doc-part'\n | 'doc-preface'\n | 'doc-prologue'\n | 'doc-pullquote'\n | 'doc-qna'\n | 'doc-subtitle'\n | 'doc-tip'\n | 'doc-toc';\n","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { LitElement, ReactiveElement, isServer } from 'lit';\n\nimport { MixinBase, MixinReturn } from '../mixins/mixin.js';\nimport {\n ARIA_PROPERTIES,\n ariaPropertyToAttribute,\n isAriaAttribute,\n} from './aria.js';\n\n// Private symbols\nconst privateIgnoreAttributeChangesFor = Symbol(\n 'privateIgnoreAttributeChangesFor',\n);\n\nfunction ariaAttributeToDataAttribute(ariaAttribute: string) {\n // aria-haspopup -> data-aria-haspopup\n return `data-${ariaAttribute}`;\n}\n\nfunction ariaAttributeToDataProperty(ariaAttribute: string) {\n // aria-haspopup -> dataset.ariaHaspopup\n return ariaAttribute.replace(/-\\w/, dashLetter =>\n dashLetter[1].toUpperCase(),\n );\n}\n\n/**\n * Overrides the constructor's native `ARIAMixin` properties to ensure that\n * aria properties reflect the values that were shifted to a data attribute.\n *\n * @param ctor The `ReactiveElement` constructor to patch.\n */\nfunction setupDelegatesAriaProperties(ctor: typeof ReactiveElement) {\n for (const ariaProperty of ARIA_PROPERTIES) {\n // The casing between ariaProperty and the dataProperty may be different.\n // ex: aria-haspopup -> ariaHasPopup\n const ariaAttribute = ariaPropertyToAttribute(ariaProperty);\n // ex: aria-haspopup -> data-aria-haspopup\n const dataAttribute = ariaAttributeToDataAttribute(ariaAttribute);\n // ex: aria-haspopup -> dataset.ariaHaspopup\n const dataProperty = ariaAttributeToDataProperty(ariaAttribute);\n\n // Call `ReactiveElement.createProperty()` so that the `aria-*` and `data-*`\n // attributes are added to the `static observedAttributes` array. This\n // triggers `attributeChangedCallback` for the delegates aria mixin to\n // handle.\n ctor.createProperty(ariaProperty, {\n attribute: ariaAttribute,\n noAccessor: true,\n });\n ctor.createProperty(Symbol(dataAttribute), {\n attribute: dataAttribute,\n noAccessor: true,\n });\n\n // Re-define the `ARIAMixin` properties to handle data attribute shifting.\n // It is safe to use `Object.defineProperty` here because the properties\n // are native and not renamed.\n // tslint:disable-next-line:ban-unsafe-reflection\n Object.defineProperty(ctor.prototype, ariaProperty, {\n configurable: true,\n enumerable: true,\n get(this: ReactiveElement): string | null {\n return this.dataset[dataProperty] ?? null;\n },\n set(this: ReactiveElement, value: string | null): void {\n const prevValue = this.dataset[dataProperty] ?? null;\n if (value === prevValue) {\n return;\n }\n\n if (value === null) {\n delete this.dataset[dataProperty];\n } else {\n this.dataset[dataProperty] = value;\n }\n\n this.requestUpdate(ariaProperty, prevValue);\n },\n });\n }\n}\n\n/**\n * Mixes in aria delegation for elements that delegate focus and aria to inner\n * shadow root elements.\n *\n * This mixin fixes invalid aria announcements with shadow roots, caused by\n * duplicate aria attributes on both the host and the inner shadow root element.\n *\n * Note: this mixin **does not yet support** ID reference attributes, such as\n * `aria-labelledby` or `aria-controls`.\n *\n * @example\n * ```ts\n * class MyButton extends mixinDelegatesAria(LitElement) {\n * static shadowRootOptions = {mode: 'open', delegatesFocus: true};\n *\n * render() {\n * return html`\n * <button aria-label=${this.ariaLabel || nothing}>\n * <slot></slot>\n * </button>\n * `;\n * }\n * }\n * ```\n * ```html\n * <my-button aria-label=\"Plus one\">+1</my-button>\n * ```\n *\n * Use `ARIAMixinStrict` for lit analyzer strict types, such as the \"role\"\n * attribute.\n *\n * @example\n * ```ts\n * return html`\n * <button role=${(this as ARIAMixinStrict).role || nothing}>\n * <slot></slot>\n * </button>\n * `;\n * ```\n *\n * In the future, updates to the Accessibility Object Model (AOM) will provide\n * built-in aria delegation features that will replace this mixin.\n *\n * @param base The class to mix functionality into.\n * @return The provided class with aria delegation mixed in.\n */\nexport function mixinDelegatesAria<T extends MixinBase<LitElement>>(\n base: T,\n): MixinReturn<T> {\n if (isServer) {\n // Don't shift attributes when running with lit-ssr. The SSR renderer\n // implements a subset of DOM APIs, including the methods this mixin\n // overrides, causing errors. We don't need to shift on the server anyway\n // since elements will shift attributes immediately once they hydrate.\n return base;\n }\n\n abstract class WithDelegatesAriaElement extends base {\n [privateIgnoreAttributeChangesFor] = new Set();\n\n override attributeChangedCallback(\n name: string,\n oldValue: string | null,\n newValue: string | null,\n ) {\n if (!isAriaAttribute(name)) {\n super.attributeChangedCallback(name, oldValue, newValue);\n return;\n }\n\n if (this[privateIgnoreAttributeChangesFor].has(name)) {\n return;\n }\n\n // Don't trigger another `attributeChangedCallback` once we remove the\n // aria attribute from the host. We check the explicit name of the\n // attribute to ignore since `attributeChangedCallback` can be called\n // multiple times out of an expected order when hydrating an element with\n // multiple attributes.\n this[privateIgnoreAttributeChangesFor].add(name);\n this.removeAttribute(name);\n this[privateIgnoreAttributeChangesFor].delete(name);\n const dataProperty = ariaAttributeToDataProperty(name);\n if (newValue === null) {\n delete this.dataset[dataProperty];\n } else {\n this.dataset[dataProperty] = newValue;\n }\n\n this.requestUpdate(ariaAttributeToDataProperty(name), oldValue);\n }\n\n override getAttribute(name: string) {\n if (isAriaAttribute(name)) {\n return super.getAttribute(ariaAttributeToDataAttribute(name));\n }\n\n return super.getAttribute(name);\n }\n\n override removeAttribute(name: string) {\n super.removeAttribute(name);\n if (isAriaAttribute(name)) {\n super.removeAttribute(ariaAttributeToDataAttribute(name));\n // Since `aria-*` attributes are already removed`, we need to request\n // an update because `attributeChangedCallback` will not be called.\n this.requestUpdate();\n }\n }\n }\n\n setupDelegatesAriaProperties(\n WithDelegatesAriaElement as unknown as typeof ReactiveElement,\n );\n\n return WithDelegatesAriaElement;\n}\n"],"names":[],"mappings":";;AAMA;;AAEG;AACI,MAAM,eAAe,GAAmB;IAC7C,MAAM;IACN,YAAY;IACZ,kBAAkB;IAClB,UAAU;IACV,aAAa;IACb,cAAc;IACd,cAAc;IACd,aAAa;IACb,aAAa;IACb,cAAc;IACd,cAAc;IACd,cAAc;IACd,YAAY;IACZ,aAAa;IACb,kBAAkB;IAClB,WAAW;IACX,WAAW;IACX,UAAU;IACV,WAAW;IACX,eAAe;IACf,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,aAAa;IACb,cAAc;IACd,cAAc;IACd,qBAAqB;IACrB,cAAc;IACd,cAAc;IACd,aAAa;IACb,cAAc;IACd,aAAa;IACb,UAAU;IACV,cAAc;IACd,cAAc;IACd,cAAc;IACd,eAAe;CAChB;AAQD;;AAEG;AACH;AACO,MAAM,eAAe,GAAG,eAAe,CAAC,GAAG,CAAC,uBAAuB,CAAC;AAE3E;;;;;;;;AAQG;AACG,SAAU,eAAe,CAAC,SAAiB,EAAA;AAC/C,IAAA,OAAO,eAAe,CAAC,QAAQ,CAAC,SAA0B,CAAC;AAC7D;AAEA;;;;;;;;AAQG;AACG,SAAU,uBAAuB,CAAyB,QAAW,EAAA;AACzE,IAAA,OACE;AACG,SAAA,OAAO,CAAC,MAAM,EAAE,OAAO;;AAEvB,SAAA,OAAO,CAAC,YAAY,EAAE,EAAE;;AAExB,SAAA,WAAW,EACf;AACH;;AC7FA;;;;AAIG;AAWH;AACA,MAAM,gCAAgC,GAAG,MAAM,CAC7C,kCAAkC,CACnC;AAED,SAAS,4BAA4B,CAAC,aAAqB,EAAA;;IAEzD,OAAO,CA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;AAES,QAAA,YAAY,CAAC,IAAY,EAAA;AAChC,YAAA,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;gBACzB,OAAO,KAAK,CAAC,YAAY,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC;YAC/D;AAEA,YAAA,OAAO,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC;QACjC;AAES,QAAA,eAAe,CAAC,IAAY,EAAA;AACnC,YAAA,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC;AAC3B,YAAA,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;gBACzB,KAAK,CAAC,eAAe,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC;;;gBAGzD,IAAI,CAAC,aAAa,EAAE;YACtB;QACF;AACD;SAnDE,gCAAgC;IAqDnC,4BAA4B,CAC1B,wBAA6D,CAC9D;AAED,IAAA,OAAO,wBAAwB;AACjC;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A unique symbol used for protected access to an instance's
|
|
3
|
+
* `ElementInternals`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* class MyElement extends mixinElementInternals(LitElement) {
|
|
8
|
+
* constructor() {
|
|
9
|
+
* super();
|
|
10
|
+
* this[internals].role = 'button';
|
|
11
|
+
* }
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
const internals = Symbol('internals');
|
|
16
|
+
// Private symbols
|
|
17
|
+
const privateInternals = Symbol('privateInternals');
|
|
18
|
+
/**
|
|
19
|
+
* Mixes in an attached `ElementInternals` instance.
|
|
20
|
+
*
|
|
21
|
+
* This mixin is only needed when other shared code needs access to a
|
|
22
|
+
* component's `ElementInternals`, such as form-associated mixins.
|
|
23
|
+
*
|
|
24
|
+
* @param base The class to mix functionality into.
|
|
25
|
+
* @return The provided class with `WithElementInternals` mixed in.
|
|
26
|
+
*/
|
|
27
|
+
function mixinElementInternals(base) {
|
|
28
|
+
class WithElementInternalsElement extends base {
|
|
29
|
+
get [internals]() {
|
|
30
|
+
// Create internals in getter so that it can be used in methods called on
|
|
31
|
+
// construction in `ReactiveElement`, such as `requestUpdate()`.
|
|
32
|
+
if (!this[privateInternals]) {
|
|
33
|
+
// Cast needed for closure
|
|
34
|
+
this[privateInternals] = this.attachInternals();
|
|
35
|
+
}
|
|
36
|
+
return this[privateInternals];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return WithElementInternalsElement;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { internals as i, mixinElementInternals as m };
|
|
43
|
+
//# sourceMappingURL=element-internals-QME0yEz4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-internals-QME0yEz4.js","sources":["../../src/__internal/mixins/element-internals.ts"],"sourcesContent":["import { LitElement } from 'lit';\n\nimport { MixinBase, MixinReturn } from './mixin.js';\n\n/**\n * A unique symbol used for protected access to an instance's\n * `ElementInternals`.\n *\n * @example\n * ```ts\n * class MyElement extends mixinElementInternals(LitElement) {\n * constructor() {\n * super();\n * this[internals].role = 'button';\n * }\n * }\n * ```\n */\nexport const internals = Symbol('internals');\n\n/**\n * An instance with an `internals` symbol property for the component's\n * `ElementInternals`.\n *\n * Use this when protected access is needed for an instance's `ElementInternals`\n * from other files. A unique symbol is used to access the internals.\n */\nexport interface WithElementInternals {\n /**\n * An instance's `ElementInternals`.\n */\n [internals]: ElementInternals;\n}\n\n// Private symbols\nconst privateInternals = Symbol('privateInternals');\n\n/**\n * Mixes in an attached `ElementInternals` instance.\n *\n * This mixin is only needed when other shared code needs access to a\n * component's `ElementInternals`, such as form-associated mixins.\n *\n * @param base The class to mix functionality into.\n * @return The provided class with `WithElementInternals` mixed in.\n */\nexport function mixinElementInternals<T extends MixinBase<LitElement>>(\n base: T,\n): MixinReturn<T, WithElementInternals> {\n abstract class WithElementInternalsElement\n extends base\n implements WithElementInternals\n {\n get [internals]() {\n // Create internals in getter so that it can be used in methods called on\n // construction in `ReactiveElement`, such as `requestUpdate()`.\n if (!this[privateInternals]) {\n // Cast needed for closure\n this[privateInternals] = (this as HTMLElement).attachInternals();\n }\n\n return this[privateInternals];\n }\n\n // In preparation for ES2022, we need to declare this property to guard\n // against the base class calling [internals] in its constructor prematurely\n // setting this field. Without declare, once this field is defined, it would\n // initialize to undefined and `attachInternals()` could be called again.\n declare [privateInternals]?: ElementInternals;\n }\n\n return WithElementInternalsElement;\n}\n"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;AAaG;MACU,SAAS,GAAG,MAAM,CAAC,WAAW;AAgB3C;AACA,MAAM,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAEnD;;;;;;;;AAQG;AACG,SAAU,qBAAqB,CACnC,IAAO,EAAA;IAEP,MAAe,2BACb,SAAQ,IAAI,CAAA;QAGZ,KAAK,SAAS,CAAC,GAAA;;;AAGb,YAAA,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE;;gBAE3B,IAAI,CAAC,gBAAgB,CAAC,GAAI,IAAoB,CAAC,eAAe,EAAE;YAClE;AAEA,YAAA,OAAO,IAAI,CAAC,gBAAgB,CAAC;QAC/B;AAOD;AAED,IAAA,OAAO,2BAA2B;AACpC;;;;"}
|
package/dist/fab.js
CHANGED
|
@@ -7,8 +7,10 @@ import { i as isActivationClick, d as dispatchActivationClick } from './dispatch
|
|
|
7
7
|
import { i as isLink } from './is-link-Dk2OV3PM.js';
|
|
8
8
|
import { D as DISABLED_REASON_ID } from './ButtonConstants-CahP2_NA.js';
|
|
9
9
|
import { m as mixinBaseButton, a as mixinHyperlink } from './hyperlink-DLvb6MXE.js';
|
|
10
|
-
import { m as mixinDelegatesAria
|
|
11
|
-
import { m as mixinFormSubmitter
|
|
10
|
+
import { m as mixinDelegatesAria } from './delegate-py-Ets8N.js';
|
|
11
|
+
import { m as mixinFormSubmitter } from './form-submitter-DPI4L6gj.js';
|
|
12
|
+
import { m as mixinElementInternals } from './element-internals-QME0yEz4.js';
|
|
13
|
+
import { m as mixinFormAssociated } from './form-associated-Bhwwr6dT.js';
|
|
12
14
|
import './base-Cl6v8-BZ.js';
|
|
13
15
|
import './directive-ZPhl09Yt.js';
|
|
14
16
|
import './throttle-C7ZAPqtu.js';
|
|
@@ -31,11 +33,11 @@ var css_248z$2 = i`* {
|
|
|
31
33
|
display: inline-flex;
|
|
32
34
|
--fab-container-shape: var(--shape-corner-large);
|
|
33
35
|
--fab-container-elevation-level: 3;
|
|
34
|
-
--
|
|
35
|
-
--
|
|
36
|
-
--
|
|
37
|
-
--
|
|
38
|
-
--
|
|
36
|
+
--_button-container-shape-start-start: var(--fab-container-shape);
|
|
37
|
+
--_button-container-shape-start-end: var(--fab-container-shape);
|
|
38
|
+
--_button-container-shape-end-start: var(--fab-container-shape);
|
|
39
|
+
--_button-container-shape-end-end: var(--fab-container-shape);
|
|
40
|
+
--_button-container-shape-variant: var(--fab-container-shape-variant);
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
/*
|
|
@@ -91,15 +93,15 @@ var css_248z$2 = i`* {
|
|
|
91
93
|
pointer-events: none;
|
|
92
94
|
z-index: 0;
|
|
93
95
|
gap: 0.75rem;
|
|
94
|
-
color: var(--
|
|
95
|
-
--icon-size: var(--
|
|
96
|
-
--icon-color: var(--
|
|
96
|
+
color: var(--_button-label-text-color);
|
|
97
|
+
--icon-size: var(--_button-icon-size);
|
|
98
|
+
--icon-color: var(--_button-label-text-color);
|
|
97
99
|
}
|
|
98
100
|
.fab .fab-label {
|
|
99
|
-
font-size: var(--
|
|
100
|
-
font-weight: var(--
|
|
101
|
-
line-height: var(--
|
|
102
|
-
letter-spacing: var(--
|
|
101
|
+
font-size: var(--_button-font-size) !important;
|
|
102
|
+
font-weight: var(--_button-font-weight) !important;
|
|
103
|
+
line-height: var(--_button-line-height) !important;
|
|
104
|
+
letter-spacing: var(--_button-letter-spacing) !important;
|
|
103
105
|
white-space: nowrap;
|
|
104
106
|
}
|
|
105
107
|
.fab.disabled {
|
|
@@ -127,23 +129,23 @@ var css_248z$2 = i`* {
|
|
|
127
129
|
|
|
128
130
|
.ripple {
|
|
129
131
|
border-radius: var(--fab-container-shape);
|
|
130
|
-
--ripple-state-opacity: var(--
|
|
131
|
-
--ripple-pressed-color: var(--
|
|
132
|
+
--ripple-state-opacity: var(--_button-container-state-opacity, 0);
|
|
133
|
+
--ripple-pressed-color: var(--_button-label-text-color);
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
.background {
|
|
135
137
|
display: block;
|
|
136
138
|
position: absolute;
|
|
137
139
|
inset: 0;
|
|
138
|
-
background-color: var(--
|
|
139
|
-
opacity: var(--
|
|
140
|
+
background-color: var(--_button-container-color);
|
|
141
|
+
opacity: var(--_button-container-opacity, 1);
|
|
140
142
|
border-radius: var(--fab-container-shape);
|
|
141
143
|
pointer-events: none;
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
.elevation {
|
|
145
147
|
--elevation-level: var(
|
|
146
|
-
--
|
|
148
|
+
--_button-container-elevation-level,
|
|
147
149
|
var(--fab-container-elevation-level)
|
|
148
150
|
);
|
|
149
151
|
transition-duration: 280ms;
|
|
@@ -155,31 +157,31 @@ var css_248z$2 = i`* {
|
|
|
155
157
|
|
|
156
158
|
/* State management */
|
|
157
159
|
:host:hover:not([disabled]) {
|
|
158
|
-
--
|
|
159
|
-
--
|
|
160
|
+
--_button-container-elevation-level: 4;
|
|
161
|
+
--_button-container-state-opacity: 0.08;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
:host(:active):not([disabled]) {
|
|
163
|
-
--
|
|
164
|
-
--
|
|
165
|
+
--_button-container-elevation-level: 3;
|
|
166
|
+
--_button-container-state-opacity: 0.12;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
:host([lowered]) {
|
|
168
170
|
--fab-container-elevation-level: 1;
|
|
169
171
|
}
|
|
170
172
|
:host([lowered]):hover:not([disabled]) {
|
|
171
|
-
--
|
|
173
|
+
--_button-container-elevation-level: 2;
|
|
172
174
|
}
|
|
173
175
|
:host([lowered]):active:not([disabled]) {
|
|
174
|
-
--
|
|
176
|
+
--_button-container-elevation-level: 1;
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
:host([disabled]) {
|
|
178
|
-
--
|
|
179
|
-
--
|
|
180
|
-
--
|
|
181
|
-
--
|
|
182
|
-
--
|
|
180
|
+
--_button-container-color: var(--color-on-surface);
|
|
181
|
+
--_button-container-opacity: 0.12;
|
|
182
|
+
--_button-label-text-color: var(--color-on-surface);
|
|
183
|
+
--_button-label-text-opacity: 0.38;
|
|
184
|
+
--_button-container-elevation-level: 0;
|
|
183
185
|
}
|
|
184
186
|
:host([disabled]) .ripple {
|
|
185
187
|
display: none;
|
|
@@ -189,13 +191,13 @@ var css_248z$2 = i`* {
|
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
:host([variant=tonal]) {
|
|
192
|
-
--
|
|
193
|
-
--
|
|
194
|
+
--_button-container-color: var(--tonal-fab-container-color);
|
|
195
|
+
--_button-label-text-color: var(--tonal-fab-label-text-color);
|
|
194
196
|
}
|
|
195
197
|
|
|
196
198
|
:host([variant=filled]) {
|
|
197
|
-
--
|
|
198
|
-
--
|
|
199
|
+
--_button-container-color: var(--filled-fab-container-color);
|
|
200
|
+
--_button-label-text-color: var(--filled-fab-label-text-color);
|
|
199
201
|
}`;
|
|
200
202
|
|
|
201
203
|
var css_248z$1 = i`:host {
|
|
@@ -238,35 +240,35 @@ var css_248z = i`@charset "UTF-8";
|
|
|
238
240
|
:host([size=sm]) {
|
|
239
241
|
--fab-container-shape: var(--shape-corner-medium);
|
|
240
242
|
--fab-container-size: 2.5rem;
|
|
241
|
-
--
|
|
243
|
+
--_button-icon-size: 1.5rem;
|
|
242
244
|
--fab-extended-min-width: 4rem;
|
|
243
|
-
--
|
|
244
|
-
--
|
|
245
|
-
--
|
|
246
|
-
--
|
|
245
|
+
--_button-font-size: 0.875rem;
|
|
246
|
+
--_button-font-weight: var(--font-weight-medium);
|
|
247
|
+
--_button-line-height: 1.25rem;
|
|
248
|
+
--_button-letter-spacing: 0.1px;
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
/* Standard/Medium FAB: 56×56dp, shape-corner-large (default) */
|
|
250
252
|
:host([size=md]) {
|
|
251
253
|
--fab-container-size: 3.5rem;
|
|
252
|
-
--
|
|
254
|
+
--_button-icon-size: 1.5rem;
|
|
253
255
|
--fab-extended-min-width: 5rem;
|
|
254
|
-
--
|
|
255
|
-
--
|
|
256
|
-
--
|
|
257
|
-
--
|
|
256
|
+
--_button-font-size: 0.875rem;
|
|
257
|
+
--_button-font-weight: var(--font-weight-medium);
|
|
258
|
+
--_button-line-height: 1.25rem;
|
|
259
|
+
--_button-letter-spacing: 0.1px;
|
|
258
260
|
}
|
|
259
261
|
|
|
260
262
|
/* Large FAB: 96×96dp, shape-corner-extra-large */
|
|
261
263
|
:host([size=lg]) {
|
|
262
264
|
--fab-container-shape: var(--shape-corner-extra-large);
|
|
263
265
|
--fab-container-size: 6rem;
|
|
264
|
-
--
|
|
266
|
+
--_button-icon-size: 2.25rem;
|
|
265
267
|
--fab-extended-min-width: 6rem;
|
|
266
|
-
--
|
|
267
|
-
--
|
|
268
|
-
--
|
|
269
|
-
--
|
|
268
|
+
--_button-font-size: 1rem;
|
|
269
|
+
--_button-font-weight: var(--font-weight-medium);
|
|
270
|
+
--_button-line-height: 1.5rem;
|
|
271
|
+
--_button-letter-spacing: 0.15px;
|
|
270
272
|
}`;
|
|
271
273
|
|
|
272
274
|
/**
|