@xplortech/apollo-core 2.4.3 → 2.6.0
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/.typings/apollo-components.html-data.json +1257 -3360
- package/build/style.css +4227 -1019
- package/dist/apollo-core/apollo-core.css +18 -27
- package/dist/apollo-core/apollo-core.esm.js +1 -1
- package/dist/apollo-core/p-02167464.entry.js +1 -0
- package/dist/apollo-core/p-0bce3874.entry.js +1 -0
- package/dist/apollo-core/{p-8c1f73ea.entry.js → p-1fd3dc87.entry.js} +1 -1
- package/dist/apollo-core/{p-0ac33b3a.entry.js → p-42016063.entry.js} +1 -1
- package/dist/apollo-core/{p-31461db7.entry.js → p-5549756c.entry.js} +1 -1
- package/dist/apollo-core/p-56fa4941.entry.js +1 -0
- package/dist/apollo-core/p-76c324da.entry.js +1 -0
- package/dist/apollo-core/p-7a3224b4.entry.js +1 -0
- package/dist/apollo-core/p-7e924697.entry.js +1 -0
- package/dist/apollo-core/{p-b1f4604d.entry.js → p-8a1affce.entry.js} +1 -1
- package/dist/apollo-core/p-9efca9e1.entry.js +1 -0
- package/dist/apollo-core/p-C_Z2nG0p.js +2 -0
- package/dist/apollo-core/p-b252b380.entry.js +1 -0
- package/dist/apollo-core/p-c91daac1.entry.js +1 -0
- package/dist/apollo-core/p-d9b62508.entry.js +1 -0
- package/dist/apollo-core/p-eaea16d1.entry.js +1 -0
- package/dist/apollo-core/p-eed13bca.entry.js +1 -0
- package/dist/apollo-core/{p-4fab8172.entry.js → p-f5af9539.entry.js} +1 -1
- package/dist/cjs/apollo-core.cjs.js +3 -3
- package/dist/cjs/{index-D__N_vw2.js → index-DH6pgWru.js} +137 -87
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/xpl-accordion.cjs.entry.js +5 -5
- package/dist/cjs/xpl-application-shell.cjs.entry.js +4 -4
- package/dist/cjs/xpl-avatar_47.cjs.entry.js +18618 -0
- package/dist/cjs/xpl-button-row.cjs.entry.js +4 -4
- package/dist/cjs/xpl-calendar.cjs.entry.js +4 -4
- package/dist/cjs/xpl-dynamic-table-cell.cjs.entry.js +5 -5
- package/dist/cjs/xpl-dynamic-table-row.cjs.entry.js +5 -5
- package/dist/cjs/xpl-dynamic-table.cjs.entry.js +4 -4
- package/dist/cjs/xpl-grid-item.cjs.entry.js +4 -4
- package/dist/cjs/xpl-grid.cjs.entry.js +4 -4
- package/dist/cjs/xpl-large-card.cjs.entry.js +4 -4
- package/dist/cjs/xpl-list.cjs.entry.js +4 -4
- package/dist/cjs/xpl-main-nav.cjs.entry.js +4 -4
- package/dist/cjs/xpl-table-header-cell.cjs.entry.js +3 -3
- package/dist/cjs/xpl-table-header.cjs.entry.js +4 -4
- package/dist/cjs/xpl-toggle.cjs.entry.js +6 -6
- package/dist/cjs/xpl-toolbar.cjs.entry.js +5 -5
- package/dist/collection/collection-manifest.json +10 -3
- package/dist/collection/components/xpl-accordion/accordion.stories.js +4 -0
- package/dist/collection/components/xpl-accordion/xpl-accordion.js +3 -3
- package/dist/collection/components/xpl-application-shell/application-shell.stories.js +4 -0
- package/dist/collection/components/xpl-application-shell/xpl-application-shell.js +2 -2
- package/dist/collection/components/xpl-avatar/avatar.stories.js +4 -0
- package/dist/collection/components/xpl-avatar/xpl-avatar.js +3 -3
- package/dist/collection/components/xpl-backdrop/backdrop.stories.js +4 -0
- package/dist/collection/components/xpl-backdrop/xpl-backdrop.js +2 -2
- package/dist/collection/components/xpl-badge/badge.stories.js +108 -33
- package/dist/collection/components/xpl-badge/xpl-badge.js +122 -14
- package/dist/collection/components/xpl-banner/banner.stories.js +64 -0
- package/dist/collection/components/xpl-banner/xpl-banner.js +295 -0
- package/dist/collection/components/xpl-breadcrumbs/breadcrumbs.stories.js +4 -0
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js +2 -2
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js +2 -2
- package/dist/collection/components/xpl-button/button.stories.js +102 -98
- package/dist/collection/components/xpl-button/xpl-button.js +183 -93
- package/dist/collection/components/xpl-button-row/xpl-button-row.js +2 -2
- package/dist/collection/components/xpl-calendar/calendar.stories.js +4 -0
- package/dist/collection/components/xpl-calendar/xpl-calendar.js +2 -2
- package/dist/collection/components/xpl-checkbox/checkbox.stories.js +4 -0
- package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +4 -4
- package/dist/collection/components/xpl-choicelist/choicelist.stories.js +4 -0
- package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +2 -2
- package/dist/collection/components/xpl-content-area/xpl-content-area.js +2 -2
- package/dist/collection/components/xpl-dashboard/xpl-dashboard.js +2 -2
- package/dist/collection/components/xpl-data-card/data-card.stories.js +4 -0
- package/dist/collection/components/xpl-data-card/xpl-data-card.js +12 -26
- package/dist/collection/components/xpl-divider/divider.stories.js +4 -0
- package/dist/collection/components/xpl-divider/xpl-divider.js +2 -2
- package/dist/collection/components/xpl-dropdown/dropdown.stories.js +4 -0
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-group/xpl-dropdown-group.js +2 -2
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-heading/xpl-dropdown-heading.js +2 -2
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.js +29 -4
- package/dist/collection/components/xpl-dropdown/xpl-dropdown.js +120 -79
- package/dist/collection/components/xpl-dynamic-table/dynamic-table.stories.js +4 -0
- package/dist/collection/components/xpl-dynamic-table/xpl-dynamic-table.js +2 -2
- package/dist/collection/components/xpl-dynamic-table-cell/xpl-dynamic-table-cell.js +3 -3
- package/dist/collection/components/xpl-dynamic-table-row/xpl-dynamic-table-row.js +3 -3
- package/dist/collection/components/xpl-grid/xpl-grid.js +2 -2
- package/dist/collection/components/xpl-grid-item/xpl-grid-item.js +2 -2
- package/dist/collection/components/xpl-header-accordion/header-accordion.stories.js +4 -0
- package/dist/collection/components/xpl-header-accordion/xpl-header-accordion.js +2 -2
- package/dist/collection/components/xpl-icon/icon-types.js +1 -0
- package/dist/collection/components/xpl-icon/icons.stories.js +47 -12
- package/dist/collection/components/xpl-icon/xpl-icon.js +14 -16
- package/dist/collection/components/xpl-input/input.stories.js +79 -9
- package/dist/collection/components/xpl-input/xpl-input-color/xpl-input-color.js +9 -9
- package/dist/collection/components/xpl-input/xpl-input-date/xpl-input-date.js +55 -17
- package/dist/collection/components/xpl-input/xpl-input-file/xpl-input-file.js +5 -5
- package/dist/collection/components/xpl-input/xpl-input-phone/phone-country-data.js +58 -0
- package/dist/collection/components/xpl-input/xpl-input-phone/phone-format.js +219 -0
- package/dist/collection/components/xpl-input/xpl-input-phone/xpl-input-phone.js +469 -0
- package/dist/collection/components/xpl-input/xpl-input-time/xpl-input-time.js +3 -3
- package/dist/collection/components/xpl-input/xpl-input.js +101 -7
- package/dist/collection/components/xpl-large-card/large-card.stories.js +4 -0
- package/dist/collection/components/xpl-large-card/xpl-large-card.js +2 -2
- package/dist/collection/components/xpl-list/list.stories.js +4 -0
- package/dist/collection/components/xpl-list/xpl-list.js +2 -2
- package/dist/collection/components/xpl-main-nav/xpl-main-nav.js +2 -2
- package/dist/collection/components/xpl-modal/modal.stories.js +4 -0
- package/dist/collection/components/xpl-modal/xpl-modal.js +2 -2
- package/dist/collection/components/xpl-nav-item/xpl-nav-item.js +3 -3
- package/dist/collection/components/xpl-pagination/pagination.stories.js +4 -0
- package/dist/collection/components/xpl-pagination/xpl-pagination.js +4 -4
- package/dist/collection/components/xpl-panel/panel.stories.js +51 -0
- package/dist/collection/components/xpl-panel/xpl-panel.js +60 -0
- package/dist/collection/components/xpl-popover/popover.stories.js +4 -0
- package/dist/collection/components/xpl-popover/xpl-popover.js +5 -5
- package/dist/collection/components/xpl-progress/progress.stories.js +4 -0
- package/dist/collection/components/xpl-progress/xpl-progress.js +2 -2
- package/dist/collection/components/xpl-progress-bar/progress-bar.stories.js +96 -0
- package/dist/collection/components/xpl-progress-bar/xpl-progress-bar.js +158 -0
- package/dist/collection/components/xpl-radio/radio.stories.js +4 -0
- package/dist/collection/components/xpl-radio/xpl-radio.js +4 -4
- package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +2 -2
- package/dist/collection/components/xpl-select/select.stories.js +4 -0
- package/dist/collection/components/xpl-select/xpl-select.js +11 -17
- package/dist/collection/components/xpl-side-nav/side-nav.stories.js +519 -0
- package/dist/collection/components/xpl-side-nav/xpl-side-nav-item/xpl-side-nav-item.js +259 -0
- package/dist/collection/components/xpl-side-nav/xpl-side-nav.js +32 -0
- package/dist/collection/components/xpl-skeleton/skeleton.stories.js +4 -0
- package/dist/collection/components/xpl-skeleton/xpl-skeleton.js +2 -2
- package/dist/collection/components/xpl-slideout/slideout.stories.js +6 -0
- package/dist/collection/components/xpl-slideout/xpl-slideout.js +2 -2
- package/dist/collection/components/xpl-tab/xpl-tab.js +3 -3
- package/dist/collection/components/xpl-tab-panel/xpl-tab-panel.js +3 -3
- package/dist/collection/components/xpl-table/table.stories.js +4 -0
- package/dist/collection/components/xpl-table/xpl-table.js +6 -6
- package/dist/collection/components/xpl-table-header/table-header.stories.js +4 -0
- package/dist/collection/components/xpl-table-header/xpl-table-header.js +2 -2
- package/dist/collection/components/xpl-table-header-cell/table-header-cell.stories.js +4 -0
- package/dist/collection/components/xpl-table-header-cell/xpl-table-header-cell.js +6 -16
- package/dist/collection/components/xpl-tabs/tabs.stories.js +4 -0
- package/dist/collection/components/xpl-tabs/xpl-tabs.js +6 -6
- package/dist/collection/components/xpl-tag/xpl-tag.js +3 -3
- package/dist/collection/components/xpl-toast/toast.stories.js +4 -0
- package/dist/collection/components/xpl-toast/xpl-toast.js +3 -3
- package/dist/collection/components/xpl-toggle/toggle.stories.js +4 -0
- package/dist/collection/components/xpl-toggle/xpl-toggle.js +4 -4
- package/dist/collection/components/xpl-toolbar/xpl-toolbar.js +3 -3
- package/dist/collection/components/xpl-tooltip/tooltip.stories.js +4 -0
- package/dist/collection/components/xpl-tooltip/xpl-tooltip.js +2 -2
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +2 -2
- package/dist/collection/utils/layout-ancestors.js +22 -0
- package/dist/components/index.js +1 -1
- package/dist/components/xpl-accordion.js +1 -1
- package/dist/components/xpl-application-shell.js +1 -1
- package/dist/components/xpl-avatar.js +1 -1
- package/dist/components/xpl-avatar2.js +1 -1
- package/dist/components/xpl-backdrop.js +1 -1
- package/dist/components/xpl-backdrop2.js +1 -1
- package/dist/components/xpl-badge.js +1 -1
- package/dist/components/xpl-badge2.js +1 -1
- package/dist/components/xpl-banner.d.ts +11 -0
- package/dist/components/xpl-banner.js +1 -0
- package/dist/components/xpl-breadcrumb-item.js +1 -1
- package/dist/components/xpl-breadcrumbs.js +1 -1
- package/dist/components/xpl-button-row.js +1 -1
- package/dist/components/xpl-button.js +1 -1
- package/dist/components/xpl-button2.js +1 -1
- package/dist/components/xpl-calendar.js +1 -1
- package/dist/components/xpl-checkbox.js +1 -1
- package/dist/components/xpl-checkbox2.js +1 -1
- package/dist/components/xpl-choicelist.js +1 -1
- package/dist/components/xpl-content-area.js +1 -1
- package/dist/components/xpl-dashboard.js +1 -1
- package/dist/components/xpl-data-card.js +1 -1
- package/dist/components/xpl-divider.js +1 -1
- package/dist/components/xpl-divider2.js +1 -1
- package/dist/components/xpl-dropdown-group.js +1 -1
- package/dist/components/xpl-dropdown-group2.js +1 -1
- package/dist/components/xpl-dropdown-heading.js +1 -1
- package/dist/components/xpl-dropdown-heading2.js +1 -1
- package/dist/components/xpl-dropdown-option.js +1 -1
- package/dist/components/xpl-dropdown-option2.js +1 -1
- package/dist/components/xpl-dropdown.js +1 -1
- package/dist/components/xpl-dropdown2.js +1 -1
- package/dist/components/xpl-dynamic-table-cell.js +1 -1
- package/dist/components/xpl-dynamic-table-row.js +1 -1
- package/dist/components/xpl-dynamic-table.js +1 -1
- package/dist/components/xpl-grid-item.js +1 -1
- package/dist/components/xpl-grid.js +1 -1
- package/dist/components/xpl-header-accordion.js +1 -1
- package/dist/components/xpl-icon.js +1 -1
- package/dist/components/xpl-icon2.js +1 -6
- package/dist/components/xpl-input-date.js +1 -1
- package/dist/components/xpl-input-date2.js +1 -1
- package/dist/components/xpl-input-file.js +1 -1
- package/dist/components/xpl-input-file2.js +1 -1
- package/dist/components/xpl-input-phone.d.ts +11 -0
- package/dist/components/xpl-input-phone.js +1 -0
- package/dist/components/xpl-input-time.js +1 -1
- package/dist/components/xpl-input.js +1 -1
- package/dist/components/xpl-input2.js +1 -1
- package/dist/components/xpl-large-card.js +1 -1
- package/dist/components/xpl-list.js +1 -1
- package/dist/components/xpl-main-nav.js +1 -1
- package/dist/components/xpl-modal.js +1 -1
- package/dist/components/xpl-nav-item.js +1 -1
- package/dist/components/xpl-pagination.js +1 -1
- package/dist/components/xpl-panel.d.ts +11 -0
- package/dist/components/xpl-panel.js +1 -0
- package/dist/components/xpl-popover.js +1 -1
- package/dist/components/xpl-popover2.js +1 -1
- package/dist/components/xpl-progress-bar.d.ts +11 -0
- package/dist/components/xpl-progress-bar.js +1 -0
- package/dist/components/xpl-progress.js +1 -1
- package/dist/components/xpl-radio.js +1 -1
- package/dist/components/xpl-radio2.js +1 -1
- package/dist/components/xpl-secondary-nav.js +1 -1
- package/dist/components/xpl-select.js +1 -1
- package/dist/components/xpl-select2.js +1 -1
- package/dist/components/xpl-side-nav-item.d.ts +11 -0
- package/dist/components/xpl-side-nav-item.js +1 -0
- package/dist/components/xpl-side-nav.d.ts +11 -0
- package/dist/components/xpl-side-nav.js +1 -0
- package/dist/components/xpl-skeleton.js +1 -1
- package/dist/components/xpl-slideout.js +1 -1
- package/dist/components/xpl-tab-panel.js +1 -1
- package/dist/components/xpl-tab.js +1 -1
- package/dist/components/xpl-table-header.js +1 -1
- package/dist/components/xpl-table.js +1 -1
- package/dist/components/xpl-tabs.js +1 -1
- package/dist/components/xpl-tag.js +1 -1
- package/dist/components/xpl-tag2.js +1 -1
- package/dist/components/xpl-toast.js +1 -1
- package/dist/components/xpl-toggle.js +1 -1
- package/dist/components/xpl-toolbar.js +1 -1
- package/dist/components/xpl-tooltip.js +1 -1
- package/dist/components/xpl-tooltip2.js +1 -1
- package/dist/components/xpl-utility-bar.js +1 -1
- package/dist/docs/xpl-accordion/readme.md +66 -0
- package/dist/docs/xpl-application-shell/readme.md +33 -0
- package/dist/docs/xpl-avatar/readme.md +40 -0
- package/dist/docs/xpl-backdrop/readme.md +34 -0
- package/dist/docs/xpl-badge/readme.md +122 -0
- package/dist/docs/xpl-banner/readme.md +166 -0
- package/dist/docs/xpl-breadcrumbs/xpl-breadcrumb-item/readme.md +19 -0
- package/dist/docs/xpl-breadcrumbs/xpl-breadcrumbs/readme.md +22 -0
- package/dist/docs/xpl-button/readme.md +181 -0
- package/dist/docs/xpl-button-row/readme.md +42 -0
- package/dist/docs/xpl-calendar/readme.md +49 -0
- package/dist/docs/xpl-checkbox/readme.md +49 -0
- package/dist/docs/xpl-choicelist/readme.md +44 -0
- package/dist/docs/xpl-content-area/readme.md +17 -0
- package/dist/docs/xpl-dashboard/readme.md +10 -0
- package/dist/docs/xpl-data-card/readme.md +54 -0
- package/dist/docs/xpl-divider/readme.md +30 -0
- package/dist/docs/xpl-dropdown/readme.md +83 -0
- package/dist/docs/xpl-dropdown/xpl-dropdown-group/readme.md +40 -0
- package/dist/docs/xpl-dropdown/xpl-dropdown-heading/readme.md +30 -0
- package/dist/docs/xpl-dropdown/xpl-dropdown-option/readme.md +42 -0
- package/dist/docs/xpl-dynamic-table/readme.md +19 -0
- package/dist/docs/xpl-dynamic-table-cell/readme.md +18 -0
- package/dist/docs/xpl-dynamic-table-row/readme.md +19 -0
- package/dist/docs/xpl-grid/readme.md +10 -0
- package/dist/docs/xpl-grid-item/readme.md +20 -0
- package/dist/docs/xpl-header-accordion/readme.md +39 -0
- package/dist/docs/xpl-icon/readme.md +92 -0
- package/dist/docs/xpl-input/readme.md +100 -0
- package/dist/docs/xpl-input/xpl-input-color/readme.md +65 -0
- package/dist/docs/xpl-input/xpl-input-date/readme.md +56 -0
- package/dist/docs/xpl-input/xpl-input-file/readme.md +79 -0
- package/dist/docs/xpl-input/xpl-input-phone/readme.md +167 -0
- package/dist/docs/xpl-input/xpl-input-time/readme.md +73 -0
- package/dist/docs/xpl-large-card/readme.md +40 -0
- package/dist/docs/xpl-list/readme.md +34 -0
- package/dist/docs/xpl-main-nav/readme.md +28 -0
- package/dist/docs/xpl-modal/readme.md +58 -0
- package/dist/docs/xpl-nav-item/readme.md +24 -0
- package/dist/docs/xpl-pagination/readme.md +55 -0
- package/dist/docs/xpl-panel/readme.md +83 -0
- package/dist/docs/xpl-popover/readme.md +48 -0
- package/dist/docs/xpl-progress/readme.md +22 -0
- package/dist/docs/xpl-progress-bar/readme.md +145 -0
- package/dist/docs/xpl-radio/readme.md +43 -0
- package/dist/docs/xpl-secondary-nav/readme.md +10 -0
- package/dist/docs/xpl-select/readme.md +89 -0
- package/dist/docs/xpl-side-nav/readme.md +71 -0
- package/dist/docs/xpl-side-nav/xpl-side-nav-item/readme.md +115 -0
- package/dist/docs/xpl-skeleton/readme.md +31 -0
- package/dist/docs/xpl-slideout/readme.md +47 -0
- package/dist/docs/xpl-tab/readme.md +25 -0
- package/dist/docs/xpl-tab-panel/readme.md +18 -0
- package/dist/docs/xpl-table/readme.md +46 -0
- package/dist/docs/xpl-table-header/readme.md +13 -0
- package/dist/docs/xpl-table-header-cell/readme.md +47 -0
- package/dist/docs/xpl-tabs/readme.md +55 -0
- package/dist/docs/xpl-tag/readme.md +30 -0
- package/dist/docs/xpl-toast/readme.md +97 -0
- package/dist/docs/xpl-toggle/readme.md +23 -0
- package/dist/docs/xpl-toolbar/readme.md +18 -0
- package/dist/docs/xpl-tooltip/readme.md +35 -0
- package/dist/docs/xpl-utility-bar/readme.md +55 -0
- package/dist/esm/apollo-core.js +4 -4
- package/dist/esm/{index-DhZas3eX.js → index-C_Z2nG0p.js} +137 -87
- package/dist/esm/loader.js +3 -3
- package/dist/esm/xpl-accordion.entry.js +5 -5
- package/dist/esm/xpl-application-shell.entry.js +4 -4
- package/dist/esm/xpl-avatar_47.entry.js +18570 -0
- package/dist/esm/xpl-button-row.entry.js +4 -4
- package/dist/esm/xpl-calendar.entry.js +4 -4
- package/dist/esm/xpl-dynamic-table-cell.entry.js +5 -5
- package/dist/esm/xpl-dynamic-table-row.entry.js +5 -5
- package/dist/esm/xpl-dynamic-table.entry.js +4 -4
- package/dist/esm/xpl-grid-item.entry.js +4 -4
- package/dist/esm/xpl-grid.entry.js +4 -4
- package/dist/esm/xpl-large-card.entry.js +4 -4
- package/dist/esm/xpl-list.entry.js +4 -4
- package/dist/esm/xpl-main-nav.entry.js +4 -4
- package/dist/esm/xpl-table-header-cell.entry.js +3 -3
- package/dist/esm/xpl-table-header.entry.js +4 -4
- package/dist/esm/xpl-toggle.entry.js +6 -6
- package/dist/esm/xpl-toolbar.entry.js +5 -5
- package/dist/types/components/xpl-accordion/xpl-accordion.d.ts +1 -1
- package/dist/types/components/xpl-application-shell/application-shell.stories.d.ts +4 -0
- package/dist/types/components/xpl-application-shell/xpl-application-shell.d.ts +1 -1
- package/dist/types/components/xpl-avatar/avatar.stories.d.ts +4 -0
- package/dist/types/components/xpl-avatar/xpl-avatar.d.ts +1 -1
- package/dist/types/components/xpl-backdrop/backdrop.stories.d.ts +4 -0
- package/dist/types/components/xpl-backdrop/xpl-backdrop.d.ts +1 -1
- package/dist/types/components/xpl-badge/badge.stories.d.ts +66 -11
- package/dist/types/components/xpl-badge/xpl-badge.d.ts +9 -2
- package/dist/types/components/xpl-banner/banner.stories.d.ts +77 -0
- package/dist/types/components/xpl-banner/xpl-banner.d.ts +20 -0
- package/dist/types/components/xpl-breadcrumbs/breadcrumbs.stories.d.ts +4 -0
- package/dist/types/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.d.ts +1 -1
- package/dist/types/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.d.ts +1 -1
- package/dist/types/components/xpl-button/button.stories.d.ts +68 -30
- package/dist/types/components/xpl-button/xpl-button.d.ts +14 -8
- package/dist/types/components/xpl-button-row/xpl-button-row.d.ts +1 -1
- package/dist/types/components/xpl-calendar/calendar.stories.d.ts +4 -0
- package/dist/types/components/xpl-calendar/xpl-calendar.d.ts +1 -1
- package/dist/types/components/xpl-checkbox/checkbox.stories.d.ts +4 -0
- package/dist/types/components/xpl-checkbox/xpl-checkbox.d.ts +1 -1
- package/dist/types/components/xpl-choicelist/choicelist.stories.d.ts +4 -0
- package/dist/types/components/xpl-choicelist/xpl-choicelist.d.ts +1 -1
- package/dist/types/components/xpl-content-area/xpl-content-area.d.ts +1 -1
- package/dist/types/components/xpl-dashboard/xpl-dashboard.d.ts +1 -1
- package/dist/types/components/xpl-data-card/data-card.stories.d.ts +4 -0
- package/dist/types/components/xpl-data-card/xpl-data-card.d.ts +3 -4
- package/dist/types/components/xpl-divider/divider.stories.d.ts +4 -0
- package/dist/types/components/xpl-divider/xpl-divider.d.ts +1 -1
- package/dist/types/components/xpl-dropdown/dropdown-option.d.ts +1 -0
- package/dist/types/components/xpl-dropdown/dropdown.stories.d.ts +1 -1
- package/dist/types/components/xpl-dropdown/xpl-dropdown-group/xpl-dropdown-group.d.ts +1 -1
- package/dist/types/components/xpl-dropdown/xpl-dropdown-heading/xpl-dropdown-heading.d.ts +1 -1
- package/dist/types/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.d.ts +3 -2
- package/dist/types/components/xpl-dropdown/xpl-dropdown.d.ts +11 -8
- package/dist/types/components/xpl-dynamic-table/dynamic-table.stories.d.ts +4 -0
- package/dist/types/components/xpl-dynamic-table/xpl-dynamic-table.d.ts +1 -1
- package/dist/types/components/xpl-dynamic-table-cell/xpl-dynamic-table-cell.d.ts +1 -1
- package/dist/types/components/xpl-dynamic-table-row/xpl-dynamic-table-row.d.ts +1 -1
- package/dist/types/components/xpl-grid/xpl-grid.d.ts +1 -1
- package/dist/types/components/xpl-grid-item/xpl-grid-item.d.ts +1 -1
- package/dist/types/components/xpl-header-accordion/header-accordion.stories.d.ts +4 -0
- package/dist/types/components/xpl-header-accordion/xpl-header-accordion.d.ts +1 -1
- package/dist/types/components/xpl-icon/icon-types.d.ts +2 -0
- package/dist/types/components/xpl-icon/xpl-icon.d.ts +2 -4
- package/dist/types/components/xpl-input/input.stories.d.ts +40 -7
- package/dist/types/components/xpl-input/xpl-input-color/xpl-input-color.d.ts +1 -1
- package/dist/types/components/xpl-input/xpl-input-date/xpl-input-date.d.ts +10 -3
- package/dist/types/components/xpl-input/xpl-input-file/xpl-input-file.d.ts +1 -1
- package/dist/types/components/xpl-input/xpl-input-phone/phone-country-data.d.ts +13 -0
- package/dist/types/components/xpl-input/xpl-input-phone/phone-format.d.ts +5 -0
- package/dist/types/components/xpl-input/xpl-input-phone/xpl-input-phone.d.ts +48 -0
- package/dist/types/components/xpl-input/xpl-input-time/xpl-input-time.d.ts +1 -1
- package/dist/types/components/xpl-input/xpl-input.d.ts +12 -2
- package/dist/types/components/xpl-large-card/large-card.stories.d.ts +4 -0
- package/dist/types/components/xpl-large-card/xpl-large-card.d.ts +1 -1
- package/dist/types/components/xpl-list/list.stories.d.ts +4 -0
- package/dist/types/components/xpl-list/xpl-list.d.ts +1 -1
- package/dist/types/components/xpl-main-nav/xpl-main-nav.d.ts +1 -1
- package/dist/types/components/xpl-modal/modal.stories.d.ts +4 -0
- package/dist/types/components/xpl-modal/xpl-modal.d.ts +1 -1
- package/dist/types/components/xpl-nav-item/xpl-nav-item.d.ts +1 -1
- package/dist/types/components/xpl-pagination/pagination.stories.d.ts +4 -0
- package/dist/types/components/xpl-pagination/xpl-pagination.d.ts +1 -1
- package/dist/types/components/xpl-panel/panel.stories.d.ts +20 -0
- package/dist/types/components/xpl-panel/xpl-panel.d.ts +5 -0
- package/dist/types/components/xpl-popover/xpl-popover.d.ts +1 -1
- package/dist/types/components/xpl-progress/progress.stories.d.ts +4 -0
- package/dist/types/components/xpl-progress/xpl-progress.d.ts +1 -1
- package/dist/types/components/xpl-progress-bar/progress-bar.stories.d.ts +73 -0
- package/dist/types/components/xpl-progress-bar/xpl-progress-bar.d.ts +15 -0
- package/dist/types/components/xpl-radio/radio.stories.d.ts +4 -0
- package/dist/types/components/xpl-radio/xpl-radio.d.ts +1 -1
- package/dist/types/components/xpl-secondary-nav/xpl-secondary-nav.d.ts +1 -1
- package/dist/types/components/xpl-select/select.stories.d.ts +4 -0
- package/dist/types/components/xpl-select/xpl-select.d.ts +2 -4
- package/dist/types/components/xpl-side-nav/side-nav.stories.d.ts +80 -0
- package/dist/types/components/xpl-side-nav/xpl-side-nav-item/xpl-side-nav-item.d.ts +20 -0
- package/dist/types/components/xpl-side-nav/xpl-side-nav.d.ts +4 -0
- package/dist/types/components/xpl-skeleton/xpl-skeleton.d.ts +1 -1
- package/dist/types/components/xpl-slideout/slideout.stories.d.ts +6 -0
- package/dist/types/components/xpl-slideout/xpl-slideout.d.ts +1 -1
- package/dist/types/components/xpl-tab/xpl-tab.d.ts +1 -1
- package/dist/types/components/xpl-tab-panel/xpl-tab-panel.d.ts +1 -1
- package/dist/types/components/xpl-table/table.stories.d.ts +4 -0
- package/dist/types/components/xpl-table/xpl-table.d.ts +1 -1
- package/dist/types/components/xpl-table-header/table-header.stories.d.ts +4 -0
- package/dist/types/components/xpl-table-header/xpl-table-header.d.ts +1 -1
- package/dist/types/components/xpl-table-header-cell/table-header-cell.stories.d.ts +4 -0
- package/dist/types/components/xpl-table-header-cell/xpl-table-header-cell.d.ts +2 -3
- package/dist/types/components/xpl-tabs/tabs.stories.d.ts +4 -0
- package/dist/types/components/xpl-tabs/xpl-tabs.d.ts +2 -2
- package/dist/types/components/xpl-tag/xpl-tag.d.ts +1 -1
- package/dist/types/components/xpl-toast/toast.stories.d.ts +4 -0
- package/dist/types/components/xpl-toast/xpl-toast.d.ts +1 -1
- package/dist/types/components/xpl-toggle/toggle.stories.d.ts +4 -0
- package/dist/types/components/xpl-toggle/xpl-toggle.d.ts +1 -1
- package/dist/types/components/xpl-toolbar/xpl-toolbar.d.ts +1 -1
- package/dist/types/components/xpl-tooltip/tooltip.stories.d.ts +4 -0
- package/dist/types/components/xpl-tooltip/xpl-tooltip.d.ts +1 -1
- package/dist/types/components/xpl-utility-bar/xpl-utility-bar.d.ts +1 -1
- package/dist/types/components.d.ts +1210 -173
- package/dist/types/stencil-public-runtime.d.ts +23 -2
- package/dist/types/utils/layout-ancestors.d.ts +2 -0
- package/package.json +45 -28
- package/dist/apollo-core/p-3b5f8989.entry.js +0 -1
- package/dist/apollo-core/p-576ce90f.entry.js +0 -1
- package/dist/apollo-core/p-5c0236db.entry.js +0 -6
- package/dist/apollo-core/p-5ec45742.entry.js +0 -1
- package/dist/apollo-core/p-7b7db57a.entry.js +0 -1
- package/dist/apollo-core/p-7f8e5cd0.entry.js +0 -1
- package/dist/apollo-core/p-812bb0e4.entry.js +0 -1
- package/dist/apollo-core/p-845eef0d.entry.js +0 -1
- package/dist/apollo-core/p-94209785.entry.js +0 -1
- package/dist/apollo-core/p-9853028c.entry.js +0 -1
- package/dist/apollo-core/p-9d65ece7.entry.js +0 -1
- package/dist/apollo-core/p-DhZas3eX.js +0 -2
- package/dist/apollo-core/p-be292555.entry.js +0 -1
- package/dist/cjs/xpl-avatar_41.cjs.entry.js +0 -5522
- package/dist/esm/xpl-avatar_41.entry.js +0 -5480
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
export function digitsOnly(value) {
|
|
2
|
+
return (value || '').replace(/\D/g, '');
|
|
3
|
+
}
|
|
4
|
+
export function getMaxNationalNumberLength(countryCode) {
|
|
5
|
+
switch (countryCode) {
|
|
6
|
+
case 'US':
|
|
7
|
+
case 'CA':
|
|
8
|
+
case 'MX':
|
|
9
|
+
case 'JP':
|
|
10
|
+
case 'IN':
|
|
11
|
+
case 'KR':
|
|
12
|
+
return 10;
|
|
13
|
+
case 'GB':
|
|
14
|
+
case 'DE':
|
|
15
|
+
case 'AT':
|
|
16
|
+
case 'CH':
|
|
17
|
+
case 'BR':
|
|
18
|
+
case 'CN':
|
|
19
|
+
return 11;
|
|
20
|
+
case 'AU':
|
|
21
|
+
case 'FR':
|
|
22
|
+
return 9;
|
|
23
|
+
default:
|
|
24
|
+
return 15;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function getPlaceholderPattern(countryCode) {
|
|
28
|
+
switch (countryCode) {
|
|
29
|
+
case 'US':
|
|
30
|
+
case 'CA':
|
|
31
|
+
return '000 000 0000';
|
|
32
|
+
case 'GB':
|
|
33
|
+
return '0000 000 0000';
|
|
34
|
+
case 'AU':
|
|
35
|
+
return '0 000 000 000';
|
|
36
|
+
case 'DE':
|
|
37
|
+
case 'AT':
|
|
38
|
+
case 'CH':
|
|
39
|
+
return '000 0000000';
|
|
40
|
+
case 'FR':
|
|
41
|
+
return '0 00 00 00 00';
|
|
42
|
+
case 'BR':
|
|
43
|
+
return '00 00000 0000';
|
|
44
|
+
case 'MX':
|
|
45
|
+
return '000 000 0000';
|
|
46
|
+
case 'JP':
|
|
47
|
+
return '000 0000 0000';
|
|
48
|
+
case 'CN':
|
|
49
|
+
return '000 0000 0000';
|
|
50
|
+
case 'IN':
|
|
51
|
+
return '00000 00000';
|
|
52
|
+
case 'KR':
|
|
53
|
+
return '000 0000 0000';
|
|
54
|
+
default:
|
|
55
|
+
return '000 000 0000';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function formatUSCA(d) {
|
|
59
|
+
const len = Math.min(d.length, 10);
|
|
60
|
+
if (len <= 3)
|
|
61
|
+
return d.slice(0, len);
|
|
62
|
+
if (len <= 6)
|
|
63
|
+
return `${d.slice(0, 3)} ${d.slice(3, len)}`;
|
|
64
|
+
return `${d.slice(0, 3)} ${d.slice(3, 6)} ${d.slice(6, len)}`;
|
|
65
|
+
}
|
|
66
|
+
function formatGB(d) {
|
|
67
|
+
const len = Math.min(d.length, 11);
|
|
68
|
+
if (len <= 4)
|
|
69
|
+
return d.slice(0, len);
|
|
70
|
+
if (len <= 7)
|
|
71
|
+
return `${d.slice(0, 4)} ${d.slice(4, len)}`;
|
|
72
|
+
return `${d.slice(0, 4)} ${d.slice(4, 7)} ${d.slice(7, len)}`;
|
|
73
|
+
}
|
|
74
|
+
function formatAU(d) {
|
|
75
|
+
const len = Math.min(d.length, 9);
|
|
76
|
+
if (len <= 1)
|
|
77
|
+
return d.slice(0, len);
|
|
78
|
+
if (len <= 4)
|
|
79
|
+
return `${d.slice(0, 1)} ${d.slice(1, len)}`;
|
|
80
|
+
if (len <= 7)
|
|
81
|
+
return `${d.slice(0, 1)} ${d.slice(1, 4)} ${d.slice(4, len)}`;
|
|
82
|
+
return `${d.slice(0, 1)} ${d.slice(1, 4)} ${d.slice(4, 7)} ${d.slice(7, len)}`;
|
|
83
|
+
}
|
|
84
|
+
function formatDE(d) {
|
|
85
|
+
const len = Math.min(d.length, 11);
|
|
86
|
+
if (len <= 3)
|
|
87
|
+
return d.slice(0, len);
|
|
88
|
+
return `${d.slice(0, 3)} ${d.slice(3, len)}`;
|
|
89
|
+
}
|
|
90
|
+
function formatFR(d) {
|
|
91
|
+
const len = Math.min(d.length, 9);
|
|
92
|
+
const parts = [];
|
|
93
|
+
let i = 0;
|
|
94
|
+
if (len > 0) {
|
|
95
|
+
parts.push(d.slice(0, 1));
|
|
96
|
+
i = 1;
|
|
97
|
+
}
|
|
98
|
+
while (i < len && i + 2 <= len) {
|
|
99
|
+
parts.push(d.slice(i, i + 2));
|
|
100
|
+
i += 2;
|
|
101
|
+
}
|
|
102
|
+
if (i < len)
|
|
103
|
+
parts.push(d.slice(i));
|
|
104
|
+
return parts.join(' ');
|
|
105
|
+
}
|
|
106
|
+
function formatBR(d) {
|
|
107
|
+
const len = Math.min(d.length, 11);
|
|
108
|
+
if (len <= 2)
|
|
109
|
+
return len ? `(${d}` : '';
|
|
110
|
+
if (len <= 6)
|
|
111
|
+
return `(${d.slice(0, 2)}) ${d.slice(2, len)}`;
|
|
112
|
+
if (len === 7)
|
|
113
|
+
return `(${d.slice(0, 2)}) ${d.slice(2, len)}`;
|
|
114
|
+
return `(${d.slice(0, 2)}) ${d.slice(2, 7)}-${d.slice(7, len)}`;
|
|
115
|
+
}
|
|
116
|
+
function formatMX(d) {
|
|
117
|
+
const len = Math.min(d.length, 10);
|
|
118
|
+
if (len <= 3)
|
|
119
|
+
return d.slice(0, len);
|
|
120
|
+
if (len <= 6)
|
|
121
|
+
return `${d.slice(0, 3)} ${d.slice(3, len)}`;
|
|
122
|
+
return `${d.slice(0, 3)} ${d.slice(3, 6)} ${d.slice(6, len)}`;
|
|
123
|
+
}
|
|
124
|
+
function formatJP(d) {
|
|
125
|
+
const len = Math.min(d.length, 10);
|
|
126
|
+
if (len <= 3)
|
|
127
|
+
return d.slice(0, len);
|
|
128
|
+
if (len <= 7)
|
|
129
|
+
return `${d.slice(0, 3)}-${d.slice(3, len)}`;
|
|
130
|
+
return `${d.slice(0, 3)}-${d.slice(3, 7)}-${d.slice(7, len)}`;
|
|
131
|
+
}
|
|
132
|
+
function formatCN(d) {
|
|
133
|
+
const len = Math.min(d.length, 11);
|
|
134
|
+
if (len <= 3)
|
|
135
|
+
return d.slice(0, len);
|
|
136
|
+
if (len <= 7)
|
|
137
|
+
return `${d.slice(0, 3)} ${d.slice(3, len)}`;
|
|
138
|
+
return `${d.slice(0, 3)} ${d.slice(3, 7)} ${d.slice(7, len)}`;
|
|
139
|
+
}
|
|
140
|
+
function formatIN(d) {
|
|
141
|
+
const len = Math.min(d.length, 10);
|
|
142
|
+
if (len <= 5)
|
|
143
|
+
return d.slice(0, len);
|
|
144
|
+
return `${d.slice(0, 5)} ${d.slice(5, len)}`;
|
|
145
|
+
}
|
|
146
|
+
function formatKR(d) {
|
|
147
|
+
const len = Math.min(d.length, 10);
|
|
148
|
+
if (len <= 3)
|
|
149
|
+
return d.slice(0, len);
|
|
150
|
+
if (len <= 7)
|
|
151
|
+
return `${d.slice(0, 3)} ${d.slice(3, len)}`;
|
|
152
|
+
return `${d.slice(0, 3)} ${d.slice(3, 7)} ${d.slice(7, len)}`;
|
|
153
|
+
}
|
|
154
|
+
function formatGeneric(d) {
|
|
155
|
+
const len = d.length;
|
|
156
|
+
if (len <= 3)
|
|
157
|
+
return d;
|
|
158
|
+
const groups = [];
|
|
159
|
+
let i = 0;
|
|
160
|
+
while (i < len) {
|
|
161
|
+
const take = len - i >= 4 ? 4 : 3;
|
|
162
|
+
groups.push(d.slice(i, i + take));
|
|
163
|
+
i += take;
|
|
164
|
+
}
|
|
165
|
+
return groups.join(' ');
|
|
166
|
+
}
|
|
167
|
+
export function formatNationalNumber(digits, countryCode) {
|
|
168
|
+
if (!digits)
|
|
169
|
+
return '';
|
|
170
|
+
const d = digits.replace(/\D/g, '');
|
|
171
|
+
switch (countryCode) {
|
|
172
|
+
case 'US':
|
|
173
|
+
case 'CA':
|
|
174
|
+
return formatUSCA(d);
|
|
175
|
+
case 'GB':
|
|
176
|
+
return formatGB(d);
|
|
177
|
+
case 'AU':
|
|
178
|
+
return formatAU(d);
|
|
179
|
+
case 'DE':
|
|
180
|
+
case 'AT':
|
|
181
|
+
case 'CH':
|
|
182
|
+
return formatDE(d);
|
|
183
|
+
case 'FR':
|
|
184
|
+
return formatFR(d);
|
|
185
|
+
case 'BR':
|
|
186
|
+
return formatBR(d);
|
|
187
|
+
case 'MX':
|
|
188
|
+
return formatMX(d);
|
|
189
|
+
case 'JP':
|
|
190
|
+
return formatJP(d);
|
|
191
|
+
case 'CN':
|
|
192
|
+
return formatCN(d);
|
|
193
|
+
case 'IN':
|
|
194
|
+
return formatIN(d);
|
|
195
|
+
case 'KR':
|
|
196
|
+
return formatKR(d);
|
|
197
|
+
default:
|
|
198
|
+
return formatGeneric(d);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
export function getCursorPositionAfterFormat(prevFormatted, nextFormatted, prevCursor) {
|
|
202
|
+
if (prevCursor >= prevFormatted.length) {
|
|
203
|
+
return nextFormatted.length;
|
|
204
|
+
}
|
|
205
|
+
const digitsBeforeCursor = digitsOnly(prevFormatted.slice(0, prevCursor)).length;
|
|
206
|
+
let newPos = 0;
|
|
207
|
+
let count = 0;
|
|
208
|
+
for (let i = 0; i < nextFormatted.length; i += 1) {
|
|
209
|
+
if (/\d/.test(nextFormatted[i])) {
|
|
210
|
+
count += 1;
|
|
211
|
+
if (count >= digitsBeforeCursor) {
|
|
212
|
+
newPos = i + (count === digitsBeforeCursor ? 1 : 0);
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
newPos = i + 1;
|
|
217
|
+
}
|
|
218
|
+
return Math.min(newPos, nextFormatted.length);
|
|
219
|
+
}
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import { Host, h, } from "@stencil/core";
|
|
2
|
+
import { v4 as uuid } from "uuid";
|
|
3
|
+
import { PHONE_COUNTRIES, getCountryByCode, getCountryByDialCode, parseE164, toE164, } from "./phone-country-data";
|
|
4
|
+
import { formatNationalNumber, getCursorPositionAfterFormat, digitsOnly, getPlaceholderPattern, getMaxNationalNumberLength, } from "./phone-format";
|
|
5
|
+
function getCountryIconName(countryName) {
|
|
6
|
+
return countryName.toLowerCase().replace(/ /g, '-');
|
|
7
|
+
}
|
|
8
|
+
export class InputPhone {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.lastCursorRef = 0;
|
|
11
|
+
this.lastFormattedRef = '';
|
|
12
|
+
this.dropdownOpen = false;
|
|
13
|
+
this.hasErrorState = null;
|
|
14
|
+
this.nationalNumber = '';
|
|
15
|
+
this.searchQuery = '';
|
|
16
|
+
this.triggerId = `xpl-input-phone-trigger-${uuid()}`;
|
|
17
|
+
this.defaultCountry = 'US';
|
|
18
|
+
this.isInternational = true;
|
|
19
|
+
this.handleTriggerClick = () => {
|
|
20
|
+
if (!this.isEditable)
|
|
21
|
+
return;
|
|
22
|
+
this.dropdownOpen = !this.dropdownOpen;
|
|
23
|
+
};
|
|
24
|
+
this.handleNumberInput = (ev) => {
|
|
25
|
+
var _a;
|
|
26
|
+
const target = ev.target;
|
|
27
|
+
const raw = target.value || '';
|
|
28
|
+
this.lastCursorRef = (_a = target.selectionStart) !== null && _a !== void 0 ? _a : 0;
|
|
29
|
+
this.lastFormattedRef = raw;
|
|
30
|
+
let nationalDigits;
|
|
31
|
+
if (this.isInternational && raw.startsWith('+')) {
|
|
32
|
+
const fullDigits = digitsOnly(raw);
|
|
33
|
+
const dialDigits = this.effectiveDialCode.slice(1).replace(/\D/g, '');
|
|
34
|
+
nationalDigits =
|
|
35
|
+
dialDigits && fullDigits.startsWith(dialDigits)
|
|
36
|
+
? fullDigits.slice(dialDigits.length)
|
|
37
|
+
: fullDigits;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
nationalDigits = digitsOnly(raw);
|
|
41
|
+
}
|
|
42
|
+
const maxLength = getMaxNationalNumberLength(this.effectiveCountryCode);
|
|
43
|
+
if (nationalDigits.length > maxLength) {
|
|
44
|
+
nationalDigits = nationalDigits.slice(0, maxLength);
|
|
45
|
+
}
|
|
46
|
+
this.nationalNumber = nationalDigits;
|
|
47
|
+
this.emitValue();
|
|
48
|
+
target.value = this.displayValue;
|
|
49
|
+
};
|
|
50
|
+
this.handleClear = () => {
|
|
51
|
+
var _a;
|
|
52
|
+
this.nationalNumber = '';
|
|
53
|
+
this.emitValue();
|
|
54
|
+
(_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.focus();
|
|
55
|
+
};
|
|
56
|
+
this.handleDropdownUpdate = (_e, { component }) => {
|
|
57
|
+
var _a;
|
|
58
|
+
const dropdown = component !== null && component !== void 0 ? component : this.dropdownRef;
|
|
59
|
+
if (!dropdown)
|
|
60
|
+
return;
|
|
61
|
+
const { options } = dropdown;
|
|
62
|
+
if (options === null || options === void 0 ? void 0 : options.length) {
|
|
63
|
+
const flat = options.reduce((acc, curr) => { var _a; return [...acc, ...(curr.groupName ? ((_a = curr.options) !== null && _a !== void 0 ? _a : []) : [curr])]; }, []);
|
|
64
|
+
const selected = flat.find((o) => o.isSelected);
|
|
65
|
+
if (selected === null || selected === void 0 ? void 0 : selected.value) {
|
|
66
|
+
const country = getCountryByCode(selected.value);
|
|
67
|
+
if (country) {
|
|
68
|
+
this.selectedCountry = country;
|
|
69
|
+
this.emitValue();
|
|
70
|
+
(_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.focus();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
onDropdownOpenChange(isOpen) {
|
|
77
|
+
if (isOpen) {
|
|
78
|
+
this.searchQuery = '';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
onHasErrorStateChanged(newValue) {
|
|
82
|
+
this.hasErrorStateChanged.emit(newValue);
|
|
83
|
+
}
|
|
84
|
+
onValueChange(newValue) {
|
|
85
|
+
var _a, _b;
|
|
86
|
+
if (newValue == null || newValue === '') {
|
|
87
|
+
const country = getCountryByCode(this.defaultCountry) || PHONE_COUNTRIES[0];
|
|
88
|
+
this.selectedCountry = country;
|
|
89
|
+
this.nationalNumber = '';
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const parsed = parseE164(newValue);
|
|
93
|
+
if (parsed) {
|
|
94
|
+
if (((_a = this.selectedCountry) === null || _a === void 0 ? void 0 : _a.dialCode) === parsed.dialCode) {
|
|
95
|
+
this.nationalNumber = parsed.nationalNumber;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const defaultForCode = getCountryByCode(this.defaultCountry);
|
|
99
|
+
const country = (_b = ((defaultForCode === null || defaultForCode === void 0 ? void 0 : defaultForCode.dialCode) === parsed.dialCode ? defaultForCode : undefined)) !== null && _b !== void 0 ? _b : getCountryByDialCode(parsed.dialCode);
|
|
100
|
+
if (country) {
|
|
101
|
+
this.selectedCountry = country;
|
|
102
|
+
this.nationalNumber = parsed.nationalNumber;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else if (!this.selectedCountry) {
|
|
107
|
+
this.selectedCountry = getCountryByCode(this.defaultCountry) || PHONE_COUNTRIES[0];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
componentWillLoad() {
|
|
111
|
+
if (this.value) {
|
|
112
|
+
this.onValueChange(this.value);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this.selectedCountry = getCountryByCode(this.defaultCountry) || PHONE_COUNTRIES[0];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
componentDidUpdate() {
|
|
119
|
+
if (this.inputEl &&
|
|
120
|
+
this.lastFormattedRef &&
|
|
121
|
+
typeof this.inputEl.setSelectionRange === 'function') {
|
|
122
|
+
const newFormatted = this.displayValue;
|
|
123
|
+
const newCursor = getCursorPositionAfterFormat(this.lastFormattedRef, newFormatted, this.lastCursorRef);
|
|
124
|
+
this.inputEl.setSelectionRange(newCursor, newCursor);
|
|
125
|
+
this.lastFormattedRef = '';
|
|
126
|
+
}
|
|
127
|
+
else if (this.inputEl && this.lastFormattedRef) {
|
|
128
|
+
this.lastFormattedRef = '';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
get effectiveCountryCode() {
|
|
132
|
+
var _a, _b, _c;
|
|
133
|
+
return (_c = (_b = (_a = this.selectedCountry) === null || _a === void 0 ? void 0 : _a.countryCode) !== null && _b !== void 0 ? _b : this.defaultCountry) !== null && _c !== void 0 ? _c : 'US';
|
|
134
|
+
}
|
|
135
|
+
get effectiveDialCode() {
|
|
136
|
+
var _a, _b;
|
|
137
|
+
return (_b = (_a = this.selectedCountry) === null || _a === void 0 ? void 0 : _a.dialCode) !== null && _b !== void 0 ? _b : '+1';
|
|
138
|
+
}
|
|
139
|
+
get isEditable() {
|
|
140
|
+
return !this.disabled && !this.readonly;
|
|
141
|
+
}
|
|
142
|
+
get orderedCountries() {
|
|
143
|
+
const preferred = this.preferredCountries || [];
|
|
144
|
+
const rest = PHONE_COUNTRIES.filter((c) => !preferred.includes(c.countryCode));
|
|
145
|
+
return [...preferred.map((code) => getCountryByCode(code)).filter(Boolean), ...rest];
|
|
146
|
+
}
|
|
147
|
+
get filteredCountries() {
|
|
148
|
+
const q = this.searchQuery.trim().toLowerCase();
|
|
149
|
+
if (!q)
|
|
150
|
+
return this.orderedCountries;
|
|
151
|
+
return this.orderedCountries.filter((c) => c.name.toLowerCase().includes(q) ||
|
|
152
|
+
c.dialCode.includes(q) ||
|
|
153
|
+
c.countryCode.toLowerCase().includes(q));
|
|
154
|
+
}
|
|
155
|
+
get displayValue() {
|
|
156
|
+
if (!this.nationalNumber)
|
|
157
|
+
return '';
|
|
158
|
+
return formatNationalNumber(this.nationalNumber, this.effectiveCountryCode);
|
|
159
|
+
}
|
|
160
|
+
get effectivePlaceholder() {
|
|
161
|
+
if (this.placeholder)
|
|
162
|
+
return this.placeholder;
|
|
163
|
+
const country = this.selectedCountry;
|
|
164
|
+
if (!country)
|
|
165
|
+
return '';
|
|
166
|
+
return getPlaceholderPattern(country.countryCode);
|
|
167
|
+
}
|
|
168
|
+
get dropdownOptions() {
|
|
169
|
+
return this.filteredCountries.map((c) => {
|
|
170
|
+
var _a;
|
|
171
|
+
return ({
|
|
172
|
+
icon: getCountryIconName(c.name),
|
|
173
|
+
label: `${c.name} (${c.dialCode})`,
|
|
174
|
+
value: c.countryCode,
|
|
175
|
+
isSelected: ((_a = this.selectedCountry) === null || _a === void 0 ? void 0 : _a.countryCode) === c.countryCode,
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
get maxInputLength() {
|
|
180
|
+
const maxNationalDigits = getMaxNationalNumberLength(this.effectiveCountryCode);
|
|
181
|
+
return formatNationalNumber('9'.repeat(maxNationalDigits), this.effectiveCountryCode)
|
|
182
|
+
.length;
|
|
183
|
+
}
|
|
184
|
+
emitValue() {
|
|
185
|
+
const e164 = this.nationalNumber ? toE164(this.effectiveDialCode, this.nationalNumber) : '';
|
|
186
|
+
this.value = e164 || undefined;
|
|
187
|
+
this.valueChange.emit(e164 || '');
|
|
188
|
+
this.validate();
|
|
189
|
+
}
|
|
190
|
+
validate() {
|
|
191
|
+
if (this.required && !this.nationalNumber.trim()) {
|
|
192
|
+
this.hasErrorState = 'required';
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.hasErrorState = null;
|
|
196
|
+
}
|
|
197
|
+
render() {
|
|
198
|
+
var _a;
|
|
199
|
+
return (h(Host, { key: 'e966930ecc1ce026b03daf50902ee783d469af03', class: {
|
|
200
|
+
'xpl-input-phone': true,
|
|
201
|
+
'xpl-input-phone--error': !!this.hasErrorState,
|
|
202
|
+
'xpl-input-phone--open': this.dropdownOpen,
|
|
203
|
+
'xpl-input-phone--domestic': !this.isInternational,
|
|
204
|
+
} }, h("div", { key: 'd594d5345f30bd1165662930abee8b4214b2640d', class: "xpl-input-wrapper" }, this.isInternational && (h("button", { key: '64842282265b03cce24e5d80386ea3f56c36b5ad', type: "button", id: this.triggerId, class: "xpl-input-phone__trigger", disabled: this.disabled, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen ? 'true' : 'false', "aria-label": "Select country", onClick: this.handleTriggerClick }, ((_a = this.selectedCountry) === null || _a === void 0 ? void 0 : _a.name) && (h("xpl-icon", { key: '00b0b9e477d285cc3e1c61becfbc056511d99ea2', class: "xpl-input-phone__flag", icon: getCountryIconName(this.selectedCountry.name), size: 24, "aria-hidden": "true" })), h("xpl-icon", { key: '9cc394beb1573e00e0eca641bfa8590a5837ff48', class: "xpl-input-phone__trigger-icon", icon: "chevron-down", size: 20, "aria-hidden": "true" }))), h("div", { key: 'ade974ac878f7c7bc3aa07f613a3005283d86819', class: "xpl-input-phone__input-wrap" }, this.isInternational && (h("span", { key: 'f4907b6f5919184dad42bac3a1071b2bbfe71a06', class: "xpl-input-phone__dial-code" }, this.effectiveDialCode)), h("input", { key: '89dce440dba56953574a05eda46862b4f24f84f8', ref: (el) => {
|
|
205
|
+
this.inputEl = el;
|
|
206
|
+
}, type: "tel", id: this.inputId, class: "xpl-input-phone__input", name: this.name, disabled: this.disabled, readonly: this.readonly, required: this.required, "aria-invalid": this.hasErrorState ? 'true' : 'false', placeholder: this.effectivePlaceholder, autocomplete: this.isInternational ? 'tel-national' : 'tel', inputmode: "numeric", maxlength: this.maxInputLength, value: this.displayValue, onInput: this.handleNumberInput }), this.nationalNumber && this.isEditable && (h("button", { key: '21e63c5dad2d73c8969e71c10cae9c507da8574a', type: "button", class: "xpl-input-phone__clear", "aria-label": "Clear phone number", onClick: this.handleClear }, h("xpl-icon", { key: 'ef1044fd8cc939db7281a8e68e72c54effb55101', icon: "x-circle", size: 16 }))))), this.isInternational && this.isEditable && (h("xpl-dropdown", { key: '0de330a03e99bdc73af073ad5b20a7b817192307', ref: (el) => {
|
|
207
|
+
this.dropdownRef = el;
|
|
208
|
+
}, isOpen: this.dropdownOpen, triggerId: this.triggerId, anchorToTrigger: true, closeOnSelect: true, mode: "single", options: this.dropdownOptions, update: this.handleDropdownUpdate, onIsOpenChange: (e) => {
|
|
209
|
+
this.dropdownOpen = e.detail;
|
|
210
|
+
}, "aria-label": "Country" }, h("div", { key: '6055decf8f631611786fc8720b17cf84341ef316', slot: "header", class: "xpl-input-phone__search-wrap" }, h("xpl-input", { key: '6c53dbde79069dc000214f22d29b17e568fde19f', class: "xpl-input-phone__search", type: "text", label: "", placeholder: "Search", value: this.searchQuery, autocomplete: "off", onInputEvent: (e) => {
|
|
211
|
+
var _a;
|
|
212
|
+
this.searchQuery = (_a = e.detail) !== null && _a !== void 0 ? _a : '';
|
|
213
|
+
} }, h("xpl-icon", { key: 'cb57543146d6f874849d518aea4c01f670e4afa4', slot: "pre", class: "xpl-input-phone__search-icon", icon: "magnifier", size: 20 })))))));
|
|
214
|
+
}
|
|
215
|
+
static get is() { return "xpl-input-phone"; }
|
|
216
|
+
static get properties() {
|
|
217
|
+
return {
|
|
218
|
+
"defaultCountry": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"mutable": false,
|
|
221
|
+
"complexType": {
|
|
222
|
+
"original": "string",
|
|
223
|
+
"resolved": "string",
|
|
224
|
+
"references": {}
|
|
225
|
+
},
|
|
226
|
+
"required": false,
|
|
227
|
+
"optional": true,
|
|
228
|
+
"docs": {
|
|
229
|
+
"tags": [],
|
|
230
|
+
"text": "Default country code (ISO 3166-1 alpha-2) when value is empty, e.g. \"US\"."
|
|
231
|
+
},
|
|
232
|
+
"getter": false,
|
|
233
|
+
"setter": false,
|
|
234
|
+
"reflect": false,
|
|
235
|
+
"attribute": "default-country",
|
|
236
|
+
"defaultValue": "'US'"
|
|
237
|
+
},
|
|
238
|
+
"disabled": {
|
|
239
|
+
"type": "boolean",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "boolean",
|
|
243
|
+
"resolved": "boolean",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": true,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "Whether the field is disabled"
|
|
251
|
+
},
|
|
252
|
+
"getter": false,
|
|
253
|
+
"setter": false,
|
|
254
|
+
"reflect": false,
|
|
255
|
+
"attribute": "disabled"
|
|
256
|
+
},
|
|
257
|
+
"inputId": {
|
|
258
|
+
"type": "string",
|
|
259
|
+
"mutable": false,
|
|
260
|
+
"complexType": {
|
|
261
|
+
"original": "string",
|
|
262
|
+
"resolved": "string",
|
|
263
|
+
"references": {}
|
|
264
|
+
},
|
|
265
|
+
"required": false,
|
|
266
|
+
"optional": true,
|
|
267
|
+
"docs": {
|
|
268
|
+
"tags": [],
|
|
269
|
+
"text": "The `inputId` is used to associate the input with a label."
|
|
270
|
+
},
|
|
271
|
+
"getter": false,
|
|
272
|
+
"setter": false,
|
|
273
|
+
"reflect": false,
|
|
274
|
+
"attribute": "input-id"
|
|
275
|
+
},
|
|
276
|
+
"isInternational": {
|
|
277
|
+
"type": "boolean",
|
|
278
|
+
"mutable": false,
|
|
279
|
+
"complexType": {
|
|
280
|
+
"original": "boolean",
|
|
281
|
+
"resolved": "boolean",
|
|
282
|
+
"references": {}
|
|
283
|
+
},
|
|
284
|
+
"required": false,
|
|
285
|
+
"optional": true,
|
|
286
|
+
"docs": {
|
|
287
|
+
"tags": [{
|
|
288
|
+
"name": "default",
|
|
289
|
+
"text": "true"
|
|
290
|
+
}],
|
|
291
|
+
"text": "Enables international mode with a country selector and dial code prefix.\nWhen false, the input is locked to `defaultCountry` with no country picker\nand no dial code shown in the display value. Emitted value is still E.164."
|
|
292
|
+
},
|
|
293
|
+
"getter": false,
|
|
294
|
+
"setter": false,
|
|
295
|
+
"reflect": false,
|
|
296
|
+
"attribute": "is-international",
|
|
297
|
+
"defaultValue": "true"
|
|
298
|
+
},
|
|
299
|
+
"name": {
|
|
300
|
+
"type": "string",
|
|
301
|
+
"mutable": false,
|
|
302
|
+
"complexType": {
|
|
303
|
+
"original": "string",
|
|
304
|
+
"resolved": "string",
|
|
305
|
+
"references": {}
|
|
306
|
+
},
|
|
307
|
+
"required": false,
|
|
308
|
+
"optional": true,
|
|
309
|
+
"docs": {
|
|
310
|
+
"tags": [],
|
|
311
|
+
"text": "Most inputs are used in forms, and should have a\n`name` associated with the input for handling form data."
|
|
312
|
+
},
|
|
313
|
+
"getter": false,
|
|
314
|
+
"setter": false,
|
|
315
|
+
"reflect": false,
|
|
316
|
+
"attribute": "name"
|
|
317
|
+
},
|
|
318
|
+
"placeholder": {
|
|
319
|
+
"type": "string",
|
|
320
|
+
"mutable": false,
|
|
321
|
+
"complexType": {
|
|
322
|
+
"original": "string",
|
|
323
|
+
"resolved": "string",
|
|
324
|
+
"references": {}
|
|
325
|
+
},
|
|
326
|
+
"required": false,
|
|
327
|
+
"optional": true,
|
|
328
|
+
"docs": {
|
|
329
|
+
"tags": [],
|
|
330
|
+
"text": "Placeholder text that appears when the field has no value"
|
|
331
|
+
},
|
|
332
|
+
"getter": false,
|
|
333
|
+
"setter": false,
|
|
334
|
+
"reflect": false,
|
|
335
|
+
"attribute": "placeholder"
|
|
336
|
+
},
|
|
337
|
+
"preferredCountries": {
|
|
338
|
+
"type": "unknown",
|
|
339
|
+
"mutable": false,
|
|
340
|
+
"complexType": {
|
|
341
|
+
"original": "string[]",
|
|
342
|
+
"resolved": "string[]",
|
|
343
|
+
"references": {}
|
|
344
|
+
},
|
|
345
|
+
"required": false,
|
|
346
|
+
"optional": true,
|
|
347
|
+
"docs": {
|
|
348
|
+
"tags": [],
|
|
349
|
+
"text": "Country codes to show at the top of the country list, e.g. [\"US\", \"CA\", \"GB\"]."
|
|
350
|
+
},
|
|
351
|
+
"getter": false,
|
|
352
|
+
"setter": false
|
|
353
|
+
},
|
|
354
|
+
"readonly": {
|
|
355
|
+
"type": "boolean",
|
|
356
|
+
"mutable": false,
|
|
357
|
+
"complexType": {
|
|
358
|
+
"original": "boolean",
|
|
359
|
+
"resolved": "boolean",
|
|
360
|
+
"references": {}
|
|
361
|
+
},
|
|
362
|
+
"required": false,
|
|
363
|
+
"optional": true,
|
|
364
|
+
"docs": {
|
|
365
|
+
"tags": [],
|
|
366
|
+
"text": "Whether the input is editable"
|
|
367
|
+
},
|
|
368
|
+
"getter": false,
|
|
369
|
+
"setter": false,
|
|
370
|
+
"reflect": false,
|
|
371
|
+
"attribute": "readonly"
|
|
372
|
+
},
|
|
373
|
+
"required": {
|
|
374
|
+
"type": "boolean",
|
|
375
|
+
"mutable": false,
|
|
376
|
+
"complexType": {
|
|
377
|
+
"original": "boolean",
|
|
378
|
+
"resolved": "boolean",
|
|
379
|
+
"references": {}
|
|
380
|
+
},
|
|
381
|
+
"required": false,
|
|
382
|
+
"optional": true,
|
|
383
|
+
"docs": {
|
|
384
|
+
"tags": [],
|
|
385
|
+
"text": "Whether the input is required"
|
|
386
|
+
},
|
|
387
|
+
"getter": false,
|
|
388
|
+
"setter": false,
|
|
389
|
+
"reflect": false,
|
|
390
|
+
"attribute": "required"
|
|
391
|
+
},
|
|
392
|
+
"value": {
|
|
393
|
+
"type": "string",
|
|
394
|
+
"mutable": true,
|
|
395
|
+
"complexType": {
|
|
396
|
+
"original": "string",
|
|
397
|
+
"resolved": "string",
|
|
398
|
+
"references": {}
|
|
399
|
+
},
|
|
400
|
+
"required": false,
|
|
401
|
+
"optional": true,
|
|
402
|
+
"docs": {
|
|
403
|
+
"tags": [],
|
|
404
|
+
"text": "Including a `value` will pre-populate the input (E.164 format, e.g. +14155551234)."
|
|
405
|
+
},
|
|
406
|
+
"getter": false,
|
|
407
|
+
"setter": false,
|
|
408
|
+
"reflect": true,
|
|
409
|
+
"attribute": "value"
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
static get states() {
|
|
414
|
+
return {
|
|
415
|
+
"dropdownOpen": {},
|
|
416
|
+
"hasErrorState": {},
|
|
417
|
+
"nationalNumber": {},
|
|
418
|
+
"searchQuery": {},
|
|
419
|
+
"selectedCountry": {},
|
|
420
|
+
"triggerId": {}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
static get events() {
|
|
424
|
+
return [{
|
|
425
|
+
"method": "hasErrorStateChanged",
|
|
426
|
+
"name": "hasErrorStateChanged",
|
|
427
|
+
"bubbles": true,
|
|
428
|
+
"cancelable": true,
|
|
429
|
+
"composed": true,
|
|
430
|
+
"docs": {
|
|
431
|
+
"tags": [],
|
|
432
|
+
"text": "Event that is emitted when the hasErrorState state changes."
|
|
433
|
+
},
|
|
434
|
+
"complexType": {
|
|
435
|
+
"original": "string | null",
|
|
436
|
+
"resolved": "string",
|
|
437
|
+
"references": {}
|
|
438
|
+
}
|
|
439
|
+
}, {
|
|
440
|
+
"method": "valueChange",
|
|
441
|
+
"name": "valueChange",
|
|
442
|
+
"bubbles": true,
|
|
443
|
+
"cancelable": true,
|
|
444
|
+
"composed": true,
|
|
445
|
+
"docs": {
|
|
446
|
+
"tags": [],
|
|
447
|
+
"text": "Event that emits the current value of the input (E.164 format)."
|
|
448
|
+
},
|
|
449
|
+
"complexType": {
|
|
450
|
+
"original": "string",
|
|
451
|
+
"resolved": "string",
|
|
452
|
+
"references": {}
|
|
453
|
+
}
|
|
454
|
+
}];
|
|
455
|
+
}
|
|
456
|
+
static get elementRef() { return "el"; }
|
|
457
|
+
static get watchers() {
|
|
458
|
+
return [{
|
|
459
|
+
"propName": "dropdownOpen",
|
|
460
|
+
"methodName": "onDropdownOpenChange"
|
|
461
|
+
}, {
|
|
462
|
+
"propName": "hasErrorState",
|
|
463
|
+
"methodName": "onHasErrorStateChanged"
|
|
464
|
+
}, {
|
|
465
|
+
"propName": "value",
|
|
466
|
+
"methodName": "onValueChange"
|
|
467
|
+
}];
|
|
468
|
+
}
|
|
469
|
+
}
|