@everymatrix/general-input 1.27.6 → 1.27.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 +12152 -11622
- package/dist/components/active-mixin.js +6 -6
- package/dist/components/checkbox-group-input2.js +260 -307
- package/dist/components/date-input2.js +3461 -2218
- package/dist/components/field-mixin.js +2188 -2474
- package/dist/components/input-field-shared-styles.js +308 -211
- package/dist/components/password-input2.js +119 -72
- package/dist/components/vaadin-button.js +102 -73
- package/dist/components/vaadin-combo-box.js +988 -805
- package/dist/components/virtual-keyboard-controller.js +1114 -1771
- package/dist/esm/checkbox-group-input_10.entry.js +12152 -11622
- package/dist/general-input/general-input.esm.js +1 -1
- package/dist/general-input/p-e322bf39.entry.js +3646 -0
- package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +2 -0
- package/package.json +1 -1
- package/dist/components/pattern-mixin.js +0 -85
- package/dist/general-input/p-de2b2f7b.entry.js +0 -3581
- package/dist/types/Users/sebastian.strulea/Documents/work/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -2
|
@@ -1,13 +1,12 @@
|
|
|
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,
|
|
5
|
-
import { P as PatternMixin } from './pattern-mixin.js';
|
|
4
|
+
import { r as registerStyles, c as InputController, e as LabelledInputController, h as html, T as TooltipController, f as defineCustomElement$1, g as ThemableMixin, E as ElementMixin, P as PolymerElement, i, G as SlotController } from './field-mixin.js';
|
|
6
5
|
import { b as button, B as Button } from './vaadin-button.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* @license
|
|
10
|
-
* Copyright (c) 2017 -
|
|
9
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
11
10
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
12
11
|
*/
|
|
13
12
|
|
|
@@ -17,7 +16,7 @@ registerStyles('vaadin-text-field', inputFieldShared, {
|
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* @license
|
|
20
|
-
* Copyright (c) 2021 -
|
|
19
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
21
20
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
22
21
|
*/
|
|
23
22
|
|
|
@@ -71,6 +70,15 @@ const InputFieldMixin = (superclass) =>
|
|
|
71
70
|
return [...super.delegateAttrs, 'autocapitalize', 'autocomplete', 'autocorrect'];
|
|
72
71
|
}
|
|
73
72
|
|
|
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
|
+
|
|
74
82
|
/**
|
|
75
83
|
* @param {HTMLElement} input
|
|
76
84
|
* @protected
|
|
@@ -92,15 +100,6 @@ const InputFieldMixin = (superclass) =>
|
|
|
92
100
|
}
|
|
93
101
|
}
|
|
94
102
|
|
|
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
|
-
|
|
104
103
|
/**
|
|
105
104
|
* Override an event listener from `FocusMixin`.
|
|
106
105
|
* @param {boolean} focused
|
|
@@ -110,7 +109,9 @@ const InputFieldMixin = (superclass) =>
|
|
|
110
109
|
_setFocused(focused) {
|
|
111
110
|
super._setFocused(focused);
|
|
112
111
|
|
|
113
|
-
|
|
112
|
+
// Do not validate when focusout is caused by document
|
|
113
|
+
// losing focus, which happens on browser tab switch.
|
|
114
|
+
if (!focused && document.hasFocus()) {
|
|
114
115
|
this.validate();
|
|
115
116
|
}
|
|
116
117
|
}
|
|
@@ -154,7 +155,81 @@ const InputFieldMixin = (superclass) =>
|
|
|
154
155
|
|
|
155
156
|
/**
|
|
156
157
|
* @license
|
|
157
|
-
* Copyright (c)
|
|
158
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
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.
|
|
158
233
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
159
234
|
*/
|
|
160
235
|
|
|
@@ -215,7 +290,7 @@ registerStyles('vaadin-text-field', inputFieldShared$1, { moduleId: 'vaadin-text
|
|
|
215
290
|
* `focus-ring` | Set when the element is keyboard focused | :host
|
|
216
291
|
* `readonly` | Set to a readonly text field | :host
|
|
217
292
|
*
|
|
218
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/
|
|
293
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
219
294
|
*
|
|
220
295
|
* @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.
|
|
221
296
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
@@ -223,13 +298,13 @@ registerStyles('vaadin-text-field', inputFieldShared$1, { moduleId: 'vaadin-text
|
|
|
223
298
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
224
299
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
225
300
|
*
|
|
301
|
+
* @customElement
|
|
226
302
|
* @extends HTMLElement
|
|
227
303
|
* @mixes ElementMixin
|
|
228
304
|
* @mixes ThemableMixin
|
|
229
|
-
* @mixes
|
|
230
|
-
* @mixes InputFieldMixin
|
|
305
|
+
* @mixes TextFieldMixin
|
|
231
306
|
*/
|
|
232
|
-
class TextField extends
|
|
307
|
+
class TextField extends TextFieldMixin(ThemableMixin(ElementMixin(PolymerElement))) {
|
|
233
308
|
static get is() {
|
|
234
309
|
return 'vaadin-text-field';
|
|
235
310
|
}
|
|
@@ -291,49 +366,22 @@ class TextField extends PatternMixin(InputFieldMixin(ThemableMixin(ElementMixin(
|
|
|
291
366
|
};
|
|
292
367
|
}
|
|
293
368
|
|
|
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
|
-
|
|
312
369
|
/** @protected */
|
|
313
370
|
ready() {
|
|
314
371
|
super.ready();
|
|
315
372
|
|
|
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
|
-
|
|
326
373
|
this._tooltipController = new TooltipController(this);
|
|
327
374
|
this._tooltipController.setPosition('top');
|
|
375
|
+
this._tooltipController.setAriaTarget(this.inputElement);
|
|
328
376
|
this.addController(this._tooltipController);
|
|
329
377
|
}
|
|
330
378
|
}
|
|
331
379
|
|
|
332
|
-
|
|
380
|
+
defineCustomElement$1(TextField);
|
|
333
381
|
|
|
334
382
|
/**
|
|
335
383
|
* @license
|
|
336
|
-
* Copyright (c) 2021 -
|
|
384
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
337
385
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
338
386
|
*/
|
|
339
387
|
|
|
@@ -358,7 +406,7 @@ registerStyles('vaadin-password-field-button', [button, passwordFieldButton], {
|
|
|
358
406
|
|
|
359
407
|
/**
|
|
360
408
|
* @license
|
|
361
|
-
* Copyright (c) 2021 -
|
|
409
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
362
410
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
363
411
|
*/
|
|
364
412
|
|
|
@@ -386,13 +434,14 @@ registerStyles('vaadin-password-field', [inputFieldShared, passwordField], { mod
|
|
|
386
434
|
|
|
387
435
|
/**
|
|
388
436
|
* @license
|
|
389
|
-
* Copyright (c) 2021 -
|
|
437
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
390
438
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
391
439
|
*/
|
|
392
440
|
|
|
393
441
|
/**
|
|
394
442
|
* An element used internally by `<vaadin-password-field>`. Not intended to be used separately.
|
|
395
443
|
*
|
|
444
|
+
* @customElement
|
|
396
445
|
* @extends Button
|
|
397
446
|
* @private
|
|
398
447
|
*/
|
|
@@ -417,11 +466,11 @@ class PasswordFieldButton extends Button {
|
|
|
417
466
|
}
|
|
418
467
|
}
|
|
419
468
|
|
|
420
|
-
|
|
469
|
+
defineCustomElement$1(PasswordFieldButton);
|
|
421
470
|
|
|
422
471
|
/**
|
|
423
472
|
* @license
|
|
424
|
-
* Copyright (c) 2021 -
|
|
473
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
425
474
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
426
475
|
*/
|
|
427
476
|
|
|
@@ -457,7 +506,7 @@ let memoizedTemplate;
|
|
|
457
506
|
* -------------------|---------------------------------
|
|
458
507
|
* `password-visible` | Set when the password is visible
|
|
459
508
|
*
|
|
460
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/
|
|
509
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
461
510
|
*
|
|
462
511
|
* @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.
|
|
463
512
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
@@ -465,6 +514,7 @@ let memoizedTemplate;
|
|
|
465
514
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
466
515
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
467
516
|
*
|
|
517
|
+
* @customElement
|
|
468
518
|
* @extends TextField
|
|
469
519
|
*/
|
|
470
520
|
class PasswordField extends TextField {
|
|
@@ -538,6 +588,14 @@ class PasswordField extends TextField {
|
|
|
538
588
|
return ['__i18nChanged(i18n.*)'];
|
|
539
589
|
}
|
|
540
590
|
|
|
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
|
+
|
|
541
599
|
/** @protected */
|
|
542
600
|
get slotStyles() {
|
|
543
601
|
const tag = this.localName;
|
|
@@ -556,31 +614,20 @@ class PasswordField extends TextField {
|
|
|
556
614
|
return this._revealButtonController && this._revealButtonController.node;
|
|
557
615
|
}
|
|
558
616
|
|
|
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
|
-
|
|
567
617
|
/** @protected */
|
|
568
618
|
ready() {
|
|
569
619
|
super.ready();
|
|
570
620
|
|
|
571
621
|
this._revealPart = this.shadowRoot.querySelector('[part="reveal-button"]');
|
|
572
622
|
|
|
573
|
-
this._revealButtonController = new SlotController(
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
() => document.createElement('vaadin-password-field-button'),
|
|
577
|
-
(host, btn) => {
|
|
578
|
-
btn.disabled = host.disabled;
|
|
623
|
+
this._revealButtonController = new SlotController(this, 'reveal', 'vaadin-password-field-button', {
|
|
624
|
+
initializer: (btn) => {
|
|
625
|
+
btn.disabled = this.disabled;
|
|
579
626
|
|
|
580
|
-
btn.addEventListener('click',
|
|
581
|
-
btn.addEventListener('mousedown',
|
|
627
|
+
btn.addEventListener('click', this.__boundRevealButtonClick);
|
|
628
|
+
btn.addEventListener('mousedown', this.__boundRevealButtonMouseDown);
|
|
582
629
|
},
|
|
583
|
-
);
|
|
630
|
+
});
|
|
584
631
|
this.addController(this._revealButtonController);
|
|
585
632
|
|
|
586
633
|
this.__updateAriaLabel(this.i18n);
|
|
@@ -737,7 +784,7 @@ class PasswordField extends TextField {
|
|
|
737
784
|
}
|
|
738
785
|
}
|
|
739
786
|
|
|
740
|
-
|
|
787
|
+
defineCustomElement$1(PasswordField);
|
|
741
788
|
|
|
742
789
|
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}";
|
|
743
790
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i, r as registerStyles,
|
|
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
2
|
import { A as ActiveMixin } from './active-mixin.js';
|
|
3
3
|
|
|
4
4
|
const button = i`
|
|
@@ -21,6 +21,7 @@ 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;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/* Set only for the internal parts so we don't affect the host vertical alignment */
|
|
@@ -51,10 +52,7 @@ const button = i`
|
|
|
51
52
|
/* We rely on the host always being relative */
|
|
52
53
|
position: absolute;
|
|
53
54
|
z-index: 1;
|
|
54
|
-
|
|
55
|
-
right: 0;
|
|
56
|
-
bottom: 0;
|
|
57
|
-
left: 0;
|
|
55
|
+
inset: 0;
|
|
58
56
|
background-color: currentColor;
|
|
59
57
|
border-radius: inherit;
|
|
60
58
|
opacity: 0;
|
|
@@ -199,16 +197,14 @@ const button = i`
|
|
|
199
197
|
|
|
200
198
|
/* Icons */
|
|
201
199
|
|
|
202
|
-
[part] ::slotted(vaadin-icon)
|
|
203
|
-
[part] ::slotted(iron-icon) {
|
|
200
|
+
[part] ::slotted(vaadin-icon) {
|
|
204
201
|
display: inline-block;
|
|
205
202
|
width: var(--lumo-icon-size-m);
|
|
206
203
|
height: var(--lumo-icon-size-m);
|
|
207
204
|
}
|
|
208
205
|
|
|
209
206
|
/* Vaadin icons are based on a 16x16 grid (unlike Lumo and Material icons with 24x24), so they look too big by default */
|
|
210
|
-
[part] ::slotted(vaadin-icon[icon^='vaadin:'])
|
|
211
|
-
[part] ::slotted(iron-icon[icon^='vaadin:']) {
|
|
207
|
+
[part] ::slotted(vaadin-icon[icon^='vaadin:']) {
|
|
212
208
|
padding: 0.25em;
|
|
213
209
|
box-sizing: border-box !important;
|
|
214
210
|
}
|
|
@@ -260,7 +256,90 @@ registerStyles('vaadin-button', button, { moduleId: 'lumo-button' });
|
|
|
260
256
|
|
|
261
257
|
/**
|
|
262
258
|
* @license
|
|
263
|
-
* Copyright (c) 2017 -
|
|
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.
|
|
264
343
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
265
344
|
*/
|
|
266
345
|
|
|
@@ -283,7 +362,9 @@ const ButtonMixin = (superClass) =>
|
|
|
283
362
|
* @protected
|
|
284
363
|
*/
|
|
285
364
|
tabindex: {
|
|
365
|
+
type: Number,
|
|
286
366
|
value: 0,
|
|
367
|
+
reflectToAttribute: true,
|
|
287
368
|
},
|
|
288
369
|
};
|
|
289
370
|
}
|
|
@@ -329,6 +410,10 @@ const ButtonMixin = (superClass) =>
|
|
|
329
410
|
_onKeyDown(event) {
|
|
330
411
|
super._onKeyDown(event);
|
|
331
412
|
|
|
413
|
+
if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
|
|
332
417
|
if (this._activeKeys.includes(event.key)) {
|
|
333
418
|
event.preventDefault();
|
|
334
419
|
|
|
@@ -341,10 +426,12 @@ const ButtonMixin = (superClass) =>
|
|
|
341
426
|
|
|
342
427
|
/**
|
|
343
428
|
* @license
|
|
344
|
-
* Copyright (c) 2017 -
|
|
429
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
345
430
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
346
431
|
*/
|
|
347
432
|
|
|
433
|
+
registerStyles('vaadin-button', buttonStyles, { moduleId: 'vaadin-button-styles' });
|
|
434
|
+
|
|
348
435
|
/**
|
|
349
436
|
* `<vaadin-button>` is an accessible and customizable button that allows users to perform actions.
|
|
350
437
|
*
|
|
@@ -371,8 +458,9 @@ const ButtonMixin = (superClass) =>
|
|
|
371
458
|
* `focus-ring` | Set when the button is focused using the keyboard.
|
|
372
459
|
* `focused` | Set when the button is focused.
|
|
373
460
|
*
|
|
374
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/
|
|
461
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
375
462
|
*
|
|
463
|
+
* @customElement
|
|
376
464
|
* @extends HTMLElement
|
|
377
465
|
* @mixes ButtonMixin
|
|
378
466
|
* @mixes ControllerMixin
|
|
@@ -385,66 +473,7 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly
|
|
|
385
473
|
}
|
|
386
474
|
|
|
387
475
|
static get template() {
|
|
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
|
-
`;
|
|
476
|
+
return buttonTemplate(html);
|
|
448
477
|
}
|
|
449
478
|
|
|
450
479
|
/** @protected */
|
|
@@ -456,6 +485,6 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly
|
|
|
456
485
|
}
|
|
457
486
|
}
|
|
458
487
|
|
|
459
|
-
|
|
488
|
+
defineCustomElement(Button);
|
|
460
489
|
|
|
461
490
|
export { Button as B, button as b };
|