@everymatrix/general-registration 1.10.5 → 1.10.11

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 (34) hide show
  1. package/dist/cjs/checkbox-input_11.cjs.entry.js +1126 -526
  2. package/dist/cjs/general-registration.cjs.js +2 -2
  3. package/dist/cjs/{index-ad0df8ea.js → index-68f93e1e.js} +9 -1
  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 +144 -275
  7. package/dist/components/checkbox-input2.js +2 -2
  8. package/dist/components/date-input2.js +15 -1441
  9. package/dist/components/email-input2.js +18 -6
  10. package/dist/components/general-input2.js +6 -6
  11. package/dist/components/general-registration.js +102 -248
  12. package/dist/components/input-field-shared-styles.js +13776 -0
  13. package/dist/components/number-input2.js +1 -1
  14. package/dist/components/password-input2.js +738 -6
  15. package/dist/components/pattern-mixin.js +84 -0
  16. package/dist/components/radio-input2.js +1 -1
  17. package/dist/components/select-input2.js +4 -4
  18. package/dist/components/tel-input2.js +12 -8
  19. package/dist/components/text-input2.js +17 -13
  20. package/dist/components/vaadin-button.js +1432 -0
  21. package/dist/components/vaadin-combo-box.js +3 -82
  22. package/dist/components/virtual-keyboard-controller.js +2136 -15909
  23. package/dist/esm/checkbox-input_11.entry.js +1126 -526
  24. package/dist/esm/general-registration.js +2 -2
  25. package/dist/esm/{index-bb9c8eb3.js → index-16916adb.js} +9 -1
  26. package/dist/esm/loader.js +2 -2
  27. package/dist/general-registration/general-registration.esm.js +1 -1
  28. package/dist/general-registration/p-8f644809.js +1 -0
  29. package/dist/general-registration/{p-8a77bab6.entry.js → p-b5f7ebdd.entry.js} +210 -100
  30. package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +4 -2
  31. package/dist/types/components/general-registration/general-registration.d.ts +20 -284
  32. package/dist/types/components.d.ts +11 -17
  33. package/package.json +3 -2
  34. package/dist/general-registration/p-4800d8b4.js +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ad0df8ea.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'];
@@ -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) {
@@ -84,7 +84,7 @@ const CheckboxInput = class {
84
84
  }
85
85
  }
86
86
  render() {
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", { 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));
88
88
  }
