@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,40 @@
|
|
|
1
|
+
# Icon >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A web component for displaying icons.
|
|
4
|
+
|
|
5
|
+
```js script
|
|
6
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
7
|
+
import { icons } from '@lion/ui/icon.js';
|
|
8
|
+
import '@lion/ui/define/lion-icon.js';
|
|
9
|
+
|
|
10
|
+
icons.addIconResolver('lion', (iconset, name) => {
|
|
11
|
+
switch (iconset) {
|
|
12
|
+
case 'bugs':
|
|
13
|
+
return import('./assets/iconset-bugs.js').then(module => module[name]);
|
|
14
|
+
case 'space':
|
|
15
|
+
return import('./assets/iconset-space.js').then(module => module[name]);
|
|
16
|
+
case 'misc':
|
|
17
|
+
return import('./assets/iconset-misc.js').then(module => module[name]);
|
|
18
|
+
default:
|
|
19
|
+
throw new Error(`Unknown iconset ${iconset}`);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```js preview-story
|
|
25
|
+
export const main = () => html`
|
|
26
|
+
<lion-icon icon-id="lion:space:alienSpaceship" style="width: 50px; height: 50px;"></lion-icon>
|
|
27
|
+
`;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm i --save @lion/ui
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import { LionIcon } from '@lion/ui/icon.js';
|
|
38
|
+
// or
|
|
39
|
+
import '@lion/ui/define/lion-icon.js';
|
|
40
|
+
```
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Icon >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import { icons } from '@lion/ui/icon.js';
|
|
6
|
+
import './assets/iconset-bugs.js';
|
|
7
|
+
import './assets/iconset-misc.js';
|
|
8
|
+
import * as spaceSet from './assets/iconset-space.js';
|
|
9
|
+
|
|
10
|
+
import '@lion/ui/define/lion-icon.js';
|
|
11
|
+
|
|
12
|
+
icons.addIconResolver('lion', (iconset, name) => {
|
|
13
|
+
switch (iconset) {
|
|
14
|
+
case 'bugs':
|
|
15
|
+
return import('./assets/iconset-bugs.js').then(module => module[name]);
|
|
16
|
+
case 'space':
|
|
17
|
+
return import('./assets/iconset-space.js').then(module => module[name]);
|
|
18
|
+
case 'misc':
|
|
19
|
+
return import('./assets/iconset-misc.js').then(module => module[name]);
|
|
20
|
+
default:
|
|
21
|
+
throw new Error(`Unknown iconset ${iconset}`);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Icon sets
|
|
27
|
+
|
|
28
|
+
Icons are displayed using icon sets. These are collections of icons, lazily loaded on demand for performance.
|
|
29
|
+
See the [system documentation](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/icon/overview.md) to learn more about icon sets.
|
|
30
|
+
|
|
31
|
+
```js preview-story
|
|
32
|
+
export const iconSets = () => html`
|
|
33
|
+
${Object.keys(spaceSet).map(
|
|
34
|
+
name => html`
|
|
35
|
+
<style>
|
|
36
|
+
.demo-icon__container {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
position: relative;
|
|
39
|
+
flex-grow: 1;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
align-items: center;
|
|
42
|
+
width: 80px;
|
|
43
|
+
height: 80px;
|
|
44
|
+
padding: 4px;
|
|
45
|
+
}
|
|
46
|
+
.demo-icon__name {
|
|
47
|
+
font-size: 10px;
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
50
|
+
<div class="demo-icon__container">
|
|
51
|
+
<lion-icon icon-id="lion:space:${name}" aria-label="${name}"></lion-icon>
|
|
52
|
+
<span class="demo-icon__name">${name}</span>
|
|
53
|
+
</div>
|
|
54
|
+
`,
|
|
55
|
+
)}
|
|
56
|
+
`;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If for some reason you don't want to lazy load icons, you can still import and use them
|
|
60
|
+
synchronously.
|
|
61
|
+
|
|
62
|
+
## Accessibility
|
|
63
|
+
|
|
64
|
+
It is recommended to add an `aria-label` to provide information to visually impaired users:
|
|
65
|
+
|
|
66
|
+
A `lion-icon` without an `aria-label` attribute will be automatically given an `aria-hidden` attribute.
|
|
67
|
+
|
|
68
|
+
```js preview-story
|
|
69
|
+
export const accessibleLabel = () => html`
|
|
70
|
+
<lion-icon icon-id="lion:misc:arrowLeft" aria-label="Pointing left"></lion-icon>
|
|
71
|
+
`;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Styling
|
|
75
|
+
|
|
76
|
+
By default, a `lion-icon` will be `1em` × `1em` (the current line-height).
|
|
77
|
+
|
|
78
|
+
`lion-icon` uses SVGs and may be styled with CSS, including using CSS properties such as `fill`:
|
|
79
|
+
|
|
80
|
+
```js preview-story
|
|
81
|
+
export const Styling = () => html`
|
|
82
|
+
<style>
|
|
83
|
+
.demo-icon {
|
|
84
|
+
width: 160px;
|
|
85
|
+
height: 160px;
|
|
86
|
+
fill: blue;
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
89
|
+
<lion-icon icon-id="lion:bugs:bug02" aria-label="Bug" class="demo-icon"></lion-icon>
|
|
90
|
+
`;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
See [SVG and CSS](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_and_CSS) on MDN web docs for more information.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Components ||40
|
|
2
|
+
|
|
3
|
+
Components are one of the key building blocks of the design system. Their systematic reuse helps to create visual and functional consistency across products.
|
|
4
|
+
|
|
5
|
+
## Got feedback?
|
|
6
|
+
|
|
7
|
+
We are always looking for ways on how to improve the our guidelines. If you have any specific need, idea or just want to tell us what you think - [please get in touch here](https://github.com/ing-bank/lion/blob/master/CONTRIBUTING.md).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Input >> Overview ||10
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import '@lion/ui/define/lion-input.js';
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
A web component that enhances the functionality of the native `<input>` element.
|
|
9
|
+
|
|
10
|
+
```js preview-story
|
|
11
|
+
export const main = () => html`<lion-input label="First Name"></lion-input>`;
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- Extra visual elements can be added via `slots`:
|
|
17
|
+
- **label**: can also be provided via the `label` attribute, but the slot can be used to change the `html` and `CSS` of the label.
|
|
18
|
+
For example add an `u-sr-only` class to the label to make it visually hidden.
|
|
19
|
+
A label is always needed for accessibility reasons.
|
|
20
|
+
- **help-text**: a helper text shown below the label to give extra clarification.
|
|
21
|
+
- **prefix**: does not have an active use case yet, but the option is in place.
|
|
22
|
+
- **suffix**: can be used for addons to the input like a calculator, datepicker or addressbook. In these cases a button with an icon is used.
|
|
23
|
+
- **before**: does not have an active use case yet, but the option is in place.
|
|
24
|
+
- **after**: can be used to show a currency or percentage.
|
|
25
|
+
- Delegates attributes like `type`, `disabled`, `placeholder` and `readonly` to the native input.
|
|
26
|
+
- Can make use of [validation](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/validate.md).
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm i --save @lion/ui
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import '@lion/ui/define/lion-input.js';
|
|
36
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Input >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import '@lion/ui/define/lion-input.js';
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Label
|
|
9
|
+
|
|
10
|
+
Can be provided via the `label` attribute or via the `slot="label"`.
|
|
11
|
+
|
|
12
|
+
```js preview-story
|
|
13
|
+
export const label = () => html` <lion-input label="Input" name="input"></lion-input> `;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Label sr-only (a11y)
|
|
17
|
+
|
|
18
|
+
Can be provided via the `label-sr-only` boolean attribute.
|
|
19
|
+
|
|
20
|
+
The label will be hidden, but still readable by screen readers.
|
|
21
|
+
|
|
22
|
+
```js preview-story
|
|
23
|
+
export const labelSrOnly = () =>
|
|
24
|
+
html` <lion-input label-sr-only label="Input" name="input"></lion-input> `;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
> Note: Once we support the ElementInternals API, the equivalent will be `<lion-input aria-label="Input" name="input"></lion-input>`
|
|
28
|
+
|
|
29
|
+
## Help-text
|
|
30
|
+
|
|
31
|
+
A helper text shown below the label to give extra clarification.
|
|
32
|
+
|
|
33
|
+
Just like the `label`, a `help-text` can be provided via the `help-text` attribute, a slot can be used to change the `html` and `CSS` of the help-text.
|
|
34
|
+
For example add an anchor with further explanation.
|
|
35
|
+
|
|
36
|
+
```js preview-story
|
|
37
|
+
export const helpText = () => html`
|
|
38
|
+
<lion-input>
|
|
39
|
+
<label slot="label">Label</label>
|
|
40
|
+
<div slot="help-text">
|
|
41
|
+
Help text using <a href="https://example.com/" target="_blank">html</a>
|
|
42
|
+
</div>
|
|
43
|
+
</lion-input>
|
|
44
|
+
`;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Prefilled
|
|
48
|
+
|
|
49
|
+
```js preview-story
|
|
50
|
+
export const prefilled = () => html`
|
|
51
|
+
<lion-input .modelValue=${'Prefilled value'} label="Prefilled"></lion-input>
|
|
52
|
+
`;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Read only
|
|
56
|
+
|
|
57
|
+
`readonly` attribute will be delegated to the native `<input>` to make it read-only.
|
|
58
|
+
|
|
59
|
+
This field **will still be included** in the parent fieldset or form's `serializedValue`.
|
|
60
|
+
|
|
61
|
+
```js preview-story
|
|
62
|
+
export const readOnly = () => html`
|
|
63
|
+
<lion-input readonly .modelValue=${'This is read only'} label="Read only"></lion-input>
|
|
64
|
+
`;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Disabled
|
|
68
|
+
|
|
69
|
+
`disabled` attribute will be delegated to the native `<input>` to make it disabled.
|
|
70
|
+
|
|
71
|
+
This field **will not be included** in the parent fieldset or form's `serializedValue`.
|
|
72
|
+
|
|
73
|
+
```js preview-story
|
|
74
|
+
export const disabled = () => html`
|
|
75
|
+
<lion-input disabled .modelValue=${'This is disabled'} label="Disabled"></lion-input>
|
|
76
|
+
`;
|
|
77
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Input Amount >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A web component based on the generic text input field. Its purpose is to provide a way for users to fill in an amount.
|
|
4
|
+
|
|
5
|
+
For formatting, we use [Intl NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat) with some overrides.
|
|
6
|
+
|
|
7
|
+
For parsing user input, we provide our own parser that takes into account a number of heuristics, locale and ignores invalid characters.
|
|
8
|
+
Valid characters are digits and separators. Formatting happens on-blur.
|
|
9
|
+
|
|
10
|
+
If there are no valid characters in the input whatsoever, it will provide an error feedback.
|
|
11
|
+
|
|
12
|
+
```js script
|
|
13
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
14
|
+
import '@lion/ui/define/lion-input-amount.js';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```js preview-story
|
|
18
|
+
export const main = () => {
|
|
19
|
+
return html`
|
|
20
|
+
<lion-input-amount label="Amount" name="amount" currency="USD"></lion-input-amount>
|
|
21
|
+
`;
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- Based on our [input](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input/overview.md)
|
|
28
|
+
- Makes use of [formatNumber](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/localize/numbers.md) for formatting and parsing.
|
|
29
|
+
- Option to show currency as a suffix
|
|
30
|
+
- Option to override locale to change the formatting and parsing
|
|
31
|
+
- Option to provide additional format options overrides
|
|
32
|
+
- Default label in different languages
|
|
33
|
+
- Can make use of number specific [validators](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/validate.md) with corresponding error messages in different languages
|
|
34
|
+
- IsNumber (default)
|
|
35
|
+
- MinNumber
|
|
36
|
+
- MaxNumber
|
|
37
|
+
- MinMaxNumber
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm i --save @lion/ui
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import { LionInputAmount } from '@lion/ui/input-amount.js';
|
|
47
|
+
// or
|
|
48
|
+
import '@lion/ui/define/lion-input-amount.js';
|
|
49
|
+
```
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Input Amount >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import { MaxLength } from '@lion/ui/form-core.js';
|
|
6
|
+
import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js';
|
|
7
|
+
|
|
8
|
+
import { localize } from '@lion/ui/localize.js';
|
|
9
|
+
|
|
10
|
+
import '@lion/ui/define/lion-input-amount.js';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Negative Number
|
|
14
|
+
|
|
15
|
+
It will accept negative numbers with a minus symbol.
|
|
16
|
+
|
|
17
|
+
```js preview-story
|
|
18
|
+
export const negativeNumber = () => html`
|
|
19
|
+
<lion-input-amount label="Amount" .modelValue=${-123456.78}></lion-input-amount>
|
|
20
|
+
`;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Set currency suffix
|
|
24
|
+
|
|
25
|
+
You can optionally set a currency suffix with the `currency` attribute.
|
|
26
|
+
|
|
27
|
+
```js preview-story
|
|
28
|
+
export const currencySuffix = () => html`
|
|
29
|
+
<lion-input-amount label="Price" currency="USD" .modelValue=${123456.78}></lion-input-amount>
|
|
30
|
+
`;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Force locale
|
|
34
|
+
|
|
35
|
+
Locale can be forced for a specific `lion-input-amount`. It will format the amount according to this locale.
|
|
36
|
+
|
|
37
|
+
```js preview-story
|
|
38
|
+
export const forceLocale = () => {
|
|
39
|
+
return html`
|
|
40
|
+
<lion-input-amount
|
|
41
|
+
label="Price"
|
|
42
|
+
currency="JOD"
|
|
43
|
+
.locale="nl-NL"
|
|
44
|
+
.modelValue=${123456.78}
|
|
45
|
+
></lion-input-amount>
|
|
46
|
+
`;
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> The separators are now flipped due to Dutch locale. On top of that, due to JOD currency, the minimum amount of decimals is 3 by default for this currency.
|
|
51
|
+
|
|
52
|
+
## Force digits as input
|
|
53
|
+
|
|
54
|
+
You can use the `preprocessAmount` preprocessor to disable users from inputting anything other than digits or separator characters.
|
|
55
|
+
This is not added by default, but you can add it yourself.
|
|
56
|
+
|
|
57
|
+
Separator characters include:
|
|
58
|
+
|
|
59
|
+
- ' ' (space)
|
|
60
|
+
- . (dot)
|
|
61
|
+
- , (comma)
|
|
62
|
+
|
|
63
|
+
```js preview-story
|
|
64
|
+
import { preprocessAmount } from '@lion/ui/input-amount.js';
|
|
65
|
+
|
|
66
|
+
export const forceDigits = () => html`
|
|
67
|
+
<lion-input-amount label="Amount" .preprocessor=${preprocessAmount}></lion-input-amount>
|
|
68
|
+
`;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Faulty prefilled
|
|
72
|
+
|
|
73
|
+
This example will show the error message by prefilling it with a faulty `modelValue`.
|
|
74
|
+
|
|
75
|
+
> If there is 1 or more digit in the input, it will ignore invalid characters instead of showing an error feedback message.
|
|
76
|
+
|
|
77
|
+
```js preview-story
|
|
78
|
+
export const faultyPrefilled = () => html`
|
|
79
|
+
<lion-input-amount
|
|
80
|
+
label="Amount"
|
|
81
|
+
help-text="Faulty prefilled input will cause error feedback"
|
|
82
|
+
.modelValue=${'foo'}
|
|
83
|
+
></lion-input-amount>
|
|
84
|
+
`;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Modifying the amount of decimals
|
|
88
|
+
|
|
89
|
+
You can override certain formatting options similar to how you would do this when using [Intl NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat).
|
|
90
|
+
This example shows formatting to whole numbers.
|
|
91
|
+
|
|
92
|
+
```js preview-story
|
|
93
|
+
export const noDecimals = () => html`
|
|
94
|
+
<lion-input-amount
|
|
95
|
+
label="Amount"
|
|
96
|
+
help-text="Prefilled and formatted"
|
|
97
|
+
.formatOptions=${{
|
|
98
|
+
minimumFractionDigits: 0,
|
|
99
|
+
maximumFractionDigits: 0,
|
|
100
|
+
}}
|
|
101
|
+
.modelValue=${20}
|
|
102
|
+
>
|
|
103
|
+
</lion-input-amount>
|
|
104
|
+
`;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Paste behavior
|
|
108
|
+
|
|
109
|
+
For copy pasting numbers into the input-amount, there is slightly different parsing behavior.
|
|
110
|
+
|
|
111
|
+
Normally, when it receives an input with only 1 separator character, we check the locale to determine whether this character is a group (thousand) separator, or a decimal separator.
|
|
112
|
+
When a user pastes the input from a different source, we find this approach (locale-based) quite unreliable, because it may have been copied from a 'mathematical context' (like an Excel sheet) or a context with a different locale.
|
|
113
|
+
Therefore, we use the heuristics based method to parse the input when it is pasted by the user.
|
|
114
|
+
|
|
115
|
+
### What this means
|
|
116
|
+
|
|
117
|
+
If the user in an English locale types `400,0` it will become `4,000.00`
|
|
118
|
+
because the locale determines that the comma is a group separator, not a decimal separator.
|
|
119
|
+
|
|
120
|
+
If the user in an English locale pastes `400,0` instead, it will become `400.00` because we cannot rely on locale.
|
|
121
|
+
Therefore, instead, we determine that the comma cannot be a group separator because it is not followed by 3 digits after.
|
|
122
|
+
It is more likely to be a decimal separator.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Input Date >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A web component based on the generic text input field. Its purpose is to provide a way for users to fill in a date.
|
|
4
|
+
|
|
5
|
+
```js script
|
|
6
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
7
|
+
import { MinDate, MinMaxDate, MaxDate } from '@lion/ui/form-core.js';
|
|
8
|
+
import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js';
|
|
9
|
+
import { formatDate } from '@lion/ui/localize.js';
|
|
10
|
+
import '@lion/ui/define/lion-input-date.js';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```js preview-story
|
|
14
|
+
export const main = () => html` <lion-input-date label="Date"></lion-input-date> `;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Based on our [input](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input/overview.md)
|
|
20
|
+
- Makes use of [formatDate](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/localize/dates.md) for formatting and parsing.
|
|
21
|
+
- Option to override locale to change the formatting and parsing
|
|
22
|
+
- Default label in different languages
|
|
23
|
+
- Can make use of date specific [validators](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/validate.md) with corresponding error messages in different languages
|
|
24
|
+
- IsDate (default)
|
|
25
|
+
- MinDate
|
|
26
|
+
- MaxDate
|
|
27
|
+
- MinMaxDate
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm i --save @lion/ui
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
import { LionInputDate } from '@lion/ui/input-date.js';
|
|
37
|
+
// or
|
|
38
|
+
import '@lion/ui/define/lion-input-date.js';
|
|
39
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Input Date >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import { MinDate, MinMaxDate, MaxDate } from '@lion/ui/form-core.js';
|
|
6
|
+
import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js';
|
|
7
|
+
import { formatDate } from '@lion/ui/localize.js';
|
|
8
|
+
import '@lion/ui/define/lion-input-date.js';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Is a date
|
|
12
|
+
|
|
13
|
+
```js preview-story
|
|
14
|
+
export const isADate = () => html`
|
|
15
|
+
<lion-input-date label="IsDate" .modelValue=${new Date('foo')}> </lion-input-date>
|
|
16
|
+
`;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## With minimum date
|
|
20
|
+
|
|
21
|
+
```js preview-story
|
|
22
|
+
export const withMinimumDate = () => {
|
|
23
|
+
loadDefaultFeedbackMessages();
|
|
24
|
+
return html`
|
|
25
|
+
<lion-input-date
|
|
26
|
+
label="MinDate"
|
|
27
|
+
help-text="Enter a date greater than or equal to today."
|
|
28
|
+
.modelValue=${new Date('2018/05/30')}
|
|
29
|
+
.validators=${[new MinDate(new Date())]}
|
|
30
|
+
>
|
|
31
|
+
</lion-input-date>
|
|
32
|
+
`;
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## With maximum date
|
|
37
|
+
|
|
38
|
+
```js preview-story
|
|
39
|
+
export const withMaximumDate = () => {
|
|
40
|
+
loadDefaultFeedbackMessages();
|
|
41
|
+
return html`
|
|
42
|
+
<lion-input-date
|
|
43
|
+
label="MaxDate"
|
|
44
|
+
help-text="Enter a date smaller than or equal to today."
|
|
45
|
+
.modelValue=${new Date('2100/05/30')}
|
|
46
|
+
.validators=${[new MaxDate(new Date())]}
|
|
47
|
+
></lion-input-date>
|
|
48
|
+
`;
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## With minimum and maximum date
|
|
53
|
+
|
|
54
|
+
```js preview-story
|
|
55
|
+
export const withMinimumAndMaximumDate = () => {
|
|
56
|
+
loadDefaultFeedbackMessages();
|
|
57
|
+
return html`
|
|
58
|
+
<lion-input-date
|
|
59
|
+
label="MinMaxDate"
|
|
60
|
+
.modelValue=${new Date('2018/05/30')}
|
|
61
|
+
.validators=${[new MinMaxDate({ min: new Date('2018/05/24'), max: new Date('2018/06/24') })]}
|
|
62
|
+
>
|
|
63
|
+
<div slot="help-text">
|
|
64
|
+
Enter a date between ${formatDate(new Date('2018/05/24'))} and ${formatDate(
|
|
65
|
+
new Date('2018/06/24'),
|
|
66
|
+
)}.
|
|
67
|
+
</div>
|
|
68
|
+
</lion-input-date>
|
|
69
|
+
`;
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Faulty prefilled
|
|
74
|
+
|
|
75
|
+
```js preview-story
|
|
76
|
+
export const faultyPrefilled = () => html`
|
|
77
|
+
<lion-input-date
|
|
78
|
+
label="Date"
|
|
79
|
+
help-text="Faulty prefilled input will be cleared"
|
|
80
|
+
.modelValue=${'foo'}
|
|
81
|
+
></lion-input-date>
|
|
82
|
+
`;
|
|
83
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Input Datepicker >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A web component based on the date text input field. Its purpose is to provide a way for users to fill in a date with a datepicker.
|
|
4
|
+
For an input field with a big range, such as `birthday-input`, a datepicker is not the best choice due to the high variance between possible inputs.
|
|
5
|
+
We encourage using our standard [input-date](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-date/overview.md) for this.
|
|
6
|
+
|
|
7
|
+
```js script
|
|
8
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
9
|
+
import '@lion/ui/define/lion-input-datepicker.js';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```js preview-story
|
|
13
|
+
export const main = () => {
|
|
14
|
+
return html` <lion-input-datepicker label="Date" name="date"></lion-input-datepicker> `;
|
|
15
|
+
};
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Input field with a datepicker to help to choose a date
|
|
21
|
+
- Based on our [input-date](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-date/overview.md)
|
|
22
|
+
- Makes use of our [calendar](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/calendar/overview.md) inside the datepicker
|
|
23
|
+
- Makes use of [formatDate](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/localize/dates.md) for formatting and parsing.
|
|
24
|
+
- Option to overwrite locale to change the formatting and parsing
|
|
25
|
+
- Can make use of date specific [validators](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/validate.md) with corresponding error messages in different languages
|
|
26
|
+
- IsDate (default)
|
|
27
|
+
- MinDate
|
|
28
|
+
- MaxDate
|
|
29
|
+
- MinMaxDate
|
|
30
|
+
- IsDateDisabled
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm i --save @lion/ui
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import { LionInputDatepicker } from '@lion/ui/input-datepicker.js';
|
|
40
|
+
// or
|
|
41
|
+
import '@lion/ui/define/lion-input-datepicker.js';
|
|
42
|
+
```
|