@everymatrix/general-input 1.10.2 → 1.15.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 (96) hide show
  1. package/dist/cjs/checkbox-group-input_10.cjs.entry.js +35539 -0
  2. package/dist/cjs/general-input.cjs.entry.js +34 -13
  3. package/dist/cjs/general-input.cjs.js +2 -2
  4. package/dist/cjs/{index-64a5cb7f.js → index-132a0774.js} +119 -6
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/locale.utils-7665b010.js +71 -0
  7. package/dist/cjs/toggle-checkbox-input.cjs.entry.js +85 -0
  8. package/dist/cjs/tooltipIcon-092a795f.js +5 -0
  9. package/dist/collection/collection-manifest.json +3 -1
  10. package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +62 -0
  11. package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +366 -0
  12. package/dist/collection/components/checkbox-input/checkbox-input.css +47 -1
  13. package/dist/collection/components/checkbox-input/checkbox-input.js +143 -16
  14. package/dist/collection/components/date-input/date-input.css +64 -30
  15. package/dist/collection/components/date-input/date-input.js +194 -13
  16. package/dist/collection/components/email-input/email-input.css +63 -28
  17. package/dist/collection/components/email-input/email-input.js +197 -21
  18. package/dist/collection/components/general-input/general-input.js +163 -21
  19. package/dist/collection/components/number-input/number-input.css +65 -30
  20. package/dist/collection/components/number-input/number-input.js +174 -19
  21. package/dist/collection/components/password-input/password-input.css +120 -29
  22. package/dist/collection/components/password-input/password-input.js +341 -25
  23. package/dist/collection/components/radio-input/radio-input.css +22 -1
  24. package/dist/collection/components/radio-input/radio-input.js +89 -10
  25. package/dist/collection/components/select-input/select-input.css +75 -22
  26. package/dist/collection/components/select-input/select-input.js +180 -37
  27. package/dist/collection/components/tel-input/tel-input.css +91 -33
  28. package/dist/collection/components/tel-input/tel-input.js +202 -24
  29. package/dist/collection/components/text-input/text-input.css +63 -28
  30. package/dist/collection/components/text-input/text-input.js +208 -39
  31. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +76 -0
  32. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +324 -0
  33. package/dist/collection/utils/locale.utils.js +52 -13
  34. package/dist/collection/utils/tooltipIcon.svg +5 -0
  35. package/dist/components/active-mixin.js +975 -0
  36. package/dist/components/checkbox-group-input.d.ts +11 -0
  37. package/dist/components/checkbox-group-input.js +6 -0
  38. package/dist/components/checkbox-group-input2.js +1125 -0
  39. package/dist/components/checkbox-input2.js +62 -12
  40. package/dist/components/date-input2.js +10247 -15
  41. package/dist/components/email-input2.js +98 -21
  42. package/dist/components/field-mixin.js +12712 -0
  43. package/dist/components/general-input.js +1 -118
  44. package/dist/components/general-input2.js +331 -0
  45. package/dist/components/input-field-shared-styles.js +1114 -0
  46. package/dist/components/number-input2.js +92 -16
  47. package/dist/components/password-input2.js +924 -24
  48. package/dist/components/pattern-mixin.js +85 -0
  49. package/dist/components/radio-input2.js +45 -11
  50. package/dist/components/select-input2.js +87 -27
  51. package/dist/components/tel-input2.js +122 -22
  52. package/dist/components/text-input2.js +120 -34
  53. package/dist/components/toggle-checkbox-input.d.ts +11 -0
  54. package/dist/components/toggle-checkbox-input.js +6 -0
  55. package/dist/components/tooltipIcon.js +70 -0
  56. package/dist/components/vaadin-button.js +461 -0
  57. package/dist/components/vaadin-combo-box.js +4329 -0
  58. package/dist/components/virtual-keyboard-controller.js +2658 -0
  59. package/dist/esm/checkbox-group-input_10.entry.js +35526 -0
  60. package/dist/esm/general-input.entry.js +34 -13
  61. package/dist/esm/general-input.js +2 -2
  62. package/dist/esm/{index-df80f936.js → index-db76d5b5.js} +118 -7
  63. package/dist/esm/loader.js +2 -2
  64. package/dist/esm/locale.utils-95ea2605.js +68 -0
  65. package/dist/esm/toggle-checkbox-input.entry.js +81 -0
  66. package/dist/esm/tooltipIcon-99c1c7b7.js +3 -0
  67. package/dist/general-input/general-input.esm.js +1 -1
  68. package/dist/general-input/p-0966f523.entry.js +3581 -0
  69. package/dist/general-input/p-916a1319.entry.js +1 -0
  70. package/dist/general-input/p-b408093e.js +1 -0
  71. package/dist/general-input/p-c2d4d6ac.entry.js +1 -0
  72. package/dist/general-input/p-f4f4ccda.js +1 -0
  73. package/dist/general-input/p-f6132f1d.js +1 -0
  74. package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +74 -0
  75. package/dist/types/components/checkbox-input/checkbox-input.d.ts +28 -2
  76. package/dist/types/components/date-input/date-input.d.ts +43 -1
  77. package/dist/types/components/email-input/email-input.d.ts +37 -3
  78. package/dist/types/components/general-input/general-input.d.ts +30 -0
  79. package/dist/types/components/number-input/number-input.d.ts +34 -3
  80. package/dist/types/components/password-input/password-input.d.ts +56 -7
  81. package/dist/types/components/radio-input/radio-input.d.ts +17 -1
  82. package/dist/types/components/select-input/select-input.d.ts +36 -3
  83. package/dist/types/components/tel-input/tel-input.d.ts +40 -5
  84. package/dist/types/components/text-input/text-input.d.ts +84 -0
  85. package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +67 -0
  86. package/dist/types/components.d.ts +568 -9
  87. package/dist/types/utils/locale.utils.d.ts +9 -0
  88. package/dist/types/utils/types.d.ts +41 -9
  89. package/package.json +8 -1
  90. package/dist/cjs/checkbox-input_9.cjs.entry.js +0 -623
  91. package/dist/components/locale.utils.js +0 -29
  92. package/dist/esm/checkbox-input_9.entry.js +0 -611
  93. package/dist/general-input/p-1703fce3.entry.js +0 -1
  94. package/dist/general-input/p-d9f7fa2e.js +0 -1
  95. package/dist/general-input/p-dea0a4ac.entry.js +0 -1
  96. /package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work}/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { t as translate } from './locale.utils.js';
