@everymatrix/general-input 1.43.4 → 1.45.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/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/checkbox-group-input_10.cjs.entry.js +3873 -1756
- package/dist/cjs/general-input.cjs.entry.js +65 -62
- package/dist/cjs/general-input.cjs.js +17 -11
- package/dist/cjs/index-8cb018cb.js +1316 -0
- package/dist/cjs/index.cjs.js +13 -13
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/cjs/locale.utils-fdc29445.js +147 -0
- package/dist/cjs/toggle-checkbox-input.cjs.entry.js +77 -74
- package/dist/collection/collection-manifest.json +14 -14
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +368 -353
- package/dist/collection/components/checkbox-input/checkbox-input.js +325 -315
- package/dist/collection/components/date-input/date-input.css +2 -2
- package/dist/collection/components/date-input/date-input.js +397 -376
- package/dist/collection/components/email-input/email-input.css +7 -11
- package/dist/collection/components/email-input/email-input.js +404 -385
- package/dist/collection/components/general-input/general-input.js +373 -367
- package/dist/collection/components/general-input/index.js +1 -0
- package/dist/collection/components/number-input/number-input.js +370 -352
- package/dist/collection/components/password-input/password-input.css +2 -4
- package/dist/collection/components/password-input/password-input.js +513 -540
- package/dist/collection/components/radio-input/radio-input.js +301 -286
- package/dist/collection/components/select-input/select-input.css +8 -9
- package/dist/collection/components/select-input/select-input.js +427 -414
- package/dist/collection/components/tel-input/tel-input.css +1 -1
- package/dist/collection/components/tel-input/tel-input.js +440 -422
- package/dist/collection/components/text-input/text-input.css +0 -1
- package/dist/collection/components/text-input/text-input.js +444 -429
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +327 -318
- package/dist/collection/index.js +13 -13
- package/dist/collection/utils/locale.utils.js +133 -133
- package/dist/collection/utils/utils.js +3 -3
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/checkbox-group-input_10.entry.js +3873 -1756
- package/dist/esm/general-input.entry.js +65 -62
- package/dist/esm/general-input.js +14 -11
- package/dist/esm/index-514fda47.js +1287 -0
- package/dist/esm/index.js +13 -13
- package/dist/esm/loader.js +7 -13
- package/dist/esm/locale.utils-75b7d185.js +144 -0
- package/dist/esm/toggle-checkbox-input.entry.js +77 -74
- package/dist/general-input/general-input.esm.js +1 -1
- package/dist/general-input/p-03e81c11.js +2 -0
- package/dist/general-input/p-122566dd.entry.js +5430 -0
- package/dist/general-input/p-1913dcb0.entry.js +1 -0
- package/dist/general-input/p-e1255160.js +1 -0
- package/dist/general-input/p-e7df9c4a.entry.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-input/.stencil/packages/stencil/general-input/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-input/.stencil/packages/stencil/general-input/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +68 -68
- package/dist/types/components/checkbox-input/checkbox-input.d.ts +61 -62
- package/dist/types/components/date-input/date-input.d.ts +78 -78
- package/dist/types/components/email-input/email-input.d.ts +77 -77
- package/dist/types/components/general-input/general-input.d.ts +72 -72
- package/dist/types/components/general-input/index.d.ts +1 -0
- package/dist/types/components/number-input/number-input.d.ts +71 -71
- package/dist/types/components/password-input/password-input.d.ts +87 -92
- package/dist/types/components/radio-input/radio-input.d.ts +55 -55
- package/dist/types/components/select-input/select-input.d.ts +79 -79
- package/dist/types/components/tel-input/tel-input.d.ts +85 -85
- package/dist/types/components/text-input/text-input.d.ts +81 -81
- package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +63 -64
- package/dist/types/components.d.ts +201 -31
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/dist/types/utils/locale.utils.d.ts +8 -8
- package/dist/types/utils/types.d.ts +54 -54
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +8 -1
- package/dist/cjs/index-132a0774.js +0 -1327
- package/dist/cjs/locale.utils-2fa6f747.js +0 -147
- package/dist/components/active-mixin.js +0 -975
- package/dist/components/checkbox-group-input.d.ts +0 -11
- package/dist/components/checkbox-group-input.js +0 -6
- package/dist/components/checkbox-group-input2.js +0 -1078
- package/dist/components/checkbox-input.d.ts +0 -11
- package/dist/components/checkbox-input.js +0 -6
- package/dist/components/checkbox-input2.js +0 -132
- package/dist/components/date-input.d.ts +0 -11
- package/dist/components/date-input.js +0 -6
- package/dist/components/date-input2.js +0 -11556
- package/dist/components/email-input.d.ts +0 -11
- package/dist/components/email-input.js +0 -6
- package/dist/components/email-input2.js +0 -171
- package/dist/components/field-mixin.js +0 -12426
- package/dist/components/general-input.d.ts +0 -11
- package/dist/components/general-input.js +0 -6
- package/dist/components/general-input2.js +0 -344
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -18
- package/dist/components/input-field-shared-styles.js +0 -1211
- package/dist/components/number-input.d.ts +0 -11
- package/dist/components/number-input.js +0 -6
- package/dist/components/number-input2.js +0 -158
- package/dist/components/password-input.d.ts +0 -11
- package/dist/components/password-input.js +0 -6
- package/dist/components/password-input2.js +0 -1059
- package/dist/components/radio-input.d.ts +0 -11
- package/dist/components/radio-input.js +0 -6
- package/dist/components/radio-input2.js +0 -114
- package/dist/components/select-input.d.ts +0 -11
- package/dist/components/select-input.js +0 -6
- package/dist/components/select-input2.js +0 -183
- package/dist/components/tel-input.d.ts +0 -11
- package/dist/components/tel-input.js +0 -6
- package/dist/components/tel-input2.js +0 -197
- package/dist/components/text-input.d.ts +0 -11
- package/dist/components/text-input.js +0 -6
- package/dist/components/text-input2.js +0 -199
- package/dist/components/toggle-checkbox-input.d.ts +0 -11
- package/dist/components/toggle-checkbox-input.js +0 -6
- package/dist/components/tooltipIcon.js +0 -146
- package/dist/components/vaadin-button.js +0 -490
- package/dist/components/vaadin-combo-box.js +0 -4512
- package/dist/components/virtual-keyboard-controller.js +0 -2001
- package/dist/esm/index-db76d5b5.js +0 -1299
- package/dist/esm/locale.utils-30fb5289.js +0 -144
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/general-input/p-6ae987d0.entry.js +0 -1
- package/dist/general-input/p-b408093e.js +0 -1
- package/dist/general-input/p-b64caafa.entry.js +0 -3646
- package/dist/general-input/p-f659e9ee.entry.js +0 -1
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -2
- /package/dist/cjs/{tooltipIcon-092a795f.js → tooltipIcon-7e9ee226.js} +0 -0
- /package/dist/esm/{tooltipIcon-99c1c7b7.js → tooltipIcon-0a5a06a2.js} +0 -0
- /package/dist/general-input/{p-f4f4ccda.js → p-2dccd0bf.js} +0 -0
- /package/dist/general-input/{p-04d4b145.js → p-ba14eb83.js} +0 -0
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
import { i, r as registerStyles, Q as TabindexMixin, l as FocusMixin, E as ElementMixin, g as ThemableMixin, H as ControllerMixin, P as PolymerElement, T as TooltipController, f as defineCustomElement, h as html } from './field-mixin.js';
|
|
2
|
-
import { A as ActiveMixin } from './active-mixin.js';
|
|
3
|
-
|
|
4
|
-
const button = i`
|
|
5
|
-
:host {
|
|
6
|
-
/* Sizing */
|
|
7
|
-
--lumo-button-size: var(--lumo-size-m);
|
|
8
|
-
min-width: calc(var(--lumo-button-size) * 2);
|
|
9
|
-
height: var(--lumo-button-size);
|
|
10
|
-
padding: 0 calc(var(--lumo-button-size) / 3 + var(--lumo-border-radius-m) / 2);
|
|
11
|
-
margin: var(--lumo-space-xs) 0;
|
|
12
|
-
box-sizing: border-box;
|
|
13
|
-
/* Style */
|
|
14
|
-
font-family: var(--lumo-font-family);
|
|
15
|
-
font-size: var(--lumo-font-size-m);
|
|
16
|
-
font-weight: 500;
|
|
17
|
-
color: var(--_lumo-button-color, var(--lumo-primary-text-color));
|
|
18
|
-
background-color: var(--_lumo-button-background-color, var(--lumo-contrast-5pct));
|
|
19
|
-
border-radius: var(--lumo-border-radius-m);
|
|
20
|
-
cursor: var(--lumo-clickable-cursor);
|
|
21
|
-
-webkit-tap-highlight-color: transparent;
|
|
22
|
-
-webkit-font-smoothing: antialiased;
|
|
23
|
-
-moz-osx-font-smoothing: grayscale;
|
|
24
|
-
flex-shrink: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Set only for the internal parts so we don't affect the host vertical alignment */
|
|
28
|
-
[part='label'],
|
|
29
|
-
[part='prefix'],
|
|
30
|
-
[part='suffix'] {
|
|
31
|
-
line-height: var(--lumo-line-height-xs);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[part='label'] {
|
|
35
|
-
padding: calc(var(--lumo-button-size) / 6) 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
:host([theme~='small']) {
|
|
39
|
-
font-size: var(--lumo-font-size-s);
|
|
40
|
-
--lumo-button-size: var(--lumo-size-s);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host([theme~='large']) {
|
|
44
|
-
font-size: var(--lumo-font-size-l);
|
|
45
|
-
--lumo-button-size: var(--lumo-size-l);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* For interaction states */
|
|
49
|
-
:host::before,
|
|
50
|
-
:host::after {
|
|
51
|
-
content: '';
|
|
52
|
-
/* We rely on the host always being relative */
|
|
53
|
-
position: absolute;
|
|
54
|
-
z-index: 1;
|
|
55
|
-
inset: 0;
|
|
56
|
-
background-color: currentColor;
|
|
57
|
-
border-radius: inherit;
|
|
58
|
-
opacity: 0;
|
|
59
|
-
pointer-events: none;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/* Hover */
|
|
63
|
-
|
|
64
|
-
@media (any-hover: hover) {
|
|
65
|
-
:host(:hover)::before {
|
|
66
|
-
opacity: 0.02;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/* Active */
|
|
71
|
-
|
|
72
|
-
:host::after {
|
|
73
|
-
transition: opacity 1.4s, transform 0.1s;
|
|
74
|
-
filter: blur(8px);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
:host([active])::before {
|
|
78
|
-
opacity: 0.05;
|
|
79
|
-
transition-duration: 0s;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
:host([active])::after {
|
|
83
|
-
opacity: 0.1;
|
|
84
|
-
transition-duration: 0s, 0s;
|
|
85
|
-
transform: scale(0);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/* Keyboard focus */
|
|
89
|
-
|
|
90
|
-
:host([focus-ring]) {
|
|
91
|
-
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
:host([theme~='primary'][focus-ring]) {
|
|
95
|
-
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px var(--lumo-primary-color-50pct);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/* Types (primary, tertiary, tertiary-inline */
|
|
99
|
-
|
|
100
|
-
:host([theme~='tertiary']),
|
|
101
|
-
:host([theme~='tertiary-inline']) {
|
|
102
|
-
background-color: transparent !important;
|
|
103
|
-
min-width: 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
:host([theme~='tertiary']) {
|
|
107
|
-
padding: 0 calc(var(--lumo-button-size) / 6);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
:host([theme~='tertiary-inline'])::before {
|
|
111
|
-
display: none;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
:host([theme~='tertiary-inline']) {
|
|
115
|
-
margin: 0;
|
|
116
|
-
height: auto;
|
|
117
|
-
padding: 0;
|
|
118
|
-
line-height: inherit;
|
|
119
|
-
font-size: inherit;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
:host([theme~='tertiary-inline']) [part='label'] {
|
|
123
|
-
padding: 0;
|
|
124
|
-
overflow: visible;
|
|
125
|
-
line-height: inherit;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
:host([theme~='primary']) {
|
|
129
|
-
background-color: var(--_lumo-button-primary-background-color, var(--lumo-primary-color));
|
|
130
|
-
color: var(--_lumo-button-primary-color, var(--lumo-primary-contrast-color));
|
|
131
|
-
font-weight: 600;
|
|
132
|
-
min-width: calc(var(--lumo-button-size) * 2.5);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
:host([theme~='primary'])::before {
|
|
136
|
-
background-color: black;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
@media (any-hover: hover) {
|
|
140
|
-
:host([theme~='primary']:hover)::before {
|
|
141
|
-
opacity: 0.05;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
:host([theme~='primary'][active])::before {
|
|
146
|
-
opacity: 0.1;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
:host([theme~='primary'][active])::after {
|
|
150
|
-
opacity: 0.2;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/* Colors (success, error, contrast) */
|
|
154
|
-
|
|
155
|
-
:host([theme~='success']) {
|
|
156
|
-
color: var(--lumo-success-text-color);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
:host([theme~='success'][theme~='primary']) {
|
|
160
|
-
background-color: var(--lumo-success-color);
|
|
161
|
-
color: var(--lumo-success-contrast-color);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
:host([theme~='error']) {
|
|
165
|
-
color: var(--lumo-error-text-color);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
:host([theme~='error'][theme~='primary']) {
|
|
169
|
-
background-color: var(--lumo-error-color);
|
|
170
|
-
color: var(--lumo-error-contrast-color);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
:host([theme~='contrast']) {
|
|
174
|
-
color: var(--lumo-contrast);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
:host([theme~='contrast'][theme~='primary']) {
|
|
178
|
-
background-color: var(--lumo-contrast);
|
|
179
|
-
color: var(--lumo-base-color);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/* Disabled state. Keep selectors after other color variants. */
|
|
183
|
-
|
|
184
|
-
:host([disabled]) {
|
|
185
|
-
pointer-events: none;
|
|
186
|
-
color: var(--lumo-disabled-text-color);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
:host([theme~='primary'][disabled]) {
|
|
190
|
-
background-color: var(--lumo-contrast-30pct);
|
|
191
|
-
color: var(--lumo-base-color);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
:host([theme~='primary'][disabled]) [part] {
|
|
195
|
-
opacity: 0.7;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/* Icons */
|
|
199
|
-
|
|
200
|
-
[part] ::slotted(vaadin-icon) {
|
|
201
|
-
display: inline-block;
|
|
202
|
-
width: var(--lumo-icon-size-m);
|
|
203
|
-
height: var(--lumo-icon-size-m);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/* Vaadin icons are based on a 16x16 grid (unlike Lumo and Material icons with 24x24), so they look too big by default */
|
|
207
|
-
[part] ::slotted(vaadin-icon[icon^='vaadin:']) {
|
|
208
|
-
padding: 0.25em;
|
|
209
|
-
box-sizing: border-box !important;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
[part='prefix'] {
|
|
213
|
-
margin-left: -0.25em;
|
|
214
|
-
margin-right: 0.25em;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
[part='suffix'] {
|
|
218
|
-
margin-left: 0.25em;
|
|
219
|
-
margin-right: -0.25em;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/* Icon-only */
|
|
223
|
-
|
|
224
|
-
:host([theme~='icon']:not([theme~='tertiary-inline'])) {
|
|
225
|
-
min-width: var(--lumo-button-size);
|
|
226
|
-
padding-left: calc(var(--lumo-button-size) / 4);
|
|
227
|
-
padding-right: calc(var(--lumo-button-size) / 4);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
:host([theme~='icon']) [part='prefix'],
|
|
231
|
-
:host([theme~='icon']) [part='suffix'] {
|
|
232
|
-
margin-left: 0;
|
|
233
|
-
margin-right: 0;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/* RTL specific styles */
|
|
237
|
-
|
|
238
|
-
:host([dir='rtl']) [part='prefix'] {
|
|
239
|
-
margin-left: 0.25em;
|
|
240
|
-
margin-right: -0.25em;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
:host([dir='rtl']) [part='suffix'] {
|
|
244
|
-
margin-left: -0.25em;
|
|
245
|
-
margin-right: 0.25em;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
:host([dir='rtl'][theme~='icon']) [part='prefix'],
|
|
249
|
-
:host([dir='rtl'][theme~='icon']) [part='suffix'] {
|
|
250
|
-
margin-left: 0;
|
|
251
|
-
margin-right: 0;
|
|
252
|
-
}
|
|
253
|
-
`;
|
|
254
|
-
|
|
255
|
-
registerStyles('vaadin-button', button, { moduleId: 'lumo-button' });
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* @license
|
|
259
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
260
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
261
|
-
*/
|
|
262
|
-
|
|
263
|
-
const buttonStyles = i`
|
|
264
|
-
:host {
|
|
265
|
-
display: inline-block;
|
|
266
|
-
position: relative;
|
|
267
|
-
outline: none;
|
|
268
|
-
white-space: nowrap;
|
|
269
|
-
-webkit-user-select: none;
|
|
270
|
-
-moz-user-select: none;
|
|
271
|
-
user-select: none;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
:host([hidden]) {
|
|
275
|
-
display: none !important;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/* Aligns the button with form fields when placed on the same line.
|
|
279
|
-
Note, to make it work, the form fields should have the same "::before" pseudo-element. */
|
|
280
|
-
.vaadin-button-container::before {
|
|
281
|
-
content: '\\2003';
|
|
282
|
-
display: inline-block;
|
|
283
|
-
width: 0;
|
|
284
|
-
max-height: 100%;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.vaadin-button-container {
|
|
288
|
-
display: inline-flex;
|
|
289
|
-
align-items: center;
|
|
290
|
-
justify-content: center;
|
|
291
|
-
text-align: center;
|
|
292
|
-
width: 100%;
|
|
293
|
-
height: 100%;
|
|
294
|
-
min-height: inherit;
|
|
295
|
-
text-shadow: inherit;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
[part='prefix'],
|
|
299
|
-
[part='suffix'] {
|
|
300
|
-
flex: none;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
[part='label'] {
|
|
304
|
-
white-space: nowrap;
|
|
305
|
-
overflow: hidden;
|
|
306
|
-
text-overflow: ellipsis;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
@media (forced-colors: active) {
|
|
310
|
-
:host {
|
|
311
|
-
outline: 1px solid;
|
|
312
|
-
outline-offset: -1px;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
:host([focused]) {
|
|
316
|
-
outline-width: 2px;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
:host([disabled]) {
|
|
320
|
-
outline-color: GrayText;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
`;
|
|
324
|
-
|
|
325
|
-
const buttonTemplate = (html) => html`
|
|
326
|
-
<div class="vaadin-button-container">
|
|
327
|
-
<span part="prefix" aria-hidden="true">
|
|
328
|
-
<slot name="prefix"></slot>
|
|
329
|
-
</span>
|
|
330
|
-
<span part="label">
|
|
331
|
-
<slot></slot>
|
|
332
|
-
</span>
|
|
333
|
-
<span part="suffix" aria-hidden="true">
|
|
334
|
-
<slot name="suffix"></slot>
|
|
335
|
-
</span>
|
|
336
|
-
</div>
|
|
337
|
-
<slot name="tooltip"></slot>
|
|
338
|
-
`;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* @license
|
|
342
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
343
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
344
|
-
*/
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* A mixin providing common button functionality.
|
|
348
|
-
*
|
|
349
|
-
* @polymerMixin
|
|
350
|
-
* @mixes ActiveMixin
|
|
351
|
-
* @mixes FocusMixin
|
|
352
|
-
* @mixes TabindexMixin
|
|
353
|
-
*/
|
|
354
|
-
const ButtonMixin = (superClass) =>
|
|
355
|
-
class ButtonMixinClass extends ActiveMixin(TabindexMixin(FocusMixin(superClass))) {
|
|
356
|
-
static get properties() {
|
|
357
|
-
return {
|
|
358
|
-
/**
|
|
359
|
-
* Indicates whether the element can be focused and where it participates in sequential keyboard navigation.
|
|
360
|
-
*
|
|
361
|
-
* @override
|
|
362
|
-
* @protected
|
|
363
|
-
*/
|
|
364
|
-
tabindex: {
|
|
365
|
-
type: Number,
|
|
366
|
-
value: 0,
|
|
367
|
-
reflectToAttribute: true,
|
|
368
|
-
},
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* By default, `Space` is the only possible activation key for a focusable HTML element.
|
|
374
|
-
* Nonetheless, the button is an exception as it can be also activated by pressing `Enter`.
|
|
375
|
-
* See the "Keyboard Support" section in https://www.w3.org/TR/wai-aria-practices/examples/button/button.html.
|
|
376
|
-
*
|
|
377
|
-
* @protected
|
|
378
|
-
* @override
|
|
379
|
-
*/
|
|
380
|
-
get _activeKeys() {
|
|
381
|
-
return ['Enter', ' '];
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/** @protected */
|
|
385
|
-
ready() {
|
|
386
|
-
super.ready();
|
|
387
|
-
|
|
388
|
-
// By default, if the user hasn't provided a custom role,
|
|
389
|
-
// the role attribute is set to "button".
|
|
390
|
-
if (!this.hasAttribute('role')) {
|
|
391
|
-
this.setAttribute('role', 'button');
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Since the button component is designed on the base of the `[role=button]` attribute,
|
|
397
|
-
* and doesn't have a native <button> inside, in order to be fully accessible from the keyboard,
|
|
398
|
-
* it should manually fire the `click` event once an activation key is pressed,
|
|
399
|
-
* as it follows from the WAI-ARIA specifications:
|
|
400
|
-
* https://www.w3.org/TR/wai-aria-practices-1.1/#button
|
|
401
|
-
*
|
|
402
|
-
* According to the UI Events specifications,
|
|
403
|
-
* the `click` event should be fired exactly on `keydown`:
|
|
404
|
-
* https://www.w3.org/TR/uievents/#event-type-keydown
|
|
405
|
-
*
|
|
406
|
-
* @param {KeyboardEvent} event
|
|
407
|
-
* @protected
|
|
408
|
-
* @override
|
|
409
|
-
*/
|
|
410
|
-
_onKeyDown(event) {
|
|
411
|
-
super._onKeyDown(event);
|
|
412
|
-
|
|
413
|
-
if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
if (this._activeKeys.includes(event.key)) {
|
|
418
|
-
event.preventDefault();
|
|
419
|
-
|
|
420
|
-
// `DisabledMixin` overrides the standard `click()` method
|
|
421
|
-
// so that it doesn't fire the `click` event when the element is disabled.
|
|
422
|
-
this.click();
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* @license
|
|
429
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
430
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
431
|
-
*/
|
|
432
|
-
|
|
433
|
-
registerStyles('vaadin-button', buttonStyles, { moduleId: 'vaadin-button-styles' });
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* `<vaadin-button>` is an accessible and customizable button that allows users to perform actions.
|
|
437
|
-
*
|
|
438
|
-
* ```html
|
|
439
|
-
* <vaadin-button>Press me</vaadin-button>
|
|
440
|
-
* ```
|
|
441
|
-
*
|
|
442
|
-
* ### Styling
|
|
443
|
-
*
|
|
444
|
-
* The following shadow DOM parts are available for styling:
|
|
445
|
-
*
|
|
446
|
-
* Part name | Description
|
|
447
|
-
* ----------|-------------
|
|
448
|
-
* `label` | The label (text) inside the button.
|
|
449
|
-
* `prefix` | A slot for content before the label (e.g. an icon).
|
|
450
|
-
* `suffix` | A slot for content after the label (e.g. an icon).
|
|
451
|
-
*
|
|
452
|
-
* The following attributes are available for styling:
|
|
453
|
-
*
|
|
454
|
-
* Attribute | Description
|
|
455
|
-
* -------------|-------------
|
|
456
|
-
* `active` | Set when the button is pressed down, either with mouse, touch or the keyboard.
|
|
457
|
-
* `disabled` | Set when the button is disabled.
|
|
458
|
-
* `focus-ring` | Set when the button is focused using the keyboard.
|
|
459
|
-
* `focused` | Set when the button is focused.
|
|
460
|
-
*
|
|
461
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
462
|
-
*
|
|
463
|
-
* @customElement
|
|
464
|
-
* @extends HTMLElement
|
|
465
|
-
* @mixes ButtonMixin
|
|
466
|
-
* @mixes ControllerMixin
|
|
467
|
-
* @mixes ElementMixin
|
|
468
|
-
* @mixes ThemableMixin
|
|
469
|
-
*/
|
|
470
|
-
class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement)))) {
|
|
471
|
-
static get is() {
|
|
472
|
-
return 'vaadin-button';
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
static get template() {
|
|
476
|
-
return buttonTemplate(html);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/** @protected */
|
|
480
|
-
ready() {
|
|
481
|
-
super.ready();
|
|
482
|
-
|
|
483
|
-
this._tooltipController = new TooltipController(this);
|
|
484
|
-
this.addController(this._tooltipController);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
defineCustomElement(Button);
|
|
489
|
-
|
|
490
|
-
export { Button as B, button as b };
|