@lion/ui 0.6.0-alpha.0 → 0.6.0-alpha.2

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 (107) hide show
  1. package/components/core/src/ScopedElementsMixin.js +146 -0
  2. package/components/core/test/SlotMixin.test.js +9 -9
  3. package/components/form-core/src/validate/ValidateMixin.js +1 -1
  4. package/components/form-core/types/validate/ValidateMixinTypes.ts +14 -1
  5. package/components/input-datepicker/src/LionInputDatepicker.js +1 -1
  6. package/components/input-file/src/LionInputFile.js +1 -1
  7. package/components/input-file/src/LionSelectedFileList.js +1 -1
  8. package/components/input-tel-dropdown/test/LionInputTelDropdown.test.js +2 -1
  9. package/components/listbox/src/ListboxMixin.js +1 -1
  10. package/components/overlays/test/local-positioning.test.js +4 -2
  11. package/components/select-rich/src/LionSelectRich.js +1 -1
  12. package/components/switch/src/LionSwitch.js +1 -1
  13. package/components/textarea/test/lion-textarea.test.js +4 -2
  14. package/components/validate-messages/src/getLocalizedMessage.js +111 -0
  15. package/components/validate-messages/src/loadDefaultFeedbackMessagesNoSideEffects.js +9 -179
  16. package/components/validate-messages/src/per-entrypoint/README.md +16 -0
  17. package/components/validate-messages/src/per-entrypoint/loadComboboxMessagesNoSideEffects.js +22 -0
  18. package/components/validate-messages/src/per-entrypoint/loadFormCoreMessagesNoSideEffects.js +77 -0
  19. package/components/validate-messages/src/per-entrypoint/loadInputTelMessagesNoSideEffects.js +39 -0
  20. package/components/validate-messages/translations/fr.js +2 -2
  21. package/custom-elements.json +2128 -7
  22. package/dist-types/components/core/src/ScopedElementsMixin.d.ts +364 -0
  23. package/dist-types/components/core/src/ScopedElementsMixin.d.ts.map +1 -0
  24. package/dist-types/components/form-core/src/LionField.d.ts +1 -1
  25. package/dist-types/components/form-core/types/validate/ValidateMixinTypes.d.ts +13 -1
  26. package/dist-types/components/form-core/types/validate/ValidateMixinTypes.d.ts.map +1 -1
  27. package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts +356 -1
  28. package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts.map +1 -1
  29. package/dist-types/components/input-file/src/LionInputFile.d.ts +349 -1
  30. package/dist-types/components/input-file/src/LionInputFile.d.ts.map +1 -1
  31. package/dist-types/components/input-file/src/LionSelectedFileList.d.ts +345 -1
  32. package/dist-types/components/input-file/src/LionSelectedFileList.d.ts.map +1 -1
  33. package/dist-types/components/listbox/src/LionListbox.d.ts +1 -1
  34. package/dist-types/components/select-rich/src/LionSelectRich.d.ts +345 -1
  35. package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
  36. package/dist-types/components/switch/src/LionSwitch.d.ts +348 -2
  37. package/dist-types/components/switch/src/LionSwitch.d.ts.map +1 -1
  38. package/dist-types/components/validate-messages/src/getLocalizedMessage.d.ts +13 -0
  39. package/dist-types/components/validate-messages/src/getLocalizedMessage.d.ts.map +1 -0
  40. package/dist-types/components/validate-messages/src/loadDefaultFeedbackMessagesNoSideEffects.d.ts.map +1 -1
  41. package/dist-types/components/validate-messages/src/per-entrypoint/loadComboboxMessagesNoSideEffects.d.ts +9 -0
  42. package/dist-types/components/validate-messages/src/per-entrypoint/loadComboboxMessagesNoSideEffects.d.ts.map +1 -0
  43. package/dist-types/components/validate-messages/src/per-entrypoint/loadFormCoreMessagesNoSideEffects.d.ts +9 -0
  44. package/dist-types/components/validate-messages/src/per-entrypoint/loadFormCoreMessagesNoSideEffects.d.ts.map +1 -0
  45. package/dist-types/components/validate-messages/src/per-entrypoint/loadInputTelMessagesNoSideEffects.d.ts +9 -0
  46. package/dist-types/components/validate-messages/src/per-entrypoint/loadInputTelMessagesNoSideEffects.d.ts.map +1 -0
  47. package/dist-types/exports/validate-messages-no-side-effects.d.ts +3 -0
  48. package/dist-types/tsconfig.tsbuildinfo +1 -1
  49. package/docs/components/accordion/overview.md +2 -2
  50. package/docs/components/checkbox-group/overview.md +2 -2
  51. package/docs/components/collapsible/overview.md +1 -1
  52. package/docs/components/combobox/overview.md +1 -1
  53. package/docs/components/combobox/use-cases.md +1 -1
  54. package/docs/components/dialog/overview.md +1 -1
  55. package/docs/components/fieldset/overview.md +5 -5
  56. package/docs/components/form/overview.md +3 -3
  57. package/docs/components/icon/use-cases.md +1 -1
  58. package/docs/components/input/overview.md +1 -1
  59. package/docs/components/input-amount/overview.md +3 -3
  60. package/docs/components/input-date/overview.md +3 -3
  61. package/docs/components/input-datepicker/overview.md +5 -5
  62. package/docs/components/input-email/overview.md +2 -2
  63. package/docs/components/input-file/overview.md +1 -1
  64. package/docs/components/input-file/use-cases.md +1 -1
  65. package/docs/components/input-iban/overview.md +2 -2
  66. package/docs/components/input-range/overview.md +2 -2
  67. package/docs/components/input-stepper/overview.md +1 -1
  68. package/docs/components/input-tel/overview.md +1 -1
  69. package/docs/components/input-tel/use-cases.md +6 -6
  70. package/docs/components/input-tel-dropdown/overview.md +1 -1
  71. package/docs/components/input-tel-dropdown/src/intl-input-tel-dropdown.js +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/switch/overview.md +2 -2
  75. package/docs/components/tabs/examples.md +1 -1
  76. package/docs/fundamentals/index.md +4 -4
  77. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
  78. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
  79. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
  80. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
  81. package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
  82. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  83. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  84. package/docs/fundamentals/rationales/accessibility.md +1 -1
  85. package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
  86. package/docs/fundamentals/systems/core/overview.md +1 -1
  87. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  88. package/docs/fundamentals/systems/form/model-value.md +1 -1
  89. package/docs/fundamentals/systems/form/overview.md +28 -28
  90. package/docs/fundamentals/systems/form/validate.md +1 -1
  91. package/docs/fundamentals/systems/localize/overview.md +4 -4
  92. package/docs/fundamentals/systems/overlays/assets/demo-el-using-overlaymixin.mjs +2 -1
  93. package/docs/fundamentals/systems/overlays/configuration.md +2 -2
  94. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  95. package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
  96. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  97. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  98. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  99. package/docs/guides/how-to/create-a-form.md +4 -4
  100. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  101. package/docs/guides/index.md +8 -8
  102. package/docs/guides/principles/index.md +5 -5
  103. package/docs/guides/principles/scoped-elements.md +4 -3
  104. package/docs/guides/principles/styling.md +1 -1
  105. package/exports/validate-messages-no-side-effects.js +3 -0
  106. package/package.json +6 -6
  107. package/validate-messages-no-side-effects.js +3 -0
