@lion/ui 0.0.3 → 0.0.4

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 (105) hide show
  1. package/components/core/src/SlotMixin.js +180 -42
  2. package/components/core/test/SlotMixin.test.js +341 -138
  3. package/components/core/types/SlotMixinTypes.ts +12 -1
  4. package/components/input-tel/src/LionInputTel.js +0 -9
  5. package/components/input-tel-dropdown/src/LionInputTelDropdown.js +32 -29
  6. package/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.js +5 -6
  7. package/components/localize/types/LocalizeMixinTypes.ts +1 -1
  8. package/custom-elements.json +1435 -133
  9. package/dist-types/components/calendar/src/LionCalendar.d.ts +1 -37
  10. package/dist-types/components/calendar/src/LionCalendar.d.ts.map +1 -1
  11. package/dist-types/components/core/src/SlotMixin.d.ts +2 -0
  12. package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
  13. package/dist-types/components/core/test/SlotMixin.test.d.ts +1 -1
  14. package/dist-types/components/core/test/SlotMixin.test.d.ts.map +1 -1
  15. package/dist-types/components/core/types/SlotMixinTypes.d.ts +9 -1
  16. package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
  17. package/dist-types/components/input-amount/src/LionInputAmount.d.ts +1 -37
  18. package/dist-types/components/input-amount/src/LionInputAmount.d.ts.map +1 -1
  19. package/dist-types/components/input-date/src/LionInputDate.d.ts +1 -37
  20. package/dist-types/components/input-date/src/LionInputDate.d.ts.map +1 -1
  21. package/dist-types/components/input-datepicker/src/LionCalendarOverlayFrame.d.ts +1 -37
  22. package/dist-types/components/input-datepicker/src/LionCalendarOverlayFrame.d.ts.map +1 -1
  23. package/dist-types/components/input-email/src/LionInputEmail.d.ts +1 -37
  24. package/dist-types/components/input-email/src/LionInputEmail.d.ts.map +1 -1
  25. package/dist-types/components/input-iban/src/LionInputIban.d.ts +1 -37
  26. package/dist-types/components/input-iban/src/LionInputIban.d.ts.map +1 -1
  27. package/dist-types/components/input-tel/src/LionInputTel.d.ts +1 -42
  28. package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
  29. package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts +14 -8
  30. package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
  31. package/dist-types/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.d.ts.map +1 -1
  32. package/dist-types/components/localize/src/LocalizeMixin.d.ts +1 -37
  33. package/dist-types/components/localize/src/LocalizeMixin.d.ts.map +1 -1
  34. package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts +1 -1
  35. package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts.map +1 -1
  36. package/dist-types/components/pagination/src/LionPagination.d.ts +1 -37
  37. package/dist-types/components/pagination/src/LionPagination.d.ts.map +1 -1
  38. package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts +1 -37
  39. package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts.map +1 -1
  40. package/dist-types/exports/core.d.ts +1 -0
  41. package/dist-types/exports/core.d.ts.map +1 -1
  42. package/dist-types/exports/form-core.d.ts +2 -0
  43. package/dist-types/exports/form-core.d.ts.map +1 -1
  44. package/dist-types/exports/input-tel-dropdown.d.ts +2 -0
  45. package/dist-types/exports/input-tel-dropdown.d.ts.map +1 -1
  46. package/dist-types/exports/input-tel.d.ts +1 -0
  47. package/dist-types/exports/input-tel.d.ts.map +1 -1
  48. package/dist-types/exports/localize.d.ts +3 -0
  49. package/dist-types/exports/localize.d.ts.map +1 -1
  50. package/dist-types/exports/overlays.d.ts +4 -0
  51. package/dist-types/exports/overlays.d.ts.map +1 -1
  52. package/dist-types/tsconfig.tsbuildinfo +1 -1
  53. package/docs/components/checkbox-group/overview.md +2 -2
  54. package/docs/components/collapsible/overview.md +1 -1
  55. package/docs/components/combobox/overview.md +1 -1
  56. package/docs/components/combobox/use-cases.md +1 -1
  57. package/docs/components/dialog/overview.md +1 -1
  58. package/docs/components/fieldset/overview.md +5 -5
  59. package/docs/components/form/overview.md +3 -3
  60. package/docs/components/icon/use-cases.md +1 -1
  61. package/docs/components/input/overview.md +1 -1
  62. package/docs/components/input-amount/overview.md +3 -3
  63. package/docs/components/input-date/overview.md +3 -3
  64. package/docs/components/input-datepicker/overview.md +5 -5
  65. package/docs/components/input-email/overview.md +2 -2
  66. package/docs/components/input-iban/overview.md +2 -2
  67. package/docs/components/input-range/overview.md +2 -2
  68. package/docs/components/input-stepper/overview.md +1 -1
  69. package/docs/components/input-tel/overview.md +1 -1
  70. package/docs/components/input-tel/use-cases.md +6 -6
  71. package/docs/components/input-tel-dropdown/overview.md +1 -1
  72. package/docs/components/radio-group/overview.md +3 -3
  73. package/docs/components/select-rich/use-cases.md +1 -1
  74. package/docs/components/tabs/examples.md +1 -1
  75. package/docs/fundamentals/index.md +4 -4
  76. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
  77. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
  78. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
  79. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
  80. package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
  81. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  82. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  83. package/docs/fundamentals/systems/core/overview.md +1 -1
  84. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  85. package/docs/fundamentals/systems/form/model-value.md +1 -1
  86. package/docs/fundamentals/systems/form/overview.md +28 -28
  87. package/docs/fundamentals/systems/form/validate.md +1 -1
  88. package/docs/fundamentals/systems/localize/overview.md +4 -4
  89. package/docs/fundamentals/systems/overlays/configuration.md +2 -2
  90. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  91. package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
  92. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  93. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  94. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  95. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  96. package/docs/guides/index.md +8 -8
  97. package/docs/guides/principles/index.md +5 -5
  98. package/docs/guides/principles/styling.md +1 -1
  99. package/exports/core.js +2 -0
  100. package/exports/form-core.js +3 -0
  101. package/exports/input-tel-dropdown.js +3 -0
  102. package/exports/input-tel.js +2 -0
  103. package/exports/localize.js +4 -0
  104. package/exports/overlays.js +5 -0
  105. package/package.json +3 -2
