@everymatrix/general-input 1.32.4 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/cjs/checkbox-group-input_10.cjs.entry.js +36077 -0
  2. package/dist/cjs/general-input.cjs.entry.js +75 -0
  3. package/dist/cjs/general-input.cjs.js +19 -0
  4. package/dist/cjs/index-132a0774.js +1327 -0
  5. package/dist/cjs/index.cjs.js +18 -0
  6. package/dist/cjs/loader.cjs.js +21 -0
  7. package/dist/cjs/locale.utils-cef1d3b6.js +128 -0
  8. package/dist/cjs/toggle-checkbox-input.cjs.entry.js +85 -0
  9. package/dist/cjs/tooltipIcon-092a795f.js +5 -0
  10. package/dist/collection/collection-manifest.json +23 -0
  11. package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +82 -0
  12. package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +366 -0
  13. package/dist/collection/components/checkbox-input/checkbox-input.css +68 -0
  14. package/dist/collection/components/checkbox-input/checkbox-input.js +324 -0
  15. package/dist/collection/components/date-input/date-input.css +101 -0
  16. package/dist/collection/components/date-input/date-input.js +396 -0
  17. package/dist/collection/components/email-input/email-input.css +95 -0
  18. package/dist/collection/components/email-input/email-input.js +403 -0
  19. package/dist/collection/components/general-input/general-input.css +4 -0
  20. package/dist/collection/components/general-input/general-input.js +373 -0
  21. package/dist/collection/components/number-input/number-input.css +102 -0
  22. package/dist/collection/components/number-input/number-input.js +368 -0
  23. package/dist/collection/components/password-input/password-input.css +182 -0
  24. package/dist/collection/components/password-input/password-input.js +527 -0
  25. package/dist/collection/components/radio-input/radio-input.css +43 -0
  26. package/dist/collection/components/radio-input/radio-input.js +297 -0
  27. package/dist/collection/components/select-input/select-input.css +122 -0
  28. package/dist/collection/components/select-input/select-input.js +429 -0
  29. package/dist/collection/components/tel-input/tel-input.css +145 -0
  30. package/dist/collection/components/tel-input/tel-input.js +440 -0
  31. package/dist/collection/components/text-input/text-input.css +98 -0
  32. package/dist/collection/components/text-input/text-input.js +448 -0
  33. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +82 -0
  34. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +324 -0
  35. package/dist/collection/index.js +17 -0
  36. package/dist/collection/utils/locale.utils.js +123 -0
  37. package/dist/collection/utils/tooltipIcon.svg +5 -0
  38. package/dist/collection/utils/types.js +1 -0
  39. package/dist/collection/utils/utils.js +5 -0
  40. package/dist/components/active-mixin.js +975 -0
  41. package/dist/components/checkbox-group-input.d.ts +11 -0
  42. package/dist/components/checkbox-group-input.js +6 -0
  43. package/dist/components/checkbox-group-input2.js +1078 -0
  44. package/dist/components/checkbox-input.d.ts +11 -0
  45. package/dist/components/checkbox-input.js +6 -0
  46. package/dist/components/checkbox-input2.js +129 -0
  47. package/dist/components/date-input.d.ts +11 -0
  48. package/dist/components/date-input.js +6 -0
  49. package/dist/components/date-input2.js +11556 -0
  50. package/dist/components/email-input.d.ts +11 -0
  51. package/dist/components/email-input.js +6 -0
  52. package/dist/components/email-input2.js +171 -0
  53. package/dist/components/field-mixin.js +12426 -0
  54. package/dist/components/general-input.d.ts +11 -0
  55. package/dist/components/general-input.js +6 -0
  56. package/dist/components/general-input2.js +341 -0
  57. package/dist/components/index.d.ts +26 -0
  58. package/dist/components/index.js +18 -0
  59. package/dist/components/input-field-shared-styles.js +1211 -0
  60. package/dist/components/number-input.d.ts +11 -0
  61. package/dist/components/number-input.js +6 -0
  62. package/dist/components/number-input2.js +158 -0
  63. package/dist/components/password-input.d.ts +11 -0
  64. package/dist/components/password-input.js +6 -0
  65. package/dist/components/password-input2.js +1041 -0
  66. package/dist/components/radio-input.d.ts +11 -0
  67. package/dist/components/radio-input.js +6 -0
  68. package/dist/components/radio-input2.js +114 -0
  69. package/dist/components/select-input.d.ts +11 -0
  70. package/dist/components/select-input.js +6 -0
  71. package/dist/components/select-input2.js +183 -0
  72. package/dist/components/tel-input.d.ts +11 -0
  73. package/dist/components/tel-input.js +6 -0
  74. package/dist/components/tel-input2.js +197 -0
  75. package/dist/components/text-input.d.ts +11 -0
  76. package/dist/components/text-input.js +6 -0
  77. package/dist/components/text-input2.js +199 -0
  78. package/dist/components/toggle-checkbox-input.d.ts +11 -0
  79. package/dist/components/toggle-checkbox-input.js +6 -0
  80. package/dist/components/tooltipIcon.js +127 -0
  81. package/dist/components/vaadin-button.js +490 -0
  82. package/dist/components/vaadin-combo-box.js +4512 -0
  83. package/dist/components/virtual-keyboard-controller.js +2001 -0
  84. package/dist/esm/checkbox-group-input_10.entry.js +36064 -0
  85. package/dist/esm/general-input.entry.js +71 -0
  86. package/dist/esm/general-input.js +17 -0
  87. package/dist/esm/index-db76d5b5.js +1299 -0
  88. package/dist/esm/index.js +16 -0
  89. package/dist/esm/loader.js +17 -0
  90. package/dist/esm/locale.utils-de759721.js +125 -0
  91. package/dist/esm/polyfills/core-js.js +11 -0
  92. package/dist/esm/polyfills/css-shim.js +1 -0
  93. package/dist/esm/polyfills/dom.js +79 -0
  94. package/dist/esm/polyfills/es5-html-element.js +1 -0
  95. package/dist/esm/polyfills/index.js +34 -0
  96. package/dist/esm/polyfills/system.js +6 -0
  97. package/dist/esm/toggle-checkbox-input.entry.js +81 -0
  98. package/dist/esm/tooltipIcon-99c1c7b7.js +3 -0
  99. package/dist/general-input/general-input.esm.js +1 -0
  100. package/dist/general-input/index.esm.js +1 -0
  101. package/dist/general-input/p-10efdf3f.js +1 -0
  102. package/dist/general-input/p-613c3e00.entry.js +1 -0
  103. package/dist/general-input/p-660bcdd1.entry.js +1 -0
  104. package/dist/general-input/p-9b6b0396.entry.js +3646 -0
  105. package/dist/general-input/p-b408093e.js +1 -0
  106. package/dist/general-input/p-f4f4ccda.js +1 -0
  107. package/dist/index.cjs.js +1 -0
  108. package/dist/index.js +1 -0
  109. package/dist/stencil.config.js +22 -0
  110. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +2 -0
  111. package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +74 -0
  112. package/dist/types/components/checkbox-input/checkbox-input.d.ts +65 -0
  113. package/dist/types/components/date-input/date-input.d.ts +84 -0
  114. package/dist/types/components/email-input/email-input.d.ts +80 -0
  115. package/dist/types/components/general-input/general-input.d.ts +75 -0
  116. package/dist/types/components/number-input/number-input.d.ts +74 -0
  117. package/dist/types/components/password-input/password-input.d.ts +91 -0
  118. package/dist/types/components/radio-input/radio-input.d.ts +59 -0
  119. package/dist/types/components/select-input/select-input.d.ts +83 -0
  120. package/dist/types/components/tel-input/tel-input.d.ts +89 -0
  121. package/dist/types/components/text-input/text-input.d.ts +84 -0
  122. package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +67 -0
  123. package/dist/types/components.d.ts +1268 -0
  124. package/dist/types/index.d.ts +1 -0
  125. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  126. package/dist/types/utils/locale.utils.d.ts +17 -0
  127. package/dist/types/utils/types.d.ts +87 -0
  128. package/dist/types/utils/utils.d.ts +1 -0
  129. package/loader/cdn.js +3 -0
  130. package/loader/index.cjs.js +3 -0
  131. package/loader/index.d.ts +12 -0
  132. package/loader/index.es2017.js +3 -0
  133. package/loader/index.js +4 -0
  134. package/loader/package.json +10 -0
  135. package/package.json +2 -3
  136. package/LICENSE +0 -21