@@ -0,0 +1,146 @@
1
+ /*
2
+ * This file is combination of '@open-wc/scoped-elements@v3/lit-element.js' and '@open-wc/scoped-elements@v3/html-element.js'.
3
+ * Then on top of those, some code from '@open-wc/scoped-elements@v2' is brought to to make polyfill not mandatory.
4
+ *
5
+ * ## Considerations
6
+ * In its current state, the [scoped-custom-element-registry](https://github.com/webcomponents/polyfills/tree/master/packages/scoped-custom-element-registry) draft spec has uncertainties:
7
+ * - the spec is not yet final; it's not clear how long it will be dependent on a polyfill
8
+ * - the polyfill conflicts with new browser functionality (form-associated custom elements in Safari, ShadowRoot.createElement in Chrome Canary, etc.).
9
+ * - the spsc is not compatible with SSR and it remains unclear if it will be in the future
10
+ *
11
+ * Also see: https://github.com/webcomponents/polyfills/issues?q=scoped-custom-element-registry
12
+ *
13
+ * In previous considerations (last year), we betted on the spec to evolve quickly and the polyfill to be stable.
14
+ * Till this day, little progress has been made. In the meantime. @lit-labs/ssr (incompatible with the spec) is released as well.
15
+ *
16
+ * This file aims to achieve two things:
17
+ * = being up to date with the latest version of @open-wc/scoped-elements (v3)
18
+ * - make the impact of this change for lion as minimal as possible
19
+ *
20
+ * In order to achieve the latter, we keep the ability to opt out of the polyfill.
21
+ * This can be beneficial for performance, bundle size, ease of use and SSR capabilities.
22
+ *
23
+ * We will keep a close eye on developments in spec and polyfill, and will re-evaluate the scoped-elements approach when the time is right.
24
+ */
25
+
26
+ import { dedupeMixin } from '@open-wc/dedupe-mixin';
27
+ import { adoptStyles } from 'lit';
28
+ import { ScopedElementsMixin as OpenWcLitScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';
29
+
30
+ /**
31
+ * @typedef {import('@open-wc/scoped-elements/lit-element.js').ScopedElementsHost} ScopedElementsHost
32
+ * @typedef {import('../../form-core/types/validate/ValidateMixinTypes.js').ScopedElementsMap} ScopedElementsMap
33
+ * @typedef {import('lit').CSSResultOrNative} CSSResultOrNative
34
+ * @typedef {import('lit').LitElement} LitElement
35
+ * @typedef {typeof import('lit').LitElement} TypeofLitElement
36
+ * @typedef {import('@open-wc/dedupe-mixin').Constructor<LitElement>} LitElementConstructor
37
+ * @typedef {import('@open-wc/dedupe-mixin').Constructor<ScopedElementsHost>} ScopedElementsHostConstructor
38
+ */
39
+
40
+ const supportsScopedRegistry = Boolean(
41
+ // @ts-expect-error
42
+ ShadowRoot.prototype.createElement && ShadowRoot.prototype.importNode,
43
+ );
44
+
45
+ /**
46
+ * @template {LitElementConstructor} T
47
+ * @param {T} superclass
48
+ */
49
+ const ScopedElementsMixinImplementation = superclass =>
50
+ /** @type {ScopedElementsHost} */
51
+ class ScopedElementsHost extends OpenWcLitScopedElementsMixin(superclass) {
52
+ createScopedElement(/** @type {string} */ tagName) {
53
+ const root = supportsScopedRegistry ? this.shadowRoot : document;
54
+ // @ts-expect-error polyfill to support createElement on shadowRoot is loaded
55
+ return root.createElement(tagName);
56
+ }
57
+
58
+ /**
59
+ * Defines a scoped element.
60
+ *
61
+ * @param {string} tagName
62
+ * @param {typeof HTMLElement} klass
63
+ */
64
+ defineScopedElement(tagName, klass) {
65
+ // @ts-ignore
66
+ const registeredClass = this.registry.get(tagName);
67
+ if (registeredClass && supportsScopedRegistry === false && registeredClass !== klass) {
68
+ // eslint-disable-next-line no-console
69
+ console.error(
70
+ [
71
+ `You are trying to re-register the "${tagName}" custom element with a different class via ScopedElementsMixin.`,
72
+ 'This is only possible with a CustomElementRegistry.',
73
+ 'Your browser does not support this feature so you will need to load a polyfill for it.',
74
+ 'Load "@webcomponents/scoped-custom-element-registry" before you register ANY web component to the global customElements registry.',
75
+ 'e.g. add "<script src="/node_modules/@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min.js"></script>" as your first script tag.',
76
+ 'For more details you can visit https://open-wc.org/docs/development/scoped-elements/',
77
+ ].join('\n'),
78
+ );
79
+ }
80
+ if (!registeredClass) {
81
+ // @ts-ignore
82
+ return this.registry.define(tagName, klass);
83
+ }
84
+ // @ts-ignore
85
+ return this.registry.get(tagName);
86
+ }
87
+
88
+ /**
89
+ * @param {ShadowRootInit} options
90
+ * @returns {ShadowRoot}
91
+ */
92
+ attachShadow(options) {
93
+ // @ts-ignore
94
+ const { scopedElements } = /** @type {typeof ScopedElementsHost} */ (this.constructor);
95
+
96
+ const shouldCreateRegistry =
97
+ !this.registry ||
98
+ // @ts-ignore
99
+ (this.registry === this.constructor.__registry &&
100
+ !Object.prototype.hasOwnProperty.call(this.constructor, '__registry'));
101
+
102
+ /**
103
+ * Create a new registry if:
104
+ * - the registry is not defined
105
+ * - this class doesn't have its own registry *AND* has no shared registry
106
+ * This is important specifically for superclasses/inheritance
107
+ */
108
+ if (shouldCreateRegistry) {
109
+ // @ts-ignore
110
+ this.registry = supportsScopedRegistry ? new CustomElementRegistry() : customElements;
111
+ for (const [tagName, klass] of Object.entries(scopedElements ?? {})) {
112
+ this.defineScopedElement(tagName, klass);
113
+ }
114
+ }
115
+
116
+ return Element.prototype.attachShadow.call(this, {
117
+ ...options,
118
+ // The polyfill currently expects the registry to be passed as `customElements`
119
+ customElements: this.registry,
120
+ // But the proposal has moved forward, and renamed it to `registry`
121
+ // For backwards compatibility, we pass it as both
122
+ registry: this.registry,
123
+ });
124
+ }
125
+
126
+ createRenderRoot() {
127
+ const { shadowRootOptions, elementStyles } = /** @type {TypeofLitElement} */ (
128
+ this.constructor
129
+ );
130
+
131
+ const createdRoot = this.attachShadow(shadowRootOptions);
132
+ if (supportsScopedRegistry) {
133
+ // @ts-expect-error
134
+ this.renderOptions.creationScope = createdRoot;
135
+ }
136
+
137
+ if (createdRoot instanceof ShadowRoot) {
138
+ adoptStyles(createdRoot, elementStyles);
139
+ this.renderOptions.renderBefore = this.renderOptions.renderBefore || createdRoot.firstChild;
140
+ }
141
+
142
+ return createdRoot;
143
+ }
144
+ };
145
+
146
+ export const ScopedElementsMixin = dedupeMixin(ScopedElementsMixinImplementation);
@@ -1,6 +1,6 @@
1
1
  import sinon from 'sinon';
2
2
  import { defineCE, expect, fixture, unsafeStatic, html } from '@open-wc/testing';
3
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
3
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';
4
4
  import { SlotMixin } from '@lion/ui/core.js';
5
5
  import { LitElement } from 'lit';
6
6
 
@@ -8,25 +8,22 @@ import { LitElement } from 'lit';
8
8
  * @typedef {import('../types/SlotMixinTypes.js').SlotHost} SlotHost
9
9
  */
10
10
 
11
- const mockedRenderTarget = document.createElement('div');
11
+ // @ts-ignore
12
+ const createElementNative = ShadowRoot.prototype.createElement;
12
13
  function mockScopedRegistry() {
13
14
  const outputObj = { createElementCallCount: 0 };
14
15
  // @ts-expect-error wait for browser support
15
- ShadowRoot.prototype.createElement = () => {
16
+ ShadowRoot.prototype.createElement = (tagName, options) => {
16
17
  outputObj.createElementCallCount += 1;
17
18
  // Return an element that lit can use as render target
18
- return mockedRenderTarget;
19
+ return createElementNative(tagName, options);
19
20
  };
20
- // @ts-expect-error wait for browser support
21
- window.CustomElementRegistry = class {};
22
21
  return outputObj;
23
22
  }
24
23
 
25
24
  function unMockScopedRegistry() {
26
25
  // @ts-expect-error wait for browser support
27
- delete ShadowRoot.prototype.createElement;
28
- // @ts-expect-error wait for browser support
29
- delete window.CustomElementRegistry;
26
+ ShadowRoot.prototype.createElement = createElementNative;
30
27
  }
31
28
 
32
29
  describe('SlotMixin', () => {
@@ -468,6 +465,8 @@ describe('SlotMixin', () => {
468
465
  });
469
466
 
470
467
  it('does not scope elements when polyfill not loaded', async () => {
468
+ // @ts-expect-error
469
+ ShadowRoot.prototype.createElement = null;
471
470
  class ScopedEl extends LitElement {}
472
471
 
473
472
  const tagName = defineCE(
@@ -505,6 +504,7 @@ describe('SlotMixin', () => {
505
504
 
506
505
  document.body.removeChild(renderTarget);
507
506
  docSpy.restore();
507
+ unMockScopedRegistry();
508
508
  });
509
509
  });
510
510
  });
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable class-methods-use-this, camelcase, no-param-reassign, max-classes-per-file */
2
2
  import { SlotMixin, DisabledMixin } from '@lion/ui/core.js';
3
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
4
3
  import { dedupeMixin } from '@open-wc/dedupe-mixin';
5
4
  // TODO: make form-core independent from localize
6
5
  import { getLocalizeManager } from '@lion/ui/localize-no-side-effects.js';
6
+ import { ScopedElementsMixin } from '../../../core/src/ScopedElementsMixin.js';
7
7
  import { AsyncQueue } from '../utils/AsyncQueue.js';
8
8
  import { pascalCase } from '../utils/pascalCase.js';
9
9
  import { SyncUpdatableMixin } from '../utils/SyncUpdatableMixin.js';
@@ -1,6 +1,5 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { Constructor } from '@open-wc/dedupe-mixin';
3
- import { ScopedElementsHost } from '@open-wc/scoped-elements/types.js';
4
3
 
5
4
  import { DisabledHost } from '../../../core/types/DisabledMixinTypes.js';
6
5
  import { SlotHost } from '../../../core/types/SlotMixinTypes.js';
@@ -214,6 +213,20 @@ export declare class ValidateHost {
214
213
  private __getFeedbackMessages(validators: Validator[]): Promise<FeedbackMessage[]>;
215
214
  }
216
215
 
216
+ export type ScopedElementsMap = {
217
+ [key: string]: typeof HTMLElement;
218
+ };
219
+ export declare class ScopedElementsHost {
220
+ /**
221
+ * Obtains the scoped elements definitions map
222
+ */
223
+ static scopedElements: ScopedElementsMap;
224
+ /**
225
+ * Obtains the CustomElementRegistry
226
+ */
227
+ registry?: CustomElementRegistry;
228
+ }
229
+
217
230
  export declare function ValidateImplementation<T extends Constructor<LitElement>>(
218
231
  superclass: T,
219
232
  ): T &
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable import/no-extraneous-dependencies */
2
2
  import { LionCalendar } from '@lion/ui/calendar.js';
3
3
  import { uuid } from '@lion/ui/core.js';
4
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
5
4
  import { html, css } from 'lit';
6
5
  import { ifDefined } from 'lit/directives/if-defined.js';
7
6
  import { LionInputDate } from '@lion/ui/input-date.js';
@@ -13,6 +12,7 @@ import {
13
12
  ArrowMixin,
14
13
  } from '@lion/ui/overlays.js';
15
14
  import { LocalizeMixin } from '@lion/ui/localize-no-side-effects.js';
15
+ import { ScopedElementsMixin } from '../../core/src/ScopedElementsMixin.js';
16
16
  import { localizeNamespaceLoader } from './localizeNamespaceLoader.js';
17
17
 
18
18
  /**
@@ -1,8 +1,8 @@
1
1
  import { LionField } from '@lion/ui/form-core.js';
2
2
  import { LocalizeMixin } from '@lion/ui/localize.js';
3
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
4
3
  import { css, html } from 'lit';
5
4
  import { ifDefined } from 'lit/directives/if-defined.js';
5
+ import { ScopedElementsMixin } from '../../core/src/ScopedElementsMixin.js';
6
6
  import { FileHandle, MAX_FILE_SIZE } from './FileHandle.js';
7
7
  import { LionSelectedFileList } from './LionSelectedFileList.js';
8
8
  import { localizeNamespaceLoader } from './localizeNamespaceLoader.js';
@@ -1,10 +1,10 @@
1
1
  import { uuid } from '@lion/ui/core.js';
2
2
  import { LionValidationFeedback } from '@lion/ui/form-core.js';
3
3
  import { LocalizeMixin } from '@lion/ui/localize.js';
4
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
5
4
  import { css, html, LitElement, nothing } from 'lit';
6
5
  import { ifDefined } from 'lit/directives/if-defined.js';
7
6
  import { repeat } from 'lit/directives/repeat.js';
7
+ import { ScopedElementsMixin } from '../../core/src/ScopedElementsMixin.js';
8
8
  import { localizeNamespaceLoader } from './localizeNamespaceLoader.js';
9
9
 
10
10
  /**
@@ -49,7 +49,8 @@ class WithFormControlInputTelDropdown extends LionInputTelDropdown {
49
49
  runInputTelSuite({ klass: LionInputTelDropdown });
50
50
  runInputTelDropdownSuite();
51
51
 
52
- describe('WithFormControlInputTelDropdown', () => {
52
+ // TODO: To be fixed in 4095205
53
+ describe.skip('WithFormControlInputTelDropdown', () => {
53
54
  // @ts-expect-error
54
55
  // Runs it for LionSelectRich, which uses .modelValue/@model-value-changed instead of .value/@change
55
56
  runInputTelDropdownSuite({ klass: WithFormControlInputTelDropdown });
@@ -1,8 +1,8 @@
1
1
  import { css, html } from 'lit';
2
2
  import { SlotMixin, uuid } from '@lion/ui/core.js';
3
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
4
3
  import { dedupeMixin } from '@open-wc/dedupe-mixin';
5
4
  import { ChoiceGroupMixin, FormControlMixin, FormRegistrarMixin } from '@lion/ui/form-core.js';
5
+ import { ScopedElementsMixin } from '../../core/src/ScopedElementsMixin.js';
6
6
  import { LionOptions } from './LionOptions.js';
7
7
 
8
8
  // TODO: extract ListNavigationWithActiveDescendantMixin that can be reused in [role="menu"]
@@ -65,7 +65,8 @@ describe('Local Positioning', () => {
65
65
  expect(ctrl._popper.state.modifiersData).to.exist;
66
66
  });
67
67
 
68
- it('positions correctly', async () => {
68
+ // TODO: To be fixed in 4096926
69
+ it.skip('positions correctly', async () => {
69
70
  // smoke test for integration of popper
70
71
  const ctrl = new OverlayController({
71
72
  ...withLocalTestConfig(),
@@ -206,7 +207,8 @@ describe('Local Positioning', () => {
206
207
  expect(ctrl._popper.state.modifiersData.offset.auto).to.eql({ x: 0, y: 16 });
207
208
  });
208
209
 
209
- it('positions the Popper element correctly on show', async () => {
210
+ // TODO: To be fixed in 4096926
211
+ it.skip('positions the Popper element correctly on show', async () => {
210
212
  const ctrl = new OverlayController({
211
213
  ...withLocalTestConfig(),
212
214
  contentNode: createContentSync({ width: 80, height: 20 }),
@@ -1,8 +1,8 @@
1
1
  import { LionListbox } from '@lion/ui/listbox.js';
2
2
  import { html } from 'lit';
3
3
  import { SlotMixin, browserDetection } from '@lion/ui/core.js';
4
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
5
4
  import { OverlayMixin, withDropdownConfig } from '@lion/ui/overlays.js';
5
+ import { ScopedElementsMixin } from '../../core/src/ScopedElementsMixin.js';
6
6
  import { LionSelectInvoker } from './LionSelectInvoker.js';
7
7
 
8
8
  /**
@@ -1,6 +1,6 @@
1
1
  import { css, html } from 'lit';
2
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
3
2
  import { ChoiceInputMixin, LionField } from '@lion/ui/form-core.js';
3
+ import { ScopedElementsMixin } from '../../core/src/ScopedElementsMixin.js';
4
4
  import { LionSwitchButton } from './LionSwitchButton.js';
5
5
 
6
6
  export class LionSwitch extends ScopedElementsMixin(ChoiceInputMixin(LionField)) {
@@ -98,7 +98,8 @@ describe('<lion-textarea>', () => {
98
98
  expect(hightWith1Line < hightWith5TextLines).to.equal(true);
99
99
  });
100
100
 
101
- it(`starts growing when content is bigger than "rows"
101
+ // TODO: To be fixed in 4096171
102
+ it.skip(`starts growing when content is bigger than "rows"
102
103
  'and stops growing after property "maxRows" is reached`, async () => {
103
104
  const el = await fixture(`<lion-textarea></lion-textarea>`);
104
105
  return [1, 2, 3, 4, 5, 6, 7, 8].reduce(async (heightPromise, i) => {
@@ -120,7 +121,8 @@ describe('<lion-textarea>', () => {
120
121
  });
121
122
 
122
123
  // TODO: make test simpler => no reduce please (also update autosize npm dependency to latest version)
123
- it('stops growing after property "maxRows" is reached when there was an initial value', async () => {
124
+ // TODO: To be fixed in 4096171
125
+ it.skip('stops growing after property "maxRows" is reached when there was an initial value', async () => {
124
126
  const el = await fixture(html`<lion-textarea .modelValue="${'1\n2\n3'}"></lion-textarea>`);
125
127
 
126
128
  return [4, 5, 6, 7, 8].reduce(async (heightPromise, i) => {
@@ -0,0 +1,111 @@
1
+ /**
2
+ * @typedef {import('../../form-core/types/validate/validate.js').FeedbackMessageData} FeedbackMessageData
3
+ * @typedef {import('@lion/ui/localize.js').LocalizeManager} LocalizeManager
4
+ */
5
+
6
+ /** @type {Promise<void | object>} */
7
+ let pendingPromise;
8
+
9
+ /**
10
+ * @param {{localize: LocalizeManager}} opts
11
+ */
12
+ export async function loadValidateNamespace({ localize }) {
13
+ if (pendingPromise) {
14
+ return pendingPromise;
15
+ }
16
+
17
+ pendingPromise = localize.loadNamespace(
18
+ {
19
+ 'lion-validate': /** @param {string} locale */ locale => {
20
+ switch (locale) {
21
+ case 'bg-BG':
22
+ return import('@lion/ui/validate-messages-translations/bg-BG.js');
23
+ case 'bg':
24
+ return import('@lion/ui/validate-messages-translations/bg.js');
25
+ case 'cs-CZ':
26
+ return import('@lion/ui/validate-messages-translations/cs-CZ.js');
27
+ case 'cs':
28
+ return import('@lion/ui/validate-messages-translations/cs.js');
29
+ case 'de-DE':
30
+ return import('@lion/ui/validate-messages-translations/de-DE.js');
31
+ case 'de':
32
+ return import('@lion/ui/validate-messages-translations/de.js');
33
+ case 'en-AU':
34
+ return import('@lion/ui/validate-messages-translations/en-AU.js');
35
+ case 'en-GB':
36
+ return import('@lion/ui/validate-messages-translations/en-GB.js');
37
+ case 'en-US':
38
+ return import('@lion/ui/validate-messages-translations/en-US.js');
39
+ case 'en-PH':
40
+ return import('@lion/ui/validate-messages-translations/en-PH.js');
41
+ case 'en':
42
+ return import('@lion/ui/validate-messages-translations/en.js');
43
+ case 'es-ES':
44
+ return import('@lion/ui/validate-messages-translations/es-ES.js');
45
+ case 'es':
46
+ return import('@lion/ui/validate-messages-translations/es.js');
47
+ case 'fr-FR':
48
+ return import('@lion/ui/validate-messages-translations/fr-FR.js');
49
+ case 'fr-BE':
50
+ return import('@lion/ui/validate-messages-translations/fr-BE.js');
51
+ case 'fr':
52
+ return import('@lion/ui/validate-messages-translations/fr.js');
53
+ case 'hu-HU':
54
+ return import('@lion/ui/validate-messages-translations/hu-HU.js');
55
+ case 'hu':
56
+ return import('@lion/ui/validate-messages-translations/hu.js');
57
+ case 'it-IT':
58
+ return import('@lion/ui/validate-messages-translations/it-IT.js');
59
+ case 'it':
60
+ return import('@lion/ui/validate-messages-translations/it.js');
61
+ case 'nl-BE':
62
+ return import('@lion/ui/validate-messages-translations/nl-BE.js');
63
+ case 'nl-NL':
64
+ return import('@lion/ui/validate-messages-translations/nl-NL.js');
65
+ case 'nl':
66
+ return import('@lion/ui/validate-messages-translations/nl.js');
67
+ case 'pl-PL':
68
+ return import('@lion/ui/validate-messages-translations/pl-PL.js');
69
+ case 'pl':
70
+ return import('@lion/ui/validate-messages-translations/pl.js');
71
+ case 'ro-RO':
72
+ return import('@lion/ui/validate-messages-translations/ro-RO.js');
73
+ case 'ro':
74
+ return import('@lion/ui/validate-messages-translations/ro.js');
75
+ case 'ru-RU':
76
+ return import('@lion/ui/validate-messages-translations/ru-RU.js');
77
+ case 'ru':
78
+ return import('@lion/ui/validate-messages-translations/ru.js');
79
+ case 'sk-SK':
80
+ return import('@lion/ui/validate-messages-translations/sk-SK.js');
81
+ case 'sk':
82
+ return import('@lion/ui/validate-messages-translations/sk.js');
83
+ case 'uk-UA':
84
+ return import('@lion/ui/validate-messages-translations/uk-UA.js');
85
+ case 'uk':
86
+ return import('@lion/ui/validate-messages-translations/uk.js');
87
+ case 'zh-CN':
88
+ case 'zh':
89
+ return import('@lion/ui/validate-messages-translations/zh.js');
90
+ default:
91
+ return import('@lion/ui/validate-messages-translations/en.js');
92
+ }
93
+ },
94
+ },
95
+ { locale: localize.locale },
96
+ );
97
+
98
+ return pendingPromise;
99
+ }
100
+
101
+ /**
102
+ * @param {{data:FeedbackMessageData; localize: LocalizeManager}} opts
103
+ * @returns {Promise<string|Element>}
104
+ */
105
+ export const getLocalizedMessage = async ({ data, localize }) => {
106
+ await loadValidateNamespace({ localize });
107
+ if (data) {
108
+ return localize.msg(`lion-validate:${data.type}.${data.name}`, data);
109
+ }
110
+ return '';
111
+ };