@everymatrix/general-input 1.10.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 (106) hide show
  1. package/dist/cjs/checkbox-input_9.cjs.entry.js +686 -0
  2. package/dist/cjs/general-input.cjs.entry.js +45 -0
  3. package/dist/cjs/general-input.cjs.js +19 -0
  4. package/dist/cjs/index-64a5cb7f.js +1214 -0
  5. package/dist/cjs/index.cjs.js +2 -0
  6. package/dist/cjs/loader.cjs.js +21 -0
  7. package/dist/collection/collection-manifest.json +21 -0
  8. package/dist/collection/components/checkbox-input/checkbox-input.css +20 -0
  9. package/dist/collection/components/checkbox-input/checkbox-input.js +196 -0
  10. package/dist/collection/components/date-input/date-input.css +60 -0
  11. package/dist/collection/components/date-input/date-input.js +242 -0
  12. package/dist/collection/components/email-input/email-input.css +60 -0
  13. package/dist/collection/components/email-input/email-input.js +259 -0
  14. package/dist/collection/components/general-input/general-input.css +3 -0
  15. package/dist/collection/components/general-input/general-input.js +204 -0
  16. package/dist/collection/components/number-input/number-input.css +67 -0
  17. package/dist/collection/components/number-input/number-input.js +245 -0
  18. package/dist/collection/components/password-input/password-input.css +60 -0
  19. package/dist/collection/components/password-input/password-input.js +210 -0
  20. package/dist/collection/components/radio-input/radio-input.css +22 -0
  21. package/dist/collection/components/radio-input/radio-input.js +245 -0
  22. package/dist/collection/components/select-input/select-input.css +49 -0
  23. package/dist/collection/components/select-input/select-input.js +308 -0
  24. package/dist/collection/components/tel-input/tel-input.css +67 -0
  25. package/dist/collection/components/tel-input/tel-input.js +294 -0
  26. package/dist/collection/components/text-input/text-input.css +60 -0
  27. package/dist/collection/components/text-input/text-input.js +278 -0
  28. package/dist/collection/index.js +1 -0
  29. package/dist/collection/utils/locale.utils.js +27 -0
  30. package/dist/collection/utils/types.js +1 -0
  31. package/dist/collection/utils/utils.js +5 -0
  32. package/dist/components/checkbox-input.d.ts +11 -0
  33. package/dist/components/checkbox-input.js +6 -0
  34. package/dist/components/checkbox-input2.js +78 -0
  35. package/dist/components/date-input.d.ts +11 -0
  36. package/dist/components/date-input.js +6 -0
  37. package/dist/components/date-input2.js +90 -0
  38. package/dist/components/email-input.d.ts +11 -0
  39. package/dist/components/email-input.js +6 -0
  40. package/dist/components/email-input2.js +108 -0
  41. package/dist/components/general-input.d.ts +11 -0
  42. package/dist/components/general-input.js +123 -0
  43. package/dist/components/index.d.ts +26 -0
  44. package/dist/components/index.js +1 -0
  45. package/dist/components/locale.utils.js +29 -0
  46. package/dist/components/number-input.d.ts +11 -0
  47. package/dist/components/number-input.js +6 -0
  48. package/dist/components/number-input2.js +96 -0
  49. package/dist/components/password-input.d.ts +11 -0
  50. package/dist/components/password-input.js +6 -0
  51. package/dist/components/password-input2.js +93 -0
  52. package/dist/components/radio-input.d.ts +11 -0
  53. package/dist/components/radio-input.js +6 -0
  54. package/dist/components/radio-input2.js +89 -0
  55. package/dist/components/select-input.d.ts +11 -0
  56. package/dist/components/select-input.js +6 -0
  57. package/dist/components/select-input2.js +127 -0
  58. package/dist/components/tel-input.d.ts +11 -0
  59. package/dist/components/tel-input.js +6 -0
  60. package/dist/components/tel-input2.js +111 -0
  61. package/dist/components/text-input.d.ts +11 -0
  62. package/dist/components/text-input.js +6 -0
  63. package/dist/components/text-input2.js +112 -0
  64. package/dist/esm/checkbox-input_9.entry.js +674 -0
  65. package/dist/esm/general-input.entry.js +41 -0
  66. package/dist/esm/general-input.js +17 -0
  67. package/dist/esm/index-df80f936.js +1188 -0
  68. package/dist/esm/index.js +1 -0
  69. package/dist/esm/loader.js +17 -0
  70. package/dist/esm/polyfills/core-js.js +11 -0
  71. package/dist/esm/polyfills/css-shim.js +1 -0
  72. package/dist/esm/polyfills/dom.js +79 -0
  73. package/dist/esm/polyfills/es5-html-element.js +1 -0
  74. package/dist/esm/polyfills/index.js +34 -0
  75. package/dist/esm/polyfills/system.js +6 -0
  76. package/dist/general-input/general-input.esm.js +1 -0
  77. package/dist/general-input/index.esm.js +0 -0
  78. package/dist/general-input/p-c9e79656.entry.js +1 -0
  79. package/dist/general-input/p-d9f7fa2e.js +1 -0
  80. package/dist/general-input/p-dea0a4ac.entry.js +1 -0
  81. package/dist/index.cjs.js +1 -0
  82. package/dist/index.js +1 -0
  83. package/dist/stencil.config.js +22 -0
  84. package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +2 -0
  85. package/dist/types/components/checkbox-input/checkbox-input.d.ts +39 -0
  86. package/dist/types/components/date-input/date-input.d.ts +47 -0
  87. package/dist/types/components/email-input/email-input.d.ts +51 -0
  88. package/dist/types/components/general-input/general-input.d.ts +40 -0
  89. package/dist/types/components/number-input/number-input.d.ts +48 -0
  90. package/dist/types/components/password-input/password-input.d.ts +42 -0
  91. package/dist/types/components/radio-input/radio-input.d.ts +48 -0
  92. package/dist/types/components/select-input/select-input.d.ts +55 -0
  93. package/dist/types/components/tel-input/tel-input.d.ts +59 -0
  94. package/dist/types/components.d.ts +749 -0
  95. package/dist/types/index.d.ts +1 -0
  96. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  97. package/dist/types/utils/locale.utils.d.ts +5 -0
  98. package/dist/types/utils/types.d.ts +55 -0
  99. package/dist/types/utils/utils.d.ts +1 -0
  100. package/loader/cdn.js +3 -0
  101. package/loader/index.cjs.js +3 -0
  102. package/loader/index.d.ts +12 -0
  103. package/loader/index.es2017.js +3 -0
  104. package/loader/index.js +4 -0
  105. package/loader/package.json +10 -0
  106. package/package.json +19 -0
