@lion/ui 0.0.2 → 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/localize/src/number/parseNumber.js +15 -36
- package/components/localize/test/number/parseNumber.test.js +3 -12
- package/dist-types/components/localize/src/number/parseNumber.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/package.json +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit';
|
|
2
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
3
|
+
import { ScopedStylesController } from '@lion/ui/core.js';
|
|
4
|
+
import { regionMetaList } from '../../select-rich/src/regionMetaList.js';
|
|
5
|
+
|
|
6
|
+
export class HRegionCodeTable extends LitElement {
|
|
7
|
+
static properties = {
|
|
8
|
+
regionMeta: Object,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/** @type {ScopedStylesController} */
|
|
14
|
+
this.scopedStylesController = new ScopedStylesController(this);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {CSSResult} scope
|
|
19
|
+
*/
|
|
20
|
+
static scopedStyles(scope) {
|
|
21
|
+
return css`
|
|
22
|
+
/* Custom input range styling comes here, be aware that this won't work for polyfilled browsers */
|
|
23
|
+
.${scope} .sr-only {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0;
|
|
26
|
+
width: 1px;
|
|
27
|
+
height: 1px;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
clip-path: inset(100%);
|
|
30
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
border: 0;
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.${scope} table {
|
|
38
|
+
position: relative;
|
|
39
|
+
height: 300px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.${scope} th {
|
|
43
|
+
border-left: none;
|
|
44
|
+
border-right: none;
|
|
45
|
+
position: sticky;
|
|
46
|
+
top: -1px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.${scope} th .backdrop {
|
|
50
|
+
background-color: white;
|
|
51
|
+
opacity: 0.95;
|
|
52
|
+
filter: blur(4px);
|
|
53
|
+
position: absolute;
|
|
54
|
+
inset: -5px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.${scope} th .content {
|
|
58
|
+
position: relative;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.${scope} td {
|
|
62
|
+
border-left: none;
|
|
63
|
+
border-right: none;
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Render to light dom, so global table styling will be applied
|
|
69
|
+
createRenderRoot() {
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
render() {
|
|
74
|
+
const finalRegionMetaList = this.regionMetaList || regionMetaList;
|
|
75
|
+
return html`
|
|
76
|
+
<table role="table">
|
|
77
|
+
<caption class="sr-only">
|
|
78
|
+
Region codes
|
|
79
|
+
</caption>
|
|
80
|
+
<thead>
|
|
81
|
+
<tr>
|
|
82
|
+
<th align="left">
|
|
83
|
+
<span class="backdrop"></span><span class="content">country name</span>
|
|
84
|
+
</th>
|
|
85
|
+
<th align="right">
|
|
86
|
+
<span class="backdrop"></span><span class="content">region code</span>
|
|
87
|
+
</th>
|
|
88
|
+
<th align="right">
|
|
89
|
+
<span class="backdrop"></span><span class="content">country code</span>
|
|
90
|
+
</th>
|
|
91
|
+
</tr>
|
|
92
|
+
</thead>
|
|
93
|
+
<tbody>
|
|
94
|
+
${repeat(
|
|
95
|
+
finalRegionMetaList,
|
|
96
|
+
regionMeta => regionMeta.regionCode,
|
|
97
|
+
({ regionCode, countryCode, flagSymbol, nameForLocale }) =>
|
|
98
|
+
html` <tr>
|
|
99
|
+
<td align="left"><span aria-hidden="true">${flagSymbol}</span> ${nameForLocale}</td>
|
|
100
|
+
<td align="right">${regionCode}</td>
|
|
101
|
+
<td align="right">${countryCode}</td>
|
|
102
|
+
</tr>`,
|
|
103
|
+
)}
|
|
104
|
+
</tbody>
|
|
105
|
+
</table>
|
|
106
|
+
`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
customElements.define('h-region-code-table', HRegionCodeTable);
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Input Tel >> 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 { Unparseable } from '@lion/ui/form-core.js';
|
|
7
|
+
import { localize } from '@lion/ui/localize.js';
|
|
8
|
+
import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js';
|
|
9
|
+
import { PhoneUtilManager } from '@lion/ui/input-tel.js';
|
|
10
|
+
import '@lion/ui/define/lion-input-tel.js';
|
|
11
|
+
import './src/h-region-code-table.js';
|
|
12
|
+
import '../../../docs/fundamentals/systems/form/assets/h-output.js';
|
|
13
|
+
|
|
14
|
+
// TODO: make each example load/use the dependencies by default
|
|
15
|
+
// loadDefaultFeedbackMessages();
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Regions: some context
|
|
19
|
+
|
|
20
|
+
Say we have the following telephone number from Madrid, Spain: `+34919930432`.
|
|
21
|
+
|
|
22
|
+
It contains a [country code](https://en.wikipedia.org/wiki/Country_code) (34), an [area code](https://en.wikipedia.org/wiki/Telephone_numbering_plan#Area_code) (91) and a [dial code](https://en.wikipedia.org/wiki/Mobile_dial_code) (+34 91).
|
|
23
|
+
Input Tel interprets phone numbers based on their [region code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2): a two character long region representation('ES' in the telephone number above).
|
|
24
|
+
|
|
25
|
+
The table below lists all possible regions worldwide. When [allowed regions](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input-tel/#allowed-regions) are not configured,
|
|
26
|
+
all of them will be supported as values of Input Tel.
|
|
27
|
+
|
|
28
|
+
```js story
|
|
29
|
+
export const regionCodesTable = () => {
|
|
30
|
+
loadDefaultFeedbackMessages();
|
|
31
|
+
return html`<h-region-code-table></h-region-code-table>`;
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Active region
|
|
36
|
+
|
|
37
|
+
The active region (accessible via readonly accessor `.activeRegion`) determines how validation and formatting
|
|
38
|
+
should be applied. It is dependent on the following factors:
|
|
39
|
+
|
|
40
|
+
- [allowed regions](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input-tel/#allowed-regions): a list that determines what is allowed to become .activeRegion. If
|
|
41
|
+
[.allowedRegions has only one entry](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input-tel/#restrict-to-one-region), .activeRegion will always be this value.
|
|
42
|
+
- the modelValue or viewValue: once it contains sufficient info to derive its region code (and
|
|
43
|
+
the derived code is inside [allowed regions](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input-tel/#allowed-regions) if configured)
|
|
44
|
+
- active locale (and the derived locale is inside [allowed regions](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input-tel/#allowed-regions) if configured)
|
|
45
|
+
|
|
46
|
+
What follows from the list above is that .activeRegion can change dynamically, after a value
|
|
47
|
+
change in the text box by the user (or when locales or allowed regions would be changed by the
|
|
48
|
+
Application Developer).
|
|
49
|
+
|
|
50
|
+
### How active region is computed
|
|
51
|
+
|
|
52
|
+
The following heuristic will be applied:
|
|
53
|
+
|
|
54
|
+
1. check for **allowed regions**: if one region defined in .allowedRegions, use it.
|
|
55
|
+
2. check for **user input**: try to derive active region from user input
|
|
56
|
+
3. check for **locale**: try to get the region from locale (`html[lang]` attribute)
|
|
57
|
+
|
|
58
|
+
```js preview-story
|
|
59
|
+
export const heuristic = () => {
|
|
60
|
+
loadDefaultFeedbackMessages();
|
|
61
|
+
|
|
62
|
+
const initialAllowedRegions = ['CN', 'ES'];
|
|
63
|
+
const [inputTelRef, outputRef, selectRef] = [createRef(), createRef(), createRef()];
|
|
64
|
+
|
|
65
|
+
const setDerivedActiveRegionScenario = (
|
|
66
|
+
scenarioToSet,
|
|
67
|
+
inputTel = inputTelRef.value,
|
|
68
|
+
output = outputRef.value,
|
|
69
|
+
) => {
|
|
70
|
+
if (scenarioToSet === 'only-allowed-region') {
|
|
71
|
+
// activeRegion will be the top allowed region, which is 'NL'
|
|
72
|
+
inputTel.modelValue = undefined;
|
|
73
|
+
inputTel.allowedRegions = ['NL']; // activeRegion will always be the only option
|
|
74
|
+
output.innerText = '.activeRegion (NL) is only allowed region';
|
|
75
|
+
} else if (scenarioToSet === 'user-input') {
|
|
76
|
+
// activeRegion will be based on phone number => 'BE'
|
|
77
|
+
inputTel.allowedRegions = ['NL', 'BE', 'DE'];
|
|
78
|
+
inputTel.modelValue = '+3261234567'; // BE number
|
|
79
|
+
output.innerText = '.activeRegion (BE) is derived (since within allowedRegions)';
|
|
80
|
+
} else if (scenarioToSet === 'locale') {
|
|
81
|
+
localize.locale = 'en-GB';
|
|
82
|
+
// activeRegion will be `html[lang]`
|
|
83
|
+
inputTel.modelValue = undefined;
|
|
84
|
+
inputTel.allowedRegions = undefined;
|
|
85
|
+
output.innerText = `.activeRegion (${inputTel._langIso}) set to locale when inside allowed or all regions`;
|
|
86
|
+
} else {
|
|
87
|
+
output.innerText = '';
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return html`
|
|
91
|
+
<select
|
|
92
|
+
aria-label="Set scenario"
|
|
93
|
+
@change="${({ target }) => setDerivedActiveRegionScenario(target.value)}"
|
|
94
|
+
>
|
|
95
|
+
<option value="">--- select scenario ---</option>
|
|
96
|
+
<option value="only-allowed-region">1. only allowed region</option>
|
|
97
|
+
<option value="user-input">2. user input</option>
|
|
98
|
+
<option value="locale">3. locale</option>
|
|
99
|
+
</select>
|
|
100
|
+
<output style="display:block; min-height: 1.5em;" id="myOutput" ${ref(outputRef)}></output>
|
|
101
|
+
<lion-input-tel
|
|
102
|
+
${ref(inputTelRef)}
|
|
103
|
+
@model-value-changed="${({ detail }) => {
|
|
104
|
+
if (detail.isTriggeredByUser && selectRef.value) {
|
|
105
|
+
selectRef.value.value = '';
|
|
106
|
+
}
|
|
107
|
+
}}"
|
|
108
|
+
name="phoneNumber"
|
|
109
|
+
label="Active region"
|
|
110
|
+
.allowedRegions="${initialAllowedRegions}"
|
|
111
|
+
></lion-input-tel>
|
|
112
|
+
<h-output
|
|
113
|
+
.show="${[
|
|
114
|
+
'activeRegion',
|
|
115
|
+
{
|
|
116
|
+
name: 'all or allowed regions',
|
|
117
|
+
processor: el => JSON.stringify(el._allowedOrAllRegions),
|
|
118
|
+
},
|
|
119
|
+
'modelValue',
|
|
120
|
+
]}"
|
|
121
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
122
|
+
></h-output>
|
|
123
|
+
`;
|
|
124
|
+
};
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Allowed regions
|
|
128
|
+
|
|
129
|
+
`.allowedRegions` is an array of one or more region codes.
|
|
130
|
+
Once it is configured, validation and formatting will be restricted to those
|
|
131
|
+
values that are present in this list.
|
|
132
|
+
|
|
133
|
+
> Note that for [InputTelDropdown](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input-tel-dropdown/index.md), only allowed regions will
|
|
134
|
+
> be shown in the dropdown list.
|
|
135
|
+
|
|
136
|
+
```js preview-story
|
|
137
|
+
export const allowedRegions = () => {
|
|
138
|
+
loadDefaultFeedbackMessages();
|
|
139
|
+
return html`
|
|
140
|
+
<lion-input-tel
|
|
141
|
+
label="Allowed regions 'NL', 'BE', 'DE'"
|
|
142
|
+
help-text="Type '+31'(NL), '+32'(BE) or '+49'(DE) and see how activeRegion changes"
|
|
143
|
+
.allowedRegions="${['NL', 'BE', 'DE']}"
|
|
144
|
+
.modelValue="${'+31612345678'}"
|
|
145
|
+
name="phoneNumber"
|
|
146
|
+
></lion-input-tel>
|
|
147
|
+
<h-output
|
|
148
|
+
.show="${['modelValue', 'activeRegion']}"
|
|
149
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
150
|
+
></h-output>
|
|
151
|
+
`;
|
|
152
|
+
};
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Restrict to one region
|
|
156
|
+
|
|
157
|
+
When one allowed region is configured, validation and formatting will be restricted to just that
|
|
158
|
+
region (that means that changes of the region via viewValue won't have effect).
|
|
159
|
+
|
|
160
|
+
```js preview-story
|
|
161
|
+
export const oneAllowedRegion = () => {
|
|
162
|
+
loadDefaultFeedbackMessages();
|
|
163
|
+
return html`
|
|
164
|
+
<lion-input-tel
|
|
165
|
+
label="Only allowed region 'DE'"
|
|
166
|
+
help-text="Restricts validation / formatting to one region"
|
|
167
|
+
.allowedRegions="${['DE']}"
|
|
168
|
+
.modelValue="${'+31612345678'}"
|
|
169
|
+
name="phoneNumber"
|
|
170
|
+
></lion-input-tel>
|
|
171
|
+
<h-output
|
|
172
|
+
.show="${['modelValue', 'activeRegion', 'validationStates']}"
|
|
173
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
174
|
+
></h-output>
|
|
175
|
+
`;
|
|
176
|
+
};
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Format
|
|
180
|
+
|
|
181
|
+
### Format strategy
|
|
182
|
+
|
|
183
|
+
Determines what the formatter output should look like.
|
|
184
|
+
Formatting strategies as provided by awesome-phonenumber / google-libphonenumber.
|
|
185
|
+
|
|
186
|
+
Possible values:
|
|
187
|
+
|
|
188
|
+
| strategy | output |
|
|
189
|
+
| :------------ | ---------------------: |
|
|
190
|
+
| e164 | `+46707123456` |
|
|
191
|
+
| international | `+46 70 712 34 56` |
|
|
192
|
+
| national | `070-712 34 56` |
|
|
193
|
+
| significant | `707123456` |
|
|
194
|
+
| rfc3966 | `tel:+46-70-712-34-56` |
|
|
195
|
+
|
|
196
|
+
Also see:
|
|
197
|
+
|
|
198
|
+
- [awesome-phonenumber documentation](https://www.npmjs.com/package/awesome-phonenumber)
|
|
199
|
+
|
|
200
|
+
```js preview-story
|
|
201
|
+
export const formatStrategy = () => {
|
|
202
|
+
loadDefaultFeedbackMessages();
|
|
203
|
+
const inputTel = createRef();
|
|
204
|
+
return html`
|
|
205
|
+
<select @change="${({ target }) => (inputTel.value.formatStrategy = target.value)}">
|
|
206
|
+
<option value="e164">e164</option>
|
|
207
|
+
<option value="international">international</option>
|
|
208
|
+
<option value="national">national</option>
|
|
209
|
+
<option value="significant">significant</option>
|
|
210
|
+
<option value="rfc3966">rfc3966</option>
|
|
211
|
+
</select>
|
|
212
|
+
<lion-input-tel
|
|
213
|
+
${ref(inputTel)}
|
|
214
|
+
label="Format strategy"
|
|
215
|
+
help-text="Choose a strategy above"
|
|
216
|
+
.modelValue=${'+46707123456'}
|
|
217
|
+
format-strategy="national"
|
|
218
|
+
name="phoneNumber"
|
|
219
|
+
></lion-input-tel>
|
|
220
|
+
<h-output
|
|
221
|
+
.show="${['modelValue', 'formatStrategy']}"
|
|
222
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
223
|
+
></h-output>
|
|
224
|
+
`;
|
|
225
|
+
};
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Format country code style
|
|
229
|
+
|
|
230
|
+
You can also style the country code with parentheses.
|
|
231
|
+
|
|
232
|
+
```js preview-story
|
|
233
|
+
export const formatCountryCodeStyle = () => {
|
|
234
|
+
loadDefaultFeedbackMessages();
|
|
235
|
+
const inputTel = createRef();
|
|
236
|
+
return html`
|
|
237
|
+
<select @change="${({ target }) => (inputTel.value.formatStrategy = target.value)}">
|
|
238
|
+
<option value="e164">e164</option>
|
|
239
|
+
<option value="international">international</option>
|
|
240
|
+
<option value="rfc3966">rfc3966</option>
|
|
241
|
+
</select>
|
|
242
|
+
<lion-input-tel
|
|
243
|
+
${ref(inputTel)}
|
|
244
|
+
label="Format strategy"
|
|
245
|
+
help-text="Choose a strategy above"
|
|
246
|
+
.modelValue=${'+46707123456'}
|
|
247
|
+
format-country-code-style="parentheses"
|
|
248
|
+
name="phoneNumber"
|
|
249
|
+
></lion-input-tel>
|
|
250
|
+
<h-output
|
|
251
|
+
.show="${['modelValue', 'formatStrategy']}"
|
|
252
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
253
|
+
></h-output>
|
|
254
|
+
`;
|
|
255
|
+
};
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Live format
|
|
259
|
+
|
|
260
|
+
Type '6' in the example below to see how the phone number is formatted during typing.
|
|
261
|
+
|
|
262
|
+
See [awesome-phonenumber documentation](https://www.npmjs.com/package/awesome-phonenumber)
|
|
263
|
+
|
|
264
|
+
```js preview-story
|
|
265
|
+
export const liveFormat = () => {
|
|
266
|
+
loadDefaultFeedbackMessages();
|
|
267
|
+
return html`
|
|
268
|
+
<lion-input-tel
|
|
269
|
+
label="Realtime format on user input"
|
|
270
|
+
help-text="Partial numbers are also formatted"
|
|
271
|
+
.modelValue=${new Unparseable('+31')}
|
|
272
|
+
format-strategy="international"
|
|
273
|
+
live-format
|
|
274
|
+
name="phoneNumber"
|
|
275
|
+
></lion-input-tel>
|
|
276
|
+
`;
|
|
277
|
+
};
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Active phone number type
|
|
281
|
+
|
|
282
|
+
The readonly acessor `.activePhoneNumberType` outputs the current phone number type, based on
|
|
283
|
+
the textbox value.
|
|
284
|
+
|
|
285
|
+
Possible types: `fixed-line`, `fixed-line-or-mobile`, `mobile`, `pager`, `personal-number`, `premium-rate`, `shared-cost`, `toll-free`, `uan`, `voip`, `unknown`
|
|
286
|
+
|
|
287
|
+
Also see:
|
|
288
|
+
|
|
289
|
+
- [awesome-phonenumber documentation](https://www.npmjs.com/package/awesome-phonenumber)
|
|
290
|
+
|
|
291
|
+
```js preview-story
|
|
292
|
+
export const activePhoneNumberType = () => {
|
|
293
|
+
loadDefaultFeedbackMessages();
|
|
294
|
+
return html`
|
|
295
|
+
<lion-input-tel
|
|
296
|
+
label="Active phone number type"
|
|
297
|
+
.modelValue="${'+31612345678'}"
|
|
298
|
+
format-strategy="international"
|
|
299
|
+
name="phoneNumber"
|
|
300
|
+
></lion-input-tel>
|
|
301
|
+
<h-output
|
|
302
|
+
.show="${['activePhoneNumberType']}"
|
|
303
|
+
.readyPromise="${PhoneUtilManager.loadComplete}"
|
|
304
|
+
></h-output>
|
|
305
|
+
`;
|
|
306
|
+
};
|
|
307
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Input Tel Dropdown >> Examples ||30
|
|
2
|
+
|
|
3
|
+
```js script
|
|
4
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
5
|
+
import '@lion/ui/define/lion-select-rich.js';
|
|
6
|
+
import './src/intl-input-tel-dropdown.js';
|
|
7
|
+
import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Input Tel International
|
|
11
|
+
|
|
12
|
+
A visually advanced Subclasser implementation of `LionInputTelDropdown`.
|
|
13
|
+
|
|
14
|
+
Inspired by:
|
|
15
|
+
|
|
16
|
+
- [intl-tel-input](https://intl-tel-input.com/)
|
|
17
|
+
- [react-phone-input-2](https://github.com/bl00mber/react-phone-input-2)
|
|
18
|
+
|
|
19
|
+
```js preview-story
|
|
20
|
+
export const IntlInputTelDropdown = () => {
|
|
21
|
+
loadDefaultFeedbackMessages();
|
|
22
|
+
return html`
|
|
23
|
+
<intl-input-tel-dropdown
|
|
24
|
+
.preferredRegions="${['NL', 'PH']}"
|
|
25
|
+
.modelValue=${'+639608920056'}
|
|
26
|
+
label="Telephone number"
|
|
27
|
+
help-text="Advanced dropdown and styling"
|
|
28
|
+
name="phoneNumber"
|
|
29
|
+
></intl-input-tel-dropdown>
|
|
30
|
+
`;
|
|
31
|
+
};
|
|
32
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Input Tel Dropdown >> Overview ||10
|
|
2
|
+
|
|
3
|
+
Extension of Input Tel that prefixes a dropdown list that shows all possible regions / countries.
|
|
4
|
+
|
|
5
|
+
```js script
|
|
6
|
+
import { html } from '@mdjs/mdjs-preview';
|
|
7
|
+
import '@lion/ui/define/lion-input-tel-dropdown.js';
|
|
8
|
+
import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js preview-story
|
|
12
|
+
export const main = () => {
|
|
13
|
+
loadDefaultFeedbackMessages();
|
|
14
|
+
return html`
|
|
15
|
+
<lion-input-tel-dropdown label="Telephone number" name="phoneNumber"></lion-input-tel-dropdown>
|
|
16
|
+
`;
|
|
17
|
+
};
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Extends our [input-tel](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/input-tel/overview.md)
|
|
23
|
+
- Shows dropdown list with all possible regions
|
|
24
|
+
- Shows only allowed regions in dropdown list when .allowedRegions is configured
|
|
25
|
+
- Highlights regions on top of dropdown list when .preferredRegions is configured
|
|
26
|
+
- Generates template meta data for advanced
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm i --save @lion/ui
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import { LionInputTelDropdown } from '@lion/ui/input-tel-dropdown.js';
|
|
36
|
+
// or
|
|
37
|
+
import '@lion/ui/define/lion-input-tel-dropdown.js';
|
|
38
|
+
```
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
2
|
+
import { html, css } from 'lit';
|
|
3
|
+
import { ref } from 'lit/directives/ref.js';
|
|
4
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
5
|
+
import { LionInputTelDropdown } from '@lion/ui/input-tel-dropdown.js';
|
|
6
|
+
import {
|
|
7
|
+
IntlSelectRich,
|
|
8
|
+
IntlOption,
|
|
9
|
+
IntlSeparator,
|
|
10
|
+
} from '../../select-rich/src/intl-select-rich.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {import('@lion/ui/input-tel-dropdown/types.js').TemplateDataForDropdownInputTel}TemplateDataForDropdownInputTel
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// Example implementation for https://intl-tel-input.com/
|
|
17
|
+
export class IntlInputTelDropdown extends ScopedElementsMixin(LionInputTelDropdown) {
|
|
18
|
+
/**
|
|
19
|
+
* @configure LitElement
|
|
20
|
+
* @enhance LionInputTelDropdown
|
|
21
|
+
*/
|
|
22
|
+
static styles = [
|
|
23
|
+
super.styles,
|
|
24
|
+
css`
|
|
25
|
+
:host,
|
|
26
|
+
::slotted(*) {
|
|
27
|
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
line-height: 1.42857143;
|
|
30
|
+
color: #333;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host {
|
|
34
|
+
max-width: 300px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.input-group__container {
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 34px;
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
line-height: 1.42857143;
|
|
42
|
+
color: #555;
|
|
43
|
+
background-color: #fff;
|
|
44
|
+
background-image: none;
|
|
45
|
+
border: 1px solid #ccc;
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
-webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
|
|
48
|
+
box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
|
|
49
|
+
-webkit-transition: border-color ease-in-out 0.15s, -webkit-box-shadow ease-in-out 0.15s;
|
|
50
|
+
-o-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
|
51
|
+
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.input-group__input {
|
|
55
|
+
padding: 6px;
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.input-group__input ::slotted(input) {
|
|
60
|
+
border: none;
|
|
61
|
+
outline: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([focused]) .input-group__container {
|
|
65
|
+
border-color: #66afe9;
|
|
66
|
+
outline: 0;
|
|
67
|
+
-webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%), 0 0 8px rgb(102 175 233 / 60%);
|
|
68
|
+
box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%), 0 0 8px rgb(102 175 233 / 60%);
|
|
69
|
+
}
|
|
70
|
+
`,
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
static templates = {
|
|
74
|
+
...(super.templates || {}),
|
|
75
|
+
/**
|
|
76
|
+
* @param {TemplateDataForDropdownInputTel} templateDataForDropdown
|
|
77
|
+
*/
|
|
78
|
+
dropdown: templateDataForDropdown => {
|
|
79
|
+
const { refs, data } = templateDataForDropdown;
|
|
80
|
+
// TODO: once spread directive available, use it per ref (like ref(refs?.dropdown?.ref))
|
|
81
|
+
return html`
|
|
82
|
+
<intl-select-rich
|
|
83
|
+
${ref(refs?.dropdown?.ref)}
|
|
84
|
+
label="${refs?.dropdown?.labels?.country}"
|
|
85
|
+
label-sr-only
|
|
86
|
+
@model-value-changed="${refs?.dropdown?.listeners['model-value-changed']}"
|
|
87
|
+
style="${refs?.dropdown?.props?.style}"
|
|
88
|
+
>
|
|
89
|
+
${data?.regionMetaListPreferred?.length
|
|
90
|
+
? html` ${repeat(
|
|
91
|
+
data.regionMetaListPreferred,
|
|
92
|
+
regionMeta => regionMeta.regionCode,
|
|
93
|
+
regionMeta =>
|
|
94
|
+
html`${this.templates.dropdownOption(templateDataForDropdown, regionMeta)} `,
|
|
95
|
+
)}<intl-separator></intl-separator>`
|
|
96
|
+
: ''}
|
|
97
|
+
${repeat(
|
|
98
|
+
data.regionMetaList,
|
|
99
|
+
regionMeta => regionMeta.regionCode,
|
|
100
|
+
regionMeta =>
|
|
101
|
+
html`${this.templates.dropdownOption(templateDataForDropdown, regionMeta)} `,
|
|
102
|
+
)}
|
|
103
|
+
</intl-select-rich>
|
|
104
|
+
`;
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* @param {TemplateDataForDropdownInputTel} templateDataForDropdown
|
|
108
|
+
* @param {RegionMeta} regionMeta
|
|
109
|
+
*/
|
|
110
|
+
// eslint-disable-next-line class-methods-use-this
|
|
111
|
+
dropdownOption: (templateDataForDropdown, regionMeta) => html`
|
|
112
|
+
<intl-option .choiceValue="${regionMeta.regionCode}" .regionMeta="${regionMeta}">
|
|
113
|
+
</intl-option>
|
|
114
|
+
`,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @configure ScopedElementsMixin
|
|
119
|
+
*/
|
|
120
|
+
static scopedElements = {
|
|
121
|
+
...super.scopedElements,
|
|
122
|
+
'intl-select-rich': IntlSelectRich,
|
|
123
|
+
'intl-option': IntlOption,
|
|
124
|
+
'intl-separator': IntlSeparator,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
customElements.define('intl-input-tel-dropdown', IntlInputTelDropdown);
|