@lion/ui 0.7.6 → 0.7.7
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 +1 -2
- package/components/button/test-suites/LionButton.suite.js +3 -1
- package/components/combobox/src/LionCombobox.js +33 -9
- package/components/combobox/test/lion-combobox.test.js +134 -7
- package/components/dialog/test/lion-dialog.test.js +59 -1
- package/components/input-datepicker/test/lion-input-datepicker.test.js +3 -3
- package/components/input-file/src/FileHandle.js +1 -1
- package/components/input-file/src/LionInputFile.js +1 -3
- package/components/input-file/test/lion-input-file.test.js +11 -14
- package/components/overlays/src/OverlayController.js +13 -7
- package/components/overlays/src/OverlayMixin.js +5 -1
- package/components/overlays/test/OverlayController.test.js +46 -0
- package/components/select-rich/src/LionSelectRich.js +12 -0
- package/components/select-rich/test/lion-select-rich.test.js +26 -0
- package/custom-elements.json +60 -55
- package/dist-types/components/button/test-suites/LionButton.suite.d.ts.map +1 -1
- package/dist-types/components/combobox/src/LionCombobox.d.ts +9 -0
- package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
- package/dist-types/components/input-file/src/LionInputFile.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayMixin.d.ts.map +1 -1
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/button/use-cases.md +2 -2
- package/docs/components/calendar/use-cases.md +4 -4
- package/docs/components/checkbox-group/api-table.md +49 -55
- package/docs/components/checkbox-group/overview.md +5 -5
- package/docs/components/checkbox-group/use-cases.md +33 -33
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/collapsible/use-cases.md +3 -3
- package/docs/components/combobox/api-table.md +84 -89
- package/docs/components/combobox/extensions.md +20 -20
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +6 -6
- package/docs/components/dialog/api-table.md +3 -3
- package/docs/components/dialog/overview.md +2 -2
- package/docs/components/dialog/src/external-dialog.js +32 -0
- package/docs/components/dialog/src/slots-dialog-content.js +1 -1
- package/docs/components/dialog/src/styled-dialog-content.js +1 -1
- package/docs/components/dialog/use-cases.md +49 -3
- package/docs/components/drawer/use-cases.md +3 -3
- package/docs/components/fieldset/api-table.md +45 -51
- package/docs/components/fieldset/overview.md +7 -7
- package/docs/components/fieldset/use-cases.md +15 -15
- package/docs/components/form/overview.md +7 -7
- package/docs/components/form/use-cases.md +4 -4
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input/use-cases.md +3 -3
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-amount/use-cases.md +8 -8
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-date/use-cases.md +8 -8
- package/docs/components/input-datepicker/api-table.md +1 -1
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-datepicker/use-cases.md +5 -5
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-email/use-cases.md +3 -3
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-iban/use-cases.md +8 -8
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/api-table.md +65 -69
- 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 +9 -9
- package/docs/components/input-tel-dropdown/api-table.md +70 -73
- package/docs/components/input-tel-dropdown/extensions.md +1 -1
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/input-tel-dropdown/use-cases.md +5 -5
- package/docs/components/listbox/api-table.md +64 -70
- package/docs/components/listbox/overview.md +5 -5
- package/docs/components/listbox/use-cases.md +61 -61
- package/docs/components/pagination/use-cases.md +5 -5
- package/docs/components/radio-group/api-table.md +49 -55
- package/docs/components/radio-group/overview.md +6 -6
- package/docs/components/radio-group/use-cases.md +18 -18
- package/docs/components/select/use-cases.md +2 -2
- package/docs/components/select-rich/api-table.md +79 -85
- package/docs/components/select-rich/overview.md +3 -3
- package/docs/components/select-rich/use-cases.md +33 -33
- package/docs/components/steps/overview.md +4 -4
- package/docs/components/steps/use-cases.md +7 -7
- package/docs/components/tabs/examples.md +1 -1
- package/docs/components/tabs/use-cases.md +1 -1
- package/docs/components/textarea/use-cases.md +3 -3
- package/docs/components/tooltip/api-table.md +3 -3
- package/docs/components/tooltip/use-cases.md +6 -6
- 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/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 +8 -8
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/use-cases.md +19 -19
- package/docs/fundamentals/systems/form/validate.md +50 -50
- package/docs/fundamentals/systems/localize/api-table.md +10 -17
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/localize/use-cases.md +4 -4
- package/docs/fundamentals/systems/overlays/_configuration-positioning.md +4 -4
- package/docs/fundamentals/systems/overlays/api-table.md +34 -90
- package/docs/fundamentals/systems/overlays/assets/umbrella-form.js +9 -9
- package/docs/fundamentals/systems/overlays/configuration.md +30 -30
- package/docs/fundamentals/systems/overlays/overview.md +6 -6
- package/docs/fundamentals/systems/overlays/use-cases.md +30 -30
- package/docs/fundamentals/tools/ajax/use-cases.md +20 -20
- package/docs/fundamentals/tools/helpers/action-logger.md +3 -3
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/example-complex/demo-app.js +2 -2
- package/docs/fundamentals/tools/singleton-manager/example-fail/demo-app.js +2 -2
- package/docs/fundamentals/tools/singleton-manager/example-success/demo-app.js +2 -2
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +7 -7
- 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/scoped-elements.md +1 -1
- package/docs/guides/principles/styling.md +1 -1
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ Validation happens on every change of `modelValue`. A change in modelValue can b
|
|
|
57
57
|
|
|
58
58
|
## When validation feedback will be shown
|
|
59
59
|
|
|
60
|
-
Although validation happens realtime under the hood, displaying validity feedback in realtime may not always lead to the desired User Experience. Together with [interaction states](https://github.com/ing-bank/lion/blob/
|
|
60
|
+
Although validation happens realtime under the hood, displaying validity feedback in realtime may not always lead to the desired User Experience. Together with [interaction states](https://github.com/ing-bank/lion/blob/a59d362cc1228fc855b426440f4bed3bd21d594b/docs/fundamentals/systems/form/interaction-states.md),
|
|
61
61
|
validity states can determine whether a validation message should be shown along the input field.
|
|
62
62
|
|
|
63
63
|
## Assessing field validation state programmatically
|
|
@@ -211,11 +211,11 @@ export const defaultValidationMessages = () => {
|
|
|
211
211
|
.validators="${[new Required(), new MinLength(4)]}"
|
|
212
212
|
.modelValue="${'foo'}"
|
|
213
213
|
></lion-input>
|
|
214
|
-
<button @click
|
|
215
|
-
<button @click
|
|
216
|
-
<button @click
|
|
217
|
-
<button @click
|
|
218
|
-
<button @click
|
|
214
|
+
<button @click="${() => (localize.locale = 'de-DE')}">DE</button>
|
|
215
|
+
<button @click="${() => (localize.locale = 'en-GB')}">EN</button>
|
|
216
|
+
<button @click="${() => (localize.locale = 'fr-FR')}">FR</button>
|
|
217
|
+
<button @click="${() => (localize.locale = 'nl-NL')}">NL</button>
|
|
218
|
+
<button @click="${() => (localize.locale = 'zh-CN')}">CN</button>
|
|
219
219
|
`;
|
|
220
220
|
};
|
|
221
221
|
```
|
|
@@ -228,11 +228,11 @@ The required validator can be put onto every form field element and will make su
|
|
|
228
228
|
|
|
229
229
|
```js preview-story
|
|
230
230
|
export const requiredValidator = () => html`
|
|
231
|
-
<lion-input .validators
|
|
231
|
+
<lion-input .validators="${[new Required()]}" label="Required" .fieldName="value"></lion-input>
|
|
232
232
|
`;
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
The default `Required` validation message is "Please, enter a(n) {fieldName}". In which the "fieldName" can be provided separately via the `fieldName` attribute, with a fallback to the label. See [override fieldname](https://github.com/ing-bank/lion/blob/
|
|
235
|
+
The default `Required` validation message is "Please, enter a(n) {fieldName}". In which the "fieldName" can be provided separately via the `fieldName` attribute, with a fallback to the label. See [override fieldname](https://github.com/ing-bank/lion/blob/a59d362cc1228fc855b426440f4bed3bd21d594b/docs/fundamentals/systems/form/#override-fieldname) for more information.
|
|
236
236
|
|
|
237
237
|
Specific required messages for a select and file-upload are created.
|
|
238
238
|
|
|
@@ -243,28 +243,28 @@ Useful on input elements it allows to define how many characters can be entered.
|
|
|
243
243
|
```js preview-story
|
|
244
244
|
export const stringValidators = () => html`
|
|
245
245
|
<lion-input
|
|
246
|
-
.validators
|
|
247
|
-
.modelValue
|
|
246
|
+
.validators="${[new EqualsLength(7)]}"
|
|
247
|
+
.modelValue="${'not exactly'}"
|
|
248
248
|
label="EqualsLength"
|
|
249
249
|
></lion-input>
|
|
250
250
|
<lion-input
|
|
251
|
-
.validators
|
|
252
|
-
.modelValue
|
|
251
|
+
.validators="${[new MinLength(10)]}"
|
|
252
|
+
.modelValue="${'too short'}"
|
|
253
253
|
label="MinLength"
|
|
254
254
|
></lion-input>
|
|
255
255
|
<lion-input
|
|
256
|
-
.validators
|
|
257
|
-
.modelValue
|
|
256
|
+
.validators="${[new MaxLength(7)]}"
|
|
257
|
+
.modelValue="${'too long'}"
|
|
258
258
|
label="MaxLength"
|
|
259
259
|
></lion-input>
|
|
260
260
|
<lion-input
|
|
261
|
-
.validators
|
|
262
|
-
.modelValue
|
|
261
|
+
.validators="${[new MinMaxLength({ min: 10, max: 20 })]}"
|
|
262
|
+
.modelValue="${'that should be enough'}"
|
|
263
263
|
label="MinMaxLength"
|
|
264
264
|
></lion-input>
|
|
265
265
|
<lion-input
|
|
266
|
-
.validators
|
|
267
|
-
.modelValue
|
|
266
|
+
.validators="${[new Pattern(/#LionRocks/)]}"
|
|
267
|
+
.modelValue="${'regex checks if "#Lion<NO SPACE>Rocks" is in this input #LionRocks'}"
|
|
268
268
|
label="Pattern"
|
|
269
269
|
></lion-input>
|
|
270
270
|
`;
|
|
@@ -314,23 +314,23 @@ export const dateValidators = () => {
|
|
|
314
314
|
const tomorrow = new Date(year, month, day + 1);
|
|
315
315
|
return html`
|
|
316
316
|
<lion-input-date
|
|
317
|
-
.validators
|
|
318
|
-
.modelValue
|
|
317
|
+
.validators="${[new IsDate()]}"
|
|
318
|
+
.modelValue="${'foo'}"
|
|
319
319
|
label="IsDate"
|
|
320
320
|
></lion-input-date>
|
|
321
321
|
<lion-input-date
|
|
322
|
-
.validators
|
|
323
|
-
.modelValue
|
|
322
|
+
.validators="${[new MinDate(today)]}"
|
|
323
|
+
.modelValue="${new Date(yesterday)}"
|
|
324
324
|
label="MinDate"
|
|
325
325
|
></lion-input-date>
|
|
326
326
|
<lion-input-date
|
|
327
|
-
.validators
|
|
328
|
-
.modelValue
|
|
327
|
+
.validators="${[new MaxDate(today)]}"
|
|
328
|
+
.modelValue="${new Date(tomorrow)}"
|
|
329
329
|
label="MaxDate"
|
|
330
330
|
></lion-input-date>
|
|
331
331
|
<lion-input-date
|
|
332
|
-
.validators
|
|
333
|
-
.modelValue
|
|
332
|
+
.validators="${[new MinMaxDate({ min: new Date(yesterday), max: new Date(tomorrow) })]}"
|
|
333
|
+
.modelValue="${new Date(today)}"
|
|
334
334
|
label="MinMaxDate"
|
|
335
335
|
></lion-input-date>
|
|
336
336
|
`;
|
|
@@ -476,11 +476,11 @@ export const checkboxValidation = () => {
|
|
|
476
476
|
id="scientists"
|
|
477
477
|
name="scientists[]"
|
|
478
478
|
label="Favorite scientists"
|
|
479
|
-
.validators
|
|
479
|
+
.validators="${[new Required()]}"
|
|
480
480
|
>
|
|
481
|
-
<lion-checkbox label="Archimedes" .choiceValue
|
|
482
|
-
<lion-checkbox label="Francis Bacon" .choiceValue
|
|
483
|
-
<lion-checkbox label="Marie Curie" .choiceValue
|
|
481
|
+
<lion-checkbox label="Archimedes" .choiceValue="${'Archimedes'}"></lion-checkbox>
|
|
482
|
+
<lion-checkbox label="Francis Bacon" .choiceValue="${'Francis Bacon'}"></lion-checkbox>
|
|
483
|
+
<lion-checkbox label="Marie Curie" .choiceValue="${'Marie Curie'}"></lion-checkbox>
|
|
484
484
|
</lion-checkbox-group>
|
|
485
485
|
<button @click="${e => validate(e)}">Validate</button>
|
|
486
486
|
`;
|
|
@@ -512,11 +512,11 @@ export const checkboxValidationAdvanced = () => {
|
|
|
512
512
|
name="scientists2[]"
|
|
513
513
|
label="Favorite scientists"
|
|
514
514
|
help-text="You should have at least 2 of those"
|
|
515
|
-
.validators
|
|
515
|
+
.validators="${[new Required(), new HasMinTwoChecked()]}"
|
|
516
516
|
>
|
|
517
|
-
<lion-checkbox label="Archimedes" .choiceValue
|
|
518
|
-
<lion-checkbox label="Francis Bacon" .choiceValue
|
|
519
|
-
<lion-checkbox label="Marie Curie" .choiceValue
|
|
517
|
+
<lion-checkbox label="Archimedes" .choiceValue="${'Archimedes'}"></lion-checkbox>
|
|
518
|
+
<lion-checkbox label="Francis Bacon" .choiceValue="${'Francis Bacon'}"></lion-checkbox>
|
|
519
|
+
<lion-checkbox label="Marie Curie" .choiceValue="${'Marie Curie'}"></lion-checkbox>
|
|
520
520
|
</lion-checkbox-group>
|
|
521
521
|
<button @click="${e => validate(e)}">Validate</button>
|
|
522
522
|
`;
|
|
@@ -536,10 +536,10 @@ export const radioValidation = () => {
|
|
|
536
536
|
id="dinos1"
|
|
537
537
|
name="dinos1"
|
|
538
538
|
label="Favourite dinosaur"
|
|
539
|
-
.validators
|
|
539
|
+
.validators="${[new Required()]}"
|
|
540
540
|
>
|
|
541
|
-
<lion-radio label="allosaurus" .choiceValue
|
|
542
|
-
<lion-radio label="brontosaurus" .choiceValue
|
|
541
|
+
<lion-radio label="allosaurus" .choiceValue="${'allosaurus'}"></lion-radio>
|
|
542
|
+
<lion-radio label="brontosaurus" .choiceValue="${'brontosaurus'}"></lion-radio>
|
|
543
543
|
<lion-radio label="diplodocus" .choiceValue="${'diplodocus'}"></lion-radio>
|
|
544
544
|
</lion-radio-group>
|
|
545
545
|
<button @click="${e => validate(e)}">Validate</button>
|
|
@@ -575,11 +575,11 @@ export const radioValidationAdvanced = () => {
|
|
|
575
575
|
id="dinos2"
|
|
576
576
|
name="dinos2"
|
|
577
577
|
label="Favourite dinosaur"
|
|
578
|
-
.validators
|
|
578
|
+
.validators="${[new Required(), new IsBrontosaurus()]}"
|
|
579
579
|
>
|
|
580
|
-
<lion-radio label="allosaurus" .choiceValue
|
|
581
|
-
<lion-radio label="brontosaurus" .choiceValue
|
|
582
|
-
<lion-radio label="diplodocus" .choiceValue
|
|
580
|
+
<lion-radio label="allosaurus" .choiceValue="${'allosaurus'}"></lion-radio>
|
|
581
|
+
<lion-radio label="brontosaurus" .choiceValue="${'brontosaurus'}"></lion-radio>
|
|
582
|
+
<lion-radio label="diplodocus" .choiceValue="${'diplodocus'}"></lion-radio>
|
|
583
583
|
</lion-radio-group>
|
|
584
584
|
<button @click="${e => validate(e)}">Validate</button>
|
|
585
585
|
`;
|
|
@@ -593,12 +593,12 @@ Validation can be used as normal, below is an example of a combobox with a `Requ
|
|
|
593
593
|
```js preview-story
|
|
594
594
|
export const validationCombobox = () => html`
|
|
595
595
|
<lion-combobox .validators="${[new Required()]}" name="favoriteMovie" label="Favorite movie">
|
|
596
|
-
<lion-option checked .choiceValue
|
|
597
|
-
<lion-option .choiceValue
|
|
598
|
-
<lion-option .choiceValue
|
|
599
|
-
<lion-option .choiceValue
|
|
600
|
-
<lion-option .choiceValue
|
|
601
|
-
<lion-option .choiceValue
|
|
596
|
+
<lion-option checked .choiceValue="${'Rocky'}">Rocky</lion-option>
|
|
597
|
+
<lion-option .choiceValue="${'Rocky II'}">Rocky II</lion-option>
|
|
598
|
+
<lion-option .choiceValue="${'Rocky III'}">Rocky III</lion-option>
|
|
599
|
+
<lion-option .choiceValue="${'Rocky IV'}">Rocky IV</lion-option>
|
|
600
|
+
<lion-option .choiceValue="${'Rocky V'}">Rocky V</lion-option>
|
|
601
|
+
<lion-option .choiceValue="${'Rocky Balboa'}">Rocky Balboa</lion-option>
|
|
602
602
|
</lion-combobox>
|
|
603
603
|
`;
|
|
604
604
|
```
|
|
@@ -762,8 +762,8 @@ According to the W3C specs, Disabled fields should not be validated. Therefore i
|
|
|
762
762
|
export const disabledInputsValidation = () => html`
|
|
763
763
|
<lion-input
|
|
764
764
|
disabled
|
|
765
|
-
.validators
|
|
766
|
-
.modelValue
|
|
765
|
+
.validators="${[new EqualsLength(7)]}"
|
|
766
|
+
.modelValue="${'not exactly'}"
|
|
767
767
|
label="EqualsLength"
|
|
768
768
|
></lion-input>
|
|
769
769
|
`;
|
|
@@ -840,7 +840,7 @@ export const backendValidation = () => {
|
|
|
840
840
|
opacity: 0.5;
|
|
841
841
|
}
|
|
842
842
|
</style>
|
|
843
|
-
<lion-form @submit
|
|
843
|
+
<lion-form @submit="${submitHandler}">
|
|
844
844
|
<form>
|
|
845
845
|
<lion-input
|
|
846
846
|
label="username"
|
|
@@ -4,23 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
### Fields
|
|
6
6
|
|
|
7
|
-
| Name | Privacy | Type | Default
|
|
8
|
-
| ---------------------------------- | --------- | --------- |
|
|
9
|
-
| `locale` | public | |
|
|
10
|
-
| `loadingComplete` | public | |
|
|
11
|
-
| `_autoLoadOnLocaleChange` | protected | `boolean` | `!!autoLoadOnLocaleChange`
|
|
12
|
-
| `_fallbackLocale` | protected | | `fallbackLocale`
|
|
13
|
-
| `_showKeyAsFallback` | protected | | `showKeyAsFallback`
|
|
14
|
-
| `formatNumberOptions` | public | `object` | `{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
postProcessors: new Map(),
|
|
18
|
-
}` | | |
|
|
19
|
-
| `formatDateOptions` | public | `object` | `{
|
|
20
|
-
/** @type {Map<string,DatePostProcessor>} */
|
|
21
|
-
postProcessors: new Map(),
|
|
22
|
-
}` | | |
|
|
23
|
-
| `_supportExternalTranslationTools` | protected | | | | |
|
|
7
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
8
|
+
| ---------------------------------- | --------- | --------- | ---------------------------------------------------------------------------------------------- | ----------- | -------------- |
|
|
9
|
+
| `locale` | public | | | | |
|
|
10
|
+
| `loadingComplete` | public | | | | |
|
|
11
|
+
| `_autoLoadOnLocaleChange` | protected | `boolean` | `!!autoLoadOnLocaleChange` | | |
|
|
12
|
+
| `_fallbackLocale` | protected | | `fallbackLocale` | | |
|
|
13
|
+
| `_showKeyAsFallback` | protected | | `showKeyAsFallback` | | |
|
|
14
|
+
| `formatNumberOptions` | public | `object` | `{ returnIfNaN: '', /** @type {Map<string,DatePostProcessor>} */ postProcessors: new Map(), }` | | |
|
|
15
|
+
| `formatDateOptions` | public | `object` | `{ /** @type {Map<string,DatePostProcessor>} */ postProcessors: new Map(), }` | | |
|
|
16
|
+
| `_supportExternalTranslationTools` | protected | | | | |
|
|
24
17
|
|
|
25
18
|
### Methods
|
|
26
19
|
|
|
@@ -9,15 +9,15 @@ In it's simplest form it is a function that returns the translated text for a na
|
|
|
9
9
|
- Formatting of numbers, amounts
|
|
10
10
|
- Formatting of dates
|
|
11
11
|
|
|
12
|
-
Further examples and a more in depth description can be found at the [Use Cases Page](https://github.com/ing-bank/lion/blob/
|
|
12
|
+
Further examples and a more in depth description can be found at the [Use Cases Page](https://github.com/ing-bank/lion/blob/a59d362cc1228fc855b426440f4bed3bd21d594b/docs/fundamentals/systems/localize/use-cases.md).
|
|
13
13
|
|
|
14
14
|
## Content
|
|
15
15
|
|
|
16
16
|
| Feature | Description |
|
|
17
17
|
| ---------------------------------------- | --------------------------------------------- |
|
|
18
|
-
| [Translate Text](https://github.com/ing-bank/lion/blob/
|
|
19
|
-
| [Format Numbers](https://github.com/ing-bank/lion/blob/
|
|
20
|
-
| [Format Dates](https://github.com/ing-bank/lion/blob/
|
|
18
|
+
| [Translate Text](https://github.com/ing-bank/lion/blob/a59d362cc1228fc855b426440f4bed3bd21d594b/docs/fundamentals/systems/localize/text.md) | Load and translate text in multiple languages |
|
|
19
|
+
| [Format Numbers](https://github.com/ing-bank/lion/blob/a59d362cc1228fc855b426440f4bed3bd21d594b/docs/fundamentals/systems/localize/numbers.md) | Format numbers in multiple languages |
|
|
20
|
+
| [Format Dates](https://github.com/ing-bank/lion/blob/a59d362cc1228fc855b426440f4bed3bd21d594b/docs/fundamentals/systems/localize/dates.md) | Format dates in multiple languages |
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
@@ -118,7 +118,7 @@ If you want to fetch it from some API this is also possible.
|
|
|
118
118
|
localize.loadNamespace({
|
|
119
119
|
'my-hello-component': async locale => {
|
|
120
120
|
const response = await fetch(
|
|
121
|
-
`https://api.example.com/?namespace=my-hello-component&locale
|
|
121
|
+
`https://api.example.com/?namespace=my-hello-component&locale="${locale}"`,
|
|
122
122
|
);
|
|
123
123
|
return response.json(); // resolves to the JSON object `{ greeting: 'Hallo {name}!' }`
|
|
124
124
|
},
|
|
@@ -133,7 +133,7 @@ And this is there the second option comes in handy.
|
|
|
133
133
|
```js
|
|
134
134
|
// using the regexp to match all component names staring with 'my-'
|
|
135
135
|
localize.setupNamespaceLoader(/my-.+/, async (locale, namespace) => {
|
|
136
|
-
const response = await fetch(`https://api.example.com/?namespace
|
|
136
|
+
const response = await fetch(`https://api.example.com/?namespace="${namespace}&locale=${locale}"`);
|
|
137
137
|
return response.json();
|
|
138
138
|
});
|
|
139
139
|
|
|
@@ -302,14 +302,14 @@ This is sort of a router for the data and is typically needed to fetch it from a
|
|
|
302
302
|
// for one specific component
|
|
303
303
|
localize.setupNamespaceLoader('my-hello-component', async locale => {
|
|
304
304
|
const response = await fetch(
|
|
305
|
-
`https://api.example.com/?namespace=my-hello-component&locale
|
|
305
|
+
`https://api.example.com/?namespace=my-hello-component&locale="${locale}"`,
|
|
306
306
|
);
|
|
307
307
|
return response.json();
|
|
308
308
|
});
|
|
309
309
|
|
|
310
310
|
// for all components which have a prefix in their names
|
|
311
311
|
localize.setupNamespaceLoader(/my-.+/, async (locale, namespace) => {
|
|
312
|
-
const response = await fetch(`https://api.example.com/?namespace
|
|
312
|
+
const response = await fetch(`https://api.example.com/?namespace="${namespace}&locale=${locale}"`);
|
|
313
313
|
return response.json();
|
|
314
314
|
});
|
|
315
315
|
```
|
|
@@ -59,13 +59,13 @@ The `placementMode` property determines the positioning of the `contentNode`:
|
|
|
59
59
|
export const placementLocal = () => {
|
|
60
60
|
const placementModeLocalConfig = { placementMode: 'local' };
|
|
61
61
|
return html`
|
|
62
|
-
<demo-el-using-overlaymixin .config
|
|
62
|
+
<demo-el-using-overlaymixin .config="${placementModeLocalConfig}">
|
|
63
63
|
<button slot="invoker">Click me to open the local overlay!</button>
|
|
64
64
|
<div slot="content" class="demo-overlay">
|
|
65
65
|
Hello! You can close this notification here:
|
|
66
66
|
<button
|
|
67
67
|
class="close-button"
|
|
68
|
-
@click
|
|
68
|
+
@click="${e => e.target.dispatchEvent(new Event('close-overlay', { bubbles: true }))}"
|
|
69
69
|
>
|
|
70
70
|
⨯
|
|
71
71
|
</button>
|
|
@@ -81,13 +81,13 @@ export const placementLocal = () => {
|
|
|
81
81
|
export const placementGlobal = () => {
|
|
82
82
|
const placementModeGlobalConfig = { placementMode: 'global' };
|
|
83
83
|
return html`
|
|
84
|
-
<demo-el-using-overlaymixin .config
|
|
84
|
+
<demo-el-using-overlaymixin .config="${placementModeGlobalConfig}">
|
|
85
85
|
<button slot="invoker">Click me to open the global overlay!</button>
|
|
86
86
|
<div slot="content" class="demo-overlay">
|
|
87
87
|
Hello! You can close this notification here:
|
|
88
88
|
<button
|
|
89
89
|
class="close-button"
|
|
90
|
-
@click
|
|
90
|
+
@click="${e => e.target.dispatchEvent(new Event('close-overlay', { bubbles: true }))}"
|
|
91
91
|
>
|
|
92
92
|
⨯
|
|
93
93
|
</button>
|