@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,159 @@
|
|
|
1
|
+
# Input Tel Dropdown >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import { ref, createRef } from 'lit/directives/ref.js';
|
|
6
|
+
import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js';
|
|
7
|
+
import { PhoneUtilManager } from '@lion/ui/input-tel.js';
|
|
8
|
+
import '@lion/ui/define/lion-input-tel-dropdown.js';
|
|
9
|
+
import '../../../docs/fundamentals/systems/form/assets/h-output.js';
|
|
10
|
+
|
|
11
|
+
// TODO: make each example load/use the dependencies by default
|
|
12
|
+
// loadDefaultFeedbackMessages();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Input Tel Dropdown
|
|
16
|
+
|
|
17
|
+
When `.allowedRegions` is not configured, all regions/countries will be available in the dropdown
|
|
18
|
+
list. Once a region is chosen, its country/dial code will be adjusted with that of the new locale.
|
|
19
|
+
|
|
20
|
+
```js preview-story
|
|
21
|
+
export const InputTelDropdown = () => {
|
|
22
|
+
loadDefaultFeedbackMessages();
|
|
23
|
+
return html`
|
|
24
|
+
<lion-input-tel-dropdown
|
|
25
|
+
label="Select region via dropdown"
|
|
26
|
+
help-text="Shows all regions by default"
|
|
27
|
+
name="phoneNumber"
|
|
28
|
+
></lion-input-tel-dropdown>
|
|
29
|
+
<h-output
|
|
30
|
+
.show="${['modelValue', 'activeRegion']}"
|
|
31
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
32
|
+
></h-output>
|
|
33
|
+
`;
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Allowed regions
|
|
38
|
+
|
|
39
|
+
When `.allowedRegions` is configured, only those regions/countries will be available in the dropdown
|
|
40
|
+
list.
|
|
41
|
+
|
|
42
|
+
```js preview-story
|
|
43
|
+
export const allowedRegions = () => {
|
|
44
|
+
loadDefaultFeedbackMessages();
|
|
45
|
+
return html`
|
|
46
|
+
<lion-input-tel-dropdown
|
|
47
|
+
label="Select region via dropdown"
|
|
48
|
+
help-text="With region code 'NL'"
|
|
49
|
+
.modelValue=${'+31612345678'}
|
|
50
|
+
name="phoneNumber"
|
|
51
|
+
.allowedRegions=${['NL', 'DE', 'GB']}
|
|
52
|
+
></lion-input-tel-dropdown>
|
|
53
|
+
<h-output
|
|
54
|
+
.show="${['modelValue', 'activeRegion']}"
|
|
55
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
56
|
+
></h-output>
|
|
57
|
+
`;
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Preferred regions
|
|
62
|
+
|
|
63
|
+
When `.preferredRegions` is configured, they will show up on top of the dropdown list to enhance user experience.
|
|
64
|
+
|
|
65
|
+
```js preview-story
|
|
66
|
+
export const preferredRegionCodes = () => {
|
|
67
|
+
loadDefaultFeedbackMessages();
|
|
68
|
+
return html`
|
|
69
|
+
<lion-input-tel-dropdown
|
|
70
|
+
label="Select region via dropdown"
|
|
71
|
+
help-text="Preferred regions show on top"
|
|
72
|
+
.modelValue=${'+31612345678'}
|
|
73
|
+
name="phoneNumber"
|
|
74
|
+
.allowedRegions=${['BE', 'CA', 'DE', 'GB', 'NL', 'US']}
|
|
75
|
+
.preferredRegions=${['DE', 'NL']}
|
|
76
|
+
></lion-input-tel-dropdown>
|
|
77
|
+
<h-output
|
|
78
|
+
.show="${['modelValue', 'activeRegion']}"
|
|
79
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
80
|
+
></h-output>
|
|
81
|
+
`;
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Format
|
|
86
|
+
|
|
87
|
+
### Format strategy
|
|
88
|
+
|
|
89
|
+
Determines what the formatter output should look like.
|
|
90
|
+
Formatting strategies as provided by awesome-phonenumber / google-libphonenumber.
|
|
91
|
+
|
|
92
|
+
Possible values:
|
|
93
|
+
|
|
94
|
+
| strategy | output |
|
|
95
|
+
| :------------ | ------------------------------------: |
|
|
96
|
+
| e164 | `+46707123456` |
|
|
97
|
+
| international | `+46 70 712 34 56` |
|
|
98
|
+
| national | not applicable for input-tel-dropdown |
|
|
99
|
+
| significant | not applicable for input-tel-dropdown |
|
|
100
|
+
| rfc3966 | `tel:+46-70-712-34-56` |
|
|
101
|
+
|
|
102
|
+
Also see:
|
|
103
|
+
|
|
104
|
+
- [awesome-phonenumber documentation](https://www.npmjs.com/package/awesome-phonenumber)
|
|
105
|
+
|
|
106
|
+
```js preview-story
|
|
107
|
+
export const formatStrategy = () => {
|
|
108
|
+
loadDefaultFeedbackMessages();
|
|
109
|
+
const inputTel = createRef();
|
|
110
|
+
return html`
|
|
111
|
+
<select @change="${({ target }) => (inputTel.value.formatStrategy = target.value)}">
|
|
112
|
+
<option value="e164">e164</option>
|
|
113
|
+
<option value="international">international</option>
|
|
114
|
+
<option value="rfc3966">rfc3966</option>
|
|
115
|
+
</select>
|
|
116
|
+
<lion-input-tel-dropdown
|
|
117
|
+
${ref(inputTel)}
|
|
118
|
+
label="Format strategy"
|
|
119
|
+
help-text="Choose a strategy above"
|
|
120
|
+
format-strategy="e164"
|
|
121
|
+
name="phoneNumber"
|
|
122
|
+
></lion-input-tel-dropdown>
|
|
123
|
+
<h-output
|
|
124
|
+
.show="${['modelValue', 'formatStrategy']}"
|
|
125
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
126
|
+
></h-output>
|
|
127
|
+
`;
|
|
128
|
+
};
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Format country code style
|
|
132
|
+
|
|
133
|
+
You can style the country code with parentheses.
|
|
134
|
+
|
|
135
|
+
```js preview-story
|
|
136
|
+
export const formatCountryCodeStyle = () => {
|
|
137
|
+
loadDefaultFeedbackMessages();
|
|
138
|
+
const inputTel = createRef();
|
|
139
|
+
return html`
|
|
140
|
+
<select @change="${({ target }) => (inputTel.value.formatStrategy = target.value)}">
|
|
141
|
+
<option value="e164">e164</option>
|
|
142
|
+
<option value="international">international</option>
|
|
143
|
+
<option value="rfc3966">rfc3966</option>
|
|
144
|
+
</select>
|
|
145
|
+
<lion-input-tel-dropdown
|
|
146
|
+
${ref(inputTel)}
|
|
147
|
+
label="Format strategy"
|
|
148
|
+
help-text="Choose a strategy above"
|
|
149
|
+
format-country-code-style="parentheses"
|
|
150
|
+
format-strategy="e164"
|
|
151
|
+
name="phoneNumber"
|
|
152
|
+
></lion-input-tel-dropdown>
|
|
153
|
+
<h-output
|
|
154
|
+
.show="${['modelValue', 'formatStrategy']}"
|
|
155
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
156
|
+
></h-output>
|
|
157
|
+
`;
|
|
158
|
+
};
|
|
159
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Listbox >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A widget that presents a list of options and allows a user to select one or more of them.
|
|
4
|
+
A listbox that allows a single option to be chosen is a `single-select listbox`; one that allows
|
|
5
|
+
multiple options to be selected is a `multi-select listbox`.
|
|
6
|
+
|
|
7
|
+
> From [listbox wai-aria best practices](https://www.w3.org/TR/wai-aria-practices/#Listbox)
|
|
8
|
+
|
|
9
|
+
```js script
|
|
10
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
11
|
+
import '@lion/ui/define/lion-listbox.js';
|
|
12
|
+
import '@lion/ui/define/lion-option.js';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```js preview-story
|
|
16
|
+
export const main = () => html`
|
|
17
|
+
<lion-listbox name="listbox" label="Default">
|
|
18
|
+
<lion-option .choiceValue=${'Apple'}>Apple</lion-option>
|
|
19
|
+
<lion-option checked .choiceValue=${'Artichoke'}>Artichoke</lion-option>
|
|
20
|
+
<lion-option .choiceValue=${'Asparagus'}>Asparagus</lion-option>
|
|
21
|
+
<lion-option .choiceValue=${'Banana'}>Banana</lion-option>
|
|
22
|
+
<lion-option .choiceValue=${'Beets'}>Beets</lion-option>
|
|
23
|
+
</lion-listbox>
|
|
24
|
+
`;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- Single & Multiple Choice
|
|
30
|
+
- Orientation
|
|
31
|
+
- Rotation when using keyboard for selection
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm i --save @lion/ui
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import '@lion/ui/define/lion-listbox.js';
|
|
41
|
+
import '@lion/ui/define/lion-option.js';
|
|
42
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const listboxData = [
|
|
2
|
+
'Apple',
|
|
3
|
+
'Artichoke',
|
|
4
|
+
'Asparagus',
|
|
5
|
+
'Banana',
|
|
6
|
+
'Beets',
|
|
7
|
+
'Bell pepper',
|
|
8
|
+
'Broccoli',
|
|
9
|
+
'Brussels sprout',
|
|
10
|
+
'Cabbage',
|
|
11
|
+
'Carrot',
|
|
12
|
+
'Cauliflower',
|
|
13
|
+
'Celery',
|
|
14
|
+
'Chard',
|
|
15
|
+
'Chicory',
|
|
16
|
+
'Corn',
|
|
17
|
+
'Cucumber',
|
|
18
|
+
'Daikon',
|
|
19
|
+
'Date',
|
|
20
|
+
'Edamame',
|
|
21
|
+
'Eggplant',
|
|
22
|
+
'Elderberry',
|
|
23
|
+
'Fennel',
|
|
24
|
+
'Fig',
|
|
25
|
+
'Garlic',
|
|
26
|
+
'Grape',
|
|
27
|
+
'Honeydew melon',
|
|
28
|
+
'Iceberg lettuce',
|
|
29
|
+
'Jerusalem artichoke',
|
|
30
|
+
'Kale',
|
|
31
|
+
'Kiwi',
|
|
32
|
+
'Leek',
|
|
33
|
+
'Lemon',
|
|
34
|
+
'Mango',
|
|
35
|
+
'Mangosteen',
|
|
36
|
+
'Melon',
|
|
37
|
+
'Mushroom',
|
|
38
|
+
'Nectarine',
|
|
39
|
+
'Okra',
|
|
40
|
+
'Olive',
|
|
41
|
+
'Onion',
|
|
42
|
+
'Orange',
|
|
43
|
+
'Parship',
|
|
44
|
+
'Pea',
|
|
45
|
+
'Pear',
|
|
46
|
+
'Pineapple',
|
|
47
|
+
'Potato',
|
|
48
|
+
'Pumpkin',
|
|
49
|
+
'Quince',
|
|
50
|
+
'Radish',
|
|
51
|
+
'Rhubarb',
|
|
52
|
+
'Shallot',
|
|
53
|
+
'Spinach',
|
|
54
|
+
'Squash',
|
|
55
|
+
'Strawberry',
|
|
56
|
+
'Sweet potato',
|
|
57
|
+
'Tomato',
|
|
58
|
+
'Turnip',
|
|
59
|
+
'Ugli fruit',
|
|
60
|
+
'Victoria plum',
|
|
61
|
+
'Watercress',
|
|
62
|
+
'Watermelon',
|
|
63
|
+
'Yam',
|
|
64
|
+
'Zucchini',
|
|
65
|
+
];
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Listbox >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import { listboxData } from './src/listboxData.js';
|
|
6
|
+
import '@lion/ui/define/lion-listbox.js';
|
|
7
|
+
import '@lion/ui/define/lion-option.js';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Multiple choice
|
|
11
|
+
|
|
12
|
+
Add `multiple-choice` flag to allow multiple values to be selected.
|
|
13
|
+
This will:
|
|
14
|
+
|
|
15
|
+
- keep the listbox overlay open on click of an option
|
|
16
|
+
- display a list of selected option representations next to the text box
|
|
17
|
+
- make the value of type `Array` instead of `String`
|
|
18
|
+
|
|
19
|
+
```js preview-story
|
|
20
|
+
export const multiple = () => html`
|
|
21
|
+
<lion-listbox name="combo" label="Multiple" multiple-choice>
|
|
22
|
+
<lion-option .choiceValue=${'Apple'}>Apple</lion-option>
|
|
23
|
+
<lion-option .choiceValue=${'Artichoke'}>Artichoke</lion-option>
|
|
24
|
+
<lion-option .choiceValue=${'Asparagus'}>Asparagus</lion-option>
|
|
25
|
+
<lion-option .choiceValue=${'Banana'}>Banana</lion-option>
|
|
26
|
+
<lion-option .choiceValue=${'Beets'}>Beets</lion-option>
|
|
27
|
+
<lion-option .choiceValue=${'Bell pepper'}>Bell pepper</lion-option>
|
|
28
|
+
<lion-option .choiceValue=${'Broccoli'}>Broccoli</lion-option>
|
|
29
|
+
<lion-option .choiceValue=${'Brussels sprout'}>Brussels sprout</lion-option>
|
|
30
|
+
<lion-option .choiceValue=${'Cabbage'}>Cabbage</lion-option>
|
|
31
|
+
<lion-option .choiceValue=${'Carrot'}>Carrot</lion-option>
|
|
32
|
+
</lion-listbox>
|
|
33
|
+
`;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Orientation
|
|
37
|
+
|
|
38
|
+
When `orientation="horizontal"`, left and right arrow keys will be enabled, plus the screenreader
|
|
39
|
+
will be informed about the direction of the options.
|
|
40
|
+
By default, `orientation="vertical"` is set, which enables up and down arrow keys.
|
|
41
|
+
|
|
42
|
+
```js preview-story
|
|
43
|
+
export const orientationHorizontal = () => html`
|
|
44
|
+
<lion-listbox name="combo" label="Orientation horizontal" orientation="horizontal">
|
|
45
|
+
<lion-option .choiceValue=${'Apple'}>Apple</lion-option>
|
|
46
|
+
<lion-option .choiceValue=${'Artichoke'}>Artichoke</lion-option>
|
|
47
|
+
<lion-option .choiceValue=${'Asparagus'}>Asparagus</lion-option>
|
|
48
|
+
<lion-option .choiceValue=${'Banana'}>Banana</lion-option>
|
|
49
|
+
<lion-option .choiceValue=${'Beets'}>Beets</lion-option>
|
|
50
|
+
<lion-option .choiceValue=${'Bell pepper'}>Bell pepper</lion-option>
|
|
51
|
+
<lion-option .choiceValue=${'Broccoli'}>Broccoli</lion-option>
|
|
52
|
+
<lion-option .choiceValue=${'Brussels sprout'}>Brussels sprout</lion-option>
|
|
53
|
+
<lion-option .choiceValue=${'Cabbage'}>Cabbage</lion-option>
|
|
54
|
+
<lion-option .choiceValue=${'Carrot'}>Carrot</lion-option>
|
|
55
|
+
</lion-listbox>
|
|
56
|
+
`;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
With `multiple-choice` flag configured, multiple options can be checked.
|
|
60
|
+
|
|
61
|
+
```js preview-story
|
|
62
|
+
export const orientationHorizontalMultiple = () => html`
|
|
63
|
+
<lion-listbox
|
|
64
|
+
name="combo"
|
|
65
|
+
label="Orientation horizontal multiple"
|
|
66
|
+
orientation="horizontal"
|
|
67
|
+
multiple-choice
|
|
68
|
+
>
|
|
69
|
+
<lion-option .choiceValue=${'Apple'}>Apple</lion-option>
|
|
70
|
+
<lion-option .choiceValue=${'Artichoke'}>Artichoke</lion-option>
|
|
71
|
+
<lion-option .choiceValue=${'Asparagus'}>Asparagus</lion-option>
|
|
72
|
+
<lion-option .choiceValue=${'Banana'}>Banana</lion-option>
|
|
73
|
+
<lion-option .choiceValue=${'Beets'}>Beets</lion-option>
|
|
74
|
+
<lion-option .choiceValue=${'Bell pepper'}>Bell pepper</lion-option>
|
|
75
|
+
<lion-option .choiceValue=${'Broccoli'}>Broccoli</lion-option>
|
|
76
|
+
<lion-option .choiceValue=${'Brussels sprout'}>Brussels sprout</lion-option>
|
|
77
|
+
<lion-option .choiceValue=${'Cabbage'}>Cabbage</lion-option>
|
|
78
|
+
<lion-option .choiceValue=${'Carrot'}>Carrot</lion-option>
|
|
79
|
+
</lion-listbox>
|
|
80
|
+
`;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Selection-follows-focus
|
|
84
|
+
|
|
85
|
+
When true, will synchronize activedescendant and selected element on arrow key navigation.
|
|
86
|
+
This behavior can usually be seen in `<select>` on the Windows platform.
|
|
87
|
+
Note that this behavior cannot be used when multiple-choice is true.
|
|
88
|
+
See [wai aria spec](https://www.w3.org/TR/wai-aria-practices/#kbd_selection_follows_focus)
|
|
89
|
+
|
|
90
|
+
```js preview-story
|
|
91
|
+
export const selectionFollowsFocus = () => html`
|
|
92
|
+
<lion-listbox name="combo" label="Selection follows focus" selection-follows-focus>
|
|
93
|
+
<lion-option .choiceValue=${'Apple'}>Apple</lion-option>
|
|
94
|
+
<lion-option .choiceValue=${'Artichoke'} disabled>Artichoke</lion-option>
|
|
95
|
+
<lion-option .choiceValue=${'Asparagus'}>Asparagus</lion-option>
|
|
96
|
+
<lion-option .choiceValue=${'Banana'}>Banana</lion-option>
|
|
97
|
+
<lion-option .choiceValue=${'Beets'}>Beets</lion-option>
|
|
98
|
+
<lion-option .choiceValue=${'Bell pepper'}>Bell pepper</lion-option>
|
|
99
|
+
<lion-option .choiceValue=${'Broccoli'}>Broccoli</lion-option>
|
|
100
|
+
<lion-option .choiceValue=${'Brussels sprout'}>Brussels sprout</lion-option>
|
|
101
|
+
<lion-option .choiceValue=${'Cabbage'}>Cabbage</lion-option>
|
|
102
|
+
<lion-option .choiceValue=${'Carrot'}>Carrot</lion-option>
|
|
103
|
+
</lion-listbox>
|
|
104
|
+
`;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Rotate keyboard navigation
|
|
108
|
+
|
|
109
|
+
`rotate-keyboard-navigation` attribute on the listbox will give the first option active state when navigated to the next option from last option.
|
|
110
|
+
|
|
111
|
+
```js preview-story
|
|
112
|
+
export const rotateKeyboardNavigation = () => html`
|
|
113
|
+
<lion-listbox name="combo" label="Rotate keyboard navigation" rotate-keyboard-navigation>
|
|
114
|
+
<lion-option .choiceValue=${'Apple'}>Apple</lion-option>
|
|
115
|
+
<lion-option .choiceValue=${'Artichoke'}>Artichoke</lion-option>
|
|
116
|
+
<lion-option .choiceValue=${'Asparagus'}>Asparagus</lion-option>
|
|
117
|
+
<lion-option .choiceValue=${'Banana'}>Banana</lion-option>
|
|
118
|
+
<lion-option .choiceValue=${'Beets'}>Beets</lion-option>
|
|
119
|
+
<lion-option .choiceValue=${'Bell pepper'}>Bell pepper</lion-option>
|
|
120
|
+
<lion-option .choiceValue=${'Broccoli'}>Broccoli</lion-option>
|
|
121
|
+
<lion-option .choiceValue=${'Brussels sprout'}>Brussels sprout</lion-option>
|
|
122
|
+
<lion-option .choiceValue=${'Cabbage'}>Cabbage</lion-option>
|
|
123
|
+
<lion-option .choiceValue=${'Carrot'}>Carrot</lion-option>
|
|
124
|
+
</lion-listbox>
|
|
125
|
+
`;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Disabled options
|
|
129
|
+
|
|
130
|
+
Navigation will skip over disabled options. Let's disable Artichoke and Brussel sprout, because they're gross.
|
|
131
|
+
|
|
132
|
+
```js preview-story
|
|
133
|
+
export const disabledRotateNavigation = () => html`
|
|
134
|
+
<lion-listbox name="combo" label="Rotate with disabled options" rotate-keyboard-navigation>
|
|
135
|
+
<lion-option .choiceValue=${'Apple'}>Apple</lion-option>
|
|
136
|
+
<lion-option .choiceValue=${'Artichoke'} disabled>Artichoke</lion-option>
|
|
137
|
+
<lion-option .choiceValue=${'Asparagus'}>Asparagus</lion-option>
|
|
138
|
+
<lion-option .choiceValue=${'Banana'}>Banana</lion-option>
|
|
139
|
+
<lion-option .choiceValue=${'Beets'}>Beets</lion-option>
|
|
140
|
+
<lion-option .choiceValue=${'Bell pepper'}>Bell pepper</lion-option>
|
|
141
|
+
<lion-option .choiceValue=${'Broccoli'}>Broccoli</lion-option>
|
|
142
|
+
<lion-option .choiceValue=${'Brussels sprout'} disabled>Brussels sprout</lion-option>
|
|
143
|
+
<lion-option .choiceValue=${'Cabbage'}>Cabbage</lion-option>
|
|
144
|
+
<lion-option .choiceValue=${'Carrot'}>Carrot</lion-option>
|
|
145
|
+
</lion-listbox>
|
|
146
|
+
`;
|
|
147
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Pagination >> Overview ||10
|
|
2
|
+
|
|
3
|
+
A web component that handles pagination.
|
|
4
|
+
|
|
5
|
+
```js script
|
|
6
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
7
|
+
import '@lion/ui/define/lion-pagination.js';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```js preview-story
|
|
11
|
+
export const main = () => html` <lion-pagination count="20" current="10"></lion-pagination> `;
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- You can pass the total number of pages in the `count` parameter, and the current page in the `current` parameter. If `current` is not defined it will default to the value 1.
|
|
17
|
+
- On a click or parameter change of `current` it will fire an event back called `current-changed`.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm i --save @lion/ui
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { LionPagination } from '@lion/ui/pagination.js';
|
|
27
|
+
// or
|
|
28
|
+
import '@lion/ui/define/lion-pagination.js';
|
|
29
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Pagination >> Use Cases ||20
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import '@lion/ui/define/lion-pagination.js';
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Without current defined
|
|
9
|
+
|
|
10
|
+
```js preview-story
|
|
11
|
+
export const withoutCurrentPage = () => {
|
|
12
|
+
return html` <lion-pagination count="20"></lion-pagination> `;
|
|
13
|
+
};
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Ensure a count value
|
|
17
|
+
|
|
18
|
+
Be sure to set a count value or you will get an "empty" pagination.
|
|
19
|
+
|
|
20
|
+
```js preview-story
|
|
21
|
+
export const ensureCount = () => {
|
|
22
|
+
return html` <lion-pagination></lion-pagination> `;
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Methods
|
|
27
|
+
|
|
28
|
+
There are the following methods available to control the pagination.
|
|
29
|
+
|
|
30
|
+
- `next()`: move forward in pagination
|
|
31
|
+
- `previous()`: goes back to pagination
|
|
32
|
+
- `first()`: to the first page
|
|
33
|
+
- `last()`: to the last page
|
|
34
|
+
- `goto(pageNumber)`: to the specific page
|
|
35
|
+
|
|
36
|
+
```js preview-story
|
|
37
|
+
export const methods = ({ shadowRoot }) => {
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
shadowRoot.getElementById('pagination-method-demo').innerText =
|
|
40
|
+
shadowRoot.getElementById('pagination-method').current;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return html`
|
|
44
|
+
<p>The current page is: <span id="pagination-method-demo"></span></p>
|
|
45
|
+
<lion-pagination
|
|
46
|
+
id="pagination-method"
|
|
47
|
+
count="100"
|
|
48
|
+
current="75"
|
|
49
|
+
@current-changed=${e => {
|
|
50
|
+
const paginationState = shadowRoot.getElementById('pagination-method-demo');
|
|
51
|
+
paginationState.innerText = e.target.current;
|
|
52
|
+
}}
|
|
53
|
+
></lion-pagination>
|
|
54
|
+
<section style="margin-top:16px">
|
|
55
|
+
<button @click=${() => shadowRoot.getElementById('pagination-method').previous()}>
|
|
56
|
+
Previous
|
|
57
|
+
</button>
|
|
58
|
+
<button @click=${() => shadowRoot.getElementById('pagination-method').next()}>Next</button>
|
|
59
|
+
<br />
|
|
60
|
+
<br />
|
|
61
|
+
<button @click=${() => shadowRoot.getElementById('pagination-method').first()}>First</button>
|
|
62
|
+
<button @click=${() => shadowRoot.getElementById('pagination-method').last()}>Last</button>
|
|
63
|
+
<br />
|
|
64
|
+
<br />
|
|
65
|
+
<button @click=${() => shadowRoot.getElementById('pagination-method').goto(55)}>
|
|
66
|
+
Go to 55
|
|
67
|
+
</button>
|
|
68
|
+
</section>
|
|
69
|
+
`;
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Event
|
|
74
|
+
|
|
75
|
+
`lion-pagination` fires an event on button click to notify the component's current state. It is useful for analytics purposes or to perform some actions on page change.
|
|
76
|
+
|
|
77
|
+
- `@current-changed`: triggers when the current page is changed
|
|
78
|
+
|
|
79
|
+
```js preview-story
|
|
80
|
+
export const event = ({ shadowRoot }) => {
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
shadowRoot.getElementById('pagination-event-demo-text').innerText =
|
|
83
|
+
shadowRoot.getElementById('pagination-event-demo').current;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return html`
|
|
87
|
+
<p>The current page is: <span id="pagination-event-demo-text"></span></p>
|
|
88
|
+
<lion-pagination
|
|
89
|
+
id="pagination-event-demo"
|
|
90
|
+
count="10"
|
|
91
|
+
current="5"
|
|
92
|
+
@current-changed=${e => {
|
|
93
|
+
const paginationState = shadowRoot.getElementById('pagination-event-demo-text');
|
|
94
|
+
paginationState.innerText = e.target.current;
|
|
95
|
+
}}
|
|
96
|
+
></lion-pagination>
|
|
97
|
+
`;
|
|
98
|
+
};
|
|
99
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { css, html } from 'lit';
|
|
2
|
+
import { LionProgressIndicator } from '@lion/ui/progress-indicator.js';
|
|
3
|
+
|
|
4
|
+
export class MyDeterminateProgressBar extends LionProgressIndicator {
|
|
5
|
+
static get styles() {
|
|
6
|
+
return [
|
|
7
|
+
css`
|
|
8
|
+
:host {
|
|
9
|
+
display: block;
|
|
10
|
+
position: relative;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 6px;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
background-color: #eee;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.progress__filled {
|
|
18
|
+
height: inherit;
|
|
19
|
+
background-color: green;
|
|
20
|
+
}
|
|
21
|
+
`,
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_graphicTemplate() {
|
|
26
|
+
return html` <div class="progress__filled" style="width: ${this._progressPercentage}%"></div> `;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
customElements.define('my-determinate-progress-bar', MyDeterminateProgressBar);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { LionProgressIndicator } from '@lion/ui/progress-indicator.js';
|
|
3
|
+
|
|
4
|
+
export class MyIndeterminateProgressSpinner extends LionProgressIndicator {
|
|
5
|
+
static get styles() {
|
|
6
|
+
return [
|
|
7
|
+
css`
|
|
8
|
+
.progress__icon {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
width: 48px;
|
|
11
|
+
height: 48px;
|
|
12
|
+
animation: spinner-rotate 2s linear infinite;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.progress__filled {
|
|
16
|
+
animation: spinner-dash 1.35s ease-in-out infinite;
|
|
17
|
+
fill: none;
|
|
18
|
+
stroke-width: 6px;
|
|
19
|
+
stroke: var(--primary-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@keyframes spinner-rotate {
|
|
23
|
+
to {
|
|
24
|
+
transform: rotate(360deg);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes spinner-dash {
|
|
29
|
+
0% {
|
|
30
|
+
stroke-dasharray: 6, 122;
|
|
31
|
+
stroke-dashoffset: 0;
|
|
32
|
+
}
|
|
33
|
+
50% {
|
|
34
|
+
stroke-dasharray: 100, 28;
|
|
35
|
+
stroke-dashoffset: -16;
|
|
36
|
+
}
|
|
37
|
+
100% {
|
|
38
|
+
stroke-dasharray: 6, 122;
|
|
39
|
+
stroke-dashoffset: -127;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
_graphicTemplate() {
|
|
47
|
+
return html`
|
|
48
|
+
<svg class="progress__icon" viewBox="20 20 47 47">
|
|
49
|
+
<circle class="progress__filled" cx="44" cy="44" r="20.2" />
|
|
50
|
+
</svg>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
customElements.define('my-indeterminate-progress-spinner', MyIndeterminateProgressSpinner);
|