@everymatrix/general-registration 1.10.4 → 1.10.10

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 (35) hide show
  1. package/dist/cjs/checkbox-input_11.cjs.entry.js +1118 -487
  2. package/dist/cjs/general-registration.cjs.js +2 -2
  3. package/dist/cjs/{index-9a07d1e9.js → index-68f93e1e.js} +9 -5
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/components/general-registration/general-registration.css +40 -14
  6. package/dist/collection/components/general-registration/general-registration.js +153 -300
  7. package/dist/components/checkbox-input2.js +8 -2
  8. package/dist/components/date-input2.js +19 -1441
  9. package/dist/components/email-input2.js +28 -9
  10. package/dist/components/general-input2.js +6 -6
  11. package/dist/components/general-registration.js +112 -274
  12. package/dist/components/input-field-shared-styles.js +13776 -0
  13. package/dist/components/locale.utils.js +1 -1
  14. package/dist/components/number-input2.js +8 -2
  15. package/dist/components/password-input2.js +748 -9
  16. package/dist/components/pattern-mixin.js +84 -0
  17. package/dist/components/radio-input2.js +1 -1
  18. package/dist/components/select-input2.js +8 -4
  19. package/dist/components/tel-input2.js +22 -10
  20. package/dist/components/text-input2.js +27 -18
  21. package/dist/components/vaadin-button.js +1432 -0
  22. package/dist/components/vaadin-combo-box.js +3 -82
  23. package/dist/components/virtual-keyboard-controller.js +2136 -15909
  24. package/dist/esm/checkbox-input_11.entry.js +1118 -487
  25. package/dist/esm/general-registration.js +2 -2
  26. package/dist/esm/{index-0505440f.js → index-16916adb.js} +9 -5
  27. package/dist/esm/loader.js +2 -2
  28. package/dist/general-registration/general-registration.esm.js +1 -1
  29. package/dist/general-registration/p-8f644809.js +1 -0
  30. package/dist/general-registration/{p-6a27a1e0.entry.js → p-fb5bf415.entry.js} +210 -100
  31. package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +6 -4
  32. package/dist/types/components/general-registration/general-registration.d.ts +20 -284
  33. package/dist/types/components.d.ts +11 -17
  34. package/package.json +3 -2
  35. package/dist/general-registration/p-1a88a312.js +0 -1
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-9a07d1e9.js');
5
+ const index = require('./index-68f93e1e.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE$1 = 'en';
8
8
  const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
9
9
  const TRANSLATIONS$1 = {
10
10
  en: {
11
11
  dateError: 'The selected date should be between {min} and {max}',
12
- numberLengthError: 'The number should be between ${min} and ${max}',
12
+ numberLengthError: 'The number should be between {min} and {max}',
13
13
  lengthError: `The length should be between {minLength} and {maxLength}`,
14
14
  requiredError: 'This input is required.',
15
15
  nextButton: 'Next',
@@ -33,7 +33,7 @@ const translate$2 = (key, customLang, values) => {
33
33
  return translation;
34
34
  };
35
35
 
36
- 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}";
36
+ const checkboxInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.checkbox{font-family:\"Roboto\";font-style:normal}.checkbox__wrapper{display:flex;gap:10px;position:relative;align-items:baseline}.checkbox__label{font-style:inherit;font-family:inherit;font-weight:400;font-size:16px;color:#2B2D3F;line-height:14px}.checkbox__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}";
37
37
 
38
38
  const CheckboxInput = class {
39
39
  constructor(hostRef) {
@@ -62,6 +62,12 @@ const CheckboxInput = class {
62
62
  valueHandler(inputValueEvent) {
63
63
  this.sendInputValue.emit(inputValueEvent);
64
64
  }
65
+ componentDidLoad() {
66
+ if (this.defaultValue) {
67
+ this.value = this.defaultValue;
68
+ this.valueHandler({ name: this.name, value: this.value });
69
+ }
70
+ }
65
71
  handleClick() {
66
72
  this.value = this.inputReference.checked.toString();
67
73
  this.errorMessage = this.setErrorMessage();
@@ -78,7 +84,7 @@ const CheckboxInput = class {
78
84
  }
79
85
  }
80
86
  render() {
81
- return index.h("div", { class: 'checkbox__wrapper' }, index.h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, checked: !!this.defaultValue, readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), index.h("label", { htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.h("small", { class: 'checkbox__error-message' }, this.errorMessage));
87
+ return index.h("div", { class: 'checkbox__wrapper' }, index.h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, checked: !!this.defaultValue, readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), index.h("label", { class: 'checkbox__label', htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.h("small", { class: 'checkbox__error-message' }, this.errorMessage));
82
88
  }
83
89
  static get watchers() { return {
84
90
  "isValid": ["validityChanged"],
@@ -101,7 +107,7 @@ CheckboxInput.style = checkboxInputCss;
101
107
  */
102
108
  class Lumo extends HTMLElement {
103
109
  static get version() {
104
- return '23.3.13';
110
+ return '23.3.14';
105
111
  }
106
112
  }
107
113
 
@@ -12974,7 +12980,7 @@ const registered = new Set();
12974
12980
  const ElementMixin = (superClass) =>
12975
12981
  class VaadinElementMixin extends DirMixin(superClass) {
12976
12982
  static get version() {
12977
- return '23.3.13';
12983
+ return '23.3.14';
12978
12984
  }
12979
12985
 
12980
12986
  /** @protected */
@@ -16272,7 +16278,7 @@ registerStyles('vaadin-date-picker-overlay', datePickerOverlayStyles, {
16272
16278
  moduleId: 'vaadin-date-picker-overlay-styles',
16273
16279
  });
16274
16280
 
16275
- let memoizedTemplate$1;
16281
+ let memoizedTemplate$2;
16276
16282
 
16277
16283
  /**
16278
16284
  * An element used internally by `<vaadin-date-picker>`. Not intended to be used separately.
@@ -16286,12 +16292,12 @@ class DatePickerOverlay extends DisableUpgradeMixin(PositionMixin(Overlay)) {
16286
16292
  }
16287
16293
 
16288
16294
  static get template() {
16289
- if (!memoizedTemplate$1) {
16290
- memoizedTemplate$1 = super.template.cloneNode(true);
16291
- memoizedTemplate$1.content.querySelector('[part~="overlay"]').removeAttribute('tabindex');
16295
+ if (!memoizedTemplate$2) {
16296
+ memoizedTemplate$2 = super.template.cloneNode(true);
16297
+ memoizedTemplate$2.content.querySelector('[part~="overlay"]').removeAttribute('tabindex');
16292
16298
  }
16293
16299
 
16294
- return memoizedTemplate$1;
16300
+ return memoizedTemplate$2;
16295
16301
  }
16296
16302
  }
16297
16303
 
@@ -23029,7 +23035,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
23029
23035
 
23030
23036
  customElements.define(DatePicker.is, DatePicker);
23031
23037
 
23032
- 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;position:relative;border:none;border-bottom:3px solid #666666;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}";
23038
+ const dateInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.date{font-family:\"Roboto\";font-style:normal}.date__wrapper{position:relative;width:100%;padding-top:26px}.date__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F;position:absolute;top:0;left:0}.date__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;margin-left:2px}.date__input{border:none;width:inherit;position:relative}.date__input[focused]::part(input-field){border-color:#3E3E3E}.date__input[invalid]::part(input-field){border-color:#cc0000b3}.date__input::part(input-field){border-radius:4px;background-color:#FFFFFF;border:2px solid #DEE1EE;color:#2A2E3F;border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px}.date__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}";
23033
23039
 
23034
23040
  const DateInput = class {
23035
23041
  constructor(hostRef) {
@@ -23056,6 +23062,10 @@ const DateInput = class {
23056
23062
  }
23057
23063
  componentDidLoad() {
23058
23064
  this.inputReference = this.element.shadowRoot.querySelector('input');
23065
+ if (this.defaultValue) {
23066
+ this.value = this.defaultValue;
23067
+ this.valueHandler({ name: this.name, value: this.value });
23068
+ }
23059
23069
  }
23060
23070
  handleInput(event) {
23061
23071
  this.value = event.target.value;
@@ -23076,7 +23086,8 @@ const DateInput = class {
23076
23086
  }
23077
23087
  }
23078
23088
  render() {
23079
- return index.h("div", { class: 'date__wrapper' }, index.h("vaadin-date-picker", { id: `${this.name}__input`, type: 'date', class: `date__input`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onBlur: (e) => this.handleInput(e) }), index.h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.h("small", { class: 'date__error-message' }, this.errorMessage));
23089
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'date__input--invalid';
23090
+ return index.h("div", { class: 'date__wrapper' }, index.h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.h("vaadin-date-picker", { id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onBlur: (e) => this.handleInput(e) }), index.h("small", { class: 'date__error-message' }, this.errorMessage));
23080
23091
  }
23081
23092
  get element() { return index.getElement(this); }
23082
23093
  static get watchers() { return {
@@ -23086,7 +23097,7 @@ const DateInput = class {
23086
23097
  };
23087
23098
  DateInput.style = dateInputCss;
23088
23099
 
23089
- 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}";
23100
+ 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%;padding-top:26px}.email__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F;position:absolute;top:0;left:0}.email__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;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:8px 20px;width:inherit;position:relative;border:2px solid #DEE1EE}.email__input:focus{outline-color:#3E3E3E}.email__input--invalid{border:2px solid #cc0000b3}.email__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}";
23090
23101
 
23091
23102
  const EmailInput = class {
23092
23103
  constructor(hostRef) {
@@ -23101,20 +23112,33 @@ const EmailInput = class {
23101
23112
  this.valueHandler({ name: this.name, value: this.value });
23102
23113
  }
23103
23114
  }
23104
- validityStateHandler(inputStateEvent) {
23105
- this.sendValidityState.emit(inputStateEvent);
23106
- }
23107
23115
  emitValueHandler(newValue) {
23108
23116
  if (newValue == true && this.isValid) {
23109
23117
  this.valueHandler({ name: this.name, value: this.value });
23110
23118
  }
23111
23119
  }
23120
+ validityStateHandler(inputStateEvent) {
23121
+ this.sendValidityState.emit(inputStateEvent);
23122
+ }
23112
23123
  valueHandler(inputValueEvent) {
23113
23124
  this.sendInputValue.emit(inputValueEvent);
23114
23125
  }
23126
+ valueChangedHandler(event) {
23127
+ if (this.isDuplicateInput) {
23128
+ if (this.name === event.detail.name + 'Duplicate') {
23129
+ this.duplicateInputValue = event.detail.value;
23130
+ }
23131
+ }
23132
+ }
23115
23133
  connectedCallback() {
23116
23134
  this.validationPattern = this.setPattern();
23117
23135
  }
23136
+ componentDidLoad() {
23137
+ if (this.defaultValue) {
23138
+ this.value = this.defaultValue;
23139
+ this.valueHandler({ name: this.name, value: this.value });
23140
+ }
23141
+ }
23118
23142
  handleInput(event) {
23119
23143
  this.value = event.target.value;
23120
23144
  this.errorMessage = this.setErrorMessage();
@@ -23126,14 +23150,15 @@ const EmailInput = class {
23126
23150
  return this.inputReference.validity.valid;
23127
23151
  }
23128
23152
  setPattern() {
23129
- var _a;
23153
+ var _a, _b;
23130
23154
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
23131
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
23155
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
23132
23156
  }
23133
23157
  }
23134
23158
  setErrorMessage() {
23159
+ var _a;
23135
23160
  if (this.inputReference.validity.patternMismatch) {
23136
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
23161
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
23137
23162
  }
23138
23163
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
23139
23164
  return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -23141,9 +23166,13 @@ const EmailInput = class {
23141
23166
  if (this.inputReference.validity.valueMissing) {
23142
23167
  return translate$2('requiredError', this.language);
23143
23168
  }
23169
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
23170
+ return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
23171
+ }
23144
23172
  }
23145
23173
  render() {
23146
- return index.h("div", { class: 'email__wrapper' }, index.h("input", { id: `${this.name}__input`, type: 'email', class: `email__input`, value: this.defaultValue, readOnly: this.autofilled, 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, onBlur: (e) => this.handleInput(e) }), index.h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'email__error-message' }, this.errorMessage));
23174
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'email__input--invalid';
23175
+ return index.h("div", { class: 'email__wrapper' }, index.h("input", { id: `${this.name}__input`, type: 'email', class: `email__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, 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, onBlur: (e) => this.handleInput(e) }), index.h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'email__error-message' }, this.errorMessage));
23147
23176
  }
23148
23177
  static get watchers() { return {
23149
23178
  "isValid": ["validityChanged"],
@@ -23165,9 +23194,9 @@ const GeneralInput = class {
23165
23194
  render() {
23166
23195
  switch (this.type.toLowerCase()) {
23167
23196
  case 'text':
23168
- return index.h("text-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language });
23197
+ return index.h("text-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, isDuplicateInput: this.isDuplicateInput });
23169
23198
  case 'email':
23170
- return index.h("email-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language });
23199
+ return index.h("email-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, isDuplicateInput: this.isDuplicateInput });
23171
23200
  case 'number':
23172
23201
  return index.h("number-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language });
23173
23202
  case 'checkbox':
@@ -23175,7 +23204,7 @@ const GeneralInput = class {
23175
23204
  case 'datetime':
23176
23205
  return index.h("date-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language });
23177
23206
  case 'password':
23178
- return index.h("password-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language });
23207
+ return index.h("password-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, isDuplicateInput: this.isDuplicateInput });
23179
23208
  case 'radio':
23180
23209
  return index.h("radio-input", { name: this.name, displayName: this.displayName, optionsGroup: this.options, validation: this.validation, emitValue: this.emitValue, language: this.language });
23181
23210
  case 'tel':
@@ -23183,7 +23212,6 @@ const GeneralInput = class {
23183
23212
  case 'dropdown':
23184
23213
  return index.h("select-input", { name: this.name, action: this.action, defaultValue: this.defaultValue, displayName: this.displayName, options: this.options, validation: this.validation, emitValue: this.emitValue, autofilled: this.autofilled, language: this.language });
23185
23214
  default:
23186
- // Nothing here
23187
23215
  return index.h("p", null, "The ", this.type, " input type is not valid");
23188
23216
  }
23189
23217
  }
@@ -23195,7 +23223,7 @@ const SUPPORTED_LANGUAGES = ['ro', 'en'];
23195
23223
  const TRANSLATIONS = {
23196
23224
  en: {
23197
23225
  dateError: 'The selected date should be between {min} and {max}',
23198
- numberLengthError: 'The number should be between ${min} and ${max}',
23226
+ numberLengthError: 'The number should be between {min} and {max}',
23199
23227
  lengthError: `The length should be between {minLength} and {maxLength}`,
23200
23228
  requiredError: 'This input is required.',
23201
23229
  nextButton: 'Next',
@@ -23219,238 +23247,54 @@ const translate = (key, customLang, values) => {
23219
23247
  return translation;
23220
23248
  };
23221
23249
 
23222
- const generalRegistrationCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.registration{display:flex;flex-direction:column;gap:20px;width:100%;height:100%}.registration__form{display:grid;grid-template-columns:repeat(2, minmax(min-content, 1fr));column-gap:65px;row-gap:30px;justify-items:stretch;align-content:flex-start;overflow:scroll;width:100%;height:100%}.registration__buttons-wrapper{display:flex;flex-direction:row-reverse;justify-content:space-between}.registration__button{background-color:#e69200;border-radius:30px;text-transform:uppercase;padding:10px 50px;border:none;box-shadow:0px 2px 2px rgba(0, 0, 0, 0.5)}.registration__button--disabled{background-color:grey}.registration__button--done{background-color:#176317}";
23250
+ const generalRegistrationCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n.registration {\n font-family: \"Roboto\";\n font-style: normal;\n font-family: sans-serif;\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n height: 100%;\n container-type: inline-size;\n}\n.registration__form {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n gap: 40px;\n justify-items: stretch;\n align-content: flex-start;\n overflow: auto;\n width: 100%;\n height: 100%;\n}\n.registration__buttons-wrapper {\n display: flex;\n flex-direction: row-reverse;\n justify-content: space-around;\n align-items: center;\n}\n.registration__button {\n text-transform: uppercase;\n width: 250px;\n height: 40px;\n border-radius: 3px;\n}\n.registration__button:hover {\n opacity: 0.8;\n}\n.registration__button:active {\n opacity: 1;\n}\n.registration__button--next {\n color: #FFFFFF;\n background-color: #B0B0B0;\n border: none;\n}\n.registration__button--back {\n color: #B0B0B0;\n background-color: #FFFFFF;\n border: 2px solid #B0B0B0;\n}\n.registration__button--first-step {\n display: none;\n}\n\n@container (min-width: 450px) {\n .registration__form {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .registration__buttons-wrapper {\n flex-direction: column;\n gap: 15px;\n }\n}";
23223
23251
 
23224
23252
  const GeneralRegistration = class {
23225
23253
  constructor(hostRef) {
23226
23254
  index.registerInstance(this, hostRef);
23227
- this.data = {
23228
- "type": "default",
23229
- "content": {
23230
- "step": "step1",
23231
- "fields": [
23232
- {
23233
- "name": "firstName",
23234
- "displayName": "Username",
23235
- "defaultValue": null,
23236
- "validate": {
23237
- "mandatory": true,
23238
- "minLength": 3,
23239
- "maxLength": 20
23240
- },
23241
- "autofill": false
23242
- },
23243
- {
23244
- "name": "lastName",
23245
- "displayName": "Last name",
23246
- "defaultValue": null,
23247
- "validate": {
23248
- "mandatory": true,
23249
- "minLength": 3,
23250
- "maxLength": 20
23251
- },
23252
- },
23253
- {
23254
- "name": "telephone",
23255
- "displayName": "Telephone",
23256
- "action": "GET https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes",
23257
- "defaultValue": null,
23258
- "validate": {
23259
- "mandatory": true
23260
- },
23261
- "autofill": false,
23262
- "inputType": "tel"
23263
- },
23264
- {
23265
- "name": "dateOfBirth",
23266
- "displayName": "Date of Birth",
23267
- "defaultValue": null,
23268
- "validate": {
23269
- "min": "2022-05-01",
23270
- "max": "2022-05-29",
23271
- "mandatory": true,
23272
- },
23273
- "inputType": "datetime"
23274
- },
23275
- {
23276
- "name": "email",
23277
- "displayName": "Email",
23278
- "defaultValue": 'a@a.com',
23279
- "validate": {
23280
- "mandatory": true,
23281
- "custom": [
23282
- {
23283
- "rule": "regex",
23284
- "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z-9.-]+\\.[a-zA-Z]{2,3}$",
23285
- "errorMessage": "Please enter a valid email address"
23286
- }
23287
- ]
23288
- },
23289
- "inputType": "email"
23290
- },
23291
- {
23292
- "name": "password",
23293
- "displayName": "Password",
23294
- "defaultValue": null,
23295
- "validate": {
23296
- "mandatory": true,
23297
- "minLength": 3,
23298
- "maxLength": 20,
23299
- "type": "password",
23300
- "custom": [
23301
- {
23302
- "rule": "regex",
23303
- "pattern": "(?=.*\\d+)(?=.*[A-Za-z]+).{8,20}",
23304
- "errorMessage": "Password must contain at least 1 letter and 1 digit, and its minimal length is 8."
23305
- }
23306
- ]
23307
- },
23308
- "inputType": "password"
23309
- },
23310
- {
23311
- "name": "email",
23312
- "displayName": "Email",
23313
- "defaultValue": null,
23314
- "validate": {
23315
- "mandatory": true,
23316
- "type": "email",
23317
- "custom": [
23318
- {
23319
- "rule": "unique-email",
23320
- "errorMessage": "Please check your email"
23321
- },
23322
- {
23323
- "rule": "regex",
23324
- "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z-9.-]+\\.[a-zA-Z]{2,3}$",
23325
- "errorMessage": "Please enter a valid email address"
23326
- },
23327
- {
23328
- "rule": "duplicate-input",
23329
- "displayName": "pt al doilea input gen: Confirm Email",
23330
- "errorMessage": "Different Email! Pls."
23331
- }
23332
- ]
23333
- }
23334
- },
23335
- {
23336
- "name": "termsAndConditions",
23337
- "displayName": "Terms and Conditions",
23338
- "validate": {
23339
- "mandatory": true,
23340
- "type": "boolean"
23341
- },
23342
- "inputType": "checkbox"
23343
- },
23344
- {
23345
- "name": "pepCheck",
23346
- "validate": {
23347
- "mandatory": true
23348
- },
23349
- "inputType": "checkbox"
23350
- },
23351
- {
23352
- "name": "gender",
23353
- "data": {
23354
- "values": [
23355
- {
23356
- "label": "🍆",
23357
- "value": "m"
23358
- },
23359
- {
23360
- "label": "🍑",
23361
- "value": "f"
23362
- }
23363
- ]
23364
- },
23365
- "validate": {
23366
- "mandatory": true
23367
- },
23368
- "inputType": "radio"
23369
- },
23370
- {
23371
- "name": "dateOfBirth",
23372
- "validate": {
23373
- "mandatory": true,
23374
- "custom": [
23375
- {
23376
- "rule": "regex",
23377
- "pattern": "(?:19\\d{2}|20[01][0-9]|2020)[-/.](?:0[1-9]|1[012])[-/.](?:0[1-9]|[12][0-9]|3[01])",
23378
- "errorMessage": "Invalid date format"
23379
- },
23380
- {
23381
- "rule": "min-18-years",
23382
- "errorMessage": "Not old enough to ride the roller coaster"
23383
- }
23384
- ]
23385
- }
23386
- },
23387
- {
23388
- "name": "city",
23389
- "displayName": "Cities",
23390
- "action": null,
23391
- "data": {
23392
- "values": [
23393
- {
23394
- "label": "Budapest",
23395
- "value": "Budapest"
23396
- },
23397
- {
23398
- "label": "Debrecen",
23399
- "value": "Debrecen"
23400
- },
23401
- {
23402
- "label": "Miskolc",
23403
- "value": "Miskolc"
23404
- },
23405
- {
23406
- "label": "Szeged",
23407
- "value": "Szeged"
23408
- },
23409
- {
23410
- "label": "Zuglo",
23411
- "value": "Zuglo"
23412
- }
23413
- ]
23414
- },
23415
- "validate": {
23416
- "mandatory": true
23417
- },
23418
- "inputType": "dropdown"
23419
- },
23420
- {
23421
- "name": "city",
23422
- "displayName": "Cities",
23423
- "data": null,
23424
- "action": "GET https://demo-api.stage.norway.everymatrix.com/v1/player/countries",
23425
- "validate": {
23426
- "mandatory": true
23427
- },
23428
- "inputType": "dropdown"
23429
- }
23430
- ],
23431
- "actions": [
23432
- "get-next-step",
23433
- "some-async-action-before-submitting",
23434
- "submit-step-data"
23435
- ]
23436
- }
23437
- };
23255
+ this.registrationWidgetLoaded = index.createEvent(this, "registrationWidgetLoaded", 7);
23256
+ this.registrationStepUpdated = index.createEvent(this, "registrationStepUpdated", 7);
23438
23257
  /**
23439
23258
  * Currently selected language
23440
23259
  */
23441
23260
  this.language = 'en';
23261
+ /**
23262
+ * Client custom styling via string
23263
+ */
23264
+ this.clientStyling = '';
23265
+ /**
23266
+ * Client custom styling via url content
23267
+ */
23268
+ this.clientStylingUrl = '';
23442
23269
  this.emitValue = false;
23443
23270
  this.listOfInputs = [];
23444
23271
  this.isLoading = true;
23272
+ this.limitStylingAppends = false;
23445
23273
  this.listOfInputValues = [];
23446
23274
  this.listOfActions = [];
23447
- this.steps = [];
23275
+ this.indexStep = 0;
23448
23276
  this.registrationStepsState = {
23449
23277
  regId: null
23450
23278
  };
23279
+ this.setClientStyling = () => {
23280
+ let sheet = document.createElement('style');
23281
+ sheet.innerHTML = this.clientStyling;
23282
+ this.stylingContainer.prepend(sheet);
23283
+ };
23284
+ this.setClientStylingURL = () => {
23285
+ let url = new URL(this.clientStylingUrl);
23286
+ let cssFile = document.createElement('style');
23287
+ fetch(url.href)
23288
+ .then((res) => res.text())
23289
+ .then((data) => {
23290
+ cssFile.innerHTML = data;
23291
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
23292
+ });
23293
+ };
23451
23294
  }
23452
- logger() {
23453
- console.log(this.registrationStep);
23295
+ sendStep() {
23296
+ this.registrationStepUpdated.emit(this.registrationStep);
23297
+ window.postMessage({ type: 'registrationStepUpdated', step: this.registrationStep }, window.location.href);
23454
23298
  }
23455
23299
  checkInputsValidityHandler(event) {
23456
23300
  // Set isValid state of the input in the list.
@@ -23459,25 +23303,30 @@ const GeneralRegistration = class {
23459
23303
  this.isFormValid = !this.getInvalidStatus(this.listOfInputs);
23460
23304
  }
23461
23305
  getInputsValueHandler(event) {
23462
- this.listOfInputValues.find(input => input.name == event.detail.name).value = event.detail.value;
23463
- /*Note to self: -- what about the inputs that received a default value.
23464
- They will send an undefined because there was no input
23465
- Handle it somehow!!!!!, one idea can be that value equals defaultValue but dependes on how the api wants stuff*/
23306
+ this.listOfInputValues.find(input => {
23307
+ if (input.name == event.detail.name) {
23308
+ input.value = event.detail.value;
23309
+ }
23310
+ });
23466
23311
  this.stepsStateMachine({ event: 'set', type: 'values' });
23467
23312
  }
23468
23313
  componentWillLoad() {
23469
- // const mockCall = Promise.resolve(this.data);
23470
- // return mockCall.then((data) => {
23471
- // this.listOfInputs = data.content.fields.map((field) => {
23472
- // this.isLoading = false;
23473
- // return { ...field, isValid: false };
23474
- // });
23475
- // });
23476
23314
  return this.getRegisterConfig().then((config) => {
23477
23315
  this.formatConfig(config);
23478
23316
  this.stepsStateMachine({ event: 'set', type: 'inputs' });
23479
23317
  });
23480
23318
  }
23319
+ componentDidRender() {
23320
+ if (!this.limitStylingAppends && this.stylingContainer) {
23321
+ this.setClientStyling();
23322
+ this.setClientStylingURL();
23323
+ this.limitStylingAppends = true;
23324
+ }
23325
+ }
23326
+ componentDidLoad() {
23327
+ this.registrationWidgetLoaded.emit();
23328
+ window.postMessage({ type: 'registrationWidgetLoaded' }, window.location.href);
23329
+ }
23481
23330
  nextHandler(e) {
23482
23331
  e.preventDefault();
23483
23332
  // Trigger events in subwidgets.
@@ -23486,8 +23335,8 @@ const GeneralRegistration = class {
23486
23335
  }
23487
23336
  backHandler(e) {
23488
23337
  e.preventDefault();
23489
- this.steps.pop();
23490
- this.registrationStep = this.steps.at(-1);
23338
+ this.isLastStep = false;
23339
+ this.registrationStep = this.stepChange('decrement');
23491
23340
  this.stepsStateMachine({ event: 'get', type: 'inputs' });
23492
23341
  this.stepsStateMachine({ event: 'get', type: 'values' });
23493
23342
  }
@@ -23496,13 +23345,11 @@ const GeneralRegistration = class {
23496
23345
  case 'set':
23497
23346
  if (state.type == 'inputs') {
23498
23347
  this.registrationStepsState[this.registrationStep].fields = this.listOfInputs;
23348
+ this.registrationStepsState[this.registrationStep].actions = this.listOfActions;
23499
23349
  }
23500
23350
  if (state.type == 'values') {
23501
23351
  this.registrationStepsState[this.registrationStep].registerUserData = this.listOfInputValues.reduce((acc, curr) => {
23502
- // @TODO remove this once GMCore is smart enough to understand the concept of UNIQUE KEYS
23503
- if (curr.value != null) {
23504
- acc[curr.name] = curr.value;
23505
- }
23352
+ acc[curr.name] = { value: curr.value, isDuplicate: curr.isDuplicate };
23506
23353
  return acc;
23507
23354
  }, {});
23508
23355
  }
@@ -23514,17 +23361,19 @@ const GeneralRegistration = class {
23514
23361
  return;
23515
23362
  if (state.type == 'inputs') {
23516
23363
  this.listOfInputs = this.registrationStepsState[this.registrationStep].fields;
23364
+ this.listOfActions = this.registrationStepsState[this.registrationStep].actions;
23517
23365
  }
23518
23366
  if (state.type == 'values') {
23519
23367
  const savedValues = savedUserData[this.registrationStep].registerUserData;
23520
23368
  this.listOfInputValues = Object.keys(savedValues).map(name => {
23521
- return { name, value: savedValues[name] };
23369
+ return { name, value: savedValues[name].value, isDuplicate: savedValues[name].isDuplicate };
23522
23370
  });
23523
23371
  // Give to each field the user input as the default value.
23524
23372
  this.listOfInputValues.forEach(inputValue => {
23525
23373
  const input = this.listOfInputs.find(input => input.name === inputValue.name);
23526
23374
  if (input) {
23527
23375
  input.defaultValue = inputValue.value;
23376
+ console.log(input);
23528
23377
  }
23529
23378
  });
23530
23379
  }
@@ -23534,9 +23383,6 @@ const GeneralRegistration = class {
23534
23383
  getRegisterConfig(registrationID) {
23535
23384
  const url = new URL(`${this.endpoint}/v1/player/legislation/registration/config`);
23536
23385
  const headers = new Headers();
23537
- // headers.append('X-Tenant-ID', this.tenantId);
23538
- // headers.append('X-Client-ID', this.clientId);
23539
- // headers.append('X-Api-Key', this.apiKey);
23540
23386
  headers.append('Content-Type', 'application/json');
23541
23387
  headers.append('Accept', 'application/json');
23542
23388
  if (registrationID) {
@@ -23565,9 +23411,15 @@ const GeneralRegistration = class {
23565
23411
  const url = new URL(`${this.endpoint}/v1/player/legislation/registration/step`);
23566
23412
  const registerStep = {
23567
23413
  registrationId: this.registrationID,
23568
- registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
23569
- // @TODO remove this once GMCore is smart enough to understand the concept of UNIQUE KEYS
23570
- if (curr.value != null) {
23414
+ registerUserDto: this.listOfInputValues
23415
+ .filter(input => !input.isDuplicate)
23416
+ .reduce((acc, curr) => {
23417
+ // Special case for "Mobile" as it needs to be split in two values -- API expects it this way.
23418
+ if (curr.name == "Mobile") {
23419
+ acc['MobilePrefix'] = curr.value.split('|')[0];
23420
+ acc[curr.name] = curr.value.split('|')[1];
23421
+ }
23422
+ else {
23571
23423
  acc[curr.name] = curr.value;
23572
23424
  }
23573
23425
  return acc;
@@ -23575,9 +23427,6 @@ const GeneralRegistration = class {
23575
23427
  step: this.registrationStep,
23576
23428
  };
23577
23429
  const headers = new Headers();
23578
- // headers.append('X-Tenant-ID', this.tenantId);
23579
- // headers.append('X-Client-ID', this.clientId);
23580
- // headers.append('X-Api-Key', this.apiKey);
23581
23430
  headers.append('Content-Type', 'application/json');
23582
23431
  headers.append('Accept', 'application/json');
23583
23432
  const options = {
@@ -23598,12 +23447,22 @@ const GeneralRegistration = class {
23598
23447
  this.setRegister();
23599
23448
  }
23600
23449
  else {
23601
- this.getRegisterConfig(this.registrationID).then((config) => {
23602
- // Format the new step config.
23603
- this.formatConfig(config);
23604
- // Set it in local storage
23605
- this.stepsStateMachine({ event: 'set', type: 'inputs' });
23606
- });
23450
+ // After sending the current step, increment and check if the next one is in state.
23451
+ this.registrationStep = this.stepChange('increment');
23452
+ // If step is present in state do NOT fetch the next config.
23453
+ if (Object.keys(this.registrationStepsState).find(key => key == this.registrationStep)) {
23454
+ // Use the one from state
23455
+ this.stepsStateMachine({ event: 'get', type: 'inputs' });
23456
+ this.stepsStateMachine({ event: 'get', type: 'values' });
23457
+ }
23458
+ else {
23459
+ this.getRegisterConfig(this.registrationID).then((config) => {
23460
+ // Format the new step config.
23461
+ this.formatConfig(config);
23462
+ // Set it in local storage.
23463
+ this.stepsStateMachine({ event: 'set', type: 'inputs' });
23464
+ });
23465
+ }
23607
23466
  }
23608
23467
  })
23609
23468
  .catch((err) => {
@@ -23617,19 +23476,8 @@ const GeneralRegistration = class {
23617
23476
  this.isLoading = true;
23618
23477
  const url = new URL(`${this.endpoint}/v1/player/legislation/register`);
23619
23478
  const headers = new Headers();
23620
- // headers.append('X-Tenant-ID', this.tenantId);
23621
- // headers.append('X-Client-ID', this.clientId);
23622
- // headers.append('X-Api-Key', this.apiKey);
23623
23479
  headers.append('Content-Type', 'application/json');
23624
23480
  headers.append('Accept', 'application/json');
23625
- // const registerStep = {
23626
- // registrationId: this.registrationID,
23627
- // registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
23628
- // acc[curr.name] = curr.value;
23629
- // return acc;
23630
- // }, {}),
23631
- // step: this.registrationStep,
23632
- // };
23633
23481
  const options = {
23634
23482
  method: 'PUT',
23635
23483
  body: JSON.stringify({ registrationId: this.registrationID }),
@@ -23656,51 +23504,69 @@ const GeneralRegistration = class {
23656
23504
  }
23657
23505
  formatConfig(config) {
23658
23506
  // Populate the list of inputs and set as invalid in the beginning
23659
- this.listOfInputs = config.content.fields.map((field) => {
23660
- return Object.assign(Object.assign({}, field), { isValid: false });
23507
+ this.listOfInputs = config.content.fields.flatMap((field) => {
23508
+ // Special case for inputs that need to be duplicated.
23509
+ const duplicateInputRule = field.validate.custom.find(customRule => customRule.rule === 'duplicate-input');
23510
+ const inputElement = Object.assign(Object.assign({}, field), { isValid: false });
23511
+ if (duplicateInputRule) {
23512
+ const duplicateInput = Object.assign(Object.assign({}, field), { name: `${field.name}Duplicate`, displayName: duplicateInputRule.displayName, isValid: false, isDuplicateInput: true });
23513
+ return [inputElement, duplicateInput];
23514
+ }
23515
+ else {
23516
+ return [inputElement];
23517
+ }
23661
23518
  });
23662
23519
  // Populate the list of inputs values and set as null in the beginning
23663
- this.listOfInputValues = config.content.fields.map(field => {
23664
- return { name: field.name, value: null };
23520
+ this.listOfInputValues = this.listOfInputs.map(field => {
23521
+ return { name: field.name, value: null, isDuplicate: field.isDuplicateInput || false };
23665
23522
  });
23666
23523
  // Set the list of actions
23667
23524
  this.listOfActions = config.content.actions.map(action => action);
23668
23525
  this.isLastStep = this.listOfActions.some(action => action == '/register');
23669
23526
  this.registrationID = config.content.registrationID;
23670
23527
  this.registrationStep = config.content.step;
23671
- this.steps.push(this.registrationStep);
23672
23528
  // Add the step to the registrationStepsData
23673
23529
  this.registrationStepsState.regId = this.registrationID;
23674
23530
  if (!this.registrationStepsState[this.registrationStep]) {
23675
23531
  this.registrationStepsState[this.registrationStep] = {
23676
23532
  fields: [],
23677
- registerUserData: {}
23533
+ registerUserData: {},
23534
+ actions: []
23678
23535
  };
23679
23536
  }
23680
23537
  }
23538
+ stepChange(action) {
23539
+ const stepNum = parseInt(this.registrationStep.replace('Step', ''));
23540
+ if (action === 'increment') {
23541
+ return 'Step' + (stepNum + 1);
23542
+ }
23543
+ if (action === 'decrement') {
23544
+ return 'Step' + (stepNum - 1);
23545
+ }
23546
+ }
23681
23547
  getInvalidStatus(listOfInputs) {
23682
23548
  return listOfInputs.filter(input => input.isValid == false).length > 0;
23683
23549
  }
23684
23550
  renderInputs() {
23685
- return (this.listOfInputs.map(input => index.h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data ? input.data.values : [], defaultValue: input.defaultValue, autofilled: input.autofill, emitValue: this.emitValue, language: this.language })));
23551
+ return (this.listOfInputs.map(input => index.h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data ? input.data.values : [], defaultValue: input.defaultValue, autofilled: input.autofill, emitValue: this.emitValue, language: this.language, isDuplicateInput: input.isDuplicateInput })));
23686
23552
  }
23687
23553
  ;
23688
23554
  renderButtons() {
23689
- return (index.h("div", { class: 'registration__buttons-wrapper' }, index.h("button", { class: `registration__button ${this.isLastStep ? 'registration__button--done' : ''}`, type: 'submit', form: 'RegistrationForm', onClick: (e) => this.nextHandler(e) }, this.isLastStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), this.registrationStep !== 'Step1' && index.h("button", { class: 'registration__button', onClick: (e) => this.backHandler(e) }, translate('backButton', this.language))));
23555
+ return (index.h("div", { class: 'registration__buttons-wrapper' }, index.h("button", { class: `registration__button registration__button--next`, type: 'submit', form: 'RegistrationForm', onClick: (e) => this.nextHandler(e) }, this.isLastStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), index.h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language))));
23690
23556
  }
23691
23557
  render() {
23692
23558
  if (this.isLoading) {
23693
23559
  return index.h("p", null, "Please wait, loading ...");
23694
23560
  }
23695
- return (index.h("div", { class: 'registration' }, index.h("form", { action: '.', id: 'RegistrationForm', class: 'registration__form' }, this.renderInputs()), this.renderButtons()));
23561
+ return (index.h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el }, index.h("form", { action: '.', id: 'RegistrationForm', class: 'registration__form' }, this.renderInputs()), this.renderButtons()));
23696
23562
  }
23697
23563
  static get watchers() { return {
23698
- "registrationStep": ["logger"]
23564
+ "registrationStep": ["sendStep"]
23699
23565
  }; }
23700
23566
  };
23701
23567
  GeneralRegistration.style = generalRegistrationCss;
23702
23568
 
23703
- 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}";
23569
+ const numberInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.number{font-family:\"Roboto\";font-style:normal}.number__wrapper{position:relative;width:100%;padding-top:26px}.number__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F;position:absolute;top:0;left:0}.number__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;margin-left:2px}.number__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:8px 20px;width:inherit;position:relative;border:2px solid #DEE1EE;-moz-appearance:textfield;}.number__input:focus{outline-color:#3E3E3E}.number__input::-webkit-outer-spin-button,.number__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.number__input--invalid{border:2px solid #cc0000b3}.number__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}";
23704
23570
 
23705
23571
  const NumberInput = class {
23706
23572
  constructor(hostRef) {
@@ -23725,6 +23591,12 @@ const NumberInput = class {
23725
23591
  valueHandler(inputValueEvent) {
23726
23592
  this.sendInputValue.emit(inputValueEvent);
23727
23593
  }
23594
+ componentDidLoad() {
23595
+ if (this.defaultValue) {
23596
+ this.value = this.defaultValue;
23597
+ this.valueHandler({ name: this.name, value: this.value });
23598
+ }
23599
+ }
23728
23600
  handleInput(event) {
23729
23601
  this.value = event.target.value;
23730
23602
  this.errorMessage = this.setErrorMessage();
@@ -23754,99 +23626,915 @@ const NumberInput = class {
23754
23626
  };
23755
23627
  NumberInput.style = numberInputCss;
23756
23628
 
23757
- const passwordInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.password__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)}.password__label--required::after{content:\"*\";margin-left:5px;color:#666666}.password__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}.password__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.password__input::placeholder{color:#666666}.password__input--invalid{border-bottom:3px solid #cc0000}.password__input:placeholder-shown+.password__label{opacity:0;visibility:hidden;transform:translateY(0)}.password__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";
23629
+ /**
23630
+ * @license
23631
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
23632
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
23633
+ */
23634
+
23635
+ registerStyles('vaadin-text-field', inputFieldShared$1, {
23636
+ moduleId: 'lumo-text-field-styles',
23637
+ });
23758
23638
 
23759
- const PasswordInput = class {
23760
- constructor(hostRef) {
23761
- index.registerInstance(this, hostRef);
23762
- this.sendValidityState = index.createEvent(this, "sendValidityState", 7);
23763
- this.sendInputValue = index.createEvent(this, "sendInputValue", 7);
23764
- /**
23765
- * Default value for the input.
23766
- */
23767
- this.defaultValue = '';
23768
- this.value = '';
23769
- this.validationPattern = '';
23770
- }
23771
- validityChanged() {
23772
- this.validityStateHandler({ valid: this.isValid, name: this.name });
23773
- if (this.emitValue == true) {
23774
- this.valueHandler({ name: this.name, value: this.value });
23639
+ /**
23640
+ * @license
23641
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
23642
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
23643
+ */
23644
+
23645
+ /**
23646
+ * A mixin to provide logic for vaadin-text-field and related components.
23647
+ *
23648
+ * @polymerMixin
23649
+ * @mixes InputControlMixin
23650
+ */
23651
+ const InputFieldMixin = (superclass) =>
23652
+ class InputFieldMixinClass extends InputControlMixin(superclass) {
23653
+ static get properties() {
23654
+ return {
23655
+ /**
23656
+ * Whether the value of the control can be automatically completed by the browser.
23657
+ * List of available options at:
23658
+ * https://developer.mozilla.org/en/docs/Web/HTML/Element/input#attr-autocomplete
23659
+ */
23660
+ autocomplete: {
23661
+ type: String,
23662
+ },
23663
+
23664
+ /**
23665
+ * This is a property supported by Safari that is used to control whether
23666
+ * autocorrection should be enabled when the user is entering/editing the text.
23667
+ * Possible values are:
23668
+ * on: Enable autocorrection.
23669
+ * off: Disable autocorrection.
23670
+ */
23671
+ autocorrect: {
23672
+ type: String,
23673
+ },
23674
+
23675
+ /**
23676
+ * This is a property supported by Safari and Chrome that is used to control whether
23677
+ * autocapitalization should be enabled when the user is entering/editing the text.
23678
+ * Possible values are:
23679
+ * characters: Characters capitalization.
23680
+ * words: Words capitalization.
23681
+ * sentences: Sentences capitalization.
23682
+ * none: No capitalization.
23683
+ */
23684
+ autocapitalize: {
23685
+ type: String,
23686
+ reflectToAttribute: true,
23687
+ },
23688
+ };
23775
23689
  }
23776
- }
23777
- validityStateHandler(inputStateEvent) {
23778
- this.sendValidityState.emit(inputStateEvent);
23779
- }
23780
- emitValueHandler(newValue) {
23781
- if (newValue == true && this.isValid) {
23782
- this.valueHandler({ name: this.name, value: this.value });
23690
+
23691
+ static get delegateAttrs() {
23692
+ return [...super.delegateAttrs, 'autocapitalize', 'autocomplete', 'autocorrect'];
23783
23693
  }
23784
- }
23785
- valueHandler(inputValueEvent) {
23786
- this.sendInputValue.emit(inputValueEvent);
23787
- }
23788
- connectedCallback() {
23789
- this.validationPattern = this.setPattern();
23790
- }
23791
- handleInput(event) {
23792
- this.value = event.target.value;
23793
- this.errorMessage = this.setErrorMessage();
23794
- this.isValid = this.setValidity();
23795
- this.validityStateHandler({ valid: this.isValid, name: this.name });
23796
- this.emitValueHandler(true);
23797
- }
23798
- setValidity() {
23799
- return this.inputReference.validity.valid;
23800
- }
23801
- setPattern() {
23802
- var _a;
23803
- if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
23804
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
23694
+
23695
+ /**
23696
+ * @param {HTMLElement} input
23697
+ * @protected
23698
+ * @override
23699
+ */
23700
+ _inputElementChanged(input) {
23701
+ super._inputElementChanged(input);
23702
+
23703
+ if (input) {
23704
+ // Discard value set on the custom slotted input.
23705
+ if (input.value && input.value !== this.value) {
23706
+ console.warn(`Please define value on the <${this.localName}> component!`);
23707
+ input.value = '';
23708
+ }
23709
+
23710
+ if (this.value) {
23711
+ input.value = this.value;
23712
+ }
23713
+ }
23805
23714
  }
23806
- }
23807
- setErrorMessage() {
23808
- if (this.inputReference.validity.patternMismatch) {
23809
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
23715
+
23716
+ // Workaround for https://github.com/Polymer/polymer/issues/5259
23717
+ get __data() {
23718
+ return this.__dataValue || {};
23810
23719
  }
23811
- if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
23812
- return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
23720
+
23721
+ set __data(value) {
23722
+ this.__dataValue = value;
23813
23723
  }
23814
- if (this.inputReference.validity.valueMissing) {
23815
- return translate$2('requiredError', this.language);
23724
+
23725
+ /**
23726
+ * Override an event listener from `FocusMixin`.
23727
+ * @param {boolean} focused
23728
+ * @protected
23729
+ * @override
23730
+ */
23731
+ _setFocused(focused) {
23732
+ super._setFocused(focused);
23733
+
23734
+ if (!focused) {
23735
+ this.validate();
23736
+ }
23816
23737
  }
23817
- }
23818
- render() {
23819
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'password__input--invalid';
23820
- return index.h("div", { class: 'password__wrapper' }, index.h("input", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue, 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) }), index.h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'password__error-message' }, this.errorMessage));
23821
- }
23822
- static get watchers() { return {
23823
- "isValid": ["validityChanged"],
23824
- "emitValue": ["emitValueHandler"]
23825
- }; }
23826
- };
23827
- PasswordInput.style = passwordInputCss;
23828
23738
 
23829
- const radioInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.radio__fieldset{border:none;position:relative}.radio__wrapper{display:flex;gap:5px}.radio__error-message{position:absolute;top:calc(100% + 5px);left:0;color:red}";
23739
+ /**
23740
+ * Override an event listener from `InputMixin`
23741
+ * to mark as valid after user started typing.
23742
+ * @param {Event} event
23743
+ * @protected
23744
+ * @override
23745
+ */
23746
+ _onInput(event) {
23747
+ super._onInput(event);
23830
23748
 
23831
- const RadioInput = class {
23832
- constructor(hostRef) {
23833
- index.registerInstance(this, hostRef);
23834
- this.sendInputValue = index.createEvent(this, "sendInputValue", 7);
23835
- this.sendValidityState = index.createEvent(this, "sendValidityState", 7);
23836
- }
23837
- validityChanged() {
23838
- this.validityStateHandler({ valid: this.isValid, name: this.name });
23839
- if (this.emitValue == true) {
23840
- this.valueHandler({ name: this.name, value: this.value });
23749
+ if (this.invalid) {
23750
+ this.validate();
23751
+ }
23841
23752
  }
23842
- }
23843
- emitValueHandler(newValue) {
23844
- if (newValue == true && this.isValid) {
23845
- this.valueHandler({ name: this.name, value: this.value });
23753
+
23754
+ /**
23755
+ * Override an observer from `InputMixin` to validate the field
23756
+ * when a new value is set programmatically.
23757
+ *
23758
+ * @param {string | undefined} newValue
23759
+ * @param {string | undefined} oldValue
23760
+ * @protected
23761
+ * @override
23762
+ */
23763
+ _valueChanged(newValue, oldValue) {
23764
+ super._valueChanged(newValue, oldValue);
23765
+
23766
+ if (oldValue === undefined) {
23767
+ return;
23768
+ }
23769
+
23770
+ if (this.invalid) {
23771
+ this.validate();
23772
+ }
23846
23773
  }
23847
- }
23848
- valueHandler(inputValueEvent) {
23849
- this.sendInputValue.emit(inputValueEvent);
23774
+ };
23775
+
23776
+ /**
23777
+ * @license
23778
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
23779
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
23780
+ */
23781
+
23782
+ /**
23783
+ * A mixin to provide `pattern` and `preventInvalidInput` properties.
23784
+ *
23785
+ * @polymerMixin
23786
+ * @mixes InputConstraintsMixin
23787
+ */
23788
+ const PatternMixin = (superclass) =>
23789
+ class PatternMixinClass extends InputConstraintsMixin(superclass) {
23790
+ static get properties() {
23791
+ return {
23792
+ /**
23793
+ * A regular expression that the value is checked against.
23794
+ * The pattern must match the entire value, not just some subset.
23795
+ */
23796
+ pattern: {
23797
+ type: String,
23798
+ },
23799
+
23800
+ /**
23801
+ * When set to true, user is prevented from typing a value that
23802
+ * conflicts with the given `pattern`.
23803
+ * @attr {boolean} prevent-invalid-input
23804
+ * @deprecated Please use `allowedCharPattern` instead.
23805
+ */
23806
+ preventInvalidInput: {
23807
+ type: Boolean,
23808
+ observer: '_preventInvalidInputChanged',
23809
+ },
23810
+ };
23811
+ }
23812
+
23813
+ static get delegateAttrs() {
23814
+ return [...super.delegateAttrs, 'pattern'];
23815
+ }
23816
+
23817
+ static get constraints() {
23818
+ return [...super.constraints, 'pattern'];
23819
+ }
23820
+
23821
+ /** @private */
23822
+ _checkInputValue() {
23823
+ if (this.preventInvalidInput) {
23824
+ const input = this.inputElement;
23825
+ if (input && input.value.length > 0 && !this.checkValidity()) {
23826
+ input.value = this.value || '';
23827
+ // Add input-prevented attribute for 200ms
23828
+ this.setAttribute('input-prevented', '');
23829
+ this._inputDebouncer = Debouncer$1.debounce(this._inputDebouncer, timeOut.after(200), () => {
23830
+ this.removeAttribute('input-prevented');
23831
+ });
23832
+ }
23833
+ }
23834
+ }
23835
+
23836
+ /**
23837
+ * @param {Event} event
23838
+ * @protected
23839
+ * @override
23840
+ */
23841
+ _onInput(event) {
23842
+ this._checkInputValue();
23843
+
23844
+ super._onInput(event);
23845
+ }
23846
+
23847
+ /** @private */
23848
+ _preventInvalidInputChanged(preventInvalidInput) {
23849
+ if (preventInvalidInput) {
23850
+ console.warn(
23851
+ `WARNING: Since Vaadin 23.2, "preventInvalidInput" is deprecated. Please use "allowedCharPattern" instead.`,
23852
+ );
23853
+ }
23854
+ }
23855
+ };
23856
+
23857
+ /**
23858
+ * @license
23859
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
23860
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
23861
+ */
23862
+
23863
+ registerStyles('vaadin-text-field', inputFieldShared, { moduleId: 'vaadin-text-field-styles' });
23864
+
23865
+ /**
23866
+ * `<vaadin-text-field>` is a web component that allows the user to input and edit text.
23867
+ *
23868
+ * ```html
23869
+ * <vaadin-text-field label="First Name"></vaadin-text-field>
23870
+ * ```
23871
+ *
23872
+ * ### Prefixes and suffixes
23873
+ *
23874
+ * These are child elements of a `<vaadin-text-field>` that are displayed
23875
+ * inline with the input, before or after.
23876
+ * In order for an element to be considered as a prefix, it must have the slot
23877
+ * attribute set to `prefix` (and similarly for `suffix`).
23878
+ *
23879
+ * ```html
23880
+ * <vaadin-text-field label="Email address">
23881
+ * <div slot="prefix">Sent to:</div>
23882
+ * <div slot="suffix">@vaadin.com</div>
23883
+ * </vaadin-text-field>
23884
+ * ```
23885
+ *
23886
+ * ### Styling
23887
+ *
23888
+ * The following custom properties are available for styling:
23889
+ *
23890
+ * Custom property | Description | Default
23891
+ * -------------------------------|----------------------------|---------
23892
+ * `--vaadin-field-default-width` | Default width of the field | `12em`
23893
+ *
23894
+ * The following shadow DOM parts are available for styling:
23895
+ *
23896
+ * Part name | Description
23897
+ * ---------------------|----------------
23898
+ * `label` | The label element
23899
+ * `input-field` | The element that wraps prefix, value and suffix
23900
+ * `clear-button` | The clear button
23901
+ * `error-message` | The error message element
23902
+ * `helper-text` | The helper text element wrapper
23903
+ * `required-indicator` | The `required` state indicator element
23904
+ *
23905
+ * The following state attributes are available for styling:
23906
+ *
23907
+ * Attribute | Description | Part name
23908
+ * --------------------|-------------|------------
23909
+ * `disabled` | Set to a disabled text field | :host
23910
+ * `has-value` | Set when the element has a value | :host
23911
+ * `has-label` | Set when the element has a label | :host
23912
+ * `has-helper` | Set when the element has helper text or slot | :host
23913
+ * `has-error-message` | Set when the element has an error message | :host
23914
+ * `invalid` | Set when the element is invalid | :host
23915
+ * `input-prevented` | Temporarily set when invalid input is prevented | :host
23916
+ * `focused` | Set when the element is focused | :host
23917
+ * `focus-ring` | Set when the element is keyboard focused | :host
23918
+ * `readonly` | Set to a readonly text field | :host
23919
+ *
23920
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
23921
+ *
23922
+ * @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
23923
+ * @fires {Event} change - Fired when the user commits a value change.
23924
+ * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
23925
+ * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
23926
+ * @fires {CustomEvent} validated - Fired whenever the field is validated.
23927
+ *
23928
+ * @extends HTMLElement
23929
+ * @mixes ElementMixin
23930
+ * @mixes ThemableMixin
23931
+ * @mixes PatternMixin
23932
+ * @mixes InputFieldMixin
23933
+ */
23934
+ class TextField extends PatternMixin(InputFieldMixin(ThemableMixin(ElementMixin(PolymerElement)))) {
23935
+ static get is() {
23936
+ return 'vaadin-text-field';
23937
+ }
23938
+
23939
+ static get template() {
23940
+ return html`
23941
+ <style>
23942
+ [part='input-field'] {
23943
+ flex-grow: 0;
23944
+ }
23945
+ </style>
23946
+
23947
+ <div class="vaadin-field-container">
23948
+ <div part="label">
23949
+ <slot name="label"></slot>
23950
+ <span part="required-indicator" aria-hidden="true" on-click="focus"></span>
23951
+ </div>
23952
+
23953
+ <vaadin-input-container
23954
+ part="input-field"
23955
+ readonly="[[readonly]]"
23956
+ disabled="[[disabled]]"
23957
+ invalid="[[invalid]]"
23958
+ theme$="[[_theme]]"
23959
+ >
23960
+ <slot name="prefix" slot="prefix"></slot>
23961
+ <slot name="input"></slot>
23962
+ <slot name="suffix" slot="suffix"></slot>
23963
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
23964
+ </vaadin-input-container>
23965
+
23966
+ <div part="helper-text">
23967
+ <slot name="helper"></slot>
23968
+ </div>
23969
+
23970
+ <div part="error-message">
23971
+ <slot name="error-message"></slot>
23972
+ </div>
23973
+ </div>
23974
+ <slot name="tooltip"></slot>
23975
+ `;
23976
+ }
23977
+
23978
+ static get properties() {
23979
+ return {
23980
+ /**
23981
+ * Maximum number of characters (in Unicode code points) that the user can enter.
23982
+ */
23983
+ maxlength: {
23984
+ type: Number,
23985
+ },
23986
+
23987
+ /**
23988
+ * Minimum number of characters (in Unicode code points) that the user can enter.
23989
+ */
23990
+ minlength: {
23991
+ type: Number,
23992
+ },
23993
+ };
23994
+ }
23995
+
23996
+ static get delegateAttrs() {
23997
+ return [...super.delegateAttrs, 'maxlength', 'minlength'];
23998
+ }
23999
+
24000
+ static get constraints() {
24001
+ return [...super.constraints, 'maxlength', 'minlength'];
24002
+ }
24003
+
24004
+ constructor() {
24005
+ super();
24006
+ this._setType('text');
24007
+ }
24008
+
24009
+ /** @protected */
24010
+ get clearElement() {
24011
+ return this.$.clearButton;
24012
+ }
24013
+
24014
+ /** @protected */
24015
+ ready() {
24016
+ super.ready();
24017
+
24018
+ this.addController(
24019
+ new InputController(this, (input) => {
24020
+ this._setInputElement(input);
24021
+ this._setFocusElement(input);
24022
+ this.stateTarget = input;
24023
+ this.ariaTarget = input;
24024
+ }),
24025
+ );
24026
+ this.addController(new LabelledInputController(this.inputElement, this._labelController));
24027
+
24028
+ this._tooltipController = new TooltipController(this);
24029
+ this._tooltipController.setPosition('top');
24030
+ this.addController(this._tooltipController);
24031
+ }
24032
+ }
24033
+
24034
+ customElements.define(TextField.is, TextField);
24035
+
24036
+ /**
24037
+ * @license
24038
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
24039
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
24040
+ */
24041
+
24042
+ const passwordFieldButton = i$1`
24043
+ :host {
24044
+ position: absolute;
24045
+ right: 0;
24046
+ top: 0;
24047
+ margin: 0;
24048
+ padding: 0;
24049
+ width: 100%;
24050
+ height: 100%;
24051
+ min-width: auto;
24052
+ background: transparent;
24053
+ outline: none;
24054
+ }
24055
+ `;
24056
+
24057
+ registerStyles('vaadin-password-field-button', [button, passwordFieldButton], {
24058
+ moduleId: 'lumo-password-field-button',
24059
+ });
24060
+
24061
+ /**
24062
+ * @license
24063
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
24064
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
24065
+ */
24066
+
24067
+ const passwordField = i$1`
24068
+ [part='reveal-button']::before {
24069
+ content: var(--lumo-icons-eye);
24070
+ }
24071
+
24072
+ :host([password-visible]) [part='reveal-button']::before {
24073
+ content: var(--lumo-icons-eye-disabled);
24074
+ }
24075
+
24076
+ /* Make it easy to hide the button across the whole app */
24077
+ [part='reveal-button'] {
24078
+ position: relative;
24079
+ display: var(--lumo-password-field-reveal-button-display, block);
24080
+ }
24081
+
24082
+ [part='reveal-button'][hidden] {
24083
+ display: none !important;
24084
+ }
24085
+ `;
24086
+
24087
+ registerStyles('vaadin-password-field', [inputFieldShared$1, passwordField], { moduleId: 'lumo-password-field' });
24088
+
24089
+ /**
24090
+ * @license
24091
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
24092
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
24093
+ */
24094
+
24095
+ /**
24096
+ * An element used internally by `<vaadin-password-field>`. Not intended to be used separately.
24097
+ *
24098
+ * @extends Button
24099
+ * @private
24100
+ */
24101
+ class PasswordFieldButton extends Button {
24102
+ static get is() {
24103
+ return 'vaadin-password-field-button';
24104
+ }
24105
+
24106
+ static get template() {
24107
+ return html`
24108
+ <style>
24109
+ :host {
24110
+ display: block;
24111
+ }
24112
+
24113
+ :host([hidden]) {
24114
+ display: none !important;
24115
+ }
24116
+ </style>
24117
+ <slot name="tooltip"></slot>
24118
+ `;
24119
+ }
24120
+ }
24121
+
24122
+ customElements.define(PasswordFieldButton.is, PasswordFieldButton);
24123
+
24124
+ /**
24125
+ * @license
24126
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
24127
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
24128
+ */
24129
+
24130
+ const ownTemplate = html`
24131
+ <div part="reveal-button" slot="suffix">
24132
+ <slot name="reveal"></slot>
24133
+ </div>
24134
+ `;
24135
+
24136
+ let memoizedTemplate$1;
24137
+
24138
+ /**
24139
+ * `<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.
24140
+ *
24141
+ * ```html
24142
+ * <vaadin-password-field label="Password"></vaadin-password-field>
24143
+ * ```
24144
+ *
24145
+ * ### Styling
24146
+ *
24147
+ * `<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.
24148
+ * See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.
24149
+ *
24150
+ * In addition to `<vaadin-text-field>` parts, the following parts are available for theming:
24151
+ *
24152
+ * Part name | Description
24153
+ * ----------------|----------------------------------------------------
24154
+ * `reveal-button` | The eye icon which toggles the password visibility
24155
+ *
24156
+ * In addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:
24157
+ *
24158
+ * Attribute | Description
24159
+ * -------------------|---------------------------------
24160
+ * `password-visible` | Set when the password is visible
24161
+ *
24162
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
24163
+ *
24164
+ * @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
24165
+ * @fires {Event} change - Fired when the user commits a value change.
24166
+ * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
24167
+ * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
24168
+ * @fires {CustomEvent} validated - Fired whenever the field is validated.
24169
+ *
24170
+ * @extends TextField
24171
+ */
24172
+ class PasswordField extends TextField {
24173
+ static get is() {
24174
+ return 'vaadin-password-field';
24175
+ }
24176
+
24177
+ static get template() {
24178
+ if (!memoizedTemplate$1) {
24179
+ // Clone the superclass template
24180
+ memoizedTemplate$1 = super.template.cloneNode(true);
24181
+
24182
+ // Retrieve this element's dom-module template
24183
+ const revealButton = ownTemplate.content.querySelector('[part="reveal-button"]');
24184
+
24185
+ // Append reveal-button and styles to the text-field template
24186
+ const inputField = memoizedTemplate$1.content.querySelector('[part="input-field"]');
24187
+ inputField.appendChild(revealButton);
24188
+ }
24189
+
24190
+ return memoizedTemplate$1;
24191
+ }
24192
+
24193
+ static get properties() {
24194
+ return {
24195
+ /**
24196
+ * Set to true to hide the eye icon which toggles the password visibility.
24197
+ * @attr {boolean} reveal-button-hidden
24198
+ */
24199
+ revealButtonHidden: {
24200
+ type: Boolean,
24201
+ observer: '_revealButtonHiddenChanged',
24202
+ value: false,
24203
+ },
24204
+
24205
+ /**
24206
+ * True if the password is visible ([type=text]).
24207
+ * @attr {boolean} password-visible
24208
+ */
24209
+ passwordVisible: {
24210
+ type: Boolean,
24211
+ value: false,
24212
+ reflectToAttribute: true,
24213
+ observer: '_passwordVisibleChanged',
24214
+ readOnly: true,
24215
+ },
24216
+
24217
+ /**
24218
+ * An object with translated strings used for localization.
24219
+ * It has the following structure and default values:
24220
+ *
24221
+ * ```
24222
+ * {
24223
+ * // Translation of the reveal icon button accessible label
24224
+ * reveal: 'Show password'
24225
+ * }
24226
+ * ```
24227
+ */
24228
+ i18n: {
24229
+ type: Object,
24230
+ value: () => {
24231
+ return {
24232
+ reveal: 'Show password',
24233
+ };
24234
+ },
24235
+ },
24236
+ };
24237
+ }
24238
+
24239
+ static get observers() {
24240
+ return ['__i18nChanged(i18n.*)'];
24241
+ }
24242
+
24243
+ /** @protected */
24244
+ get slotStyles() {
24245
+ const tag = this.localName;
24246
+ return [
24247
+ ...super.slotStyles,
24248
+ `
24249
+ ${tag} [slot="input"]::-ms-reveal {
24250
+ display: none;
24251
+ }
24252
+ `,
24253
+ ];
24254
+ }
24255
+
24256
+ /** @protected */
24257
+ get _revealNode() {
24258
+ return this._revealButtonController && this._revealButtonController.node;
24259
+ }
24260
+
24261
+ constructor() {
24262
+ super();
24263
+ this._setType('password');
24264
+ this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
24265
+ this.__boundRevealButtonTouchend = this._onRevealButtonTouchend.bind(this);
24266
+ }
24267
+
24268
+ /** @protected */
24269
+ ready() {
24270
+ super.ready();
24271
+
24272
+ this._revealPart = this.shadowRoot.querySelector('[part="reveal-button"]');
24273
+
24274
+ this._revealButtonController = new SlotController(
24275
+ this,
24276
+ 'reveal',
24277
+ () => document.createElement('vaadin-password-field-button'),
24278
+ (host, btn) => {
24279
+ btn.disabled = host.disabled;
24280
+
24281
+ btn.addEventListener('click', host.__boundRevealButtonClick);
24282
+ btn.addEventListener('touchend', host.__boundRevealButtonTouchend);
24283
+ },
24284
+ );
24285
+ this.addController(this._revealButtonController);
24286
+
24287
+ this.__updateAriaLabel(this.i18n);
24288
+
24289
+ this._updateToggleState(false);
24290
+ this._toggleRevealHidden(this.revealButtonHidden);
24291
+
24292
+ if (this.inputElement) {
24293
+ this.inputElement.autocapitalize = 'off';
24294
+ }
24295
+ }
24296
+
24297
+ /**
24298
+ * Override method inherited from `FocusMixin` to mark field as focused
24299
+ * when focus moves to the reveal button using Shift Tab.
24300
+ * @param {Event} event
24301
+ * @return {boolean}
24302
+ * @protected
24303
+ */
24304
+ _shouldSetFocus(event) {
24305
+ return event.target === this.inputElement || event.target === this._revealNode;
24306
+ }
24307
+
24308
+ /**
24309
+ * Override method inherited from `FocusMixin` to not hide password
24310
+ * when focus moves to the reveal button or back to the input.
24311
+ * @param {Event} event
24312
+ * @return {boolean}
24313
+ * @protected
24314
+ */
24315
+ _shouldRemoveFocus(event) {
24316
+ return !(
24317
+ event.relatedTarget === this._revealNode ||
24318
+ (event.relatedTarget === this.inputElement && event.target === this._revealNode)
24319
+ );
24320
+ }
24321
+
24322
+ /**
24323
+ * Override method inherited from `FocusMixin` to toggle password visibility.
24324
+ * @param {boolean} focused
24325
+ * @protected
24326
+ * @override
24327
+ */
24328
+ _setFocused(focused) {
24329
+ super._setFocused(focused);
24330
+
24331
+ if (!focused) {
24332
+ this._setPasswordVisible(false);
24333
+ } else {
24334
+ const isButtonFocused = this.getRootNode().activeElement === this._revealNode;
24335
+ // Remove focus-ring from the field when the reveal button gets focused
24336
+ this.toggleAttribute('focus-ring', this._keyboardActive && !isButtonFocused);
24337
+ }
24338
+ }
24339
+
24340
+ /** @private */
24341
+ __updateAriaLabel(i18n) {
24342
+ if (i18n.reveal && this._revealNode) {
24343
+ this._revealNode.setAttribute('aria-label', i18n.reveal);
24344
+ }
24345
+ }
24346
+
24347
+ /** @private */
24348
+ __i18nChanged(i18n) {
24349
+ this.__updateAriaLabel(i18n.base);
24350
+ }
24351
+
24352
+ /** @private */
24353
+ _revealButtonHiddenChanged(hidden) {
24354
+ this._toggleRevealHidden(hidden);
24355
+ }
24356
+
24357
+ /** @private */
24358
+ _togglePasswordVisibility() {
24359
+ this._setPasswordVisible(!this.passwordVisible);
24360
+ }
24361
+
24362
+ /** @private */
24363
+ _onRevealButtonClick() {
24364
+ this._togglePasswordVisibility();
24365
+ }
24366
+
24367
+ /** @private */
24368
+ _onRevealButtonTouchend(e) {
24369
+ // Cancel the following click event
24370
+ e.preventDefault();
24371
+ this._togglePasswordVisibility();
24372
+ // Focus the input to avoid problem with password still visible
24373
+ // when user clicks the reveal button and then clicks outside.
24374
+ this.inputElement.focus();
24375
+ }
24376
+
24377
+ /** @private */
24378
+ _toggleRevealHidden(hidden) {
24379
+ if (this._revealNode) {
24380
+ if (hidden) {
24381
+ this._revealPart.setAttribute('hidden', '');
24382
+ this._revealNode.setAttribute('tabindex', '-1');
24383
+ this._revealNode.setAttribute('aria-hidden', 'true');
24384
+ } else {
24385
+ this._revealPart.removeAttribute('hidden');
24386
+ this._revealNode.setAttribute('tabindex', '0');
24387
+ this._revealNode.removeAttribute('aria-hidden');
24388
+ }
24389
+ }
24390
+ }
24391
+
24392
+ /** @private */
24393
+ _updateToggleState(passwordVisible) {
24394
+ if (this._revealNode) {
24395
+ this._revealNode.setAttribute('aria-pressed', passwordVisible ? 'true' : 'false');
24396
+ }
24397
+ }
24398
+
24399
+ /** @private */
24400
+ _passwordVisibleChanged(passwordVisible) {
24401
+ this._setType(passwordVisible ? 'text' : 'password');
24402
+
24403
+ this._updateToggleState(passwordVisible);
24404
+ }
24405
+
24406
+ /**
24407
+ * Override method inherited from `DisabledMixin` to synchronize the reveal button
24408
+ * disabled state with the password field disabled state.
24409
+ * @param {boolean} disabled
24410
+ * @param {boolean} oldDisabled
24411
+ * @protected
24412
+ */
24413
+ _disabledChanged(disabled, oldDisabled) {
24414
+ super._disabledChanged(disabled, oldDisabled);
24415
+
24416
+ if (this._revealNode) {
24417
+ this._revealNode.disabled = disabled;
24418
+ }
24419
+ }
24420
+ }
24421
+
24422
+ customElements.define(PasswordField.is, PasswordField);
24423
+
24424
+ const passwordInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password{font-family:\"Roboto\";font-style:normal}.password__wrapper{position:relative;width:100%;padding-top:26px}.password__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F;position:absolute;top:0;left:0}.password__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;margin-left:2px}.password__input{width:inherit;border:none}.password__input[focused]::part(input-field){border-color:#3E3E3E}.password__input[invalid]::part(input-field){border-color:#cc0000b3}.password__input::part(input-field){border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;width:100%;position:relative;border:2px solid #DEE1EE}.password__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}";
24425
+
24426
+ const PasswordInput = class {
24427
+ constructor(hostRef) {
24428
+ index.registerInstance(this, hostRef);
24429
+ this.sendValidityState = index.createEvent(this, "sendValidityState", 7);
24430
+ this.sendInputValue = index.createEvent(this, "sendInputValue", 7);
24431
+ /**
24432
+ * Default value for the input.
24433
+ */
24434
+ this.defaultValue = '';
24435
+ this.value = '';
24436
+ this.validationPattern = '';
24437
+ }
24438
+ validityChanged() {
24439
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
24440
+ if (this.emitValue == true) {
24441
+ this.valueHandler({ name: this.name, value: this.value });
24442
+ }
24443
+ }
24444
+ emitValueHandler(newValue) {
24445
+ if (newValue == true && this.isValid) {
24446
+ this.valueHandler({ name: this.name, value: this.value });
24447
+ }
24448
+ }
24449
+ validityStateHandler(inputStateEvent) {
24450
+ this.sendValidityState.emit(inputStateEvent);
24451
+ }
24452
+ valueHandler(inputValueEvent) {
24453
+ this.sendInputValue.emit(inputValueEvent);
24454
+ }
24455
+ valueChangedHandler(event) {
24456
+ if (this.isDuplicateInput) {
24457
+ if (this.name === event.detail.name + 'Duplicate') {
24458
+ this.duplicateInputValue = event.detail.value;
24459
+ }
24460
+ }
24461
+ }
24462
+ connectedCallback() {
24463
+ this.validationPattern = this.setPattern();
24464
+ }
24465
+ componentDidLoad() {
24466
+ this.inputReference = this.element.shadowRoot.querySelector('input');
24467
+ if (this.defaultValue) {
24468
+ this.value = this.defaultValue;
24469
+ this.valueHandler({ name: this.name, value: this.value });
24470
+ }
24471
+ }
24472
+ handleInput(event) {
24473
+ this.value = event.target.value;
24474
+ this.errorMessage = this.setErrorMessage();
24475
+ this.isValid = this.setValidity();
24476
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
24477
+ this.emitValueHandler(true);
24478
+ }
24479
+ setValidity() {
24480
+ return this.inputReference.validity.valid;
24481
+ }
24482
+ setPattern() {
24483
+ var _a, _b;
24484
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
24485
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
24486
+ }
24487
+ }
24488
+ setErrorMessage() {
24489
+ var _a;
24490
+ if (this.inputReference.validity.patternMismatch) {
24491
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
24492
+ }
24493
+ if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
24494
+ return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
24495
+ }
24496
+ if (this.inputReference.validity.valueMissing) {
24497
+ return translate$2('requiredError', this.language);
24498
+ }
24499
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
24500
+ return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
24501
+ }
24502
+ }
24503
+ render() {
24504
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'password__input--invalid';
24505
+ return index.h("div", { class: 'password__wrapper' }, index.h("vaadin-password-field", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue,
24506
+ // ref={(el) => this.inputReference = el as HTMLInputElement}
24507
+ 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) }), index.h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'password__error-message' }, this.errorMessage));
24508
+ }
24509
+ get element() { return index.getElement(this); }
24510
+ static get watchers() { return {
24511
+ "isValid": ["validityChanged"],
24512
+ "emitValue": ["emitValueHandler"]
24513
+ }; }
24514
+ };
24515
+ PasswordInput.style = passwordInputCss;
24516
+
24517
+ const radioInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.radio__fieldset{border:none;position:relative}.radio__wrapper{display:flex;gap:5px}.radio__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}";
24518
+
24519
+ const RadioInput = class {
24520
+ constructor(hostRef) {
24521
+ index.registerInstance(this, hostRef);
24522
+ this.sendInputValue = index.createEvent(this, "sendInputValue", 7);
24523
+ this.sendValidityState = index.createEvent(this, "sendValidityState", 7);
24524
+ }
24525
+ validityChanged() {
24526
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
24527
+ if (this.emitValue == true) {
24528
+ this.valueHandler({ name: this.name, value: this.value });
24529
+ }
24530
+ }
24531
+ emitValueHandler(newValue) {
24532
+ if (newValue == true && this.isValid) {
24533
+ this.valueHandler({ name: this.name, value: this.value });
24534
+ }
24535
+ }
24536
+ valueHandler(inputValueEvent) {
24537
+ this.sendInputValue.emit(inputValueEvent);
23850
24538
  }
23851
24539
  validityStateHandler(inputStateEvent) {
23852
24540
  this.sendValidityState.emit(inputStateEvent);
@@ -26234,87 +26922,6 @@ class ComboBoxScroller extends PolymerElement {
26234
26922
 
26235
26923
  customElements.define(ComboBoxScroller.is, ComboBoxScroller);
26236
26924
 
26237
- /**
26238
- * @license
26239
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
26240
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
26241
- */
26242
-
26243
- /**
26244
- * A mixin to provide `pattern` and `preventInvalidInput` properties.
26245
- *
26246
- * @polymerMixin
26247
- * @mixes InputConstraintsMixin
26248
- */
26249
- const PatternMixin = (superclass) =>
26250
- class PatternMixinClass extends InputConstraintsMixin(superclass) {
26251
- static get properties() {
26252
- return {
26253
- /**
26254
- * A regular expression that the value is checked against.
26255
- * The pattern must match the entire value, not just some subset.
26256
- */
26257
- pattern: {
26258
- type: String,
26259
- },
26260
-
26261
- /**
26262
- * When set to true, user is prevented from typing a value that
26263
- * conflicts with the given `pattern`.
26264
- * @attr {boolean} prevent-invalid-input
26265
- * @deprecated Please use `allowedCharPattern` instead.
26266
- */
26267
- preventInvalidInput: {
26268
- type: Boolean,
26269
- observer: '_preventInvalidInputChanged',
26270
- },
26271
- };
26272
- }
26273
-
26274
- static get delegateAttrs() {
26275
- return [...super.delegateAttrs, 'pattern'];
26276
- }
26277
-
26278
- static get constraints() {
26279
- return [...super.constraints, 'pattern'];
26280
- }
26281
-
26282
- /** @private */
26283
- _checkInputValue() {
26284
- if (this.preventInvalidInput) {
26285
- const input = this.inputElement;
26286
- if (input && input.value.length > 0 && !this.checkValidity()) {
26287
- input.value = this.value || '';
26288
- // Add input-prevented attribute for 200ms
26289
- this.setAttribute('input-prevented', '');
26290
- this._inputDebouncer = Debouncer$1.debounce(this._inputDebouncer, timeOut.after(200), () => {
26291
- this.removeAttribute('input-prevented');
26292
- });
26293
- }
26294
- }
26295
- }
26296
-
26297
- /**
26298
- * @param {Event} event
26299
- * @protected
26300
- * @override
26301
- */
26302
- _onInput(event) {
26303
- this._checkInputValue();
26304
-
26305
- super._onInput(event);
26306
- }
26307
-
26308
- /** @private */
26309
- _preventInvalidInputChanged(preventInvalidInput) {
26310
- if (preventInvalidInput) {
26311
- console.warn(
26312
- `WARNING: Since Vaadin 23.2, "preventInvalidInput" is deprecated. Please use "allowedCharPattern" instead.`,
26313
- );
26314
- }
26315
- }
26316
- };
26317
-
26318
26925
  /**
26319
26926
  * @license
26320
26927
  * Copyright (c) 2015 - 2022 Vaadin Ltd.
@@ -28300,7 +28907,7 @@ class ComboBox extends ComboBoxDataProviderMixin(
28300
28907
 
28301
28908
  customElements.define(ComboBox.is, ComboBox);
28302
28909
 
28303
- const selectInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.select__wrapper{position:relative;display:flex;padding-top:10px;width:100%}.select__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)}.select__label--hidden{opacity:0;visibility:hidden;transform:translateY(0)}.select__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}.select__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.select__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";
28910
+ const selectInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.select{font-family:\"Roboto\";font-style:normal}.select__wrapper{position:relative;width:100%;padding-top:26px}.select__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F;position:absolute;top:0;left:0}.select__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;margin-left:2px}.select__input{border:none;width:inherit;position:relative}.select__input[focused]::part(input-field){border-color:#3E3E3E}.select__input[invalid]::part(input-field){border-color:#cc0000b3}.select__input vaadin-date-picker-overlay-content>vaadin-button{color:#1F1F1F}.select__input vaadin-month-calendar::part(selected date){background-color:red}.select__input::part(input-field){border-radius:4px;background-color:#FFFFFF;border:2px solid #DEE1EE;color:#2A2E3F;border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px}.select__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}";
28304
28911
 
28305
28912
  const SelectInput = class {
28306
28913
  constructor(hostRef) {
@@ -28349,6 +28956,10 @@ const SelectInput = class {
28349
28956
  }
28350
28957
  componentDidLoad() {
28351
28958
  this.inputReference = this.element.shadowRoot.querySelector('input');
28959
+ if (this.defaultValue) {
28960
+ this.value = this.defaultValue;
28961
+ this.valueHandler({ name: this.name, value: this.value });
28962
+ }
28352
28963
  }
28353
28964
  getOptions() {
28354
28965
  // TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
@@ -28370,7 +28981,6 @@ const SelectInput = class {
28370
28981
  this.isValid = this.setValidity();
28371
28982
  this.validityStateHandler({ valid: this.isValid, name: this.name });
28372
28983
  this.emitValueHandler(true);
28373
- this.inputReference.previousElementSibling.classList.remove('select__label--hidden');
28374
28984
  }
28375
28985
  setValidity() {
28376
28986
  return this.inputReference.validity.valid;
@@ -28381,7 +28991,8 @@ const SelectInput = class {
28381
28991
  }
28382
28992
  }
28383
28993
  render() {
28384
- return index.h("div", { class: 'select__wrapper' }, index.h("label", { class: 'select__label select__label--hidden', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), index.h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: 'select__input', "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, items: this.displayedOptions, onBlur: (e) => this.handleChange(e) }), index.h("small", { class: 'select__error-message' }, this.errorMessage));
28994
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'select__input--invalid';
28995
+ return index.h("div", { class: 'select__wrapper' }, index.h("label", { class: 'select__label', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), index.h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, items: this.displayedOptions, onBlur: (e) => this.handleChange(e) }), index.h("small", { class: 'select__error-message' }, this.errorMessage));
28385
28996
  }
28386
28997
  get element() { return index.getElement(this); }
28387
28998
  static get watchers() { return {
@@ -28391,7 +29002,7 @@ const SelectInput = class {
28391
29002
  };
28392
29003
  SelectInput.style = selectInputCss;
28393
29004
 
28394
- const telInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.tel__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px;border-bottom:3px solid #666666}.tel__wrapper--flex{display:flex}.tel__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)}.tel__label--required::after{content:\"*\";margin-left:5px;color:#666666}.tel vaadin-combo-box{flex-grow:1}.tel__input{width:inherit;padding:15px 6px;position:relative;border:none;background-color:transparent;color:#666666;font-size:16px;font-family:inherit;flex-grow:3;-moz-appearance:textfield;}.tel__input::-webkit-outer-spin-button,.tel__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.tel__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.tel__input::placeholder{color:#666666}.tel__input--invalid .tel__wrapper{border-bottom:3px solid #cc0000}.tel__input:placeholder-shown+.tel__label{opacity:0;visibility:hidden;transform:translateY(0)}.tel__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";
29005
+ const telInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.tel{font-family:\"Roboto\";font-style:normal}.tel__wrapper{position:relative;width:100%;padding-top:26px}.tel__wrapper--flex{width:inherit;display:flex;align-items:stretch;border-radius:4px;border:2px solid #DEE1EE}.tel__wrapper--flex:focus-within{border:2px solid #3E3E3E}.tel__wrapper--flex--invalid{border:2px solid #cc0000b3}.tel__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F;position:absolute;top:0;left:0}.tel__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;margin-left:2px}.tel__prefix{width:120px}.tel__prefix[focus]{outline:none}.tel__prefix::part(input-field){border-radius:0 4px 4px 0;background-color:#DEE1EE;color:#1F1F1F;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px}.tel__input{border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;border:none;padding:8px 20px;width:inherit;position:relative;-moz-appearance:textfield;}.tel__input:focus{outline:none}.tel__input::-webkit-outer-spin-button,.tel__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.tel__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}";
28395
29006
 
28396
29007
  const TelInput = class {
28397
29008
  constructor(hostRef) {
@@ -28419,18 +29030,28 @@ const TelInput = class {
28419
29030
  }
28420
29031
  connectedCallback() {
28421
29032
  this.validationPattern = this.setPattern();
29033
+ if (this.defaultValue) {
29034
+ this.prefixValue = this.defaultValue.split('|')[0];
29035
+ this.phoneValue = this.defaultValue.split('|')[1];
29036
+ }
28422
29037
  }
28423
29038
  componentWillLoad() {
28424
29039
  if (this.action) {
28425
29040
  if (this.action.split(" ")[0] == 'GET') {
28426
29041
  return this.getPhoneCodes().then((options) => {
28427
29042
  this.phoneCodesOptions = options.phoneCodes.map(code => {
28428
- return { label: code.Prefix, value: code.CountryID };
29043
+ return { label: code.Prefix, value: code.Prefix };
28429
29044
  });
28430
29045
  });
28431
29046
  }
28432
29047
  }
28433
29048
  }
29049
+ componentDidLoad() {
29050
+ if (this.defaultValue) {
29051
+ this.value = `${this.prefixValue}|${this.phoneValue}`;
29052
+ this.valueHandler({ name: this.name, value: this.value });
29053
+ }
29054
+ }
28434
29055
  getPhoneCodes() {
28435
29056
  // TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
28436
29057
  const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes");
@@ -28446,7 +29067,8 @@ const TelInput = class {
28446
29067
  });
28447
29068
  }
28448
29069
  handleInput(event) {
28449
- this.value = event.target.value;
29070
+ this.phoneValue = event.target.value;
29071
+ this.value = `${this.prefixValue}|${this.phoneValue}`;
28450
29072
  this.errorMessage = this.setErrorMessage();
28451
29073
  this.isValid = this.setValidity();
28452
29074
  this.validityStateHandler({ valid: this.isValid, name: this.name });
@@ -28456,14 +29078,15 @@ const TelInput = class {
28456
29078
  return this.inputReference.validity.valid;
28457
29079
  }
28458
29080
  setPattern() {
28459
- var _a;
29081
+ var _a, _b;
28460
29082
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
28461
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
29083
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
28462
29084
  }
28463
29085
  }
28464
29086
  setErrorMessage() {
29087
+ var _a;
28465
29088
  if (this.inputReference.validity.patternMismatch) {
28466
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
29089
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
28467
29090
  }
28468
29091
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
28469
29092
  return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -28473,8 +29096,8 @@ const TelInput = class {
28473
29096
  }
28474
29097
  }
28475
29098
  render() {
28476
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__input--invalid';
28477
- return index.h("div", { class: 'tel__wrapper' }, index.h("div", { class: 'tel__wrapper--flex' }, index.h("vaadin-combo-box", { items: this.phoneCodesOptions, value: this.defaultValue, readOnly: this.autofilled }), index.h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onBlur: (e) => this.handleInput(e) })), index.h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'tel__error-message' }, this.errorMessage));
29099
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__wrapper--flex--invalid';
29100
+ return index.h("div", { class: 'tel__wrapper' }, index.h("div", { class: `tel__wrapper--flex ${invalidClass}` }, index.h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onBlur: (e) => this.prefixValue = e.target.value }), index.h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: this.phoneValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onBlur: (e) => this.handleInput(e) })), index.h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'tel__error-message' }, this.errorMessage));
28478
29101
  }
28479
29102
  static get watchers() { return {
28480
29103
  "isValid": ["validityChanged"],
@@ -28483,7 +29106,7 @@ const TelInput = class {
28483
29106
  };
28484
29107
  TelInput.style = telInputCss;
28485
29108
 
28486
- const textInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.text__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.text__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)}.text__label--required::after{content:\"*\";margin-left:5px;color:#666666}.text__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}.text__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.text__input::placeholder{color:#666666}.text__input--invalid{border-bottom:3px solid #cc0000}.text__input:placeholder-shown+.text__label{opacity:0;visibility:hidden;transform:translateY(0)}.text__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";
29109
+ const textInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.text{font-family:\"Roboto\";font-style:normal}.text__wrapper{position:relative;width:100%;padding-top:26px}.text__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#1F1F1F;position:absolute;top:0;left:0}.text__label--required::after{content:\"*\";font-family:inherit;color:#1F1F1F;margin-left:2px}.text__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:8px 20px;width:inherit;position:relative;border:2px solid #DEE1EE}.text__input:focus{outline-color:#3E3E3E}.text__input--invalid{border:2px solid #cc0000b3}.text__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}";
28487
29110
 
28488
29111
  const TextInput = class {
28489
29112
  constructor(hostRef) {
@@ -28504,22 +29127,33 @@ const TextInput = class {
28504
29127
  this.valueHandler({ name: this.name, value: this.value });
28505
29128
  }
28506
29129
  }
28507
- validityStateHandler(inputStateEvent) {
28508
- this.sendValidityState.emit(inputStateEvent);
28509
- }
28510
29130
  emitValueHandler(newValue) {
28511
29131
  if (newValue == true && this.isValid) {
28512
29132
  this.valueHandler({ name: this.name, value: this.value });
28513
29133
  }
28514
29134
  }
29135
+ validityStateHandler(inputStateEvent) {
29136
+ this.sendValidityState.emit(inputStateEvent);
29137
+ }
28515
29138
  valueHandler(inputValueEvent) {
28516
29139
  this.sendInputValue.emit(inputValueEvent);
28517
29140
  }
29141
+ valueChangedHandler(event) {
29142
+ if (this.isDuplicateInput) {
29143
+ if (this.name === event.detail.name + 'Duplicate') {
29144
+ this.duplicateInputValue = event.detail.value;
29145
+ }
29146
+ }
29147
+ }
28518
29148
  connectedCallback() {
28519
- // @TODO do something with customRules !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28520
- this.customRules = this.setCustomRules();
28521
29149
  this.validationPattern = this.setPattern();
28522
29150
  }
29151
+ componentDidLoad() {
29152
+ if (this.defaultValue) {
29153
+ this.value = this.defaultValue;
29154
+ this.valueHandler({ name: this.name, value: this.value });
29155
+ }
29156
+ }
28523
29157
  handleInput(event) {
28524
29158
  this.value = event.target.value;
28525
29159
  this.isValid = this.setValidity();
@@ -28530,22 +29164,16 @@ const TextInput = class {
28530
29164
  setValidity() {
28531
29165
  return this.inputReference.validity.valid;
28532
29166
  }
28533
- // @TODO type here
28534
- setCustomRules() {
28535
- var _a;
28536
- if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
28537
- return this.validation.custom.filter(customValidation => customValidation.rule !== 'regex');
28538
- }
28539
- }
28540
29167
  setPattern() {
28541
- var _a;
29168
+ var _a, _b;
28542
29169
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
28543
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
29170
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
28544
29171
  }
28545
29172
  }
28546
29173
  setErrorMessage() {
29174
+ var _a;
28547
29175
  if (this.inputReference.validity.patternMismatch) {
28548
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
29176
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
28549
29177
  }
28550
29178
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
28551
29179
  return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -28553,10 +29181,13 @@ const TextInput = class {
28553
29181
  if (this.inputReference.validity.valueMissing) {
28554
29182
  return translate$2('requiredError', this.language);
28555
29183
  }
29184
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
29185
+ return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
29186
+ }
28556
29187
  }
28557
29188
  render() {
28558
29189
  const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
28559
- return index.h("div", { class: 'text__wrapper' }, index.h("input", { id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onBlur: (e) => { this.handleInput(e); } }), index.h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'text__error-message' }, this.errorMessage));
29190
+ return index.h("div", { class: 'text__wrapper' }, index.h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("input", { name: this.name, id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onBlur: (e) => { this.handleInput(e); } }), index.h("small", { class: 'text__error-message' }, this.errorMessage));
28560
29191
  }
28561
29192
  static get watchers() { return {
28562
29193
  "isValid": ["validityChanged"],