@lion/ui 0.1.4 → 0.1.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.
- package/README.md +222 -0
- package/components/combobox/src/LionCombobox.js +73 -3
- package/components/combobox/test/lion-combobox.test.js +44 -3
- package/components/combobox/translations/bg.js +3 -0
- package/components/combobox/translations/cs.js +3 -0
- package/components/combobox/translations/de.js +3 -0
- package/components/combobox/translations/en.js +3 -0
- package/components/combobox/translations/es.js +3 -0
- package/components/combobox/translations/fr.js +3 -0
- package/components/combobox/translations/hu.js +3 -0
- package/components/combobox/translations/it.js +3 -0
- package/components/combobox/translations/nl.js +3 -0
- package/components/combobox/translations/pl.js +3 -0
- package/components/combobox/translations/ro.js +3 -0
- package/components/combobox/translations/ru.js +3 -0
- package/components/combobox/translations/sk.js +3 -0
- package/components/combobox/translations/uk.js +3 -0
- package/components/combobox/translations/zh.js +3 -0
- package/custom-elements.json +444 -0
- package/dist-types/components/combobox/src/LionCombobox.d.ts +1 -1
- package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
- package/dist-types/components/combobox/translations/bg.d.ts +5 -0
- package/dist-types/components/combobox/translations/bg.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/cs.d.ts +5 -0
- package/dist-types/components/combobox/translations/cs.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/de.d.ts +5 -0
- package/dist-types/components/combobox/translations/de.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/en.d.ts +5 -0
- package/dist-types/components/combobox/translations/en.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/es.d.ts +5 -0
- package/dist-types/components/combobox/translations/es.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/fr.d.ts +5 -0
- package/dist-types/components/combobox/translations/fr.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/hu.d.ts +5 -0
- package/dist-types/components/combobox/translations/hu.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/it.d.ts +5 -0
- package/dist-types/components/combobox/translations/it.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/nl.d.ts +5 -0
- package/dist-types/components/combobox/translations/nl.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/pl.d.ts +5 -0
- package/dist-types/components/combobox/translations/pl.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/ro.d.ts +5 -0
- package/dist-types/components/combobox/translations/ro.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/ru.d.ts +5 -0
- package/dist-types/components/combobox/translations/ru.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/sk.d.ts +5 -0
- package/dist-types/components/combobox/translations/sk.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/uk.d.ts +5 -0
- package/dist-types/components/combobox/translations/uk.d.ts.map +1 -0
- package/dist-types/components/combobox/translations/zh.d.ts +5 -0
- package/dist-types/components/combobox/translations/zh.d.ts.map +1 -0
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/checkbox-group/overview.md +2 -2
- 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/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- 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-iban/overview.md +2 -2
- package/docs/components/input-range/overview.md +2 -2
- 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/radio-group/overview.md +3 -3
- package/docs/components/select-rich/use-cases.md +1 -1
- package/docs/components/tabs/examples.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
- 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/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 +1 -1
- 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/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 +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img
|
|
3
|
+
width="20%"
|
|
4
|
+
src="./docs/_assets/logo.svg"
|
|
5
|
+
alt="Lion"
|
|
6
|
+
/>
|
|
7
|
+
<h1 style="text-align: center;">Lion</h1>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://github.com/modernweb-dev/rocket/actions"
|
|
12
|
+
><img
|
|
13
|
+
src="https://img.shields.io/github/workflow/status/modernweb-dev/rocket/Release/main?label=workflow&style=flat-square"
|
|
14
|
+
alt="GitHub Actions workflow status"
|
|
15
|
+
/></a>
|
|
16
|
+
<a href="https://github.com/modernweb-dev/rocket/actions"
|
|
17
|
+
><img
|
|
18
|
+
src="https://img.shields.io/github/workflow/status/modernweb-dev/rocket/Release/main?label=workflow&style=flat-square"
|
|
19
|
+
alt="GitHub Actions workflow status"
|
|
20
|
+
/></a>
|
|
21
|
+
<a href="https://www.tickgit.com/browse?repo=github.com/ing-bank/lion"
|
|
22
|
+
><img
|
|
23
|
+
src="https://badgen.net/https/api.tickgit.com/badgen/github.comgithub.com/ing-bank/lion"
|
|
24
|
+
alt="Todos"
|
|
25
|
+
/></a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<a href="https://lion-web.netlify.app">Website</a>
|
|
30
|
+
·
|
|
31
|
+
<a href="https://lion-web.netlify.app/guides/">Guides</a>
|
|
32
|
+
·
|
|
33
|
+
<a href="https://lion-web.netlify.app/components/">Components</a>
|
|
34
|
+
·
|
|
35
|
+
<a href="https://lion-web.netlify.app/docs/">Documentation</a>
|
|
36
|
+
·
|
|
37
|
+
<a href="https://lion-web.netlify.app/blog/">Blog</a>
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
**Lion is a set of highly performant, accessible and flexible Web Components.!**
|
|
41
|
+
|
|
42
|
+
They provide an unopinionated, white-label layer that can be extended to your own layer of components.
|
|
43
|
+
|
|
44
|
+
- **High Performance:** Focused on great performance in all relevant browsers with a minimal number of dependencies.
|
|
45
|
+
- **Accessibility:** Aimed at compliance with the WCAG 2.1 AA standard to create components that are accessible for everybody.
|
|
46
|
+
- **Flexibility:** Provides solutions through Web Components and JavaScript classes which can be used, adopted and extended to fit all needs.
|
|
47
|
+
- **Modern Code:** Lion is distributes as pure es modules.
|
|
48
|
+
- **Exposes functions/classes and Web Components:** Ships a functionality in it's most appropriate form.
|
|
49
|
+
|
|
50
|
+
> Note: Our demos may look a little bland but that is on purpose. They only come with functional stylings.
|
|
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
|
+
|
|
53
|
+
<p align="center">
|
|
54
|
+
<a href="https://lion-web.netlify.app/guides/"><strong>Explore the Lion Guides ▶</strong></a>
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
## How to install
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm i @lion/<package-name>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## How to use
|
|
64
|
+
|
|
65
|
+
### Extend a Web Component
|
|
66
|
+
|
|
67
|
+
**This is the main use case for lion**. To import component classes, and extend them for your own design system's components.
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
import { css } from 'lit';
|
|
71
|
+
import { LionInput } from '@lion/input';
|
|
72
|
+
|
|
73
|
+
class MyInput extends LionInput {
|
|
74
|
+
static get styles() {
|
|
75
|
+
return [
|
|
76
|
+
super.styles,
|
|
77
|
+
css`
|
|
78
|
+
/* your styles here */
|
|
79
|
+
`,
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
customElements.define('my-input', MyInput);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Use a JavaScript system
|
|
87
|
+
|
|
88
|
+
There's a couple of "systems" in lion which have a JavaScript API. Examples are `localize`, `overlays`, `ajax`, etc.
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<script type="module">
|
|
92
|
+
import { ajax } from '@lion/ajax';
|
|
93
|
+
|
|
94
|
+
ajax
|
|
95
|
+
.fetch('data.json')
|
|
96
|
+
.then(response => response.json())
|
|
97
|
+
.then(data => {
|
|
98
|
+
// do something with the data
|
|
99
|
+
});
|
|
100
|
+
</script>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Use a Web Component
|
|
104
|
+
|
|
105
|
+
You can also use the lion elements directly, although this is likely not a common use case.
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<script type="module">
|
|
109
|
+
import '@lion/input/define';
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<lion-input name="firstName"></lion-input>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Issues
|
|
116
|
+
|
|
117
|
+
If you encounter an issue with any of the packages we are offering please open a [new bug issue](https://github.com/ing-bank/lion/issues/new?assignees=&labels=&template=bug_report.md&title=). Be sure to include a description of the expected and the current behavior - additional adding a [reproduction](https://webcomponents.dev/edit/kpZmz1CJN580OaXsk56f?pm=1) always helps.
|
|
118
|
+
|
|
119
|
+
## Feature requests
|
|
120
|
+
|
|
121
|
+
When you have an idea on how we could improve, please check our [discussions](https://github.com/ing-bank/lion/discussions) to see if there are similar ideas or feature requests. If there are none, please [start](https://github.com/ing-bank/lion/discussions/new) your feature request as a new discussion topic. Add the title `[Feature Request] My awesome feature` and a description of what you expect from the improvement and what the use case is.
|
|
122
|
+
|
|
123
|
+
## Content
|
|
124
|
+
|
|
125
|
+
Lion web components is logically organized in groups of systems.
|
|
126
|
+
|
|
127
|
+
The accessibility column indicates whether the functionality is accessible in its core. Aspects like styling and content determine actual accessibility in usage.
|
|
128
|
+
|
|
129
|
+
| Package | Version | Description | Accessibility |
|
|
130
|
+
| ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -------------------------- |
|
|
131
|
+
| **-- [Form System](https://lion-web.netlify.app/fundamentals/systems/form/overview/) --** | | A system that lets you make complex forms with ease, including: validation, translations. | ✔️ |
|
|
132
|
+
| [combobox](https://lion-web.netlify.app/components/combobox/overview/) | [](https://www.npmjs.com/package/@lion/form) | Text box controlling popup listbox | ✔️ |
|
|
133
|
+
| [form](https://lion-web.netlify.app/components/form/overview) | [](https://www.npmjs.com/package/@lion/form) | Wrapper for multiple form elements | ✔️ |
|
|
134
|
+
| [form-core](https://lion-web.netlify.app/fundamentals/systems/form/overview/) | [](https://www.npmjs.com/package/@lion/form-core) | Core functionality for all form controls | ✔️ |
|
|
135
|
+
| [form-integrations](https://lion-web.netlify.app/fundamentals/systems/form/overview/) | [](https://www.npmjs.com/package/@lion/form-integrations) | Shows form elements in an integrated way | ✔️ |
|
|
136
|
+
| [fieldset](https://lion-web.netlify.app/components/fieldset/overview/) | [](https://www.npmjs.com/package/@lion/fieldset) | Group for form inputs | ✔️ |
|
|
137
|
+
| [checkbox-group](https://lion-web.netlify.app/components/checkbox-group/overview/) | [](https://www.npmjs.com/package/@lion/checkbox-group) | Group of checkboxes | ✔️ |
|
|
138
|
+
| [input](https://lion-web.netlify.app/components/input/overview/) | [](https://www.npmjs.com/package/@lion/input) | Input element for strings | ✔️ |
|
|
139
|
+
| [input-amount](https://lion-web.netlify.app/components/input-amount/overview/) | [](https://www.npmjs.com/package/@lion/input-amount) | Input element for amounts | ✔️ |
|
|
140
|
+
| [input-date](https://lion-web.netlify.app/components/input-date/overview/) | [](https://www.npmjs.com/package/@lion/input-date) | Input element for dates | ✔️ |
|
|
141
|
+
| [input-datepicker](https://lion-web.netlify.app/components/input-datepicker/overview/) | [](https://www.npmjs.com/package/@lion/input-datepicker) | Input element for dates with a datepicker | ✔️ |
|
|
142
|
+
| [input-email](https://lion-web.netlify.app/components/input-email/overview/) | [](https://www.npmjs.com/package/@lion/input-email) | Input element for e-mails | ✔️ |
|
|
143
|
+
| [input-iban](https://lion-web.netlify.app/components/input-iban/overview/) | [](https://www.npmjs.com/package/@lion/input-iban) | Input element for IBANs | ✔️ |
|
|
144
|
+
| [input-range](https://lion-web.netlify.app/components/input-range/overview/) | [](https://www.npmjs.com/package/@lion/input-range) | Input element for a range of values | ✔️ |
|
|
145
|
+
| [input-stepper](https://lion-web.netlify.app/components/input-stepper/overview/) | [](https://www.npmjs.com/package/@lion/input-stepper) | Input stepper element for the predefined range | ✔️ |
|
|
146
|
+
| [listbox](https://lion-web.netlify.app/components/listbox/overview/) | [](https://www.npmjs.com/package/@lion/form) | Interactive list with selectable options | ✔️ |
|
|
147
|
+
| [radio-group](https://lion-web.netlify.app/components/radio-group/overview/) | [](https://www.npmjs.com/package/@lion/radio-group) | Group of radios | ✔️ |
|
|
148
|
+
| [select](https://lion-web.netlify.app/components/select/overview/) | [](https://www.npmjs.com/package/@lion/select) | Simple native dropdown element | ✔️ |
|
|
149
|
+
| [select-rich](https://lion-web.netlify.app/components/select-rich/overview/) | [](https://www.npmjs.com/package/@lion/select-rich) | 'rich' version of the native dropdown element | [#243][i243] |
|
|
150
|
+
| [textarea](https://lion-web.netlify.app/components/textarea/overview/) | [](https://www.npmjs.com/package/@lion/textarea) | Multiline text input | ✔️ |
|
|
151
|
+
| **-- [Button System](https://lion-web.netlify.app/components/buttons-intro--page) --** | | These web components bring common UX patterns while still full integrated with (native) forms. | |
|
|
152
|
+
| [button](https://lion-web.netlify.app/components/button/overview/) | [](https://www.npmjs.com/package/@lion/button) | Button | ✔️ |
|
|
153
|
+
| [switch](https://lion-web.netlify.app/components/switch/overview/) | [](https://www.npmjs.com/package/@lion/switch) | Switch | ✔️ |
|
|
154
|
+
| **-- [Overlay System](https://lion-web.netlify.app/components/overlays-intro--page) --** | | If something needs to overlay content this is your place. | |
|
|
155
|
+
| [overlays](https://lion-web.netlify.app/fundamentals/systems/overlays/overview/) | [](https://www.npmjs.com/package/@lion/overlays) | Overlay System | ✔️ |
|
|
156
|
+
| [dialog](https://lion-web.netlify.app/components/dialog/overview/) | [](https://www.npmjs.com/package/@lion/dialog) | Dialog element | ✔️ |
|
|
157
|
+
| [tooltip](https://lion-web.netlify.app/components/tooltip/overview/) | [](https://www.npmjs.com/package/@lion/tooltip) | Tooltip element | [#175][i175] |
|
|
158
|
+
| **-- [Navigation System](https://lion-web.netlify.app/components/navigation-intro--page) --** | | Components which are used to guide users | |
|
|
159
|
+
| [accordion](https://lion-web.netlify.app/components/accordion/overview/) | [](https://www.npmjs.com/package/@lion/accordion) | Accordion | ✔️ |
|
|
160
|
+
| [pagination](https://lion-web.netlify.app/components/pagination/overview/) | [](https://www.npmjs.com/package/@lion/pagination) | Pagination | ✔️ |
|
|
161
|
+
| [steps](https://lion-web.netlify.app/components/steps/overview) | [](https://www.npmjs.com/package/@lion/steps) | Multi Step System | n/a |
|
|
162
|
+
| [tabs](https://lion-web.netlify.app/components/tabs/overview) | [](https://www.npmjs.com/package/@lion/tabs) | Move between a small number of equally important views | n/a |
|
|
163
|
+
| **-- [localize System](https://lion-web.netlify.app/fundamentals/systems/localize/overview/) --** | | Localize text, numbers, dates and a way to store/fetch these data. | |
|
|
164
|
+
| [localize](https://lion-web.netlify.app/fundamentals/systems/localize/overview/) | [](https://www.npmjs.com/package/@lion/localize) | Localize and translate your application/components | n/a |
|
|
165
|
+
| **-- [Icon System](https://lion-web.netlify.app/fundamentals/systems/icon/overview/) --** | | Loading and displaying icons | |
|
|
166
|
+
| [icon](https://lion-web.netlify.app/fundamentals/systems/icon/overview/) | [](https://www.npmjs.com/package/@lion/icon) | Display our svg icons | [#173][i173], [#172][i172] |
|
|
167
|
+
| **-- Others --** | | Features not fitting any other category | |
|
|
168
|
+
| [core](https://lion-web.netlify.app/fundamentals/systems/core/overview/) | [](https://www.npmjs.com/package/@lion/core) | Core System (exports LitElement, lit-html) | n/a |
|
|
169
|
+
| [ajax](https://lion-web.netlify.app/fundamentals/tools/ajax/overview/) | [](https://www.npmjs.com/package/@lion/ajax) | Fetching data via ajax request | n/a |
|
|
170
|
+
| [calendar](https://lion-web.netlify.app/components/calendar/overview/) | [](https://www.npmjs.com/package/@lion/calendar) | Standalone calendar | [#195][i195], [#194][i194] |
|
|
171
|
+
| [collapsible](https://lion-web.netlify.app/components/collapsible/overview/) | [](https://www.npmjs.com/package/@lion/collapsible) | Combination of a button and a chunk of extra content | ✔️ |
|
|
172
|
+
| **-- [Helpers](https://lion-web.netlify.app/fundamentals/tools/helpers/overview/) --** | [](https://www.npmjs.com/package/@lion/helpers) | Helpers to make your and your life easier | |
|
|
173
|
+
| [sb-action-logger](https://lion-web.netlify.app/fundamentals/tools/helpers/action-logger/) | | Storybook action logger |
|
|
174
|
+
|
|
175
|
+
## Technologies
|
|
176
|
+
|
|
177
|
+
Lion Web Components aims to be future-proof and use well-supported proven technology. The stack we have chosen should reflect this.
|
|
178
|
+
|
|
179
|
+
- [lit](https://lit.dev/)
|
|
180
|
+
- [npm](http://npmjs.com)
|
|
181
|
+
- [Open Web Components](https://open-wc.org)
|
|
182
|
+
- [Modern Web](https://modern-web.dev)
|
|
183
|
+
- [Mocha](https://mochajs.org)
|
|
184
|
+
- [Chai](https://www.chaijs.com)
|
|
185
|
+
- [ESLint](https://eslint.org)
|
|
186
|
+
- [prettier](https://prettier.io)
|
|
187
|
+
- [ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)
|
|
188
|
+
- Lots and lots of tests
|
|
189
|
+
|
|
190
|
+
## Rationale
|
|
191
|
+
|
|
192
|
+
We know from experience that making high quality, accessible UI components is hard and time consuming:
|
|
193
|
+
it takes many iterations, a lot of development time and a lot of testing to get a generic component that works in every
|
|
194
|
+
context, supports many edge cases and is accessible in all relevant screen readers.
|
|
195
|
+
|
|
196
|
+
Lion aims to do the heavy lifting for you.
|
|
197
|
+
This means you only have to apply your own Design System: by delivering styles, configuring components and adding a minimal set of custom logic on top.
|
|
198
|
+
|
|
199
|
+
## Coding guidelines
|
|
200
|
+
|
|
201
|
+
Check out our [coding guidelines](https://lion-web.netlify.app/guides/principles/definitions-and-terms/) for more detailed information.
|
|
202
|
+
|
|
203
|
+
## How to contribute
|
|
204
|
+
|
|
205
|
+
**Please note:** This project uses Npm [Workspaces](https://docs.npmjs.com/cli/v8/using-npm/workspaces). If you want to run all demos locally you need to get at least npm 7+ and install all dependencies by executing `npm install`.
|
|
206
|
+
|
|
207
|
+
Lion Web Components are only as good as its contributions.
|
|
208
|
+
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.
|
|
209
|
+
|
|
210
|
+
## Contact
|
|
211
|
+
|
|
212
|
+
Feel free to create a github issue for any feedback or questions you might have.
|
|
213
|
+
You can also find us on the Lit & Friends slack in the [#lion](https://lit-and-friends.slack.com/archives/CJGFWJN9J) channel.
|
|
214
|
+
|
|
215
|
+
You can join the Lit & Friends slack by visiting [https://lit.dev/slack-invite/](https://lit.dev/slack-invite/).
|
|
216
|
+
|
|
217
|
+
[i172]: https://github.com/ing-bank/lion/issues/172
|
|
218
|
+
[i173]: https://github.com/ing-bank/lion/issues/173
|
|
219
|
+
[i175]: https://github.com/ing-bank/lion/issues/175
|
|
220
|
+
[i194]: https://github.com/ing-bank/lion/issues/194
|
|
221
|
+
[i195]: https://github.com/ing-bank/lion/issues/195
|
|
222
|
+
[i243]: https://github.com/ing-bank/lion/issues/243
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { browserDetection } from '@lion/ui/core.js';
|
|
2
2
|
import { LionListbox } from '@lion/ui/listbox.js';
|
|
3
|
+
import { LocalizeMixin } from '@lion/ui/localize-no-side-effects.js';
|
|
3
4
|
import { OverlayMixin, withDropdownConfig } from '@lion/ui/overlays.js';
|
|
4
5
|
import { css, html } from 'lit';
|
|
5
6
|
import { makeMatchingTextBold, unmakeMatchingTextBold } from './utils/makeMatchingTextBold.js';
|
|
@@ -24,7 +25,7 @@ const matchA11ySpanReverseFns = new WeakMap();
|
|
|
24
25
|
* LionCombobox: implements the wai-aria combobox design pattern and integrates it as a Lion
|
|
25
26
|
* FormControl
|
|
26
27
|
*/
|
|
27
|
-
export class LionCombobox extends OverlayMixin(LionListbox) {
|
|
28
|
+
export class LionCombobox extends LocalizeMixin(OverlayMixin(LionListbox)) {
|
|
28
29
|
/** @type {any} */
|
|
29
30
|
static get properties() {
|
|
30
31
|
return {
|
|
@@ -75,6 +76,71 @@ export class LionCombobox extends OverlayMixin(LionListbox) {
|
|
|
75
76
|
];
|
|
76
77
|
}
|
|
77
78
|
|
|
79
|
+
static get localizeNamespaces() {
|
|
80
|
+
return [
|
|
81
|
+
{
|
|
82
|
+
'lion-combobox': /** @param {string} locale */ locale => {
|
|
83
|
+
switch (locale) {
|
|
84
|
+
case 'bg-BG':
|
|
85
|
+
case 'bg':
|
|
86
|
+
return import('@lion/ui/combobox-translations/bg.js');
|
|
87
|
+
case 'cs-CZ':
|
|
88
|
+
case 'cs':
|
|
89
|
+
return import('@lion/ui/combobox-translations/cs.js');
|
|
90
|
+
case 'de-AT':
|
|
91
|
+
case 'de-DE':
|
|
92
|
+
case 'de':
|
|
93
|
+
return import('@lion/ui/combobox-translations/de.js');
|
|
94
|
+
case 'en-AU':
|
|
95
|
+
case 'en-GB':
|
|
96
|
+
case 'en-PH':
|
|
97
|
+
case 'en-US':
|
|
98
|
+
case 'en':
|
|
99
|
+
return import('@lion/ui/combobox-translations/en.js');
|
|
100
|
+
case 'es-ES':
|
|
101
|
+
case 'es':
|
|
102
|
+
return import('@lion/ui/combobox-translations/es.js');
|
|
103
|
+
case 'fr-FR':
|
|
104
|
+
case 'fr-BE':
|
|
105
|
+
case 'fr':
|
|
106
|
+
return import('@lion/ui/combobox-translations/fr.js');
|
|
107
|
+
case 'hu-HU':
|
|
108
|
+
case 'hu':
|
|
109
|
+
return import('@lion/ui/combobox-translations/hu.js');
|
|
110
|
+
case 'it-IT':
|
|
111
|
+
case 'it':
|
|
112
|
+
return import('@lion/ui/combobox-translations/it.js');
|
|
113
|
+
case 'nl-BE':
|
|
114
|
+
case 'nl-NL':
|
|
115
|
+
case 'nl':
|
|
116
|
+
return import('@lion/ui/combobox-translations/nl.js');
|
|
117
|
+
case 'pl-PL':
|
|
118
|
+
case 'pl':
|
|
119
|
+
return import('@lion/ui/combobox-translations/pl.js');
|
|
120
|
+
case 'ro-RO':
|
|
121
|
+
case 'ro':
|
|
122
|
+
return import('@lion/ui/combobox-translations/ro.js');
|
|
123
|
+
case 'ru-RU':
|
|
124
|
+
case 'ru':
|
|
125
|
+
return import('@lion/ui/combobox-translations/ru.js');
|
|
126
|
+
case 'sk-SK':
|
|
127
|
+
case 'sk':
|
|
128
|
+
return import('@lion/ui/combobox-translations/sk.js');
|
|
129
|
+
case 'uk-UA':
|
|
130
|
+
case 'uk':
|
|
131
|
+
return import('@lion/ui/combobox-translations/uk.js');
|
|
132
|
+
case 'zh-CN':
|
|
133
|
+
case 'zh':
|
|
134
|
+
return import('@lion/ui/combobox-translations/zh.js');
|
|
135
|
+
default:
|
|
136
|
+
return import('@lion/ui/combobox-translations/en.js');
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
...super.localizeNamespaces,
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
|
|
78
144
|
/**
|
|
79
145
|
* @enhance FormControlMixin - add slot[name=selection-display]
|
|
80
146
|
* @protected
|
|
@@ -94,9 +160,12 @@ export class LionCombobox extends OverlayMixin(LionListbox) {
|
|
|
94
160
|
*/
|
|
95
161
|
// eslint-disable-next-line class-methods-use-this
|
|
96
162
|
_overlayListboxTemplate() {
|
|
97
|
-
// TODO: Localize the aria-label
|
|
98
163
|
return html`
|
|
99
|
-
<div
|
|
164
|
+
<div
|
|
165
|
+
id="overlay-content-node-wrapper"
|
|
166
|
+
role="dialog"
|
|
167
|
+
aria-label="${this.msgLit(`lion-combobox:optionsPopup`)}"
|
|
168
|
+
>
|
|
100
169
|
<slot name="listbox"></slot>
|
|
101
170
|
</div>
|
|
102
171
|
<slot id="options-outlet"></slot>
|
|
@@ -856,6 +925,7 @@ export class LionCombobox extends OverlayMixin(LionListbox) {
|
|
|
856
925
|
...withDropdownConfig(),
|
|
857
926
|
elementToFocusAfterHide: undefined,
|
|
858
927
|
invokerNode: this._comboboxNode,
|
|
928
|
+
visibilityTriggerFunction: undefined,
|
|
859
929
|
});
|
|
860
930
|
}
|
|
861
931
|
|
|
@@ -670,6 +670,25 @@ describe('lion-combobox', () => {
|
|
|
670
670
|
expect(el.checkedIndex).to.equal(-1);
|
|
671
671
|
});
|
|
672
672
|
|
|
673
|
+
it('has the correct Overlay Config defined', async () => {
|
|
674
|
+
const el = /** @type {LionCombobox} */ (
|
|
675
|
+
await fixture(html`
|
|
676
|
+
<lion-combobox name="foo" .showAllOnEmpty="${true}">
|
|
677
|
+
<lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
|
678
|
+
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
|
679
|
+
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
|
680
|
+
<lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
|
|
681
|
+
</lion-combobox>
|
|
682
|
+
`)
|
|
683
|
+
);
|
|
684
|
+
// @ts-ignore [allow-protected] in test
|
|
685
|
+
expect(el._defineOverlayConfig().elementToFocusAfterHide).to.equal(undefined);
|
|
686
|
+
// @ts-ignore [allow-protected] in test
|
|
687
|
+
expect(el._defineOverlayConfig().invokerNode).to.equal(el._inputNode);
|
|
688
|
+
// @ts-ignore [allow-protected] in test
|
|
689
|
+
expect(el._defineOverlayConfig().visibilityTriggerFunction).to.equal(undefined);
|
|
690
|
+
});
|
|
691
|
+
|
|
673
692
|
// NB: If this becomes a suite, move to separate file
|
|
674
693
|
describe('Subclassers', () => {
|
|
675
694
|
it('allows to control overlay visibility via "_showOverlayCondition"', async () => {
|
|
@@ -880,8 +899,26 @@ describe('lion-combobox', () => {
|
|
|
880
899
|
|
|
881
900
|
expect(el.checkedIndex).to.equal(-1);
|
|
882
901
|
await el.feedbackComplete;
|
|
883
|
-
expect(el.hasFeedbackFor).to.include('error');
|
|
884
|
-
|
|
902
|
+
expect(el.hasFeedbackFor).to.include('error', 'hasFeedbackFor');
|
|
903
|
+
await el.feedbackComplete;
|
|
904
|
+
expect(el.showsFeedbackFor).to.include('error', 'showsFeedbackFor');
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
it('dropdown has a label', async () => {
|
|
908
|
+
const el = /** @type {LionCombobox} */ (
|
|
909
|
+
await fixture(html`
|
|
910
|
+
<lion-combobox name="foo" .validators=${[new Required()]}>
|
|
911
|
+
<lion-option checked .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
|
912
|
+
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
|
913
|
+
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
|
914
|
+
<lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
|
|
915
|
+
</lion-combobox>
|
|
916
|
+
`)
|
|
917
|
+
);
|
|
918
|
+
const { _overlayCtrl } = getComboboxMembers(el);
|
|
919
|
+
expect(_overlayCtrl.contentWrapperNode.getAttribute('aria-label')).to.equal(
|
|
920
|
+
'Combobox options popup',
|
|
921
|
+
);
|
|
885
922
|
});
|
|
886
923
|
});
|
|
887
924
|
});
|
|
@@ -1342,6 +1379,7 @@ describe('lion-combobox', () => {
|
|
|
1342
1379
|
`)
|
|
1343
1380
|
);
|
|
1344
1381
|
const { _inputNode } = getComboboxMembers(el);
|
|
1382
|
+
await el.updateComplete;
|
|
1345
1383
|
expect(_inputNode.value).to.equal('');
|
|
1346
1384
|
|
|
1347
1385
|
/**
|
|
@@ -1356,9 +1394,10 @@ describe('lion-combobox', () => {
|
|
|
1356
1394
|
await el.updateComplete;
|
|
1357
1395
|
el.autocomplete = autocomplete;
|
|
1358
1396
|
el.setCheckedIndex(index);
|
|
1397
|
+
await el.updateComplete;
|
|
1359
1398
|
el.opened = false;
|
|
1360
1399
|
await el.updateComplete;
|
|
1361
|
-
expect(_inputNode.value).to.equal(valueOnClose);
|
|
1400
|
+
expect(_inputNode.value).to.equal(valueOnClose, autocomplete);
|
|
1362
1401
|
}
|
|
1363
1402
|
|
|
1364
1403
|
await performChecks('none', 0, 'Artichoke');
|
|
@@ -2030,6 +2069,8 @@ describe('lion-combobox', () => {
|
|
|
2030
2069
|
const { _inputNode } = getComboboxMembers(el);
|
|
2031
2070
|
|
|
2032
2071
|
async function performChecks() {
|
|
2072
|
+
await el.updateComplete;
|
|
2073
|
+
|
|
2033
2074
|
el.formElements[0].click();
|
|
2034
2075
|
await el.updateComplete;
|
|
2035
2076
|
|