@lion/ui 0.0.4 → 0.0.5

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 (186) hide show
  1. package/components/calendar/src/LionCalendar.js +10 -4
  2. package/components/combobox/src/LionCombobox.js +6 -4
  3. package/components/core/src/DisabledMixin.js +6 -4
  4. package/components/core/src/DisabledWithTabIndexMixin.js +6 -4
  5. package/components/core/types/SlotMixinTypes.ts +1 -1
  6. package/components/form-core/src/FormatMixin.js +10 -8
  7. package/components/form-core/src/InteractionStateMixin.js +8 -6
  8. package/components/form-core/src/choice-group/ChoiceInputMixin.js +6 -4
  9. package/components/form-core/src/utils/SyncUpdatableMixin.js +9 -4
  10. package/components/form-core/test/utils/SyncUpdatableMixin.test.js +6 -4
  11. package/components/form-core/test-suites/ValidateMixin.suite.js +1 -1
  12. package/components/form-core/test-suites/form-group/FormGroupMixin.suite.js +2 -2
  13. package/components/input/src/LionInput.js +6 -4
  14. package/components/input-datepicker/src/LionInputDatepicker.js +6 -4
  15. package/components/input-tel/src/LionInputTel.js +7 -13
  16. package/components/input-tel/src/PhoneUtilManager.js +9 -5
  17. package/components/input-tel/src/formatters.js +8 -10
  18. package/components/input-tel/src/parsers.js +3 -4
  19. package/components/input-tel/src/preprocessors.js +2 -4
  20. package/components/input-tel/src/validators.js +4 -6
  21. package/components/input-tel/test/validators.test.js +8 -5
  22. package/components/input-tel-dropdown/src/LionInputTelDropdown.js +14 -8
  23. package/components/listbox/src/LionOption.js +6 -4
  24. package/components/overlays/src/OverlayMixin.js +6 -5
  25. package/components/overlays/src/OverlaysManager.js +21 -4
  26. package/components/overlays/src/globalOverlaysStyle.js +10 -0
  27. package/components/overlays/test/OverlaysManager.test.js +76 -0
  28. package/components/overlays/test-suites/OverlayMixin.suite.js +20 -14
  29. package/components/select-rich/src/LionSelectRich.js +6 -4
  30. package/components/switch/src/LionSwitchButton.js +6 -7
  31. package/custom-elements.json +568 -159
  32. package/dist-types/components/accordion/src/LionAccordion.d.ts +1 -1
  33. package/dist-types/components/button/src/LionButton.d.ts +1 -1
  34. package/dist-types/components/calendar/src/LionCalendar.d.ts +6 -4
  35. package/dist-types/components/calendar/src/LionCalendar.d.ts.map +1 -1
  36. package/dist-types/components/checkbox-group/src/LionCheckboxGroup.d.ts +1 -1
  37. package/dist-types/components/checkbox-group/src/LionCheckboxIndeterminate.d.ts +0 -4
  38. package/dist-types/components/checkbox-group/src/LionCheckboxIndeterminate.d.ts.map +1 -1
  39. package/dist-types/components/collapsible/src/LionCollapsible.d.ts +1 -1
  40. package/dist-types/components/combobox/src/LionCombobox.d.ts +5 -3
  41. package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
  42. package/dist-types/components/core/src/DisabledMixin.d.ts.map +1 -1
  43. package/dist-types/components/core/src/DisabledWithTabIndexMixin.d.ts.map +1 -1
  44. package/dist-types/components/core/src/SlotMixin.d.ts +1 -1
  45. package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
  46. package/dist-types/components/core/types/SlotMixinTypes.d.ts +1 -1
  47. package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
  48. package/dist-types/components/dialog/src/LionDialog.d.ts +1 -1
  49. package/dist-types/components/fieldset/src/LionFieldset.d.ts +1 -1
  50. package/dist-types/components/form-core/src/FormatMixin.d.ts.map +1 -1
  51. package/dist-types/components/form-core/src/InteractionStateMixin.d.ts.map +1 -1
  52. package/dist-types/components/form-core/src/LionField.d.ts +1 -1
  53. package/dist-types/components/form-core/src/choice-group/ChoiceInputMixin.d.ts.map +1 -1
  54. package/dist-types/components/form-core/src/utils/SyncUpdatableMixin.d.ts.map +1 -1
  55. package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts +1 -1
  56. package/dist-types/components/form-core/test-suites/FormRegistrationMixins.suite.d.ts +1 -1
  57. package/dist-types/components/form-integrations/test/helpers/umbrella-form.d.ts +1 -1
  58. package/dist-types/components/helpers/src/SbActionLogger.d.ts +1 -1
  59. package/dist-types/components/helpers/src/SbLocaleSwitcher.d.ts +1 -1
  60. package/dist-types/components/icon/src/LionIcon.d.ts +1 -1
  61. package/dist-types/components/input/src/LionInput.d.ts +5 -3
  62. package/dist-types/components/input/src/LionInput.d.ts.map +1 -1
  63. package/dist-types/components/input-datepicker/src/LionCalendarOverlayFrame.d.ts +1 -1
  64. package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts +0 -5
  65. package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts.map +1 -1
  66. package/dist-types/components/input-tel/src/LionInputTel.d.ts +3 -22
  67. package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
  68. package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts +8 -4
  69. package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts.map +1 -1
  70. package/dist-types/components/input-tel/src/formatters.d.ts +0 -2
  71. package/dist-types/components/input-tel/src/formatters.d.ts.map +1 -1
  72. package/dist-types/components/input-tel/src/parsers.d.ts +0 -2
  73. package/dist-types/components/input-tel/src/parsers.d.ts.map +1 -1
  74. package/dist-types/components/input-tel/src/preprocessors.d.ts +0 -2
  75. package/dist-types/components/input-tel/src/preprocessors.d.ts.map +1 -1
  76. package/dist-types/components/input-tel/src/validators.d.ts +0 -1
  77. package/dist-types/components/input-tel/src/validators.d.ts.map +1 -1
  78. package/dist-types/components/input-tel/test/validators.test.d.ts +1 -1
  79. package/dist-types/components/input-tel/test/validators.test.d.ts.map +1 -1
  80. package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts +7 -9
  81. package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
  82. package/dist-types/components/listbox/src/LionListbox.d.ts +1 -1
  83. package/dist-types/components/listbox/src/LionOption.d.ts +6 -4
  84. package/dist-types/components/listbox/src/LionOption.d.ts.map +1 -1
  85. package/dist-types/components/listbox/src/LionOptions.d.ts +1 -1
  86. package/dist-types/components/overlays/src/OverlayMixin.d.ts.map +1 -1
  87. package/dist-types/components/overlays/src/OverlaysManager.d.ts +4 -0
  88. package/dist-types/components/overlays/src/OverlaysManager.d.ts.map +1 -1
  89. package/dist-types/components/overlays/src/globalOverlaysStyle.d.ts.map +1 -1
  90. package/dist-types/components/overlays/test/OverlaysManager.test.d.ts.map +1 -1
  91. package/dist-types/components/overlays/test-suites/OverlayMixin.suite.d.ts.map +1 -1
  92. package/dist-types/components/pagination/src/LionPagination.d.ts +1 -1
  93. package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts +1 -1
  94. package/dist-types/components/radio-group/src/LionRadioGroup.d.ts +1 -1
  95. package/dist-types/components/select-rich/src/LionSelectRich.d.ts +5 -3
  96. package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
  97. package/dist-types/components/steps/src/LionStep.d.ts +1 -1
  98. package/dist-types/components/steps/src/LionSteps.d.ts +1 -1
  99. package/dist-types/components/switch/src/LionSwitchButton.d.ts +6 -7
  100. package/dist-types/components/switch/src/LionSwitchButton.d.ts.map +1 -1
  101. package/dist-types/components/tabs/src/LionTabs.d.ts +1 -1
  102. package/dist-types/components/tooltip/src/LionTooltip.d.ts +1 -1
  103. package/dist-types/exports/core.d.ts +0 -1
  104. package/dist-types/exports/core.d.ts.map +1 -1
  105. package/dist-types/exports/form-core.d.ts +0 -2
  106. package/dist-types/exports/form-core.d.ts.map +1 -1
  107. package/dist-types/exports/input-tel-dropdown.d.ts +0 -2
  108. package/dist-types/exports/input-tel-dropdown.d.ts.map +1 -1
  109. package/dist-types/exports/input-tel.d.ts +0 -1
  110. package/dist-types/exports/input-tel.d.ts.map +1 -1
  111. package/dist-types/exports/localize.d.ts +0 -3
  112. package/dist-types/exports/localize.d.ts.map +1 -1
  113. package/dist-types/exports/overlays.d.ts +0 -4
  114. package/dist-types/exports/overlays.d.ts.map +1 -1
  115. package/dist-types/exports/types/core.d.ts +2 -0
  116. package/dist-types/exports/types/core.d.ts.map +1 -0
  117. package/dist-types/exports/types/form-core.d.ts +3 -0
  118. package/dist-types/exports/types/form-core.d.ts.map +1 -0
  119. package/dist-types/exports/types/input-tel-dropdown.d.ts +3 -0
  120. package/dist-types/exports/types/input-tel-dropdown.d.ts.map +1 -0
  121. package/dist-types/exports/types/input-tel.d.ts +2 -0
  122. package/dist-types/exports/types/input-tel.d.ts.map +1 -0
  123. package/dist-types/exports/types/localize.d.ts +4 -0
  124. package/dist-types/exports/types/localize.d.ts.map +1 -0
  125. package/dist-types/exports/types/overlays.d.ts +5 -0
  126. package/dist-types/exports/types/overlays.d.ts.map +1 -0
  127. package/dist-types/tsconfig.tsbuildinfo +1 -1
  128. package/docs/components/checkbox-group/overview.md +2 -2
  129. package/docs/components/collapsible/overview.md +1 -1
  130. package/docs/components/combobox/overview.md +1 -1
  131. package/docs/components/combobox/use-cases.md +1 -1
  132. package/docs/components/dialog/overview.md +1 -1
  133. package/docs/components/fieldset/overview.md +5 -5
  134. package/docs/components/form/overview.md +3 -3
  135. package/docs/components/icon/use-cases.md +1 -1
  136. package/docs/components/input/overview.md +1 -1
  137. package/docs/components/input-amount/overview.md +3 -3
  138. package/docs/components/input-date/overview.md +3 -3
  139. package/docs/components/input-datepicker/overview.md +5 -5
  140. package/docs/components/input-email/overview.md +2 -2
  141. package/docs/components/input-iban/overview.md +2 -2
  142. package/docs/components/input-range/overview.md +2 -2
  143. package/docs/components/input-stepper/overview.md +1 -1
  144. package/docs/components/input-tel/overview.md +1 -1
  145. package/docs/components/input-tel/use-cases.md +6 -6
  146. package/docs/components/input-tel-dropdown/overview.md +1 -1
  147. package/docs/components/radio-group/overview.md +3 -3
  148. package/docs/components/select-rich/use-cases.md +1 -1
  149. package/docs/components/tabs/examples.md +1 -1
  150. package/docs/fundamentals/index.md +4 -4
  151. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
  152. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
  153. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
  154. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
  155. package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
  156. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  157. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  158. package/docs/fundamentals/systems/core/overview.md +1 -1
  159. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  160. package/docs/fundamentals/systems/form/model-value.md +1 -1
  161. package/docs/fundamentals/systems/form/overview.md +28 -28
  162. package/docs/fundamentals/systems/form/validate.md +1 -1
  163. package/docs/fundamentals/systems/localize/overview.md +4 -4
  164. package/docs/fundamentals/systems/overlays/configuration.md +2 -2
  165. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  166. package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
  167. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  168. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  169. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  170. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  171. package/docs/guides/index.md +8 -8
  172. package/docs/guides/principles/index.md +5 -5
  173. package/docs/guides/principles/styling.md +1 -1
  174. package/exports/core.js +0 -2
  175. package/exports/form-core.js +0 -3
  176. package/exports/input-tel-dropdown.js +0 -3
  177. package/exports/input-tel.js +0 -2
  178. package/exports/localize.js +0 -4
  179. package/exports/overlays.js +0 -5
  180. package/exports/types/core.ts +1 -0
  181. package/exports/types/form-core.ts +2 -0
  182. package/exports/types/input-tel-dropdown.ts +2 -0
  183. package/exports/types/input-tel.ts +1 -0
  184. package/exports/types/localize.ts +3 -0
  185. package/exports/types/overlays.ts +4 -0
  186. package/package.json +6 -4
