@everymatrix/general-input 1.90.7 → 1.90.8

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 (41) hide show
  1. package/dist/cjs/checkbox-group-input_14.cjs.entry.js +373 -345
  2. package/dist/cjs/general-input.cjs.js +2 -2
  3. package/dist/cjs/{index-3b546c2c.js → index-7a4b2771.js} +1 -4
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +34 -20
  6. package/dist/collection/components/checkbox-input/checkbox-input.js +33 -19
  7. package/dist/collection/components/date-input/date-input.js +34 -20
  8. package/dist/collection/components/email-input/email-input.js +34 -20
  9. package/dist/collection/components/general-input/general-input.js +35 -64
  10. package/dist/collection/components/number-input/number-input.js +34 -20
  11. package/dist/collection/components/password-input/password-input.js +34 -20
  12. package/dist/collection/components/postalcode-input/postalcode-input.js +35 -19
  13. package/dist/collection/components/radio-input/radio-input.js +36 -20
  14. package/dist/collection/components/select-input/select-input.js +35 -21
  15. package/dist/collection/components/tel-input/tel-input.js +34 -20
  16. package/dist/collection/components/text-input/text-input.js +36 -22
  17. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +34 -20
  18. package/dist/collection/components/twofa-input/twofa-input.js +26 -59
  19. package/dist/esm/checkbox-group-input_14.entry.js +373 -345
  20. package/dist/esm/general-input.js +3 -3
  21. package/dist/esm/{index-ca174b7a.js → index-9174417a.js} +1 -4
  22. package/dist/esm/loader.js +3 -3
  23. package/dist/general-input/checkbox-group-input_14.entry.js +242 -242
  24. package/dist/general-input/general-input.esm.js +1 -1
  25. package/dist/general-input/{index-ca174b7a.js → index-9174417a.js} +2 -2
  26. package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +7 -4
  27. package/dist/types/components/checkbox-input/checkbox-input.d.ts +7 -4
  28. package/dist/types/components/date-input/date-input.d.ts +7 -4
  29. package/dist/types/components/email-input/email-input.d.ts +7 -4
  30. package/dist/types/components/general-input/general-input.d.ts +4 -6
  31. package/dist/types/components/number-input/number-input.d.ts +7 -4
  32. package/dist/types/components/password-input/password-input.d.ts +7 -4
  33. package/dist/types/components/postalcode-input/postalcode-input.d.ts +7 -4
  34. package/dist/types/components/radio-input/radio-input.d.ts +8 -4
  35. package/dist/types/components/select-input/select-input.d.ts +7 -4
  36. package/dist/types/components/tel-input/tel-input.d.ts +7 -4
  37. package/dist/types/components/text-input/text-input.d.ts +7 -4
  38. package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +7 -4
  39. package/dist/types/components/twofa-input/twofa-input.d.ts +3 -7
  40. package/dist/types/components.d.ts +96 -0
  41. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { translate } from "../../utils/locale.utils";
3
3
  import tooltipIcon from "../../utils/tooltipIcon.svg";
