@lion/ui 0.0.2 → 0.0.4
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/core/src/SlotMixin.js +180 -42
- package/components/core/test/SlotMixin.test.js +355 -145
- package/components/core/types/SlotMixinTypes.ts +12 -1
- package/components/input-tel/src/LionInputTel.js +0 -9
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +32 -29
- package/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.js +5 -6
- package/components/localize/src/number/parseNumber.js +15 -36
- package/components/localize/test/number/parseNumber.test.js +3 -12
- package/components/localize/types/LocalizeMixinTypes.ts +1 -1
- package/custom-elements.json +1435 -133
- package/dist-types/components/calendar/src/LionCalendar.d.ts +1 -37
- package/dist-types/components/calendar/src/LionCalendar.d.ts.map +1 -1
- package/dist-types/components/core/src/SlotMixin.d.ts +2 -0
- package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
- package/dist-types/components/core/test/SlotMixin.test.d.ts +1 -1
- package/dist-types/components/core/test/SlotMixin.test.d.ts.map +1 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts +9 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts +1 -37
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts.map +1 -1
- package/dist-types/components/input-date/src/LionInputDate.d.ts +1 -37
- package/dist-types/components/input-date/src/LionInputDate.d.ts.map +1 -1
- package/dist-types/components/input-datepicker/src/LionCalendarOverlayFrame.d.ts +1 -37
- package/dist-types/components/input-datepicker/src/LionCalendarOverlayFrame.d.ts.map +1 -1
- package/dist-types/components/input-email/src/LionInputEmail.d.ts +1 -37
- package/dist-types/components/input-email/src/LionInputEmail.d.ts.map +1 -1
- package/dist-types/components/input-iban/src/LionInputIban.d.ts +1 -37
- package/dist-types/components/input-iban/src/LionInputIban.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/LionInputTel.d.ts +1 -42
- package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts +14 -8
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.d.ts.map +1 -1
- package/dist-types/components/localize/src/LocalizeMixin.d.ts +1 -37
- package/dist-types/components/localize/src/LocalizeMixin.d.ts.map +1 -1
- package/dist-types/components/localize/src/number/parseNumber.d.ts.map +1 -1
- package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts +1 -1
- package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts.map +1 -1
- package/dist-types/components/pagination/src/LionPagination.d.ts +1 -37
- package/dist-types/components/pagination/src/LionPagination.d.ts.map +1 -1
- package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts +1 -37
- package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts.map +1 -1
- package/dist-types/exports/core.d.ts +1 -0
- package/dist-types/exports/core.d.ts.map +1 -1
- package/dist-types/exports/form-core.d.ts +2 -0
- package/dist-types/exports/form-core.d.ts.map +1 -1
- package/dist-types/exports/input-tel-dropdown.d.ts +2 -0
- package/dist-types/exports/input-tel-dropdown.d.ts.map +1 -1
- package/dist-types/exports/input-tel.d.ts +1 -0
- package/dist-types/exports/input-tel.d.ts.map +1 -1
- package/dist-types/exports/localize.d.ts +3 -0
- package/dist-types/exports/localize.d.ts.map +1 -1
- package/dist-types/exports/overlays.d.ts +4 -0
- package/dist-types/exports/overlays.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/accordion/index.md +3 -0
- package/docs/components/accordion/overview.md +129 -0
- package/docs/components/accordion/reference.md +47 -0
- package/docs/components/accordion/use-cases.md +252 -0
- package/docs/components/button/examples.md +30 -0
- package/docs/components/button/index.md +3 -0
- package/docs/components/button/overview.md +30 -0
- package/docs/components/button/src/icon.svg.js +5 -0
- package/docs/components/button/use-cases.md +106 -0
- package/docs/components/calendar/index.md +3 -0
- package/docs/components/calendar/overview.md +49 -0
- package/docs/components/calendar/use-cases.md +192 -0
- package/docs/components/checkbox-group/index.md +3 -0
- package/docs/components/checkbox-group/overview.md +40 -0
- package/docs/components/checkbox-group/use-cases.md +256 -0
- package/docs/components/collapsible/assets/CustomCollapsible.js +113 -0
- package/docs/components/collapsible/assets/applyDemoCollapsibleStyles.js +37 -0
- package/docs/components/collapsible/examples.md +83 -0
- package/docs/components/collapsible/index.md +3 -0
- package/docs/components/collapsible/overview.md +39 -0
- package/docs/components/collapsible/use-cases.md +79 -0
- package/docs/components/combobox/examples.md +153 -0
- package/docs/components/combobox/index.md +3 -0
- package/docs/components/combobox/overview.md +51 -0
- package/docs/components/combobox/src/LinkMixin.js +60 -0
- package/docs/components/combobox/src/demo-selection-display.js +191 -0
- package/docs/components/combobox/src/gh-combobox/gh-button.js +69 -0
- package/docs/components/combobox/src/gh-combobox/gh-combobox.js +508 -0
- package/docs/components/combobox/src/google-combobox/assets/google-clear-icon.js +9 -0
- package/docs/components/combobox/src/google-combobox/assets/google-search-icon.js +9 -0
- package/docs/components/combobox/src/google-combobox/assets/google-voice-search-icon.js +19 -0
- package/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png +0 -0
- package/docs/components/combobox/src/google-combobox/google-combobox.js +460 -0
- package/docs/components/combobox/src/lazyRender.js +29 -0
- package/docs/components/combobox/src/levenshtein.js +95 -0
- package/docs/components/combobox/src/md-combobox/MdFieldMixin.js +341 -0
- package/docs/components/combobox/src/md-combobox/md-combobox.js +89 -0
- package/docs/components/combobox/src/md-combobox/md-input.js +5 -0
- package/docs/components/combobox/src/md-combobox/style/load-roboto.js +6 -0
- package/docs/components/combobox/src/md-combobox/style/md-ripple.js +81 -0
- package/docs/components/combobox/src/wa-combobox/wa-combobox.js +368 -0
- package/docs/components/combobox/use-cases.md +377 -0
- package/docs/components/dialog/index.md +3 -0
- package/docs/components/dialog/overview.md +63 -0
- package/docs/components/dialog/src/demo-dialog-style.js +3 -0
- package/docs/components/dialog/src/demoStyle.js +39 -0
- package/docs/components/dialog/src/slots-dialog-content.js +32 -0
- package/docs/components/dialog/src/styled-dialog-content.js +38 -0
- package/docs/components/dialog/use-cases.md +154 -0
- package/docs/components/drawer/index.md +3 -0
- package/docs/components/drawer/overview.md +68 -0
- package/docs/components/drawer/src/demoStyle.js +71 -0
- package/docs/components/drawer/use-cases.md +194 -0
- package/docs/components/fieldset/index.md +3 -0
- package/docs/components/fieldset/overview.md +49 -0
- package/docs/components/fieldset/use-cases.md +185 -0
- package/docs/components/form/index.md +3 -0
- package/docs/components/form/overview.md +43 -0
- package/docs/components/form/use-cases.md +72 -0
- package/docs/components/icon/assets/bugs/bug01.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug02.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug05.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug06.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug08.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug12.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug19.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug23.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug24.svg.js +2 -0
- package/docs/components/icon/assets/iconset-bugs.js +11 -0
- package/docs/components/icon/assets/iconset-misc.js +3 -0
- package/docs/components/icon/assets/iconset-space.js +31 -0
- package/docs/components/icon/assets/misc/arrowLeft.svg.js +6 -0
- package/docs/components/icon/assets/space/aliens-spaceship.svg.js +2 -0
- package/docs/components/icon/assets/space/meteor.svg.js +2 -0
- package/docs/components/icon/assets/space/moon-flag.svg.js +2 -0
- package/docs/components/icon/assets/space/moon.svg.js +2 -0
- package/docs/components/icon/assets/space/night.svg.js +2 -0
- package/docs/components/icon/assets/space/orbit.svg.js +2 -0
- package/docs/components/icon/assets/space/planet.svg.js +2 -0
- package/docs/components/icon/assets/space/robot.svg.js +2 -0
- package/docs/components/icon/assets/space/rocket.svg.js +2 -0
- package/docs/components/icon/assets/space/satellite.svg.js +2 -0
- package/docs/components/icon/assets/space/signal.svg.js +2 -0
- package/docs/components/icon/assets/space/space-helmet.svg.js +2 -0
- package/docs/components/icon/assets/space/sun.svg.js +2 -0
- package/docs/components/icon/assets/space/telescope.svg.js +2 -0
- package/docs/components/icon/index.md +3 -0
- package/docs/components/icon/overview.md +40 -0
- package/docs/components/icon/use-cases.md +93 -0
- package/docs/components/index.md +7 -0
- package/docs/components/input/index.md +3 -0
- package/docs/components/input/overview.md +36 -0
- package/docs/components/input/use-cases.md +77 -0
- package/docs/components/input-amount/index.md +3 -0
- package/docs/components/input-amount/overview.md +49 -0
- package/docs/components/input-amount/use-cases.md +122 -0
- package/docs/components/input-date/index.md +3 -0
- package/docs/components/input-date/overview.md +39 -0
- package/docs/components/input-date/use-cases.md +83 -0
- package/docs/components/input-datepicker/index.md +3 -0
- package/docs/components/input-datepicker/overview.md +42 -0
- package/docs/components/input-datepicker/use-cases.md +78 -0
- package/docs/components/input-email/index.md +3 -0
- package/docs/components/input-email/overview.md +32 -0
- package/docs/components/input-email/use-cases.md +48 -0
- package/docs/components/input-iban/index.md +3 -0
- package/docs/components/input-iban/overview.md +37 -0
- package/docs/components/input-iban/use-cases.md +102 -0
- package/docs/components/input-range/index.md +3 -0
- package/docs/components/input-range/overview.md +34 -0
- package/docs/components/input-range/use-cases.md +108 -0
- package/docs/components/input-stepper/index.md +3 -0
- package/docs/components/input-stepper/overview.md +36 -0
- package/docs/components/input-stepper/use-cases.md +41 -0
- package/docs/components/input-tel/index.md +3 -0
- package/docs/components/input-tel/overview.md +62 -0
- package/docs/components/input-tel/src/h-region-code-table.js +109 -0
- package/docs/components/input-tel/use-cases.md +307 -0
- package/docs/components/input-tel-dropdown/examples.md +32 -0
- package/docs/components/input-tel-dropdown/index.md +3 -0
- package/docs/components/input-tel-dropdown/overview.md +38 -0
- package/docs/components/input-tel-dropdown/src/intl-input-tel-dropdown.js +127 -0
- package/docs/components/input-tel-dropdown/use-cases.md +159 -0
- package/docs/components/listbox/index.md +3 -0
- package/docs/components/listbox/overview.md +42 -0
- package/docs/components/listbox/src/listboxData.js +65 -0
- package/docs/components/listbox/use-cases.md +147 -0
- package/docs/components/pagination/index.md +3 -0
- package/docs/components/pagination/overview.md +29 -0
- package/docs/components/pagination/use-cases.md +99 -0
- package/docs/components/progress-indicator/assets/my-determinate-progress-bar.js +30 -0
- package/docs/components/progress-indicator/assets/my-indeterminate-progress-spinner.js +55 -0
- package/docs/components/progress-indicator/examples.md +125 -0
- package/docs/components/progress-indicator/index.md +3 -0
- package/docs/components/progress-indicator/overview.md +36 -0
- package/docs/components/radio-group/index.md +3 -0
- package/docs/components/radio-group/overview.md +46 -0
- package/docs/components/radio-group/use-cases.md +140 -0
- package/docs/components/select/index.md +3 -0
- package/docs/components/select/overview.md +44 -0
- package/docs/components/select/use-cases.md +55 -0
- package/docs/components/select-rich/examples.md +31 -0
- package/docs/components/select-rich/index.md +3 -0
- package/docs/components/select-rich/overview.md +46 -0
- package/docs/components/select-rich/src/flagStyles.js +1250 -0
- package/docs/components/select-rich/src/flags.png +0 -0
- package/docs/components/select-rich/src/flags@2x.png +0 -0
- package/docs/components/select-rich/src/intl-select-rich.js +194 -0
- package/docs/components/select-rich/src/regionMetaList.js +1717 -0
- package/docs/components/select-rich/use-cases.md +370 -0
- package/docs/components/steps/index.md +3 -0
- package/docs/components/steps/overview.md +63 -0
- package/docs/components/steps/use-cases.md +163 -0
- package/docs/components/switch/index.md +3 -0
- package/docs/components/switch/overview.md +75 -0
- package/docs/components/switch/reference.md +39 -0
- package/docs/components/switch/use-cases.md +76 -0
- package/docs/components/tabs/examples.md +23 -0
- package/docs/components/tabs/index.md +3 -0
- package/docs/components/tabs/overview.md +48 -0
- package/docs/components/tabs/src/lea-tab-panel.js +24 -0
- package/docs/components/tabs/src/lea-tab.js +45 -0
- package/docs/components/tabs/src/lea-tabs.js +28 -0
- package/docs/components/tabs/use-cases.md +219 -0
- package/docs/components/textarea/index.md +3 -0
- package/docs/components/textarea/overview.md +35 -0
- package/docs/components/textarea/use-cases.md +95 -0
- package/docs/components/tooltip/examples.md +39 -0
- package/docs/components/tooltip/index.md +3 -0
- package/docs/components/tooltip/overview.md +44 -0
- package/docs/components/tooltip/use-cases.md +208 -0
- package/docs/fundamentals/index.md +19 -0
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md +1 -0
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md +233 -0
- package/docs/fundamentals/node-tools/index.md +1 -0
- package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +68 -0
- package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +111 -0
- package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +69 -0
- package/docs/fundamentals/node-tools/providence-analytics/assets/_mermaid.svg.js +1202 -0
- package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +22 -0
- package/docs/fundamentals/node-tools/providence-analytics/index.md +1 -0
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +192 -0
- package/docs/fundamentals/node-tools/publish-docs/index.md +1 -0
- package/docs/fundamentals/node-tools/publish-docs/overview.md +136 -0
- package/docs/fundamentals/node-tools/remark-extend/index.md +1 -0
- package/docs/fundamentals/node-tools/remark-extend/overview.md +274 -0
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md +1 -0
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +285 -0
- package/docs/fundamentals/rationales/TypeScript.md +18 -0
- package/docs/fundamentals/rationales/index.md +1 -0
- package/docs/fundamentals/rationales/side-effects.md +203 -0
- package/docs/fundamentals/rationales/versioning.md +35 -0
- package/docs/fundamentals/systems/core/index.md +3 -0
- package/docs/fundamentals/systems/core/overview.md +85 -0
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg +1 -0
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg +1 -0
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg +84 -0
- package/docs/fundamentals/systems/form/assets/h-output.js +155 -0
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +245 -0
- package/docs/fundamentals/systems/form/index.md +3 -0
- package/docs/fundamentals/systems/form/interaction-states.md +177 -0
- package/docs/fundamentals/systems/form/model-value.md +35 -0
- package/docs/fundamentals/systems/form/overview.md +82 -0
- package/docs/fundamentals/systems/form/styling.md +101 -0
- package/docs/fundamentals/systems/form/use-cases.md +156 -0
- package/docs/fundamentals/systems/form/validate.md +929 -0
- package/docs/fundamentals/systems/icon/index.md +3 -0
- package/docs/fundamentals/systems/icon/overview.md +124 -0
- package/docs/fundamentals/systems/index.md +1 -0
- package/docs/fundamentals/systems/localize/assets/all-locales.js +437 -0
- package/docs/fundamentals/systems/localize/assets/en-AU.js +6 -0
- package/docs/fundamentals/systems/localize/assets/en-GB.js +6 -0
- package/docs/fundamentals/systems/localize/assets/en-US.js +6 -0
- package/docs/fundamentals/systems/localize/assets/en.js +4 -0
- package/docs/fundamentals/systems/localize/assets/nl-BE.js +6 -0
- package/docs/fundamentals/systems/localize/assets/nl-NL.js +6 -0
- package/docs/fundamentals/systems/localize/assets/nl.js +4 -0
- package/docs/fundamentals/systems/localize/dates.md +195 -0
- package/docs/fundamentals/systems/localize/index.md +3 -0
- package/docs/fundamentals/systems/localize/numbers.md +217 -0
- package/docs/fundamentals/systems/localize/overview.md +48 -0
- package/docs/fundamentals/systems/localize/rationale.md +62 -0
- package/docs/fundamentals/systems/localize/text.md +125 -0
- package/docs/fundamentals/systems/localize/use-cases.md +319 -0
- package/docs/fundamentals/systems/overlays/assets/applyDemoOverlayStyles.js +22 -0
- package/docs/fundamentals/systems/overlays/assets/demo-overlay-backdrop.js +48 -0
- package/docs/fundamentals/systems/overlays/assets/demo-overlay-system.js +42 -0
- package/docs/fundamentals/systems/overlays/assets/umbrella-form.js +133 -0
- package/docs/fundamentals/systems/overlays/configuration.md +453 -0
- package/docs/fundamentals/systems/overlays/form-integration.md +65 -0
- package/docs/fundamentals/systems/overlays/index.md +3 -0
- package/docs/fundamentals/systems/overlays/overview.md +118 -0
- package/docs/fundamentals/systems/overlays/rationale.md +232 -0
- package/docs/fundamentals/systems/overlays/scope.md +176 -0
- package/docs/fundamentals/systems/overlays/use-cases.md +699 -0
- package/docs/fundamentals/tools/ajax/assets/naga.json +9 -0
- package/docs/fundamentals/tools/ajax/assets/pabu.json +9 -0
- package/docs/fundamentals/tools/ajax/index.md +3 -0
- package/docs/fundamentals/tools/ajax/overview.md +128 -0
- package/docs/fundamentals/tools/ajax/use-cases.md +456 -0
- package/docs/fundamentals/tools/helpers/action-logger.md +165 -0
- package/docs/fundamentals/tools/helpers/index.md +3 -0
- package/docs/fundamentals/tools/helpers/overview.md +30 -0
- package/docs/fundamentals/tools/index.md +1 -0
- package/docs/fundamentals/tools/singleton-manager/index.md +3 -0
- package/docs/fundamentals/tools/singleton-manager/overview.md +304 -0
- package/docs/guides/how-to/create-a-custom-field.md +200 -0
- package/docs/guides/how-to/extend-a-native-input.md +66 -0
- package/docs/guides/how-to/get-started.md +77 -0
- package/docs/guides/how-to/index.md +1 -0
- package/docs/guides/index.md +34 -0
- package/docs/guides/principles/definitions-and-terms.md +41 -0
- package/docs/guides/principles/index.md +26 -0
- package/docs/guides/principles/scoped-elements.md +103 -0
- package/docs/guides/principles/styling.md +32 -0
- package/docs/guides/principles/subclasser-apis.md +28 -0
- package/docs/override.js +15 -0
- package/exports/core.js +2 -0
- package/exports/form-core.js +3 -0
- package/exports/input-tel-dropdown.js +3 -0
- package/exports/input-tel.js +2 -0
- package/exports/localize.js +4 -0
- package/exports/overlays.js +5 -0
- package/package.json +3 -2
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Dialog >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
`lion-dialog` is a component wrapping a modal dialog controller.
|
|
4
|
+
Its purpose is to make it easy to use our Overlay System declaratively.
|
|
5
|
+
|
|
6
|
+
```js script
|
|
7
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
8
|
+
import '@lion/ui/define/lion-dialog.js';
|
|
9
|
+
|
|
10
|
+
import { demoStyle } from './src/demoStyle.js';
|
|
11
|
+
import './src/styled-dialog-content.js';
|
|
12
|
+
import './src/slots-dialog-content.js';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<lion-dialog>
|
|
17
|
+
<div slot="content">
|
|
18
|
+
This is a dialog
|
|
19
|
+
<button @click=${e => e.target.dispatchEvent(new Event('close-overlay', { bubbles: true }))}>x</button>
|
|
20
|
+
<div>
|
|
21
|
+
<button slot="invoker">Click me</button>
|
|
22
|
+
</lion-dialog>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Styling content
|
|
26
|
+
|
|
27
|
+
It's not possible to style content from the dialog component. This is because the content slot is moved to the global root node. This is why a custom component should be created and slotted in as the content. This ensures style encapsulation on the dialog content.
|
|
28
|
+
|
|
29
|
+
```js preview-story
|
|
30
|
+
export const stylingContent = () => html`
|
|
31
|
+
<style>
|
|
32
|
+
${demoStyle}
|
|
33
|
+
</style>
|
|
34
|
+
<lion-dialog .config=${{ hidesOnOutsideClick: true, hidesOnEsc: true }}>
|
|
35
|
+
<button slot="invoker">Styled dialog</button>
|
|
36
|
+
<styled-dialog-content slot="content"></styled-dialog-content>
|
|
37
|
+
</lion-dialog>
|
|
38
|
+
`;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Content with slots
|
|
42
|
+
|
|
43
|
+
```js preview-story
|
|
44
|
+
export const slotsContent = () => html`
|
|
45
|
+
<style>
|
|
46
|
+
${demoStyle}
|
|
47
|
+
</style>
|
|
48
|
+
<lion-dialog .config=${{ hidesOnOutsideClick: true, hidesOnEsc: true }}>
|
|
49
|
+
<button slot="invoker">Dialog with content with slots</button>
|
|
50
|
+
<slots-dialog-content slot="content">
|
|
51
|
+
<p>Some Stuff</p>
|
|
52
|
+
<p slot="actions">I am in the actions slot</p>
|
|
53
|
+
</slots-dialog-content>
|
|
54
|
+
</lion-dialog>
|
|
55
|
+
`;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Close overlay from component slotted as content
|
|
59
|
+
|
|
60
|
+
The overlay cannot be closed by dispatching the `close-overlay` from a button in a styled component that is slotted in as content, because it will not cross the shadow boundary of the component. A method should be created that will dispatch the `close-overlay` event from the component.
|
|
61
|
+
|
|
62
|
+
```js preview-story
|
|
63
|
+
export const closeOverlayFromComponent = () => html`
|
|
64
|
+
<style>
|
|
65
|
+
${demoStyle}
|
|
66
|
+
</style>
|
|
67
|
+
<lion-dialog .config=${{ hidesOnOutsideClick: true, hidesOnEsc: true }}>
|
|
68
|
+
<button slot="invoker">Styled dialog</button>
|
|
69
|
+
<styled-dialog-content slot="content"></styled-dialog-content>
|
|
70
|
+
</lion-dialog>
|
|
71
|
+
`;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Placement overrides
|
|
75
|
+
|
|
76
|
+
```js preview-story
|
|
77
|
+
export const placementOverrides = () => {
|
|
78
|
+
const dialog = placement => html`
|
|
79
|
+
<lion-dialog .config=${{ viewportConfig: { placement } }}>
|
|
80
|
+
<button slot="invoker">Dialog ${placement}</button>
|
|
81
|
+
<div slot="content" class="dialog">
|
|
82
|
+
Hello! You can close this notification here:
|
|
83
|
+
<button
|
|
84
|
+
class="close-button"
|
|
85
|
+
@click=${e => e.target.dispatchEvent(new Event('close-overlay', { bubbles: true }))}
|
|
86
|
+
>
|
|
87
|
+
⨯
|
|
88
|
+
</button>
|
|
89
|
+
</div>
|
|
90
|
+
</lion-dialog>
|
|
91
|
+
`;
|
|
92
|
+
return html`
|
|
93
|
+
<style>
|
|
94
|
+
${demoStyle}
|
|
95
|
+
</style>
|
|
96
|
+
<div class="demo-box_placements">
|
|
97
|
+
${dialog('center')} ${dialog('top-left')} ${dialog('top-right')} ${dialog('bottom-left')}
|
|
98
|
+
${dialog('bottom-right')}
|
|
99
|
+
</div>
|
|
100
|
+
`;
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Configuration passed to `config` property:
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
{
|
|
108
|
+
viewportConfig: {
|
|
109
|
+
placement: ... // <-- choose a position
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Other overrides
|
|
115
|
+
|
|
116
|
+
No backdrop, hides on escape, prevents scrolling while opened, and focuses the body when hiding.
|
|
117
|
+
|
|
118
|
+
```js preview-story
|
|
119
|
+
export const otherOverrides = () => html`
|
|
120
|
+
<style>
|
|
121
|
+
${demoStyle}
|
|
122
|
+
</style>
|
|
123
|
+
<lion-dialog
|
|
124
|
+
.config=${{
|
|
125
|
+
hasBackdrop: false,
|
|
126
|
+
hidesOnEscape: true,
|
|
127
|
+
preventsScroll: true,
|
|
128
|
+
elementToFocusAfterHide: document.body,
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<button slot="invoker">Click me to open dialog</button>
|
|
132
|
+
<div slot="content" class="dialog">
|
|
133
|
+
Hello! You can close this dialog here:
|
|
134
|
+
<button
|
|
135
|
+
class="close-button"
|
|
136
|
+
@click=${e => e.target.dispatchEvent(new Event('close-overlay', { bubbles: true }))}
|
|
137
|
+
>
|
|
138
|
+
⨯
|
|
139
|
+
</button>
|
|
140
|
+
</div>
|
|
141
|
+
</lion-dialog>
|
|
142
|
+
`;
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Configuration passed to `config` property:
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
{
|
|
149
|
+
hasBackdrop: false,
|
|
150
|
+
hidesOnEscape: true,
|
|
151
|
+
preventsScroll: true,
|
|
152
|
+
elementToFocusAfterHide: document.body
|
|
153
|
+
}
|
|
154
|
+
```
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Drawer >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A combination of a button (the invoker) and a chunk of 'extra content'. This web component can be extended with an
|
|
4
|
+
animation to disclose the extra content.
|
|
5
|
+
|
|
6
|
+
There are three slots available respectively; `invoker` to specify the
|
|
7
|
+
drawer's invoker, `headline` for the optional headline and `content` for the content of the drawer.
|
|
8
|
+
|
|
9
|
+
Through the `position` property, the drawer can be placed on the `top`, `left` or `right` of the viewport.
|
|
10
|
+
|
|
11
|
+
```js script
|
|
12
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
13
|
+
import '@lion/ui/define/lion-drawer.js';
|
|
14
|
+
import '@lion/ui/define/lion-icon.js';
|
|
15
|
+
import { icons } from '@lion/ui/icon.js';
|
|
16
|
+
import { demoStyle } from './src/demoStyle.js';
|
|
17
|
+
|
|
18
|
+
icons.addIconResolver('lion', (iconset, name) => {
|
|
19
|
+
switch (iconset) {
|
|
20
|
+
case 'misc':
|
|
21
|
+
return import('../icon/assets/iconset-misc.js').then(module => module[name]);
|
|
22
|
+
default:
|
|
23
|
+
throw new Error(`Unknown iconset ${iconset}`);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```js preview-story
|
|
29
|
+
export const main = () => html`
|
|
30
|
+
<style>
|
|
31
|
+
${demoStyle}
|
|
32
|
+
</style>
|
|
33
|
+
<div class="demo-container">
|
|
34
|
+
<lion-drawer>
|
|
35
|
+
<button slot="invoker">
|
|
36
|
+
<lion-icon icon-id="lion:misc:arrowLeft" style="width: 16px; height: 16px;"></lion-icon>
|
|
37
|
+
</button>
|
|
38
|
+
<p slot="headline">Headline</p>
|
|
39
|
+
<div slot="content" class="drawer">Hello! This is the content of the drawer</div>
|
|
40
|
+
<button slot="bottom-invoker">
|
|
41
|
+
<lion-icon icon-id="lion:misc:arrowLeft" style="width: 16px; height: 16px;"></lion-icon>
|
|
42
|
+
</button>
|
|
43
|
+
</lion-drawer>
|
|
44
|
+
<div>
|
|
45
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum convallis, lorem sit amet
|
|
46
|
+
sollicitudin egestas, dui lectus sodales leo, quis luctus nulla metus vitae lacus. In at
|
|
47
|
+
imperdiet augue. Mauris mauris dolor, faucibus non nulla vel, vulputate hendrerit mauris.
|
|
48
|
+
Praesent dapibus leo nec libero scelerisque, ac venenatis ante tincidunt. Nulla maximus
|
|
49
|
+
vestibulum orci, ac viverra nisi molestie vel. Vivamus eget elit et turpis elementum tempor
|
|
50
|
+
ultricies at turpis. Ut pretium aliquet finibus. Duis ullamcorper ultrices velit id luctus.
|
|
51
|
+
Phasellus in ex luctus, interdum ex vel, eleifend dolor. Cras massa odio, sodales quis
|
|
52
|
+
consectetur a, blandit eu purus. Donec ut gravida libero, sed accumsan arcu.
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
`;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm i --save @lion/ui
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import { LionDrawer } from '@lion/ui/drawer.js';
|
|
66
|
+
// or
|
|
67
|
+
import '@lion/ui/define/lion-drawer.js';
|
|
68
|
+
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export const demoStyle = css`
|
|
4
|
+
.demo-container {
|
|
5
|
+
height: 400px;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.demo-container > div {
|
|
11
|
+
padding: 8px;
|
|
12
|
+
background-color: #f6f8fa;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
lion-drawer {
|
|
16
|
+
height: 400px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
button {
|
|
20
|
+
all: revert !important;
|
|
21
|
+
border: 2px solid #000000;
|
|
22
|
+
background-color: rgb(239, 239, 239);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.demo-container-top {
|
|
26
|
+
height: 400px;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.demo-container-top > div {
|
|
32
|
+
padding: 8px;
|
|
33
|
+
height: 100%;
|
|
34
|
+
background-color: #f6f8fa;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.demo-container-top lion-drawer {
|
|
38
|
+
height: auto;
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.demo-container-right {
|
|
43
|
+
height: 400px;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: row-reverse;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.demo-container-right > div {
|
|
49
|
+
padding: 8px;
|
|
50
|
+
background-color: #f6f8fa;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.demo-container-right lion-drawer {
|
|
54
|
+
height: 400px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.demo-container-opened {
|
|
58
|
+
height: 400px;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: row;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.demo-container-opened > div {
|
|
64
|
+
padding: 8px;
|
|
65
|
+
background-color: #f6f8fa;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.demo-container-opened lion-drawer {
|
|
69
|
+
height: 400px;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Drawer >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import { icons } from '@lion/ui/icon.js';
|
|
6
|
+
import '@lion/ui/define/lion-drawer.js';
|
|
7
|
+
import '@lion/ui/define/lion-icon.js';
|
|
8
|
+
import { demoStyle } from './src/demoStyle.js';
|
|
9
|
+
|
|
10
|
+
icons.addIconResolver('lion', (iconset, name) => {
|
|
11
|
+
switch (iconset) {
|
|
12
|
+
case 'misc':
|
|
13
|
+
return import('../icon/assets/iconset-misc.js').then(module => module[name]);
|
|
14
|
+
default:
|
|
15
|
+
throw new Error(`Unknown iconset ${iconset}`);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Positioning
|
|
21
|
+
|
|
22
|
+
### Default left
|
|
23
|
+
|
|
24
|
+
By default, the drawer is positioned on the left side of the viewport.
|
|
25
|
+
|
|
26
|
+
With the `position` property it can be positioned at the top or on the right of the screen.
|
|
27
|
+
|
|
28
|
+
### Top
|
|
29
|
+
|
|
30
|
+
```js preview-story
|
|
31
|
+
export const top = () => html`
|
|
32
|
+
<style>
|
|
33
|
+
${demoStyle}
|
|
34
|
+
</style>
|
|
35
|
+
<div class="demo-container-top">
|
|
36
|
+
<lion-drawer position="top">
|
|
37
|
+
<button slot="invoker">
|
|
38
|
+
<lion-icon icon-id="lion:misc:arrowLeft" style="width: 16px; height: 16px;"></lion-icon>
|
|
39
|
+
</button>
|
|
40
|
+
<p slot="headline">Headline</p>
|
|
41
|
+
<div slot="content" class="drawer">Hello! This is the content of the drawer</div>
|
|
42
|
+
</lion-drawer>
|
|
43
|
+
<div>
|
|
44
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum convallis, lorem sit amet
|
|
45
|
+
sollicitudin egestas, dui lectus sodales leo, quis luctus nulla metus vitae lacus. In at
|
|
46
|
+
imperdiet augue. Mauris mauris dolor, faucibus non nulla vel, vulputate hendrerit mauris.
|
|
47
|
+
Praesent dapibus leo nec libero scelerisque, ac venenatis ante tincidunt. Nulla maximus
|
|
48
|
+
vestibulum orci, ac viverra nisi molestie vel. Vivamus eget elit et turpis elementum tempor
|
|
49
|
+
ultricies at turpis. Ut pretium aliquet finibus. Duis ullamcorper ultrices velit id luctus.
|
|
50
|
+
Phasellus in ex luctus, interdum ex vel, eleifend dolor. Cras massa odio, sodales quis
|
|
51
|
+
consectetur a, blandit eu purus. Donec ut gravida libero, sed accumsan arcu.
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Right
|
|
58
|
+
|
|
59
|
+
```js preview-story
|
|
60
|
+
export const right = () => html`
|
|
61
|
+
<style>
|
|
62
|
+
${demoStyle}
|
|
63
|
+
</style>
|
|
64
|
+
<div class="demo-container-right">
|
|
65
|
+
<lion-drawer position="right">
|
|
66
|
+
<button slot="invoker">
|
|
67
|
+
<lion-icon icon-id="lion:misc:arrowLeft" style="width: 16px; height: 16px;"></lion-icon>
|
|
68
|
+
</button>
|
|
69
|
+
<p slot="headline">Headline</p>
|
|
70
|
+
<div slot="content" class="drawer">Hello! This is the content of the drawer</div>
|
|
71
|
+
</lion-drawer>
|
|
72
|
+
<div>
|
|
73
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum convallis, lorem sit amet
|
|
74
|
+
sollicitudin egestas, dui lectus sodales leo, quis luctus nulla metus vitae lacus. In at
|
|
75
|
+
imperdiet augue. Mauris mauris dolor, faucibus non nulla vel, vulputate hendrerit mauris.
|
|
76
|
+
Praesent dapibus leo nec libero scelerisque, ac venenatis ante tincidunt. Nulla maximus
|
|
77
|
+
vestibulum orci, ac viverra nisi molestie vel. Vivamus eget elit et turpis elementum tempor
|
|
78
|
+
ultricies at turpis. Ut pretium aliquet finibus. Duis ullamcorper ultrices velit id luctus.
|
|
79
|
+
Phasellus in ex luctus, interdum ex vel, eleifend dolor. Cras massa odio, sodales quis
|
|
80
|
+
consectetur a, blandit eu purus. Donec ut gravida libero, sed accumsan arcu.
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
`;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Opened
|
|
87
|
+
|
|
88
|
+
Add the `opened` attribute to display the drawer opened.
|
|
89
|
+
|
|
90
|
+
```js preview-story
|
|
91
|
+
export const opened = () => html`
|
|
92
|
+
<style>
|
|
93
|
+
${demoStyle}
|
|
94
|
+
</style>
|
|
95
|
+
<div class="demo-container">
|
|
96
|
+
<lion-drawer opened>
|
|
97
|
+
<p slot="headline">Headline</p>
|
|
98
|
+
<div slot="content" class="drawer">Hello! This is the content of the drawer</div>
|
|
99
|
+
</lion-drawer>
|
|
100
|
+
<div>
|
|
101
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum convallis, lorem sit amet
|
|
102
|
+
sollicitudin egestas, dui lectus sodales leo, quis luctus nulla metus vitae lacus. In at
|
|
103
|
+
imperdiet augue. Mauris mauris dolor, faucibus non nulla vel, vulputate hendrerit mauris.
|
|
104
|
+
Praesent dapibus leo nec libero scelerisque, ac venenatis ante tincidunt. Nulla maximus
|
|
105
|
+
vestibulum orci, ac viverra nisi molestie vel. Vivamus eget elit et turpis elementum tempor
|
|
106
|
+
ultricies at turpis. Ut pretium aliquet finibus. Duis ullamcorper ultrices velit id luctus.
|
|
107
|
+
Phasellus in ex luctus, interdum ex vel, eleifend dolor. Cras massa odio, sodales quis
|
|
108
|
+
consectetur a, blandit eu purus. Donec ut gravida libero, sed accumsan arcu.
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
`;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Methods
|
|
115
|
+
|
|
116
|
+
There are the following methods available to control the extra content for the drawer.
|
|
117
|
+
|
|
118
|
+
- `toggle()`: toggle the extra content
|
|
119
|
+
- `show()`: show the extra content
|
|
120
|
+
- `hide()`: hide the extra content
|
|
121
|
+
|
|
122
|
+
```js preview-story
|
|
123
|
+
export const methods = ({ shadowRoot }) => html`
|
|
124
|
+
<style>
|
|
125
|
+
${demoStyle}
|
|
126
|
+
</style>
|
|
127
|
+
<section style="margin-top:16px">
|
|
128
|
+
<button @click=${() => shadowRoot.querySelector('#drawer').toggle()}>Toggle content</button>
|
|
129
|
+
<button @click=${() => shadowRoot.querySelector('#drawer').show()}>Show content</button>
|
|
130
|
+
<button @click=${() => shadowRoot.querySelector('#drawer').hide()}>Hide content</button>
|
|
131
|
+
</section>
|
|
132
|
+
|
|
133
|
+
<div class="demo-container">
|
|
134
|
+
<lion-drawer id="drawer">
|
|
135
|
+
<button slot="invoker">
|
|
136
|
+
<lion-icon icon-id="lion:misc:arrowLeft" style="width: 16px; height: 16px;"></lion-icon>
|
|
137
|
+
</button>
|
|
138
|
+
<p slot="headline">Headline</p>
|
|
139
|
+
<div slot="content" class="drawer">Hello! This is the content of the drawer</div>
|
|
140
|
+
</lion-drawer>
|
|
141
|
+
<div>
|
|
142
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum convallis, lorem sit amet
|
|
143
|
+
sollicitudin egestas, dui lectus sodales leo, quis luctus nulla metus vitae lacus. In at
|
|
144
|
+
imperdiet augue. Mauris mauris dolor, faucibus non nulla vel, vulputate hendrerit mauris.
|
|
145
|
+
Praesent dapibus leo nec libero scelerisque, ac venenatis ante tincidunt. Nulla maximus
|
|
146
|
+
vestibulum orci, ac viverra nisi molestie vel. Vivamus eget elit et turpis elementum tempor
|
|
147
|
+
ultricies at turpis. Ut pretium aliquet finibus. Duis ullamcorper ultrices velit id luctus.
|
|
148
|
+
Phasellus in ex luctus, interdum ex vel, eleifend dolor. Cras massa odio, sodales quis
|
|
149
|
+
consectetur a, blandit eu purus. Donec ut gravida libero, sed accumsan arcu.
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
`;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Events
|
|
156
|
+
|
|
157
|
+
`lion-drawer` fires an event on `invoker` click to notify the component's current state. It is useful for analytics purposes or to perform some actions while expanding and collapsing the component.
|
|
158
|
+
|
|
159
|
+
- `@opened-changed`: triggers when drawer either gets opened or closed
|
|
160
|
+
|
|
161
|
+
```js preview-story
|
|
162
|
+
export const events = ({ shadowRoot }) => html`
|
|
163
|
+
<style>
|
|
164
|
+
${demoStyle}
|
|
165
|
+
</style>
|
|
166
|
+
<div class="demo-custom-collapsible-state-container">
|
|
167
|
+
<strong id="collapsible-state"></strong>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="demo-container">
|
|
170
|
+
<lion-drawer
|
|
171
|
+
@opened-changed=${ev => {
|
|
172
|
+
const collapsibleState = shadowRoot.querySelector('#collapsible-state');
|
|
173
|
+
collapsibleState.innerText = `Opened: ${ev.target.opened}`;
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
176
|
+
<button slot="invoker">
|
|
177
|
+
<lion-icon icon-id="lion:misc:arrowLeft" style="width: 16px; height: 16px;"></lion-icon>
|
|
178
|
+
</button>
|
|
179
|
+
<p slot="headline">Headline</p>
|
|
180
|
+
<div slot="content" class="drawer">Hello! This is the content of the drawer</div>
|
|
181
|
+
</lion-drawer>
|
|
182
|
+
<div>
|
|
183
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum convallis, lorem sit amet
|
|
184
|
+
sollicitudin egestas, dui lectus sodales leo, quis luctus nulla metus vitae lacus. In at
|
|
185
|
+
imperdiet augue. Mauris mauris dolor, faucibus non nulla vel, vulputate hendrerit mauris.
|
|
186
|
+
Praesent dapibus leo nec libero scelerisque, ac venenatis ante tincidunt. Nulla maximus
|
|
187
|
+
vestibulum orci, ac viverra nisi molestie vel. Vivamus eget elit et turpis elementum tempor
|
|
188
|
+
ultricies at turpis. Ut pretium aliquet finibus. Duis ullamcorper ultrices velit id luctus.
|
|
189
|
+
Phasellus in ex luctus, interdum ex vel, eleifend dolor. Cras massa odio, sodales quis
|
|
190
|
+
consectetur a, blandit eu purus. Donec ut gravida libero, sed accumsan arcu.
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
`;
|
|
194
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Fieldset >> Overview ||10
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
|
|
6
|
+
import '@lion/ui/define/lion-input.js';
|
|
7
|
+
import '@lion/ui/define/lion-fieldset.js';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
A web component that can be used to group multiple input fields or other fieldsets together.
|
|
11
|
+
|
|
12
|
+
```js preview-story
|
|
13
|
+
export const main = () => html`
|
|
14
|
+
<lion-fieldset name="nameGroup" label="Name">
|
|
15
|
+
<lion-input name="firstName" label="First Name" .modelValue=${'Foo'}></lion-input>
|
|
16
|
+
<lion-input name="lastName" label="Last Name" .modelValue=${'Bar'}></lion-input>
|
|
17
|
+
</lion-fieldset>
|
|
18
|
+
`;
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
We have three specific fieldset implementations:
|
|
22
|
+
|
|
23
|
+
- [form](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/form/overview.md)
|
|
24
|
+
- [checkbox-group](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/checkbox-group/overview.md)
|
|
25
|
+
- [radio-group](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/radio-group/overview.md)
|
|
26
|
+
|
|
27
|
+
A native fieldset element should always have a legend-element for a11y purposes.
|
|
28
|
+
However, our fieldset element is not native and should not have a legend-element.
|
|
29
|
+
Our fieldset instead has a label attribute or you can add a label with a div- or heading-element using `slot="label"`.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- Easy retrieval of form data based on field names
|
|
34
|
+
- Advanced user interaction scenarios via [interaction states](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/interaction-states.md)
|
|
35
|
+
- Can have [validate](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/validate.md) on fieldset level and shows the validation feedback below the fieldset
|
|
36
|
+
- Can disable input fields on fieldset level
|
|
37
|
+
- Accessible out of the box
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm i --save @lion/ui
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import { LionFieldset } from '@lion/ui/fieldset.js';
|
|
47
|
+
// or
|
|
48
|
+
import '@lion/ui/define/lion-fieldset.js';
|
|
49
|
+
```
|