@lion/ui 0.0.12 → 0.0.14
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/components/accordion/src/LionAccordion.js +22 -9
- package/components/accordion/test/lion-accordion.test.js +29 -32
- package/components/icon/src/LionIcon.js +11 -4
- package/components/input-tel/translations/bg.js +3 -1
- package/components/input-tel/translations/cs.js +3 -1
- package/components/input-tel/translations/de.js +3 -1
- package/components/input-tel/translations/en.js +3 -1
- package/components/input-tel/translations/es.js +3 -1
- package/components/input-tel/translations/fr.js +3 -1
- package/components/input-tel/translations/hu.js +3 -1
- package/components/input-tel/translations/it.js +3 -1
- package/components/input-tel/translations/nl.js +3 -1
- package/components/input-tel/translations/pl.js +3 -1
- package/components/input-tel/translations/ro.js +3 -1
- package/components/input-tel/translations/ru.js +3 -1
- package/components/input-tel/translations/sk.js +3 -1
- package/components/input-tel/translations/uk.js +3 -1
- package/components/input-tel/translations/zh.js +3 -1
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +5 -5
- package/components/listbox/src/ListboxMixin.js +0 -4
- package/components/listbox/types/ListboxMixinTypes.ts +1 -4
- package/components/localize/src/LocalizeMixin.js +4 -3
- package/components/overlays/src/OverlayController.js +14 -25
- package/components/overlays/src/utils/adopt-styles.js +136 -0
- package/components/overlays/test/OverlayController.test.js +8 -55
- package/components/overlays/test/local-positioning.test.js +1 -1
- package/components/overlays/test/utils-tests/adopt-styles.test.js +177 -0
- package/components/overlays/test-helpers/createShadowHost.js +16 -0
- package/components/overlays/{test/utils-tests/local-positioning-helpers.js → test-helpers/normalizeTransformStyle.js} +0 -0
- package/components/select-rich/src/LionSelectRich.js +12 -6
- package/components/select-rich/test/lion-select-rich.test.js +25 -1
- package/custom-elements.json +418 -113
- package/dist-types/components/accordion/src/LionAccordion.d.ts.map +1 -1
- package/dist-types/components/icon/src/LionIcon.d.ts.map +1 -1
- package/dist-types/components/input-tel/translations/bg-BG.d.ts +3 -1
- package/dist-types/components/input-tel/translations/bg.d.ts +3 -1
- package/dist-types/components/input-tel/translations/cs-CZ.d.ts +3 -1
- package/dist-types/components/input-tel/translations/cs.d.ts +3 -1
- package/dist-types/components/input-tel/translations/de-DE.d.ts +3 -1
- package/dist-types/components/input-tel/translations/de.d.ts +3 -1
- package/dist-types/components/input-tel/translations/en-AU.d.ts +3 -1
- package/dist-types/components/input-tel/translations/en-GB.d.ts +3 -1
- package/dist-types/components/input-tel/translations/en-US.d.ts +3 -1
- package/dist-types/components/input-tel/translations/en.d.ts +3 -1
- package/dist-types/components/input-tel/translations/es-ES.d.ts +3 -1
- package/dist-types/components/input-tel/translations/es.d.ts +3 -1
- package/dist-types/components/input-tel/translations/fr-BE.d.ts +3 -1
- package/dist-types/components/input-tel/translations/fr-FR.d.ts +3 -1
- package/dist-types/components/input-tel/translations/fr.d.ts +3 -1
- package/dist-types/components/input-tel/translations/hu-HU.d.ts +3 -1
- package/dist-types/components/input-tel/translations/hu.d.ts +3 -1
- package/dist-types/components/input-tel/translations/it-IT.d.ts +3 -1
- package/dist-types/components/input-tel/translations/it.d.ts +3 -1
- package/dist-types/components/input-tel/translations/nl-BE.d.ts +3 -1
- package/dist-types/components/input-tel/translations/nl-NL.d.ts +3 -1
- package/dist-types/components/input-tel/translations/nl.d.ts +3 -1
- package/dist-types/components/input-tel/translations/pl-PL.d.ts +3 -1
- package/dist-types/components/input-tel/translations/pl.d.ts +3 -1
- package/dist-types/components/input-tel/translations/ro-RO.d.ts +3 -1
- package/dist-types/components/input-tel/translations/ro.d.ts +3 -1
- package/dist-types/components/input-tel/translations/ru-RU.d.ts +3 -1
- package/dist-types/components/input-tel/translations/ru.d.ts +3 -1
- package/dist-types/components/input-tel/translations/sk-SK.d.ts +3 -1
- package/dist-types/components/input-tel/translations/sk.d.ts +3 -1
- package/dist-types/components/input-tel/translations/uk-UA.d.ts +3 -1
- package/dist-types/components/input-tel/translations/uk.d.ts +3 -1
- package/dist-types/components/input-tel/translations/zh.d.ts +3 -1
- package/dist-types/components/listbox/src/ListboxMixin.d.ts.map +1 -1
- package/dist-types/components/listbox/types/ListboxMixinTypes.d.ts +1 -2
- package/dist-types/components/listbox/types/ListboxMixinTypes.d.ts.map +1 -1
- package/dist-types/components/localize/src/LocalizeMixin.d.ts +1 -0
- package/dist-types/components/localize/src/LocalizeMixin.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts +5 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
- package/dist-types/components/overlays/src/utils/adopt-styles.d.ts +24 -0
- package/dist-types/components/overlays/src/utils/adopt-styles.d.ts.map +1 -0
- package/dist-types/components/overlays/test/OverlayController.test.d.ts.map +1 -1
- package/dist-types/components/overlays/test/utils-tests/adopt-styles.test.d.ts +2 -0
- package/dist-types/components/overlays/test/utils-tests/adopt-styles.test.d.ts.map +1 -0
- package/dist-types/components/overlays/test-helpers/createShadowHost.d.ts +8 -0
- package/dist-types/components/overlays/test-helpers/createShadowHost.d.ts.map +1 -0
- package/dist-types/components/overlays/{test/utils-tests/local-positioning-helpers.d.ts → test-helpers/normalizeTransformStyle.d.ts} +1 -1
- package/dist-types/components/overlays/test-helpers/normalizeTransformStyle.d.ts.map +1 -0
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts +8 -8
- 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 -0
- 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/src/demo-selection-display.js +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/dialog/src/demoStyle.js +18 -0
- 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 +30 -24
- 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/assets/demo-el-using-overlaymixin.mjs +0 -16
- package/docs/fundamentals/systems/overlays/configuration.md +13 -25
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +5 -5
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/.gitignore +1 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/demo-app.js +93 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/instance.js +4 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/page-a.js +35 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/node_modules/overlays/instance.js +4 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-b/page-b.js +49 -0
- package/docs/fundamentals/tools/singleton-manager/example-complex/overlayCompatibility.js +70 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/demo-app.js +91 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/overlays/instance.js +3 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-a/page-a.js +34 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/node_modules/overlays/instance.js +3 -0
- package/docs/fundamentals/tools/singleton-manager/example-fail/node_modules/page-b/page-b.js +34 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/demo-app.js +93 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/overlays/instance.js +4 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-a/page-a.js +34 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/index.js +30 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/node_modules/overlays/instance.js +4 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/node_modules/page-b/page-b.js +34 -0
- package/docs/fundamentals/tools/singleton-manager/example-success/overlayCompatibility.js +23 -0
- 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 -2
- package/dist-types/components/overlays/test/utils-tests/local-positioning-helpers.d.ts.map +0 -1
|
@@ -7,7 +7,7 @@ To do this automatically you can use this preset for [rocket](https://rocket.mod
|
|
|
7
7
|
|
|
8
8
|
## Features
|
|
9
9
|
|
|
10
|
-
- Import lion documentation and adjust it using [remark-extend](https://github.com/ing-bank/lion/blob/
|
|
10
|
+
- Import lion documentation and adjust it using [remark-extend](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/node-tools/remark-extend/overview.md)
|
|
11
11
|
- Renames named imports and all it's usage
|
|
12
12
|
- Adjusts import paths
|
|
13
13
|
- Replace tags in template literals
|
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
|
|
39
39
|
## Reusing documentation
|
|
40
40
|
|
|
41
|
-
To take an existing documentation you can "import" it using [remark-extend](https://github.com/ing-bank/lion/blob/
|
|
41
|
+
To take an existing documentation you can "import" it using [remark-extend](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/node-tools/remark-extend/overview.md).
|
|
42
42
|
|
|
43
43
|
As an example you can create `docs/components/tabs/overview.md`.
|
|
44
44
|
|
|
@@ -15,7 +15,7 @@ import { LitElement, html, render } from 'lit-element';
|
|
|
15
15
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
|
-
- [function to deduplicate mixins (dedupeMixin)](https://github.com/ing-bank/lion/blob/
|
|
18
|
+
- [function to deduplicate mixins (dedupeMixin)](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/core/#deduping-of-mixins)
|
|
19
19
|
- Mixin to handle disabled (DisabledMixin)
|
|
20
20
|
- Mixin to handle disabled AND tabIndex (DisabledWithTabIndexMixin)
|
|
21
21
|
- Mixin to manage auto-generated needed slot elements in light dom (SlotMixin)
|
|
@@ -23,7 +23,7 @@ Our fields can automatically format/parse/serialize user input or an input set i
|
|
|
23
23
|
|
|
24
24
|
Below are some concrete examples of implementations of formatters and parsers mimicking a (basic) amount input.
|
|
25
25
|
|
|
26
|
-
> For an actual amount input, check out [lion-input-amount](https://github.com/ing-bank/lion/blob/
|
|
26
|
+
> For an actual amount input, check out [lion-input-amount](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/input-amount/overview.md).
|
|
27
27
|
> This comes with its own formatter, parser, serializer.
|
|
28
28
|
|
|
29
29
|
### Parsers & modelValue
|
|
@@ -230,16 +230,16 @@ Below we show three flow diagrams to show the flow of formatting, serializing an
|
|
|
230
230
|
|
|
231
231
|
Where a user changes the input with their keyboard:
|
|
232
232
|
|
|
233
|
-

|
|
234
234
|
|
|
235
235
|
### Unparseable flow
|
|
236
236
|
|
|
237
237
|
Where a user sets the input to something that is not parseable by the parser:
|
|
238
238
|
|
|
239
|
-

|
|
240
240
|
|
|
241
241
|
### Imperative / programmatic flow
|
|
242
242
|
|
|
243
243
|
Where the developer sets the modelValue of the input programmatically:
|
|
244
244
|
|
|
245
|
-

|
|
@@ -21,7 +21,7 @@ level, via:
|
|
|
21
21
|
> Internal/private concepts like viewValue, formattedValue, serializedValue are therefore not
|
|
22
22
|
> recommended as a means of interaction.
|
|
23
23
|
|
|
24
|
-
For more information about parsing and the Unparseable type, see [Formatting and Parsing](https://github.com/ing-bank/lion/blob/
|
|
24
|
+
For more information about parsing and the Unparseable type, see [Formatting and Parsing](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/form/formatting-and-parsing.md)
|
|
25
25
|
|
|
26
26
|
### Event meta
|
|
27
27
|
|
|
@@ -20,9 +20,9 @@ Fields (think of an input, textarea, select) are the actual form controls the en
|
|
|
20
20
|
|
|
21
21
|
On top of this, they feature:
|
|
22
22
|
|
|
23
|
-
- [formatting/parsing/serializing](https://github.com/ing-bank/lion/blob/
|
|
24
|
-
- Advanced [validation](https://github.com/ing-bank/lion/blob/
|
|
25
|
-
- Creation of advanced user interaction scenarios via [interaction states](https://github.com/ing-bank/lion/blob/
|
|
23
|
+
- [formatting/parsing/serializing](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/form/formatting-and-parsing.md) of view values.
|
|
24
|
+
- Advanced [validation](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/form/validate.md) possibilities.
|
|
25
|
+
- Creation of advanced user interaction scenarios via [interaction states](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/form/interaction-states.md).
|
|
26
26
|
- Provision of labels and help texts in an easy, declarative manner.
|
|
27
27
|
- Accessibility out of the box.
|
|
28
28
|
- Advanced styling possibilities: map your own Design System to the internal HTML structure.
|
|
@@ -31,33 +31,33 @@ On top of this, they feature:
|
|
|
31
31
|
|
|
32
32
|
### Platform fields (wrappers)
|
|
33
33
|
|
|
34
|
-
- [LionInput](https://github.com/ing-bank/lion/blob/
|
|
35
|
-
- [LionTextarea](https://github.com/ing-bank/lion/blob/
|
|
36
|
-
- [LionSelect](https://github.com/ing-bank/lion/blob/
|
|
34
|
+
- [LionInput](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/input/overview.md), a wrapper for `<input>`.
|
|
35
|
+
- [LionTextarea](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/textarea/overview.md), a wrapper for `<textarea>`.
|
|
36
|
+
- [LionSelect](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/select/overview.md), a wrapper for `<select>`.
|
|
37
37
|
|
|
38
38
|
### Custom fields (wrappers)
|
|
39
39
|
|
|
40
|
-
Whenever a native form control doesn't exist or is not sufficient, a [custom form field](https://github.com/ing-bank/lion/blob/
|
|
40
|
+
Whenever a native form control doesn't exist or is not sufficient, a [custom form field](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/guides/how-to/create-a-custom-field.md) should be created. One could think of components like:
|
|
41
41
|
|
|
42
|
-
- [LionCombobox](https://github.com/ing-bank/lion/blob/
|
|
43
|
-
- [LionDate](https://github.com/ing-bank/lion/blob/
|
|
44
|
-
- [LionDatepicker](https://github.com/ing-bank/lion/blob/
|
|
45
|
-
- [LionListbox](https://github.com/ing-bank/lion/blob/
|
|
46
|
-
- [LionInputAmount](https://github.com/ing-bank/lion/blob/
|
|
47
|
-
- [LionInputEmail](https://github.com/ing-bank/lion/blob/
|
|
48
|
-
- [LionInputIban](https://github.com/ing-bank/lion/blob/
|
|
49
|
-
- [LionInputRange](https://github.com/ing-bank/lion/blob/
|
|
50
|
-
- [LionInputStepper](https://github.com/ing-bank/lion/blob/
|
|
51
|
-
- [LionSelectRich](https://github.com/ing-bank/lion/blob/
|
|
42
|
+
- [LionCombobox](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/combobox/overview.md), a custom implementation of a combobox.
|
|
43
|
+
- [LionDate](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/input-date/overview.md), an alternative for `<input type="date">`.
|
|
44
|
+
- [LionDatepicker](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/input-datepicker/overview.md), an alternative for `<input type="date">` including a calendar dropdown.
|
|
45
|
+
- [LionListbox](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/listbox/overview.md), a custom implementation of a listbox.
|
|
46
|
+
- [LionInputAmount](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/input-amount/overview.md), an alternative for `<input type="number">` special for amounts.
|
|
47
|
+
- [LionInputEmail](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/input-email/overview.md), an alternative for `<input type="email">`.
|
|
48
|
+
- [LionInputIban](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/input-iban/overview.md), an ING specific for an input with IBAN numbers.
|
|
49
|
+
- [LionInputRange](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/input-range/overview.md), an alternative for `<input type="range">`.
|
|
50
|
+
- [LionInputStepper](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/input-stepper/overview.md), an alternative for `<input type="number">`.
|
|
51
|
+
- [LionSelectRich](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/select-rich/overview.md), an alternative for `<select>` with multiline options.
|
|
52
52
|
|
|
53
53
|
### Choice Input Fields
|
|
54
54
|
|
|
55
55
|
For form controls which return a `checked-state` you can use the `lion-choice-input` mixin. It is used in:
|
|
56
56
|
|
|
57
|
-
- [LionCheckbox](https://github.com/ing-bank/lion/blob/
|
|
57
|
+
- [LionCheckbox](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/checkbox-group/overview.md), a wrapper for `<input type="checkbox">`.
|
|
58
58
|
- LionOption, an alternative for `<option>`.
|
|
59
|
-
- [LionRadio](https://github.com/ing-bank/lion/blob/
|
|
60
|
-
- [LionSwitch](https://github.com/ing-bank/lion/blob/
|
|
59
|
+
- [LionRadio](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/radio-group/overview.md), a wrapper for `<input type="radio">`.
|
|
60
|
+
- [LionSwitch](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/switch/overview.md), a custom implementation of a switch.
|
|
61
61
|
|
|
62
62
|
Which contains the following features:
|
|
63
63
|
|
|
@@ -69,14 +69,14 @@ Which contains the following features:
|
|
|
69
69
|
|
|
70
70
|
Fieldsets are groups of fields. They can be considered fields on their own as well, since they partly share the normalized API via `FormControlMixin`. Fieldsets are the basis for:
|
|
71
71
|
|
|
72
|
-
- [LionFieldset](https://github.com/ing-bank/lion/blob/
|
|
73
|
-
- [LionForm](https://github.com/ing-bank/lion/blob/
|
|
74
|
-
- [LionCheckboxGroup](https://github.com/ing-bank/lion/blob/
|
|
75
|
-
- [LionRadioGroup](https://github.com/ing-bank/lion/blob/
|
|
72
|
+
- [LionFieldset](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/fieldset/overview.md), a wrapper around multiple input fields or other fieldsets.
|
|
73
|
+
- [LionForm](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/form/overview.md), enhances the functionality of the native `<form>` component.
|
|
74
|
+
- [LionCheckboxGroup](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/checkbox-group/overview.md), a wrapper component for multiple checkboxes.
|
|
75
|
+
- [LionRadioGroup](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/radio-group/overview.md), a wrapper component for multiple radio inputs.
|
|
76
76
|
|
|
77
77
|
## Other Resources
|
|
78
78
|
|
|
79
|
-
- [Model Value](https://github.com/ing-bank/lion/blob/
|
|
80
|
-
- [Formatting and parsing](https://github.com/ing-bank/lion/blob/
|
|
81
|
-
- [Interaction states](https://github.com/ing-bank/lion/blob/
|
|
82
|
-
- [Validation System](https://github.com/ing-bank/lion/blob/
|
|
79
|
+
- [Model Value](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/form/model-value.md)
|
|
80
|
+
- [Formatting and parsing](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/form/formatting-and-parsing.md)
|
|
81
|
+
- [Interaction states](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/form/interaction-states.md)
|
|
82
|
+
- [Validation System](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/form/validate.md)
|
|
@@ -58,7 +58,7 @@ Validation happens on every change of `modelValue`. A change in modelValue can b
|
|
|
58
58
|
|
|
59
59
|
## When validation feedback will be shown
|
|
60
60
|
|
|
61
|
-
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/
|
|
61
|
+
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/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/form/interaction-states.md),
|
|
62
62
|
validity states can determine whether a validation message should be shown along the input field.
|
|
63
63
|
|
|
64
64
|
## Assessing field validation state programmatically
|
|
@@ -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/c7ce3afabd95988fe0cc2f466ffed78890796fa3/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/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/localize/text.md) | Load and translate text in multiple languages |
|
|
19
|
+
| [Format Numbers](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/localize/numbers.md) | Format numbers in multiple languages |
|
|
20
|
+
| [Format Dates](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/localize/dates.md) | Format dates in multiple languages |
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
@@ -15,22 +15,6 @@ class DemoElUsingOverlayMixin extends OverlayMixin(LitElement) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
_setupOpenCloseListeners() {
|
|
19
|
-
super._setupOpenCloseListeners();
|
|
20
|
-
|
|
21
|
-
if (this._overlayInvokerNode) {
|
|
22
|
-
this._overlayInvokerNode.addEventListener('click', this.toggle);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
_teardownOpenCloseListeners() {
|
|
27
|
-
super._teardownOpenCloseListeners();
|
|
28
|
-
|
|
29
|
-
if (this._overlayInvokerNode) {
|
|
30
|
-
this._overlayInvokerNode.removeEventListener('click', this.toggle);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
18
|
render() {
|
|
35
19
|
return html`
|
|
36
20
|
<slot name="invoker"></slot>
|
|
@@ -20,7 +20,7 @@ or in the `overlays` container at the bottom of the `<body>`.
|
|
|
20
20
|
|
|
21
21
|
```js preview-story
|
|
22
22
|
export const placementLocal = () => {
|
|
23
|
-
const placementModeLocalConfig = {
|
|
23
|
+
const placementModeLocalConfig = { ...withDropdownConfig() };
|
|
24
24
|
return html`
|
|
25
25
|
<style>
|
|
26
26
|
.demo-overlay {
|
|
@@ -68,7 +68,7 @@ export const placementGlobal = () => {
|
|
|
68
68
|
|
|
69
69
|
## isTooltip (placementMode: 'local')
|
|
70
70
|
|
|
71
|
-
As specified in the [overlay rationale](https://github.com/ing-bank/lion/blob/
|
|
71
|
+
As specified in the [overlay rationale](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/overlays/rationale.md) there are only two official types of overlays: dialogs and tooltips. And their main differences are:
|
|
72
72
|
|
|
73
73
|
- Dialogs have a modal option, tooltips don’t
|
|
74
74
|
- Dialogs have interactive content, tooltips don’t
|
|
@@ -77,24 +77,12 @@ As specified in the [overlay rationale](https://github.com/ing-bank/lion/blob/ed
|
|
|
77
77
|
Since most overlays have interactive content the default is set to dialogs. To get a tooltip, you can add `isTooltip` to the config object. This only works for local placement and it also needs to have `handlesAccessibility` activated to work.
|
|
78
78
|
|
|
79
79
|
```js preview-story
|
|
80
|
-
export const
|
|
81
|
-
|
|
82
|
-
const tooltip = document.querySelector('#tooltip');
|
|
83
|
-
tooltip.opened = true;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function hideTooltip() {
|
|
87
|
-
const tooltip = document.querySelector('#tooltip');
|
|
88
|
-
tooltip.opened = false;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const tooltipConfig = { placementMode: 'local', isTooltip: true, handlesAccessibility: true };
|
|
80
|
+
export const usingTooltipConfig = () => {
|
|
81
|
+
const tooltipConfig = { ...withTooltipConfig() };
|
|
92
82
|
|
|
93
83
|
return html`
|
|
94
84
|
<demo-el-using-overlaymixin id="tooltip" .config=${tooltipConfig}>
|
|
95
|
-
<button slot="invoker"
|
|
96
|
-
Hover me to open the tooltip!
|
|
97
|
-
</button>
|
|
85
|
+
<button slot="invoker">Hover me to open the tooltip!</button>
|
|
98
86
|
<div slot="content" class="demo-overlay">Hello!</div>
|
|
99
87
|
</demo-el-using-overlaymixin>
|
|
100
88
|
`;
|
|
@@ -112,7 +100,7 @@ You use the feature on any type of overlay.
|
|
|
112
100
|
|
|
113
101
|
```js preview-story
|
|
114
102
|
export const trapsKeyboardFocus = () => {
|
|
115
|
-
const trapsKeyboardFocusConfig = { trapsKeyboardFocus: true };
|
|
103
|
+
const trapsKeyboardFocusConfig = { ...withDropdownConfig(), trapsKeyboardFocus: true };
|
|
116
104
|
return html`
|
|
117
105
|
<demo-el-using-overlaymixin .config=${trapsKeyboardFocusConfig}>
|
|
118
106
|
<button slot="invoker">Click me to open the overlay!</button>
|
|
@@ -138,7 +126,7 @@ Boolean property. Will allow closing the overlay on ESC key when enabled.
|
|
|
138
126
|
|
|
139
127
|
```js preview-story
|
|
140
128
|
export const hidesOnEsc = () => {
|
|
141
|
-
const hidesOnEscConfig = { hidesOnEsc: true };
|
|
129
|
+
const hidesOnEscConfig = { ...withDropdownConfig(), hidesOnEsc: true };
|
|
142
130
|
return html`
|
|
143
131
|
<demo-el-using-overlaymixin .config=${hidesOnEscConfig}>
|
|
144
132
|
<button slot="invoker">Click me to open the overlay!</button>
|
|
@@ -162,7 +150,7 @@ Boolean property. When enabled allows closing the overlay on ESC key, even when
|
|
|
162
150
|
|
|
163
151
|
```js preview-story
|
|
164
152
|
export const hidesOnOutsideEsc = () => {
|
|
165
|
-
const hidesOnEscConfig = { hidesOnOutsideEsc: true };
|
|
153
|
+
const hidesOnEscConfig = { ...withDropdownConfig(), hidesOnOutsideEsc: true };
|
|
166
154
|
return html`
|
|
167
155
|
<demo-el-using-overlaymixin .config=${hidesOnEscConfig}>
|
|
168
156
|
<button slot="invoker">Click me to open the overlay!</button>
|
|
@@ -186,7 +174,7 @@ Boolean property. Will allow closing the overlay by clicking outside the `conten
|
|
|
186
174
|
|
|
187
175
|
```js preview-story
|
|
188
176
|
export const hidesOnOutsideClick = () => {
|
|
189
|
-
const hidesOnOutsideClickConfig = { hidesOnOutsideClick: true };
|
|
177
|
+
const hidesOnOutsideClickConfig = { ...withDropdownConfig(), hidesOnOutsideClick: true };
|
|
190
178
|
return html`
|
|
191
179
|
<demo-el-using-overlaymixin .config=${hidesOnOutsideClickConfig}>
|
|
192
180
|
<button slot="invoker">Click me to open the overlay!</button>
|
|
@@ -216,7 +204,7 @@ export const elementToFocusAfterHide = () => {
|
|
|
216
204
|
const btn = document.createElement('button');
|
|
217
205
|
btn.innerText = 'I should get focus';
|
|
218
206
|
|
|
219
|
-
const elementToFocusAfterHideConfig = { elementToFocusAfterHide: btn };
|
|
207
|
+
const elementToFocusAfterHideConfig = { ...withDropdownConfig(), elementToFocusAfterHide: btn };
|
|
220
208
|
return html`
|
|
221
209
|
<demo-el-using-overlaymixin .config=${elementToFocusAfterHideConfig}>
|
|
222
210
|
<button slot="invoker">Click me to open the overlay!</button>
|
|
@@ -252,7 +240,7 @@ This currently only supports CSS Animations, because it relies on the `animation
|
|
|
252
240
|
|
|
253
241
|
```js preview-story
|
|
254
242
|
export const hasBackdrop = () => {
|
|
255
|
-
const hasBackdropConfig = { hasBackdrop: true };
|
|
243
|
+
const hasBackdropConfig = { ...withDropdownConfig(), hasBackdrop: true };
|
|
256
244
|
return html`
|
|
257
245
|
<demo-el-using-overlaymixin .config=${hasBackdropConfig}>
|
|
258
246
|
<button slot="invoker">Click me to open the overlay!</button>
|
|
@@ -276,7 +264,7 @@ Boolean property. When true, will block other overlays.
|
|
|
276
264
|
|
|
277
265
|
```js preview-story
|
|
278
266
|
export const isBlocking = () => {
|
|
279
|
-
const isBlockingConfig = { hasBackdrop: true, isBlocking: true };
|
|
267
|
+
const isBlockingConfig = { ...withDropdownConfig(), hasBackdrop: true, isBlocking: true };
|
|
280
268
|
return html`
|
|
281
269
|
<demo-el-using-overlaymixin>
|
|
282
270
|
<button slot="invoker">Overlay A: open first</button>
|
|
@@ -385,7 +373,7 @@ Features:
|
|
|
385
373
|
|
|
386
374
|
> Popper strictly is scoped on positioning. **It does not change the dimensions of the content node nor the invoker node**.
|
|
387
375
|
> This also means that if you use the arrow feature, you are in charge of styling it properly, use the data-popper-placement attribute for this.
|
|
388
|
-
> An example implementation can be found in [lion-tooltip](https://github.com/ing-bank/lion/blob/
|
|
376
|
+
> An example implementation can be found in [lion-tooltip](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/tooltip/overview.md), where an arrow is set by default.
|
|
389
377
|
|
|
390
378
|
To override the default options we set for local mode, you add a `popperConfig` object to the config passed to the OverlayController.
|
|
391
379
|
Here's a succinct overview of some often used popper properties:
|
|
@@ -6,7 +6,7 @@ Manages their position on the screen relative to other elements, including other
|
|
|
6
6
|
|
|
7
7
|
Its purpose is to make it easy to use our Overlay System declaratively. It can be easily extended where needed, to override event listeners and more.
|
|
8
8
|
|
|
9
|
-
See [lion-dialog](../../../components/dialog/overview.md) and [lion-tooltip](https://github.com/ing-bank/lion/blob/
|
|
9
|
+
See [lion-dialog](../../../components/dialog/overview.md) and [lion-tooltip](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/components/tooltip/overview.md) for example Web Component implementations using the Overlay System.
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
@@ -18,9 +18,9 @@ See [lion-dialog](../../../components/dialog/overview.md) and [lion-tooltip](htt
|
|
|
18
18
|
- lion-overlay web component:
|
|
19
19
|
- Show content when clicking the invoker
|
|
20
20
|
- Have a `.config` object to set or update the OverlayController's configuration
|
|
21
|
-
- [**OverlaysManager**](https://github.com/ing-bank/lion/blob/
|
|
22
|
-
- [**OverlayController**](https://github.com/ing-bank/lion/blob/
|
|
23
|
-
- [**OverlayMixin**](https://github.com/ing-bank/lion/blob/
|
|
21
|
+
- [**OverlaysManager**](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/overlays/use-cases.md#overlaysmanager), a global repository keeping track of all different types of overlays
|
|
22
|
+
- [**OverlayController**](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/overlays/use-cases.md#overlaycontroller), a single controller class for handling overlays
|
|
23
|
+
- [**OverlayMixin**](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/overlays/use-cases.md#overlaymixin), a mixin that can be used to create webcomponents that use the OverlayController under the hood
|
|
24
24
|
|
|
25
25
|
Usually you will use `lion-dialog` (or `lion-tooltip` if this makes more sense).
|
|
26
26
|
|
|
@@ -110,7 +110,7 @@ class MyOverlayComponent extends OverlayMixin(LitElement) {
|
|
|
110
110
|
|
|
111
111
|
## Rationales
|
|
112
112
|
|
|
113
|
-
Please check the [system rationals](https://github.com/ing-bank/lion/blob/
|
|
113
|
+
Please check the [system rationals](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/overlays/rationale.md) folder, where we go more in-depth.
|
|
114
114
|
|
|
115
115
|
### Aria roles
|
|
116
116
|
|
|
@@ -21,7 +21,7 @@ The overlay system allows to create different types of overlays like dialogs, to
|
|
|
21
21
|
It's designed to be highly flexible, while still delivering sensible defaults.
|
|
22
22
|
On top of this, the system was built having accessibility in mind.
|
|
23
23
|
|
|
24
|
-
For a detailed rationale, please consult [Rationale](https://github.com/ing-bank/lion/blob/
|
|
24
|
+
For a detailed rationale, please consult [Rationale](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/overlays/rationale.md).
|
|
25
25
|
|
|
26
26
|
```js preview-story
|
|
27
27
|
export const main = () => html`
|
|
@@ -67,7 +67,7 @@ Global refers to overlays where the content is positioned in a global root node
|
|
|
67
67
|
|
|
68
68
|
Overlays can be configured in many ways to suit your needs. We go in-depth into each option in the Overlay System - Configuration chapter.
|
|
69
69
|
|
|
70
|
-
We also export a few [preset configuration objects](https://github.com/ing-bank/lion/blob/
|
|
70
|
+
We also export a few [preset configuration objects](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/systems/overlays/configuration.md).
|
|
71
71
|
|
|
72
72
|
- withModalDialogConfig
|
|
73
73
|
- withDropdownConfig
|
|
@@ -539,7 +539,7 @@ Below an example is shown with the `isBlocking` option, which makes use of the O
|
|
|
539
539
|
|
|
540
540
|
```js preview-story
|
|
541
541
|
export const overlayManager = () => {
|
|
542
|
-
const hasBackdropConfig = { hasBackdrop: true };
|
|
542
|
+
const hasBackdropConfig = { ...withModalDialogConfig(), hasBackdrop: true };
|
|
543
543
|
return html`
|
|
544
544
|
<demo-el-using-overlaymixin .config=${hasBackdropConfig}>
|
|
545
545
|
<button slot="invoker">Click me to open the overlay!</button>
|
|
@@ -558,7 +558,7 @@ export const overlayManager = () => {
|
|
|
558
558
|
</demo-el-using-overlaymixin>
|
|
559
559
|
<demo-el-using-overlaymixin
|
|
560
560
|
id="secondOverlay"
|
|
561
|
-
.config=${{ hasBackdrop: true, isBlocking: true }}
|
|
561
|
+
.config=${{ ...withModalDialogConfig(), hasBackdrop: true, isBlocking: true }}
|
|
562
562
|
>
|
|
563
563
|
<div slot="content" class="demo-overlay demo-overlay--second">
|
|
564
564
|
Hello! You can close this notification here:
|
|
@@ -581,7 +581,7 @@ Here is the example below
|
|
|
581
581
|
|
|
582
582
|
```js preview-story
|
|
583
583
|
export const localBackdrop = () => {
|
|
584
|
-
const localBackdropConfig = {
|
|
584
|
+
const localBackdropConfig = { ...withDropdownConfig() };
|
|
585
585
|
return html`
|
|
586
586
|
<demo-el-using-overlaymixin .config=${localBackdropConfig}>
|
|
587
587
|
<demo-overlay-backdrop slot="backdrop"></demo-overlay-backdrop>
|
|
@@ -9,7 +9,7 @@ Therefore, they may not have the same quality standards as our other packages.
|
|
|
9
9
|
|
|
10
10
|
| Package | Description |
|
|
11
11
|
| -------------------------------------- | ----------------------- |
|
|
12
|
-
| [sb-action-logger](https://github.com/ing-bank/lion/blob/
|
|
12
|
+
| [sb-action-logger](https://github.com/ing-bank/lion/blob/c7ce3afabd95988fe0cc2f466ffed78890796fa3/docs/fundamentals/tools/helpers/action-logger.md) | Storybook action logger |
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!**/*
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit';
|
|
2
|
+
|
|
3
|
+
import './overlayCompatibility.js';
|
|
4
|
+
|
|
5
|
+
import 'page-a/page-a.js';
|
|
6
|
+
import 'page-b/page-b.js';
|
|
7
|
+
|
|
8
|
+
class DemoApp extends LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.page = 'A';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static get properties() {
|
|
15
|
+
return {
|
|
16
|
+
page: { type: String },
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static get styles() {
|
|
21
|
+
return css`
|
|
22
|
+
:host {
|
|
23
|
+
display: block;
|
|
24
|
+
max-width: 680px;
|
|
25
|
+
margin: 0 auto;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
nav {
|
|
29
|
+
padding: 0 10px 10px 10px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
button {
|
|
33
|
+
border: none;
|
|
34
|
+
padding: 1rem 2rem;
|
|
35
|
+
background: #0069ed;
|
|
36
|
+
color: #fff;
|
|
37
|
+
font-size: 1rem;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
text-align: center;
|
|
40
|
+
transition: background 250ms ease-in-out, transform 150ms ease;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
button:hover,
|
|
44
|
+
button:focus {
|
|
45
|
+
background: #0053ba;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
button:focus {
|
|
49
|
+
outline: 1px solid #fff;
|
|
50
|
+
outline-offset: -4px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
button:active {
|
|
54
|
+
transform: scale(0.99);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
button.active {
|
|
58
|
+
background: #33a43f;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
h1 {
|
|
62
|
+
text-align: center;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
render() {
|
|
68
|
+
return html`
|
|
69
|
+
<h1>Demo App</h1>
|
|
70
|
+
<nav>
|
|
71
|
+
<button
|
|
72
|
+
class=${this.page === 'A' ? 'active' : ''}
|
|
73
|
+
@click=${() => {
|
|
74
|
+
this.page = 'A';
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
Page A
|
|
78
|
+
</button>
|
|
79
|
+
<button
|
|
80
|
+
class=${this.page === 'B' ? 'active' : ''}
|
|
81
|
+
@click=${() => {
|
|
82
|
+
this.page = 'B';
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
Page B
|
|
86
|
+
</button>
|
|
87
|
+
</nav>
|
|
88
|
+
${this.page === 'A' ? html` <page-a></page-a> ` : html` <page-b></page-b> `}
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
customElements.define('demo-app', DemoApp);
|
package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class OverlaysManager {
|
|
2
|
+
name = 'OverlayManager 1.x';
|
|
3
|
+
|
|
4
|
+
blockBody = false;
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
this._setupBlocker();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
_setupBlocker() {
|
|
11
|
+
const blocker = document.createElement('div');
|
|
12
|
+
blocker.setAttribute('style', 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 140px; text-align: center;');
|
|
13
|
+
blocker.innerText = `Blocker for ${this.name}`;
|
|
14
|
+
|
|
15
|
+
const target = document.getElementById('overlay-target');
|
|
16
|
+
target.appendChild(blocker);
|
|
17
|
+
|
|
18
|
+
this.blocker = blocker;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
block() {
|
|
22
|
+
this.blockBody = true;
|
|
23
|
+
this.blocker.style.backgroundColor = '#ff6161';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
unBlock() {
|
|
27
|
+
this.blockBody = false;
|
|
28
|
+
this.blocker.style.backgroundColor = 'transparent';
|
|
29
|
+
}
|
|
30
|
+
}
|
package/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/page-a/page-a.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit-element';
|
|
2
|
+
import { overlays } from 'overlays/instance.js';
|
|
3
|
+
|
|
4
|
+
export class PageA extends LitElement {
|
|
5
|
+
static get styles() {
|
|
6
|
+
return css`
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
padding: 10px;
|
|
10
|
+
border: 2px solid #ccc;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
render() {
|
|
16
|
+
return html`
|
|
17
|
+
<h3>I am page A</h3>
|
|
18
|
+
<p>Overlays Status:</p>
|
|
19
|
+
<p>Name: ${overlays.name}</p>
|
|
20
|
+
<p>Blocked: ${overlays.blockBody}</p>
|
|
21
|
+
<button @click=${() => {
|
|
22
|
+
overlays.block(); this.requestUpdate();
|
|
23
|
+
}}>block</button>
|
|
24
|
+
<button @click=${() => {
|
|
25
|
+
overlays.unBlock(); this.requestUpdate();
|
|
26
|
+
}}>un-block</button>
|
|
27
|
+
<button @click=${() => {
|
|
28
|
+
this.requestUpdate();
|
|
29
|
+
}}>refresh</button>
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
customElements.define('page-a', PageA);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class OverlaysManager {
|
|
2
|
+
name = 'OverlayManager 2.x';
|
|
3
|
+
|
|
4
|
+
_blockBody = false;
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
this._setupBlocker();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
_setupBlocker() {
|
|
11
|
+
const blocker = document.createElement('div');
|
|
12
|
+
blocker.setAttribute('style', 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 140px; text-align: center;');
|
|
13
|
+
blocker.innerText = `Blocker for ${this.name}`;
|
|
14
|
+
|
|
15
|
+
const target = document.getElementById('overlay-target');
|
|
16
|
+
target.appendChild(blocker);
|
|
17
|
+
|
|
18
|
+
this.blocker = blocker;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
blockBody() {
|
|
22
|
+
this._blockBody = true;
|
|
23
|
+
this.blocker.style.backgroundColor = '#ff6161';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
unBlockBody() {
|
|
27
|
+
this._blockBody = false;
|
|
28
|
+
this.blocker.style.backgroundColor = 'transparent';
|
|
29
|
+
}
|
|
30
|
+
}
|