89
89
  static get watchers() { return {
90
90
  "isValid": ["validityChanged"],
@@ -107,7 +107,7 @@ CheckboxInput.style = checkboxInputCss;
107
107
  */
108
108
  class Lumo extends HTMLElement {
109
109
  static get version() {
110
- return '23.3.13';
110
+ return '23.3.14';
111
111
  }
112
112
  }
113
113
 
@@ -12980,7 +12980,7 @@ const registered = new Set();
12980
12980
  const ElementMixin = (superClass) =>
12981
12981
  class VaadinElementMixin extends DirMixin(superClass) {
12982
12982
  static get version() {
12983
- return '23.3.13';
12983
+ return '23.3.14';
12984
12984
  }
12985
12985
 
12986
12986
  /** @protected */
@@ -16278,7 +16278,7 @@ registerStyles('vaadin-date-picker-overlay', datePickerOverlayStyles, {
16278
16278
  moduleId: 'vaadin-date-picker-overlay-styles',
16279
16279
  });
16280
16280
 
16281
- let memoizedTemplate$1;
16281
+ let memoizedTemplate$2;
16282
16282
 
16283
16283
  /**
16284
16284
  * An element used internally by `<vaadin-date-picker>`. Not intended to be used separately.
@@ -16292,12 +16292,12 @@ class DatePickerOverlay extends DisableUpgradeMixin(PositionMixin(Overlay)) {
16292
16292
  }
16293
16293
 
16294
16294
  static get template() {
16295
- if (!memoizedTemplate$1) {
16296
- memoizedTemplate$1 = super.template.cloneNode(true);
16297
- 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');
16298
16298
  }
16299
16299
 
16300
- return memoizedTemplate$1;
16300
+ return memoizedTemplate$2;
16301
16301
  }
16302
16302
  }
16303
16303
 
@@ -23035,7 +23035,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
23035
23035
 
23036
23036
  customElements.define(DatePicker.is, DatePicker);
23037
23037
 
23038
- 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}";
23039
23039
 
23040
23040
  const DateInput = class {
23041
23041
  constructor(hostRef) {
@@ -23086,7 +23086,8 @@ const DateInput = class {
23086
23086
  }
23087
23087
  }
23088
23088
  render() {
23089
- 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));
23090
23091
  }
23091
23092
  get element() { return index.getElement(this); }
23092
23093
  static get watchers() { return {
@@ -23096,7 +23097,7 @@ const DateInput = class {
23096
23097
  };
23097
23098
  DateInput.style = dateInputCss;
23098
23099
 
23099
- 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}";
23100
23101
 
23101
23102
  const EmailInput = class {
23102
23103
  constructor(hostRef) {
@@ -23111,17 +23112,24 @@ const EmailInput = class {
23111
23112
  this.valueHandler({ name: this.name, value: this.value });
23112
23113
  }
23113
23114
  }
23114
- validityStateHandler(inputStateEvent) {
23115
- this.sendValidityState.emit(inputStateEvent);
23116
- }
23117
23115
  emitValueHandler(newValue) {
23118
23116
  if (newValue == true && this.isValid) {
23119
23117
  this.valueHandler({ name: this.name, value: this.value });
23120
23118
  }
23121
23119
  }
23120
+ validityStateHandler(inputStateEvent) {
23121
+ this.sendValidityState.emit(inputStateEvent);
23122
+ }
23122
23123
  valueHandler(inputValueEvent) {
23123
23124
  this.sendInputValue.emit(inputValueEvent);
23124
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
+ }
23125
23133
  connectedCallback() {
23126
23134
  this.validationPattern = this.setPattern();
23127
23135
  }
@@ -23158,9 +23166,13 @@ const EmailInput = class {
23158
23166
  if (this.inputReference.validity.valueMissing) {
23159
23167
  return translate$2('requiredError', this.language);
23160
23168
  }
23169
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
23170
+ return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
23171
+ }
23161
23172
  }
23162
23173
  render() {
23163
- 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));
23164
23176
  }
23165
23177
  static get watchers() { return {
23166
23178
  "isValid": ["validityChanged"],
@@ -23182,9 +23194,9 @@ const GeneralInput = class {
23182
23194
  render() {
23183
23195
  switch (this.type.toLowerCase()) {
23184
23196
  case 'text':
23185
- 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 });
23186
23198
  case 'email':
23187
- 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 });
23188
23200
  case 'number':
23189
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 });
23190
23202
  case 'checkbox':
@@ -23192,7 +23204,7 @@ const GeneralInput = class {
23192
23204
  case 'datetime':
23193
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 });
23194
23206
  case 'password':
23195
- 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 });
23196
23208
  case 'radio':
23197
23209
  return index.h("radio-input", { name: this.name, displayName: this.displayName, optionsGroup: this.options, validation: this.validation, emitValue: this.emitValue, language: this.language });
23198
23210
  case 'tel':
@@ -23200,7 +23212,6 @@ const GeneralInput = class {
23200
23212
  case 'dropdown':
23201
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 });
23202
23214
  default:
23203
- // Nothing here
23204
23215
  return index.h("p", null, "The ", this.type, " input type is not valid");
23205
23216
  }
23206
23217
  }
@@ -23236,238 +23247,54 @@ const translate = (key, customLang, values) => {
23236
23247
  return translation;
23237
23248
  };
23238
23249
 
23239
- 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}";
23240
23251
 
23241
23252
  const GeneralRegistration = class {
23242
23253
  constructor(hostRef) {
23243
23254
  index.registerInstance(this, hostRef);
23244
- this.data = {
23245
- "type": "default",
23246
- "content": {
23247
- "step": "step1",
23248
- "fields": [
23249
- {
23250
- "name": "firstName",
23251
- "displayName": "Username",
23252
- "defaultValue": null,
23253
- "validate": {
23254
- "mandatory": true,
23255
- "minLength": 3,
23256
- "maxLength": 20
23257
- },
23258
- "autofill": false
23259
- },
23260
- {
23261
- "name": "lastName",
23262
- "displayName": "Last name",
23263
- "defaultValue": null,
23264
- "validate": {
23265
- "mandatory": true,
23266
- "minLength": 3,
23267
- "maxLength": 20
23268
- },
23269
- },
23270
- {
23271
- "name": "telephone",
23272
- "displayName": "Telephone",
23273
- "action": "GET https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes",
23274
- "defaultValue": null,
23275
- "validate": {
23276
- "mandatory": true
23277
- },
23278
- "autofill": false,
23279
- "inputType": "tel"
23280
- },
23281
- {
23282
- "name": "dateOfBirth",
23283
- "displayName": "Date of Birth",
23284
- "defaultValue": null,
23285
- "validate": {
23286
- "min": "2022-05-01",
23287
- "max": "2022-05-29",
23288
- "mandatory": true,
23289
- },
23290
- "inputType": "datetime"
23291
- },
23292
- {
23293
- "name": "email",
23294
- "displayName": "Email",
23295
- "defaultValue": 'a@a.com',
23296
- "validate": {
23297
- "mandatory": true,
23298
- "custom": [
23299
- {
23300
- "rule": "regex",
23301
- "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z-9.-]+\\.[a-zA-Z]{2,3}$",
23302
- "errorMessage": "Please enter a valid email address"
23303
- }
23304
- ]
23305
- },
23306
- "inputType": "email"
23307
- },
23308
- {
23309
- "name": "password",
23310
- "displayName": "Password",
23311
- "defaultValue": null,
23312
- "validate": {
23313
- "mandatory": true,
23314
- "minLength": 3,
23315
- "maxLength": 20,
23316
- "type": "password",
23317
- "custom": [
23318
- {
23319
- "rule": "regex",
23320
- "pattern": "(?=.*\\d+)(?=.*[A-Za-z]+).{8,20}",
23321
- "errorMessage": "Password must contain at least 1 letter and 1 digit, and its minimal length is 8."
23322
- }
23323
- ]
23324
- },
23325
- "inputType": "password"
23326
- },
23327
- {
23328
- "name": "email",
23329
- "displayName": "Email",
23330
- "defaultValue": null,
23331
- "validate": {
23332
- "mandatory": true,
23333
- "type": "email",
23334
- "custom": [
23335
- {
23336
- "rule": "unique-email",
23337
- "errorMessage": "Please check your email"
23338
- },
23339
- {
23340
- "rule": "regex",
23341
- "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z-9.-]+\\.[a-zA-Z]{2,3}$",
23342
- "errorMessage": "Please enter a valid email address"
23343
- },
23344
- {
23345
- "rule": "duplicate-input",
23346
- "displayName": "pt al doilea input gen: Confirm Email",
23347
- "errorMessage": "Different Email! Pls."
23348
- }
23349
- ]
23350
- }
23351
- },
23352
- {
23353
- "name": "termsAndConditions",
23354
- "displayName": "Terms and Conditions",
23355
- "validate": {
23356
- "mandatory": true,
23357
- "type": "boolean"
23358
- },
23359
- "inputType": "checkbox"
23360
- },
23361
- {
23362
- "name": "pepCheck",
23363
- "validate": {
23364
- "mandatory": true
23365
- },
23366
- "inputType": "checkbox"
23367
- },
23368
- {
23369
- "name": "gender",
23370
- "data": {
23371
- "values": [
23372
- {
23373
- "label": "🍆",
23374
- "value": "m"
23375
- },
23376
- {
23377
- "label": "🍑",
23378
- "value": "f"
23379
- }
23380
- ]
23381
- },
23382
- "validate": {
23383
- "mandatory": true
23384
- },
23385
- "inputType": "radio"
23386
- },
23387
- {
23388
- "name": "dateOfBirth",
23389
- "validate": {
23390
- "mandatory": true,
23391
- "custom": [
23392
- {
23393
- "rule": "regex",
23394
- "pattern": "(?:19\\d{2}|20[01][0-9]|2020)[-/.](?:0[1-9]|1[012])[-/.](?:0[1-9]|[12][0-9]|3[01])",
23395
- "errorMessage": "Invalid date format"
23396
- },
23397
- {
23398
- "rule": "min-18-years",
23399
- "errorMessage": "Not old enough to ride the roller coaster"
23400
- }
23401
- ]
23402
- }
23403
- },
23404
- {
23405
- "name": "city",
23406
- "displayName": "Cities",
23407
- "action": null,
23408
- "data": {
23409
- "values": [
23410
- {
23411
- "label": "Budapest",
23412
- "value": "Budapest"
23413
- },
23414
- {
23415
- "label": "Debrecen",
23416
- "value": "Debrecen"
23417
- },
23418
- {
23419
- "label": "Miskolc",
23420
- "value": "Miskolc"
23421
- },
23422
- {
23423
- "label": "Szeged",
23424
- "value": "Szeged"
23425
- },
23426
- {
23427
- "label": "Zuglo",
23428
- "value": "Zuglo"
23429
- }
23430
- ]
23431
- },
23432
- "validate": {
23433
- "mandatory": true
23434
- },
23435
- "inputType": "dropdown"
23436
- },
23437
- {
23438
- "name": "city",
23439
- "displayName": "Cities",
23440
- "data": null,
23441
- "action": "GET https://demo-api.stage.norway.everymatrix.com/v1/player/countries",
23442
- "validate": {
23443
- "mandatory": true
23444
- },
23445
- "inputType": "dropdown"
23446
- }
23447
- ],
23448
- "actions": [
23449
- "get-next-step",
23450
- "some-async-action-before-submitting",
23451
- "submit-step-data"
23452
- ]
23453
- }
23454
- };
23255
+ this.registrationWidgetLoaded = index.createEvent(this, "registrationWidgetLoaded", 7);
23256
+ this.registrationStepUpdated = index.createEvent(this, "registrationStepUpdated", 7);
23455
23257
  /**
23456
23258
  * Currently selected language
23457
23259
  */
23458
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 = '';
23459
23269
  this.emitValue = false;
23460
23270
  this.listOfInputs = [];
23461
23271
  this.isLoading = true;
23272
+ this.limitStylingAppends = false;
23462
23273
  this.listOfInputValues = [];
23463
23274
  this.listOfActions = [];
23464
- this.steps = [];
23275
+ this.indexStep = 0;
23465
23276
  this.registrationStepsState = {
23466
23277
  regId: null
23467
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
+ };
23468
23294
  }
23469
- logger() {
23470
- console.log(this.registrationStep);
23295
+ sendStep() {
23296
+ this.registrationStepUpdated.emit(this.registrationStep);
23297
+ window.postMessage({ type: 'registrationStepUpdated', step: this.registrationStep }, window.location.href);
23471
23298
  }
23472
23299
  checkInputsValidityHandler(event) {
23473
23300
  // Set isValid state of the input in the list.
@@ -23484,18 +23311,24 @@ const GeneralRegistration = class {
23484
23311
  this.stepsStateMachine({ event: 'set', type: 'values' });
23485
23312
  }
23486
23313
  componentWillLoad() {
23487
- // const mockCall = Promise.resolve(this.data);
23488
- // return mockCall.then((data) => {
23489
- // this.listOfInputs = data.content.fields.map((field) => {
23490
- // this.isLoading = false;
23491
- // return { ...field, isValid: false };
23492
- // });
23493
- // });
23494
23314
  return this.getRegisterConfig().then((config) => {
23495
23315
  this.formatConfig(config);
23496
23316
  this.stepsStateMachine({ event: 'set', type: 'inputs' });
23497
23317
  });
23498
23318
  }
23319
+ componentDidRender() {
23320
+ if (!this.limitStylingAppends && this.stylingContainer) {
23321
+ if (this.clientStyling)
23322
+ this.setClientStyling();
23323
+ if (this.clientStylingUrl)
23324
+ this.setClientStylingURL();
23325
+ this.limitStylingAppends = true;
23326
+ }
23327
+ }
23328
+ componentDidLoad() {
23329
+ this.registrationWidgetLoaded.emit();
23330
+ window.postMessage({ type: 'registrationWidgetLoaded' }, window.location.href);
23331
+ }
23499
23332
  nextHandler(e) {
23500
23333
  e.preventDefault();
23501
23334
  // Trigger events in subwidgets.
@@ -23504,8 +23337,8 @@ const GeneralRegistration = class {
23504
23337
  }
23505
23338
  backHandler(e) {
23506
23339
  e.preventDefault();
23507
- this.steps.pop();
23508
- this.registrationStep = this.steps.at(-1);
23340
+ this.isLastStep = false;
23341
+ this.registrationStep = this.stepChange('decrement');
23509
23342
  this.stepsStateMachine({ event: 'get', type: 'inputs' });
23510
23343
  this.stepsStateMachine({ event: 'get', type: 'values' });
23511
23344
  }
@@ -23514,10 +23347,11 @@ const GeneralRegistration = class {
23514
23347
  case 'set':
23515
23348
  if (state.type == 'inputs') {
23516
23349
  this.registrationStepsState[this.registrationStep].fields = this.listOfInputs;
23350
+ this.registrationStepsState[this.registrationStep].actions = this.listOfActions;
23517
23351
  }
23518
23352
  if (state.type == 'values') {
23519
23353
  this.registrationStepsState[this.registrationStep].registerUserData = this.listOfInputValues.reduce((acc, curr) => {
23520
- acc[curr.name] = curr.value;
23354
+ acc[curr.name] = { value: curr.value, isDuplicate: curr.isDuplicate };
23521
23355
  return acc;
23522
23356
  }, {});
23523
23357
  }
@@ -23529,17 +23363,19 @@ const GeneralRegistration = class {
23529
23363
  return;
23530
23364
  if (state.type == 'inputs') {
23531
23365
  this.listOfInputs = this.registrationStepsState[this.registrationStep].fields;
23366
+ this.listOfActions = this.registrationStepsState[this.registrationStep].actions;
23532
23367
  }
23533
23368
  if (state.type == 'values') {
23534
23369
  const savedValues = savedUserData[this.registrationStep].registerUserData;
23535
23370
  this.listOfInputValues = Object.keys(savedValues).map(name => {
23536
- return { name, value: savedValues[name] };
23371
+ return { name, value: savedValues[name].value, isDuplicate: savedValues[name].isDuplicate };
23537
23372
  });
23538
23373
  // Give to each field the user input as the default value.
23539
23374
  this.listOfInputValues.forEach(inputValue => {
23540
23375
  const input = this.listOfInputs.find(input => input.name === inputValue.name);
23541
23376
  if (input) {
23542
23377
  input.defaultValue = inputValue.value;
23378
+ console.log(input);
23543
23379
  }
23544
23380
  });
23545
23381
  }
@@ -23577,7 +23413,9 @@ const GeneralRegistration = class {
23577
23413
  const url = new URL(`${this.endpoint}/v1/player/legislation/registration/step`);
23578
23414
  const registerStep = {
23579
23415
  registrationId: this.registrationID,
23580
- registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
23416
+ registerUserDto: this.listOfInputValues
23417
+ .filter(input => !input.isDuplicate)
23418
+ .reduce((acc, curr) => {
23581
23419
  // Special case for "Mobile" as it needs to be split in two values -- API expects it this way.
23582
23420
  if (curr.name == "Mobile") {
23583
23421
  acc['MobilePrefix'] = curr.value.split('|')[0];
@@ -23611,12 +23449,22 @@ const GeneralRegistration = class {
23611
23449
  this.setRegister();
23612
23450
  }
23613
23451
  else {
23614
- this.getRegisterConfig(this.registrationID).then((config) => {
23615
- // Format the new step config.
23616
- this.formatConfig(config);
23617
- // Set it in local storage
23618
- this.stepsStateMachine({ event: 'set', type: 'inputs' });
23619
- });
23452
+ // After sending the current step, increment and check if the next one is in state.
23453
+ this.registrationStep = this.stepChange('increment');
23454
+ // If step is present in state do NOT fetch the next config.
23455
+ if (Object.keys(this.registrationStepsState).find(key => key == this.registrationStep)) {
23456
+ // Use the one from state
23457
+ this.stepsStateMachine({ event: 'get', type: 'inputs' });
23458
+ this.stepsStateMachine({ event: 'get', type: 'values' });
23459
+ }
23460
+ else {
23461
+ this.getRegisterConfig(this.registrationID).then((config) => {
23462
+ // Format the new step config.
23463
+ this.formatConfig(config);
23464
+ // Set it in local storage.
23465
+ this.stepsStateMachine({ event: 'set', type: 'inputs' });
23466
+ });
23467
+ }
23620
23468
  }
23621
23469
  })
23622
23470
  .catch((err) => {
@@ -23658,52 +23506,69 @@ const GeneralRegistration = class {
23658
23506
  }
23659
23507
  formatConfig(config) {
23660
23508
  // Populate the list of inputs and set as invalid in the beginning
23661
- let newListOfInputs = config.content.fields.map((field) => {
23662
- return Object.assign(Object.assign({}, field), { isValid: false });
23509
+ this.listOfInputs = config.content.fields.flatMap((field) => {
23510
+ // Special case for inputs that need to be duplicated.
23511
+ const duplicateInputRule = field.validate.custom.find(customRule => customRule.rule === 'duplicate-input');
23512
+ const inputElement = Object.assign(Object.assign({}, field), { isValid: false });
23513
+ if (duplicateInputRule) {
23514
+ const duplicateInput = Object.assign(Object.assign({}, field), { name: `${field.name}Duplicate`, displayName: duplicateInputRule.displayName, isValid: false, isDuplicateInput: true });
23515
+ return [inputElement, duplicateInput];
23516
+ }
23517
+ else {
23518
+ return [inputElement];
23519
+ }
23663
23520
  });
23664
- this.listOfInputs = JSON.parse(JSON.stringify(newListOfInputs));
23665
23521
  // Populate the list of inputs values and set as null in the beginning
23666
- this.listOfInputValues = config.content.fields.map(field => {
23667
- return { name: field.name, value: null };
23522
+ this.listOfInputValues = this.listOfInputs.map(field => {
23523
+ return { name: field.name, value: null, isDuplicate: field.isDuplicateInput || false };
23668
23524
  });
23669
23525
  // Set the list of actions
23670
23526
  this.listOfActions = config.content.actions.map(action => action);
23671
23527
  this.isLastStep = this.listOfActions.some(action => action == '/register');
23672
23528
  this.registrationID = config.content.registrationID;
23673
23529
  this.registrationStep = config.content.step;
23674
- this.steps.push(this.registrationStep);
23675
23530
  // Add the step to the registrationStepsData
23676
23531
  this.registrationStepsState.regId = this.registrationID;
23677
23532
  if (!this.registrationStepsState[this.registrationStep]) {
23678
23533
  this.registrationStepsState[this.registrationStep] = {
23679
23534
  fields: [],
23680
- registerUserData: {}
23535
+ registerUserData: {},
23536
+ actions: []
23681
23537
  };
23682
23538
  }
23683
23539
  }
23540
+ stepChange(action) {
23541
+ const stepNum = parseInt(this.registrationStep.replace('Step', ''));
23542
+ if (action === 'increment') {
23543
+ return 'Step' + (stepNum + 1);
23544
+ }
23545
+ if (action === 'decrement') {
23546
+ return 'Step' + (stepNum - 1);
23547
+ }
23548
+ }
23684
23549
  getInvalidStatus(listOfInputs) {
23685
23550
  return listOfInputs.filter(input => input.isValid == false).length > 0;
23686
23551
  }
23687
23552
  renderInputs() {
23688
- 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 })));
23553
+ 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 })));
23689
23554
  }
23690
23555
  ;
23691
23556
  renderButtons() {
23692
- 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))));
23557
+ 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))));
23693
23558
  }
