@lion/ui 0.15.1 → 0.15.3
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.
- package/README.md +44 -9
- package/components/dialog/test/lion-dialog.integration.test.js +170 -0
- package/components/form-core/src/validate/LionValidationFeedback.js +2 -2
- package/components/form-core/src/validate/ValidateMixin.js +3 -3
- package/components/form-core/test/validate/lion-validation-feedback.test.js +2 -2
- package/components/form-core/test-suites/ValidateMixin.suite.js +23 -11
- package/components/form-core/translations/bg.js +4 -4
- package/components/form-core/translations/cs.js +4 -4
- package/components/form-core/translations/de.js +4 -4
- package/components/form-core/translations/en.js +4 -4
- package/components/form-core/translations/es.js +4 -4
- package/components/form-core/translations/fr.js +4 -4
- package/components/form-core/translations/hu.js +4 -4
- package/components/form-core/translations/it.js +4 -4
- package/components/form-core/translations/nl.js +4 -4
- package/components/form-core/translations/pl.js +4 -4
- package/components/form-core/translations/ro.js +4 -4
- package/components/form-core/translations/ru.js +4 -4
- package/components/form-core/translations/sk.js +4 -4
- package/components/form-core/translations/uk.js +4 -4
- package/components/form-core/translations/zh.js +4 -4
- package/components/input-amount-dropdown/src/localizeNamespaceLoader.js +53 -0
- package/components/input-amount-dropdown/translations/bg.js +5 -0
- package/components/input-amount-dropdown/translations/cs.js +5 -0
- package/components/input-amount-dropdown/translations/de.js +5 -0
- package/components/input-amount-dropdown/translations/es.js +5 -0
- package/components/input-amount-dropdown/translations/fr.js +5 -0
- package/components/input-amount-dropdown/translations/hu.js +5 -0
- package/components/input-amount-dropdown/translations/id.js +5 -0
- package/components/input-amount-dropdown/translations/it.js +5 -0
- package/components/input-amount-dropdown/translations/nl.js +5 -0
- package/components/input-amount-dropdown/translations/pl.js +5 -0
- package/components/input-amount-dropdown/translations/ro.js +5 -0
- package/components/input-amount-dropdown/translations/ru.js +5 -0
- package/components/input-amount-dropdown/translations/sk.js +5 -0
- package/components/input-amount-dropdown/translations/uk.js +5 -0
- package/components/input-amount-dropdown/translations/zh.js +5 -0
- package/components/input-stepper/src/LionInputStepper.js +48 -52
- package/components/input-stepper/test/lion-input-stepper.test.js +253 -41
- package/components/overlays/src/OverlayController.js +34 -7
- package/components/overlays/test/OverlayMixin.test.js +2 -2
- package/components/overlays/test-suites/OverlayMixin.suite.js +57 -0
- package/components/pagination/src/LionPagination.js +2 -1
- package/components/pagination/test/lion-pagination.test.js +41 -0
- package/components/validate-messages/translations/it.js +2 -2
- package/custom-elements.json +158 -170
- package/dist-types/components/dialog/test/lion-dialog.integration.test.d.ts +3 -0
- package/dist-types/components/dialog/test/lion-dialog.integration.test.d.ts.map +1 -0
- package/dist-types/components/form-core/test-suites/ValidateMixin.suite.d.ts.map +1 -1
- package/dist-types/components/input-amount-dropdown/src/localizeNamespaceLoader.d.ts +1 -1
- package/dist-types/components/input-amount-dropdown/src/localizeNamespaceLoader.d.ts.map +1 -1
- package/dist-types/components/input-amount-dropdown/translations/bg.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/bg.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/cs.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/cs.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/de.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/de.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/es.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/es.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/fr.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/fr.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/hu.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/hu.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/id.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/id.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/it.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/it.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/nl.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/nl.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/pl.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/pl.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/ro.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/ro.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/ru.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/ru.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/sk.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/sk.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/uk.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/uk.d.ts.map +1 -0
- package/dist-types/components/input-amount-dropdown/translations/zh.d.ts +7 -0
- package/dist-types/components/input-amount-dropdown/translations/zh.d.ts.map +1 -0
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts +4 -20
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts.map +1 -1
- package/dist-types/components/input-stepper/test/lion-input-stepper.test.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts +13 -4
- package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
- package/dist-types/components/overlays/test-suites/OverlayMixin.suite.d.ts.map +1 -1
- package/dist-types/components/pagination/src/LionPagination.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/checkbox-group/use-cases.md +3 -9
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/dialog/use-cases.md +2 -2
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/form/use-cases.md +2 -2
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/api-table.md +2 -3
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/listbox/use-cases.md +1 -1
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/radio-group/use-cases.md +3 -9
- package/docs/components/select/overview.md +1 -1
- package/docs/components/select/use-cases.md +6 -6
- package/docs/components/select-rich/use-cases.md +2 -2
- package/docs/components/tabs/examples.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/rationales/accessibility.md +1 -1
- package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/validate.md +2 -2
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/create-a-form.md +4 -4
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
</p>
|
|
27
27
|
|
|
28
28
|
<p align="center">
|
|
29
|
-
<a href="https://lion
|
|
29
|
+
<a href="https://lion.js.org">Website</a>
|
|
30
30
|
·
|
|
31
|
-
<a href="https://lion
|
|
31
|
+
<a href="https://lion.js.org/fundamentals/">Fundamentals</a>
|
|
32
32
|
·
|
|
33
|
-
<a href="https://lion
|
|
33
|
+
<a href="https://lion.js.org/guides/">Guides</a>
|
|
34
34
|
·
|
|
35
|
-
<a href="https://lion
|
|
35
|
+
<a href="https://lion.js.org/components/">Components</a>
|
|
36
36
|
·
|
|
37
|
-
<a href="https://lion
|
|
37
|
+
<a href="https://lion.js.org/blog/">Blog</a>
|
|
38
38
|
</p>
|
|
39
39
|
|
|
40
40
|
**Lion is a set of highly performant, accessible and flexible Web Components.!**
|
|
@@ -51,9 +51,38 @@ They provide an unopinionated, white-label layer that can be extended to your ow
|
|
|
51
51
|
> This makes sense as the main use case is to extend those components and if you do you do not want to override existing stylings.
|
|
52
52
|
|
|
53
53
|
<p align="center">
|
|
54
|
-
<a href="https://lion
|
|
54
|
+
<a href="https://lion.js.org/guides/"><strong>Explore the Lion Guides ▶</strong></a>
|
|
55
55
|
</p>
|
|
56
56
|
|
|
57
|
+
<details>
|
|
58
|
+
<summary><h2>Table of Contents</h2></summary>
|
|
59
|
+
<ul>
|
|
60
|
+
<li><a href="#astro-migration"> Astro migration </a>
|
|
61
|
+
<ul>
|
|
62
|
+
<li><a href="#astro-how-to"> Astro how to </a></li>
|
|
63
|
+
<li><a href="#issues-which-are-not-caused-by-the-migration-not-to-be-fixed-now"> Issues which are not caused by migration </a></li>
|
|
64
|
+
</ul>
|
|
65
|
+
</li>
|
|
66
|
+
<li><a href="#how-to-install"> Installation </a></li>
|
|
67
|
+
<li><a href="#how-to-use"> How to use </a>
|
|
68
|
+
<ul>
|
|
69
|
+
<li><a href="#extend-a-web-component"> Extend a web component </a></li>
|
|
70
|
+
<li><a href="#use-a-javascript-system"> Use a JavaScript system </a></li>
|
|
71
|
+
<li><a href="#use-a-web-component"> Use a Web Component </a></li>
|
|
72
|
+
</ul>
|
|
73
|
+
</li>
|
|
74
|
+
<li><a href="#issues"> Issues </a></li>
|
|
75
|
+
<li><a href="#feature-requests"> Feature request </a></li>
|
|
76
|
+
<li><a href="#content"> Content </a></li>
|
|
77
|
+
<li><a href="#technologies"> Technologies </a></li>
|
|
78
|
+
<li><a href="#rationale"> Rationale </a></li>
|
|
79
|
+
<li><a href="#coding-guidelines"> Coding guidelines </a></li>
|
|
80
|
+
<li><a href="#how-to-contribute"> How to contribute </a></li>
|
|
81
|
+
<li><a href="#site-deployment"> Site deployment </a></li>
|
|
82
|
+
<li><a href="#content"> Contact </a></li>
|
|
83
|
+
</ul>
|
|
84
|
+
</details>
|
|
85
|
+
|
|
57
86
|
## Astro migration
|
|
58
87
|
|
|
59
88
|
- Keep using `/docs` on the root level as we used it in the `master` branch. The documentation is copied into Astro related directories on `npm run start` and when when anything in `/docs` is updated.
|
|
@@ -77,8 +106,6 @@ They provide an unopinionated, white-label layer that can be extended to your ow
|
|
|
77
106
|
|
|
78
107
|
Note. There is the same error on master. This issue is not caused by the migration
|
|
79
108
|
|
|
80
|
-
### TODO
|
|
81
|
-
|
|
82
109
|
## How to install
|
|
83
110
|
|
|
84
111
|
```bash
|
|
@@ -184,7 +211,7 @@ This means you only have to apply your own Design System: by delivering styles,
|
|
|
184
211
|
|
|
185
212
|
## Coding guidelines
|
|
186
213
|
|
|
187
|
-
Check out our [coding guidelines](https://lion
|
|
214
|
+
Check out our [coding guidelines](https://lion.js.org/guides/principles/definitions-and-terms/) for more detailed information.
|
|
188
215
|
|
|
189
216
|
## How to contribute
|
|
190
217
|
|
|
@@ -193,6 +220,14 @@ Check out our [coding guidelines](https://lion-web.netlify.app/guides/principles
|
|
|
193
220
|
Lion Web Components are only as good as its contributions.
|
|
194
221
|
Read our [contribution guide](https://github.com/ing-bank/lion/blob/master/CONTRIBUTING.md) and feel free to enhance/improve Lion. We keep feature requests closed while we're not working on them.
|
|
195
222
|
|
|
223
|
+
## Site deployment
|
|
224
|
+
|
|
225
|
+
We use [GitHub Pages](https://docs.github.com/en/pages) to host our static website. Collaborators with push permission to the repository branch [`gh-pages`](https://github.com/ing-bank/lion/tree/gh-pages) can trigger a deploy by simply running:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
npm run deploy
|
|
229
|
+
```
|
|
230
|
+
|
|
196
231
|
## Contact
|
|
197
232
|
|
|
198
233
|
Feel free to create a github issue for any feedback or questions you might have.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/* eslint-disable lit-a11y/no-autofocus */
|
|
2
|
+
import { expect, fixture as _fixture, html, waitUntil } from '@open-wc/testing';
|
|
3
|
+
import { sendKeys } from '@web/test-runner-commands';
|
|
4
|
+
|
|
5
|
+
import '@lion/ui/define/lion-button.js';
|
|
6
|
+
import '@lion/ui/define/lion-combobox.js';
|
|
7
|
+
import '@lion/ui/define/lion-select-rich.js';
|
|
8
|
+
import '@lion/ui/define/lion-option.js';
|
|
9
|
+
import '@lion/ui/define/lion-dialog.js';
|
|
10
|
+
import '@lion/ui/define/lion-tooltip.js';
|
|
11
|
+
|
|
12
|
+
import { mimicUserTyping } from '@lion/ui/combobox-test-helpers.js';
|
|
13
|
+
import sinon from 'sinon';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {import('../src/LionDialog.js').LionDialog} LionDialog
|
|
17
|
+
* @typedef {import('lit').TemplateResult} TemplateResult
|
|
18
|
+
*/
|
|
19
|
+
const fixture = /** @type {(arg: TemplateResult) => Promise<LionDialog>} */ (_fixture);
|
|
20
|
+
|
|
21
|
+
const dropDownEntries = ['Apple', 'Banana'];
|
|
22
|
+
|
|
23
|
+
describe('lion-dialog', () => {
|
|
24
|
+
describe('lion-combobox integration', () => {
|
|
25
|
+
it('should close lion-combobox dropdown on Escape and should not close the parent lion-dialog', async () => {
|
|
26
|
+
const el = await fixture(html`
|
|
27
|
+
<lion-dialog has-close-button>
|
|
28
|
+
<lion-button slot="invoker">Open Dialog</lion-button>
|
|
29
|
+
<div slot="header">Combobox example</div>
|
|
30
|
+
<div slot="content">
|
|
31
|
+
<lion-combobox name="combo" label="Select a fruit">
|
|
32
|
+
${dropDownEntries.map(
|
|
33
|
+
(/** @type { string } */ entry) =>
|
|
34
|
+
html` <lion-option .choiceValue="${entry}">${entry}</lion-option>`,
|
|
35
|
+
)}
|
|
36
|
+
</lion-combobox>
|
|
37
|
+
</div>
|
|
38
|
+
</lion-dialog>
|
|
39
|
+
`);
|
|
40
|
+
const dialogInvoker = /** @type {HTMLElement} */ (el.querySelector('[slot="invoker"]'));
|
|
41
|
+
dialogInvoker.click();
|
|
42
|
+
const combobox = /** @type {HTMLElement} */ el.querySelector('lion-combobox');
|
|
43
|
+
const isComboboxRendered = () => !!combobox?.shadowRoot?.childNodes.length;
|
|
44
|
+
await waitUntil(isComboboxRendered);
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
await mimicUserTyping(combobox, 'a');
|
|
47
|
+
const firstOption = /** @type { HTMLElement | undefined } */ (
|
|
48
|
+
el.querySelectorAll('lion-option')?.[0]
|
|
49
|
+
);
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
const isComboboxFirstOptionInDropdownVisible = () => firstOption?.checkVisibility();
|
|
52
|
+
await waitUntil(isComboboxFirstOptionInDropdownVisible);
|
|
53
|
+
const comboboxDialog = combobox?.shadowRoot?.querySelector('dialog');
|
|
54
|
+
// Note, do not remove `console.log` down below. There is a bug in test engine.
|
|
55
|
+
// Referring dialog.close from the test environement fixes the bug
|
|
56
|
+
console.log(sinon.spy(comboboxDialog?.close));
|
|
57
|
+
const comboboxInput = combobox?.querySelector('input');
|
|
58
|
+
comboboxInput?.focus();
|
|
59
|
+
const dropdownDialog = combobox?.shadowRoot?.querySelector('dialog');
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
const dropdownDialogCloseSpy = sinon.spy(dropdownDialog, 'close');
|
|
62
|
+
await sendKeys({
|
|
63
|
+
press: 'Escape',
|
|
64
|
+
});
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
const isDialogVisible = () => el?.shadowRoot?.querySelector('dialog')?.checkVisibility();
|
|
67
|
+
await waitUntil(() => dropdownDialogCloseSpy.called);
|
|
68
|
+
expect(isDialogVisible()).to.equal(true);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('lion-select-rich integration', () => {
|
|
73
|
+
it('should close lion-select-rich dropdown on Escape and should not close the parent lion-dialog', async () => {
|
|
74
|
+
const el = await fixture(html`
|
|
75
|
+
<lion-dialog has-close-button>
|
|
76
|
+
<lion-button slot="invoker">Open Dialog</lion-button>
|
|
77
|
+
<div slot="header">Select rich example</div>
|
|
78
|
+
<div slot="content">
|
|
79
|
+
<lion-select-rich label="Select a fruit">
|
|
80
|
+
${dropDownEntries.map(
|
|
81
|
+
(/** @type { string } */ entry) =>
|
|
82
|
+
html` <lion-option .choiceValue="${entry}">${entry}</lion-option>`,
|
|
83
|
+
)}
|
|
84
|
+
</lion-select-rich>
|
|
85
|
+
</div>
|
|
86
|
+
</lion-dialog>
|
|
87
|
+
`);
|
|
88
|
+
const dialogInvoker = /** @type {HTMLElement} */ (el.querySelector('[slot="invoker"]'));
|
|
89
|
+
dialogInvoker.click();
|
|
90
|
+
const selectRichInvoker = /** @type {HTMLElement} */ (
|
|
91
|
+
el.querySelector('lion-select-invoker')
|
|
92
|
+
);
|
|
93
|
+
const isSelectRichInvokerRendered = () => !!selectRichInvoker?.shadowRoot?.childNodes.length;
|
|
94
|
+
await waitUntil(isSelectRichInvokerRendered);
|
|
95
|
+
const selectRich = el?.querySelector('lion-select-rich');
|
|
96
|
+
const selectRichDialog = selectRich?.shadowRoot?.querySelector('dialog');
|
|
97
|
+
// Note, do not remove `console.log` down below. There is a bug in test engine.
|
|
98
|
+
// Referring dialog.close from the test environement fixes the bug
|
|
99
|
+
console.log(selectRichDialog?.close);
|
|
100
|
+
|
|
101
|
+
selectRichInvoker?.click();
|
|
102
|
+
const dropdownDialog = el
|
|
103
|
+
?.querySelector('lion-select-rich')
|
|
104
|
+
?.shadowRoot?.querySelector('dialog');
|
|
105
|
+
// @ts-ignore
|
|
106
|
+
const dropdownDialogCloseSpy = sinon.spy(dropdownDialog, 'close');
|
|
107
|
+
const isDropdownVisible = () =>
|
|
108
|
+
el
|
|
109
|
+
?.querySelector('lion-select-rich')
|
|
110
|
+
?.shadowRoot?.querySelector('dialog')
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
?.checkVisibility();
|
|
113
|
+
await waitUntil(isDropdownVisible);
|
|
114
|
+
const lionOptions = /** @type {HTMLElement} */ (el.querySelector('lion-options'));
|
|
115
|
+
lionOptions?.focus();
|
|
116
|
+
await sendKeys({
|
|
117
|
+
press: 'Escape',
|
|
118
|
+
});
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
const isDialogVisible = () => el?.shadowRoot?.querySelector('dialog')?.checkVisibility();
|
|
121
|
+
await waitUntil(() => dropdownDialogCloseSpy.called);
|
|
122
|
+
expect(isDialogVisible()).to.equal(true);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe('lion-tooltip integration', () => {
|
|
127
|
+
it('should close lion-tooltip on first Escape and should close the parent lion-dialog on the second Escape', async () => {
|
|
128
|
+
const el = await fixture(html`
|
|
129
|
+
<lion-dialog has-close-button>
|
|
130
|
+
<lion-button slot="invoker" class="dialog-invoker">Open Dialog</lion-button>
|
|
131
|
+
<div slot="header">Tooltip example</div>
|
|
132
|
+
<div slot="content">
|
|
133
|
+
<lion-tooltip has-arrow>
|
|
134
|
+
<button slot="invoker" class="demo-tooltip-invoker">Focus on me</button>
|
|
135
|
+
<div slot="content">This is a tooltip</div>
|
|
136
|
+
</lion-tooltip>
|
|
137
|
+
</div>
|
|
138
|
+
</lion-dialog>
|
|
139
|
+
`);
|
|
140
|
+
|
|
141
|
+
await el.updateComplete;
|
|
142
|
+
const dialogInvoker = /** @type {HTMLElement} */ (el.querySelector('.dialog-invoker'));
|
|
143
|
+
dialogInvoker.click();
|
|
144
|
+
const tooltip = /** @type {HTMLElement} */ el.querySelector('lion-tooltip');
|
|
145
|
+
const isTooltipRendered = () => !!tooltip?.shadowRoot?.childNodes.length;
|
|
146
|
+
await waitUntil(isTooltipRendered);
|
|
147
|
+
const tooltipButton = /** @type {HTMLElement} */ (el.querySelector('.demo-tooltip-invoker'));
|
|
148
|
+
tooltipButton?.focus();
|
|
149
|
+
const getTooltipContent = () =>
|
|
150
|
+
el
|
|
151
|
+
.querySelector('lion-tooltip')
|
|
152
|
+
?.shadowRoot?.querySelector('#overlay-content-node-wrapper');
|
|
153
|
+
// @ts-ignore
|
|
154
|
+
const isTooltipContentVisible = () => getTooltipContent()?.checkVisibility();
|
|
155
|
+
await waitUntil(isTooltipContentVisible);
|
|
156
|
+
await sendKeys({
|
|
157
|
+
press: 'Escape',
|
|
158
|
+
});
|
|
159
|
+
// @ts-ignore
|
|
160
|
+
const isDialogVisible = () => el?.shadowRoot?.querySelector('dialog')?.checkVisibility();
|
|
161
|
+
expect(isTooltipContentVisible()).to.equal(false);
|
|
162
|
+
expect(isDialogVisible()).to.equal(true);
|
|
163
|
+
await sendKeys({
|
|
164
|
+
press: 'Escape',
|
|
165
|
+
});
|
|
166
|
+
expect(isTooltipContentVisible()).to.equal(false);
|
|
167
|
+
expect(isDialogVisible()).to.equal(false);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
});
|
|
@@ -87,11 +87,11 @@ export class LionValidationFeedback extends LocalizeMixin(LitElement) {
|
|
|
87
87
|
${this.feedbackData &&
|
|
88
88
|
this.feedbackData.map(
|
|
89
89
|
({ message, type, validator }) => html`
|
|
90
|
-
<
|
|
90
|
+
<span class="validation-feedback__type">
|
|
91
91
|
${message && type
|
|
92
92
|
? this._localizeManager.msg(`lion-form-core:validation${capitalize(type)}`)
|
|
93
93
|
: nothing}
|
|
94
|
-
</
|
|
94
|
+
</span>
|
|
95
95
|
${this._messageTemplate({ message, type, validator })}
|
|
96
96
|
`,
|
|
97
97
|
)}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/* eslint-disable class-methods-use-this, camelcase, no-param-reassign, max-classes-per-file */
|
|
2
|
-
import {
|
|
2
|
+
import { DisabledMixin, SlotMixin } from '@lion/ui/core.js';
|
|
3
3
|
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
4
4
|
// TODO: make form-core independent from localize
|
|
5
5
|
import { getLocalizeManager } from '@lion/ui/localize-no-side-effects.js';
|
|
6
6
|
import { ScopedElementsMixin } from '../../../core/src/ScopedElementsMixin.js';
|
|
7
|
+
import { FormControlMixin } from '../FormControlMixin.js';
|
|
7
8
|
import { AsyncQueue } from '../utils/AsyncQueue.js';
|
|
8
9
|
import { pascalCase } from '../utils/pascalCase.js';
|
|
9
10
|
import { SyncUpdatableMixin } from '../utils/SyncUpdatableMixin.js';
|
|
10
11
|
import { LionValidationFeedback } from './LionValidationFeedback.js';
|
|
11
12
|
import { Unparseable } from './Unparseable.js';
|
|
12
|
-
import { FormControlMixin } from '../FormControlMixin.js';
|
|
13
13
|
// eslint-disable-next-line no-unused-vars
|
|
14
14
|
import { ResultValidator as MetaValidator } from './ResultValidator.js';
|
|
15
15
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -399,7 +399,7 @@ export const ValidateMixinImplementation = superclass =>
|
|
|
399
399
|
this.__validateCompleteResolve = resolve;
|
|
400
400
|
});
|
|
401
401
|
|
|
402
|
-
if (this.disabled) {
|
|
402
|
+
if (this.disabled || this.readOnly) {
|
|
403
403
|
this.__clearValidationResults();
|
|
404
404
|
this.__finishValidationPass();
|
|
405
405
|
this._updateFeedbackComponent();
|
|
@@ -61,12 +61,12 @@ describe('lion-validation-feedback', () => {
|
|
|
61
61
|
await el.updateComplete;
|
|
62
62
|
|
|
63
63
|
const validationFeedbackType = el.shadowRoot?.querySelector('.validation-feedback__type');
|
|
64
|
-
expect(validationFeedbackType?.textContent?.trim()).to.equal('Error');
|
|
64
|
+
expect(validationFeedbackType?.textContent?.trim()).to.equal('Error,');
|
|
65
65
|
|
|
66
66
|
el.feedbackData = [{ message: 'hello', type: 'info', validator: new AlwaysInvalid() }];
|
|
67
67
|
await el.updateComplete;
|
|
68
68
|
|
|
69
|
-
expect(validationFeedbackType?.textContent?.trim()).to.equal('Info');
|
|
69
|
+
expect(validationFeedbackType?.textContent?.trim()).to.equal('Info,');
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it('it does not share the type if there is no message', async () => {
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
|
3
1
|
import {
|
|
4
|
-
getFormControlMembers,
|
|
5
|
-
AsyncAlwaysInvalid,
|
|
6
|
-
AsyncAlwaysValid,
|
|
7
2
|
AlwaysInvalid,
|
|
8
3
|
AlwaysValid,
|
|
4
|
+
AsyncAlwaysInvalid,
|
|
5
|
+
AsyncAlwaysValid,
|
|
6
|
+
getFormControlMembers,
|
|
9
7
|
} from '@lion/ui/form-core-test-helpers.js';
|
|
10
|
-
import sinon from 'sinon';
|
|
11
8
|
import {
|
|
12
|
-
ResultValidator,
|
|
13
|
-
ValidateMixin,
|
|
14
9
|
EqualsLength,
|
|
15
|
-
Unparseable,
|
|
16
10
|
MaxLength,
|
|
17
11
|
MinLength,
|
|
18
|
-
Validator,
|
|
19
12
|
Required,
|
|
13
|
+
ResultValidator,
|
|
14
|
+
Unparseable,
|
|
15
|
+
ValidateMixin,
|
|
16
|
+
Validator,
|
|
20
17
|
} from '@lion/ui/form-core.js';
|
|
18
|
+
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
|
19
|
+
import { LitElement } from 'lit';
|
|
20
|
+
import sinon from 'sinon';
|
|
21
21
|
|
|
22
|
-
import '@lion/ui/define/lion-validation-feedback.js';
|
|
23
22
|
import '@lion/ui/define/lion-field.js';
|
|
23
|
+
import '@lion/ui/define/lion-validation-feedback.js';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* @typedef {import('@lion/ui/form-core.js').LionField} LionField
|
|
@@ -631,6 +631,18 @@ export function runValidateMixinSuite(customConfig) {
|
|
|
631
631
|
isCatValidator.param = 'Garfield';
|
|
632
632
|
expect(catSpy.callCount).to.equal(2);
|
|
633
633
|
});
|
|
634
|
+
|
|
635
|
+
it('Validators will not be called on readOnly fields', async () => {
|
|
636
|
+
const el = /** @type {ValidateElement} */ (
|
|
637
|
+
await fixture(html`
|
|
638
|
+
<${tag} .validators=${[new IsCat()]}>${lightDom}</${tag}>
|
|
639
|
+
`)
|
|
640
|
+
);
|
|
641
|
+
|
|
642
|
+
el.readOnly = true;
|
|
643
|
+
el.modelValue = 'dog';
|
|
644
|
+
expect(el.validationStates.error.IsCat).to.be.undefined;
|
|
645
|
+
});
|
|
634
646
|
});
|
|
635
647
|
|
|
636
648
|
describe('Async Validator Integration', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: '
|
|
3
|
-
validationWarning: '
|
|
4
|
-
validationSuccess: '
|
|
5
|
-
validationInfo: '
|
|
2
|
+
validationError: 'Грешка,',
|
|
3
|
+
validationWarning: 'Предупреждение,',
|
|
4
|
+
validationSuccess: 'Успех,',
|
|
5
|
+
validationInfo: 'Информация,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Chyba',
|
|
3
|
-
validationWarning: '
|
|
4
|
-
validationSuccess: 'Úspěch',
|
|
5
|
-
validationInfo: 'Informace',
|
|
2
|
+
validationError: 'Chyba,',
|
|
3
|
+
validationWarning: 'Varování,',
|
|
4
|
+
validationSuccess: 'Úspěch,',
|
|
5
|
+
validationInfo: 'Informace,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Fehler',
|
|
3
|
-
validationWarning: 'Warnhinweis',
|
|
4
|
-
validationSuccess: 'Erfolgreich',
|
|
5
|
-
validationInfo: 'Info',
|
|
2
|
+
validationError: 'Fehler,',
|
|
3
|
+
validationWarning: 'Warnhinweis,',
|
|
4
|
+
validationSuccess: 'Erfolgreich,',
|
|
5
|
+
validationInfo: 'Info,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Error',
|
|
3
|
-
validationWarning: 'Advertencia',
|
|
4
|
-
validationSuccess: 'Satisfactorio',
|
|
5
|
-
validationInfo: 'Información',
|
|
2
|
+
validationError: 'Error,',
|
|
3
|
+
validationWarning: 'Advertencia,',
|
|
4
|
+
validationSuccess: 'Satisfactorio,',
|
|
5
|
+
validationInfo: 'Información,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Erreur',
|
|
3
|
-
validationWarning: 'Avertissement',
|
|
4
|
-
validationSuccess: 'Succès',
|
|
5
|
-
validationInfo: 'Info',
|
|
2
|
+
validationError: 'Erreur,',
|
|
3
|
+
validationWarning: 'Avertissement,',
|
|
4
|
+
validationSuccess: 'Succès,',
|
|
5
|
+
validationInfo: 'Info,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Hiba',
|
|
3
|
-
validationWarning: 'Figyelmeztetés',
|
|
4
|
-
validationSuccess: 'Sikeres',
|
|
5
|
-
validationInfo: '
|
|
2
|
+
validationError: 'Hiba,',
|
|
3
|
+
validationWarning: 'Figyelmeztetés,',
|
|
4
|
+
validationSuccess: 'Sikeres,',
|
|
5
|
+
validationInfo: 'Információ,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Errore',
|
|
3
|
-
validationWarning: 'Avvertenza',
|
|
4
|
-
validationSuccess: 'Operazione riuscita',
|
|
5
|
-
validationInfo: 'Info',
|
|
2
|
+
validationError: 'Errore,',
|
|
3
|
+
validationWarning: 'Avvertenza,',
|
|
4
|
+
validationSuccess: 'Operazione riuscita,',
|
|
5
|
+
validationInfo: 'Info,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Fout',
|
|
3
|
-
validationWarning: 'Waarschuwing',
|
|
4
|
-
validationSuccess: 'Succes',
|
|
5
|
-
validationInfo: 'Informatie',
|
|
2
|
+
validationError: 'Fout,',
|
|
3
|
+
validationWarning: 'Waarschuwing,',
|
|
4
|
+
validationSuccess: 'Succes,',
|
|
5
|
+
validationInfo: 'Informatie,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Błąd',
|
|
3
|
-
validationWarning: 'Ostrzeżenie',
|
|
4
|
-
validationSuccess: 'Zrealizowano pomyślnie',
|
|
5
|
-
validationInfo: 'Informacja',
|
|
2
|
+
validationError: 'Błąd,',
|
|
3
|
+
validationWarning: 'Ostrzeżenie,',
|
|
4
|
+
validationSuccess: 'Zrealizowano pomyślnie,',
|
|
5
|
+
validationInfo: 'Informacja,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Eroare',
|
|
3
|
-
validationWarning: 'Atenție',
|
|
4
|
-
validationSuccess: 'Succes',
|
|
5
|
-
validationInfo: 'Informații',
|
|
2
|
+
validationError: 'Eroare,',
|
|
3
|
+
validationWarning: 'Atenție,',
|
|
4
|
+
validationSuccess: 'Succes,',
|
|
5
|
+
validationInfo: 'Informații,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: '
|
|
3
|
-
validationWarning: '
|
|
4
|
-
validationSuccess: '
|
|
5
|
-
validationInfo: '
|
|
2
|
+
validationError: 'Ошибка,',
|
|
3
|
+
validationWarning: 'Предупреждение,',
|
|
4
|
+
validationSuccess: 'Успешно,',
|
|
5
|
+
validationInfo: 'Информация,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: 'Chyba',
|
|
3
|
-
validationWarning: 'Varovanie',
|
|
4
|
-
validationSuccess: '
|
|
5
|
-
validationInfo: 'Info',
|
|
2
|
+
validationError: 'Chyba,',
|
|
3
|
+
validationWarning: 'Varovanie,',
|
|
4
|
+
validationSuccess: 'Úspešné,',
|
|
5
|
+
validationInfo: 'Info,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
validationError: '
|
|
3
|
-
validationWarning: '
|
|
4
|
-
validationSuccess: '
|
|
5
|
-
validationInfo: '
|
|
2
|
+
validationError: 'Помилка,',
|
|
3
|
+
validationWarning: 'Попередження,',
|
|
4
|
+
validationSuccess: 'Успішно,',
|
|
5
|
+
validationInfo: 'Інформація,',
|
|
6
6
|
};
|
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
2
|
export const localizeNamespaceLoader = /** @param {string} locale */ locale => {
|
|
3
3
|
switch (locale) {
|
|
4
|
+
case 'bg-BG':
|
|
5
|
+
case 'bg':
|
|
6
|
+
return import('@lion/ui/input-amount-dropdown-translations/bg.js');
|
|
7
|
+
case 'cs-CZ':
|
|
8
|
+
case 'cs':
|
|
9
|
+
return import('@lion/ui/input-amount-dropdown-translations/cs.js');
|
|
10
|
+
case 'de-DE':
|
|
11
|
+
case 'de':
|
|
12
|
+
return import('@lion/ui/input-amount-dropdown-translations/de.js');
|
|
13
|
+
case 'en-AU':
|
|
14
|
+
case 'en-GB':
|
|
15
|
+
case 'en-US':
|
|
16
|
+
case 'en-PH':
|
|
17
|
+
case 'en':
|
|
18
|
+
return import('@lion/ui/input-amount-dropdown-translations/en.js');
|
|
19
|
+
case 'es-ES':
|
|
20
|
+
case 'es':
|
|
21
|
+
return import('@lion/ui/input-amount-dropdown-translations/es.js');
|
|
22
|
+
case 'fr-FR':
|
|
23
|
+
case 'fr-BE':
|
|
24
|
+
case 'fr':
|
|
25
|
+
return import('@lion/ui/input-amount-dropdown-translations/fr.js');
|
|
26
|
+
case 'hu-HU':
|
|
27
|
+
case 'hu':
|
|
28
|
+
return import('@lion/ui/input-amount-dropdown-translations/hu.js');
|
|
29
|
+
case 'id-ID':
|
|
30
|
+
case 'id':
|
|
31
|
+
return import('@lion/ui/input-amount-dropdown-translations/id.js');
|
|
32
|
+
case 'it-IT':
|
|
33
|
+
case 'it':
|
|
34
|
+
return import('@lion/ui/input-amount-dropdown-translations/it.js');
|
|
35
|
+
case 'nl-BE':
|
|
36
|
+
case 'nl-NL':
|
|
37
|
+
case 'nl':
|
|
38
|
+
return import('@lion/ui/input-amount-dropdown-translations/nl.js');
|
|
39
|
+
case 'pl-PL':
|
|
40
|
+
case 'pl':
|
|
41
|
+
return import('@lion/ui/input-amount-dropdown-translations/pl.js');
|
|
42
|
+
case 'ro-RO':
|
|
43
|
+
case 'ro':
|
|
44
|
+
return import('@lion/ui/input-amount-dropdown-translations/ro.js');
|
|
45
|
+
case 'ru-RU':
|
|
46
|
+
case 'ru':
|
|
47
|
+
return import('@lion/ui/input-amount-dropdown-translations/ru.js');
|
|
48
|
+
case 'sk-SK':
|
|
49
|
+
case 'sk':
|
|
50
|
+
return import('@lion/ui/input-amount-dropdown-translations/sk.js');
|
|
51
|
+
case 'uk-UA':
|
|
52
|
+
case 'uk':
|
|
53
|
+
return import('@lion/ui/input-amount-dropdown-translations/uk.js');
|
|
54
|
+
case 'zh-CN':
|
|
55
|
+
case 'zh':
|
|
56
|
+
return import('@lion/ui/input-amount-dropdown-translations/zh.js');
|
|
4
57
|
default:
|
|
5
58
|
return import('@lion/ui/input-amount-dropdown-translations/en.js');
|
|
6
59
|
}
|