@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,199 @@
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 textInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.text{font-family:\"Roboto\";font-style:normal}.text__wrapper{position:relative;width:100%;display:flex;flex-direction:column;gap:5px;height:100%}.text__wrapper--autofilled{pointer-events:none}.text__wrapper--autofilled .text__label{color:var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000))}.text__wrapper--autofilled .text__input::part(input-field){color:var(--emfe-w-color-black, #000000)}.text__wrapper--flex{display:flex;gap:5px}.text__wrapper--relative{position:relative}.text__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))}.text__label--required::after{content:\"*\";font-family:inherit;color:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));margin-left:2px}.text__input{font-family:inherit;width:100%;height:44px;border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);background-color:var(--emfe-w-color-white, #FFFFFF);color:var(--emfe-w-color-black, #000000);border-radius:5px;font-size:16px;font-weight:300;line-height:1.5;padding:5px 15px}.text__input:focus{border:1px solid var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C))}.text__input--invalid{border:1px solid var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.text__input::placeholder{color:var(--emfe-w-color-gray-150, #828282)}.text__error-message{position:absolute;top:calc(100% + 5px);left:0;color:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.text__tooltip-icon{width:16px;height:auto}.text__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}.text__tooltip.visible{opacity:1}";
5
+
6
+ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
11
+ this.sendValidityState = createEvent(this, "sendValidityState", 7);
12
+ this.sendInputValue = createEvent(this, "sendInputValue", 7);
13
+ /**
14
+ * Default value for the input.
15
+ */
16
+ this.defaultValue = '';
17
+ /**
18
+ * Client custom styling via inline style
19
+ */
20
+ this.clientStyling = '';
21
+ this.errorMessage = '';
22
+ this.limitStylingAppends = false;
23
+ this.showTooltip = false;
24
+ this.value = '';
25
+ this.validationPattern = '';
26
+ this.duplicateInputValue = null;
27
+ this.touched = false;
28
+ this.handleInput = (event) => {
29
+ this.value = event.target.value;
30
+ this.touched = true;
31
+ if (this.debounceTime) {
32
+ clearTimeout(this.debounceTime);
33
+ }
34
+ this.debounceTime = setTimeout(() => {
35
+ this.isValid = this.setValidity();
36
+ this.errorMessage = this.setErrorMessage();
37
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
38
+ this.emitValueHandler(true);
39
+ }, 500);
40
+ };
41
+ this.handleBlur = (event) => {
42
+ this.value = event.target.value;
43
+ this.touched = true;
44
+ this.isValid = this.setValidity();
45
+ this.errorMessage = this.setErrorMessage();
46
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
47
+ };
48
+ this.setClientStyling = () => {
49
+ let sheet = document.createElement('style');
50
+ sheet.innerHTML = this.clientStyling;
51
+ this.stylingContainer.prepend(sheet);
52
+ };
53
+ }
54
+ validityChanged() {
55
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
56
+ if (this.emitValue == true) {
57
+ this.valueHandler({ name: this.name, value: this.value });
58
+ }
59
+ }
60
+ emitValueHandler(newValue) {
61
+ if (newValue == true && this.isValid) {
62
+ this.valueHandler({ name: this.name, value: this.value });
63
+ }
64
+ }
65
+ validityStateHandler(inputStateEvent) {
66
+ this.sendValidityState.emit(inputStateEvent);
67
+ }
68
+ valueHandler(inputValueEvent) {
69
+ this.sendInputValue.emit(inputValueEvent);
70
+ }
71
+ handleClickOutside(event) {
72
+ if (event.composedPath()[0] === this.tooltipIconReference)
73
+ return;
74
+ if (event.composedPath()[0] !== this.tooltipReference)
75
+ this.showTooltip = false;
76
+ }
77
+ valueChangedHandler(event) {
78
+ if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
79
+ this.duplicateInputValue = event.detail.value;
80
+ if (this.touched) {
81
+ this.isValid = this.setValidity();
82
+ this.errorMessage = this.setErrorMessage();
83
+ }
84
+ }
85
+ if (this.name === event.detail.name + 'Duplicate'
86
+ && this.name.replace('Duplicate', '') === event.detail.name
87
+ && this.touched === true) {
88
+ this.isValid = this.setValidity();
89
+ this.errorMessage = this.setErrorMessage();
90
+ }
91
+ }
92
+ connectedCallback() {
93
+ this.validationPattern = this.setPattern();
94
+ }
95
+ componentDidRender() {
96
+ // start custom styling area
97
+ if (!this.limitStylingAppends && this.stylingContainer) {
98
+ if (this.clientStyling)
99
+ this.setClientStyling();
100
+ this.limitStylingAppends = true;
101
+ }
102
+ // end custom styling area
103
+ }
104
+ componentDidLoad() {
105
+ if (this.defaultValue) {
106
+ this.value = this.defaultValue;
107
+ this.valueHandler({ name: this.name, value: this.value });
108
+ if (this.isDuplicateInput) {
109
+ this.touched = true;
110
+ }
111
+ }
112
+ this.isValid = this.setValidity();
113
+ }
114
+ setValidity() {
115
+ var _a;
116
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
117
+ return false;
118
+ }
119
+ else {
120
+ return (_a = this.inputReference) === null || _a === void 0 ? void 0 : _a.validity.valid;
121
+ }
122
+ }
123
+ setPattern() {
124
+ var _a, _b;
125
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
126
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
127
+ }
128
+ }
129
+ setErrorMessage() {
130
+ var _a, _b, _c, _d;
131
+ if (this.inputReference.validity.patternMismatch) {
132
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
133
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
134
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
135
+ }
136
+ if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
137
+ return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
138
+ }
139
+ if (this.inputReference.validity.valueMissing) {
140
+ return translate('requiredError', this.language);
141
+ }
142
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
143
+ const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
144
+ const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
145
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
146
+ }
147
+ }
148
+ renderTooltip() {
149
+ if (this.showTooltip) {
150
+ return (h("div", { class: `text__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
151
+ }
152
+ return null;
153
+ }
154
+ render() {
155
+ let invalidClass = '';
156
+ if (this.touched) {
157
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
158
+ }
159
+ return h("div", { class: `text__wrapper ${this.name}__input ${this.autofilled ? 'text__wrapper--autofilled' : ''}`, ref: el => this.stylingContainer = el }, h("div", { class: 'text__wrapper--flex' }, h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'text__wrapper--relative' }, this.tooltip &&
160
+ h("img", { class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { name: this.name, id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.placeholder}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { class: 'text__error-message' }, this.errorMessage));
161
+ }
162
+ static get watchers() { return {
163
+ "isValid": ["validityChanged"],
164
+ "emitValue": ["emitValueHandler"]
165
+ }; }
166
+ static get style() { return textInputCss; }
167
+ }, [1, "text-input", {
168
+ "name": [513],
169
+ "displayName": [513, "display-name"],
170
+ "placeholder": [513],
171
+ "validation": [16],
172
+ "defaultValue": [513, "default-value"],
173
+ "autofilled": [516],
174
+ "tooltip": [513],
175
+ "language": [513],
176
+ "checkValidity": [516, "check-validity"],
177
+ "emitValue": [516, "emit-value"],
178
+ "isDuplicateInput": [516, "is-duplicate-input"],
179
+ "clientStyling": [513, "client-styling"],
180
+ "isValid": [32],
181
+ "errorMessage": [32],
182
+ "limitStylingAppends": [32],
183
+ "showTooltip": [32]
184
+ }, [[4, "click", "handleClickOutside"], [16, "sendInputValue", "valueChangedHandler"]]]);
185
+ function defineCustomElement() {
186
+ if (typeof customElements === "undefined") {
187
+ return;
188
+ }
189
+ const components = ["text-input"];
190
+ components.forEach(tagName => { switch (tagName) {
191
+ case "text-input":
192
+ if (!customElements.get(tagName)) {
193
+ customElements.define(tagName, TextInput);
194
+ }
195
+ break;
196
+ } });
197
+ }
198
+
199
+ export { TextInput as T, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface ToggleCheckboxInput extends Components.ToggleCheckboxInput, HTMLElement {}
4
+ export const ToggleCheckboxInput: {
5
+ prototype: ToggleCheckboxInput;
6
+ new (): ToggleCheckboxInput;
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 ToggleCheckboxInput$1, a as defineCustomElement$1 } from './general-input2.js';
2
+
3
+ const ToggleCheckboxInput = ToggleCheckboxInput$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { ToggleCheckboxInput, defineCustomElement };
@@ -0,0 +1,127 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const TRANSLATIONS = {
3
+ "en": {
4
+ "dateError": 'The selected date should be between {min} and {max}',
5
+ "dateError2": 'The selected date is not within the accepted range',
6
+ "numberLengthError": 'The number should be between {min} and {max}',
7
+ "lengthError": `The length should be between {minLength} and {maxLength}`,
8
+ "requiredError": 'This input is required.',
9
+ "invalidOriginalPasswordError": "Initial password field does not validate all criteria.",
10
+ "passwordStrength": "Password strength",
11
+ "passwordStrengthWeak": "is not adequate",
12
+ "passwordStrengthStrong": "is adequate",
13
+ "SpecialCharactersNotAllowed": 'Should not contain special characters',
14
+ "InvalidEmailFormat": "Invalid email format.",
15
+ "EmailNotMatching": "Emails not matching!",
16
+ "PasswordNotMatching": "Passwords not matching",
17
+ "MustIncludeNumber": "include a number",
18
+ "MustContainCapital": "contain capital letters",
19
+ "MustIncludePunctation": "punctuation",
20
+ "OnlyNumbers": "Should contains only numbers."
21
+ },
22
+ "hu": {
23
+ "dateError": 'A választott dátumnak {min} és {max} között kell lennie',
24
+ "numberLengthError": 'A számnak {min} és {max} között kell lennie',
25
+ "lengthError": `A hossznak {minLength} és {maxLength} között kell lennie`,
26
+ "requiredError": 'Ez a beviteli mező kötelező.',
27
+ "invalidOriginalPasswordError": "Initial password field does not validate all criteria.",
28
+ "passwordStrength": "Jelszó erőssége",
29
+ "passwordStrengthWeak": "nem megfelelő",
30
+ "passwordStrengthStrong": "megfelelő",
31
+ "SpecialCharactersNotAllowed": 'Nem tartalmazhat speciális karaktereket',
32
+ "InvalidEmailFormat": "Érvénytelen e-mail formátum.",
33
+ "EmailNotMatching": "Az e-mailek nem egyeznek!",
34
+ "PasswordNotMatching": "A jelszavak nem egyeznek",
35
+ "MustIncludeNumber": "tartalmaznia kell egy számot",
36
+ "MustContainCapital": "nagybetűket kell tartalmaznia",
37
+ "MustIncludePunctation": "írásjelet",
38
+ "OnlyNumbers": "Csak számokat kell tartalmaznia."
39
+ },
40
+ "hr": {
41
+ "dateError": 'Odabrani datum treba biti između {min} i {max}',
42
+ "dateError2": 'Odabrani datum nije unutar prihvaćenog raspona',
43
+ "numberLengthError": 'Broj bi trebao biti između {min} i {max}',
44
+ "lengthError": `Duljina bi trebala biti između {minLength} i {maxLength}`,
45
+ "requiredError": 'Ovaj unos je obavezan.',
46
+ "invalidOriginalPasswordError": "Polje početne lozinke ne potvrđuje sve kriterije",
47
+ "passwordStrength": "Jačina zaporke",
48
+ "passwordStrengthWeak": "nije adekvatno",
49
+ "passwordStrengthStrong": "je adekvatan",
50
+ "SpecialCharactersNotAllowed": 'Ne smije sadržavati posebne znakove',
51
+ "InvalidEmailFormat": "Nevažeći format e-maila",
52
+ "EmailNotMatching": "E-mailovi se ne podudaraju!",
53
+ "PasswordNotMatching": "Lozinke se ne podudaraju",
54
+ "MustIncludeNumber": "uključiti broj",
55
+ "MustContainCapital": "sadrže velika slova",
56
+ "MustIncludePunctation": "interpunkcija",
57
+ "OnlyNumbers": "Treba sadržavati samo brojeve."
58
+ },
59
+ 'pt-br': {
60
+ "dateError": "A data selecionada deve estar entre {min} e {max}",
61
+ "dateError2": "A data selecionada não está dentro de um intervalo válido",
62
+ "numberLengthError": "O número deve estar entre {min} e {max}",
63
+ "lengthError": "O comprimento deve estar entre {minLength} e {maxLength}",
64
+ "requiredError": "Este campo é obrigatório",
65
+ "invalidOriginalPasswordError": "O campo de senha inicial não faz parte dos critérios válidos",
66
+ "PasswordStrength": "Força da senha",
67
+ "PasswordStrengthWeak": "Não é adequado",
68
+ "PasswordStrengthStrong": "é apropriado",
69
+ "SpecialCharactersNotAllowed": "Não deve conter caracteres especiais",
70
+ "InvalidEmailFormat": "Formato de email inválido",
71
+ "EmailNotMatching": "E-mail não corresponde",
72
+ "PasswordNotMatching": "Senha não corresponde",
73
+ "MustIncludeNumber": "inclui um número",
74
+ "MustContainCapital": "contém letras maiúsculas",
75
+ "MustIncludePunctation": "pontuação",
76
+ "OnlyNumbers": "Deve conter apenas números"
77
+ },
78
+ 'es-mx': {
79
+ "dateError": "La fecha seleccionada debe ser entre {min} y {max}",
80
+ "dateError2": "La fecha seleccionada no está dentro de un rango válido",
81
+ "numberLengthError": "El número debe ser entre {min} y {max}",
82
+ "lengthError": "La longitud deber ser entre {minLength} y {maxLength}",
83
+ "requiredError": "Este campo es requerido",
84
+ "invalidOriginalPasswordError": "El campo de contraseña inicial no es parte del criterio válido",
85
+ "PasswordStrength": "La fortaleza de la contraseña",
86
+ "PasswordStrengthWeak": "no es adecuada",
87
+ "PasswordStrengthStrong": "es adecuada",
88
+ "SpecialCharactersNotAllowed": "No debe contener caracteres especiales",
89
+ "InvalidEmailFormat": "Formato inválido de correo",
90
+ "EmailNotMatching": "El correo electrónico no coincide",
91
+ "PasswordNotMatching": "La contraseña no coincide",
92
+ "MustIncludeNumber": "incluye un número",
93
+ "MustContainCapital": "contiene mayúsculas",
94
+ "MustIncludePunctation": "puntuación",
95
+ "OnlyNumbers": "Solo debe contener números"
96
+ }
97
+ };
98
+ const translate = (key, customLang, values) => {
99
+ const lang = customLang;
100
+ let translation = TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
101
+ if (values !== undefined) {
102
+ for (const [key, value] of Object.entries(values.values)) {
103
+ const regex = new RegExp(`{${key}}`, 'g');
104
+ translation = translation.replace(regex, value);
105
+ }
106
+ }
107
+ return translation;
108
+ };
109
+ const getTranslations = (url) => {
110
+ // fetch url, get the data, replace the TRANSLATIONS content
111
+ return new Promise((resolve) => {
112
+ fetch(url)
113
+ .then((res) => res.json())
114
+ .then((data) => {
115
+ Object.keys(data).forEach((item) => {
116
+ for (let key in data[item]) {
117
+ TRANSLATIONS[item][key] = data[item][key];
118
+ }
119
+ });
120
+ resolve(true);
121
+ });
122
+ });
123
+ };
124
+
125
+ const tooltipIconSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iNiIgY3k9IjYiIHI9IjUuNSIgc3Ryb2tlPSIjOTc5Nzk3Ii8+CjxyZWN0IHg9IjUiIHk9IjUiIHdpZHRoPSIyIiBoZWlnaHQ9IjUiIGZpbGw9IiM5Nzk3OTciLz4KPGNpcmNsZSBjeD0iNiIgY3k9IjMiIHI9IjEiIGZpbGw9IiM5Nzk3OTciLz4KPC9zdmc+Cg==';
126
+
127
+ export { tooltipIconSvg as a, getTranslations as g, translate as t };