@everymatrix/general-input 0.0.1 → 1.0.69
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 +20007 -16663
- package/dist/cjs/general-input.cjs.entry.js +67 -40
- package/dist/cjs/general-input.cjs.js +17 -11
- package/dist/cjs/index-8cb018cb.js +1316 -0
- package/dist/cjs/index.cjs.js +16 -0
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/cjs/locale.utils-7a3dfe2f.js +128 -0
- package/dist/cjs/toggle-checkbox-input.cjs.entry.js +91 -0
- package/dist/cjs/tooltipIcon-7e9ee226.js +5 -0
- package/dist/collection/collection-manifest.json +14 -13
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +26 -6
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +372 -335
- package/dist/collection/components/checkbox-input/checkbox-input.css +16 -10
- package/dist/collection/components/checkbox-input/checkbox-input.js +325 -310
- package/dist/collection/components/date-input/date-input.css +35 -19
- package/dist/collection/components/date-input/date-input.js +401 -328
- package/dist/collection/components/email-input/email-input.css +30 -18
- package/dist/collection/components/email-input/email-input.js +405 -365
- package/dist/collection/components/general-input/general-input.css +1 -0
- package/dist/collection/components/general-input/general-input.js +374 -291
- package/dist/collection/components/general-input/index.js +1 -0
- package/dist/collection/components/number-input/number-input.css +28 -16
- package/dist/collection/components/number-input/number-input.js +371 -334
- package/dist/collection/components/password-input/password-input.css +105 -11
- package/dist/collection/components/password-input/password-input.js +518 -378
- package/dist/collection/components/radio-input/radio-input.css +4 -4
- package/dist/collection/components/radio-input/radio-input.js +301 -287
- package/dist/collection/components/select-input/select-input.css +47 -19
- package/dist/collection/components/select-input/select-input.js +428 -398
- package/dist/collection/components/tel-input/tel-input.css +52 -23
- package/dist/collection/components/tel-input/tel-input.js +441 -404
- package/dist/collection/components/text-input/text-input.css +33 -18
- package/dist/collection/components/text-input/text-input.js +446 -389
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +82 -0
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +336 -0
- package/dist/collection/index.js +16 -0
- package/dist/collection/utils/locale.utils.js +118 -21
- package/dist/collection/utils/tooltipIcon.svg +4 -4
- 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 +20007 -16663
- package/dist/esm/general-input.entry.js +67 -40
- package/dist/esm/general-input.js +14 -11
- package/dist/esm/index-514fda47.js +1287 -0
- package/dist/esm/index.js +16 -1
- package/dist/esm/loader.js +7 -13
- package/dist/esm/locale.utils-21605050.js +125 -0
- package/dist/esm/toggle-checkbox-input.entry.js +87 -0
- package/dist/esm/tooltipIcon-0a5a06a2.js +3 -0
- package/dist/general-input/general-input.esm.js +1 -1
- package/dist/general-input/index.esm.js +1 -0
- package/dist/general-input/p-03e81c11.js +2 -0
- package/dist/general-input/p-2dccd0bf.js +1 -0
- package/dist/general-input/p-34939f14.entry.js +1 -0
- package/dist/general-input/p-b32f19c2.entry.js +5430 -0
- package/dist/general-input/p-c43bb82e.entry.js +1 -0
- package/dist/general-input/p-cfe9eb31.js +1 -0
- package/dist/general-input/p-e1255160.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/general-input/.stencil/packages/stencil/general-input/stencil.config.d.ts +2 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/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 +69 -67
- package/dist/types/components/checkbox-input/checkbox-input.d.ts +61 -60
- package/dist/types/components/date-input/date-input.d.ts +79 -65
- package/dist/types/components/email-input/email-input.d.ts +76 -73
- package/dist/types/components/general-input/general-input.d.ts +72 -57
- package/dist/types/components/general-input/index.d.ts +1 -0
- package/dist/types/components/number-input/number-input.d.ts +70 -66
- package/dist/types/components/password-input/password-input.d.ts +87 -75
- package/dist/types/components/radio-input/radio-input.d.ts +55 -55
- package/dist/types/components/select-input/select-input.d.ts +78 -77
- package/dist/types/components/tel-input/tel-input.d.ts +84 -80
- package/dist/types/components/text-input/text-input.d.ts +81 -78
- package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +67 -0
- package/dist/types/components.d.ts +331 -25
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/dist/types/utils/locale.utils.d.ts +13 -1
- package/dist/types/utils/types.d.ts +58 -47
- 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 +9 -9
- package/dist/cjs/index-1768513d.js +0 -1286
- 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 -5793
- package/dist/components/checkbox-input.d.ts +0 -11
- package/dist/components/checkbox-input.js +0 -6
- package/dist/components/checkbox-input2.js +0 -127
- package/dist/components/date-input.d.ts +0 -11
- package/dist/components/date-input.js +0 -6
- package/dist/components/date-input2.js +0 -5182
- package/dist/components/email-input.d.ts +0 -11
- package/dist/components/email-input.js +0 -6
- package/dist/components/email-input2.js +0 -150
- package/dist/components/field-mixin.js +0 -12712
- package/dist/components/general-input.d.ts +0 -11
- package/dist/components/general-input.js +0 -140
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/components/input-field-shared-styles.js +0 -1067
- package/dist/components/number-input.d.ts +0 -11
- package/dist/components/number-input.js +0 -6
- package/dist/components/number-input2.js +0 -139
- package/dist/components/password-input.d.ts +0 -11
- package/dist/components/password-input.js +0 -6
- package/dist/components/password-input2.js +0 -879
- package/dist/components/pattern-mixin.js +0 -85
- package/dist/components/radio-input.d.ts +0 -11
- package/dist/components/radio-input.js +0 -6
- package/dist/components/radio-input2.js +0 -115
- package/dist/components/select-input.d.ts +0 -11
- package/dist/components/select-input.js +0 -6
- package/dist/components/select-input2.js +0 -166
- package/dist/components/tel-input.d.ts +0 -11
- package/dist/components/tel-input.js +0 -6
- package/dist/components/tel-input2.js +0 -178
- package/dist/components/text-input.d.ts +0 -11
- package/dist/components/text-input.js +0 -6
- package/dist/components/text-input2.js +0 -157
- package/dist/components/tooltipIcon.js +0 -30
- package/dist/components/vaadin-button.js +0 -461
- package/dist/components/vaadin-combo-box.js +0 -4329
- package/dist/components/virtual-keyboard-controller.js +0 -2693
- package/dist/esm/index-7e24a6f1.js +0 -1259
- 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-61d76ec3.entry.js +0 -1
- package/dist/general-input/p-a79eb0a3.entry.js +0 -4413
- package/dist/general-input/p-fb647820.js +0 -1
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -2
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { A as Debouncer, B 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,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface RadioInput extends Components.RadioInput, HTMLElement {}
|
|
4
|
-
export const RadioInput: {
|
|
5
|
-
prototype: RadioInput;
|
|
6
|
-
new (): RadioInput;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
|
-
|
|
4
|
-
const radioInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.radio__fieldset{border:none;position:relative}.radio__wrapper{display:flex;gap:5px}.radio__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.radio__tooltip-icon{position:absolute;right:0;bottom:10px}.radio__tooltip{position:absolute;bottom:35px;right:10px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.radio__tooltip.visible{opacity:1}";
|
|
5
|
-
|
|
6
|
-
const RadioInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.__registerHost();
|
|
10
|
-
this.__attachShadow();
|
|
11
|
-
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
12
|
-
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
13
|
-
/**
|
|
14
|
-
* Client custom styling via inline style
|
|
15
|
-
*/
|
|
16
|
-
this.clientStyling = '';
|
|
17
|
-
this.limitStylingAppends = false;
|
|
18
|
-
this.showTooltip = false;
|
|
19
|
-
this.setClientStyling = () => {
|
|
20
|
-
let sheet = document.createElement('style');
|
|
21
|
-
sheet.innerHTML = this.clientStyling;
|
|
22
|
-
this.stylingContainer.prepend(sheet);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
validityChanged() {
|
|
26
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
27
|
-
if (this.emitValue == true) {
|
|
28
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
emitValueHandler(newValue) {
|
|
32
|
-
if (newValue == true && this.isValid) {
|
|
33
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
valueHandler(inputValueEvent) {
|
|
37
|
-
this.sendInputValue.emit(inputValueEvent);
|
|
38
|
-
}
|
|
39
|
-
validityStateHandler(inputStateEvent) {
|
|
40
|
-
this.sendValidityState.emit(inputStateEvent);
|
|
41
|
-
}
|
|
42
|
-
handleClickOutside(event) {
|
|
43
|
-
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
44
|
-
return;
|
|
45
|
-
if (event.composedPath()[0] !== this.tooltipReference)
|
|
46
|
-
this.showTooltip = false;
|
|
47
|
-
}
|
|
48
|
-
componentDidRender() {
|
|
49
|
-
// start custom styling area
|
|
50
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
51
|
-
if (this.clientStyling)
|
|
52
|
-
this.setClientStyling();
|
|
53
|
-
this.limitStylingAppends = true;
|
|
54
|
-
}
|
|
55
|
-
// end custom styling area
|
|
56
|
-
}
|
|
57
|
-
handleClick(event) {
|
|
58
|
-
this.value = event.target.value;
|
|
59
|
-
this.isValid = this.setValidity();
|
|
60
|
-
this.errorMessage = this.setErrorMessage();
|
|
61
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
62
|
-
this.emitValueHandler(true);
|
|
63
|
-
}
|
|
64
|
-
setValidity() {
|
|
65
|
-
return this.inputReference.validity.valid;
|
|
66
|
-
}
|
|
67
|
-
setErrorMessage() {
|
|
68
|
-
if (this.inputReference.validity.valueMissing) {
|
|
69
|
-
return translate('requiredError', this.language);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
renderTooltip() {
|
|
73
|
-
if (this.showTooltip) {
|
|
74
|
-
return (h("div", { class: `radio__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
render() {
|
|
79
|
-
return h("fieldset", { class: 'radio__fieldset', ref: el => this.stylingContainer = el }, h("legend", { class: 'radio__legend' }, this.displayName, ":"), this.optionsGroup.map(option => h("div", { class: 'radio__wrapper' }, h("input", { type: "radio", class: 'radio__input', id: `${option.label}__input`, ref: (el) => this.inputReference = el, value: option.value, name: this.name, required: this.validation.mandatory, onClick: (e) => this.handleClick(e) }), h("label", { htmlFor: `${option.label}__input` }, option.label))), h("small", { class: 'radio__error-message' }, this.errorMessage), this.tooltip &&
|
|
80
|
-
h("img", { class: 'radio__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
|
|
81
|
-
}
|
|
82
|
-
static get watchers() { return {
|
|
83
|
-
"isValid": ["validityChanged"],
|
|
84
|
-
"emitValue": ["emitValueHandler"]
|
|
85
|
-
}; }
|
|
86
|
-
static get style() { return radioInputCss; }
|
|
87
|
-
}, [1, "radio-input", {
|
|
88
|
-
"name": [513],
|
|
89
|
-
"displayName": [513, "display-name"],
|
|
90
|
-
"optionsGroup": [16],
|
|
91
|
-
"validation": [16],
|
|
92
|
-
"tooltip": [513],
|
|
93
|
-
"language": [513],
|
|
94
|
-
"emitValue": [516, "emit-value"],
|
|
95
|
-
"clientStyling": [513, "client-styling"],
|
|
96
|
-
"errorMessage": [32],
|
|
97
|
-
"isValid": [32],
|
|
98
|
-
"limitStylingAppends": [32],
|
|
99
|
-
"showTooltip": [32]
|
|
100
|
-
}, [[4, "click", "handleClickOutside"]]]);
|
|
101
|
-
function defineCustomElement() {
|
|
102
|
-
if (typeof customElements === "undefined") {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const components = ["radio-input"];
|
|
106
|
-
components.forEach(tagName => { switch (tagName) {
|
|
107
|
-
case "radio-input":
|
|
108
|
-
if (!customElements.get(tagName)) {
|
|
109
|
-
customElements.define(tagName, RadioInput);
|
|
110
|
-
}
|
|
111
|
-
break;
|
|
112
|
-
} });
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export { RadioInput as R, defineCustomElement as d };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface SelectInput extends Components.SelectInput, HTMLElement {}
|
|
4
|
-
export const SelectInput: {
|
|
5
|
-
prototype: SelectInput;
|
|
6
|
-
new (): SelectInput;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
|
-
import './input-field-shared-styles.js';
|
|
4
|
-
import './vaadin-combo-box.js';
|
|
5
|
-
|
|
6
|
-
const selectInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.select{font-family:\"Roboto\";font-style:normal}.select__wrapper{position:relative;width:100%}.select__wrapper--flex{display:flex;gap:5px}.select__wrapper--relative{position:relative}.select__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F}.select__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;margin-left:2px}.select__input{border:none;width:inherit;position:relative}.select__input[focused]::part(input-field){border-color:#3E3E3E}.select__input[invalid]::part(input-field){border-color:#cc0000b3}.select__input vaadin-date-picker-overlay-content>vaadin-button{color:#1F1F1F}.select__input vaadin-month-calendar::part(selected date){background-color:red}.select__input::part(input-field){border-radius:4px;background-color:#FFFFFF;border:2px solid #DEE1EE;color:#2A2E3F;border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px}.select__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.select__tooltip-icon{width:16px;height:auto}.select__tooltip{position:absolute;top:0;left:20px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.select__tooltip.visible{opacity:1}";
|
|
7
|
-
|
|
8
|
-
const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this.__registerHost();
|
|
12
|
-
this.__attachShadow();
|
|
13
|
-
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
14
|
-
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
15
|
-
/**
|
|
16
|
-
* Default value for the input.
|
|
17
|
-
*/
|
|
18
|
-
this.defaultValue = '';
|
|
19
|
-
/**
|
|
20
|
-
* Options of the input.
|
|
21
|
-
*/
|
|
22
|
-
this.options = [];
|
|
23
|
-
/**
|
|
24
|
-
* Client custom styling via inline style
|
|
25
|
-
*/
|
|
26
|
-
this.clientStyling = '';
|
|
27
|
-
this.limitStylingAppends = false;
|
|
28
|
-
this.showTooltip = false;
|
|
29
|
-
this.setClientStyling = () => {
|
|
30
|
-
let sheet = document.createElement('style');
|
|
31
|
-
sheet.innerHTML = this.clientStyling;
|
|
32
|
-
this.stylingContainer.prepend(sheet);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
validityChanged() {
|
|
36
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
37
|
-
if (this.emitValue == true) {
|
|
38
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
validityStateHandler(inputStateEvent) {
|
|
42
|
-
this.sendValidityState.emit(inputStateEvent);
|
|
43
|
-
}
|
|
44
|
-
emitValueHandler(newValue) {
|
|
45
|
-
if (newValue == true && this.isValid) {
|
|
46
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
valueHandler(inputValueEvent) {
|
|
50
|
-
this.sendInputValue.emit(inputValueEvent);
|
|
51
|
-
}
|
|
52
|
-
handleClickOutside(event) {
|
|
53
|
-
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
54
|
-
return;
|
|
55
|
-
if (event.composedPath()[0] !== this.tooltipReference)
|
|
56
|
-
this.showTooltip = false;
|
|
57
|
-
}
|
|
58
|
-
connectedCallback() {
|
|
59
|
-
this.displayedOptions = this.options;
|
|
60
|
-
}
|
|
61
|
-
componentWillLoad() {
|
|
62
|
-
if (this.action && !this.options.length) {
|
|
63
|
-
if (this.action.split(" ")[0] == 'GET') {
|
|
64
|
-
return this.getOptions().then((options) => {
|
|
65
|
-
this.displayedOptions = options.countries.map(option => {
|
|
66
|
-
return { label: option.Name, value: option.Alpha2Code };
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
componentDidRender() {
|
|
73
|
-
// start custom styling area
|
|
74
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
75
|
-
if (this.clientStyling)
|
|
76
|
-
this.setClientStyling();
|
|
77
|
-
this.limitStylingAppends = true;
|
|
78
|
-
}
|
|
79
|
-
// end custom styling area
|
|
80
|
-
}
|
|
81
|
-
componentDidLoad() {
|
|
82
|
-
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
83
|
-
if (this.defaultValue) {
|
|
84
|
-
this.value = this.defaultValue;
|
|
85
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
getOptions() {
|
|
89
|
-
// TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
|
|
90
|
-
const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/countries");
|
|
91
|
-
return new Promise((resolve, reject) => {
|
|
92
|
-
fetch(url.href)
|
|
93
|
-
.then((res) => res.json())
|
|
94
|
-
.then((options) => {
|
|
95
|
-
resolve(options);
|
|
96
|
-
}).catch((err) => {
|
|
97
|
-
console.error(err);
|
|
98
|
-
reject(err);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
handleChange(event) {
|
|
103
|
-
this.value = event.target.value;
|
|
104
|
-
this.errorMessage = this.setErrorMessage();
|
|
105
|
-
this.isValid = this.setValidity();
|
|
106
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
107
|
-
this.emitValueHandler(true);
|
|
108
|
-
}
|
|
109
|
-
setValidity() {
|
|
110
|
-
return this.inputReference.validity.valid;
|
|
111
|
-
}
|
|
112
|
-
setErrorMessage() {
|
|
113
|
-
if (this.inputReference.validity.valueMissing) {
|
|
114
|
-
return translate('requiredError', this.language);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
renderTooltip() {
|
|
118
|
-
if (this.showTooltip) {
|
|
119
|
-
return (h("div", { class: `select__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
render() {
|
|
124
|
-
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'select__input--invalid';
|
|
125
|
-
return h("div", { class: 'select__wrapper', ref: el => this.stylingContainer = el }, h("div", { class: 'select__wrapper--flex' }, h("label", { class: 'select__label', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), h("div", { class: 'select__wrapper--relative' }, this.tooltip &&
|
|
126
|
-
h("img", { class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, items: this.displayedOptions, onChange: (e) => this.handleChange(e) }), h("small", { class: 'select__error-message' }, this.errorMessage));
|
|
127
|
-
}
|
|
128
|
-
get element() { return this; }
|
|
129
|
-
static get watchers() { return {
|
|
130
|
-
"isValid": ["validityChanged"],
|
|
131
|
-
"emitValue": ["emitValueHandler"]
|
|
132
|
-
}; }
|
|
133
|
-
static get style() { return selectInputCss; }
|
|
134
|
-
}, [1, "select-input", {
|
|
135
|
-
"name": [513],
|
|
136
|
-
"displayName": [513, "display-name"],
|
|
137
|
-
"placeholder": [513],
|
|
138
|
-
"action": [513],
|
|
139
|
-
"defaultValue": [513, "default-value"],
|
|
140
|
-
"autofilled": [516],
|
|
141
|
-
"tooltip": [513],
|
|
142
|
-
"options": [16],
|
|
143
|
-
"validation": [16],
|
|
144
|
-
"language": [513],
|
|
145
|
-
"emitValue": [516, "emit-value"],
|
|
146
|
-
"clientStyling": [513, "client-styling"],
|
|
147
|
-
"errorMessage": [32],
|
|
148
|
-
"isValid": [32],
|
|
149
|
-
"limitStylingAppends": [32],
|
|
150
|
-
"showTooltip": [32]
|
|
151
|
-
}, [[4, "click", "handleClickOutside"]]]);
|
|
152
|
-
function defineCustomElement() {
|
|
153
|
-
if (typeof customElements === "undefined") {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
const components = ["select-input"];
|
|
157
|
-
components.forEach(tagName => { switch (tagName) {
|
|
158
|
-
case "select-input":
|
|
159
|
-
if (!customElements.get(tagName)) {
|
|
160
|
-
customElements.define(tagName, SelectInput);
|
|
161
|
-
}
|
|
162
|
-
break;
|
|
163
|
-
} });
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export { SelectInput as S, defineCustomElement as d };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface TelInput extends Components.TelInput, HTMLElement {}
|
|
4
|
-
export const TelInput: {
|
|
5
|
-
prototype: TelInput;
|
|
6
|
-
new (): TelInput;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
|
-
import './input-field-shared-styles.js';
|
|
4
|
-
import './vaadin-combo-box.js';
|
|
5
|
-
|
|
6
|
-
const telInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.tel{font-family:\"Roboto\";font-style:normal}.tel__wrapper{position:relative;width:100%}.tel__wrapper--flex{width:inherit;display:flex;align-items:stretch;border-radius:4px;border:2px solid #DEE1EE}.tel__wrapper--flex:focus-within{border:2px solid #3E3E3E}.tel__wrapper--flex--invalid{border:2px solid #cc0000b3}.tel__wrapper--flex-label{display:flex;gap:5px}.tel__wrapper--flex--relative{position:relative}.tel__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F}.tel__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;margin-left:2px}.tel__prefix{width:120px}.tel__prefix[focus]{outline:none}.tel__prefix::part(input-field){border-radius:0 4px 4px 0;background-color:#DEE1EE;color:#1F1F1F;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px}.tel__input{border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;border:none;padding:8px 20px;width:inherit;position:relative;-moz-appearance:textfield;}.tel__input:focus{outline:none}.tel__input::-webkit-outer-spin-button,.tel__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.tel__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.tel__tooltip-icon{width:16px;height:auto}.tel__tooltip{position:absolute;top:0;left:20px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.tel__tooltip.visible{opacity:1}";
|
|
7
|
-
|
|
8
|
-
const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this.__registerHost();
|
|
12
|
-
this.__attachShadow();
|
|
13
|
-
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
14
|
-
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
15
|
-
/**
|
|
16
|
-
* Client custom styling via inline style
|
|
17
|
-
*/
|
|
18
|
-
this.clientStyling = '';
|
|
19
|
-
this.limitStylingAppends = false;
|
|
20
|
-
this.showTooltip = false;
|
|
21
|
-
this.validationPattern = '';
|
|
22
|
-
this.setClientStyling = () => {
|
|
23
|
-
let sheet = document.createElement('style');
|
|
24
|
-
sheet.innerHTML = this.clientStyling;
|
|
25
|
-
this.stylingContainer.prepend(sheet);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
validityChanged() {
|
|
29
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
30
|
-
if (this.emitValue == true) {
|
|
31
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
validityStateHandler(inputStateEvent) {
|
|
35
|
-
this.sendValidityState.emit(inputStateEvent);
|
|
36
|
-
}
|
|
37
|
-
emitValueHandler(newValue) {
|
|
38
|
-
if (newValue == true && this.isValid) {
|
|
39
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
valueHandler(inputValueEvent) {
|
|
43
|
-
this.sendInputValue.emit(inputValueEvent);
|
|
44
|
-
}
|
|
45
|
-
handleClickOutside(event) {
|
|
46
|
-
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
47
|
-
return;
|
|
48
|
-
if (event.composedPath()[0] !== this.tooltipReference)
|
|
49
|
-
this.showTooltip = false;
|
|
50
|
-
}
|
|
51
|
-
connectedCallback() {
|
|
52
|
-
this.validationPattern = this.setPattern();
|
|
53
|
-
if (this.defaultValue) {
|
|
54
|
-
this.prefixValue = this.defaultValue.split('|')[0];
|
|
55
|
-
this.phoneValue = this.defaultValue.split('|')[1];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
componentWillLoad() {
|
|
59
|
-
if (this.action) {
|
|
60
|
-
if (this.action.split(" ")[0] == 'GET') {
|
|
61
|
-
return this.getPhoneCodes().then((options) => {
|
|
62
|
-
this.phoneCodesOptions = options.phoneCodes.map(code => {
|
|
63
|
-
return { label: code.Prefix, value: code.Prefix };
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
componentDidRender() {
|
|
70
|
-
// start custom styling area
|
|
71
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
72
|
-
if (this.clientStyling)
|
|
73
|
-
this.setClientStyling();
|
|
74
|
-
this.limitStylingAppends = true;
|
|
75
|
-
}
|
|
76
|
-
// end custom styling area
|
|
77
|
-
if (this.defaultValue) {
|
|
78
|
-
this.value = `${this.prefixValue}|${this.phoneValue}`;
|
|
79
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
getPhoneCodes() {
|
|
83
|
-
// TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
|
|
84
|
-
const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes");
|
|
85
|
-
return new Promise((resolve, reject) => {
|
|
86
|
-
fetch(url.href)
|
|
87
|
-
.then((res) => res.json())
|
|
88
|
-
.then((options) => {
|
|
89
|
-
resolve(options);
|
|
90
|
-
}).catch((err) => {
|
|
91
|
-
console.error(err);
|
|
92
|
-
reject(err);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
handleInput(event) {
|
|
97
|
-
this.phoneValue = event.target.value;
|
|
98
|
-
this.value = `${this.prefixValue}|${this.phoneValue}`;
|
|
99
|
-
this.errorMessage = this.setErrorMessage();
|
|
100
|
-
this.isValid = this.setValidity();
|
|
101
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
102
|
-
this.emitValueHandler(true);
|
|
103
|
-
}
|
|
104
|
-
handlePrefixInput(event) {
|
|
105
|
-
this.prefixValue = event.target.value;
|
|
106
|
-
this.value = `${this.prefixValue}|${this.phoneValue}`;
|
|
107
|
-
this.emitValueHandler(true);
|
|
108
|
-
}
|
|
109
|
-
setValidity() {
|
|
110
|
-
return this.inputReference.validity.valid;
|
|
111
|
-
}
|
|
112
|
-
setPattern() {
|
|
113
|
-
var _a, _b;
|
|
114
|
-
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
115
|
-
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
setErrorMessage() {
|
|
119
|
-
var _a;
|
|
120
|
-
if (this.inputReference.validity.patternMismatch) {
|
|
121
|
-
return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
|
|
122
|
-
}
|
|
123
|
-
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
124
|
-
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
125
|
-
}
|
|
126
|
-
if (this.inputReference.validity.valueMissing) {
|
|
127
|
-
return translate('requiredError', this.language);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
renderTooltip() {
|
|
131
|
-
if (this.showTooltip) {
|
|
132
|
-
return (h("div", { class: `tel__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
133
|
-
}
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
render() {
|
|
137
|
-
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__wrapper--flex--invalid';
|
|
138
|
-
return h("div", { class: 'tel__wrapper', ref: el => this.stylingContainer = el }, h("div", { class: 'tel__wrapper--flex-label' }, h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'tel__wrapper--relative' }, this.tooltip &&
|
|
139
|
-
h("img", { class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("div", { class: `tel__wrapper--flex ${invalidClass}` }, h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onChange: (e) => this.handlePrefixInput(e) }), h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: this.phoneValue, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onBlur: (e) => this.handleInput(e) })), h("small", { class: 'tel__error-message' }, this.errorMessage));
|
|
140
|
-
}
|
|
141
|
-
static get watchers() { return {
|
|
142
|
-
"isValid": ["validityChanged"],
|
|
143
|
-
"emitValue": ["emitValueHandler"]
|
|
144
|
-
}; }
|
|
145
|
-
static get style() { return telInputCss; }
|
|
146
|
-
}, [1, "tel-input", {
|
|
147
|
-
"name": [513],
|
|
148
|
-
"displayName": [513, "display-name"],
|
|
149
|
-
"placeholder": [513],
|
|
150
|
-
"showLabels": [516, "show-labels"],
|
|
151
|
-
"action": [513],
|
|
152
|
-
"validation": [16],
|
|
153
|
-
"defaultValue": [513, "default-value"],
|
|
154
|
-
"autofilled": [516],
|
|
155
|
-
"tooltip": [513],
|
|
156
|
-
"language": [513],
|
|
157
|
-
"emitValue": [516, "emit-value"],
|
|
158
|
-
"clientStyling": [513, "client-styling"],
|
|
159
|
-
"isValid": [32],
|
|
160
|
-
"errorMessage": [32],
|
|
161
|
-
"limitStylingAppends": [32],
|
|
162
|
-
"showTooltip": [32]
|
|
163
|
-
}, [[4, "click", "handleClickOutside"]]]);
|
|
164
|
-
function defineCustomElement() {
|
|
165
|
-
if (typeof customElements === "undefined") {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const components = ["tel-input"];
|
|
169
|
-
components.forEach(tagName => { switch (tagName) {
|
|
170
|
-
case "tel-input":
|
|
171
|
-
if (!customElements.get(tagName)) {
|
|
172
|
-
customElements.define(tagName, TelInput);
|
|
173
|
-
}
|
|
174
|
-
break;
|
|
175
|
-
} });
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export { TelInput as T, defineCustomElement as d };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface TextInput extends Components.TextInput, HTMLElement {}
|
|
4
|
-
export const TextInput: {
|
|
5
|
-
prototype: TextInput;
|
|
6
|
-
new (): TextInput;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|