2
+ import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
3
3
 
4
- const emailInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.email__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.email__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.email__label--required::after{content:\"*\";margin-left:5px;color:#666666}.email__input{width:inherit;padding:15px 6px;position:relative;border:none;border-bottom:3px solid #666666;background-color:transparent;color:#666666;font-size:16px;font-family:inherit}.email__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.email__input::placeholder{color:#666666}.email__input--invalid{border-bottom:3px solid #cc0000}.email__input:placeholder-shown+.email__label{opacity:0;visibility:hidden;transform:translateY(0)}.email__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";
4
+ const emailInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.email{font-family:\"Roboto\";font-style:normal}.email__wrapper{position:relative;width:100%}.email__wrapper--autofilled{pointer-events:none}.email__wrapper--autofilled .email__label{color:#979797}.email__wrapper--autofilled .email__input{color:#979797}.email__wrapper--flex{display:flex;gap:5px}.email__wrapper--relative{position:relative}.email__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#2A3841}.email__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.email__input{border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;padding:10px 20px;width:inherit;position:relative;border:2px solid #DEE1EE}.email__input:focus{outline-color:#3E3E3E}.email__input--invalid{border:2px solid #cc0000b3}.email__input::placeholder{color:#979797}.email__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.email__tooltip-icon{width:16px;height:auto}.email__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}.email__tooltip.visible{opacity:1}";
5
5
 
6
6
  const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
7
  constructor() {
@@ -10,7 +10,36 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
10
  this.__attachShadow();
11
11
  this.sendValidityState = createEvent(this, "sendValidityState", 7);
12
12
  this.sendInputValue = createEvent(this, "sendInputValue", 7);
13
+ /**
14
+ * Client custom styling via inline style
15
+ */
16
+ this.clientStyling = '';
17
+ this.limitStylingAppends = false;
18
+ this.showTooltip = false;
13
19
  this.validationPattern = '';
20
+ this.touched = false;
21
+ this.handleInput = (event) => {
22
+ this.value = event.target.value;
23
+ this.touched = true;
24
+ if (this.debounceTime) {
25
+ clearTimeout(this.debounceTime);
26
+ }
27
+ this.debounceTime = setTimeout(() => {
28
+ this.isValid = this.setValidity();
29
+ this.errorMessage = this.setErrorMessage();
30
+ this.emitValueHandler(true);
31
+ }, 500);
32
+ };
33
+ this.handleBlur = () => {
34
+ this.isValid = this.setValidity();
35
+ this.errorMessage = this.setErrorMessage();
36
+ this.touched = true;
37
+ };
38
+ this.setClientStyling = () => {
39
+ let sheet = document.createElement('style');
40
+ sheet.innerHTML = this.clientStyling;
41
+ this.stylingContainer.prepend(sheet);
42
+ };
14
43
  }
15
44
  validityChanged() {
16
45
  this.validityStateHandler({ valid: this.isValid, name: this.name });
@@ -18,39 +47,64 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
18
47
  this.valueHandler({ name: this.name, value: this.value });
19
48
  }
20
49
  }
21
- validityStateHandler(inputStateEvent) {
22
- this.sendValidityState.emit(inputStateEvent);
23
- }
24
50
  emitValueHandler(newValue) {
25
51
  if (newValue == true && this.isValid) {
26
52
  this.valueHandler({ name: this.name, value: this.value });
27
53
  }
28
54
  }
55
+ validityStateHandler(inputStateEvent) {
56
+ this.sendValidityState.emit(inputStateEvent);
57
+ }
29
58
  valueHandler(inputValueEvent) {
30
59
  this.sendInputValue.emit(inputValueEvent);
31
60
  }
61
+ handleClickOutside(event) {
62
+ if (event.composedPath()[0] === this.tooltipIconReference)
63
+ return;
64
+ if (event.composedPath()[0] !== this.tooltipReference)
65
+ this.showTooltip = false;
66
+ }
67
+ valueChangedHandler(event) {
68
+ if (this.isDuplicateInput) {
69
+ if (this.name === event.detail.name + 'Duplicate') {
70
+ this.duplicateInputValue = event.detail.value;
71
+ }
72
+ }
73
+ }
32
74
  connectedCallback() {
33
75
  this.validationPattern = this.setPattern();
34
76
  }
35
- handleInput(event) {
36
- this.value = event.target.value;
37
- this.errorMessage = this.setErrorMessage();
77
+ componentDidRender() {
78
+ // start custom styling area
79
+ if (!this.limitStylingAppends && this.stylingContainer) {
80
+ if (this.clientStyling)
81
+ this.setClientStyling();
82
+ this.limitStylingAppends = true;
83
+ }
84
+ // end custom styling area
85
+ }
86
+ componentDidLoad() {
38
87
  this.isValid = this.setValidity();
39
- this.validityStateHandler({ valid: this.isValid, name: this.name });
40
- this.emitValueHandler(true);
88
+ if (this.defaultValue) {
89
+ this.value = this.defaultValue;
90
+ this.valueHandler({ name: this.name, value: this.value });
91
+ }
41
92
  }
42
93
  setValidity() {
43
94
  return this.inputReference.validity.valid;
44
95
  }
45
96
  setPattern() {
46
- var _a;
97
+ var _a, _b;
47
98
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
48
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
99
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
49
100
  }
50
101
  }
51
102
  setErrorMessage() {
103
+ var _a, _b, _c, _d;
52
104
  if (this.inputReference.validity.patternMismatch) {
53
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
105
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
106
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
107
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
54
108
  }
55
109
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
56
110
  return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -58,9 +112,25 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
58
112
  if (this.inputReference.validity.valueMissing) {
59
113
  return translate('requiredError', this.language);
60
114
  }
115
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
116
+ const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
117
+ const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
118
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
119
+ }
120
+ }
121
+ renderTooltip() {
122
+ if (this.showTooltip) {
123
+ return (h("div", { class: `email__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
124
+ }
125
+ return null;
61
126
  }
62
127
  render() {
63
- return h("div", { class: 'email__wrapper' }, h("input", { id: `${this.name}__input`, type: 'email', class: `email__input`, value: this.defaultValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: (e) => this.handleInput(e) }), h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("small", { class: 'email__error-message' }, this.errorMessage));
128
+ let invalidClass = '';
129
+ if (this.touched) {
130
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
131
+ }
132
+ return h("div", { class: `email__wrapper ${this.autofilled ? 'number__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'email__wrapper--flex' }, h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'email__wrapper--relative' }, this.tooltip &&
133
+ h("img", { class: 'email__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { id: `${this.name}__input`, type: 'email', class: `email__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { class: 'email__error-message' }, this.errorMessage));
64
134
  }
65
135
  static get watchers() { return {
66
136
  "isValid": ["validityChanged"],
@@ -68,15 +138,22 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
68
138
  }; }
69
139
  static get style() { return emailInputCss; }
70
140
  }, [1, "email-input", {
71
- "name": [1],
72
- "displayName": [1, "display-name"],
141
+ "name": [513],
142
+ "displayName": [513, "display-name"],
143
+ "placeholder": [513],
73
144
  "validation": [16],
74
- "defaultValue": [1, "default-value"],
75
- "language": [1],
76
- "emitValue": [4, "emit-value"],
145
+ "defaultValue": [513, "default-value"],
146
+ "autofilled": [516],
147
+ "tooltip": [513],
148
+ "language": [513],
149
+ "emitValue": [516, "emit-value"],
150
+ "isDuplicateInput": [516, "is-duplicate-input"],
151
+ "clientStyling": [513, "client-styling"],
77
152
  "errorMessage": [32],
78
- "isValid": [32]
79
- }]);
153
+ "isValid": [32],
154
+ "limitStylingAppends": [32],
155
+ "showTooltip": [32]
156
+ }, [[4, "click", "handleClickOutside"], [16, "sendInputValue", "valueChangedHandler"]]]);
80
157
  function defineCustomElement() {
81
158
  if (typeof customElements === "undefined") {
82
159
  return;