4
+ import { setClientStyling, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
4
5
  export class ToggleCheckboxInput {
5
6
  constructor() {
6
7
  this.callBackObject = {};
@@ -10,11 +11,6 @@ export class ToggleCheckboxInput {
10
11
  event.stopPropagation();
11
12
  window.postMessage({ type: `registration${fieldName}Clicked` }, window.location.href);
12
13
  };
13
- this.setClientStyling = () => {
14
- let sheet = document.createElement('style');
15
- sheet.innerHTML = this.clientStyling;
16
- this.stylingContainer.prepend(sheet);
17
- };
18
14
  this.name = undefined;
19
15
  this.displayName = undefined;
20
16
  this.defaultValue = '';
@@ -25,15 +21,16 @@ export class ToggleCheckboxInput {
25
21
  this.language = undefined;
26
22
  this.emitValue = undefined;
27
23
  this.clientStyling = '';
24
+ this.mbSource = undefined;
28
25
  this.errorMessage = undefined;
29
26
  this.isValid = undefined;
30
- this.limitStylingAppends = false;
31
27
  this.showTooltip = false;
32
28
  this.showFields = this.defaultValue === 'true';
33
29
  }
34
- handleStylingChange(newValue, oldValue) {
35
- if (newValue !== oldValue)
36
- this.setClientStyling();
30
+ handleClientStylingChange(newValue, oldValue) {
31
+ if (newValue !== oldValue) {
32
+ setClientStyling(this.stylingContainer, this.clientStyling);
33
+ }
37
34
  }
38
35
  validityStateHandler(inputStateEvent) {
39
36
  this.sendValidityState.emit(inputStateEvent);
@@ -47,16 +44,17 @@ export class ToggleCheckboxInput {
47
44
  this.showTooltip = false;
48
45
  }
49
46
  }
50
- componentDidRender() {
51
- // start custom styling area
52
- if (!this.limitStylingAppends && this.stylingContainer) {
53
- if (this.clientStyling)
54
- this.setClientStyling();
55
- this.limitStylingAppends = true;
47
+ handleClientStyling() {
48
+ if (window.emMessageBus !== undefined) {
49
+ this.stylingSubscription = setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription, true);
50
+ return;
51
+ }
52
+ if (this.clientStyling) {
53
+ setClientStyling(this.stylingContainer, this.clientStyling);
56
54
  }
57
- // end custom styling area
58
55
  }
59
56
  componentDidLoad() {
57
+ this.handleClientStyling();
60
58
  if (this.options.length === 0)
61
59
  return;
62
60
  this.options.forEach((subField) => {
@@ -93,8 +91,8 @@ export class ToggleCheckboxInput {
93
91
  return null;
94
92
  }
95
93
  render() {
96
- return h("div", { key: '828751327e59e9649afc04c6c9f7a02ef7dcae8d', class: `togglecheckbox__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { key: 'd02a2a6ef595aaf7142cbc6e9681394ee4db8fee', class: 'togglecheckbox__wrapper--flex' }, h("input", { key: 'fca6401ef6eb178f53471362444d54ed69086429', class: 'togglecheckbox__input', type: "checkbox", id: `${this.name}__input`, ref: (el) => this.checkboxReference = el, name: this.name, checked: this.defaultValue === "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), this.renderLabel()), h("small", { key: '3781a8fdfeb719422693bcd541a4a3fe708e705a', class: 'togglecheckbox__error-message' }, this.errorMessage), h("div", { key: '27a4c6b047cd332407ee40c82cf7be1914ed34c9', class: 'togglecheckbox__wrapper--relative' }, this.tooltip &&
97
- h("img", { key: 'f1367d7e061d20ad68c24dfbe3147e6b67df746f', class: 'togglecheckbox__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()), h("div", { key: '98d42103554de4d14a65eafd1722bf9d587a27f1', class: `togglecheckbox__fields-wrapper ${this.showFields ? '' : 'hidden'}` }, this.options.map(subfield => {
94
+ return h("div", { key: '31cd24b5da24368eef2f53952714395d6d9f6285', class: `togglecheckbox__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { key: 'aa14784bd8a3870f7015db79d23226521706ad58', class: 'togglecheckbox__wrapper--flex' }, h("input", { key: '0237f06c99b8b2ed7de80433f5b93b9eae7c25f5', class: 'togglecheckbox__input', type: "checkbox", id: `${this.name}__input`, ref: (el) => this.checkboxReference = el, name: this.name, checked: this.defaultValue === "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), this.renderLabel()), h("small", { key: '7e26bea1cfcc725d5aa5a795fd0f999d99abe39d', class: 'togglecheckbox__error-message' }, this.errorMessage), h("div", { key: '4256fc552545b7a1050ff5cdeb005f5ea83cc5c1', class: 'togglecheckbox__wrapper--relative' }, this.tooltip &&
95
+ h("img", { key: 'be3c3e036f0bfe46658fce870ae0ffa258229e7d', class: 'togglecheckbox__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()), h("div", { key: '2d61bedaac02f21116318b10a21b361e70e0213f', class: `togglecheckbox__fields-wrapper ${this.showFields ? '' : 'hidden'}` }, this.options.map(subfield => {
98
96
  return h("general-input", { type: subfield.inputType, name: subfield.name, displayName: subfield.displayName, validation: subfield.validate, action: subfield.action || null, defaultValue: subfield.defaultValue, autofilled: subfield.autofill, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: subfield.tooltip, placeholder: subfield.placeholder == null ? '' : subfield.placeholder, ref: el => this.subFieldsObject[subfield.name] = el });
99
97
  })));
100
98
  }
@@ -291,6 +289,23 @@ export class ToggleCheckboxInput {
291
289
  "attribute": "client-styling",
292
290
  "reflect": true,
293
291
  "defaultValue": "''"
292
+ },
293
+ "mbSource": {
294
+ "type": "string",
295
+ "mutable": false,
296
+ "complexType": {
297
+ "original": "string",
298
+ "resolved": "string",
299
+ "references": {}
300
+ },
301
+ "required": false,
302
+ "optional": false,
303
+ "docs": {
304
+ "tags": [],
305
+ "text": "Client custom styling via message bus"
306
+ },
307
+ "attribute": "mb-source",
308
+ "reflect": true
294
309
  }
295
310
  };
296
311
  }
@@ -298,7 +313,6 @@ export class ToggleCheckboxInput {
298
313
  return {
299
314
  "errorMessage": {},
300
315
  "isValid": {},
301
- "limitStylingAppends": {},
302
316
  "showTooltip": {},
303
317
  "showFields": {}
304
318
  };
@@ -351,7 +365,7 @@ export class ToggleCheckboxInput {
351
365
  static get watchers() {
352
366
  return [{
353
367
  "propName": "clientStyling",
354
- "methodName": "handleStylingChange"
368
+ "methodName": "handleClientStylingChange"
355
369
  }];
356
370
  }
357
371
  static get listeners() {
@@ -1,5 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { translate } from "../../utils/locale.utils";
3
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
4
  export class TwofaInput {
4
5
  constructor() {
5
6
  this.validationPattern = '';
@@ -13,17 +14,6 @@ export class TwofaInput {
13
14
  this.triggerResendInterval();
14
15
  this.resendCode.emit();
15
16
  };
16
- this.setClientStylingURL = () => {
17
- let url = new URL(this.clientStylingUrl);
18
- let cssFile = document.createElement('style');
19
- fetch(url.href)
20
- .then((res) => res.text())
21
- .then((data) => {
22
- cssFile.innerHTML = data;
23
- this.clientStyling = data;
24
- setTimeout(() => { this.host.shadowRoot.prepend(cssFile); }, 1);
25
- });
26
- };
27
17
  this.setInputRef = (el, idx) => {
28
18
  if (el) {
29
19
  this.inputRefs[idx] = el;
@@ -79,21 +69,6 @@ export class TwofaInput {
79
69
  this.setValidity();
80
70
  this.setErrorMessage();
81
71
  };
82
- this.setClientStyling = () => {
83
- let sheet = document.createElement('style');
84
- sheet.innerHTML = this.clientStyling;
85
- this.stylingContainer.prepend(sheet);
86
- };
87
- this.setStreamStyling = (domain) => {
88
- if (window.emMessageBus) {
89
- const sheet = document.createElement('style');
90
- this.stylingSubscription = window.emMessageBus.subscribe(domain, (data) => {
91
- sheet.innerHTML = data;
92
- this.clientStyling = data;
93
- this.host.shadowRoot.prepend(sheet);
94
- });
95
- }
96
- };
97
72
  this.name = '';
98
73
  this.displayName = '';
99
74
  this.placeholder = '';
@@ -108,7 +83,6 @@ export class TwofaInput {
108
83
  this.pinAttemptsExceeded = undefined;
109
84
  this.clientStylingUrl = '';
110
85
  this.mbSource = undefined;
111
- this.limitStylingAppends = false;
112
86
  this.isValid = false;
113
87
  this.isResendButtonAvailable = true;
114
88
  this.showTooltip = false;
@@ -128,9 +102,16 @@ export class TwofaInput {
128
102
  this.valueHandler({ name: this.name, value: this.code.join('') });
129
103
  }
130
104
  }
131
- handleStylingUrlChange(newValue, oldValue) {
132
- if (newValue !== oldValue)
133
- this.setClientStylingURL();
105
+ handleClientStylingChange(newValue, oldValue) {
106
+ if (newValue !== oldValue) {
107
+ setClientStyling(this.stylingContainer, this.clientStyling);
108
+ }
109
+ }
110
+ handleClientStylingChangeURL(newValue, oldValue) {
111
+ if (newValue !== oldValue) {
112
+ if (this.clientStylingUrl)
113
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
114
+ }
134
115
  }
135
116
  validityStateHandler(inputStateEvent) {
136
117
  this.sendValidityState.emit(inputStateEvent);
@@ -144,10 +125,6 @@ export class TwofaInput {
144
125
  this.showTooltip = false;
145
126
  }
146
127
  }
147
- handleStylingChange(newValue, oldValue) {
148
- if (newValue !== oldValue)
149
- this.setClientStyling();
150
- }
151
128
  connectedCallback() {
152
129
  this.validationPattern = this.setPattern();
153
130
  this.code = new Array(this.validation.maxLength).fill('');
@@ -155,30 +132,21 @@ export class TwofaInput {
155
132
  disconnectedCallback() {
156
133
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
157
134
  }
158
- componentDidRender() {
159
- if (!this.limitStylingAppends && this.stylingContainer) {
160
- if (this.clientStyling) {
161
- this.setClientStyling();
162
- }
163
- this.limitStylingAppends = true;
135
+ handleClientStyling() {
136
+ if (window.emMessageBus !== undefined) {
137
+ this.stylingSubscription = setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription, true);
138
+ return;
164
139
  }
140
+ if (this.clientStyling)
141
+ setClientStyling(this.stylingContainer, this.clientStyling);
142
+ if (this.clientStylingUrl)
143
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
165
144
  }
166
145
  componentDidLoad() {
167
146
  this.setValidity();
168
147
  this.registrationWidgetLoaded.emit();
169
148
  window.postMessage({ type: 'registrationWidgetLoaded' }, window.location.href);
170
- if (!this.limitStylingAppends && this.host) {
171
- if (window.emMessageBus != undefined) {
172
- this.setStreamStyling(`${this.mbSource}.Style`);
173
- }
174
- else {
175
- if (this.clientStyling)
176
- this.setClientStyling();
177
- if (this.clientStylingUrl)
178
- this.setClientStylingURL();
179
- this.limitStylingAppends = true;
180
- }
181
- }
149
+ this.handleClientStyling();
182
150
  }
183
151
  handleKeyDown(e, idx) {
184
152
  if (e.key === 'Backspace') {
@@ -269,9 +237,9 @@ export class TwofaInput {
269
237
  return current;
270
238
  }
271
239
  render() {
272
- return (h("div", { key: '08b9139f1c2236dd40a045517a9623ad966f29d3', class: "twofa", ref: el => this.stylingContainer = el }, h("div", { key: '7528885100be3d450ec52aafd6085a4c852710c8', class: 'twofa__error-message' }, h("p", { key: '51dab3f02156b5eb3b7408f06f2d359cfbda11a7' }, this.errorMessage)), h("div", { key: 'f336f89ecee0724663b1bbb4d443bb834336b5c1', class: "twofa__description", innerHTML: translate('twofaDescription', this.language, { values: { destination: this.destination } }) }), h("div", { key: '5127127ccc8e50428f8319fddc9e21606f3b4148', class: "twofa__input-wrapper", ref: this.setContainerRef }, this.code.map((_, idx) => {
240
+ return (h("div", { key: 'cd5396afccaf4016201281f5cc53898c0a2052ed', class: "twofa", ref: el => this.stylingContainer = el }, h("div", { key: '008dd54682a0d93190e9e5b2b49673262ed01763', class: 'twofa__error-message' }, h("p", { key: '41db51d6b396ccd1f3149e4473e96960e92d05ca' }, this.errorMessage)), h("div", { key: '67e9e4ac90cf95f2269e75b121ed220a02c5f139', class: "twofa__description", innerHTML: translate('twofaDescription', this.language, { values: { destination: this.destination } }) }), h("div", { key: '702c342eb7be0001ab8de310cadd7e8684a8025d', class: "twofa__input-wrapper", ref: this.setContainerRef }, this.code.map((_, idx) => {
273
241
  return (h("input", { key: idx, ref: el => this.setInputRef(el, idx), id: `otp-input-${idx}`, type: "text", maxLength: 2, value: this.getInputDisplayValue(idx), onInput: (event) => this.handleInput(event, idx), onKeyDown: (event) => this.handleKeyDown(event, idx), onPaste: (event) => this.handlePaste(event) }));
274
- })), h("div", { key: 'be82ae1192129d571275b78c8097c3023468cf3e', class: "twofa__button-wrapper" }, h("p", { key: '11de61d738ffa74bfd44f0d7c88fc4e456647d0c', class: "twofa__resend-message" }, translate('twofaResendMessage', this.language)), h("button", { key: '84d5c55c4d9bf024164ec52e2100cfcc8c236ac2', class: `twofa__resend-button ${this.pinAttemptsExceeded ? 'twofa__resend-button--disabled' : ''}`, onClick: this.resendCodeHandler, disabled: !this.isResendButtonAvailable || this.pinAttemptsExceeded }, this.isResendButtonAvailable
242
+ })), h("div", { key: '63564bd4a0442232f81058ba914ee86c537ce85a', class: "twofa__button-wrapper" }, h("p", { key: '219f5005c0d03189df48f05c5e0cd980eb0e1979', class: "twofa__resend-message" }, translate('twofaResendMessage', this.language)), h("button", { key: '12b7b4bc3ea165994f2c50107f406c64e708cf4d', class: `twofa__resend-button ${this.pinAttemptsExceeded ? 'twofa__resend-button--disabled' : ''}`, onClick: this.resendCodeHandler, disabled: !this.isResendButtonAvailable || this.pinAttemptsExceeded }, this.isResendButtonAvailable
275
243
  ? translate('twofaResendButton', this.language)
276
244
  : this.formatTime()))));
277
245
  }
@@ -545,7 +513,6 @@ export class TwofaInput {
545
513
  }
546
514
  static get states() {
547
515
  return {
548
- "limitStylingAppends": {},
549
516
  "isValid": {},
550
517
  "isResendButtonAvailable": {},
551
518
  "showTooltip": {},
@@ -638,12 +605,12 @@ export class TwofaInput {
638
605
  }, {
639
606
  "propName": "emitValue",
640
607
  "methodName": "emitValueHandler"
641
- }, {
642
- "propName": "clientStylingUrl",
643
- "methodName": "handleStylingUrlChange"
644
608
  }, {
645
609
  "propName": "clientStyling",
646
- "methodName": "handleStylingChange"
610
+ "methodName": "handleClientStylingChange"
611
+ }, {
612
+ "propName": "clientStylingUrl",
613
+ "methodName": "handleClientStylingChangeURL"
647
614
  }];
648
615
  }
649
616
  static get listeners() {