@xplortech/apollo-core 2.5.0 → 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 +393 -26
- package/build/style.css +4224 -1016
- 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-0e1877a2.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-5549756c.entry.js +1 -0
- 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-f4c2626d.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_41.cjs.entry.js → xpl-avatar_47.cjs.entry.js} +2802 -272
- 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 +9 -2
- 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 +3 -3
- 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/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/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/xpl-header-accordion.js +2 -2
- package/dist/collection/components/xpl-icon/xpl-icon.js +3 -3
- package/dist/collection/components/xpl-input/input.stories.js +75 -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/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/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/xpl-radio.js +4 -4
- package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +2 -2
- package/dist/collection/components/xpl-select/xpl-select.js +7 -7
- 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/xpl-skeleton.js +2 -2
- 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/xpl-table.js +6 -6
- package/dist/collection/components/xpl-table-header/xpl-table-header.js +2 -2
- package/dist/collection/components/xpl-table-header-cell/xpl-table-header-cell.js +1 -1
- 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/xpl-toast.js +3 -3
- 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/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 -1
- 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 +4 -0
- package/dist/docs/xpl-avatar/readme.md +5 -0
- package/dist/docs/xpl-backdrop/readme.md +1 -1
- package/dist/docs/xpl-badge/readme.md +97 -4
- package/dist/docs/xpl-banner/readme.md +166 -0
- package/dist/docs/xpl-button/readme.md +151 -14
- package/dist/docs/xpl-button-row/readme.md +1 -0
- package/dist/docs/xpl-calendar/readme.md +2 -1
- package/dist/docs/xpl-checkbox/readme.md +2 -0
- package/dist/docs/xpl-choicelist/readme.md +1 -0
- package/dist/docs/xpl-data-card/readme.md +2 -2
- package/dist/docs/xpl-divider/readme.md +1 -1
- package/dist/docs/xpl-dropdown/readme.md +14 -11
- package/dist/docs/xpl-dropdown/xpl-dropdown-group/readme.md +1 -0
- package/dist/docs/xpl-dropdown/xpl-dropdown-option/readme.md +6 -0
- package/dist/docs/xpl-icon/readme.md +12 -0
- package/dist/docs/xpl-input/readme.md +41 -31
- package/dist/docs/xpl-input/xpl-input-color/readme.md +4 -0
- package/dist/docs/xpl-input/xpl-input-phone/readme.md +167 -0
- package/dist/docs/xpl-input/xpl-input-time/readme.md +4 -0
- package/dist/docs/xpl-large-card/readme.md +1 -1
- package/dist/docs/xpl-modal/readme.md +3 -0
- package/dist/docs/xpl-pagination/readme.md +3 -0
- package/dist/docs/xpl-panel/readme.md +83 -0
- package/dist/docs/xpl-popover/readme.md +1 -1
- package/dist/docs/xpl-progress-bar/readme.md +145 -0
- package/dist/docs/xpl-select/readme.md +1 -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-slideout/readme.md +1 -0
- package/dist/docs/xpl-tabs/readme.md +1 -0
- package/dist/docs/xpl-toast/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_41.entry.js → xpl-avatar_47.entry.js} +2753 -229
- 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 +1 -1
- 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/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/xpl-header-accordion.d.ts +1 -1
- package/dist/types/components/xpl-icon/xpl-icon.d.ts +1 -1
- package/dist/types/components/xpl-input/input.stories.d.ts +36 -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/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/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/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/xpl-select.d.ts +1 -1
- 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/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/xpl-table.d.ts +1 -1
- package/dist/types/components/xpl-table-header/xpl-table-header.d.ts +1 -1
- package/dist/types/components/xpl-table-header-cell/xpl-table-header-cell.d.ts +1 -1
- 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/xpl-toast.d.ts +1 -1
- 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/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 +1219 -178
- package/dist/types/stencil-public-runtime.d.ts +23 -2
- package/dist/types/utils/layout-ancestors.d.ts +2 -0
- package/package.json +41 -27
- package/dist/apollo-core/p-1c2e4034.entry.js +0 -1
- 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-5ec45742.entry.js +0 -1
- package/dist/apollo-core/p-77f0fd4a.entry.js +0 -1
- package/dist/apollo-core/p-7b7db57a.entry.js +0 -1
- package/dist/apollo-core/p-7c22b842.entry.js +0 -1
- package/dist/apollo-core/p-7d245bf0.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-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
|
@@ -7,7 +7,7 @@ const fallbackColorValues = {
|
|
|
7
7
|
b: 0,
|
|
8
8
|
a: 1,
|
|
9
9
|
};
|
|
10
|
-
export class
|
|
10
|
+
export class InputColor {
|
|
11
11
|
constructor() {
|
|
12
12
|
this.placeholder = 'Select color';
|
|
13
13
|
this.eyeDropperSupported = 'EyeDropper' in window;
|
|
@@ -193,16 +193,16 @@ export class XplInputColor {
|
|
|
193
193
|
top: `${y}px`,
|
|
194
194
|
background: `rgb(${r}, ${g}, ${b})`,
|
|
195
195
|
};
|
|
196
|
-
return (h(Host, { key: '
|
|
196
|
+
return (h(Host, { key: 'a8cdba9ff504fbeaf7b21167b778d8cf00216a1a', class: "xpl-input-color" }, h("xpl-popover", { key: '535497f6aba0e7e9e65b894cd8c62cebe8ad3dd5', disabled: this.disabled, display: "menu" }, h("div", { key: '436c51111938bbbef99698b94bd5c3123bc0b42d', slot: "trigger" }, h("div", { key: '09e8f57c0d1a35d1b0a5785ebb141db62c3db4d2', class: {
|
|
197
197
|
'xpl-input-color__display': true,
|
|
198
198
|
'xpl-input-color__display--disabled': this.disabled,
|
|
199
199
|
'xpl-input-color__display--error': !!this.hasErrorState,
|
|
200
|
-
} }, h("span", { key: '
|
|
200
|
+
} }, h("span", { key: '76da6216e95d48dd5cdbb890e7fe14cf1be85c6b', class: "xpl-input-color__color", style: {
|
|
201
201
|
background: objectToStringColor(this.colorValues),
|
|
202
|
-
} }), this.colorValues.hex ? (h("span", { class: "xpl-input-color__value" }, objectToStringColor(this.colorValues))) : (h("span", { class: "xpl-input-color__placeholder" }, this.placeholder)), this.eyeDropperSupported && !this.hideEyeDropper && (h("xpl-icon", { key: '
|
|
202
|
+
} }), this.colorValues.hex ? (h("span", { class: "xpl-input-color__value" }, objectToStringColor(this.colorValues))) : (h("span", { class: "xpl-input-color__placeholder" }, this.placeholder)), this.eyeDropperSupported && !this.hideEyeDropper && (h("xpl-icon", { key: 'c4a560be47d17c98f353c0e324c0f9025f535fae', size: 20, icon: "eye-dropper", class: "xpl-input-color__icon", onClick: (e) => {
|
|
203
203
|
e.stopPropagation();
|
|
204
204
|
this.openEyeDropper();
|
|
205
|
-
} })))), h("div", { key: '
|
|
205
|
+
} })))), h("div", { key: '844a66fa0523b133ce3e2b6d83e395254e9b513f', class: "xpl-input-color__menu" }, h("div", { key: 'c687aaa94b122258e09cffabcc5029905ddccb27', class: "xpl-input-color__sl-grid", ref: (el) => {
|
|
206
206
|
this.colorInputElements.slGrid = el;
|
|
207
207
|
}, style: {
|
|
208
208
|
background: [
|
|
@@ -210,9 +210,9 @@ export class XplInputColor {
|
|
|
210
210
|
`linear-gradient(to right, #fff, #fff0)`,
|
|
211
211
|
`rgb(${hueBaseColor.r} ${hueBaseColor.g} ${hueBaseColor.b})`,
|
|
212
212
|
].join(', '),
|
|
213
|
-
}, onMouseDown: this.startDrag, onTouchStart: this.startDrag }, h("div", { key: '
|
|
213
|
+
}, onMouseDown: this.startDrag, onTouchStart: this.startDrag }, h("div", { key: '7e65660cef09fc5ae0c9dc0d49fe7769ad15b55a', class: "xpl-input-color__sl-thumb", style: slThumbStyle })), h("div", { key: '5e76247d0d59fca5500416ddeaca53784dc42209', class: "xpl-input-color__grid" }, h("input", { key: '5b891dd55f6d4f5d1242d142c9af8a3af496e398', type: "range", min: "0", max: "360", value: this.hue, class: "xpl-input-color__slider xpl-input-color__hue", name: "color-hue-slider", ref: (el) => {
|
|
214
214
|
this.colorInputElements.hue = el;
|
|
215
|
-
} }), h("input", { key: '
|
|
215
|
+
} }), h("input", { key: 'ae20b7cbfa6303c6615afee0fc35d0dda3bc1f70', type: "range", min: "0", max: "1", step: "0.01", value: a, class: "xpl-input-color__slider xpl-input-color__alpha", name: "color-alpha-slider", ref: (el) => {
|
|
216
216
|
this.colorInputElements.alpha = el;
|
|
217
217
|
}, style: {
|
|
218
218
|
backgroundImage: [
|
|
@@ -222,9 +222,9 @@ export class XplInputColor {
|
|
|
222
222
|
`linear-gradient(45deg, transparent 75%, #ccc 75%)`,
|
|
223
223
|
`linear-gradient(-45deg, transparent 75%, #ccc 75%)`,
|
|
224
224
|
].join(', '),
|
|
225
|
-
} }), h("div", { key: '
|
|
225
|
+
} }), h("div", { key: 'c4b884401f5324e37e09637785a2148ef5c99112', class: "xpl-input-color__preview", style: {
|
|
226
226
|
background: `rgba(${r}, ${g}, ${b}, ${a})`,
|
|
227
|
-
} })), h("div", { key: '
|
|
227
|
+
} })), h("div", { key: '5d8eff1bf9e51bd44116c01e3bfd016414662d92', class: "xpl-input-color__inputs" }, Object.entries(this.colorInputElements)
|
|
228
228
|
.filter(([key]) => ['hex', 'r', 'g', 'b', 'a'].includes(key))
|
|
229
229
|
.map(([key]) => (h("xpl-input", { key: key, label: key.toLocaleUpperCase(), name: `color-${key}-input`, placeholder: key === 'hex' ? '793EF7' : '0', value: this.colorValues[key], ref: (elRef) => {
|
|
230
230
|
this.colorInputElements[key] = elRef;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Host, h } from "@stencil/core";
|
|
1
|
+
import { Host, h, } from "@stencil/core";
|
|
2
2
|
import flatpickr from "flatpickr";
|
|
3
|
+
import { getNearestScrollableAncestor, isInsideFixedPosition, } from "../../../utils/layout-ancestors";
|
|
3
4
|
const arrowSvg = (rotate = false) => `<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="${rotate
|
|
4
5
|
? 'M0.557948 5.6813L6.06209 0.132167C6.23831 -0.0440556 6.52327 -0.0440556 6.69949 0.132167L7.44187 0.874551C7.61809 1.05077 7.61809 1.33573 7.44187 1.51195L2.99882 6L7.44187 10.488C7.61809 10.6643 7.61809 10.9492 7.44187 11.1254L6.69949 11.8678C6.52327 12.0441 6.23831 12.0441 6.06209 11.8678L0.557948 6.3187C0.381726 6.14248 0.381726 5.85752 0.557948 5.6813Z'
|
|
5
6
|
: 'M7.44187 6.3187L1.93773 11.8678C1.76151 12.0441 1.47655 12.0441 1.30033 11.8678L0.557948 11.1254C0.381726 10.9492 0.381726 10.6643 0.557948 10.488L5.001 6L0.557948 1.51195C0.381726 1.33573 0.381726 1.05077 0.557948 0.874551L1.30033 0.132167C1.47655 -0.0440556 1.76151 -0.0440556 1.93773 0.132167L7.44187 5.6813C7.6181 5.85752 7.6181 6.14248 7.44187 6.3187Z'}" /></svg>`;
|
|
6
|
-
export class
|
|
7
|
+
export class InputDate {
|
|
7
8
|
constructor() {
|
|
8
9
|
this.dateFormat = 'Y-m-d';
|
|
9
10
|
this.mode = 'single';
|
|
11
|
+
this.flatpickrStaticLayout = false;
|
|
10
12
|
this.valueChanged = (event) => {
|
|
11
13
|
const target = event.target;
|
|
12
14
|
this.valueChange.emit(target.value);
|
|
@@ -19,17 +21,31 @@ export class XplInputDate {
|
|
|
19
21
|
var _a;
|
|
20
22
|
(_a = this.flatpickrInstance) === null || _a === void 0 ? void 0 : _a.setDate(newValue);
|
|
21
23
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
queueMicrotask(() => this.ensureFlatpickr());
|
|
26
|
+
}
|
|
27
|
+
disconnectedCallback() {
|
|
28
|
+
var _a;
|
|
29
|
+
(_a = this.flatpickrInstance) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
30
|
+
this.flatpickrInstance = undefined;
|
|
31
|
+
this.flatpickrStaticLayout = false;
|
|
32
|
+
this.unwrapStaleFlatpickrWrapper();
|
|
33
|
+
}
|
|
34
|
+
componentDidRender() {
|
|
35
|
+
this.ensureFlatpickr();
|
|
36
|
+
}
|
|
37
|
+
ensureFlatpickr() {
|
|
38
|
+
if (this.flatpickrInstance || !this.input || !this.el.isConnected) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.unwrapStaleFlatpickrWrapper();
|
|
42
|
+
this.initFlatpickr();
|
|
43
|
+
}
|
|
44
|
+
initFlatpickr() {
|
|
45
|
+
const insideFixed = isInsideFixedPosition(this.el);
|
|
46
|
+
this.flatpickrInstance = flatpickr(this.input, Object.assign(Object.assign({ allowInput: true }, (insideFixed
|
|
47
|
+
? { static: true }
|
|
48
|
+
: { appendTo: getNearestScrollableAncestor(this.el) })), { dateFormat: this.dateFormat, defaultDate: this.value, maxDate: this.max, minDate: this.min, mode: this.mode, nextArrow: arrowSvg(), prevArrow: arrowSvg(true), onClose: (selectedDates) => {
|
|
33
49
|
const minRequiredDates = !this.required ? 0 : this.mode === 'single' ? 1 : 2;
|
|
34
50
|
this.hasErrorState = selectedDates.length < minRequiredDates ? 'required' : null;
|
|
35
51
|
if (selectedDates.length === 2) {
|
|
@@ -39,19 +55,39 @@ export class XplInputDate {
|
|
|
39
55
|
end,
|
|
40
56
|
});
|
|
41
57
|
}
|
|
42
|
-
}
|
|
58
|
+
} }));
|
|
59
|
+
queueMicrotask(() => {
|
|
60
|
+
if (this.flatpickrStaticLayout !== insideFixed) {
|
|
61
|
+
this.flatpickrStaticLayout = insideFixed;
|
|
62
|
+
}
|
|
43
63
|
});
|
|
44
64
|
}
|
|
65
|
+
unwrapStaleFlatpickrWrapper() {
|
|
66
|
+
const { input } = this;
|
|
67
|
+
const wrapper = input === null || input === void 0 ? void 0 : input.parentElement;
|
|
68
|
+
if (!(wrapper === null || wrapper === void 0 ? void 0 : wrapper.classList.contains('flatpickr-wrapper'))) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const parent = wrapper.parentElement;
|
|
72
|
+
if (!parent) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
while (wrapper.firstChild) {
|
|
76
|
+
parent.insertBefore(wrapper.firstChild, wrapper);
|
|
77
|
+
}
|
|
78
|
+
parent.removeChild(wrapper);
|
|
79
|
+
}
|
|
45
80
|
render() {
|
|
46
|
-
return (h(Host, { key: '
|
|
81
|
+
return (h(Host, { key: '35f91387097b7fd5bdc59ff8608c3700470ff367', class: {
|
|
47
82
|
'xpl-input-date': true,
|
|
48
83
|
[`xpl-input-date--mode-${this.mode}`]: true,
|
|
49
84
|
'xpl-input-date--error': !!this.hasErrorState,
|
|
50
|
-
|
|
85
|
+
'xpl-input-date--flatpickr-static': this.flatpickrStaticLayout,
|
|
86
|
+
} }, h("div", { key: '7f561dba2b2aa7d308d0029a20ace5d918368afc', class: "xpl-input-wrapper" }, this.pre && (h("label", { key: '2e87d6e22a2a69db7e91c69fb3d59f81d8358e52', class: "xpl-input-pre", htmlFor: this.inputId }, this.pre)), h("input", { key: '53d05e6b6b637e298f31cb1f2b9c56d9d597688f', type: "date", id: this.inputId, disabled: this.disabled, name: this.name, required: this.required, readonly: this.readonly, placeholder: this.placeholder, max: this.max, min: this.min, ref: (el) => {
|
|
51
87
|
this.input = el;
|
|
52
88
|
}, onChange: (event) => {
|
|
53
89
|
this.valueChanged(event);
|
|
54
|
-
} }), h("xpl-icon", { key: '
|
|
90
|
+
} }), h("xpl-icon", { key: '45c1d48fe6a312855cf3bd90e139d060821c4ba4', class: "xpl-input-calendar", icon: "calendar-month", size: 24 }), this.post && (h("label", { key: '037657e9a3cecc054d95b6fd835b58885eef8042', class: "xpl-input-post", htmlFor: this.inputId }, this.post)))));
|
|
55
91
|
}
|
|
56
92
|
static get is() { return "xpl-input-date"; }
|
|
57
93
|
static get properties() {
|
|
@@ -309,6 +345,7 @@ export class XplInputDate {
|
|
|
309
345
|
}
|
|
310
346
|
static get states() {
|
|
311
347
|
return {
|
|
348
|
+
"flatpickrStaticLayout": {},
|
|
312
349
|
"hasErrorState": {}
|
|
313
350
|
};
|
|
314
351
|
}
|
|
@@ -365,6 +402,7 @@ export class XplInputDate {
|
|
|
365
402
|
}
|
|
366
403
|
}];
|
|
367
404
|
}
|
|
405
|
+
static get elementRef() { return "el"; }
|
|
368
406
|
static get watchers() {
|
|
369
407
|
return [{
|
|
370
408
|
"propName": "hasErrorState",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Host, h, } from "@stencil/core";
|
|
2
|
-
export class
|
|
2
|
+
export class InputFile {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.accept = '';
|
|
5
5
|
this.multiple = false;
|
|
@@ -33,18 +33,18 @@ export class XplInputFile {
|
|
|
33
33
|
}
|
|
34
34
|
render() {
|
|
35
35
|
var _a, _b;
|
|
36
|
-
return (h(Host, { key: '
|
|
36
|
+
return (h(Host, { key: '87df3edce40c74988426ba9fcef4bc3f5740c56b', class: {
|
|
37
37
|
'xpl-input-file': true,
|
|
38
38
|
'xpl-input-file--hide-trigger-on-select': this.hideTriggerOnSelect,
|
|
39
39
|
'xpl-input-file--disabled': this.disabled,
|
|
40
|
-
} }, h("span", { key: '
|
|
40
|
+
} }, h("span", { key: '11e4c220751ce3f06fd15a741a1f8b81d98c18bc', class: {
|
|
41
41
|
'xpl-input-file__trigger-wrapper': true,
|
|
42
42
|
'xpl-input-file__trigger-wrapper--hidden': this.hideTriggerOnSelect && ((_a = this.files) === null || _a === void 0 ? void 0 : _a.length) > 0,
|
|
43
|
-
}, role: "button", tabIndex: 0, onClick: this.openFileDialog }, h("slot", { key: '
|
|
43
|
+
}, role: "button", tabIndex: 0, onClick: this.openFileDialog }, h("slot", { key: '6daba4f9e520c12a791bfd18f2894e55f0da86f4', name: "trigger" })), ((_b = this.files) === null || _b === void 0 ? void 0 : _b.length) > 0 && !this.hideFileNames && (h("ul", { key: '3459f9c3e8618962c02f1e25e6b80f63fe4d593d', class: "xpl-input-file__file-list" }, this.files.map((file, fileIndex) => (h("li", { class: "xpl-input-file__file-item" }, h("span", { class: "xpl-text-callout" }, file.name), h("xpl-icon", { icon: "x-circle", size: 24, onClick: (e) => {
|
|
44
44
|
e.preventDefault();
|
|
45
45
|
e.stopPropagation();
|
|
46
46
|
this.onRemoveFileByIndex(fileIndex);
|
|
47
|
-
}, class: "xpl-input-file__remove-icon" })))))), this.accept && !this.hideAcceptText && (h("span", { key: '
|
|
47
|
+
}, class: "xpl-input-file__remove-icon" })))))), this.accept && !this.hideAcceptText && (h("span", { key: '2c8646cd5ef7e235e75c68bf4832ce1d9c578493', class: "xpl-input-file__accept xpl-text-caption" }, "Accepted file types: ", this.accept)), h("input", { key: 'd303ac9e074e8031ed2d695cc85eef32ef40f058', onChange: this.handleFileChange, type: "file", ref: (el) => {
|
|
48
48
|
this.fileInput = el;
|
|
49
49
|
}, hidden: true, accept: this.accept, multiple: this.multiple, name: this.name })));
|
|
50
50
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const PHONE_COUNTRIES = [
|
|
2
|
+
{ countryCode: 'US', dialCode: '+1', name: 'United States' },
|
|
3
|
+
{ countryCode: 'CA', dialCode: '+1', name: 'Canada' },
|
|
4
|
+
{ countryCode: 'GB', dialCode: '+44', name: 'United Kingdom' },
|
|
5
|
+
{ countryCode: 'AU', dialCode: '+61', name: 'Australia' },
|
|
6
|
+
{ countryCode: 'DE', dialCode: '+49', name: 'Germany' },
|
|
7
|
+
{ countryCode: 'FR', dialCode: '+33', name: 'France' },
|
|
8
|
+
{ countryCode: 'ES', dialCode: '+34', name: 'Spain' },
|
|
9
|
+
{ countryCode: 'IT', dialCode: '+39', name: 'Italy' },
|
|
10
|
+
{ countryCode: 'NL', dialCode: '+31', name: 'Netherlands' },
|
|
11
|
+
{ countryCode: 'BE', dialCode: '+32', name: 'Belgium' },
|
|
12
|
+
{ countryCode: 'AT', dialCode: '+43', name: 'Austria' },
|
|
13
|
+
{ countryCode: 'CH', dialCode: '+41', name: 'Switzerland' },
|
|
14
|
+
{ countryCode: 'PL', dialCode: '+48', name: 'Poland' },
|
|
15
|
+
{ countryCode: 'IE', dialCode: '+353', name: 'Ireland' },
|
|
16
|
+
{ countryCode: 'PT', dialCode: '+351', name: 'Portugal' },
|
|
17
|
+
{ countryCode: 'SE', dialCode: '+46', name: 'Sweden' },
|
|
18
|
+
{ countryCode: 'NO', dialCode: '+47', name: 'Norway' },
|
|
19
|
+
{ countryCode: 'DK', dialCode: '+45', name: 'Denmark' },
|
|
20
|
+
{ countryCode: 'FI', dialCode: '+358', name: 'Finland' },
|
|
21
|
+
{ countryCode: 'NZ', dialCode: '+64', name: 'New Zealand' },
|
|
22
|
+
{ countryCode: 'JP', dialCode: '+81', name: 'Japan' },
|
|
23
|
+
{ countryCode: 'CN', dialCode: '+86', name: 'China' },
|
|
24
|
+
{ countryCode: 'IN', dialCode: '+91', name: 'India' },
|
|
25
|
+
{ countryCode: 'BR', dialCode: '+55', name: 'Brazil' },
|
|
26
|
+
{ countryCode: 'MX', dialCode: '+52', name: 'Mexico' },
|
|
27
|
+
{ countryCode: 'ZA', dialCode: '+27', name: 'South Africa' },
|
|
28
|
+
{ countryCode: 'SG', dialCode: '+65', name: 'Singapore' },
|
|
29
|
+
{ countryCode: 'HK', dialCode: '+852', name: 'Hong Kong' },
|
|
30
|
+
{ countryCode: 'KR', dialCode: '+82', name: 'South Korea' },
|
|
31
|
+
];
|
|
32
|
+
export function getCountryByCode(countryCode) {
|
|
33
|
+
return PHONE_COUNTRIES.find((c) => c.countryCode === countryCode);
|
|
34
|
+
}
|
|
35
|
+
export function getCountryByDialCode(dialCode) {
|
|
36
|
+
return PHONE_COUNTRIES.find((c) => c.dialCode === dialCode);
|
|
37
|
+
}
|
|
38
|
+
export function parseE164(value) {
|
|
39
|
+
if (!value || !value.startsWith('+'))
|
|
40
|
+
return null;
|
|
41
|
+
const digits = value.slice(1).replace(/\D/g, '');
|
|
42
|
+
if (!digits.length)
|
|
43
|
+
return null;
|
|
44
|
+
const sorted = [...PHONE_COUNTRIES].sort((a, b) => b.dialCode.replace(/\D/g, '').length - a.dialCode.replace(/\D/g, '').length);
|
|
45
|
+
const matchedCountry = sorted.find((country) => {
|
|
46
|
+
const codeDigits = country.dialCode.slice(1).replace(/\D/g, '');
|
|
47
|
+
return digits.startsWith(codeDigits);
|
|
48
|
+
});
|
|
49
|
+
if (!matchedCountry)
|
|
50
|
+
return null;
|
|
51
|
+
const codeDigits = matchedCountry.dialCode.slice(1).replace(/\D/g, '');
|
|
52
|
+
const nationalNumber = digits.slice(codeDigits.length);
|
|
53
|
+
return { dialCode: matchedCountry.dialCode, nationalNumber };
|
|
54
|
+
}
|
|
55
|
+
export function toE164(dialCode, nationalNumber) {
|
|
56
|
+
const digits = (dialCode.slice(1) + nationalNumber).replace(/\D/g, '');
|
|
57
|
+
return digits.length ? `+${digits}` : '';
|
|
58
|
+
}
|
|
@@ -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
|
+
}
|