@@ -0,0 +1,245 @@
1
+ import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ export class NumberInput {
4
+ checkValidityHandler(newValue) {
5
+ if (newValue == true) {
6
+ this.isValid = this.setValidity();
7
+ this.errorMessage = this.setErrorMessage();
8
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
9
+ }
10
+ }
11
+ validityChanged() {
12
+ if (this.checkValidity == true) {
13
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
14
+ }
15
+ if (this.emitValue == true) {
16
+ this.valueHandler({ name: this.name, value: this.value });
17
+ }
18
+ }
19
+ validityStateHandler(inputStateEvent) {
20
+ this.sendValidityState.emit(inputStateEvent);
21
+ }
22
+ emitValueHandler(newValue) {
23
+ if (newValue == true && this.isValid) {
24
+ this.valueHandler({ name: this.name, value: this.value });
25
+ }
26
+ }
27
+ valueHandler(inputValueEvent) {
28
+ this.sendInputValue.emit(inputValueEvent);
29
+ }
30
+ handleInput(event) {
31
+ this.value = event.target.value;
32
+ if (this.debounceTime) {
33
+ clearTimeout(this.debounceTime);
34
+ }
35
+ this.debounceTime = setTimeout(() => {
36
+ this.errorMessage = this.setErrorMessage();
37
+ this.isValid = this.setValidity();
38
+ }, 500);
39
+ }
40
+ setValidity() {
41
+ return this.inputReference.validity.valid;
42
+ }
43
+ setErrorMessage() {
44
+ if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
45
+ return translate('numberLengthError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
46
+ }
47
+ if (this.inputReference.validity.valueMissing) {
48
+ return translate('requiredError', this.language);
49
+ }
50
+ }
51
+ render() {
52
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'number__input--invalid';
53
+ return h("div", { class: 'number__wrapper' },
54
+ h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, id: `${this.name}__input`, class: `number__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onInput: (e) => this.handleInput(e) }),
55
+ h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName),
56
+ h("small", { class: 'number__error-message' }, this.errorMessage));
57
+ }
58
+ static get is() { return "number-input"; }
59
+ static get encapsulation() { return "shadow"; }
60
+ static get originalStyleUrls() { return {
61
+ "$": ["number-input.scss"]
62
+ }; }
63
+ static get styleUrls() { return {
64
+ "$": ["number-input.css"]
65
+ }; }
66
+ static get properties() { return {
67
+ "name": {
68
+ "type": "string",
69
+ "mutable": false,
70
+ "complexType": {
71
+ "original": "string",
72
+ "resolved": "string",
73
+ "references": {}
74
+ },
75
+ "required": false,
76
+ "optional": false,
77
+ "docs": {
78
+ "tags": [],
79
+ "text": "Name of the input."
80
+ },
81
+ "attribute": "name",
82
+ "reflect": false
83
+ },
84
+ "displayName": {
85
+ "type": "string",
86
+ "mutable": false,
87
+ "complexType": {
88
+ "original": "string",
89
+ "resolved": "string",
90
+ "references": {}
91
+ },
92
+ "required": false,
93
+ "optional": false,
94
+ "docs": {
95
+ "tags": [],
96
+ "text": "Name of input to be shown to the user."
97
+ },
98
+ "attribute": "display-name",
99
+ "reflect": false
100
+ },
101
+ "validation": {
102
+ "type": "unknown",
103
+ "mutable": false,
104
+ "complexType": {
105
+ "original": "ValidationSchema",
106
+ "resolved": "ValidationSchema",
107
+ "references": {
108
+ "ValidationSchema": {
109
+ "location": "import",
110
+ "path": "../../utils/types"
111
+ }
112
+ }
113
+ },
114
+ "required": false,
115
+ "optional": false,
116
+ "docs": {
117
+ "tags": [],
118
+ "text": "Object of validation rules for the input."
119
+ }
120
+ },
121
+ "defaultValue": {
122
+ "type": "number",
123
+ "mutable": false,
124
+ "complexType": {
125
+ "original": "number",
126
+ "resolved": "number",
127
+ "references": {}
128
+ },
129
+ "required": false,
130
+ "optional": false,
131
+ "docs": {
132
+ "tags": [],
133
+ "text": "Default value for the input."
134
+ },
135
+ "attribute": "default-value",
136
+ "reflect": false
137
+ },
138
+ "language": {
139
+ "type": "string",
140
+ "mutable": false,
141
+ "complexType": {
142
+ "original": "string",
143
+ "resolved": "string",
144
+ "references": {}
145
+ },
146
+ "required": false,
147
+ "optional": false,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": "Currently selected language."
151
+ },
152
+ "attribute": "language",
153
+ "reflect": false
154
+ },
155
+ "checkValidity": {
156
+ "type": "boolean",
157
+ "mutable": false,
158
+ "complexType": {
159
+ "original": "boolean",
160
+ "resolved": "boolean",
161
+ "references": {}
162
+ },
163
+ "required": false,
164
+ "optional": false,
165
+ "docs": {
166
+ "tags": [],
167
+ "text": "State passed down from the parent element. Will trigger the input to check for validity."
168
+ },
169
+ "attribute": "check-validity",
170
+ "reflect": false
171
+ },
172
+ "emitValue": {
173
+ "type": "boolean",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "boolean",
177
+ "resolved": "boolean",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
185
+ },
186
+ "attribute": "emit-value",
187
+ "reflect": false
188
+ }
189
+ }; }
190
+ static get states() { return {
191
+ "errorMessage": {},
192
+ "isValid": {}
193
+ }; }
194
+ static get events() { return [{
195
+ "method": "sendValidityState",
196
+ "name": "sendValidityState",
197
+ "bubbles": true,
198
+ "cancelable": true,
199
+ "composed": true,
200
+ "docs": {
201
+ "tags": [],
202
+ "text": ""
203
+ },
204
+ "complexType": {
205
+ "original": "InputStateEvent",
206
+ "resolved": "InputStateEvent",
207
+ "references": {
208
+ "InputStateEvent": {
209
+ "location": "import",
210
+ "path": "../../utils/types"
211
+ }
212
+ }
213
+ }
214
+ }, {
215
+ "method": "sendInputValue",
216
+ "name": "sendInputValue",
217
+ "bubbles": true,
218
+ "cancelable": true,
219
+ "composed": true,
220
+ "docs": {
221
+ "tags": [],
222
+ "text": ""
223
+ },
224
+ "complexType": {
225
+ "original": "InputValueEvent",
226
+ "resolved": "InputValueEvent",
227
+ "references": {
228
+ "InputValueEvent": {
229
+ "location": "import",
230
+ "path": "../../utils/types"
231
+ }
232
+ }
233
+ }
234
+ }]; }
235
+ static get watchers() { return [{
236
+ "propName": "checkValidity",
237
+ "methodName": "checkValidityHandler"
238
+ }, {
239
+ "propName": "isValid",
240
+ "methodName": "validityChanged"
241
+ }, {
242
+ "propName": "emitValue",
243
+ "methodName": "emitValueHandler"
244
+ }]; }
245
+ }
@@ -0,0 +1,60 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ padding: 0;
5
+ margin: 0;
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ .password__wrapper {
10
+ position: relative;
11
+ display: flex;
12
+ flex-direction: column-reverse;
13
+ padding-top: 10px;
14
+ }
15
+ .password__label {
16
+ color: #474747;
17
+ font-size: 16px;
18
+ position: absolute;
19
+ bottom: 15px;
20
+ left: 5px;
21
+ transform: translateY(-25px);
22
+ transition: all 0.3s cubic-bezier(0.5, 0, 0.5, 1);
23
+ }
24
+ .password__label--required::after {
25
+ content: "*";
26
+ margin-left: 5px;
27
+ color: #666666;
28
+ }
29
+ .password__input {
30
+ width: inherit;
31
+ padding: 15px 6px;
32
+ position: relative;
33
+ border: none;
34
+ border-bottom: 3px solid #666666;
35
+ background-color: transparent;
36
+ color: #666666;
37
+ font-size: 16px;
38
+ font-family: inherit;
39
+ }
40
+ .password__input:focus {
41
+ outline: none;
42
+ box-shadow: 0 5px 5px rgba(16, 15, 15, 0.1);
43
+ }
44
+ .password__input::placeholder {
45
+ color: #666666;
46
+ }
47
+ .password__input--invalid {
48
+ border-bottom: 3px solid #cc0000;
49
+ }
50
+ .password__input:placeholder-shown + .password__label {
51
+ opacity: 0;
52
+ visibility: hidden;
53
+ transform: translateY(0);
54
+ }
55
+ .password__error-message {
56
+ position: absolute;
57
+ top: calc(100% + 5px);
58
+ left: 0;
59
+ color: #cc0000;
60
+ }
@@ -0,0 +1,210 @@
1
+ import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ export class PasswordInput {
4
+ constructor() {
5
+ this.validationPattern = '';
6
+ }
7
+ validityChanged() {
8
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
9
+ if (this.emitValue == true) {
10
+ this.valueHandler({ name: this.name, value: this.value });
11
+ }
12
+ }
13
+ validityStateHandler(inputStateEvent) {
14
+ this.sendValidityState.emit(inputStateEvent);
15
+ }
16
+ emitValueHandler(newValue) {
17
+ if (newValue == true && this.isValid) {
18
+ this.valueHandler({ name: this.name, value: this.value });
19
+ }
20
+ }
21
+ valueHandler(inputValueEvent) {
22
+ this.sendInputValue.emit(inputValueEvent);
23
+ }
24
+ connectedCallback() {
25
+ this.validationPattern = this.setPattern();
26
+ }
27
+ handleInput(event) {
28
+ this.value = event.target.value;
29
+ this.errorMessage = this.setErrorMessage();
30
+ this.isValid = this.setValidity();
31
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
32
+ }
33
+ setValidity() {
34
+ return this.inputReference.validity.valid;
35
+ }
36
+ setPattern() {
37
+ var _a;
38
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
39
+ return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
40
+ }
41
+ }
42
+ setErrorMessage() {
43
+ if (this.inputReference.validity.patternMismatch) {
44
+ return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
45
+ }
46
+ if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
47
+ return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
48
+ }
49
+ if (this.inputReference.validity.valueMissing) {
50
+ return translate('requiredError', this.language);
51
+ }
52
+ }
53
+ render() {
54
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'password__input--invalid';
55
+ return h("div", { class: 'password__wrapper' },
56
+ h("input", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, ref: (el) => this.inputReference = el, required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, onBlur: (e) => this.handleInput(e) }),
57
+ h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName),
58
+ h("small", { class: 'password__error-message' }, this.errorMessage));
59
+ }
60
+ static get is() { return "password-input"; }
61
+ static get encapsulation() { return "shadow"; }
62
+ static get originalStyleUrls() { return {
63
+ "$": ["password-input.scss"]
64
+ }; }
65
+ static get styleUrls() { return {
66
+ "$": ["password-input.css"]
67
+ }; }
68
+ static get properties() { return {
69
+ "name": {
70
+ "type": "string",
71
+ "mutable": false,
72
+ "complexType": {
73
+ "original": "string",
74
+ "resolved": "string",
75
+ "references": {}
76
+ },
77
+ "required": false,
78
+ "optional": false,
79
+ "docs": {
80
+ "tags": [],
81
+ "text": "Name of the input."
82
+ },
83
+ "attribute": "name",
84
+ "reflect": false
85
+ },
86
+ "displayName": {
87
+ "type": "string",
88
+ "mutable": false,
89
+ "complexType": {
90
+ "original": "string",
91
+ "resolved": "string",
92
+ "references": {}
93
+ },
94
+ "required": false,
95
+ "optional": false,
96
+ "docs": {
97
+ "tags": [],
98
+ "text": "Name of input to be shown to the user."
99
+ },
100
+ "attribute": "display-name",
101
+ "reflect": false
102
+ },
103
+ "validation": {
104
+ "type": "unknown",
105
+ "mutable": false,
106
+ "complexType": {
107
+ "original": "ValidationSchema",
108
+ "resolved": "ValidationSchema",
109
+ "references": {
110
+ "ValidationSchema": {
111
+ "location": "import",
112
+ "path": "../../utils/types"
113
+ }
114
+ }
115
+ },
116
+ "required": false,
117
+ "optional": false,
118
+ "docs": {
119
+ "tags": [],
120
+ "text": "Object of validation rules for the input."
121
+ }
122
+ },
123
+ "language": {
124
+ "type": "string",
125
+ "mutable": false,
126
+ "complexType": {
127
+ "original": "string",
128
+ "resolved": "string",
129
+ "references": {}
130
+ },
131
+ "required": false,
132
+ "optional": false,
133
+ "docs": {
134
+ "tags": [],
135
+ "text": "Currently selected language."
136
+ },
137
+ "attribute": "language",
138
+ "reflect": false
139
+ },
140
+ "emitValue": {
141
+ "type": "boolean",
142
+ "mutable": false,
143
+ "complexType": {
144
+ "original": "boolean",
145
+ "resolved": "boolean",
146
+ "references": {}
147
+ },
148
+ "required": false,
149
+ "optional": false,
150
+ "docs": {
151
+ "tags": [],
152
+ "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
153
+ },
154
+ "attribute": "emit-value",
155
+ "reflect": false
156
+ }
157
+ }; }
158
+ static get states() { return {
159
+ "isValid": {},
160
+ "errorMessage": {}
161
+ }; }
162
+ static get events() { return [{
163
+ "method": "sendValidityState",
164
+ "name": "sendValidityState",
165
+ "bubbles": true,
166
+ "cancelable": true,
167
+ "composed": true,
168
+ "docs": {
169
+ "tags": [],
170
+ "text": ""
171
+ },
172
+ "complexType": {
173
+ "original": "InputStateEvent",
174
+ "resolved": "InputStateEvent",
175
+ "references": {
176
+ "InputStateEvent": {
177
+ "location": "import",
178
+ "path": "../../utils/types"
179
+ }
180
+ }
181
+ }
182
+ }, {
183
+ "method": "sendInputValue",
184
+ "name": "sendInputValue",
185
+ "bubbles": true,
186
+ "cancelable": true,
187
+ "composed": true,
188
+ "docs": {
189
+ "tags": [],
190
+ "text": ""
191
+ },
192
+ "complexType": {
193
+ "original": "InputValueEvent",
194
+ "resolved": "InputValueEvent",
195
+ "references": {
196
+ "InputValueEvent": {
197
+ "location": "import",
198
+ "path": "../../utils/types"
199
+ }
200
+ }
201
+ }
202
+ }]; }
203
+ static get watchers() { return [{
204
+ "propName": "isValid",
205
+ "methodName": "validityChanged"
206
+ }, {
207
+ "propName": "emitValue",
208
+ "methodName": "emitValueHandler"
209
+ }]; }
210
+ }
@@ -0,0 +1,22 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ padding: 0;
5
+ margin: 0;
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ .radio__fieldset {
10
+ border: none;
11
+ position: relative;
12
+ }
13
+ .radio__wrapper {
14
+ display: flex;
15
+ gap: 5px;
16
+ }
17
+ .radio__error-message {
18
+ position: absolute;
19
+ top: calc(100% + 5px);
20
+ left: 0;
21
+ color: red;
22
+ }