@lion/ui 0.0.1 → 0.0.3
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/test/SlotMixin.test.js +28 -21
- package/components/drawer/src/LionDrawer.js +217 -0
- package/components/drawer/src/drawerStyle.js +59 -0
- package/components/drawer/test/lion-drawer.test.js +109 -0
- package/components/localize/src/number/parseNumber.js +15 -36
- package/components/localize/test/number/parseNumber.test.js +3 -12
- package/custom-elements.json +743 -0
- package/dist-types/components/drawer/src/LionDrawer.d.ts +67 -0
- package/dist-types/components/drawer/src/LionDrawer.d.ts.map +1 -0
- package/dist-types/components/drawer/src/drawerStyle.d.ts +2 -0
- package/dist-types/components/drawer/src/drawerStyle.d.ts.map +1 -0
- package/dist-types/components/drawer/test/lion-drawer.test.d.ts +3 -0
- package/dist-types/components/drawer/test/lion-drawer.test.d.ts.map +1 -0
- package/dist-types/components/localize/src/number/parseNumber.d.ts.map +1 -1
- package/dist-types/exports/define/lion-drawer.d.ts +2 -0
- package/dist-types/exports/define/lion-drawer.d.ts.map +1 -0
- package/dist-types/exports/drawer.d.ts +2 -0
- package/dist-types/exports/drawer.d.ts.map +1 -0
- 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/define/lion-drawer.js +3 -0
- package/exports/drawer.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Input Datepicker >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import { MinMaxDate, IsDateDisabled } 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-datepicker.js';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Minimum and maximum date
|
|
12
|
+
|
|
13
|
+
Below are examples of different validators for dates.
|
|
14
|
+
|
|
15
|
+
```js preview-story
|
|
16
|
+
export const minimumAndMaximumDate = () => html`
|
|
17
|
+
<lion-input-datepicker
|
|
18
|
+
label="MinMaxDate"
|
|
19
|
+
.modelValue=${new Date('2018/05/30')}
|
|
20
|
+
.validators=${[new MinMaxDate({ min: new Date('2018/05/24'), max: new Date('2018/06/24') })]}
|
|
21
|
+
>
|
|
22
|
+
<div slot="help-text">
|
|
23
|
+
Enter a date between ${formatDate(new Date('2018/05/24'))} and ${formatDate(
|
|
24
|
+
new Date('2018/06/24'),
|
|
25
|
+
)}.
|
|
26
|
+
</div>
|
|
27
|
+
</lion-input-datepicker>
|
|
28
|
+
`;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Disable specific dates
|
|
32
|
+
|
|
33
|
+
```js preview-story
|
|
34
|
+
export const disableSpecificDates = () => html`
|
|
35
|
+
<lion-input-datepicker
|
|
36
|
+
label="IsDateDisabled"
|
|
37
|
+
help-text="You're not allowed to choose any 15th."
|
|
38
|
+
.validators=${[new IsDateDisabled(d => d.getDate() === 15)]}
|
|
39
|
+
></lion-input-datepicker>
|
|
40
|
+
`;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Calendar heading
|
|
44
|
+
|
|
45
|
+
You can modify the heading of the calendar with the `.calendarHeading` property or `calendar-heading` attribute for simple values.
|
|
46
|
+
|
|
47
|
+
By default, it will take the label value.
|
|
48
|
+
|
|
49
|
+
```js preview-story
|
|
50
|
+
export const calendarHeading = () => html`
|
|
51
|
+
<lion-input-datepicker
|
|
52
|
+
label="Date"
|
|
53
|
+
.calendarHeading="${'Custom heading'}"
|
|
54
|
+
.modelValue=${new Date()}
|
|
55
|
+
></lion-input-datepicker>
|
|
56
|
+
`;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Disabled
|
|
60
|
+
|
|
61
|
+
You can disable datepicker inputs.
|
|
62
|
+
|
|
63
|
+
```js preview-story
|
|
64
|
+
export const disabled = () => html`
|
|
65
|
+
<lion-input-datepicker label="Disabled" disabled></lion-input-datepicker>
|
|
66
|
+
`;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Read only
|
|
70
|
+
|
|
71
|
+
You can set datepicker inputs to `readonly`, which will prevent the user from opening the calendar popup.
|
|
72
|
+
|
|
73
|
+
```js preview-story
|
|
74
|
+
export const readOnly = () => html`
|
|
75
|
+
<lion-input-datepicker label="Readonly" readonly .modelValue="${new Date()}">
|
|
76
|
+
</lion-input-datepicker>
|
|
77
|
+
`;
|
|
78
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Input Email >> 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 email.
|
|
4
|
+
|
|
5
|
+
```js script
|
|
6
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
7
|
+
import '@lion/ui/define/lion-input-email.js';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```js preview-story
|
|
11
|
+
export const main = () => {
|
|
12
|
+
return html` <lion-input-email label="Email" name="email"></lion-input-email> `;
|
|
13
|
+
};
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Based on our [input](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input/overview.md)
|
|
19
|
+
- Makes use of email [validators](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/fundamentals/systems/form/validate.md) with corresponding error messages in different languages
|
|
20
|
+
- IsEmail (default)
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm i --save @lion/ui
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { LionInputEmail } from '@lion/ui/input-email.js';
|
|
30
|
+
// or
|
|
31
|
+
import '@lion/ui/define/lion-input-email.js';
|
|
32
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Input Email >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import { Validator } from '@lion/ui/form-core.js';
|
|
6
|
+
import '@lion/ui/define/lion-input-email.js';
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Faulty Prefilled
|
|
10
|
+
|
|
11
|
+
When prefilling with a faulty input, an error feedback message will show.
|
|
12
|
+
|
|
13
|
+
Use `loadDefaultFeedbackMessages` to get our default feedback messages displayed on it.
|
|
14
|
+
|
|
15
|
+
```js preview-story
|
|
16
|
+
export const faultyPrefilled = () => html`
|
|
17
|
+
<lion-input-email .modelValue=${'foo'} label="Email"></lion-input-email>
|
|
18
|
+
`;
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Custom Validator
|
|
22
|
+
|
|
23
|
+
```js preview-story
|
|
24
|
+
export const customValidator = () => {
|
|
25
|
+
class GmailOnly extends Validator {
|
|
26
|
+
static get validatorName() {
|
|
27
|
+
return 'GmailOnly';
|
|
28
|
+
}
|
|
29
|
+
execute(value) {
|
|
30
|
+
let hasError = false;
|
|
31
|
+
if (!(value.indexOf('gmail.com') !== -1)) {
|
|
32
|
+
hasError = true;
|
|
33
|
+
}
|
|
34
|
+
return hasError;
|
|
35
|
+
}
|
|
36
|
+
static async getMessage() {
|
|
37
|
+
return 'You can only use gmail.com email addresses.';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return html`
|
|
41
|
+
<lion-input-email
|
|
42
|
+
.modelValue=${'foo@bar.com'}
|
|
43
|
+
.validators=${[new GmailOnly()]}
|
|
44
|
+
label="Email"
|
|
45
|
+
></lion-input-email>
|
|
46
|
+
`;
|
|
47
|
+
};
|
|
48
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Input Iban >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A web component based on the generic text input field.
|
|
4
|
+
Its purpose is to provide a way for users to fill in an IBAN (International Bank Account Number).
|
|
5
|
+
|
|
6
|
+
```js script
|
|
7
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
8
|
+
import '@lion/ui/define/lion-input-iban.js';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js preview-story
|
|
12
|
+
export const main = () => {
|
|
13
|
+
return html` <lion-input-iban label="Account" name="account"></lion-input-iban> `;
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Based on our [input](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input/overview.md)
|
|
20
|
+
- Default label in different languages
|
|
21
|
+
- Makes use of IBAN specific [validate](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/fundamentals/systems/form/validate.md) with corresponding error messages in different languages
|
|
22
|
+
- IsIBAN (default)
|
|
23
|
+
- IsCountryIBAN
|
|
24
|
+
- Parses IBANs automatically
|
|
25
|
+
- Formats IBANs automatically
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm i --save @lion/ui
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import { LionInputIban } from '@lion/ui/input-iban.js';
|
|
35
|
+
// or
|
|
36
|
+
import '@lion/ui/define/lion-input-amount.js';
|
|
37
|
+
```
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Input Iban >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js';
|
|
6
|
+
import { IsCountryIBAN, IsNotCountryIBAN } from '@lion/ui/input-iban.js';
|
|
7
|
+
import '@lion/ui/define/lion-input-iban.js';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Prefilled
|
|
11
|
+
|
|
12
|
+
```js preview-story
|
|
13
|
+
export const prefilled = () => html`
|
|
14
|
+
<lion-input-iban .modelValue=${'NL20INGB0001234567'} name="iban" label="IBAN"></lion-input-iban>
|
|
15
|
+
`;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Faulty Prefilled
|
|
19
|
+
|
|
20
|
+
```js preview-story
|
|
21
|
+
export const faultyPrefilled = () => html`
|
|
22
|
+
<lion-input-iban
|
|
23
|
+
.modelValue=${'NL20INGB0001234567XXXX'}
|
|
24
|
+
name="iban"
|
|
25
|
+
label="IBAN"
|
|
26
|
+
></lion-input-iban>
|
|
27
|
+
`;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Country Restrictions
|
|
31
|
+
|
|
32
|
+
By default, we validate the input to ensure the IBAN is valid.
|
|
33
|
+
To get the default feedback message for this default validator, use `loadDefaultFeedbackMessages` from `@lion/form-core`.
|
|
34
|
+
|
|
35
|
+
In the example below, we show how to use an additional validator that restricts the `input-iban` to IBANs from only certain countries.
|
|
36
|
+
|
|
37
|
+
```js preview-story
|
|
38
|
+
export const countryRestrictions = () => {
|
|
39
|
+
loadDefaultFeedbackMessages();
|
|
40
|
+
return html`
|
|
41
|
+
<lion-input-iban
|
|
42
|
+
.modelValue=${'DE89370400440532013000'}
|
|
43
|
+
.validators=${[new IsCountryIBAN('NL')]}
|
|
44
|
+
name="iban"
|
|
45
|
+
label="IBAN"
|
|
46
|
+
></lion-input-iban>
|
|
47
|
+
<br />
|
|
48
|
+
<small>Demo instructions: you can use NL20 INGB 0001 2345 67</small>
|
|
49
|
+
`;
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You can pass a single string value, or an array of strings.
|
|
54
|
+
The latter may be useful, for example if you only want to allow BeNeLux IBANs.
|
|
55
|
+
|
|
56
|
+
```js preview-story
|
|
57
|
+
export const countryRestrictionsMultiple = () => {
|
|
58
|
+
loadDefaultFeedbackMessages();
|
|
59
|
+
return html`
|
|
60
|
+
<lion-input-iban
|
|
61
|
+
.modelValue=${'DE89370400440532013000'}
|
|
62
|
+
.validators=${[new IsCountryIBAN(['BE', 'NL', 'LU'])]}
|
|
63
|
+
name="iban"
|
|
64
|
+
label="IBAN"
|
|
65
|
+
></lion-input-iban>
|
|
66
|
+
<br />
|
|
67
|
+
<small>Demo instructions: you can use:</small>
|
|
68
|
+
<ul>
|
|
69
|
+
<li><small>BE68 5390 0754 7034</small></li>
|
|
70
|
+
<li><small>NL20 INGB 0001 2345 67</small></li>
|
|
71
|
+
<li><small>LU28 0019 4006 4475 0000</small></li>
|
|
72
|
+
</ul>
|
|
73
|
+
`;
|
|
74
|
+
};
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Blacklisted Country
|
|
78
|
+
|
|
79
|
+
By default, we validate the input to ensure the IBAN is valid.
|
|
80
|
+
To get the default feedback message for this default validator, use `loadDefaultFeedbackMessages` from `@lion/form-core`.
|
|
81
|
+
|
|
82
|
+
In the example below, we show how to use an additional validator that blocks IBANs from certain countries.
|
|
83
|
+
|
|
84
|
+
You can pass a single string value, or an array of strings.
|
|
85
|
+
|
|
86
|
+
```js preview-story
|
|
87
|
+
export const blacklistedCountry = () => {
|
|
88
|
+
loadDefaultFeedbackMessages();
|
|
89
|
+
return html`
|
|
90
|
+
<lion-input-iban
|
|
91
|
+
.modelValue=${'DE89370400440532013000'}
|
|
92
|
+
.validators=${[new IsNotCountryIBAN(['RO', 'NL'])]}
|
|
93
|
+
name="iban"
|
|
94
|
+
label="IBAN"
|
|
95
|
+
></lion-input-iban>
|
|
96
|
+
<br />
|
|
97
|
+
<small>
|
|
98
|
+
Demo instructions: Try <code>RO 89 RZBR 6997 3728 4864 5577</code> and watch it fail
|
|
99
|
+
</small>
|
|
100
|
+
`;
|
|
101
|
+
};
|
|
102
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Input Range >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A web component based on the native range input. Its purpose is to provide a way for users to select one value from a range of values.
|
|
4
|
+
|
|
5
|
+
```js script
|
|
6
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
7
|
+
import '@lion/ui/define/lion-input-range.js';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```js preview-story
|
|
11
|
+
export const main = () => html`
|
|
12
|
+
<lion-input-range min="200" max="500" .modelValue="${300}" label="Input range"></lion-input-range>
|
|
13
|
+
`;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Based on our [input](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input/overview.md).
|
|
19
|
+
- Shows `modelValue` and `unit` above the range input.
|
|
20
|
+
- Shows `min` and `max` value after the range input.
|
|
21
|
+
- Can hide the `min` and `max` value via `no-min-max-labels`.
|
|
22
|
+
- Makes use of [formatNumber](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/fundamentals/systems/localize/numbers.md) for formatting and parsing.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm i --save @lion/ui
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import { LionInputRange } from '@lion/ui/input-range.js';
|
|
32
|
+
// or
|
|
33
|
+
import '@lion/ui/define/lion-input-range.js';
|
|
34
|
+
```
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Input Range >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import '@lion/ui/define/lion-input-range.js';
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Units
|
|
9
|
+
|
|
10
|
+
```js preview-story
|
|
11
|
+
export const units = () => html`
|
|
12
|
+
<style>
|
|
13
|
+
lion-input-range {
|
|
14
|
+
max-width: 400px;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
<lion-input-range
|
|
18
|
+
min="0"
|
|
19
|
+
max="100"
|
|
20
|
+
.modelValue="${50}"
|
|
21
|
+
unit="%"
|
|
22
|
+
label="Percentage"
|
|
23
|
+
></lion-input-range>
|
|
24
|
+
`;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Steps
|
|
28
|
+
|
|
29
|
+
```js preview-story
|
|
30
|
+
export const steps = () => html`
|
|
31
|
+
<lion-input-range
|
|
32
|
+
style="max-width: 400px;"
|
|
33
|
+
min="200"
|
|
34
|
+
max="500"
|
|
35
|
+
step="50"
|
|
36
|
+
.modelValue="${300}"
|
|
37
|
+
label="Input range"
|
|
38
|
+
help-text="This slider uses increments of 50"
|
|
39
|
+
></lion-input-range>
|
|
40
|
+
`;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Without Min Max Labels
|
|
44
|
+
|
|
45
|
+
```js preview-story
|
|
46
|
+
export const noMinMaxLabels = () => html`
|
|
47
|
+
<lion-input-range
|
|
48
|
+
style="max-width: 400px;"
|
|
49
|
+
no-min-max-labels
|
|
50
|
+
min="0"
|
|
51
|
+
max="100"
|
|
52
|
+
label="Input range"
|
|
53
|
+
></lion-input-range>
|
|
54
|
+
`;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Disabled
|
|
58
|
+
|
|
59
|
+
```js preview-story
|
|
60
|
+
export const disabled = () => html`
|
|
61
|
+
<lion-input-range
|
|
62
|
+
style="max-width: 400px;"
|
|
63
|
+
disabled
|
|
64
|
+
min="200"
|
|
65
|
+
max="500"
|
|
66
|
+
.modelValue="${300}"
|
|
67
|
+
label="Input range"
|
|
68
|
+
></lion-input-range>
|
|
69
|
+
`;
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Range Styles
|
|
73
|
+
|
|
74
|
+
Often, you will style your own range input by changing the pseudo-elements for the slider track and thumb.
|
|
75
|
+
|
|
76
|
+
These pseudo-elements do not play nice with `::slotted`.
|
|
77
|
+
|
|
78
|
+
As per [specification](https://drafts.csswg.org/css-scoping/#slotted-pseudo):
|
|
79
|
+
|
|
80
|
+
> The ::slotted() pseudo-element can be followed by a tree-abiding pseudo-element,
|
|
81
|
+
> like ::slotted()::before, representing the appropriate pseudo-element of the elements
|
|
82
|
+
> represented by the ::slotted() pseudo-element.
|
|
83
|
+
|
|
84
|
+
The pseudo-elements associated with the slider track/thumb are not tree-abiding, so you can't do:
|
|
85
|
+
|
|
86
|
+
```css
|
|
87
|
+
::slotted(.form-control)::-webkit-slider-runnable-track
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This means you will need to style the slotted native input from the LightDOM,
|
|
91
|
+
and for this we added added our ScopedStylesController as a controller to `LionInputRange`.
|
|
92
|
+
This controller inserts a `<style>` element
|
|
93
|
+
that emulates scoping by generating a uniquely generated class on the LionInputRange component.
|
|
94
|
+
This prevents the styling from conflicting with other elements on the page.
|
|
95
|
+
|
|
96
|
+
To use it when extending, override `static scopedStyles(scope)`:
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
class MyInputRange extends LionInputRange {
|
|
100
|
+
static scopedStyles(scope) {
|
|
101
|
+
return css`
|
|
102
|
+
.${scope} .form-control::-webkit-slider-runnable-track {
|
|
103
|
+
background-color: lightgreen;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Input Stepper >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A web component that enables the user to increase and decrease a numeric value by predefined range. It is a combination of two buttons and a number input field with an optional slot `after` to suffix the extra information.
|
|
4
|
+
|
|
5
|
+
```js script
|
|
6
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
7
|
+
import '@lion/ui/define/lion-input-stepper.js';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```js preview-story
|
|
11
|
+
export const main = () => html`
|
|
12
|
+
<lion-input-stepper max="5" min="0" name="count">
|
|
13
|
+
<label slot="label">RSVP</label>
|
|
14
|
+
<div slot="help-text">Max. 5 guests</div>
|
|
15
|
+
</lion-input-stepper>
|
|
16
|
+
`;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- Based on our [input](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input/overview.md).
|
|
22
|
+
- Set `min` and `max` value to define the range.
|
|
23
|
+
- Set `step` value in integer or decimal to increase and decrease the value.
|
|
24
|
+
- Use `ArrowUp` or `ArrowDown` to update the value.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm i --save @lion/ui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { LionInputStepper } from '@lion/ui/input-stepper.js';
|
|
34
|
+
// or
|
|
35
|
+
import '@lion/ui/define/lion-input-stepper.js';
|
|
36
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Input Stepper >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import '@lion/ui/define/lion-input-stepper.js';
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Default with no specification
|
|
9
|
+
|
|
10
|
+
When no range or step is defined, it can go infinite with default step value as `1`. You can also specify prefix content using `after` slot.
|
|
11
|
+
|
|
12
|
+
```js preview-story
|
|
13
|
+
export const defaultMode = () => html`
|
|
14
|
+
<label>How old is the existence?</label>
|
|
15
|
+
<lion-input-stepper name="year">
|
|
16
|
+
<div slot="after">In Billion Years</div>
|
|
17
|
+
</lion-input-stepper>
|
|
18
|
+
`;
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Step and Value
|
|
22
|
+
|
|
23
|
+
Use `step` attribute to specify the incrementor or decrementor difference and `value` to set the default value.
|
|
24
|
+
|
|
25
|
+
```js preview-story
|
|
26
|
+
export const steps = () => html`
|
|
27
|
+
<p><strong>Min:</strong> 100, <strong>Value:</strong> 200, <strong>Step:</strong> 100</p>
|
|
28
|
+
<lion-input-stepper min="100" step="100" name="value" value="200"></lion-input-stepper>
|
|
29
|
+
`;
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Range
|
|
33
|
+
|
|
34
|
+
Use `min` and `max` attribute to specify range.
|
|
35
|
+
|
|
36
|
+
```js preview-story
|
|
37
|
+
export const range = () => html`
|
|
38
|
+
<p><strong>Min:</strong> 200, <strong>Max:</strong> 500, <strong>Step:</strong> 100</p>
|
|
39
|
+
<lion-input-stepper min="200" max="500" name="value" step="100" value="200"></lion-input-stepper>
|
|
40
|
+
`;
|
|
41
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Input Tel >> Overview ||10
|
|
2
|
+
|
|
3
|
+
Input field for entering phone numbers, including validation, formatting and mobile keyboard support.
|
|
4
|
+
|
|
5
|
+
```js script
|
|
6
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
7
|
+
import { ref, createRef } from 'lit/directives/ref.js';
|
|
8
|
+
|
|
9
|
+
import { PhoneUtilManager } from '@lion/ui/input-tel.js';
|
|
10
|
+
import '@lion/ui/define/lion-input-tel.js';
|
|
11
|
+
import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js';
|
|
12
|
+
import '../../../docs/fundamentals/systems/form/assets/h-output.js';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```js preview-story
|
|
16
|
+
export const main = () => {
|
|
17
|
+
loadDefaultFeedbackMessages();
|
|
18
|
+
return html`
|
|
19
|
+
<lion-input-tel
|
|
20
|
+
.modelValue="${'+639921343959'}"
|
|
21
|
+
live-format
|
|
22
|
+
label="Telephone number"
|
|
23
|
+
name="phoneNumber"
|
|
24
|
+
></lion-input-tel>
|
|
25
|
+
<h-output
|
|
26
|
+
.show="${[
|
|
27
|
+
'activeRegion',
|
|
28
|
+
{
|
|
29
|
+
name: 'all or allowed regions',
|
|
30
|
+
processor: el => JSON.stringify(el._allowedOrAllRegions),
|
|
31
|
+
},
|
|
32
|
+
'modelValue',
|
|
33
|
+
]}" 'modelValue']}"
|
|
34
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
35
|
+
></h-output>
|
|
36
|
+
`;
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
- Extends our [input](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input/overview.md)
|
|
43
|
+
- Shows a mobile telephone keypad on mobile (by having a native `<input inputmode="tel">` inside)
|
|
44
|
+
- Can be configured with a list of allowed region codes
|
|
45
|
+
- Will be preconfigured with region derived from locale
|
|
46
|
+
- Has the [e164 standard format](https://en.wikipedia.org/wiki/E.164) as modelValue
|
|
47
|
+
- Uses [awesome-phonenumber](https://www.npmjs.com/package/awesome-phonenumber) (a performant, concise version of [google-lib-phonenumber](https://www.npmjs.com/package/google-libphonenumber)):
|
|
48
|
+
- Formats phone numbers, based on region code
|
|
49
|
+
- Validates phone numbers, based on region code
|
|
50
|
+
- Lazy loads awesome-phonenumber, so that the first paint of this component will be brought to your screen as quick as possible
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm i --save @lion/ui
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
import { LionInputTel } from '@lion/ui/input-tel.js';
|
|
60
|
+
// or
|
|
61
|
+
import '@lion/ui/define/lion-input-tel.js';
|
|
62
|
+
```
|