@@ -317,11 +317,17 @@ export class LionCalendar extends LocalizeMixin(LitElement) {
317
317
  }
318
318
 
319
319
  /**
320
- * @param {string} name
321
- * @param {?} oldValue
320
+ * @param {string} [name]
321
+ * @param {unknown} [oldValue]
322
+ * @param {import('lit').PropertyDeclaration} [options]
323
+ * @returns {void}
322
324
  */
323
- requestUpdate(name, oldValue) {
324
- super.requestUpdate(name, oldValue);
325
+ requestUpdate(name, oldValue, options) {
326
+ super.requestUpdate(name, oldValue, options);
327
+
328
+ if (name === undefined) {
329
+ return;
330
+ }
325
331
 
326
332
  const map = {
327
333
  disableDates: () => this.__disableDatesChanged(),
@@ -378,11 +378,13 @@ export class LionCombobox extends OverlayMixin(LionListbox) {
378
378
  }
379
379
 
380
380
  /**
381
- * @param {'disabled'|'modelValue'|'readOnly'|'focused'} name
382
- * @param {unknown} oldValue
381
+ * @param {string} [name]
382
+ * @param {unknown} [oldValue]
383
+ * @param {import('lit').PropertyDeclaration} [options]
384
+ * @returns {void}
383
385
  */
384
- requestUpdate(name, oldValue) {
385
- super.requestUpdate(name, oldValue);
386
+ requestUpdate(name, oldValue, options) {
387
+ super.requestUpdate(name, oldValue, options);
386
388
  if (name === 'disabled' || name === 'readOnly') {
387
389
  this.__setComboboxDisabledAndReadOnly();
388
390
  }
@@ -58,11 +58,13 @@ const DisabledMixinImplementation = superclass =>
58
58
  }
59
59
 
60
60
  /**
61
- * @param {PropertyKey} name
62
- * @param {?} oldValue
61
+ * @param {string} [name]
62
+ * @param {unknown} [oldValue]
63
+ * @param {import('lit').PropertyDeclaration} [options]
64
+ * @returns {void}
63
65
  */
64
- requestUpdate(name, oldValue) {
65
- super.requestUpdate(name, oldValue);
66
+ requestUpdate(name, oldValue, options) {
67
+ super.requestUpdate(name, oldValue, options);
66
68
  if (name === 'disabled') {
67
69
  if (this.__isUserSettingDisabled) {
68
70
  this.__restoreDisabledTo = this.disabled;
@@ -60,11 +60,13 @@ const DisabledWithTabIndexMixinImplementation = superclass =>
60
60
  }
61
61
 
62
62
  /**
63
- * @param {PropertyKey} name
64
- * @param {?} oldValue
63
+ * @param {string} [name]
64
+ * @param {unknown} [oldValue]
65
+ * @param {import('lit').PropertyDeclaration} [options]
66
+ * @returns {void}
65
67
  */
66
- requestUpdate(name, oldValue) {
67
- super.requestUpdate(name, oldValue);
68
+ requestUpdate(name, oldValue, options) {
69
+ super.requestUpdate(name, oldValue, options);
68
70
 
69
71
  if (name === 'disabled') {
70
72
  if (this.disabled) {
@@ -60,7 +60,7 @@ export declare class SlotHost {
60
60
  * };
61
61
  * }
62
62
  */
63
- export declare function SlotMixinImplementation<T extends Constructor<LitElement>>(
63
+ declare function SlotMixinImplementation<T extends Constructor<LitElement>>(
64
64
  superclass: T,
65
65
  ): T &
66
66
  Constructor<SlotHost> &
@@ -70,19 +70,21 @@ const FormatMixinImplementation = superclass =>
70
70
  }
71
71
 
72
72
  /**
73
- * @param {string} name
74
- * @param {any} oldVal
73
+ * @param {string} [name]
74
+ * @param {unknown} [oldValue]
75
+ * @param {import('lit').PropertyDeclaration} [options]
76
+ * @returns {void}
75
77
  */
76
- requestUpdate(name, oldVal) {
77
- super.requestUpdate(name, oldVal);
78
+ requestUpdate(name, oldValue, options) {
79
+ super.requestUpdate(name, oldValue, options);
78
80
 
79
- if (name === 'modelValue' && this.modelValue !== oldVal) {
80
- this._onModelValueChanged({ modelValue: this.modelValue }, { modelValue: oldVal });
81
+ if (name === 'modelValue' && this.modelValue !== oldValue) {
82
+ this._onModelValueChanged({ modelValue: this.modelValue }, { modelValue: oldValue });
81
83
  }
82
- if (name === 'serializedValue' && this.serializedValue !== oldVal) {
84
+ if (name === 'serializedValue' && this.serializedValue !== oldValue) {
83
85
  this._calculateValues({ source: 'serialized' });
84
86
  }
85
- if (name === 'formattedValue' && this.formattedValue !== oldVal) {
87
+ if (name === 'formattedValue' && this.formattedValue !== oldValue) {
86
88
  this._calculateValues({ source: 'formatted' });
87
89
  }
88
90
  }
@@ -33,12 +33,14 @@ const InteractionStateMixinImplementation = superclass =>
33
33
  }
34
34
 
35
35
  /**
36
- * @param {PropertyKey} name
37
- * @param {*} oldVal
36
+ * @param {string} [name]
37
+ * @param {unknown} [oldValue]
38
+ * @param {import('lit').PropertyDeclaration} [options]
39
+ * @returns {void}
38
40
  */
39
- requestUpdate(name, oldVal) {
40
- super.requestUpdate(name, oldVal);
41
- if (name === 'touched' && this.touched !== oldVal) {
41
+ requestUpdate(name, oldValue, options) {
42
+ super.requestUpdate(name, oldValue, options);
43
+ if (name === 'touched' && this.touched !== oldValue) {
42
44
  this._onTouchedChanged();
43
45
  }
44
46
 
@@ -48,7 +50,7 @@ const InteractionStateMixinImplementation = superclass =>
48
50
  this.filled = !this._isEmpty();
49
51
  }
50
52
 
51
- if (name === 'dirty' && this.dirty !== oldVal) {
53
+ if (name === 'dirty' && this.dirty !== oldValue) {
52
54
  this._onDirtyChanged();
53
55
  }
54
56
  }
@@ -52,11 +52,13 @@ const ChoiceInputMixinImplementation = superclass =>
52
52
  }
53
53
 
54
54
  /**
55
- * @param {string} name
56
- * @param {any} oldValue
55
+ * @param {string} [name]
56
+ * @param {unknown} [oldValue]
57
+ * @param {import('lit').PropertyDeclaration} [options]
58
+ * @returns {void}
57
59
  */
58
- requestUpdate(name, oldValue) {
59
- super.requestUpdate(name, oldValue);
60
+ requestUpdate(name, oldValue, options) {
61
+ super.requestUpdate(name, oldValue, options);
60
62
 
61
63
  if (name === 'modelValue') {
62
64
  if (this.modelValue.checked !== this.checked) {
@@ -93,11 +93,16 @@ const SyncUpdatableMixinImplementation = superclass =>
93
93
  }
94
94
 
95
95
  /**
96
- * @param {string} name
97
- * @param {*} oldValue
96
+ * @param {string} [name]
97
+ * @param {unknown} [oldValue]
98
+ * @param {import('lit').PropertyDeclaration} [options]
99
+ * @returns {void}
98
100
  */
99
- requestUpdate(name, oldValue) {
100
- super.requestUpdate(name, oldValue);
101
+ requestUpdate(name, oldValue, options) {
102
+ super.requestUpdate(name, oldValue, options);
103
+ if (name === undefined) {
104
+ return;
105
+ }
101
106
 
102
107
  this.__SyncUpdatableNamespace = this.__SyncUpdatableNamespace || {};
103
108
  const ns = this.__SyncUpdatableNamespace;
@@ -147,11 +147,13 @@ describe('SyncUpdatableMixin', () => {
147
147
  }
148
148
 
149
149
  /**
150
- * @param {string} name
151
- * @param {*} oldValue
150
+ * @param {string} [name]
151
+ * @param {unknown} [oldValue]
152
+ * @param {import('lit').PropertyDeclaration} [options]
153
+ * @returns {void}
152
154
  */
153
- requestUpdate(name, oldValue) {
154
- super.requestUpdate(name, oldValue);
155
+ requestUpdate(name, oldValue, options) {
156
+ super.requestUpdate(name, oldValue, options);
155
157
  if (name === 'prop') {
156
158
  propChangedCount += 1;
157
159
  }
@@ -64,7 +64,7 @@ export function runValidateMixinSuite(customConfig) {
64
64
  * - *feedback-node*
65
65
  * The 'this._feedbackNode' property (usually a getter) that returns/contains a reference to
66
66
  * the output container for validation feedback. Messages will be written to this element
67
- * based on user defined or default validity feedback visibility conditions.
67
+ * based on user-defined or default validity feedback visibility conditions.
68
68
  *
69
69
  * - *show-{type}-feedback-condition*
70
70
  * The 'this.hasErrorVisible value that stores whether the
@@ -1234,7 +1234,7 @@ export function runFormGroupMixinSuite(cfg = {}) {
1234
1234
  </${tag}>
1235
1235
  `)
1236
1236
  );
1237
- const childFieldsetEl = el.querySelector(tagString);
1237
+ const childFieldsetEl = /** @type {FormGroup} */ (el.querySelector(tagString));
1238
1238
  const resetGroupSpy = sinon.spy(childFieldsetEl, 'resetGroup');
1239
1239
  el.resetGroup();
1240
1240
  expect(resetGroupSpy.callCount).to.equal(1);
@@ -1270,7 +1270,7 @@ export function runFormGroupMixinSuite(cfg = {}) {
1270
1270
  </${tag}>
1271
1271
  `)
1272
1272
  );
1273
- const childFieldsetEl = el.querySelector(tagString);
1273
+ const childFieldsetEl = /** @type {FormGroup} */ (el.querySelector(tagString));
1274
1274
  const clearGroupSpy = sinon.spy(childFieldsetEl, 'clearGroup');
1275
1275
  el.clearGroup();
1276
1276
  expect(clearGroupSpy.callCount).to.equal(1);
@@ -64,11 +64,13 @@ export class LionInput extends NativeTextFieldMixin(LionField) {
64
64
  }
65
65
 
66
66
  /**
67
- * @param {PropertyKey} [name]
68
- * @param {?} [oldValue]
67
+ * @param {string} [name]
68
+ * @param {unknown} [oldValue]
69
+ * @param {import('lit').PropertyDeclaration} [options]
70
+ * @returns {void}
69
71
  */
70
- requestUpdate(name, oldValue) {
71
- super.requestUpdate(name, oldValue);
72
+ requestUpdate(name, oldValue, options) {
73
+ super.requestUpdate(name, oldValue, options);
72
74
  if (name === 'readOnly') {
73
75
  this.__delegateReadOnly();
74
76
  }
@@ -211,11 +211,13 @@ export class LionInputDatepicker extends ScopedElementsMixin(
211
211
  }
212
212
 
213
213
  /**
214
- * @param {PropertyKey} name
215
- * @param {?} oldValue
214
+ * @param {string} [name]
215
+ * @param {unknown} [oldValue]
216
+ * @param {import('lit').PropertyDeclaration} [options]
217
+ * @returns {void}
216
218
  */
217
- requestUpdate(name, oldValue) {
218
- super.requestUpdate(name, oldValue);
219
+ requestUpdate(name, oldValue, options) {
220
+ super.requestUpdate(name, oldValue, options);
219
221
 
220
222
  if (name === 'disabled' || name === 'readOnly') {
221
223
  this.__toggleInvokerDisabled();
@@ -14,7 +14,7 @@ import { localizeNamespaceLoader } from './localizeNamespaceLoader.js';
14
14
  * @typedef {import('awesome-phonenumber').PhoneNumberFormat} PhoneNumberFormat
15
15
  * @typedef {import('awesome-phonenumber').PhoneNumberTypes} PhoneNumberTypes
16
16
  * @typedef {import('../../form-core/types/FormatMixinTypes.js').FormatOptions} FormatOptions
17
- * @typedef {* & import('awesome-phonenumber').default} AwesomePhoneNumber
17
+ * @typedef {* & import('awesome-phonenumber')} AwesomePhoneNumber
18
18
  * @typedef {FormatOptions & {regionCode: RegionCode; formatStrategy: PhoneNumberFormat; formatCountryCodeStyle: string;}} FormatOptionsTel
19
19
  */
20
20
 
@@ -28,7 +28,6 @@ export class LionInputTel extends LocalizeMixin(LionInput) {
28
28
  formatCountryCodeStyle: { type: String, attribute: 'format-country-code-style' },
29
29
  activeRegion: { type: String },
30
30
  _phoneUtil: { type: Object, state: true },
31
- _needsLightDomRender: { type: Number, state: true },
32
31
  };
33
32
 
34
33
  static localizeNamespaces = [
@@ -72,10 +71,12 @@ export class LionInputTel extends LocalizeMixin(LionInput) {
72
71
  get activePhoneNumberType() {
73
72
  let pn;
74
73
  try {
75
- pn = this._phoneUtil && this._phoneUtil(this.modelValue, this.activeRegion);
74
+ pn =
75
+ this._phoneUtil &&
76
+ this._phoneUtil.parsePhoneNumber(this.modelValue, { regionCode: this.activeRegion });
76
77
  // eslint-disable-next-line no-empty
77
78
  } catch (_) {}
78
- return pn?.g?.type || 'unknown';
79
+ return pn?.type || 'unknown';
79
80
  }
80
81
 
81
82
  // @ts-ignore read only
@@ -169,14 +170,6 @@ export class LionInputTel extends LocalizeMixin(LionInput) {
169
170
  ? /** @type {AwesomePhoneNumber} */ (PhoneUtilManager.PhoneUtil)
170
171
  : null;
171
172
 
172
- /**
173
- * Helper that triggers a light dom render aligned with update loop.
174
- * TODO: combine with render fn of SlotMixin
175
- * @protected
176
- * @type {number}
177
- */
178
- this._needsLightDomRender = 0;
179
-
180
173
  if (!PhoneUtilManager.isLoaded) {
181
174
  PhoneUtilManager.loadComplete.then(() => {
182
175
  this._onPhoneNumberUtilReady();
@@ -325,7 +318,8 @@ export class LionInputTel extends LocalizeMixin(LionInput) {
325
318
  const value = !(this.modelValue instanceof Unparseable)
326
319
  ? this.modelValue
327
320
  : this.value.match(regex)?.join('');
328
- const regionDerivedFromValue = value && this._phoneUtil && this._phoneUtil(value).g?.regionCode;
321
+ const regionDerivedFromValue =
322
+ value && this._phoneUtil && this._phoneUtil.parsePhoneNumber(value).regionCode;
329
323
 
330
324
  if (regionDerivedFromValue && this._allowedOrAllRegions.includes(regionDerivedFromValue)) {
331
325
  this._setActiveRegion(regionDerivedFromValue);
@@ -2,21 +2,25 @@
2
2
  let resolveLoaded;
3
3
 
4
4
  /**
5
- * - Handles lazy loading of the (relatively large) google-libphonenumber library, allowing
5
+ * @typedef {* & import('awesome-phonenumber')} AwesomePhoneNumber
6
+ */
7
+
8
+ /**
9
+ * - Handles lazy loading of the awesome-phonenumber library (relatively large, but way lighter than google-libphonenumber), allowing
6
10
  * for quick first paints
7
11
  * - Maintains one instance of phoneNumberUtil that can be shared across multiple places
8
12
  * - Allows for easy mocking in unit tests
9
13
  */
10
14
  export class PhoneUtilManager {
11
15
  static async loadLibPhoneNumber() {
12
- const PhoneUtil = (await import('awesome-phonenumber')).default;
13
- this.PhoneUtil = PhoneUtil;
16
+ const PhoneUtil = /** @type {AwesomePhoneNumber} */ (await import('awesome-phonenumber'));
17
+ this.PhoneUtil = { ...PhoneUtil };
14
18
  resolveLoaded(undefined);
15
19
  return PhoneUtil;
16
20
  }
17
21
 
18
22
  /**
19
- * Check if google-libphonenumber has been loaded
23
+ * Check if awesome-phonenumber has been loaded
20
24
  */
21
25
  static get isLoaded() {
22
26
  return Boolean(this.PhoneUtil);
@@ -24,7 +28,7 @@ export class PhoneUtilManager {
24
28
  }
25
29
 
26
30
  /**
27
- * Wait till google-libphonenumber has been loaded
31
+ * Wait till awesome-phonenumber has been loaded
28
32
  * @example
29
33
  * ```js
30
34
  * await PhoneUtilManager.loadComplete;
@@ -3,7 +3,6 @@ import { PhoneUtilManager } from './PhoneUtilManager.js';
3
3
  /**
4
4
  * @typedef {import('awesome-phonenumber').PhoneNumberFormat} PhoneNumberFormat
5
5
  * @typedef {import('../types/index.js').RegionCode} RegionCode
6
- * @typedef {* & import('awesome-phonenumber').default} AwesomePhoneNumber
7
6
  */
8
7
 
9
8
  /**
@@ -42,33 +41,32 @@ export function formatPhoneNumber(
42
41
  return modelValue;
43
42
  }
44
43
 
45
- // eslint-disable-next-line prefer-destructuring
46
- const PhoneUtil = /** @type {AwesomePhoneNumber} */ (PhoneUtilManager.PhoneUtil);
44
+ const AwesomePhoneNumber = PhoneUtilManager.PhoneUtil;
47
45
 
48
46
  let pn;
49
47
  try {
50
- pn = new PhoneUtil(modelValue, regionCode);
48
+ pn = AwesomePhoneNumber.parsePhoneNumber(modelValue, { regionCode });
51
49
  // eslint-disable-next-line no-empty
52
50
  } catch (_) {}
53
51
 
54
- if (modelValue?.length >= 4 && modelValue?.length <= 16 && pn?.isValid()) {
52
+ if (modelValue?.length >= 4 && modelValue?.length <= 16 && pn?.valid) {
55
53
  let formattedValue;
56
54
 
57
55
  switch (formatStrategy) {
58
56
  case 'e164':
59
- formattedValue = pn.getNumber('e164'); // -> '+46707123456' (default)
57
+ formattedValue = pn.number.e164; // -> '+46707123456' (default)
60
58
  break;
61
59
  case 'international':
62
- formattedValue = pn.getNumber('international'); // -> '+46 70 712 34 56'
60
+ formattedValue = pn.number.international; // -> '+46 70 712 34 56'
63
61
  break;
64
62
  case 'national':
65
- formattedValue = pn.getNumber('national'); // -> '070-712 34 56'
63
+ formattedValue = pn.number.national; // -> '070-712 34 56'
66
64
  break;
67
65
  case 'rfc3966':
68
- formattedValue = pn.getNumber('rfc3966'); // -> 'tel:+46-70-712-34-56'
66
+ formattedValue = pn.number.rfc3966; // -> 'tel:+46-70-712-34-56'
69
67
  break;
70
68
  case 'significant':
71
- formattedValue = pn.getNumber('significant'); // -> '707123456'
69
+ formattedValue = pn.number.significant; // -> '707123456'
72
70
  break;
73
71
  default:
74
72
  break;
@@ -2,7 +2,6 @@ import { PhoneUtilManager } from './PhoneUtilManager.js';
2
2
 
3
3
  /**
4
4
  * @typedef {import('../types/index.js').RegionCode} RegionCode
5
- * @typedef {* & import('awesome-phonenumber').default} AwesomePhoneNumber
6
5
  */
7
6
 
8
7
  /**
@@ -17,17 +16,17 @@ export function parsePhoneNumber(viewValue, { regionCode }) {
17
16
  }
18
17
 
19
18
  // eslint-disable-next-line prefer-destructuring
20
- const PhoneNumber = /** @type {AwesomePhoneNumber} */ (PhoneUtilManager.PhoneUtil);
19
+ const AwesomePhoneNumber = PhoneUtilManager.PhoneUtil;
21
20
  const regex = /[+0-9]+/gi;
22
21
  const strippedViewValue = viewValue.match(regex)?.join('');
23
22
  let pn;
24
23
  try {
25
- pn = PhoneNumber(strippedViewValue, regionCode);
24
+ pn = AwesomePhoneNumber.parsePhoneNumber(strippedViewValue, { regionCode });
26
25
  // eslint-disable-next-line no-empty
27
26
  } catch (_) {}
28
27
 
29
28
  if (pn) {
30
- return pn.getNumber('e164');
29
+ return pn.number.e164;
31
30
  }
32
31
 
33
32
  return viewValue;
@@ -4,7 +4,6 @@ import { PhoneUtilManager } from './PhoneUtilManager.js';
4
4
  /**
5
5
  * @typedef {import('../types/index.js').RegionCode} RegionCode
6
6
  * @typedef {import('awesome-phonenumber').PhoneNumberFormat} PhoneNumberFormat
7
- * @typedef {* & import('awesome-phonenumber').default} AwesomePhoneNumber
8
7
  */
9
8
 
10
9
  /**
@@ -27,9 +26,8 @@ export function liveFormatPhoneNumber(
27
26
  return undefined;
28
27
  }
29
28
 
30
- // eslint-disable-next-line prefer-destructuring
31
- const PhoneNumber = /** @type {AwesomePhoneNumber} */ (PhoneUtilManager.PhoneUtil);
32
- const ayt = PhoneNumber.getAsYouType(regionCode);
29
+ const AwesomePhoneNumber = PhoneUtilManager.PhoneUtil;
30
+ const ayt = AwesomePhoneNumber.getAsYouType(regionCode);
33
31
 
34
32
  for (const char of viewValue) {
35
33
  if (char !== '') {
@@ -3,7 +3,6 @@ import { PhoneUtilManager } from './PhoneUtilManager.js';
3
3
 
4
4
  /**
5
5
  * @typedef {import('../types/index.js').RegionCode} RegionCode
6
- * @typedef {* & import('awesome-phonenumber').default} AwesomePhoneNumber
7
6
  * @typedef {import('../../form-core/types/validate/validate.js').FeedbackMessageData} FeedbackMessageData
8
7
  */
9
8
 
@@ -13,22 +12,21 @@ import { PhoneUtilManager } from './PhoneUtilManager.js';
13
12
  * @returns {false|'invalid-country-code'|'unknown'|'too-long'|'too-short'}
14
13
  */
15
14
  function hasFeedback(modelValue, regionCode) {
16
- // eslint-disable-next-line prefer-destructuring
17
- const PhoneNumber = /** @type {AwesomePhoneNumber} */ (PhoneUtilManager.PhoneUtil);
15
+ const AwesomePhoneNumber = PhoneUtilManager.PhoneUtil;
18
16
  let invalidCountryCode = false;
19
17
 
20
18
  if (regionCode && modelValue?.length >= 4 && modelValue?.length <= 16) {
21
19
  let pn;
22
20
  try {
23
- pn = PhoneNumber(modelValue, regionCode);
24
- invalidCountryCode = pn.g.regionCode !== regionCode;
21
+ pn = AwesomePhoneNumber.parsePhoneNumber(modelValue, { regionCode });
22
+ invalidCountryCode = pn.regionCode !== regionCode;
25
23
  if (invalidCountryCode) {
26
24
  return 'invalid-country-code';
27
25
  }
28
26
  // eslint-disable-next-line no-empty
29
27
  } catch (_) {}
30
28
  // too-short/too-long info seems to be not there (we get 'is-possible'?)
31
- const enumValue = !pn.isValid() ? pn.g.possibility : false;
29
+ const enumValue = !pn.valid ? pn.possibility : false;
32
30
  if (enumValue === 'is-possible') {
33
31
  return 'unknown';
34
32
  }
@@ -4,7 +4,7 @@ import { PhoneNumber, PhoneUtilManager } from '@lion/ui/input-tel.js';
4
4
  import { mockPhoneUtilManager, restorePhoneUtilManager } from '@lion/ui/input-tel-test-helpers.js';
5
5
 
6
6
  /**
7
- * @typedef {* & import('awesome-phonenumber').default} AwesomePhoneNumber
7
+ * @typedef {* & import('awesome-phonenumber')} AwesomePhoneNumber
8
8
  */
9
9
 
10
10
  // For enum output, see: https://www.npmjs.com/package/awesome-phonenumber
@@ -24,6 +24,7 @@ describe('PhoneNumber validation', () => {
24
24
  expect(validator.execute('foo', 'NL')).to.equal('unknown');
25
25
  });
26
26
 
27
+ // TODO: this changed after awesome-phonenumber v4. Skip for now, look into this later
27
28
  it('is invalid when wrong country code is entered, returns "invalid-country-code"', () => {
28
29
  const validator = new PhoneNumber();
29
30
  // 32 is BE region code
@@ -47,12 +48,13 @@ describe('PhoneNumber validation', () => {
47
48
 
48
49
  it('handles validation via awesome-phonenumber', () => {
49
50
  const validator = new PhoneNumber();
50
- const spy = sinon.spy(PhoneUtilManager, 'PhoneUtil');
51
+ // @ts-ignore
52
+ const spy = sinon.spy(PhoneUtilManager.PhoneUtil, 'parsePhoneNumber');
51
53
  validator.execute('0123456789', 'NL');
52
54
  expect(spy).to.have.been.calledOnce;
53
- expect(spy.lastCall.args[1]).to.equal('NL');
55
+ expect(spy.lastCall.args[1]).to.eql({ regionCode: 'NL' });
54
56
  validator.execute('0123456789', 'DE');
55
- expect(spy.lastCall.args[1]).to.equal('DE');
57
+ expect(spy.lastCall.args[1]).to.eql({ regionCode: 'DE' });
56
58
  spy.restore();
57
59
  });
58
60
 
@@ -75,7 +77,8 @@ describe('PhoneNumber validation', () => {
75
77
 
76
78
  it('waits for the lib to be loaded before execution completes when still in async mode', async () => {
77
79
  const validator = new PhoneNumber();
78
- const spy = sinon.spy(PhoneUtilManager, 'PhoneUtil');
80
+ // @ts-ignore
81
+ const spy = sinon.spy(PhoneUtilManager.PhoneUtil, 'parsePhoneNumber');
79
82
  const validationResult = validator.execute('061234', 'NL');
80
83
  expect(validationResult).to.be.instanceOf(Promise);
81
84
  expect(spy).to.not.have.been.called;
@@ -27,7 +27,6 @@ import { getFlagSymbol } from './getFlagSymbol.js';
27
27
  * @typedef {import('../types/index.js').OnDropdownChangeEvent} OnDropdownChangeEvent
28
28
  * @typedef {import('../types/index.js').DropdownRef} DropdownRef
29
29
  * @typedef {import('../types/index.js').RegionMeta} RegionMeta
30
- * @typedef {* & import('awesome-phonenumber').default} AwesomePhoneNumber
31
30
  * @typedef {import('../../select-rich/src/LionSelectRich.js').LionSelectRich} LionSelectRich
32
31
  * @typedef {import('../../overlays/src/OverlayController.js').OverlayController} OverlayController
33
32
  * @typedef {TemplateDataForDropdownInputTel & {data: {regionMetaList:RegionMeta[]}}} TemplateDataForIntlInputTel
@@ -178,9 +177,7 @@ export class LionInputTelDropdown extends LionInputTel {
178
177
 
179
178
  return {
180
179
  template: templates.dropdown(this._templateDataDropdown),
181
- afterRender: () => {
182
- this.__syncRegionWithDropdown();
183
- },
180
+ afterRender: this.__syncRegionWithDropdown,
184
181
  };
185
182
  },
186
183
  };
@@ -205,8 +202,6 @@ export class LionInputTelDropdown extends LionInputTel {
205
202
  _onPhoneNumberUtilReady() {
206
203
  super._onPhoneNumberUtilReady();
207
204
  this.__createRegionMeta();
208
- // render dropdown (trigger render of prefix slot via SlotMixin)
209
- this.requestUpdate();
210
205
  }
211
206
 
212
207
  /**
@@ -234,19 +229,27 @@ export class LionInputTelDropdown extends LionInputTel {
234
229
  /**
235
230
  * Contains everything needed for rendering region options:
236
231
  * region code, country code, display name according to locale, display name
232
+ * @private
237
233
  * @type {RegionMeta[]}
238
234
  */
239
235
  this.__regionMetaList = [];
240
236
 
241
237
  /**
242
238
  * A filtered `this.__regionMetaList`, containing all regions provided in `preferredRegions`
239
+ * @private
243
240
  * @type {RegionMeta[]}
244
241
  */
245
242
  this.__regionMetaListPreferred = [];
246
243
 
247
- /** @type {EventListener} */
244
+ /**
245
+ * @protected
246
+ * @type {EventListener}
247
+ */
248
248
  this._onDropdownValueChange = this._onDropdownValueChange.bind(this);
249
- /** @type {EventListener} */
249
+ /**
250
+ * @private
251
+ * @type {EventListener}
252
+ */
250
253
  this.__syncRegionWithDropdown = this.__syncRegionWithDropdown.bind(this);
251
254
  }
252
255
 
@@ -285,6 +288,9 @@ export class LionInputTelDropdown extends LionInputTel {
285
288
  }
286
289
  }
287
290
 
291
+ /**
292
+ * @protected
293
+ */
288
294
  _initModelValueBasedOnDropdown() {
289
295
  if (!this._initialModelValue && !this.dirty && this._phoneUtil) {
290
296
  const countryCode = this._phoneUtil.getCountryCodeForRegionCode(this.activeRegion);
@@ -78,11 +78,13 @@ export class LionOption extends DisabledMixin(
78
78
  }
79
79
 
80
80
  /**
81
- * @param {string} name
82
- * @param {unknown} oldValue
81
+ * @param {string} [name]
82
+ * @param {unknown} [oldValue]
83
+ * @param {import('lit').PropertyDeclaration} [options]
84
+ * @returns {void}
83
85
  */
84
- requestUpdate(name, oldValue) {
85
- super.requestUpdate(name, oldValue);
86
+ requestUpdate(name, oldValue, options) {
87
+ super.requestUpdate(name, oldValue, options);
86
88
 
87
89
  if (name === 'active' && this.active !== oldValue) {
88
90
  this.dispatchEvent(new Event('active-changed', { bubbles: true }));