23694
23559
  render() {
23695
23560
  if (this.isLoading) {
23696
23561
  return index.h("p", null, "Please wait, loading ...");
23697
23562
  }
23698
- return (index.h("div", { class: 'registration' }, index.h("form", { action: '.', id: 'RegistrationForm', class: 'registration__form' }, this.renderInputs()), this.renderButtons()));
23563
+ 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()));
23699
23564
  }
23700
23565
  static get watchers() { return {
23701
- "registrationStep": ["logger"]
23566
+ "registrationStep": ["sendStep"]
23702
23567
  }; }
23703
23568
  };
23704
23569
  GeneralRegistration.style = generalRegistrationCss;
23705
23570
 
23706
- 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}";
23571
+ 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}";
23707
23572
 
23708
23573
  const NumberInput = class {
23709
23574
  constructor(hostRef) {
@@ -23763,176 +23628,985 @@ const NumberInput = class {
23763
23628
  };
23764
23629
  NumberInput.style = numberInputCss;
23765
23630
 
23766
- 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}";
23767
-
23768
- const PasswordInput = class {
23769
- constructor(hostRef) {
23770
- index.registerInstance(this, hostRef);
23771
- this.sendValidityState = index.createEvent(this, "sendValidityState", 7);
23772
- this.sendInputValue = index.createEvent(this, "sendInputValue", 7);
23773
- /**
23774
- * Default value for the input.
23775
- */
23776
- this.defaultValue = '';
23777
- this.value = '';
23778
- this.validationPattern = '';
23779
- }
23780
- validityChanged() {
23781
- this.validityStateHandler({ valid: this.isValid, name: this.name });
23782
- if (this.emitValue == true) {
23783
- this.valueHandler({ name: this.name, value: this.value });
23784
- }
23785
- }
23786
- validityStateHandler(inputStateEvent) {
23787
- this.sendValidityState.emit(inputStateEvent);
23788
- }
23789
- emitValueHandler(newValue) {
23790
- if (newValue == true && this.isValid) {
23791
- this.valueHandler({ name: this.name, value: this.value });
23792
- }
23793
- }
23794
- valueHandler(inputValueEvent) {
23795
- this.sendInputValue.emit(inputValueEvent);
23796
- }
23797
- connectedCallback() {
23798
- this.validationPattern = this.setPattern();
23799
- }
23800
- componentDidLoad() {
23801
- if (this.defaultValue) {
23802
- this.value = this.defaultValue;
23803
- this.valueHandler({ name: this.name, value: this.value });
23804
- }
23805
- }
23806
- handleInput(event) {
23807
- this.value = event.target.value;
23808
- this.errorMessage = this.setErrorMessage();
23809
- this.isValid = this.setValidity();
23810
- this.validityStateHandler({ valid: this.isValid, name: this.name });
23811
- this.emitValueHandler(true);
23812
- }
23813
- setValidity() {
23814
- return this.inputReference.validity.valid;
23815
- }
23816
- setPattern() {
23817
- var _a, _b;
23818
- if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
23819
- return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
23820
- }
23821
- }
23822
- setErrorMessage() {
23823
- var _a;
23824
- if (this.inputReference.validity.patternMismatch) {
23825
- return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
23826
- }
23827
- if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
23828
- return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
23829
- }
23830
- if (this.inputReference.validity.valueMissing) {
23831
- return translate$2('requiredError', this.language);
23832
- }
23833
- }
23834
- render() {
23835
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'password__input--invalid';
23836
- 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));
23837
- }
23838
- static get watchers() { return {
23839
- "isValid": ["validityChanged"],
23840
- "emitValue": ["emitValueHandler"]
23841
- }; }
23842
- };
23843
- PasswordInput.style = passwordInputCss;
23844
-
23845
- 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}";
23631
+ /**
23632
+ * @license
23633
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
23634
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
23635
+ */
23846
23636
 