@@ -1,4 +1,4 @@
1
- import { html, render, css } from 'lit';
1
+ import { html, css } from 'lit';
2
2
  import { ref, createRef } from 'lit/directives/ref.js';
3
3
 
4
4
  import { LionInputTel } from '@lion/ui/input-tel.js';
@@ -99,6 +99,7 @@ export class LionInputTelDropdown extends LionInputTel {
99
99
  },
100
100
  },
101
101
  };
102
+
102
103
  return {
103
104
  refs,
104
105
  data: {
@@ -155,7 +156,7 @@ export class LionInputTelDropdown extends LionInputTel {
155
156
  css`
156
157
  /**
157
158
  * We need to align the height of the dropdown with the height of the text field.
158
- * We target the HTMLDivElement 'this.__dropdownRenderParent' here. Its child,
159
+ * We target the HTMLDivElement (render wrapper from SlotMixin) here. Its child,
159
160
  * [data-ref=dropdown], recieves a 100% height as well via inline styles (since we
160
161
  * can't target from shadow styles).
161
162
  */
@@ -171,7 +172,17 @@ export class LionInputTelDropdown extends LionInputTel {
171
172
  get slots() {
172
173
  return {
173
174
  ...super.slots,
174
- prefix: () => this.__dropdownRenderParent,
175
+ prefix: () => {
176
+ const ctor = /** @type {typeof LionInputTelDropdown} */ (this.constructor);
177
+ const { templates } = ctor;
178
+
179
+ return {
180
+ template: templates.dropdown(this._templateDataDropdown),
181
+ afterRender: () => {
182
+ this.__syncRegionWithDropdown();
183
+ },
184
+ };
185
+ },
175
186
  };
176
187
  }
177
188
 
@@ -186,7 +197,6 @@ export class LionInputTelDropdown extends LionInputTel {
186
197
  type: 'region',
187
198
  });
188
199
  this.__createRegionMeta();
189
- this._scheduleLightDomRender();
190
200
  }
191
201
 
192
202
  /**
@@ -195,6 +205,8 @@ export class LionInputTelDropdown extends LionInputTel {
195
205
  _onPhoneNumberUtilReady() {
196
206
  super._onPhoneNumberUtilReady();
197
207
  this.__createRegionMeta();
208
+ // render dropdown (trigger render of prefix slot via SlotMixin)
209
+ this.requestUpdate();
198
210
  }
199
211
 
200
212
  /**
@@ -219,9 +231,6 @@ export class LionInputTelDropdown extends LionInputTel {
219
231
  */
220
232
  this._preferredCountriesLabel = '';
221
233
 
222
- /** @type {HTMLDivElement} */
223
- this.__dropdownRenderParent = document.createElement('div');
224
-
225
234
  /**
226
235
  * Contains everything needed for rendering region options:
227
236
  * region code, country code, display name according to locale, display name
@@ -259,9 +268,6 @@ export class LionInputTelDropdown extends LionInputTel {
259
268
  updated(changedProperties) {
260
269
  super.updated(changedProperties);
261
270
 
262
- if (changedProperties.has('_needsLightDomRender')) {
263
- this.__renderDropdown();
264
- }
265
271
  if (changedProperties.has('activeRegion')) {
266
272
  this.__syncRegionWithDropdown();
267
273
  }
@@ -326,6 +332,7 @@ export class LionInputTelDropdown extends LionInputTel {
326
332
  if (prevActiveRegion !== this.activeRegion && !this.focused && this._phoneUtil) {
327
333
  const prevCountryCode = this._phoneUtil.getCountryCodeForRegionCode(prevActiveRegion);
328
334
  const countryCode = this._phoneUtil.getCountryCodeForRegionCode(this.activeRegion);
335
+
329
336
  if (this.value.includes(`+${prevCountryCode}`)) {
330
337
  this.modelValue = this._callParser(
331
338
  this.value.replace(`+${prevCountryCode}`, `+${countryCode}`),
@@ -350,25 +357,6 @@ export class LionInputTelDropdown extends LionInputTel {
350
357
  }
351
358
  }
352
359
 
353
- /**
354
- * Abstract away rendering to light dom, so that we can rerender when needed
355
- * @private
356
- */
357
- __renderDropdown() {
358
- const ctor = /** @type {typeof LionInputTelDropdown} */ (this.constructor);
359
- // If the user locally overrode the templates, get those on the instance
360
- const templates = this.templates || ctor.templates;
361
- render(
362
- templates.dropdown(this._templateDataDropdown),
363
- this.__dropdownRenderParent,
364
- /** @type {RenderOptions} */ ({
365
- scopeName: this.localName,
366
- eventContext: this,
367
- }),
368
- );
369
- this.__syncRegionWithDropdown();
370
- }
371
-
372
360
  /**
373
361
  * @private
374
362
  */
@@ -411,6 +399,7 @@ export class LionInputTelDropdown extends LionInputTel {
411
399
  if (!this._allowedOrAllRegions?.length || !this.__namesForLocale) {
412
400
  return;
413
401
  }
402
+
414
403
  this.__regionMetaList = [];
415
404
  this.__regionMetaListPreferred = [];
416
405
  this._allowedOrAllRegions.forEach(regionCode => {
@@ -436,4 +425,18 @@ export class LionInputTelDropdown extends LionInputTel {
436
425
  });
437
426
  });
438
427
  }
428
+
429
+ /**
430
+ * Usually, we don't use composition in regular LionFields (non choice-groups). Here we use a LionSelect(Rich) inside.
431
+ * We don't want to repropagate any children, since an Application Developer is not concerned with these internals (see repropate logic in FormControlMixin)
432
+ * Also, we don't want to give (wrong) info to InteractionStateMixin, that will set the wrong interaction states based on child info.
433
+ * TODO: Make "this._repropagationRole !== 'child'" the default for FormControlMixin
434
+ * (so that FormControls used within are never repropagated for LionFields)
435
+ * @protected
436
+ * @configure FormControlMixin: don't repropagate any children
437
+ */
438
+ // eslint-disable-next-line class-methods-use-this
439
+ _repropagationCondition() {
440
+ return false;
441
+ }
439
442
  }
@@ -91,8 +91,7 @@ export function runInputTelDropdownSuite({ klass } = { klass: LionInputTelDropdo
91
91
 
92
92
  it('syncs value of dropdown on init if input has no value does not influence interaction states', async () => {
93
93
  const el = await fixture(html` <${tag}></${tag}> `);
94
- // TODO find out why its get dirty again
95
- // expect(el.dirty).to.be.false;
94
+ expect(el.dirty).to.be.false;
96
95
  expect(el.prefilled).to.be.false;
97
96
  });
98
97
 
@@ -111,8 +110,7 @@ export function runInputTelDropdownSuite({ klass } = { klass: LionInputTelDropdo
111
110
 
112
111
  it('sets correct interaction states on init if input has a value', async () => {
113
112
  const el = await fixture(html` <${tag} .modelValue="${'+31612345678'}"></${tag}> `);
114
- // TODO find out why its get dirty again
115
- // expect(el.dirty).to.be.false;
113
+ expect(el.dirty).to.be.false;
116
114
  expect(el.prefilled).to.be.true;
117
115
  });
118
116
 
@@ -245,10 +243,10 @@ export function runInputTelDropdownSuite({ klass } = { klass: LionInputTelDropdo
245
243
  const { resolveLoaded } = mockPhoneUtilManager();
246
244
  const el = await fixture(html` <${tag} .allowedRegions="${['DE']}"></${tag}> `);
247
245
  // @ts-ignore
248
- const spy = sinon.spy(el, '_scheduleLightDomRender');
246
+ const spy = sinon.spy(el, '__rerenderSlot');
249
247
  resolveLoaded(undefined);
250
248
  await aTimeout(0);
251
- expect(spy).to.have.been.calledOnce;
249
+ expect(spy).to.have.been.calledWith('prefix');
252
250
  restorePhoneUtilManager();
253
251
  spy.restore();
254
252
  });
@@ -323,6 +321,7 @@ export function runInputTelDropdownSuite({ klass } = { klass: LionInputTelDropdo
323
321
  mimicUserChangingDropdown(el.refs.dropdown.value, 'BE');
324
322
  await el.updateComplete;
325
323
  await el.updateComplete;
324
+
326
325
  expect(el.value).to.equal('+32 612345678');
327
326
  });
328
327
 
@@ -58,7 +58,7 @@ export interface msgOptions {
58
58
  locale?: string;
59
59
  }
60
60
 
61
- declare class LocalizeMixinHost {
61
+ export declare class LocalizeMixinHost {
62
62
  static get localizeNamespaces(): StringToFunctionMap[];
63
63
 
64
64
  static get waitForLocalizeNamespaces(): boolean;