@everymatrix/general-input 1.28.7 → 1.28.8
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/checkbox-group-input_10.cjs.entry.js +12517 -13047
- package/dist/components/active-mixin.js +6 -6
- package/dist/components/checkbox-group-input2.js +307 -260
- package/dist/components/date-input2.js +2206 -3449
- package/dist/components/field-mixin.js +2512 -2226
- package/dist/components/input-field-shared-styles.js +211 -308
- package/dist/components/password-input2.js +72 -119
- package/dist/components/pattern-mixin.js +85 -0
- package/dist/components/vaadin-button.js +73 -102
- package/dist/components/vaadin-combo-box.js +808 -991
- package/dist/components/virtual-keyboard-controller.js +1768 -1111
- package/dist/esm/checkbox-group-input_10.entry.js +12517 -13047
- package/dist/general-input/general-input.esm.js +1 -1
- package/dist/general-input/p-6958a2a8.entry.js +3581 -0
- package/package.json +1 -1
- package/dist/general-input/p-765941e7.entry.js +0 -3646
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/Documents/work}/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
3
|
import { i as inputFieldShared, c as InputControlMixin, d as inputFieldShared$1 } from './input-field-shared-styles.js';
|
|
4
|
-
import { r as registerStyles,
|
|
4
|
+
import { r as registerStyles, h as html, e as InputController, f as LabelledInputController, g as TooltipController, T as ThemableMixin, E as ElementMixin, P as PolymerElement, i, S as SlotController } from './field-mixin.js';
|
|
5
|
+
import { P as PatternMixin } from './pattern-mixin.js';
|
|
5
6
|
import { b as button, B as Button } from './vaadin-button.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @license
|
|
9
|
-
* Copyright (c) 2017 -
|
|
10
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
10
11
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
11
12
|
*/
|
|
12
13
|
|
|
@@ -16,7 +17,7 @@ registerStyles('vaadin-text-field', inputFieldShared, {
|
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* @license
|
|
19
|
-
* Copyright (c) 2021 -
|
|
20
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
20
21
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
21
22
|
*/
|
|
22
23
|
|
|
@@ -70,15 +71,6 @@ const InputFieldMixin = (superclass) =>
|
|
|
70
71
|
return [...super.delegateAttrs, 'autocapitalize', 'autocomplete', 'autocorrect'];
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
// Workaround for https://github.com/Polymer/polymer/issues/5259
|
|
74
|
-
get __data() {
|
|
75
|
-
return this.__dataValue || {};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
set __data(value) {
|
|
79
|
-
this.__dataValue = value;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
74
|
/**
|
|
83
75
|
* @param {HTMLElement} input
|
|
84
76
|
* @protected
|
|
@@ -100,6 +92,15 @@ const InputFieldMixin = (superclass) =>
|
|
|
100
92
|
}
|
|
101
93
|
}
|
|
102
94
|
|
|
95
|
+
// Workaround for https://github.com/Polymer/polymer/issues/5259
|
|
96
|
+
get __data() {
|
|
97
|
+
return this.__dataValue || {};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
set __data(value) {
|
|
101
|
+
this.__dataValue = value;
|
|
102
|
+
}
|
|
103
|
+
|
|
103
104
|
/**
|
|
104
105
|
* Override an event listener from `FocusMixin`.
|
|
105
106
|
* @param {boolean} focused
|
|
@@ -109,9 +110,7 @@ const InputFieldMixin = (superclass) =>
|
|
|
109
110
|
_setFocused(focused) {
|
|
110
111
|
super._setFocused(focused);
|
|
111
112
|
|
|
112
|
-
|
|
113
|
-
// losing focus, which happens on browser tab switch.
|
|
114
|
-
if (!focused && document.hasFocus()) {
|
|
113
|
+
if (!focused) {
|
|
115
114
|
this.validate();
|
|
116
115
|
}
|
|
117
116
|
}
|
|
@@ -155,81 +154,7 @@ const InputFieldMixin = (superclass) =>
|
|
|
155
154
|
|
|
156
155
|
/**
|
|
157
156
|
* @license
|
|
158
|
-
* Copyright (c)
|
|
159
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
160
|
-
*/
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* A mixin providing common text field functionality.
|
|
164
|
-
*
|
|
165
|
-
* @polymerMixin
|
|
166
|
-
* @mixes InputFieldMixin
|
|
167
|
-
*/
|
|
168
|
-
const TextFieldMixin = (superClass) =>
|
|
169
|
-
class TextFieldMixinClass extends InputFieldMixin(superClass) {
|
|
170
|
-
static get properties() {
|
|
171
|
-
return {
|
|
172
|
-
/**
|
|
173
|
-
* Maximum number of characters (in Unicode code points) that the user can enter.
|
|
174
|
-
*/
|
|
175
|
-
maxlength: {
|
|
176
|
-
type: Number,
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Minimum number of characters (in Unicode code points) that the user can enter.
|
|
181
|
-
*/
|
|
182
|
-
minlength: {
|
|
183
|
-
type: Number,
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* A regular expression that the value is checked against.
|
|
188
|
-
* The pattern must match the entire value, not just some subset.
|
|
189
|
-
*/
|
|
190
|
-
pattern: {
|
|
191
|
-
type: String,
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
static get delegateAttrs() {
|
|
197
|
-
return [...super.delegateAttrs, 'maxlength', 'minlength', 'pattern'];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
static get constraints() {
|
|
201
|
-
return [...super.constraints, 'maxlength', 'minlength', 'pattern'];
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
constructor() {
|
|
205
|
-
super();
|
|
206
|
-
this._setType('text');
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/** @protected */
|
|
210
|
-
get clearElement() {
|
|
211
|
-
return this.$.clearButton;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/** @protected */
|
|
215
|
-
ready() {
|
|
216
|
-
super.ready();
|
|
217
|
-
|
|
218
|
-
this.addController(
|
|
219
|
-
new InputController(this, (input) => {
|
|
220
|
-
this._setInputElement(input);
|
|
221
|
-
this._setFocusElement(input);
|
|
222
|
-
this.stateTarget = input;
|
|
223
|
-
this.ariaTarget = input;
|
|
224
|
-
}),
|
|
225
|
-
);
|
|
226
|
-
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* @license
|
|
232
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
157
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
233
158
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
234
159
|
*/
|
|
235
160
|
|
|
@@ -290,7 +215,7 @@ registerStyles('vaadin-text-field', inputFieldShared$1, { moduleId: 'vaadin-text
|
|
|
290
215
|
* `focus-ring` | Set when the element is keyboard focused | :host
|
|
291
216
|
* `readonly` | Set to a readonly text field | :host
|
|
292
217
|
*
|
|
293
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
218
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
294
219
|
*
|
|
295
220
|
* @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
|
|
296
221
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
@@ -298,13 +223,13 @@ registerStyles('vaadin-text-field', inputFieldShared$1, { moduleId: 'vaadin-text
|
|
|
298
223
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
299
224
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
300
225
|
*
|
|
301
|
-
* @customElement
|
|
302
226
|
* @extends HTMLElement
|
|
303
227
|
* @mixes ElementMixin
|
|
304
228
|
* @mixes ThemableMixin
|
|
305
|
-
* @mixes
|
|
229
|
+
* @mixes PatternMixin
|
|
230
|
+
* @mixes InputFieldMixin
|
|
306
231
|
*/
|
|
307
|
-
class TextField extends
|
|
232
|
+
class TextField extends PatternMixin(InputFieldMixin(ThemableMixin(ElementMixin(PolymerElement)))) {
|
|
308
233
|
static get is() {
|
|
309
234
|
return 'vaadin-text-field';
|
|
310
235
|
}
|
|
@@ -366,22 +291,49 @@ class TextField extends TextFieldMixin(ThemableMixin(ElementMixin(PolymerElement
|
|
|
366
291
|
};
|
|
367
292
|
}
|
|
368
293
|
|
|
294
|
+
static get delegateAttrs() {
|
|
295
|
+
return [...super.delegateAttrs, 'maxlength', 'minlength'];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
static get constraints() {
|
|
299
|
+
return [...super.constraints, 'maxlength', 'minlength'];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
constructor() {
|
|
303
|
+
super();
|
|
304
|
+
this._setType('text');
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** @protected */
|
|
308
|
+
get clearElement() {
|
|
309
|
+
return this.$.clearButton;
|
|
310
|
+
}
|
|
311
|
+
|
|
369
312
|
/** @protected */
|
|
370
313
|
ready() {
|
|
371
314
|
super.ready();
|
|
372
315
|
|
|
316
|
+
this.addController(
|
|
317
|
+
new InputController(this, (input) => {
|
|
318
|
+
this._setInputElement(input);
|
|
319
|
+
this._setFocusElement(input);
|
|
320
|
+
this.stateTarget = input;
|
|
321
|
+
this.ariaTarget = input;
|
|
322
|
+
}),
|
|
323
|
+
);
|
|
324
|
+
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
325
|
+
|
|
373
326
|
this._tooltipController = new TooltipController(this);
|
|
374
327
|
this._tooltipController.setPosition('top');
|
|
375
|
-
this._tooltipController.setAriaTarget(this.inputElement);
|
|
376
328
|
this.addController(this._tooltipController);
|
|
377
329
|
}
|
|
378
330
|
}
|
|
379
331
|
|
|
380
|
-
|
|
332
|
+
customElements.define(TextField.is, TextField);
|
|
381
333
|
|
|
382
334
|
/**
|
|
383
335
|
* @license
|
|
384
|
-
* Copyright (c) 2021 -
|
|
336
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
385
337
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
386
338
|
*/
|
|
387
339
|
|
|
@@ -406,7 +358,7 @@ registerStyles('vaadin-password-field-button', [button, passwordFieldButton], {
|
|
|
406
358
|
|
|
407
359
|
/**
|
|
408
360
|
* @license
|
|
409
|
-
* Copyright (c) 2021 -
|
|
361
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
410
362
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
411
363
|
*/
|
|
412
364
|
|
|
@@ -434,14 +386,13 @@ registerStyles('vaadin-password-field', [inputFieldShared, passwordField], { mod
|
|
|
434
386
|
|
|
435
387
|
/**
|
|
436
388
|
* @license
|
|
437
|
-
* Copyright (c) 2021 -
|
|
389
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
438
390
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
439
391
|
*/
|
|
440
392
|
|
|
441
393
|
/**
|
|
442
394
|
* An element used internally by `<vaadin-password-field>`. Not intended to be used separately.
|
|
443
395
|
*
|
|
444
|
-
* @customElement
|
|
445
396
|
* @extends Button
|
|
446
397
|
* @private
|
|
447
398
|
*/
|
|
@@ -466,11 +417,11 @@ class PasswordFieldButton extends Button {
|
|
|
466
417
|
}
|
|
467
418
|
}
|
|
468
419
|
|
|
469
|
-
|
|
420
|
+
customElements.define(PasswordFieldButton.is, PasswordFieldButton);
|
|
470
421
|
|
|
471
422
|
/**
|
|
472
423
|
* @license
|
|
473
|
-
* Copyright (c) 2021 -
|
|
424
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
474
425
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
475
426
|
*/
|
|
476
427
|
|
|
@@ -506,7 +457,7 @@ let memoizedTemplate;
|
|
|
506
457
|
* -------------------|---------------------------------
|
|
507
458
|
* `password-visible` | Set when the password is visible
|
|
508
459
|
*
|
|
509
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
460
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
510
461
|
*
|
|
511
462
|
* @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
|
|
512
463
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
@@ -514,7 +465,6 @@ let memoizedTemplate;
|
|
|
514
465
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
515
466
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
516
467
|
*
|
|
517
|
-
* @customElement
|
|
518
468
|
* @extends TextField
|
|
519
469
|
*/
|
|
520
470
|
class PasswordField extends TextField {
|
|
@@ -588,14 +538,6 @@ class PasswordField extends TextField {
|
|
|
588
538
|
return ['__i18nChanged(i18n.*)'];
|
|
589
539
|
}
|
|
590
540
|
|
|
591
|
-
constructor() {
|
|
592
|
-
super();
|
|
593
|
-
this._setType('password');
|
|
594
|
-
this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
|
|
595
|
-
this.__boundRevealButtonMouseDown = this._onRevealButtonMouseDown.bind(this);
|
|
596
|
-
this.__lastChange = '';
|
|
597
|
-
}
|
|
598
|
-
|
|
599
541
|
/** @protected */
|
|
600
542
|
get slotStyles() {
|
|
601
543
|
const tag = this.localName;
|
|
@@ -614,20 +556,31 @@ class PasswordField extends TextField {
|
|
|
614
556
|
return this._revealButtonController && this._revealButtonController.node;
|
|
615
557
|
}
|
|
616
558
|
|
|
559
|
+
constructor() {
|
|
560
|
+
super();
|
|
561
|
+
this._setType('password');
|
|
562
|
+
this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
|
|
563
|
+
this.__boundRevealButtonMouseDown = this._onRevealButtonMouseDown.bind(this);
|
|
564
|
+
this.__lastChange = '';
|
|
565
|
+
}
|
|
566
|
+
|
|
617
567
|
/** @protected */
|
|
618
568
|
ready() {
|
|
619
569
|
super.ready();
|
|
620
570
|
|
|
621
571
|
this._revealPart = this.shadowRoot.querySelector('[part="reveal-button"]');
|
|
622
572
|
|
|
623
|
-
this._revealButtonController = new SlotController(
|
|
624
|
-
|
|
625
|
-
|
|
573
|
+
this._revealButtonController = new SlotController(
|
|
574
|
+
this,
|
|
575
|
+
'reveal',
|
|
576
|
+
() => document.createElement('vaadin-password-field-button'),
|
|
577
|
+
(host, btn) => {
|
|
578
|
+
btn.disabled = host.disabled;
|
|
626
579
|
|
|
627
|
-
btn.addEventListener('click',
|
|
628
|
-
btn.addEventListener('mousedown',
|
|
580
|
+
btn.addEventListener('click', host.__boundRevealButtonClick);
|
|
581
|
+
btn.addEventListener('mousedown', host.__boundRevealButtonMouseDown);
|
|
629
582
|
},
|
|
630
|
-
|
|
583
|
+
);
|
|
631
584
|
this.addController(this._revealButtonController);
|
|
632
585
|
|
|
633
586
|
this.__updateAriaLabel(this.i18n);
|
|
@@ -784,7 +737,7 @@ class PasswordField extends TextField {
|
|
|
784
737
|
}
|
|
785
738
|
}
|
|
786
739
|
|
|
787
|
-
|
|
740
|
+
customElements.define(PasswordField.is, PasswordField);
|
|
788
741
|
|
|
789
742
|
const passwordInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password{font-family:\"Roboto\";font-style:normal}.password__wrapper{position:relative;width:100%;display:flex;flex-direction:column;gap:5px}.password__wrapper--autofilled{pointer-events:none}.password__wrapper--autofilled .password__label{color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.password__wrapper--autofilled .password__input::part(input-field){color:var(--emfe-w-color-black, #000000)}.password__wrapper--flex{display:flex;gap:5px}.password__wrapper--relative{position:relative}.password__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.password__label--required::after{content:\"*\";font-family:inherit;color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));margin-left:2px}.password__input{width:inherit;border:none}.password__input[focused]::part(input-field){border-color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C))}.password__input[invalid]::part(input-field){border:1px solid var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.password__input::part(input-field){border-radius:4px;background-color:var(--emfe-w-color-white, #FFFFFF);border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);color:var(--emfe-w-color-black, #000000);background-color:var(--emfe-w-color-white, #FFFFFF);font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:1.5;position:relative;margin-bottom:unset;height:44px;padding:0;width:100%}.password__input::part(reveal-button){position:relative;right:10px}.password__input::part(reveal-button)::before{color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.password__input>input{padding:5px 15px}.password__input>input:placeholder-shown{color:var(--emfe-w-color-gray-150, #828282)}.password__error-message{position:absolute;top:calc(100% + 5px);left:0;color:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.password__complexity{position:relative;padding:10px;display:flex;flex-direction:column;gap:20px;justify-content:center;margin-top:20px;font-weight:300;background:var(--emfe-w-color-white, #FFFFFF);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;height:150px;border:1px solid #B0B0B0;}.password__complexity meter{border-color:transparent;}.password__complexity meter[value=\"1\"]::-moz-meter-bar{background-color:var(--emfe-w-color-valid, #48952a)}.password__complexity meter[value=\"1\"]::-webkit-meter-optimum-value{background-color:var(--emfe-w-color-valid, #48952a)}.password__complexity meter:not([value=\"1\"])::-moz-meter-bar{background-color:var(--emfe-w-color-error, #FD2839)}.password__complexity meter:not([value=\"1\"])::-webkit-meter-optimum-value{background-color:var(--emfe-w-color-error, #FD2839)}.password__complexity--strength{display:flex;justify-content:space-evenly;align-items:center}.password__complexity--strength meter::-moz-meter-bar{background:#B0B0B0}.password__complexity--hidden{display:none}.password__complexity--text-bold{font-weight:500}.password__complexity--checkbox{margin-right:5px}.password__complexity:after{content:\"\";position:absolute;width:25px;height:25px;border-top:1px solid var(--emfe-w-color-gray-150, #828282);border-right:0 solid var(--emfe-w-color-gray-150, #828282);border-left:1px solid var(--emfe-w-color-gray-150, #828282);border-bottom:0 solid var(--emfe-w-color-gray-150, #828282);bottom:92%;left:50%;margin-left:-25px;transform:rotate(45deg);margin-top:-25px;background-color:var(--emfe-w-color-white, #FFFFFF)}.password__tooltip-icon{width:16px;height:auto}.password__tooltip{position:absolute;top:0;left:20px;background-color:var(--emfe-w-color-white, #FFFFFF);border:1px solid var(--emfe-w-color-gray-150, #828282);color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.password__tooltip.visible{opacity:1}";
|
|
790
743
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { y as Debouncer, z as timeOut } from './field-mixin.js';
|
|
2
|
+
import { I as InputConstraintsMixin } from './input-field-shared-styles.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
7
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A mixin to provide `pattern` and `preventInvalidInput` properties.
|
|
12
|
+
*
|
|
13
|
+
* @polymerMixin
|
|
14
|
+
* @mixes InputConstraintsMixin
|
|
15
|
+
*/
|
|
16
|
+
const PatternMixin = (superclass) =>
|
|
17
|
+
class PatternMixinClass extends InputConstraintsMixin(superclass) {
|
|
18
|
+
static get properties() {
|
|
19
|
+
return {
|
|
20
|
+
/**
|
|
21
|
+
* A regular expression that the value is checked against.
|
|
22
|
+
* The pattern must match the entire value, not just some subset.
|
|
23
|
+
*/
|
|
24
|
+
pattern: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* When set to true, user is prevented from typing a value that
|
|
30
|
+
* conflicts with the given `pattern`.
|
|
31
|
+
* @attr {boolean} prevent-invalid-input
|
|
32
|
+
* @deprecated Please use `allowedCharPattern` instead.
|
|
33
|
+
*/
|
|
34
|
+
preventInvalidInput: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
observer: '_preventInvalidInputChanged',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static get delegateAttrs() {
|
|
42
|
+
return [...super.delegateAttrs, 'pattern'];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static get constraints() {
|
|
46
|
+
return [...super.constraints, 'pattern'];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @private */
|
|
50
|
+
_checkInputValue() {
|
|
51
|
+
if (this.preventInvalidInput) {
|
|
52
|
+
const input = this.inputElement;
|
|
53
|
+
if (input && input.value.length > 0 && !this.checkValidity()) {
|
|
54
|
+
input.value = this.value || '';
|
|
55
|
+
// Add input-prevented attribute for 200ms
|
|
56
|
+
this.setAttribute('input-prevented', '');
|
|
57
|
+
this._inputDebouncer = Debouncer.debounce(this._inputDebouncer, timeOut.after(200), () => {
|
|
58
|
+
this.removeAttribute('input-prevented');
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {Event} event
|
|
66
|
+
* @protected
|
|
67
|
+
* @override
|
|
68
|
+
*/
|
|
69
|
+
_onInput(event) {
|
|
70
|
+
this._checkInputValue();
|
|
71
|
+
|
|
72
|
+
super._onInput(event);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @private */
|
|
76
|
+
_preventInvalidInputChanged(preventInvalidInput) {
|
|
77
|
+
if (preventInvalidInput) {
|
|
78
|
+
console.warn(
|
|
79
|
+
`WARNING: Since Vaadin 23.2, "preventInvalidInput" is deprecated. Please use "allowedCharPattern" instead.`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export { PatternMixin as P };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i, r as registerStyles,
|
|
1
|
+
import { i, r as registerStyles, N as TabindexMixin, l as FocusMixin, E as ElementMixin, T as ThemableMixin, C as ControllerMixin, P as PolymerElement, h as html, g as TooltipController } from './field-mixin.js';
|
|
2
2
|
import { A as ActiveMixin } from './active-mixin.js';
|
|
3
3
|
|
|
4
4
|
const button = i`
|
|
@@ -21,7 +21,6 @@ const button = i`
|
|
|
21
21
|
-webkit-tap-highlight-color: transparent;
|
|
22
22
|
-webkit-font-smoothing: antialiased;
|
|
23
23
|
-moz-osx-font-smoothing: grayscale;
|
|
24
|
-
flex-shrink: 0;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
/* Set only for the internal parts so we don't affect the host vertical alignment */
|
|
@@ -52,7 +51,10 @@ const button = i`
|
|
|
52
51
|
/* We rely on the host always being relative */
|
|
53
52
|
position: absolute;
|
|
54
53
|
z-index: 1;
|
|
55
|
-
|
|
54
|
+
top: 0;
|
|
55
|
+
right: 0;
|
|
56
|
+
bottom: 0;
|
|
57
|
+
left: 0;
|
|
56
58
|
background-color: currentColor;
|
|
57
59
|
border-radius: inherit;
|
|
58
60
|
opacity: 0;
|
|
@@ -197,14 +199,16 @@ const button = i`
|
|
|
197
199
|
|
|
198
200
|
/* Icons */
|
|
199
201
|
|
|
200
|
-
[part] ::slotted(vaadin-icon)
|
|
202
|
+
[part] ::slotted(vaadin-icon),
|
|
203
|
+
[part] ::slotted(iron-icon) {
|
|
201
204
|
display: inline-block;
|
|
202
205
|
width: var(--lumo-icon-size-m);
|
|
203
206
|
height: var(--lumo-icon-size-m);
|
|
204
207
|
}
|
|
205
208
|
|
|
206
209
|
/* 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:'])
|
|
210
|
+
[part] ::slotted(vaadin-icon[icon^='vaadin:']),
|
|
211
|
+
[part] ::slotted(iron-icon[icon^='vaadin:']) {
|
|
208
212
|
padding: 0.25em;
|
|
209
213
|
box-sizing: border-box !important;
|
|
210
214
|
}
|
|
@@ -256,90 +260,7 @@ registerStyles('vaadin-button', button, { moduleId: 'lumo-button' });
|
|
|
256
260
|
|
|
257
261
|
/**
|
|
258
262
|
* @license
|
|
259
|
-
* Copyright (c) 2017 -
|
|
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.
|
|
263
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
343
264
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
344
265
|
*/
|
|
345
266
|
|
|
@@ -362,9 +283,7 @@ const ButtonMixin = (superClass) =>
|
|
|
362
283
|
* @protected
|
|
363
284
|
*/
|
|
364
285
|
tabindex: {
|
|
365
|
-
type: Number,
|
|
366
286
|
value: 0,
|
|
367
|
-
reflectToAttribute: true,
|
|
368
287
|
},
|
|
369
288
|
};
|
|
370
289
|
}
|
|
@@ -410,10 +329,6 @@ const ButtonMixin = (superClass) =>
|
|
|
410
329
|
_onKeyDown(event) {
|
|
411
330
|
super._onKeyDown(event);
|
|
412
331
|
|
|
413
|
-
if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
332
|
if (this._activeKeys.includes(event.key)) {
|
|
418
333
|
event.preventDefault();
|
|
419
334
|
|
|
@@ -426,12 +341,10 @@ const ButtonMixin = (superClass) =>
|
|
|
426
341
|
|
|
427
342
|
/**
|
|
428
343
|
* @license
|
|
429
|
-
* Copyright (c) 2017 -
|
|
344
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
430
345
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
431
346
|
*/
|
|
432
347
|
|
|
433
|
-
registerStyles('vaadin-button', buttonStyles, { moduleId: 'vaadin-button-styles' });
|
|
434
|
-
|
|
435
348
|
/**
|
|
436
349
|
* `<vaadin-button>` is an accessible and customizable button that allows users to perform actions.
|
|
437
350
|
*
|
|
@@ -458,9 +371,8 @@ registerStyles('vaadin-button', buttonStyles, { moduleId: 'vaadin-button-styles'
|
|
|
458
371
|
* `focus-ring` | Set when the button is focused using the keyboard.
|
|
459
372
|
* `focused` | Set when the button is focused.
|
|
460
373
|
*
|
|
461
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
374
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
462
375
|
*
|
|
463
|
-
* @customElement
|
|
464
376
|
* @extends HTMLElement
|
|
465
377
|
* @mixes ButtonMixin
|
|
466
378
|
* @mixes ControllerMixin
|
|
@@ -473,7 +385,66 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly
|
|
|
473
385
|
}
|
|
474
386
|
|
|
475
387
|
static get template() {
|
|
476
|
-
return
|
|
388
|
+
return html`
|
|
389
|
+
<style>
|
|
390
|
+
:host {
|
|
391
|
+
display: inline-block;
|
|
392
|
+
position: relative;
|
|
393
|
+
outline: none;
|
|
394
|
+
white-space: nowrap;
|
|
395
|
+
-webkit-user-select: none;
|
|
396
|
+
-moz-user-select: none;
|
|
397
|
+
user-select: none;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
:host([hidden]) {
|
|
401
|
+
display: none !important;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/* Aligns the button with form fields when placed on the same line.
|
|
405
|
+
Note, to make it work, the form fields should have the same "::before" pseudo-element. */
|
|
406
|
+
.vaadin-button-container::before {
|
|
407
|
+
content: '\\2003';
|
|
408
|
+
display: inline-block;
|
|
409
|
+
width: 0;
|
|
410
|
+
max-height: 100%;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.vaadin-button-container {
|
|
414
|
+
display: inline-flex;
|
|
415
|
+
align-items: center;
|
|
416
|
+
justify-content: center;
|
|
417
|
+
text-align: center;
|
|
418
|
+
width: 100%;
|
|
419
|
+
height: 100%;
|
|
420
|
+
min-height: inherit;
|
|
421
|
+
text-shadow: inherit;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
[part='prefix'],
|
|
425
|
+
[part='suffix'] {
|
|
426
|
+
flex: none;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
[part='label'] {
|
|
430
|
+
white-space: nowrap;
|
|
431
|
+
overflow: hidden;
|
|
432
|
+
text-overflow: ellipsis;
|
|
433
|
+
}
|
|
434
|
+
</style>
|
|
435
|
+
<div class="vaadin-button-container">
|
|
436
|
+
<span part="prefix" aria-hidden="true">
|
|
437
|
+
<slot name="prefix"></slot>
|
|
438
|
+
</span>
|
|
439
|
+
<span part="label">
|
|
440
|
+
<slot></slot>
|
|
441
|
+
</span>
|
|
442
|
+
<span part="suffix" aria-hidden="true">
|
|
443
|
+
<slot name="suffix"></slot>
|
|
444
|
+
</span>
|
|
445
|
+
</div>
|
|
446
|
+
<slot name="tooltip"></slot>
|
|
447
|
+
`;
|
|
477
448
|
}
|
|
478
449
|
|
|
479
450
|
/** @protected */
|
|
@@ -485,6 +456,6 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly
|
|
|
485
456
|
}
|
|
486
457
|
}
|
|
487
458
|
|
|
488
|
-
|
|
459
|
+
customElements.define(Button.is, Button);
|
|
489
460
|
|
|
490
461
|
export { Button as B, button as b };
|