23847
- const RadioInput = class {
23848
- constructor(hostRef) {
23849
- index.registerInstance(this, hostRef);
23850
- this.sendInputValue = index.createEvent(this, "sendInputValue", 7);
23851
- this.sendValidityState = index.createEvent(this, "sendValidityState", 7);
23852
- }
23853
- validityChanged() {
23854
- this.validityStateHandler({ valid: this.isValid, name: this.name });
23855
- if (this.emitValue == true) {
23856
- this.valueHandler({ name: this.name, value: this.value });
23857
- }
23858
- }
23859
- emitValueHandler(newValue) {
23860
- if (newValue == true && this.isValid) {
23861
- this.valueHandler({ name: this.name, value: this.value });
23862
- }
23863
- }
23864
- valueHandler(inputValueEvent) {
23865
- this.sendInputValue.emit(inputValueEvent);
23866
- }
23867
- validityStateHandler(inputStateEvent) {
23868
- this.sendValidityState.emit(inputStateEvent);
23869
- }
23870
- connectedCallback() {
23871
- }
23872
- handleClick(event) {
23873
- this.value = event.target.value;
23874
- this.isValid = this.setValidity();
23875
- this.errorMessage = this.setErrorMessage();
23876
- this.validityStateHandler({ valid: this.isValid, name: this.name });
23877
- this.emitValueHandler(true);
23878
- }
23879
- setValidity() {
23880
- return this.inputReference.validity.valid;
23881
- }
23882
- setErrorMessage() {
23883
- if (this.inputReference.validity.valueMissing) {
23884
- return translate$2('requiredError', this.language);
23885
- }
23886
- }
23887
- render() {
23888
- return index.h("fieldset", { class: 'radio__fieldset' }, index.h("legend", { class: 'radio__legend' }, this.displayName, ":"), this.optionsGroup.map(option => index.h("div", { class: 'radio__wrapper' }, index.h("input", { type: "radio", class: 'radio__input', id: `${option.label}__input`, ref: (el) => this.inputReference = el, value: option.value, name: this.name, required: this.validation.mandatory, onClick: (e) => this.handleClick(e) }), index.h("label", { htmlFor: `${option.label}__input` }, option.label))), index.h("small", { class: 'radio__error-message' }, this.errorMessage));
23889
- }
23890
- static get watchers() { return {
23891
- "isValid": ["validityChanged"],
23892
- "emitValue": ["emitValueHandler"]
23893
- }; }
23894
- };
23895
- RadioInput.style = radioInputCss;
23637
+ registerStyles('vaadin-text-field', inputFieldShared$1, {
23638
+ moduleId: 'lumo-text-field-styles',
23639
+ });
23896
23640
 
23897
23641
  /**
23898
23642
  * @license
23899
- * Copyright (c) 2022 Vaadin Ltd.
23643
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
23900
23644
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
23901
23645
  */
23902
23646
 