@@ -0,0 +1,11 @@
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;
@@ -0,0 +1,6 @@
1
+ import { R as RadioInput$1, d as defineCustomElement$1 } from './radio-input2.js';
2
+
3
+ const RadioInput = RadioInput$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { RadioInput, defineCustomElement };
@@ -0,0 +1,114 @@
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:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.radio__tooltip-icon{position:absolute;right:0;bottom:10px}.radio__tooltip{position:absolute;bottom:35px;right:10px;background-color:var(--emfe-w-color-white, #FFFFFF);border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));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.emitValueHandler(true);
62
+ }
63
+ setValidity() {
64
+ return this.inputReference.validity.valid;
65
+ }
66
+ setErrorMessage() {
67
+ if (this.inputReference.validity.valueMissing) {
68
+ return translate('requiredError', this.language);
69
+ }
70
+ }
71
+ renderTooltip() {
72
+ if (this.showTooltip) {
73
+ return (h("div", { class: `radio__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
74
+ }
75
+ return null;
76
+ }
77
+ render() {
78
+ return h("fieldset", { class: `radio__fieldset ${this.name}__input`, 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 &&
79
+ h("img", { class: 'radio__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
80
+ }
81
+ static get watchers() { return {
82
+ "isValid": ["validityChanged"],
83
+ "emitValue": ["emitValueHandler"]
84
+ }; }
85
+ static get style() { return radioInputCss; }
86
+ }, [1, "radio-input", {
87
+ "name": [513],
88
+ "displayName": [513, "display-name"],
89
+ "optionsGroup": [16],
90
+ "validation": [16],
91
+ "tooltip": [513],
92
+ "language": [513],
93
+ "emitValue": [516, "emit-value"],
94
+ "clientStyling": [513, "client-styling"],
95
+ "errorMessage": [32],
96
+ "isValid": [32],
97
+ "limitStylingAppends": [32],
98
+ "showTooltip": [32]
99
+ }, [[4, "click", "handleClickOutside"]]]);
100
+ function defineCustomElement() {
101
+ if (typeof customElements === "undefined") {
102
+ return;
103
+ }
104
+ const components = ["radio-input"];
105
+ components.forEach(tagName => { switch (tagName) {
106
+ case "radio-input":
107
+ if (!customElements.get(tagName)) {
108
+ customElements.define(tagName, RadioInput);
109
+ }
110
+ break;
111
+ } });
112
+ }
113
+
114
+ export { RadioInput as R, defineCustomElement as d };
@@ -0,0 +1,11 @@
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;
@@ -0,0 +1,6 @@
1
+ import { S as SelectInput$1, d as defineCustomElement$1 } from './select-input2.js';
2
+
3
+ const SelectInput = SelectInput$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SelectInput, defineCustomElement };
@@ -0,0 +1,183 @@
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}:host{height:100%}vaadin-combo-box>input{background-color:var(--emfe-w-color-white, #FFFFFF);color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));font-weight:300;font-size:16px;-webkit-font-smoothing:initial;}.select{font-family:\"Roboto\";font-style:normal}.select__wrapper{position:relative;width:100%;display:flex;flex-direction:column;gap:5px}.select__wrapper--autofilled{pointer-events:none}.select__wrapper--autofilled .select__label{color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.select__wrapper--autofilled .select__input::part(input-field){color:var(--emfe-w-color-black, #000000)}.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:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.select__label--required::after{content:\"*\";font-family:inherit;color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));margin-left:2px}.select__input{border:none;width:inherit;position:relative}.select__input[focused]::part(input-field){border-color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C))}.select__input[invalid]::part(input-field){border:1px solid var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.select__input vaadin-date-picker-overlay-content>vaadin-button{color:var(--emfe-w-color-black, #000000)}.select__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);font-family:inherit;font-style:normal;font-size:16px;font-weight:300;line-height:1.5;padding:0;height:44px}.select__input::part(toggle-button){position:relative;right:10px}.select__input>input{padding:5px 15px}.select__error-message{position:absolute;top:calc(100% + 5px);left:0;color:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.select__tooltip-icon{width:16px;height:auto}.select__tooltip{position:absolute;top:0;left:20px;background-color:var(--emfe-w-color-white, #FFFFFF);border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));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.touched = false;
30
+ this.handleChange = (event) => {
31
+ this.touched = true;
32
+ const selectedValue = event.target.value;
33
+ // Find the original option based on case-insensitive comparison
34
+ const originalOption = this.options.find(option => option.value.toLowerCase() === selectedValue.toLowerCase());
35
+ if (originalOption) {
36
+ this.value = originalOption.value;
37
+ }
38
+ else {
39
+ this.value = selectedValue;
40
+ }
41
+ this.isValid = this.setValidity();
42
+ this.errorMessage = this.setErrorMessage();
43
+ this.emitValueHandler(true);
44
+ };
45
+ this.setClientStyling = () => {
46
+ let sheet = document.createElement('style');
47
+ sheet.innerHTML = this.clientStyling;
48
+ this.stylingContainer.prepend(sheet);
49
+ };
50
+ }
51
+ validityChanged() {
52
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
53
+ if (this.emitValue == true) {
54
+ this.valueHandler({ name: this.name, value: this.value });
55
+ }
56
+ }
57
+ validityStateHandler(inputStateEvent) {
58
+ this.sendValidityState.emit(inputStateEvent);
59
+ }
60
+ emitValueHandler(newValue) {
61
+ if (newValue == true && this.isValid) {
62
+ this.valueHandler({ name: this.name, value: this.value });
63
+ }
64
+ }
65
+ valueHandler(inputValueEvent) {
66
+ this.sendInputValue.emit(inputValueEvent);
67
+ }
68
+ handleClickOutside(event) {
69
+ if (event.composedPath()[0] === this.tooltipIconReference)
70
+ return;
71
+ if (event.composedPath()[0] !== this.tooltipReference)
72
+ this.showTooltip = false;
73
+ }
74
+ connectedCallback() {
75
+ this.displayedOptions = this.options.map(option => ({
76
+ label: option.label,
77
+ value: option.value.toUpperCase()
78
+ }));
79
+ }
80
+ componentWillLoad() {
81
+ if (this.action && !this.options.length) {
82
+ if (this.action.split(" ")[0] == 'GET') {
83
+ const endpoint = this.action.split(" ")[1];
84
+ return this.getOptions(endpoint).then((options) => {
85
+ const firstKey = Object.keys(options)[0];
86
+ this.displayedOptions = options[firstKey].map(option => {
87
+ return { label: option.Name, value: option.Alpha2Code };
88
+ });
89
+ });
90
+ }
91
+ }
92
+ }
93
+ componentDidRender() {
94
+ // start custom styling area
95
+ if (!this.limitStylingAppends && this.stylingContainer) {
96
+ if (this.clientStyling)
97
+ this.setClientStyling();
98
+ this.limitStylingAppends = true;
99
+ }
100
+ // end custom styling area
101
+ }
102
+ componentDidLoad() {
103
+ this.inputReference = this.element.shadowRoot.querySelector('input');
104
+ this.isValid = this.setValidity();
105
+ if (this.defaultValue) {
106
+ this.value = this.defaultValue.toUpperCase();
107
+ this.valueHandler({ name: this.name, value: this.value });
108
+ }
109
+ }
110
+ getOptions(endpoint) {
111
+ const url = new URL(endpoint);
112
+ return new Promise((resolve, reject) => {
113
+ fetch(url.href)
114
+ .then((res) => res.json())
115
+ .then((options) => {
116
+ resolve(options);
117
+ }).catch((err) => {
118
+ console.error(err);
119
+ reject(err);
120
+ });
121
+ });
122
+ }
123
+ setValidity() {
124
+ return this.inputReference.validity.valid;
125
+ }
126
+ setErrorMessage() {
127
+ if (this.inputReference.validity.valueMissing) {
128
+ return translate('requiredError', this.language);
129
+ }
130
+ }
131
+ renderTooltip() {
132
+ if (this.showTooltip) {
133
+ return (h("div", { class: `select__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
134
+ }
135
+ return null;
136
+ }
137
+ render() {
138
+ let invalidClass = '';
139
+ if (this.touched) {
140
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
141
+ }
142
+ return h("div", { class: `select__wrapper ${this.autofilled ? 'select__wrapper--autofilled' : ''} ${this.name}__input`, 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 &&
143
+ 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} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleChange }), h("small", { class: 'select__error-message' }, this.errorMessage));
144
+ }
145
+ get element() { return this; }
146
+ static get watchers() { return {
147
+ "isValid": ["validityChanged"],
148
+ "emitValue": ["emitValueHandler"]
149
+ }; }
150
+ static get style() { return selectInputCss; }
151
+ }, [1, "select-input", {
152
+ "name": [513],
153
+ "displayName": [513, "display-name"],
154
+ "placeholder": [513],
155
+ "action": [513],
156
+ "defaultValue": [513, "default-value"],
157
+ "autofilled": [516],
158
+ "tooltip": [513],
159
+ "options": [16],
160
+ "validation": [16],
161
+ "language": [513],
162
+ "emitValue": [516, "emit-value"],
163
+ "clientStyling": [513, "client-styling"],
164
+ "errorMessage": [32],
165
+ "isValid": [32],
166
+ "limitStylingAppends": [32],
167
+ "showTooltip": [32]
168
+ }, [[4, "click", "handleClickOutside"]]]);
169
+ function defineCustomElement() {
170
+ if (typeof customElements === "undefined") {
171
+ return;
172
+ }
173
+ const components = ["select-input"];
174
+ components.forEach(tagName => { switch (tagName) {
175
+ case "select-input":
176
+ if (!customElements.get(tagName)) {
177
+ customElements.define(tagName, SelectInput);
178
+ }
179
+ break;
180
+ } });
181
+ }
182
+
183
+ export { SelectInput as S, defineCustomElement as d };
@@ -0,0 +1,11 @@
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;
@@ -0,0 +1,6 @@
1
+ import { T as TelInput$1, d as defineCustomElement$1 } from './tel-input2.js';
2
+
3
+ const TelInput = TelInput$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { TelInput, defineCustomElement };
@@ -0,0 +1,197 @@
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%;display:flex;flex-direction:column;gap:5px}.tel__wrapper--autofilled{pointer-events:none}.tel__wrapper--autofilled .tel__label{color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.tel__wrapper--autofilled .tel__input::part(input-field){color:var(--emfe-w-color-black, #000000)}.tel__wrapper--flex{width:inherit;display:flex;align-items:center;border-radius:4px;border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);background-color:var(--emfe-w-color-white, #FFFFFF);overflow:hidden}.tel__wrapper--flex:focus-within{border-color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C))}.tel__wrapper--flex--invalid{border:1px solid var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.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:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.tel__label--required::after{content:\"*\";font-family:inherit;color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));margin-left:2px}.tel__prefix{--vaadin-field-default-width:90px}.tel__prefix[focus]{outline:none}.tel__prefix::part(input-field){border-radius:0 5px 5px 0;background-color:var(--emfe-w-color-white, #FFFFFF);color:var(--emfe-w-color-black, #000000);font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:1.5;border:none;border-right:2px solid #DDE0EE;border-image-source:linear-gradient(to bottom, rgba(221, 224, 238, 0) 25%, #dde0ee 25%, #dde0ee 75%, rgba(221, 224, 238, 0) 75%);border-image-slice:1;border-image-repeat:round}.tel__prefix::part(input-field):hover{background-color:var(--emfe-w-color-white, #FFFFFF)}.tel__prefix::part(toggle-button){color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.tel__input{font-family:inherit;border-radius:5px;width:100%;color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));background-color:var(--emfe-w-color-white, #FFFFFF);border:none;width:inherit;position:relative;font-size:16px;font-weight:300;line-height:1.5;padding:5px 15px;height:42px;-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__input::placeholder{color:var(--emfe-w-color-gray-150, #979797)}.tel__error-message{position:absolute;top:calc(100% + 5px);left:0;color:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.tel__tooltip-icon{width:16px;height:auto}.tel__tooltip{position:absolute;top:0;left:20px;background-color:var(--emfe-w-color-white, #FFFFFF);border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));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.touched = false;
23
+ this.handleInput = (event) => {
24
+ this.phoneValue = event.target.value;
25
+ this.value = { prefix: this.prefixValue, phone: this.phoneValue };
26
+ this.touched = true;
27
+ if (this.debounceTime) {
28
+ clearTimeout(this.debounceTime);
29
+ }
30
+ this.debounceTime = setTimeout(() => {
31
+ this.isValid = this.setValidity();
32
+ this.errorMessage = this.setErrorMessage();
33
+ this.emitValueHandler(true);
34
+ }, 500);
35
+ };
36
+ this.handleBlur = () => {
37
+ this.isValid = this.setValidity();
38
+ this.touched = true;
39
+ this.errorMessage = this.setErrorMessage();
40
+ };
41
+ this.setClientStyling = () => {
42
+ let sheet = document.createElement('style');
43
+ sheet.innerHTML = this.clientStyling;
44
+ this.stylingContainer.prepend(sheet);
45
+ };
46
+ }
47
+ validityChanged() {
48
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
49
+ if (this.emitValue == true) {
50
+ this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
51
+ }
52
+ }
53
+ validityStateHandler(inputStateEvent) {
54
+ this.sendValidityState.emit(inputStateEvent);
55
+ }
56
+ emitValueHandler(newValue) {
57
+ if (newValue == true && this.isValid) {
58
+ this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
59
+ }
60
+ }
61
+ valueHandler(inputValueEvent) {
62
+ this.sendInputValue.emit(inputValueEvent);
63
+ }
64
+ handleClickOutside(event) {
65
+ if (event.composedPath()[0] === this.tooltipIconReference)
66
+ return;
67
+ if (event.composedPath()[0] !== this.tooltipReference)
68
+ this.showTooltip = false;
69
+ }
70
+ connectedCallback() {
71
+ this.validationPattern = this.setPattern();
72
+ if (this.defaultValue) {
73
+ this.prefixValue = this.defaultValue.prefix ? this.defaultValue.prefix : this.defaultValue;
74
+ this.phoneValue = this.defaultValue.phone || null;
75
+ }
76
+ }
77
+ componentWillLoad() {
78
+ if (this.action) {
79
+ if (this.action.split(" ")[0] == 'GET') {
80
+ const endpoint = this.action.split(" ")[1];
81
+ return this.getPhoneCodes(endpoint).then((options) => {
82
+ this.phoneCodesOptions = options.phoneCodes.map(code => {
83
+ return { label: code.Prefix, value: code.Prefix };
84
+ });
85
+ });
86
+ }
87
+ }
88
+ }
89
+ componentDidRender() {
90
+ // start custom styling area
91
+ if (!this.limitStylingAppends && this.stylingContainer) {
92
+ if (this.clientStyling)
93
+ this.setClientStyling();
94
+ this.limitStylingAppends = true;
95
+ }
96
+ // end custom styling area
97
+ }
98
+ componentDidLoad() {
99
+ this.isValid = this.setValidity();
100
+ if (this.defaultValue) {
101
+ this.value = this.defaultValue;
102
+ this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
103
+ }
104
+ }
105
+ getPhoneCodes(endpoint) {
106
+ const url = new URL(endpoint);
107
+ return new Promise((resolve, reject) => {
108
+ fetch(url.href)
109
+ .then((res) => res.json())
110
+ .then((options) => {
111
+ resolve(options);
112
+ }).catch((err) => {
113
+ console.error(err);
114
+ reject(err);
115
+ });
116
+ });
117
+ }
118
+ handlePrefixInput(event) {
119
+ this.prefixValue = event.target.value;
120
+ this.value = { prefix: this.prefixValue, phone: this.phoneValue };
121
+ this.emitValueHandler(true);
122
+ }
123
+ setValidity() {
124
+ return this.inputReference.validity.valid;
125
+ }
126
+ setPattern() {
127
+ var _a, _b;
128
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
129
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
130
+ }
131
+ }
132
+ setErrorMessage() {
133
+ var _a, _b;
134
+ if (this.inputReference.validity.patternMismatch) {
135
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
136
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
137
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
138
+ }
139
+ if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
140
+ return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
141
+ }
142
+ if (this.inputReference.validity.valueMissing) {
143
+ return translate('requiredError', this.language);
144
+ }
145
+ }
146
+ renderTooltip() {
147
+ if (this.showTooltip) {
148
+ return (h("div", { class: `tel__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
149
+ }
150
+ return null;
151
+ }
152
+ render() {
153
+ let invalidClass = '';
154
+ if (this.touched) {
155
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
156
+ }
157
+ return h("div", { class: `tel__wrapper ${this.autofilled ? 'tel__wrapper--autofilled' : ''} ${this.name}__input`, 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 &&
158
+ 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}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onInput: this.handleInput, onBlur: this.handleBlur })), h("small", { class: 'tel__error-message' }, this.errorMessage));
159
+ }
160
+ static get watchers() { return {
161
+ "isValid": ["validityChanged"],
162
+ "emitValue": ["emitValueHandler"]
163
+ }; }
164
+ static get style() { return telInputCss; }
165
+ }, [1, "tel-input", {
166
+ "name": [513],
167
+ "displayName": [513, "display-name"],
168
+ "placeholder": [513],
169
+ "showLabels": [516, "show-labels"],
170
+ "action": [513],
171
+ "validation": [16],
172
+ "defaultValue": [520, "default-value"],
173
+ "autofilled": [516],
174
+ "tooltip": [513],
175
+ "language": [513],
176
+ "emitValue": [516, "emit-value"],
177
+ "clientStyling": [513, "client-styling"],
178
+ "isValid": [32],
179
+ "errorMessage": [32],
180
+ "limitStylingAppends": [32],
181
+ "showTooltip": [32]
182
+ }, [[4, "click", "handleClickOutside"]]]);
183
+ function defineCustomElement() {
184
+ if (typeof customElements === "undefined") {
185
+ return;
186
+ }
187
+ const components = ["tel-input"];
188
+ components.forEach(tagName => { switch (tagName) {
189
+ case "tel-input":
190
+ if (!customElements.get(tagName)) {
191
+ customElements.define(tagName, TelInput);
192
+ }
193
+ break;
194
+ } });
195
+ }
196
+
197
+ export { TelInput as T, defineCustomElement as d };
@@ -0,0 +1,11 @@
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;
@@ -0,0 +1,6 @@
1
+ import { T as TextInput$1, d as defineCustomElement$1 } from './text-input2.js';
2
+
3
+ const TextInput = TextInput$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { TextInput, defineCustomElement };