@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,78 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { t as translate } from './locale.utils.js';
3
+
4
+ const checkboxInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.checkbox__wrapper{display:flex;gap:10px;position:relative;align-items:baseline}.checkbox__error-message{position:absolute;top:calc(100% + 5px);left:0;color:red}";
5
+
6
+ const CheckboxInput = /*@__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
+ validityChanged() {
15
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
16
+ if (this.emitValue == true) {
17
+ this.valueHandler({ name: this.name, value: this.value });
18
+ }
19
+ }
20
+ validityStateHandler(inputStateEvent) {
21
+ this.sendValidityState.emit(inputStateEvent);
22
+ }
23
+ emitValueHandler(newValue) {
24
+ if (newValue == true && this.isValid) {
25
+ this.valueHandler({ name: this.name, value: this.value });
26
+ }
27
+ }
28
+ valueHandler(inputValueEvent) {
29
+ this.sendInputValue.emit(inputValueEvent);
30
+ }
31
+ connectedCallback() {
32
+ }
33
+ handleClick() {
34
+ this.value = this.inputReference.checked;
35
+ this.errorMessage = this.setErrorMessage();
36
+ this.isValid = this.setValidity();
37
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
38
+ }
39
+ setValidity() {
40
+ return this.inputReference.validity.valid;
41
+ }
42
+ setErrorMessage() {
43
+ if (this.inputReference.validity.valueMissing) {
44
+ return translate('requiredError', this.language);
45
+ }
46
+ }
47
+ render() {
48
+ return h("div", { class: 'checkbox__wrapper' }, h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, required: this.validation.mandatory, value: 'jdjdj', onClick: () => this.handleClick() }), h("label", { htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), h("small", { class: 'checkbox__error-message' }, this.errorMessage));
49
+ }
50
+ static get watchers() { return {
51
+ "isValid": ["validityChanged"],
52
+ "emitValue": ["emitValueHandler"]
53
+ }; }
54
+ static get style() { return checkboxInputCss; }
55
+ }, [1, "checkbox-input", {
56
+ "name": [1],
57
+ "displayName": [1, "display-name"],
58
+ "validation": [16],
59
+ "language": [1],
60
+ "emitValue": [4, "emit-value"],
61
+ "errorMessage": [32],
62
+ "isValid": [32]
63
+ }]);
64
+ function defineCustomElement() {
65
+ if (typeof customElements === "undefined") {
66
+ return;
67
+ }
68
+ const components = ["checkbox-input"];
69
+ components.forEach(tagName => { switch (tagName) {
70
+ case "checkbox-input":
71
+ if (!customElements.get(tagName)) {
72
+ customElements.define(tagName, CheckboxInput);
73
+ }
74
+ break;
75
+ } });
76
+ }
77
+
78
+ export { CheckboxInput as C, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface DateInput extends Components.DateInput, HTMLElement {}
4
+ export const DateInput: {
5
+ prototype: DateInput;
6
+ new (): DateInput;
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 { D as DateInput$1, d as defineCustomElement$1 } from './date-input2.js';
2
+
3
+ const DateInput = DateInput$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { DateInput, defineCustomElement };
@@ -0,0 +1,90 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { t as translate } from './locale.utils.js';
3
+
4
+ const dateInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.date__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.date__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)}.date__label--required::after{content:\"*\";margin-left:5px;color:#666666}.date__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}.date__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.date__input::placeholder{color:#666666}.date__input--invalid{border-bottom:3px solid #cc0000}.date__input:placeholder-shown+.date__label{opacity:0;visibility:hidden;transform:translateY(0)}.date__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";
5
+
6
+ const DateInput = /*@__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
+ checkValidityHandler(newValue) {
15
+ if (newValue == true) {
16
+ this.isValid = this.setValidity();
17
+ this.errorMessage = this.setErrorMessage();
18
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
19
+ }
20
+ }
21
+ validityChanged() {
22
+ if (this.checkValidity == true) {
23
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
24
+ }
25
+ if (this.emitValue == true) {
26
+ this.valueHandler({ name: this.name, value: this.value });
27
+ }
28
+ }
29
+ validityStateHandler(inputStateEvent) {
30
+ this.sendValidityState.emit(inputStateEvent);
31
+ }
32
+ emitValueHandler(newValue) {
33
+ if (newValue == true && this.isValid) {
34
+ this.valueHandler({ name: this.name, value: this.value });
35
+ }
36
+ }
37
+ valueHandler(inputValueEvent) {
38
+ this.sendInputValue.emit(inputValueEvent);
39
+ }
40
+ handleInput(event) {
41
+ this.value = event.target.value;
42
+ this.errorMessage = this.setErrorMessage();
43
+ this.isValid = this.setValidity();
44
+ }
45
+ setValidity() {
46
+ return this.inputReference.validity.valid;
47
+ }
48
+ setErrorMessage() {
49
+ if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
50
+ return translate('dateError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
51
+ }
52
+ if (this.inputReference.validity.valueMissing) {
53
+ return translate('requiredError', this.language);
54
+ }
55
+ }
56
+ render() {
57
+ return h("div", { class: 'date__wrapper' }, h("input", { id: `${this.name}__input`, type: 'date', class: `date__input`, value: this.defaultValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onInput: (e) => this.handleInput(e) }), h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), h("small", { class: 'date__error-message' }, this.errorMessage));
58
+ }
59
+ static get watchers() { return {
60
+ "checkValidity": ["checkValidityHandler"],
61
+ "isValid": ["validityChanged"],
62
+ "emitValue": ["emitValueHandler"]
63
+ }; }
64
+ static get style() { return dateInputCss; }
65
+ }, [1, "date-input", {
66
+ "name": [1],
67
+ "displayName": [1, "display-name"],
68
+ "validation": [16],
69
+ "defaultValue": [1, "default-value"],
70
+ "language": [1],
71
+ "checkValidity": [4, "check-validity"],
72
+ "emitValue": [4, "emit-value"],
73
+ "errorMessage": [32],
74
+ "isValid": [32]
75
+ }]);
76
+ function defineCustomElement() {
77
+ if (typeof customElements === "undefined") {
78
+ return;
79
+ }
80
+ const components = ["date-input"];
81
+ components.forEach(tagName => { switch (tagName) {
82
+ case "date-input":
83
+ if (!customElements.get(tagName)) {
84
+ customElements.define(tagName, DateInput);
85
+ }
86
+ break;
87
+ } });
88
+ }
89
+
90
+ export { DateInput as D, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface EmailInput extends Components.EmailInput, HTMLElement {}
4
+ export const EmailInput: {
5
+ prototype: EmailInput;
6
+ new (): EmailInput;
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 { E as EmailInput$1, d as defineCustomElement$1 } from './email-input2.js';
2
+
3
+ const EmailInput = EmailInput$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { EmailInput, defineCustomElement };
@@ -0,0 +1,108 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { t as translate } from './locale.utils.js';
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}";
5
+
6
+ const EmailInput = /*@__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
+ this.validationPattern = '';
14
+ }
15
+ checkValidityHandler(newValue) {
16
+ if (newValue == true) {
17
+ this.isValid = this.setValidity();
18
+ this.errorMessage = this.setErrorMessage();
19
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
20
+ }
21
+ }
22
+ validityChanged() {
23
+ if (this.checkValidity == true) {
24
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
25
+ }
26
+ if (this.emitValue == true) {
27
+ this.valueHandler({ name: this.name, value: this.value });
28
+ }
29
+ }
30
+ validityStateHandler(inputStateEvent) {
31
+ this.sendValidityState.emit(inputStateEvent);
32
+ }
33
+ emitValueHandler(newValue) {
34
+ if (newValue == true && this.isValid) {
35
+ this.valueHandler({ name: this.name, value: this.value });
36
+ }
37
+ }
38
+ valueHandler(inputValueEvent) {
39
+ this.sendInputValue.emit(inputValueEvent);
40
+ }
41
+ connectedCallback() {
42
+ this.validationPattern = this.setPattern();
43
+ }
44
+ handleInput(event) {
45
+ this.value = event.target.value;
46
+ if (this.debounceTime) {
47
+ clearTimeout(this.debounceTime);
48
+ }
49
+ this.debounceTime = setTimeout(() => {
50
+ this.errorMessage = this.setErrorMessage();
51
+ this.isValid = this.setValidity();
52
+ }, 500);
53
+ }
54
+ setValidity() {
55
+ return this.inputReference.validity.valid;
56
+ }
57
+ setPattern() {
58
+ var _a;
59
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
60
+ return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
61
+ }
62
+ }
63
+ setErrorMessage() {
64
+ if (this.inputReference.validity.patternMismatch) {
65
+ return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
66
+ }
67
+ if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
68
+ return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
69
+ }
70
+ if (this.inputReference.validity.valueMissing) {
71
+ return translate('requiredError', this.language);
72
+ }
73
+ }
74
+ render() {
75
+ 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));
76
+ }
77
+ static get watchers() { return {
78
+ "checkValidity": ["checkValidityHandler"],
79
+ "isValid": ["validityChanged"],
80
+ "emitValue": ["emitValueHandler"]
81
+ }; }
82
+ static get style() { return emailInputCss; }
83
+ }, [1, "email-input", {
84
+ "name": [1],
85
+ "displayName": [1, "display-name"],
86
+ "validation": [16],
87
+ "defaultValue": [1, "default-value"],
88
+ "language": [1],
89
+ "emitValue": [4, "emit-value"],
90
+ "checkValidity": [4, "check-validity"],
91
+ "errorMessage": [32],
92
+ "isValid": [32]
93
+ }]);
94
+ function defineCustomElement() {
95
+ if (typeof customElements === "undefined") {
96
+ return;
97
+ }
98
+ const components = ["email-input"];
99
+ components.forEach(tagName => { switch (tagName) {
100
+ case "email-input":
101
+ if (!customElements.get(tagName)) {
102
+ customElements.define(tagName, EmailInput);
103
+ }
104
+ break;
105
+ } });
106
+ }
107
+
108
+ export { EmailInput as E, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GeneralInput extends Components.GeneralInput, HTMLElement {}
4
+ export const GeneralInput: {
5
+ prototype: GeneralInput;
6
+ new (): GeneralInput;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,123 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+ import { d as defineCustomElement$a } from './checkbox-input2.js';
3
+ import { d as defineCustomElement$9 } from './date-input2.js';
4
+ import { d as defineCustomElement$8 } from './email-input2.js';
5
+ import { d as defineCustomElement$7 } from './number-input2.js';
6
+ import { d as defineCustomElement$6 } from './password-input2.js';
7
+ import { d as defineCustomElement$5 } from './radio-input2.js';
8
+ import { d as defineCustomElement$4 } from './select-input2.js';
9
+ import { d as defineCustomElement$3 } from './tel-input2.js';
10
+ import { d as defineCustomElement$2 } from './text-input2.js';
11
+
12
+ const generalInputCss = ":host{display:block}";
13
+
14
+ const GeneralInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
15
+ constructor() {
16
+ super();
17
+ this.__registerHost();
18
+ this.__attachShadow();
19
+ /**
20
+ * Type the general-input should take. Can take the default HTML input values.
21
+ */
22
+ this.type = 'text';
23
+ }
24
+ render() {
25
+ switch (this.type.toLowerCase()) {
26
+ case 'text':
27
+ return h("text-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, emitValue: this.emitValue, language: this.language });
28
+ case 'email':
29
+ return h("email-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, emitValue: this.emitValue, language: this.language });
30
+ case 'number':
31
+ return h("number-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, emitValue: this.emitValue, language: this.language });
32
+ case 'checkbox':
33
+ return h("checkbox-input", { name: this.name, displayName: this.displayName, validation: this.validation, emitValue: this.emitValue, language: this.language });
34
+ case 'datetime':
35
+ return h("date-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, emitValue: this.emitValue, language: this.language });
36
+ case 'password':
37
+ return h("password-input", { name: this.name, displayName: this.displayName, validation: this.validation, emitValue: this.emitValue, language: this.language });
38
+ case 'radio':
39
+ return h("radio-input", { name: this.name, displayName: this.displayName, optionsGroup: this.options, validation: this.validation, emitValue: this.emitValue, language: this.language });
40
+ case 'tel':
41
+ return h("tel-input", { name: this.name, action: this.action, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, emitValue: this.emitValue, language: this.language });
42
+ case 'dropdown':
43
+ return h("select-input", { name: this.name, action: this.action, displayName: this.displayName, options: this.options, validation: this.validation, emitValue: this.emitValue, language: this.language });
44
+ default:
45
+ // Nothing here
46
+ return h("p", null, "The ", this.type, " input type is not valid");
47
+ }
48
+ }
49
+ static get style() { return generalInputCss; }
50
+ }, [1, "general-input", {
51
+ "type": [1],
52
+ "name": [1],
53
+ "displayName": [1, "display-name"],
54
+ "action": [1],
55
+ "validation": [16],
56
+ "options": [8],
57
+ "language": [1],
58
+ "defaultValue": [8, "default-value"],
59
+ "emitValue": [4, "emit-value"]
60
+ }]);
61
+ function defineCustomElement$1() {
62
+ if (typeof customElements === "undefined") {
63
+ return;
64
+ }
65
+ const components = ["general-input", "checkbox-input", "date-input", "email-input", "number-input", "password-input", "radio-input", "select-input", "tel-input", "text-input"];
66
+ components.forEach(tagName => { switch (tagName) {
67
+ case "general-input":
68
+ if (!customElements.get(tagName)) {
69
+ customElements.define(tagName, GeneralInput$1);
70
+ }
71
+ break;
72
+ case "checkbox-input":
73
+ if (!customElements.get(tagName)) {
74
+ defineCustomElement$a();
75
+ }
76
+ break;
77
+ case "date-input":
78
+ if (!customElements.get(tagName)) {
79
+ defineCustomElement$9();
80
+ }
81
+ break;
82
+ case "email-input":
83
+ if (!customElements.get(tagName)) {
84
+ defineCustomElement$8();
85
+ }
86
+ break;
87
+ case "number-input":
88
+ if (!customElements.get(tagName)) {
89
+ defineCustomElement$7();
90
+ }
91
+ break;
92
+ case "password-input":
93
+ if (!customElements.get(tagName)) {
94
+ defineCustomElement$6();
95
+ }
96
+ break;
97
+ case "radio-input":
98
+ if (!customElements.get(tagName)) {
99
+ defineCustomElement$5();
100
+ }
101
+ break;
102
+ case "select-input":
103
+ if (!customElements.get(tagName)) {
104
+ defineCustomElement$4();
105
+ }
106
+ break;
107
+ case "tel-input":
108
+ if (!customElements.get(tagName)) {
109
+ defineCustomElement$3();
110
+ }
111
+ break;
112
+ case "text-input":
113
+ if (!customElements.get(tagName)) {
114
+ defineCustomElement$2();
115
+ }
116
+ break;
117
+ } });
118
+ }
119
+
120
+ const GeneralInput = GeneralInput$1;
121
+ const defineCustomElement = defineCustomElement$1;
122
+
123
+ export { GeneralInput, defineCustomElement };
@@ -0,0 +1,26 @@
1
+ /* GeneralInput custom elements */
2
+
3
+ import type { Components, JSX } from "../types/components";
4
+
5
+ /**
6
+ * Used to manually set the base path where assets can be found.
7
+ * If the script is used as "module", it's recommended to use "import.meta.url",
8
+ * such as "setAssetPath(import.meta.url)". Other options include
9
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
10
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
11
+ * But do note that this configuration depends on how your script is bundled, or lack of
12
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
13
+ * will have to ensure the static assets are copied to its build directory.
14
+ */
15
+ export declare const setAssetPath: (path: string) => void;
16
+
17
+ export interface SetPlatformOptions {
18
+ raf?: (c: FrameRequestCallback) => number;
19
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
20
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
21
+ }
22
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
23
+
24
+ export type { Components, JSX };
25
+
26
+ export * from '../types';
@@ -0,0 +1 @@
1
+ export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
@@ -0,0 +1,29 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ dateError: 'The selected date should be between {min} and {max}',
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
+ nextButton: 'Next',
10
+ backButton: 'Back'
11
+ },
12
+ ro: {
13
+ lengthError: `Cuvântul introdus este prea scurt. {minLength} and {maxLength}`,
14
+ requiredError: 'Acest câmp este obligatoriu.'
15
+ }
16
+ };
17
+ const translate = (key, customLang, values) => {
18
+ const lang = customLang;
19
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
20
+ if (values !== undefined) {
21
+ for (const [key, value] of Object.entries(values.values)) {
22
+ const regex = new RegExp(`{${key}}`, 'g');
23
+ translation = translation.replace(regex, value);
24
+ }
25
+ }
26
+ return translation;
27
+ };
28
+
29
+ export { translate as t };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface NumberInput extends Components.NumberInput, HTMLElement {}
4
+ export const NumberInput: {
5
+ prototype: NumberInput;
6
+ new (): NumberInput;
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 { N as NumberInput$1, d as defineCustomElement$1 } from './number-input2.js';
2
+
3
+ const NumberInput = NumberInput$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { NumberInput, defineCustomElement };
@@ -0,0 +1,96 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { t as translate } from './locale.utils.js';
3
+
4
+ const numberInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.number__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.number__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)}.number__label--required::after{content:\"*\";margin-left:5px;color:#666666}.number__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;-moz-appearance:textfield;}.number__input::-webkit-outer-spin-button,.number__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.number__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.number__input::placeholder{color:#666666}.number__input--invalid{border-bottom:3px solid #cc0000}.number__input:placeholder-shown+.number__label{opacity:0;visibility:hidden;transform:translateY(0)}.number__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";
5
+
6
+ const NumberInput = /*@__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
+ checkValidityHandler(newValue) {
15
+ if (newValue == true) {
16
+ this.isValid = this.setValidity();
17
+ this.errorMessage = this.setErrorMessage();
18
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
19
+ }
20
+ }
21
+ validityChanged() {
22
+ if (this.checkValidity == true) {
23
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
24
+ }
25
+ if (this.emitValue == true) {
26
+ this.valueHandler({ name: this.name, value: this.value });
27
+ }
28
+ }
29
+ validityStateHandler(inputStateEvent) {
30
+ this.sendValidityState.emit(inputStateEvent);
31
+ }
32
+ emitValueHandler(newValue) {
33
+ if (newValue == true && this.isValid) {
34
+ this.valueHandler({ name: this.name, value: this.value });
35
+ }
36
+ }
37
+ valueHandler(inputValueEvent) {
38
+ this.sendInputValue.emit(inputValueEvent);
39
+ }
40
+ handleInput(event) {
41
+ this.value = event.target.value;
42
+ if (this.debounceTime) {
43
+ clearTimeout(this.debounceTime);
44
+ }
45
+ this.debounceTime = setTimeout(() => {
46
+ this.errorMessage = this.setErrorMessage();
47
+ this.isValid = this.setValidity();
48
+ }, 500);
49
+ }
50
+ setValidity() {
51
+ return this.inputReference.validity.valid;
52
+ }
53
+ setErrorMessage() {
54
+ if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
55
+ return translate('numberLengthError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
56
+ }
57
+ if (this.inputReference.validity.valueMissing) {
58
+ return translate('requiredError', this.language);
59
+ }
60
+ }
61
+ render() {
62
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'number__input--invalid';
63
+ return h("div", { class: 'number__wrapper' }, 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) }), h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("small", { class: 'number__error-message' }, this.errorMessage));
64
+ }
65
+ static get watchers() { return {
66
+ "checkValidity": ["checkValidityHandler"],
67
+ "isValid": ["validityChanged"],
68
+ "emitValue": ["emitValueHandler"]
69
+ }; }
70
+ static get style() { return numberInputCss; }
71
+ }, [1, "number-input", {
72
+ "name": [1],
73
+ "displayName": [1, "display-name"],
74
+ "validation": [16],
75
+ "defaultValue": [2, "default-value"],
76
+ "language": [1],
77
+ "checkValidity": [4, "check-validity"],
78
+ "emitValue": [4, "emit-value"],
79
+ "errorMessage": [32],
80
+ "isValid": [32]
81
+ }]);
82
+ function defineCustomElement() {
83
+ if (typeof customElements === "undefined") {
84
+ return;
85
+ }
86
+ const components = ["number-input"];
87
+ components.forEach(tagName => { switch (tagName) {
88
+ case "number-input":
89
+ if (!customElements.get(tagName)) {
90
+ customElements.define(tagName, NumberInput);
91
+ }
92
+ break;
93
+ } });
94
+ }
95
+
96
+ export { NumberInput as N, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PasswordInput extends Components.PasswordInput, HTMLElement {}
4
+ export const PasswordInput: {
5
+ prototype: PasswordInput;
6
+ new (): PasswordInput;
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 { P as PasswordInput$1, d as defineCustomElement$1 } from './password-input2.js';
2
+
3
+ const PasswordInput = PasswordInput$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { PasswordInput, defineCustomElement };