23903
- const loader = i$1`
23904
- [part~='loader'] {
23905
- box-sizing: border-box;
23906
- width: var(--lumo-icon-size-s);
23907
- height: var(--lumo-icon-size-s);
23908
- border: 2px solid transparent;
23909
- border-color: var(--lumo-primary-color-10pct) var(--lumo-primary-color-10pct) var(--lumo-primary-color)
23910
- var(--lumo-primary-color);
23911
- border-radius: calc(0.5 * var(--lumo-icon-size-s));
23912
- opacity: 0;
23913
- pointer-events: none;
23914
- }
23915
-
23916
- :host(:not([loading])) [part~='loader'] {
23917
- display: none;
23918
- }
23647
+ /**
23648
+ * A mixin to provide logic for vaadin-text-field and related components.
23649
+ *
23650
+ * @polymerMixin
23651
+ * @mixes InputControlMixin
23652
+ */
23653
+ const InputFieldMixin = (superclass) =>
23654
+ class InputFieldMixinClass extends InputControlMixin(superclass) {
23655
+ static get properties() {
23656
+ return {
23657
+ /**
23658
+ * Whether the value of the control can be automatically completed by the browser.
23659
+ * List of available options at:
23660
+ * https://developer.mozilla.org/en/docs/Web/HTML/Element/input#attr-autocomplete
23661
+ */
23662
+ autocomplete: {
23663
+ type: String,
23664
+ },
23919
23665
 
23920
- :host([loading]) [part~='loader'] {
23921
- animation: 1s linear infinite lumo-loader-rotate, 0.3s 0.1s lumo-loader-fade-in both;
23922
- }
23666
+ /**
23667
+ * This is a property supported by Safari that is used to control whether
23668
+ * autocorrection should be enabled when the user is entering/editing the text.
23669
+ * Possible values are:
23670
+ * on: Enable autocorrection.
23671
+ * off: Disable autocorrection.
23672
+ */
23673
+ autocorrect: {
23674
+ type: String,
23675
+ },
23923
23676
 
23924
- @keyframes lumo-loader-fade-in {
23925
- 0% {
23926
- opacity: 0;
23677
+ /**
23678
+ * This is a property supported by Safari and Chrome that is used to control whether
23679
+ * autocapitalization should be enabled when the user is entering/editing the text.
23680
+ * Possible values are:
23681
+ * characters: Characters capitalization.
23682
+ * words: Words capitalization.
23683
+ * sentences: Sentences capitalization.
23684
+ * none: No capitalization.
23685
+ */
23686
+ autocapitalize: {
23687
+ type: String,
23688
+ reflectToAttribute: true,
23689
+ },
23690
+ };
23927
23691
  }
23928
23692
 
23929
- 100% {
23930
- opacity: 1;
23693
+ static get delegateAttrs() {
23694
+ return [...super.delegateAttrs, 'autocapitalize', 'autocomplete', 'autocorrect'];
23931
23695
  }
23932
- }
23933
23696
 
23934
- @keyframes lumo-loader-rotate {
23935
- 0% {
23697
+ /**
23698
+ * @param {HTMLElement} input
23699
+ * @protected
23700
+ * @override
23701
+ */
23702
+ _inputElementChanged(input) {
23703
+ super._inputElementChanged(input);
23704
+
23705
+ if (input) {
23706
+ // Discard value set on the custom slotted input.
23707
+ if (input.value && input.value !== this.value) {
23708
+ console.warn(`Please define value on the <${this.localName}> component!`);
23709
+ input.value = '';
23710
+ }
23711
+
23712
+ if (this.value) {
23713
+ input.value = this.value;
23714
+ }
23715
+ }
23716
+ }
23717
+
23718
+ // Workaround for https://github.com/Polymer/polymer/issues/5259
23719
+ get __data() {
23720
+ return this.__dataValue || {};
23721
+ }
23722
+
23723
+ set __data(value) {
23724
+ this.__dataValue = value;
23725
+ }
23726
+
23727
+ /**
23728
+ * Override an event listener from `FocusMixin`.
23729
+ * @param {boolean} focused
23730
+ * @protected
23731
+ * @override
23732
+ */
23733
+ _setFocused(focused) {
23734
+ super._setFocused(focused);
23735
+
23736
+ if (!focused) {
23737
+ this.validate();
23738
+ }
23739
+ }
23740
+
23741
+ /**
23742
+ * Override an event listener from `InputMixin`
23743
+ * to mark as valid after user started typing.
23744
+ * @param {Event} event
23745
+ * @protected
23746
+ * @override
23747
+ */
23748
+ _onInput(event) {
23749
+ super._onInput(event);
23750
+
23751
+ if (this.invalid) {
23752
+ this.validate();
23753
+ }
23754
+ }
23755
+
23756
+ /**
23757
+ * Override an observer from `InputMixin` to validate the field
23758
+ * when a new value is set programmatically.
23759
+ *
23760
+ * @param {string | undefined} newValue
23761
+ * @param {string | undefined} oldValue
23762
+ * @protected
23763
+ * @override
23764
+ */
23765
+ _valueChanged(newValue, oldValue) {
23766
+ super._valueChanged(newValue, oldValue);
23767
+
23768
+ if (oldValue === undefined) {
23769
+ return;
23770
+ }
23771
+
23772
+ if (this.invalid) {
23773
+ this.validate();
23774
+ }
23775
+ }
23776
+ };
23777
+
23778
+ /**
23779
+ * @license
23780
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
23781
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
23782
+ */
23783
+
23784
+ /**
23785
+ * A mixin to provide `pattern` and `preventInvalidInput` properties.
23786
+ *
23787
+ * @polymerMixin
23788
+ * @mixes InputConstraintsMixin
23789
+ */
23790
+ const PatternMixin = (superclass) =>
23791
+ class PatternMixinClass extends InputConstraintsMixin(superclass) {
23792
+ static get properties() {
23793
+ return {
23794
+ /**
23795
+ * A regular expression that the value is checked against.
23796
+ * The pattern must match the entire value, not just some subset.
23797
+ */
23798
+ pattern: {
23799
+ type: String,
23800
+ },
23801
+
23802
+ /**
23803
+ * When set to true, user is prevented from typing a value that
23804
+ * conflicts with the given `pattern`.
23805
+ * @attr {boolean} prevent-invalid-input
23806
+ * @deprecated Please use `allowedCharPattern` instead.
23807
+ */
23808
+ preventInvalidInput: {
23809
+ type: Boolean,
23810
+ observer: '_preventInvalidInputChanged',
23811
+ },
23812
+ };
23813
+ }
23814
+
23815
+ static get delegateAttrs() {
23816
+ return [...super.delegateAttrs, 'pattern'];
23817
+ }
23818
+
23819
+ static get constraints() {
23820
+ return [...super.constraints, 'pattern'];
23821
+ }
23822
+
23823
+ /** @private */
23824
+ _checkInputValue() {
23825
+ if (this.preventInvalidInput) {
23826
+ const input = this.inputElement;
23827
+ if (input && input.value.length > 0 && !this.checkValidity()) {
23828
+ input.value = this.value || '';
23829
+ // Add input-prevented attribute for 200ms
23830
+ this.setAttribute('input-prevented', '');
23831
+ this._inputDebouncer = Debouncer$1.debounce(this._inputDebouncer, timeOut.after(200), () => {
23832
+ this.removeAttribute('input-prevented');
23833
+ });
23834
+ }
23835
+ }
23836
+ }
23837
+
23838
+ /**
23839
+ * @param {Event} event
23840
+ * @protected
23841
+ * @override
23842
+ */
23843
+ _onInput(event) {
23844
+ this._checkInputValue();
23845
+
23846
+ super._onInput(event);
23847
+ }
23848
+
23849
+ /** @private */
23850
+ _preventInvalidInputChanged(preventInvalidInput) {
23851
+ if (preventInvalidInput) {
23852
+ console.warn(
23853
+ `WARNING: Since Vaadin 23.2, "preventInvalidInput" is deprecated. Please use "allowedCharPattern" instead.`,
23854
+ );
23855
+ }
23856
+ }
23857
+ };
23858
+
23859
+ /**
23860
+ * @license
23861
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
23862
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
23863
+ */
23864
+
23865
+ registerStyles('vaadin-text-field', inputFieldShared, { moduleId: 'vaadin-text-field-styles' });
23866
+
23867
+ /**
23868
+ * `<vaadin-text-field>` is a web component that allows the user to input and edit text.
23869
+ *
23870
+ * ```html
23871
+ * <vaadin-text-field label="First Name"></vaadin-text-field>
23872
+ * ```
23873
+ *
23874
+ * ### Prefixes and suffixes
23875
+ *
23876
+ * These are child elements of a `<vaadin-text-field>` that are displayed
23877
+ * inline with the input, before or after.
23878
+ * In order for an element to be considered as a prefix, it must have the slot
23879
+ * attribute set to `prefix` (and similarly for `suffix`).
23880
+ *
23881
+ * ```html
23882
+ * <vaadin-text-field label="Email address">
23883
+ * <div slot="prefix">Sent to:</div>
23884
+ * <div slot="suffix">@vaadin.com</div>
23885
+ * </vaadin-text-field>
23886
+ * ```
23887
+ *
23888
+ * ### Styling
23889
+ *
23890
+ * The following custom properties are available for styling:
23891
+ *
23892
+ * Custom property | Description | Default
23893
+ * -------------------------------|----------------------------|---------
23894
+ * `--vaadin-field-default-width` | Default width of the field | `12em`
23895
+ *
23896
+ * The following shadow DOM parts are available for styling:
23897
+ *
23898
+ * Part name | Description
23899
+ * ---------------------|----------------
23900
+ * `label` | The label element
23901
+ * `input-field` | The element that wraps prefix, value and suffix
23902
+ * `clear-button` | The clear button
23903
+ * `error-message` | The error message element
23904
+ * `helper-text` | The helper text element wrapper
23905
+ * `required-indicator` | The `required` state indicator element
23906
+ *
23907
+ * The following state attributes are available for styling:
23908
+ *
23909
+ * Attribute | Description | Part name
23910
+ * --------------------|-------------|------------
23911
+ * `disabled` | Set to a disabled text field | :host
23912
+ * `has-value` | Set when the element has a value | :host
23913
+ * `has-label` | Set when the element has a label | :host
23914
+ * `has-helper` | Set when the element has helper text or slot | :host
23915
+ * `has-error-message` | Set when the element has an error message | :host
23916
+ * `invalid` | Set when the element is invalid | :host
23917
+ * `input-prevented` | Temporarily set when invalid input is prevented | :host
23918
+ * `focused` | Set when the element is focused | :host
23919
+ * `focus-ring` | Set when the element is keyboard focused | :host
23920
+ * `readonly` | Set to a readonly text field | :host
23921
+ *
23922
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
23923
+ *
23924
+ * @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.
23925
+ * @fires {Event} change - Fired when the user commits a value change.
23926
+ * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
23927
+ * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
23928
+ * @fires {CustomEvent} validated - Fired whenever the field is validated.
23929
+ *
23930
+ * @extends HTMLElement
23931
+ * @mixes ElementMixin
23932
+ * @mixes ThemableMixin
23933
+ * @mixes PatternMixin
23934
+ * @mixes InputFieldMixin
23935
+ */
23936
+ class TextField extends PatternMixin(InputFieldMixin(ThemableMixin(ElementMixin(PolymerElement)))) {
23937
+ static get is() {
23938
+ return 'vaadin-text-field';
23939
+ }
23940
+
23941
+ static get template() {
23942
+ return html`
23943
+ <style>
23944
+ [part='input-field'] {
23945
+ flex-grow: 0;
23946
+ }
23947
+ </style>
23948
+
23949
+ <div class="vaadin-field-container">
23950
+ <div part="label">
23951
+ <slot name="label"></slot>
23952
+ <span part="required-indicator" aria-hidden="true" on-click="focus"></span>
23953
+ </div>
23954
+
23955
+ <vaadin-input-container
23956
+ part="input-field"
23957
+ readonly="[[readonly]]"
23958
+ disabled="[[disabled]]"
23959
+ invalid="[[invalid]]"
23960
+ theme$="[[_theme]]"
23961
+ >
23962
+ <slot name="prefix" slot="prefix"></slot>
23963
+ <slot name="input"></slot>
23964
+ <slot name="suffix" slot="suffix"></slot>
23965
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
23966
+ </vaadin-input-container>
23967
+
23968
+ <div part="helper-text">
23969
+ <slot name="helper"></slot>
23970
+ </div>
23971
+
23972
+ <div part="error-message">
23973
+ <slot name="error-message"></slot>
23974
+ </div>
23975
+ </div>
23976
+ <slot name="tooltip"></slot>
23977
+ `;
23978
+ }
23979
+
23980
+ static get properties() {
23981
+ return {
23982
+ /**
23983
+ * Maximum number of characters (in Unicode code points) that the user can enter.
23984
+ */
23985
+ maxlength: {
23986
+ type: Number,
23987
+ },
23988
+
23989
+ /**
23990
+ * Minimum number of characters (in Unicode code points) that the user can enter.
23991
+ */
23992
+ minlength: {
23993
+ type: Number,
23994
+ },
23995
+ };
23996
+ }
23997
+
23998
+ static get delegateAttrs() {
23999
+ return [...super.delegateAttrs, 'maxlength', 'minlength'];
24000
+ }
24001
+
24002
+ static get constraints() {
24003
+ return [...super.constraints, 'maxlength', 'minlength'];
24004
+ }
24005
+
24006
+ constructor() {
24007
+ super();
24008
+ this._setType('text');
24009
+ }
24010
+
24011
+ /** @protected */
24012
+ get clearElement() {
24013
+ return this.$.clearButton;
24014
+ }
24015
+
24016
+ /** @protected */
24017
+ ready() {
24018
+ super.ready();
24019
+
24020
+ this.addController(
24021
+ new InputController(this, (input) => {
24022
+ this._setInputElement(input);
24023
+ this._setFocusElement(input);
24024
+ this.stateTarget = input;
24025
+ this.ariaTarget = input;
24026
+ }),
24027
+ );
24028
+ this.addController(new LabelledInputController(this.inputElement, this._labelController));
24029
+
24030
+ this._tooltipController = new TooltipController(this);
24031
+ this._tooltipController.setPosition('top');
24032
+ this.addController(this._tooltipController);
24033
+ }
24034
+ }
24035
+
24036
+ customElements.define(TextField.is, TextField);
24037
+
24038
+ /**
24039
+ * @license
24040
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
24041
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
24042
+ */
24043
+
24044
+ const passwordFieldButton = i$1`
24045
+ :host {
24046
+ position: absolute;
24047
+ right: 0;
24048
+ top: 0;
24049
+ margin: 0;
24050
+ padding: 0;
24051
+ width: 100%;
24052
+ height: 100%;
24053
+ min-width: auto;
24054
+ background: transparent;
24055
+ outline: none;
24056
+ }
24057
+ `;
24058
+
24059
+ registerStyles('vaadin-password-field-button', [button, passwordFieldButton], {
24060
+ moduleId: 'lumo-password-field-button',
24061
+ });
24062
+
24063
+ /**
24064
+ * @license
24065
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
24066
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
24067
+ */
24068
+
24069
+ const passwordField = i$1`
24070
+ [part='reveal-button']::before {
24071
+ content: var(--lumo-icons-eye);
24072
+ }
24073
+
24074
+ :host([password-visible]) [part='reveal-button']::before {
24075
+ content: var(--lumo-icons-eye-disabled);
24076
+ }
24077
+
24078
+ /* Make it easy to hide the button across the whole app */
24079
+ [part='reveal-button'] {
24080
+ position: relative;
24081
+ display: var(--lumo-password-field-reveal-button-display, block);
24082
+ }
24083
+
24084
+ [part='reveal-button'][hidden] {
24085
+ display: none !important;
24086
+ }
24087
+ `;
24088
+
24089
+ registerStyles('vaadin-password-field', [inputFieldShared$1, passwordField], { moduleId: 'lumo-password-field' });
24090
+
24091
+ /**
24092
+ * @license
24093
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
24094
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
24095
+ */
24096
+
24097
+ /**
24098
+ * An element used internally by `<vaadin-password-field>`. Not intended to be used separately.
24099
+ *
24100
+ * @extends Button
24101
+ * @private
24102
+ */
24103
+ class PasswordFieldButton extends Button {
24104
+ static get is() {
24105
+ return 'vaadin-password-field-button';
24106
+ }
24107
+
24108
+ static get template() {
24109
+ return html`
24110
+ <style>
24111
+ :host {
24112
+ display: block;
24113
+ }
24114
+
24115
+ :host([hidden]) {
24116
+ display: none !important;
24117
+ }
24118
+ </style>
24119
+ <slot name="tooltip"></slot>
24120
+ `;
24121
+ }
24122
+ }
24123
+
24124
+ customElements.define(PasswordFieldButton.is, PasswordFieldButton);
24125
+
24126
+ /**
24127
+ * @license
24128
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
24129
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
24130
+ */
24131
+
24132
+ const ownTemplate = html`
24133
+ <div part="reveal-button" slot="suffix">
24134
+ <slot name="reveal"></slot>
24135
+ </div>
24136
+ `;
24137
+
24138
+ let memoizedTemplate$1;
24139
+
24140
+ /**
24141
+ * `<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.
24142
+ *
24143
+ * ```html
24144
+ * <vaadin-password-field label="Password"></vaadin-password-field>
24145
+ * ```
24146
+ *
24147
+ * ### Styling
24148
+ *
24149
+ * `<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.
24150
+ * See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.
24151
+ *
24152
+ * In addition to `<vaadin-text-field>` parts, the following parts are available for theming:
24153
+ *
24154
+ * Part name | Description
24155
+ * ----------------|----------------------------------------------------
24156
+ * `reveal-button` | The eye icon which toggles the password visibility
24157
+ *
24158
+ * In addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:
24159
+ *
24160
+ * Attribute | Description
24161
+ * -------------------|---------------------------------
24162
+ * `password-visible` | Set when the password is visible
24163
+ *
24164
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
24165
+ *
24166
+ * @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.
24167
+ * @fires {Event} change - Fired when the user commits a value change.
24168
+ * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
24169
+ * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
24170
+ * @fires {CustomEvent} validated - Fired whenever the field is validated.
24171
+ *
24172
+ * @extends TextField
24173
+ */
24174
+ class PasswordField extends TextField {
24175
+ static get is() {
24176
+ return 'vaadin-password-field';
24177
+ }
24178
+
24179
+ static get template() {
24180
+ if (!memoizedTemplate$1) {
24181
+ // Clone the superclass template
24182
+ memoizedTemplate$1 = super.template.cloneNode(true);
24183
+
24184
+ // Retrieve this element's dom-module template
24185
+ const revealButton = ownTemplate.content.querySelector('[part="reveal-button"]');
24186
+
24187
+ // Append reveal-button and styles to the text-field template
24188
+ const inputField = memoizedTemplate$1.content.querySelector('[part="input-field"]');
24189
+ inputField.appendChild(revealButton);
24190
+ }
24191
+
24192
+ return memoizedTemplate$1;
24193
+ }
24194
+
24195
+ static get properties() {
24196
+ return {
24197
+ /**
24198
+ * Set to true to hide the eye icon which toggles the password visibility.
24199
+ * @attr {boolean} reveal-button-hidden
24200
+ */
24201
+ revealButtonHidden: {
24202
+ type: Boolean,
24203
+ observer: '_revealButtonHiddenChanged',
24204
+ value: false,
24205
+ },
24206
+
24207
+ /**
24208
+ * True if the password is visible ([type=text]).
24209
+ * @attr {boolean} password-visible
24210
+ */
24211
+ passwordVisible: {
24212
+ type: Boolean,
24213
+ value: false,
24214
+ reflectToAttribute: true,
24215
+ observer: '_passwordVisibleChanged',
24216
+ readOnly: true,
24217
+ },
24218
+
24219
+ /**
24220
+ * An object with translated strings used for localization.
24221
+ * It has the following structure and default values:
24222
+ *
24223
+ * ```
24224
+ * {
24225
+ * // Translation of the reveal icon button accessible label
24226
+ * reveal: 'Show password'
24227
+ * }
24228
+ * ```
24229
+ */
24230
+ i18n: {
24231
+ type: Object,
24232
+ value: () => {
24233
+ return {
24234
+ reveal: 'Show password',
24235
+ };
24236
+ },
24237
+ },
24238
+ };
24239
+ }
24240
+
24241
+ static get observers() {
24242
+ return ['__i18nChanged(i18n.*)'];
24243
+ }
24244
+
24245
+ /** @protected */
24246
+ get slotStyles() {
24247
+ const tag = this.localName;
24248
+ return [
24249
+ ...super.slotStyles,
24250
+ `
24251
+ ${tag} [slot="input"]::-ms-reveal {
24252
+ display: none;
24253
+ }
24254
+ `,
24255
+ ];
24256
+ }
24257
+
24258
+ /** @protected */
24259
+ get _revealNode() {
24260
+ return this._revealButtonController && this._revealButtonController.node;
24261
+ }
24262
+
24263
+ constructor() {
24264
+ super();
24265
+ this._setType('password');
24266
+ this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
24267
+ this.__boundRevealButtonTouchend = this._onRevealButtonTouchend.bind(this);
24268
+ }
24269
+
24270
+ /** @protected */
24271
+ ready() {
24272
+ super.ready();
24273
+
24274
+ this._revealPart = this.shadowRoot.querySelector('[part="reveal-button"]');
24275
+
24276
+ this._revealButtonController = new SlotController(
24277
+ this,
24278
+ 'reveal',
24279
+ () => document.createElement('vaadin-password-field-button'),
24280
+ (host, btn) => {
24281
+ btn.disabled = host.disabled;
24282
+
24283
+ btn.addEventListener('click', host.__boundRevealButtonClick);
24284
+ btn.addEventListener('touchend', host.__boundRevealButtonTouchend);
24285
+ },
24286
+ );
24287
+ this.addController(this._revealButtonController);
24288
+
24289
+ this.__updateAriaLabel(this.i18n);
24290
+
24291
+ this._updateToggleState(false);
24292
+ this._toggleRevealHidden(this.revealButtonHidden);
24293
+
24294
+ if (this.inputElement) {
24295
+ this.inputElement.autocapitalize = 'off';
24296
+ }
24297
+ }
24298
+
24299
+ /**
24300
+ * Override method inherited from `FocusMixin` to mark field as focused
24301
+ * when focus moves to the reveal button using Shift Tab.
24302
+ * @param {Event} event
24303
+ * @return {boolean}
24304
+ * @protected
24305
+ */
24306
+ _shouldSetFocus(event) {
24307
+ return event.target === this.inputElement || event.target === this._revealNode;
24308
+ }
24309
+
24310
+ /**
24311
+ * Override method inherited from `FocusMixin` to not hide password
24312
+ * when focus moves to the reveal button or back to the input.
24313
+ * @param {Event} event
24314
+ * @return {boolean}
24315
+ * @protected
24316
+ */
24317
+ _shouldRemoveFocus(event) {
24318
+ return !(
24319
+ event.relatedTarget === this._revealNode ||
24320
+ (event.relatedTarget === this.inputElement && event.target === this._revealNode)
24321
+ );
24322
+ }
24323
+
24324
+ /**
24325
+ * Override method inherited from `FocusMixin` to toggle password visibility.
24326
+ * @param {boolean} focused
24327
+ * @protected
24328
+ * @override
24329
+ */
24330
+ _setFocused(focused) {
24331
+ super._setFocused(focused);
24332
+
24333
+ if (!focused) {
24334
+ this._setPasswordVisible(false);
24335
+ } else {
24336
+ const isButtonFocused = this.getRootNode().activeElement === this._revealNode;
24337
+ // Remove focus-ring from the field when the reveal button gets focused
24338
+ this.toggleAttribute('focus-ring', this._keyboardActive && !isButtonFocused);
24339
+ }
24340
+ }
24341
+
24342
+ /** @private */
24343
+ __updateAriaLabel(i18n) {
24344
+ if (i18n.reveal && this._revealNode) {
24345
+ this._revealNode.setAttribute('aria-label', i18n.reveal);
24346
+ }
24347
+ }
24348
+
24349
+ /** @private */
24350
+ __i18nChanged(i18n) {
24351
+ this.__updateAriaLabel(i18n.base);
24352
+ }
24353
+
24354
+ /** @private */
24355
+ _revealButtonHiddenChanged(hidden) {
24356
+ this._toggleRevealHidden(hidden);
24357
+ }
24358
+
24359
+ /** @private */
24360
+ _togglePasswordVisibility() {
24361
+ this._setPasswordVisible(!this.passwordVisible);
24362
+ }
24363
+
24364
+ /** @private */
24365
+ _onRevealButtonClick() {
24366
+ this._togglePasswordVisibility();
24367
+ }
24368
+
24369
+ /** @private */
24370
+ _onRevealButtonTouchend(e) {
24371
+ // Cancel the following click event
24372
+ e.preventDefault();
24373
+ this._togglePasswordVisibility();
24374
+ // Focus the input to avoid problem with password still visible
24375
+ // when user clicks the reveal button and then clicks outside.
24376
+ this.inputElement.focus();
24377
+ }
24378
+
24379
+ /** @private */
24380
+ _toggleRevealHidden(hidden) {
24381
+ if (this._revealNode) {
24382
+ if (hidden) {
24383
+ this._revealPart.setAttribute('hidden', '');
24384
+ this._revealNode.setAttribute('tabindex', '-1');
24385
+ this._revealNode.setAttribute('aria-hidden', 'true');
24386
+ } else {
24387
+ this._revealPart.removeAttribute('hidden');
24388
+ this._revealNode.setAttribute('tabindex', '0');
24389
+ this._revealNode.removeAttribute('aria-hidden');
24390
+ }
24391
+ }
24392
+ }
24393
+
24394
+ /** @private */
24395
+ _updateToggleState(passwordVisible) {
24396
+ if (this._revealNode) {
24397
+ this._revealNode.setAttribute('aria-pressed', passwordVisible ? 'true' : 'false');
24398
+ }
24399
+ }
24400
+
24401
+ /** @private */
24402
+ _passwordVisibleChanged(passwordVisible) {
24403
+ this._setType(passwordVisible ? 'text' : 'password');
24404
+
24405
+ this._updateToggleState(passwordVisible);
24406
+ }
24407
+
24408
+ /**
24409
+ * Override method inherited from `DisabledMixin` to synchronize the reveal button
24410
+ * disabled state with the password field disabled state.
24411
+ * @param {boolean} disabled
24412
+ * @param {boolean} oldDisabled
24413
+ * @protected
24414
+ */
24415
+ _disabledChanged(disabled, oldDisabled) {
24416
+ super._disabledChanged(disabled, oldDisabled);
24417
+
24418
+ if (this._revealNode) {
24419
+ this._revealNode.disabled = disabled;
24420
+ }
24421
+ }
24422
+ }
24423
+
24424
+ customElements.define(PasswordField.is, PasswordField);
24425
+
24426
+ 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}";
24427
+
24428
+ const PasswordInput = class {
24429
+ constructor(hostRef) {
24430
+ index.registerInstance(this, hostRef);
24431
+ this.sendValidityState = index.createEvent(this, "sendValidityState", 7);
24432
+ this.sendInputValue = index.createEvent(this, "sendInputValue", 7);
24433
+ /**
24434
+ * Default value for the input.
24435
+ */
24436
+ this.defaultValue = '';
24437
+ this.value = '';
24438
+ this.validationPattern = '';
24439
+ }
24440
+ validityChanged() {
24441
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
24442
+ if (this.emitValue == true) {
24443
+ this.valueHandler({ name: this.name, value: this.value });
24444
+ }
24445
+ }
24446
+ emitValueHandler(newValue) {
24447
+ if (newValue == true && this.isValid) {
24448
+ this.valueHandler({ name: this.name, value: this.value });
24449
+ }
24450
+ }
24451
+ validityStateHandler(inputStateEvent) {
24452
+ this.sendValidityState.emit(inputStateEvent);
24453
+ }
24454
+ valueHandler(inputValueEvent) {
24455
+ this.sendInputValue.emit(inputValueEvent);
24456
+ }
24457
+ valueChangedHandler(event) {
24458
+ if (this.isDuplicateInput) {
24459
+ if (this.name === event.detail.name + 'Duplicate') {
24460
+ this.duplicateInputValue = event.detail.value;
24461
+ }
24462
+ }
24463
+ }
24464
+ connectedCallback() {
24465
+ this.validationPattern = this.setPattern();
24466
+ }
24467
+ componentDidLoad() {
24468
+ this.inputReference = this.element.shadowRoot.querySelector('input');
24469
+ if (this.defaultValue) {
24470
+ this.value = this.defaultValue;
24471
+ this.valueHandler({ name: this.name, value: this.value });
24472
+ }
24473
+ }
24474
+ handleInput(event) {
24475
+ this.value = event.target.value;
24476
+ this.errorMessage = this.setErrorMessage();
24477
+ this.isValid = this.setValidity();
24478
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
24479
+ this.emitValueHandler(true);
24480
+ }
24481
+ setValidity() {
24482
+ return this.inputReference.validity.valid;
24483
+ }
24484
+ setPattern() {
24485
+ var _a, _b;
24486
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
24487
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
24488
+ }
24489
+ }
24490
+ setErrorMessage() {
24491
+ var _a;
24492
+ if (this.inputReference.validity.patternMismatch) {
24493
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
24494
+ }
24495
+ if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
24496
+ return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
24497
+ }
24498
+ if (this.inputReference.validity.valueMissing) {
24499
+ return translate$2('requiredError', this.language);
24500
+ }
24501
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
24502
+ return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
24503
+ }
24504
+ }
24505
+ render() {
24506
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'password__input--invalid';
24507
+ 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,
24508
+ // ref={(el) => this.inputReference = el as HTMLInputElement}
24509
+ 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));
24510
+ }
24511
+ get element() { return index.getElement(this); }
24512
+ static get watchers() { return {
24513
+ "isValid": ["validityChanged"],
24514
+ "emitValue": ["emitValueHandler"]
24515
+ }; }
24516
+ };
24517
+ PasswordInput.style = passwordInputCss;
24518
+
24519
+ 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}";
24520
+
24521
+ const RadioInput = class {
24522
+ constructor(hostRef) {
24523
+ index.registerInstance(this, hostRef);
24524
+ this.sendInputValue = index.createEvent(this, "sendInputValue", 7);
24525
+ this.sendValidityState = index.createEvent(this, "sendValidityState", 7);
24526
+ }
24527
+ validityChanged() {
24528
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
24529
+ if (this.emitValue == true) {
24530
+ this.valueHandler({ name: this.name, value: this.value });
24531
+ }
24532
+ }
24533
+ emitValueHandler(newValue) {
24534
+ if (newValue == true && this.isValid) {
24535
+ this.valueHandler({ name: this.name, value: this.value });
24536
+ }
24537
+ }
24538
+ valueHandler(inputValueEvent) {
24539
+ this.sendInputValue.emit(inputValueEvent);
24540
+ }
24541
+ validityStateHandler(inputStateEvent) {
24542
+ this.sendValidityState.emit(inputStateEvent);
24543
+ }
24544
+ connectedCallback() {
24545
+ }
24546
+ handleClick(event) {
24547
+ this.value = event.target.value;
24548
+ this.isValid = this.setValidity();
24549
+ this.errorMessage = this.setErrorMessage();
24550
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
24551
+ this.emitValueHandler(true);
24552
+ }
24553
+ setValidity() {
24554
+ return this.inputReference.validity.valid;
24555
+ }
24556
+ setErrorMessage() {
24557
+ if (this.inputReference.validity.valueMissing) {
24558
+ return translate$2('requiredError', this.language);
24559
+ }
24560
+ }
24561
+ render() {
24562
+ return index.h("fieldset", { class: 'radio__fieldset' }, index.h("legend", { class: 'radio__legend' }, this.displayName, ":"), this.optionsGroup.map(option => index.h("div", { class: 'radio__wrapper' }, index.h("input", { type: "radio", class: 'radio__input', id: `${option.label}__input`, ref: (el) => this.inputReference = el, value: option.value, name: this.name, required: this.validation.mandatory, onClick: (e) => this.handleClick(e) }), index.h("label", { htmlFor: `${option.label}__input` }, option.label))), index.h("small", { class: 'radio__error-message' }, this.errorMessage));
24563
+ }
24564
+ static get watchers() { return {
24565
+ "isValid": ["validityChanged"],
24566
+ "emitValue": ["emitValueHandler"]
24567
+ }; }
24568
+ };
24569
+ RadioInput.style = radioInputCss;
24570
+
24571
+ /**
24572
+ * @license
24573
+ * Copyright (c) 2022 Vaadin Ltd.
24574
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
24575
+ */
24576
+
24577
+ const loader = i$1`
24578
+ [part~='loader'] {
24579
+ box-sizing: border-box;
24580
+ width: var(--lumo-icon-size-s);
24581
+ height: var(--lumo-icon-size-s);
24582
+ border: 2px solid transparent;
24583
+ border-color: var(--lumo-primary-color-10pct) var(--lumo-primary-color-10pct) var(--lumo-primary-color)
24584
+ var(--lumo-primary-color);
24585
+ border-radius: calc(0.5 * var(--lumo-icon-size-s));
24586
+ opacity: 0;
24587
+ pointer-events: none;
24588
+ }
24589
+
24590
+ :host(:not([loading])) [part~='loader'] {
24591
+ display: none;
24592
+ }
24593
+
24594
+ :host([loading]) [part~='loader'] {
24595
+ animation: 1s linear infinite lumo-loader-rotate, 0.3s 0.1s lumo-loader-fade-in both;
24596
+ }
24597
+
24598
+ @keyframes lumo-loader-fade-in {
24599
+ 0% {
24600
+ opacity: 0;
24601
+ }
24602
+
24603
+ 100% {
24604
+ opacity: 1;
24605
+ }
24606
+ }
24607
+
24608
+ @keyframes lumo-loader-rotate {
24609
+ 0% {
23936
24610
  transform: rotate(0deg);
23937
24611
  }
23938
24612
 
@@ -26250,87 +26924,6 @@ class ComboBoxScroller extends PolymerElement {
26250
26924
 
26251
26925
  customElements.define(ComboBoxScroller.is, ComboBoxScroller);
26252
26926
 
26253
- /**
26254
- * @license
26255
- * Copyright (c) 2021 - 2022 Vaadin Ltd.
26256
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
26257
- */
26258
-
26259
- /**
26260
- * A mixin to provide `pattern` and `preventInvalidInput` properties.
26261
- *
26262
- * @polymerMixin
26263
- * @mixes InputConstraintsMixin
26264
- */
26265
- const PatternMixin = (superclass) =>
26266
- class PatternMixinClass extends InputConstraintsMixin(superclass) {
26267
- static get properties() {
26268
- return {
26269
- /**
26270
- * A regular expression that the value is checked against.
26271
- * The pattern must match the entire value, not just some subset.
26272
- */
26273
- pattern: {
26274
- type: String,
26275
- },
26276
-
26277
- /**
26278
- * When set to true, user is prevented from typing a value that
26279
- * conflicts with the given `pattern`.
26280
- * @attr {boolean} prevent-invalid-input
26281
- * @deprecated Please use `allowedCharPattern` instead.
26282
- */
26283
- preventInvalidInput: {
26284
- type: Boolean,
26285
- observer: '_preventInvalidInputChanged',
26286
- },
26287
- };
26288
- }
26289
-
26290
- static get delegateAttrs() {
26291
- return [...super.delegateAttrs, 'pattern'];
26292
- }
26293
-
26294
- static get constraints() {
26295
- return [...super.constraints, 'pattern'];
26296
- }
26297
-
26298
- /** @private */
26299
- _checkInputValue() {
26300
- if (this.preventInvalidInput) {
26301
- const input = this.inputElement;
26302
- if (input && input.value.length > 0 && !this.checkValidity()) {
26303
- input.value = this.value || '';
26304
- // Add input-prevented attribute for 200ms
26305
- this.setAttribute('input-prevented', '');
26306
- this._inputDebouncer = Debouncer$1.debounce(this._inputDebouncer, timeOut.after(200), () => {
26307
- this.removeAttribute('input-prevented');
26308
- });
26309
- }
26310
- }
26311
- }
26312
-
26313
- /**
26314
- * @param {Event} event
26315
- * @protected
26316
- * @override
26317
- */
26318
- _onInput(event) {
26319
- this._checkInputValue();
26320
-
26321
- super._onInput(event);
26322
- }
26323
-
26324
- /** @private */
26325
- _preventInvalidInputChanged(preventInvalidInput) {
26326
- if (preventInvalidInput) {
26327
- console.warn(
26328
- `WARNING: Since Vaadin 23.2, "preventInvalidInput" is deprecated. Please use "allowedCharPattern" instead.`,
26329
- );
26330
- }
26331
- }
26332
- };
26333
-
26334
26927
  /**
26335
26928
  * @license
26336
26929
  * Copyright (c) 2015 - 2022 Vaadin Ltd.
@@ -28316,7 +28909,7 @@ class ComboBox extends ComboBoxDataProviderMixin(
28316
28909
 
28317
28910
  customElements.define(ComboBox.is, ComboBox);
28318
28911
 
28319
- 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}";
28912
+ 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}";
28320
28913
 
28321
28914
  const SelectInput = class {
28322
28915
  constructor(hostRef) {
@@ -28390,7 +28983,6 @@ const SelectInput = class {
28390
28983
  this.isValid = this.setValidity();
28391
28984
  this.validityStateHandler({ valid: this.isValid, name: this.name });
28392
28985
  this.emitValueHandler(true);
28393
- this.inputReference.previousElementSibling.classList.remove('select__label--hidden');
28394
28986
  }
28395
28987
  setValidity() {
28396
28988
  return this.inputReference.validity.valid;
@@ -28401,7 +28993,8 @@ const SelectInput = class {
28401
28993
  }
28402
28994
  }
28403
28995
  render() {
28404
- 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));
28996
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'select__input--invalid';
28997
+ 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));
28405
28998
  }
28406
28999
  get element() { return index.getElement(this); }
28407
29000
  static get watchers() { return {
@@ -28411,7 +29004,7 @@ const SelectInput = class {
28411
29004
  };
28412
29005
  SelectInput.style = selectInputCss;
28413
29006
 
28414
- 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}";
29007
+ 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}";
28415
29008
 
28416
29009
  const TelInput = class {
28417
29010
  constructor(hostRef) {
@@ -28439,6 +29032,10 @@ const TelInput = class {
28439
29032
  }
28440
29033
  connectedCallback() {
28441
29034
  this.validationPattern = this.setPattern();
29035
+ if (this.defaultValue) {
29036
+ this.prefixValue = this.defaultValue.split('|')[0];
29037
+ this.phoneValue = this.defaultValue.split('|')[1];
29038
+ }
28442
29039
  }
28443
29040
  componentWillLoad() {
28444
29041
  if (this.action) {
@@ -28453,8 +29050,8 @@ const TelInput = class {
28453
29050
  }
28454
29051
  componentDidLoad() {
28455
29052
  if (this.defaultValue) {
28456
- this.prefixValue = this.defaultValue;
28457
- this.valueHandler({ name: this.name, value: `${this.prefixValue}|` });
29053
+ this.value = `${this.prefixValue}|${this.phoneValue}`;
29054
+ this.valueHandler({ name: this.name, value: this.value });
28458
29055
  }
28459
29056
  }
28460
29057
  getPhoneCodes() {
@@ -28472,8 +29069,8 @@ const TelInput = class {
28472
29069
  });
28473
29070
  }
28474
29071
  handleInput(event) {
28475
- // Kinda hack? Open to suggestions.
28476
- this.value = `${this.prefixValue}|${event.target.value}`;
29072
+ this.phoneValue = event.target.value;
29073
+ this.value = `${this.prefixValue}|${this.phoneValue}`;
28477
29074
  this.errorMessage = this.setErrorMessage();
28478
29075
  this.isValid = this.setValidity();
28479
29076
  this.validityStateHandler({ valid: this.isValid, name: this.name });
@@ -28501,8 +29098,8 @@ const TelInput = class {
28501
29098
  }
28502
29099
  }
28503
29100
  render() {
28504
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__input--invalid';
28505
- 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, 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 ${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));
29101
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__wrapper--flex--invalid';
29102
+ 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));
28506
29103
  }
28507
29104
  static get watchers() { return {
28508
29105
  "isValid": ["validityChanged"],
@@ -28511,7 +29108,7 @@ const TelInput = class {
28511
29108
  };
28512
29109
  TelInput.style = telInputCss;
28513
29110
 
28514
- 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}";
29111
+ 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}";
28515
29112
 
28516
29113
  const TextInput = class {
28517
29114
  constructor(hostRef) {
@@ -28532,17 +29129,24 @@ const TextInput = class {
28532
29129
  this.valueHandler({ name: this.name, value: this.value });
28533
29130
  }
28534
29131
  }
28535
- validityStateHandler(inputStateEvent) {
28536
- this.sendValidityState.emit(inputStateEvent);
28537
- }
28538
29132
  emitValueHandler(newValue) {
28539
29133
  if (newValue == true && this.isValid) {
28540
29134
  this.valueHandler({ name: this.name, value: this.value });
28541
29135
  }
28542
29136
  }
29137
+ validityStateHandler(inputStateEvent) {
29138
+ this.sendValidityState.emit(inputStateEvent);
29139
+ }
28543
29140
  valueHandler(inputValueEvent) {
28544
29141
  this.sendInputValue.emit(inputValueEvent);
28545
29142
  }
29143
+ valueChangedHandler(event) {
29144
+ if (this.isDuplicateInput) {
29145
+ if (this.name === event.detail.name + 'Duplicate') {
29146
+ this.duplicateInputValue = event.detail.value;
29147
+ }
29148
+ }
29149
+ }
28546
29150
  connectedCallback() {
28547
29151
  this.validationPattern = this.setPattern();
28548
29152
  }
@@ -28562,13 +29166,6 @@ const TextInput = class {
28562
29166
  setValidity() {
28563
29167
  return this.inputReference.validity.valid;
28564
29168
  }
28565
- // @TODO type here
28566
- setCustomRules() {
28567
- var _a;
28568
- if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
28569
- return this.validation.custom.filter(customValidation => customValidation.rule !== 'regex');
28570
- }
28571
- }
28572
29169
  setPattern() {
28573
29170
  var _a, _b;
28574
29171
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
@@ -28586,10 +29183,13 @@ const TextInput = class {
28586
29183
  if (this.inputReference.validity.valueMissing) {
28587
29184
  return translate$2('requiredError', this.language);
28588
29185
  }
29186
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
29187
+ return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
29188
+ }
28589
29189
  }
28590
29190
  render() {
28591
29191
  const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
28592
- 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));
29192
+ 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));
28593
29193
  }
28594
29194
  static get watchers() { return {
28595
29195
  "isValid": ["validityChanged"],