@xplortech/apollo-core 2.5.0 → 2.7.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 +1156 -115
- package/build/style.css +12151 -5333
- package/dist/apollo-core/apollo-core.css +68 -37
- package/dist/apollo-core/apollo-core.esm.js +1 -1
- package/dist/apollo-core/{p-f4c2626d.entry.js → p-084d26ed.entry.js} +1 -1
- package/dist/apollo-core/p-146d5d55.entry.js +1 -0
- package/dist/apollo-core/p-16742606.entry.js +1 -0
- package/dist/apollo-core/{p-0ac33b3a.entry.js → p-28d12fd3.entry.js} +1 -1
- package/dist/apollo-core/{p-7d245bf0.entry.js → p-3eb5eb7c.entry.js} +1 -1
- package/dist/apollo-core/p-4882f0bd.entry.js +1 -0
- package/dist/apollo-core/p-64b34268.entry.js +1 -0
- package/dist/apollo-core/p-6c956d4e.entry.js +1 -0
- package/dist/apollo-core/p-71b75f36.entry.js +1 -0
- package/dist/apollo-core/p-7eb86c63.entry.js +1 -0
- package/dist/apollo-core/{p-0e1877a2.entry.js → p-84254a24.entry.js} +1 -1
- package/dist/apollo-core/p-9f2a0321.entry.js +1 -0
- package/dist/apollo-core/p-C7bgJs6C.js +2 -0
- package/dist/apollo-core/p-cde83ab0.entry.js +1 -0
- package/dist/apollo-core/p-e7363036.entry.js +1 -0
- package/dist/cjs/apollo-core.cjs.js +3 -3
- package/dist/cjs/{index-D__N_vw2.js → index-BQ97-AWw.js} +149 -96
- 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_61.cjs.entry.js} +9154 -1989
- 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-main-nav.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 +26 -8
- 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 +122 -103
- package/dist/collection/components/xpl-avatar/xpl-avatar.js +250 -16
- 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 +76 -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 +296 -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 +201 -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 +48 -26
- 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 +47 -54
- package/dist/collection/components/xpl-icon/xpl-icon.js +3 -3
- package/dist/collection/components/xpl-input/input.stories.js +170 -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-search/xpl-input-search.js +485 -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 +223 -17
- 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 +300 -63
- package/dist/collection/components/xpl-list/xpl-list-item/xpl-list-item.js +818 -0
- package/dist/collection/components/xpl-list/xpl-list.js +580 -22
- 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 +53 -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-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-progress-indicator/progress-indicator.stories.js +118 -0
- package/dist/collection/components/xpl-progress-indicator/xpl-progress-indicator.js +171 -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-spotlight/spotlight.stories.js +385 -0
- package/dist/collection/components/xpl-spotlight/xpl-spotlight.js +1085 -0
- package/dist/collection/components/xpl-tab/xpl-tab.js +262 -9
- package/dist/collection/components/xpl-tab-panel/xpl-tab-panel.js +23 -16
- package/dist/collection/components/xpl-table/table.stories.js +319 -67
- package/dist/collection/components/xpl-table/utils/move-row-dom.js +50 -0
- package/dist/collection/components/xpl-table/utils/table-internal.js +58 -0
- package/dist/collection/components/xpl-table/xpl-table-body/xpl-table-body.js +7 -0
- package/dist/collection/components/xpl-table/xpl-table-cell/xpl-table-cell.js +155 -0
- package/dist/collection/components/xpl-table/xpl-table-footer/xpl-table-footer.js +7 -0
- package/dist/collection/components/xpl-table/xpl-table-footer-cell/xpl-table-footer-cell.js +37 -0
- package/dist/collection/components/xpl-table/xpl-table-header/table-header.stories.js +131 -0
- package/dist/collection/components/xpl-table/xpl-table-header/xpl-table-header.js +7 -0
- package/dist/collection/components/xpl-table/xpl-table-header-cell/table-header-cell.stories.js +105 -0
- package/dist/collection/components/xpl-table/xpl-table-header-cell/xpl-table-header-cell.js +402 -0
- package/dist/collection/components/xpl-table/xpl-table-row/xpl-table-row.js +121 -0
- package/dist/collection/components/xpl-table/xpl-table.js +1449 -144
- package/dist/collection/components/xpl-tabs/segment-control.stories.js +31 -0
- package/dist/collection/components/xpl-tabs/tabs.shared.js +156 -0
- package/dist/collection/components/xpl-tabs/tabs.stories.js +10 -60
- package/dist/collection/components/xpl-tabs/xpl-tabs.js +339 -63
- package/dist/collection/components/xpl-tag/tag.stories.js +153 -0
- package/dist/collection/components/xpl-tag/xpl-tag.js +313 -10
- 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-top-nav/top-nav.stories.js +625 -0
- package/dist/collection/components/xpl-top-nav/xpl-nav-header-menu/xpl-nav-header-menu.js +122 -0
- package/dist/collection/components/xpl-top-nav/xpl-top-nav-item/xpl-top-nav-item.js +481 -0
- package/dist/collection/components/xpl-top-nav/xpl-top-nav.js +433 -0
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +2 -2
- package/dist/collection/utils/layout-ancestors.js +22 -0
- package/dist/collection/utils/lifecycle.js +79 -0
- package/dist/collection/utils/tab-a11y-ids.js +22 -0
- package/dist/components/floating-ui.dom.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/lifecycle.js +1 -0
- package/dist/components/tab-a11y-ids.js +1 -0
- 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-search.d.ts +11 -0
- package/dist/components/xpl-input-search.js +1 -0
- package/dist/components/xpl-input-search2.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-progress.d.ts → xpl-list-item.d.ts} +4 -4
- package/dist/components/xpl-list-item.js +1 -0
- package/dist/components/xpl-list-item2.js +1 -0
- 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-header-menu.d.ts +11 -0
- package/dist/components/xpl-nav-header-menu.js +1 -0
- 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-indicator.d.ts +11 -0
- package/dist/components/xpl-progress-indicator.js +1 -0
- 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-spotlight.d.ts +11 -0
- package/dist/components/xpl-spotlight.js +1 -0
- package/dist/components/xpl-tab-panel.js +1 -1
- package/dist/components/xpl-tab.js +1 -1
- package/dist/components/xpl-table-body.d.ts +11 -0
- package/dist/components/xpl-table-body.js +1 -0
- package/dist/components/xpl-table-cell.d.ts +11 -0
- package/dist/components/xpl-table-cell.js +1 -0
- package/dist/components/xpl-table-cell2.js +1 -0
- package/dist/components/xpl-table-footer-cell.d.ts +11 -0
- package/dist/components/xpl-table-footer-cell.js +1 -0
- package/dist/components/xpl-table-footer-cell2.js +1 -0
- package/dist/components/xpl-table-footer.d.ts +11 -0
- package/dist/components/xpl-table-footer.js +1 -0
- package/dist/components/xpl-table-header-cell.js +1 -1
- package/dist/components/xpl-table-header-cell2.js +1 -0
- package/dist/components/xpl-table-header.js +1 -1
- package/dist/components/xpl-table-row.d.ts +11 -0
- package/dist/components/xpl-table-row.js +1 -0
- 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-top-nav-item.d.ts +11 -0
- package/dist/components/xpl-top-nav-item.js +1 -0
- package/dist/components/xpl-top-nav-item2.js +1 -0
- package/dist/components/xpl-top-nav.d.ts +11 -0
- package/dist/components/xpl-top-nav.js +1 -0
- 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 +291 -12
- package/dist/docs/xpl-backdrop/readme.md +1 -1
- package/dist/docs/xpl-badge/readme.md +104 -6
- package/dist/docs/xpl-banner/readme.md +203 -0
- package/dist/docs/xpl-button/readme.md +161 -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 +19 -14
- 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 +6 -4
- package/dist/docs/xpl-dropdown/readme.md +15 -12
- 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-dynamic-table/readme.md +22 -19
- package/dist/docs/xpl-dynamic-table-cell/readme.md +20 -18
- package/dist/docs/xpl-dynamic-table-row/readme.md +21 -19
- package/dist/docs/xpl-icon/readme.md +27 -3
- package/dist/docs/xpl-input/readme.md +72 -37
- package/dist/docs/xpl-input/xpl-input-color/readme.md +5 -0
- package/dist/docs/xpl-input/xpl-input-phone/readme.md +168 -0
- package/dist/docs/xpl-input/xpl-input-search/readme.md +175 -0
- package/dist/docs/xpl-input/xpl-input-time/readme.md +5 -0
- package/dist/docs/xpl-large-card/readme.md +1 -1
- package/dist/docs/xpl-list/readme.md +320 -10
- package/dist/docs/xpl-list/xpl-list-item/readme.md +99 -0
- package/dist/docs/xpl-modal/readme.md +3 -0
- package/dist/docs/xpl-pagination/readme.md +4 -0
- package/dist/docs/xpl-panel/readme.md +174 -0
- package/dist/docs/xpl-popover/readme.md +3 -1
- package/dist/docs/xpl-progress-bar/readme.md +145 -0
- package/dist/docs/xpl-progress-indicator/readme.md +234 -0
- package/dist/docs/xpl-radio/readme.md +6 -4
- package/dist/docs/xpl-select/readme.md +3 -1
- 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 +2 -1
- package/dist/docs/xpl-spotlight/readme.md +235 -0
- package/dist/docs/xpl-tab/readme.md +43 -7
- package/dist/docs/xpl-tab-panel/readme.md +42 -0
- package/dist/docs/xpl-table/readme.md +110 -46
- package/dist/docs/xpl-table/xpl-table-body/readme.md +10 -0
- package/dist/docs/xpl-table/xpl-table-cell/readme.md +33 -0
- package/dist/docs/xpl-table/xpl-table-footer/readme.md +10 -0
- package/dist/docs/xpl-table/xpl-table-footer-cell/readme.md +30 -0
- package/dist/docs/{xpl-table-header → xpl-table/xpl-table-header}/readme.md +13 -13
- package/dist/docs/xpl-table/xpl-table-header-cell/readme.md +66 -0
- package/dist/docs/xpl-table/xpl-table-row/readme.md +19 -0
- package/dist/docs/xpl-tabs/readme.md +63 -8
- package/dist/docs/xpl-tag/readme.md +379 -4
- package/dist/docs/xpl-toast/readme.md +56 -1
- package/dist/docs/xpl-top-nav/readme.md +179 -0
- package/dist/docs/xpl-top-nav/xpl-nav-header-menu/readme.md +81 -0
- package/dist/docs/xpl-top-nav/xpl-top-nav-item/readme.md +87 -0
- package/dist/esm/apollo-core.js +4 -4
- package/dist/esm/{index-DhZas3eX.js → index-C7bgJs6C.js} +149 -97
- 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_61.entry.js} +9087 -1942
- 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-main-nav.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 +90 -27
- package/dist/types/components/xpl-avatar/xpl-avatar.d.ts +30 -3
- 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 +47 -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 +21 -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 +5 -4
- 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 +10 -11
- package/dist/types/components/xpl-icon/xpl-icon.d.ts +1 -1
- package/dist/types/components/xpl-input/input.stories.d.ts +37 -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-search/xpl-input-search.d.ts +39 -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 +23 -5
- 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 +299 -13
- package/dist/types/components/xpl-list/listitem.d.ts +13 -0
- package/dist/types/components/xpl-list/xpl-list-item/xpl-list-item.d.ts +71 -0
- package/dist/types/components/xpl-list/xpl-list.d.ts +56 -3
- 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 +22 -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-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-progress-indicator/progress-indicator.stories.d.ts +62 -0
- package/dist/types/components/xpl-progress-indicator/xpl-progress-indicator.d.ts +11 -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-spotlight/spotlight.stories.d.ts +197 -0
- package/dist/types/components/xpl-spotlight/xpl-spotlight.d.ts +101 -0
- package/dist/types/components/xpl-tab/xpl-tab.d.ts +15 -2
- package/dist/types/components/xpl-tab-panel/xpl-tab-panel.d.ts +3 -2
- package/dist/types/components/xpl-table/table.stories.d.ts +161 -19
- package/dist/types/components/xpl-table/utils/move-row-dom.d.ts +3 -0
- package/dist/types/components/xpl-table/utils/table-internal.d.ts +8 -0
- package/dist/types/components/xpl-table/xpl-table-body/xpl-table-body.d.ts +3 -0
- package/dist/types/components/xpl-table/xpl-table-cell/xpl-table-cell.d.ts +11 -0
- package/dist/types/components/xpl-table/xpl-table-footer/xpl-table-footer.d.ts +3 -0
- package/dist/types/components/xpl-table/xpl-table-footer-cell/xpl-table-footer-cell.d.ts +4 -0
- package/dist/types/components/{xpl-table-header → xpl-table/xpl-table-header}/table-header.stories.d.ts +13 -16
- package/dist/types/components/xpl-table/xpl-table-header/xpl-table-header.d.ts +3 -0
- package/dist/types/components/{xpl-table-header-cell → xpl-table/xpl-table-header-cell}/table-header-cell.stories.d.ts +24 -20
- package/dist/types/components/xpl-table/xpl-table-header-cell/xpl-table-header-cell.d.ts +32 -0
- package/dist/types/components/xpl-table/xpl-table-row/xpl-table-row.d.ts +13 -0
- package/dist/types/components/xpl-table/xpl-table.d.ts +124 -22
- package/dist/types/components/xpl-tabs/segment-control.stories.d.ts +112 -0
- package/dist/types/components/xpl-tabs/tabs.shared.d.ts +156 -0
- package/dist/types/components/xpl-tabs/tabs.stories.d.ts +65 -12
- package/dist/types/components/xpl-tabs/xpl-tabs.d.ts +38 -19
- package/dist/types/components/xpl-tag/tag.stories.d.ts +65 -0
- package/dist/types/components/xpl-tag/xpl-tag.d.ts +37 -2
- 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-top-nav/top-nav.stories.d.ts +471 -0
- package/dist/types/components/xpl-top-nav/xpl-nav-header-menu/xpl-nav-header-menu.d.ts +18 -0
- package/dist/types/components/xpl-top-nav/xpl-top-nav-item/xpl-top-nav-item.d.ts +48 -0
- package/dist/types/components/xpl-top-nav/xpl-top-nav.d.ts +51 -0
- package/dist/types/components/xpl-utility-bar/xpl-utility-bar.d.ts +1 -1
- package/dist/types/components.d.ts +3059 -278
- package/dist/types/stencil-public-runtime.d.ts +23 -2
- package/dist/types/utils/layout-ancestors.d.ts +2 -0
- package/dist/types/utils/lifecycle.d.ts +16 -0
- package/dist/types/utils/tab-a11y-ids.d.ts +4 -0
- package/package.json +42 -28
- 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-4fab8172.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-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
- package/dist/cjs/xpl-list.cjs.entry.js +0 -32
- package/dist/cjs/xpl-table-header-cell.cjs.entry.js +0 -57
- package/dist/cjs/xpl-table-header.cjs.entry.js +0 -14
- package/dist/collection/components/xpl-progress/progress.stories.js +0 -106
- package/dist/collection/components/xpl-progress/xpl-progress.js +0 -60
- package/dist/collection/components/xpl-table-header/table-header.stories.js +0 -126
- package/dist/collection/components/xpl-table-header/xpl-table-header.js +0 -7
- package/dist/collection/components/xpl-table-header-cell/table-header-cell.stories.js +0 -75
- package/dist/collection/components/xpl-table-header-cell/xpl-table-header-cell.js +0 -188
- package/dist/components/xpl-progress.js +0 -1
- package/dist/docs/xpl-progress/readme.md +0 -22
- package/dist/docs/xpl-table-header-cell/readme.md +0 -47
- package/dist/esm/xpl-list.entry.js +0 -30
- package/dist/esm/xpl-table-header-cell.entry.js +0 -55
- package/dist/esm/xpl-table-header.entry.js +0 -12
- package/dist/types/components/xpl-progress/progress.stories.d.ts +0 -38
- package/dist/types/components/xpl-progress/xpl-progress.d.ts +0 -6
- package/dist/types/components/xpl-table-header/xpl-table-header.d.ts +0 -3
- package/dist/types/components/xpl-table-header-cell/xpl-table-header-cell.d.ts +0 -13
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
import { addons } from "storybook/preview-api";
|
|
2
|
+
import { INITIAL_VIEWPORTS } from "storybook/viewport";
|
|
3
|
+
const UPDATE_GLOBALS = 'updateGlobals';
|
|
4
|
+
const TOP_NAV_MOBILE600_VIEWPORT = {
|
|
5
|
+
name: 'Mobile (600px)',
|
|
6
|
+
styles: { width: '600px', height: '900px' },
|
|
7
|
+
type: 'mobile',
|
|
8
|
+
};
|
|
9
|
+
const TOP_NAV_STORY_STYLE_ID = 'sb-top-nav-story-styles';
|
|
10
|
+
const TOP_NAV_STORY_CSS = `
|
|
11
|
+
.sb-top-nav-story-canvas {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
min-height: 100vh;
|
|
14
|
+
width: 100%;
|
|
15
|
+
padding: var(--xpl-space-0);
|
|
16
|
+
}
|
|
17
|
+
.sb-top-nav-html-root { width: 100%; }
|
|
18
|
+
.sb-top-nav-html-bar {
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
align-items: center;
|
|
22
|
+
padding: var(--xpl-space-8) var(--xpl-space-16);
|
|
23
|
+
height: var(--xpl-size-350);
|
|
24
|
+
background: var(--xpl-background-surface-default);
|
|
25
|
+
color: var(--xpl-text-subdued);
|
|
26
|
+
border-bottom: var(--xpl-border-small) solid var(--xpl-border-default);
|
|
27
|
+
}
|
|
28
|
+
.sb-top-nav-html-inner-left { display: flex; align-items: center; }
|
|
29
|
+
.sb-top-nav-html-nav-control {
|
|
30
|
+
margin-right: var(--xpl-space-16);
|
|
31
|
+
border: none;
|
|
32
|
+
padding: var(--xpl-space-0);
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
.sb-top-nav-html-aside-left {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: var(--xpl-space-8);
|
|
39
|
+
flex: 1;
|
|
40
|
+
}
|
|
41
|
+
.sb-top-nav-html-brand-link {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: var(--xpl-space-8);
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
color: inherit;
|
|
47
|
+
}
|
|
48
|
+
.sb-top-nav-html-brand-img { height: var(--xpl-size-100); width: auto; }
|
|
49
|
+
.sb-top-nav-html-brand-text,
|
|
50
|
+
.sb-top-nav-html-brand-text-link {
|
|
51
|
+
font-size: var(--xpl-font-size-title-4);
|
|
52
|
+
font-weight: var(--xpl-font-weight-medium);
|
|
53
|
+
color: var(--xpl-text-strong);
|
|
54
|
+
}
|
|
55
|
+
.sb-top-nav-html-brand-text-link { text-decoration: none; }
|
|
56
|
+
.sb-top-nav-html-brand-row {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: var(--xpl-space-8);
|
|
60
|
+
}
|
|
61
|
+
.sb-top-nav-html-nav-link {
|
|
62
|
+
padding: var(--xpl-space-8);
|
|
63
|
+
font-size: var(--xpl-font-size-body);
|
|
64
|
+
}
|
|
65
|
+
.sb-top-nav-html-aside-right {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: flex-end;
|
|
69
|
+
gap: var(--xpl-space-8);
|
|
70
|
+
flex: 1;
|
|
71
|
+
}
|
|
72
|
+
.sb-top-nav-html-account-btn {
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: var(--xpl-space-8);
|
|
76
|
+
padding: var(--xpl-space-8);
|
|
77
|
+
font-size: var(--xpl-font-size-title-4);
|
|
78
|
+
font-weight: var(--xpl-font-weight-medium);
|
|
79
|
+
color: var(--xpl-text-strong);
|
|
80
|
+
border: none;
|
|
81
|
+
background-color: var(--xpl-background-surface-transparent-0);
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
}
|
|
84
|
+
.sb-top-nav-item-story-bar {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
height: var(--xpl-size-350);
|
|
88
|
+
padding: var(--xpl-space-0) var(--xpl-space-16);
|
|
89
|
+
gap: var(--xpl-space-8);
|
|
90
|
+
background: var(--xpl-background-surface-default);
|
|
91
|
+
border: var(--xpl-border-small) solid var(--xpl-border-default);
|
|
92
|
+
border-radius: var(--xpl-border-radius-default);
|
|
93
|
+
}
|
|
94
|
+
.sb-top-nav-html-item-icon {
|
|
95
|
+
width: var(--xpl-size-100);
|
|
96
|
+
height: var(--xpl-size-100);
|
|
97
|
+
display: inline-block;
|
|
98
|
+
margin-right: var(--xpl-space-8);
|
|
99
|
+
}
|
|
100
|
+
.sb-top-nav-html-item-inner {
|
|
101
|
+
padding: var(--xpl-space-8);
|
|
102
|
+
font-size: var(--xpl-font-size-body);
|
|
103
|
+
border-radius: var(--xpl-border-radius-small);
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
gap: var(--xpl-space-8);
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
text-decoration: none;
|
|
109
|
+
color: inherit;
|
|
110
|
+
}
|
|
111
|
+
.sb-top-nav-html-item-inner--selected { color: var(--xpl-text-strong); }
|
|
112
|
+
.sb-top-nav-menu-shell {
|
|
113
|
+
background: var(--xpl-background-surface-default);
|
|
114
|
+
border: var(--xpl-border-small) solid var(--xpl-border-default);
|
|
115
|
+
border-radius: var(--xpl-border-radius-default);
|
|
116
|
+
width: var(--xpl-top-nav-panel-width);
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
padding: var(--xpl-space-0);
|
|
121
|
+
}
|
|
122
|
+
.sb-top-nav-menu-shell--min {
|
|
123
|
+
min-width: var(--xpl-top-nav-panel-width);
|
|
124
|
+
border: var(--xpl-border-small) solid var(--xpl-border-default);
|
|
125
|
+
border-radius: var(--xpl-border-radius-default);
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
}
|
|
128
|
+
.sb-top-nav-menu-profile {
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
align-items: center;
|
|
132
|
+
text-align: center;
|
|
133
|
+
padding: var(--xpl-space-16);
|
|
134
|
+
border-bottom: var(--xpl-border-small) solid var(--xpl-border-default);
|
|
135
|
+
}
|
|
136
|
+
.sb-top-nav-menu-profile-inner { width: 100%; min-width: 0; }
|
|
137
|
+
.sb-top-nav-menu-username { font-weight: var(--xpl-font-weight-medium); }
|
|
138
|
+
.sb-top-nav-menu-email {
|
|
139
|
+
font-size: var(--xpl-font-size-caption);
|
|
140
|
+
color: var(--xpl-text-subdued);
|
|
141
|
+
}
|
|
142
|
+
.sb-top-nav-menu-list {
|
|
143
|
+
padding: var(--xpl-space-8) var(--xpl-space-0);
|
|
144
|
+
}
|
|
145
|
+
.sb-top-nav-menu-list a {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: var(--xpl-space-8);
|
|
149
|
+
padding: var(--xpl-space-8) var(--xpl-space-16);
|
|
150
|
+
color: inherit;
|
|
151
|
+
text-decoration: none;
|
|
152
|
+
}
|
|
153
|
+
.sb-top-nav-menu-right-aside-mobile {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
gap: var(--xpl-space-4);
|
|
157
|
+
padding: var(--xpl-space-4) var(--xpl-space-0);
|
|
158
|
+
border-bottom: var(--xpl-border-small) solid var(--xpl-border-default);
|
|
159
|
+
}
|
|
160
|
+
.sb-top-nav-menu-right-aside-mobile a {
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
gap: var(--xpl-space-8);
|
|
164
|
+
padding: var(--xpl-space-10) var(--xpl-space-12);
|
|
165
|
+
color: inherit;
|
|
166
|
+
text-decoration: none;
|
|
167
|
+
}
|
|
168
|
+
`.trim();
|
|
169
|
+
function ensureTopNavStoryStyles() {
|
|
170
|
+
if (typeof document === 'undefined')
|
|
171
|
+
return;
|
|
172
|
+
if (document.getElementById(TOP_NAV_STORY_STYLE_ID))
|
|
173
|
+
return;
|
|
174
|
+
const style = document.createElement('style');
|
|
175
|
+
style.id = TOP_NAV_STORY_STYLE_ID;
|
|
176
|
+
style.textContent = TOP_NAV_STORY_CSS;
|
|
177
|
+
document.head.appendChild(style);
|
|
178
|
+
}
|
|
179
|
+
function syncTopNavPreviewViewportToGlobals(previewViewport, globalsSnapshot) {
|
|
180
|
+
var _a;
|
|
181
|
+
const next = previewViewport !== null && previewViewport !== void 0 ? previewViewport : 'responsive';
|
|
182
|
+
const raw = (_a = globalsSnapshot === null || globalsSnapshot === void 0 ? void 0 : globalsSnapshot.viewport) === null || _a === void 0 ? void 0 : _a.value;
|
|
183
|
+
const normalizedCurrent = raw == null || raw === '' || raw === 'reset' ? undefined : String(raw);
|
|
184
|
+
const desiredValue = next === 'responsive' ? undefined : next;
|
|
185
|
+
if (normalizedCurrent === desiredValue) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const channel = addons.getChannel();
|
|
189
|
+
if (channel == null) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (next === 'responsive') {
|
|
193
|
+
channel.emit(UPDATE_GLOBALS, {
|
|
194
|
+
globals: { viewport: { value: undefined, isRotated: false } },
|
|
195
|
+
});
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
channel.emit(UPDATE_GLOBALS, {
|
|
199
|
+
globals: { viewport: { value: next, isRotated: false } },
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function topNavPreviewViewportDecorator(story, context) {
|
|
203
|
+
var _a;
|
|
204
|
+
const viewport = (_a = context.globals) === null || _a === void 0 ? void 0 : _a.viewport;
|
|
205
|
+
syncTopNavPreviewViewportToGlobals(context.args.previewViewport, { viewport });
|
|
206
|
+
return story();
|
|
207
|
+
}
|
|
208
|
+
function topNavDarkStoryDecorator(story) {
|
|
209
|
+
ensureTopNavStoryStyles();
|
|
210
|
+
const wrap = document.createElement('div');
|
|
211
|
+
wrap.className = 'dark sb-top-nav-story-canvas';
|
|
212
|
+
const result = story();
|
|
213
|
+
if (typeof result === 'string') {
|
|
214
|
+
const fragment = document.createRange().createContextualFragment(result);
|
|
215
|
+
wrap.append(fragment);
|
|
216
|
+
}
|
|
217
|
+
else if (result != null &&
|
|
218
|
+
typeof Node !== 'undefined' &&
|
|
219
|
+
result.nodeType !== undefined) {
|
|
220
|
+
wrap.appendChild(result);
|
|
221
|
+
}
|
|
222
|
+
return wrap;
|
|
223
|
+
}
|
|
224
|
+
const TOP_NAV_FIGMA_DESIGN = {
|
|
225
|
+
type: 'figma',
|
|
226
|
+
url: 'https://www.figma.com/design/MjjYek73MFnHmVNdm45Sd1/Apollo-Web?node-id=36021-13064&p=f&t=zPkMI4H5nK5XE3ZU-11',
|
|
227
|
+
};
|
|
228
|
+
const topNavFamilyDocsDescription = [
|
|
229
|
+
'Horizontal top bar (`xpl-top-nav`), nav items (`xpl-top-nav-item`), and profile header (`xpl-nav-header-menu`). **`xpl-top-nav`** supports **`brand-name`**, **`brand-href`**, **`brand-logo`** (image URL), and **`slot="brand-logo"`** for the built-in brand row; **`slot="left-aside"`** holds primary links; **`slot="right-aside"`** then **`slot="user-menu"`**; on narrow viewports (**one pixel below Tailwind `md`** — **`max-width: 767px`** with default **`screens.md`**) **`right-aside`** is hidden in the bar — duplicate those actions into **`slot="right-aside-mobile"`** on **`xpl-nav-header-menu`**. The account region uses an **internal** **`xpl-popover`** (**`bottom-end`**, **`display="menu"`**): set **`child-account-label`** for the built-in trigger label beside **`chevron-down`**, put the panel in **`slot="user-menu"`**, or use **`slot="user-menu-trigger"`** to replace the built-in trigger. Use **Top Navigation** Controls for props + **Actions** for **`navOpen`** / **`brandClick`**. With **`nav-control`**, the hamburger is visible only on those narrow widths (CSS **`top-nav.css`**). **`brandClick`** fires when the built-in brand is activated and **`brand-href`** is **not** set.',
|
|
230
|
+
'',
|
|
231
|
+
'**Storybook:** These stories wrap the canvas in Foundation **`dark`** so previews match the components’ dark palette. The manager **moon** toggle targets the addon store and may still look “light” in the chrome; the preview area uses dark tokens regardless.',
|
|
232
|
+
'',
|
|
233
|
+
'### Events',
|
|
234
|
+
'',
|
|
235
|
+
'| Component | Event | When it fires | `event.detail` |',
|
|
236
|
+
'| --- | --- | --- | --- |',
|
|
237
|
+
'| **`xpl-top-nav`** | `navOpen` | Mobile menu toggled via control, or drawer closed with **Escape** (`nav-control` must be set). | `boolean` — `true` when open, `false` when closed. |',
|
|
238
|
+
'| **`xpl-top-nav`** | `brandClick` | Built-in brand is activated (click or keyboard) and **`brand-href`** is unset. | `MouseEvent` — same as **`navItemClick`** on the internal brand **`xpl-top-nav-item`**. |',
|
|
239
|
+
'| **`xpl-top-nav-item`** | `navItemClick` | User activates a plain item (click or Enter/Space). Not emitted for dropdown items (`slot="dropdown"`) or for internal chevron-only toggles. | `MouseEvent` (the original click). |',
|
|
240
|
+
'| **`xpl-nav-header-menu`** | — | No custom events. | — |',
|
|
241
|
+
].join('\n');
|
|
242
|
+
const meta = {
|
|
243
|
+
title: 'Components/Navigation/Top Navigation',
|
|
244
|
+
component: 'xpl-top-nav',
|
|
245
|
+
decorators: [topNavDarkStoryDecorator],
|
|
246
|
+
parameters: {
|
|
247
|
+
design: TOP_NAV_FIGMA_DESIGN,
|
|
248
|
+
darkMode: {
|
|
249
|
+
current: 'dark',
|
|
250
|
+
},
|
|
251
|
+
actions: {
|
|
252
|
+
handles: ['navOpen', 'brandClick'],
|
|
253
|
+
},
|
|
254
|
+
docs: {
|
|
255
|
+
description: {
|
|
256
|
+
component: topNavFamilyDocsDescription,
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
export default meta;
|
|
262
|
+
function escapeAttr(value) {
|
|
263
|
+
return value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<');
|
|
264
|
+
}
|
|
265
|
+
function topNavLabelAttr(label) {
|
|
266
|
+
if (label == null || String(label).trim() === '') {
|
|
267
|
+
return '';
|
|
268
|
+
}
|
|
269
|
+
return ` label="${String(label).replace(/"/g, '"')}"`;
|
|
270
|
+
}
|
|
271
|
+
function topNavBrandAttrs(brandName, brandHref, brandLogo) {
|
|
272
|
+
const parts = [];
|
|
273
|
+
if (brandName != null && String(brandName).trim() !== '') {
|
|
274
|
+
parts.push(` brand-name="${escapeAttr(String(brandName))}"`);
|
|
275
|
+
}
|
|
276
|
+
if (brandHref != null && String(brandHref).trim() !== '') {
|
|
277
|
+
parts.push(` brand-href="${escapeAttr(String(brandHref))}"`);
|
|
278
|
+
}
|
|
279
|
+
if (brandLogo != null && String(brandLogo).trim() !== '') {
|
|
280
|
+
parts.push(` brand-logo="${escapeAttr(String(brandLogo).trim())}"`);
|
|
281
|
+
}
|
|
282
|
+
return parts.join('');
|
|
283
|
+
}
|
|
284
|
+
function topNavChildAccountLabelAttr(childAccountLabel) {
|
|
285
|
+
if (childAccountLabel == null || String(childAccountLabel).trim() === '') {
|
|
286
|
+
return '';
|
|
287
|
+
}
|
|
288
|
+
return ` child-account-label="${escapeAttr(String(childAccountLabel).trim())}"`;
|
|
289
|
+
}
|
|
290
|
+
export const TopNavigation = (args) => {
|
|
291
|
+
const { navControl, label, childAccountLabel, brandName, brandHref, brandLogo, menuUsername = 'Jane', menuEmail = 'jane@example.com', } = args;
|
|
292
|
+
const navControlAttr = navControl === true ? ' nav-control' : '';
|
|
293
|
+
const labelAttr = topNavLabelAttr(label);
|
|
294
|
+
const childAccountAttr = topNavChildAccountLabelAttr(childAccountLabel);
|
|
295
|
+
const brandAttr = topNavBrandAttrs(brandName, brandHref, brandLogo);
|
|
296
|
+
const username = (menuUsername === null || menuUsername === void 0 ? void 0 : menuUsername.trim()) ? escapeAttr(menuUsername.trim()) : '';
|
|
297
|
+
const email = (menuEmail === null || menuEmail === void 0 ? void 0 : menuEmail.trim()) ? escapeAttr(menuEmail.trim()) : '';
|
|
298
|
+
const navHeaderMenuAttrs = [
|
|
299
|
+
username ? `username="${username}"` : '',
|
|
300
|
+
email ? `email="${email}"` : '',
|
|
301
|
+
]
|
|
302
|
+
.filter(Boolean)
|
|
303
|
+
.join(' ');
|
|
304
|
+
const brandLogoSlot = brandLogo != null && String(brandLogo).trim() !== ''
|
|
305
|
+
? ''
|
|
306
|
+
: `
|
|
307
|
+
<xpl-icon slot="brand-logo" icon="rocket" size="24"></xpl-icon>`;
|
|
308
|
+
const rightAsideBlock = `
|
|
309
|
+
<xpl-button variant="tertiary" size="lg" slot="right-aside">
|
|
310
|
+
<xpl-icon icon="message-writing" size="20"></xpl-icon>
|
|
311
|
+
Inbox
|
|
312
|
+
<xpl-badge dot-only>7</xpl-badge>
|
|
313
|
+
</xpl-button>`;
|
|
314
|
+
const rightAsideMobileBlock = `
|
|
315
|
+
<xpl-top-nav-item slot="right-aside-mobile" label="Inbox" icon="message-writing"></xpl-top-nav-item>
|
|
316
|
+
`;
|
|
317
|
+
return `
|
|
318
|
+
<xpl-top-nav${navControlAttr}${labelAttr}${childAccountAttr}${brandAttr}>
|
|
319
|
+
${brandLogoSlot}
|
|
320
|
+
<xpl-top-nav-item slot="left-aside" label="Home" selected></xpl-top-nav-item>
|
|
321
|
+
<xpl-top-nav-item slot="left-aside" label="Dashboard"></xpl-top-nav-item>
|
|
322
|
+
<xpl-top-nav-item slot="left-aside" label="Settings"></xpl-top-nav-item>${rightAsideBlock}
|
|
323
|
+
<xpl-nav-header-menu slot="user-menu" ${navHeaderMenuAttrs}>${rightAsideMobileBlock}
|
|
324
|
+
<xpl-top-nav-item label="View Account" icon="house-4" selected></xpl-top-nav-item>
|
|
325
|
+
<xpl-top-nav-item label="Change Account" icon="refresh"></xpl-top-nav-item>
|
|
326
|
+
<xpl-top-nav-item label="Logout" icon="open-rect-arrow-out"></xpl-top-nav-item>
|
|
327
|
+
</xpl-nav-header-menu>
|
|
328
|
+
</xpl-top-nav>
|
|
329
|
+
`.trim();
|
|
330
|
+
};
|
|
331
|
+
const HtmlTopNavigation = (args) => {
|
|
332
|
+
const { navControl, label, childAccountLabel, brandName, brandHref, brandLogo } = args;
|
|
333
|
+
const navAriaLabel = label != null && String(label).trim() !== '' ? String(label) : 'top-navigation-bar';
|
|
334
|
+
const demoBrand = brandName != null && String(brandName).trim() !== '' ? String(brandName).trim() : 'My App';
|
|
335
|
+
const demoBrandLink = brandHref != null && String(brandHref).trim() !== '' ? brandHref : '#';
|
|
336
|
+
const safeBrandText = demoBrand
|
|
337
|
+
.replace(/&/g, '&')
|
|
338
|
+
.replace(/</g, '<')
|
|
339
|
+
.replace(/>/g, '>');
|
|
340
|
+
const logoUrl = brandLogo != null && String(brandLogo).trim() !== '' ? String(brandLogo).trim() : '';
|
|
341
|
+
const showChildRow = childAccountLabel != null && String(childAccountLabel).trim() !== '';
|
|
342
|
+
const safeChildLabel = showChildRow && childAccountLabel != null
|
|
343
|
+
? String(childAccountLabel)
|
|
344
|
+
.replace(/&/g, '&')
|
|
345
|
+
.replace(/</g, '<')
|
|
346
|
+
.replace(/>/g, '>')
|
|
347
|
+
: '';
|
|
348
|
+
const lines = [
|
|
349
|
+
'<div class="dark xpl-top-nav sb-top-nav-html-root">',
|
|
350
|
+
` <nav aria-label="${navAriaLabel.replace(/"/g, '"')}" class="xpl-top-nav__bar sb-top-nav-html-bar">`,
|
|
351
|
+
' <div class="xpl-top-nav__inner-left sb-top-nav-html-inner-left">',
|
|
352
|
+
];
|
|
353
|
+
if (navControl) {
|
|
354
|
+
lines.push(' <button type="button" class="xpl-top-nav__nav-control sb-top-nav-html-nav-control" aria-expanded="false" aria-label="Open navigation menu">', ' <xpl-icon icon="menu" class="xpl-top-nav__control-icon" aria-hidden="true"></xpl-icon>', ' </button>');
|
|
355
|
+
}
|
|
356
|
+
lines.push(' <div class="xpl-top-nav__aside xpl-nav-left sb-top-nav-html-aside-left">');
|
|
357
|
+
if (logoUrl) {
|
|
358
|
+
const alt = demoBrand ? escapeAttr(demoBrand) : 'Brand';
|
|
359
|
+
lines.push(` <a href="${demoBrandLink.replace(/"/g, '"')}" class="sb-top-nav-html-brand-link">`, ` <img src="${escapeAttr(logoUrl)}" alt="${alt}" class="sb-top-nav-html-brand-img" />`);
|
|
360
|
+
if (demoBrand) {
|
|
361
|
+
lines.push(` <span class="sb-top-nav-html-brand-text">${safeBrandText}</span>`);
|
|
362
|
+
}
|
|
363
|
+
lines.push(' </a>');
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
lines.push(' <div class="sb-top-nav-html-brand-row">', ' <xpl-icon icon="rocket" size="24"></xpl-icon>', ` <a href="${demoBrandLink.replace(/"/g, '"')}" class="sb-top-nav-html-brand-text-link">${safeBrandText}</a>`, ' </div>');
|
|
367
|
+
}
|
|
368
|
+
lines.push(' <a href="#" class="sb-top-nav-html-nav-link">Home</a>', ' <a href="#" class="sb-top-nav-html-nav-link">Dashboard</a>', ' <a href="#" class="sb-top-nav-html-nav-link">Settings</a>', ' </div>', ' </div>', ' <div class="xpl-top-nav__aside xpl-nav-right sb-top-nav-html-aside-right">', ' <xpl-button variant="tertiary" size="lg">', ' <xpl-icon icon="message-writing" size="20"></xpl-icon>', ' Inbox', ' <xpl-badge dot-only>7</xpl-badge>', ' </xpl-button>');
|
|
369
|
+
if (showChildRow) {
|
|
370
|
+
lines.push(` <button type="button" class="sb-top-nav-html-account-btn">${safeChildLabel} <xpl-icon icon="chevron-down" size="20"></xpl-icon></button>`);
|
|
371
|
+
}
|
|
372
|
+
lines.push(` <!-- user-menu: internal xpl-popover opened by the built-in child-account trigger -->`, ' </div>', ' </nav>', '</div>');
|
|
373
|
+
return lines.join('\n');
|
|
374
|
+
};
|
|
375
|
+
TopNavigation.args = {
|
|
376
|
+
previewViewport: 'responsive',
|
|
377
|
+
navControl: true,
|
|
378
|
+
label: 'Main navigation',
|
|
379
|
+
childAccountLabel: 'Child Account',
|
|
380
|
+
brandName: 'My App',
|
|
381
|
+
brandHref: '#',
|
|
382
|
+
brandLogo: '',
|
|
383
|
+
menuUsername: 'Jane',
|
|
384
|
+
menuEmail: 'jane@example.com',
|
|
385
|
+
};
|
|
386
|
+
TopNavigation.decorators = [topNavPreviewViewportDecorator];
|
|
387
|
+
TopNavigation.argTypes = {
|
|
388
|
+
previewViewport: {
|
|
389
|
+
control: 'select',
|
|
390
|
+
options: ['responsive', 'iphone12'],
|
|
391
|
+
description: '**Storybook preview width** (updates **`globals.viewport`** — same as the viewport toolbar). **`responsive`** = full iframe (desktop nav). **`iphone12`** / narrow the iframe so **`top-nav.css`** mobile rules apply. Switch back to **Responsive** before leaving this story if other stories need a wide canvas.',
|
|
392
|
+
table: { category: 'Storybook' },
|
|
393
|
+
},
|
|
394
|
+
brandName: {
|
|
395
|
+
control: 'text',
|
|
396
|
+
description: 'Built-in **`brand-name`** attribute (shown next to **`slot="brand-logo"`** / **`brand-logo`** URL). Clear both **`brand-name`** and **`brand-href`** in Controls to hide the brand row in the Web Component panel (keep **`slot="brand-logo"`** only if you still need a logo-only row).',
|
|
397
|
+
},
|
|
398
|
+
brandHref: {
|
|
399
|
+
control: 'text',
|
|
400
|
+
description: 'Built-in **`brand-href`** — native navigation for the brand control. **`#`** is fine for Storybook. **Clear** this field so the brand uses **`role="button"`** and emits **`brandClick`** (see **Actions**).',
|
|
401
|
+
},
|
|
402
|
+
brandLogo: {
|
|
403
|
+
control: 'text',
|
|
404
|
+
description: 'Optional **`brand-logo`** image URL. When set, the built-in **`<img>`** is used and **`slot="brand-logo"`** (icon) is omitted in this story.',
|
|
405
|
+
table: { category: 'Brand' },
|
|
406
|
+
},
|
|
407
|
+
childAccountLabel: {
|
|
408
|
+
control: 'text',
|
|
409
|
+
description: '**`child-account-label`** — label beside the chevron on the built-in account menu trigger (with **`slot="user-menu"`**). Clear for chevron-only trigger.',
|
|
410
|
+
},
|
|
411
|
+
navControl: {
|
|
412
|
+
control: 'boolean',
|
|
413
|
+
description: 'Renders the hamburger in the DOM. CSS shows it only below **`md`** (**max-width 767px** at default Tailwind); **`left-aside`** is hidden at that width until the drawer opens. When **off**, **`left-aside`** stays hidden on narrow viewports **with no drawer**. Emits **`navOpen`** when the control is used.',
|
|
414
|
+
},
|
|
415
|
+
label: {
|
|
416
|
+
control: 'text',
|
|
417
|
+
description: 'Accessible name for the `<nav>` landmark (`aria-label`). Use a unique value when the page has multiple navigation regions. Clear to use default `top-navigation-bar`.',
|
|
418
|
+
},
|
|
419
|
+
menuUsername: {
|
|
420
|
+
control: 'text',
|
|
421
|
+
description: '**`username`** on **`xpl-nav-header-menu`**.',
|
|
422
|
+
table: { category: 'User menu (panel)' },
|
|
423
|
+
},
|
|
424
|
+
menuEmail: {
|
|
425
|
+
control: 'text',
|
|
426
|
+
description: '**`email`** on **`xpl-nav-header-menu`**.',
|
|
427
|
+
table: { category: 'User menu (panel)' },
|
|
428
|
+
},
|
|
429
|
+
navOpen: {
|
|
430
|
+
control: false,
|
|
431
|
+
description: '**Event** (not a prop): `navOpen` — `CustomEvent<boolean>`; `detail` is the new open state when the nav control is used or **Escape** closes the mobile drawer (when **`nav-control`** is set).',
|
|
432
|
+
table: { category: 'Events' },
|
|
433
|
+
},
|
|
434
|
+
brandClick: {
|
|
435
|
+
control: false,
|
|
436
|
+
description: '**Event** (not a prop): `brandClick` — `CustomEvent<MouseEvent>`; fires when the built-in brand is activated and **`brand-href`** is **not** set. Clear **`brand-href`** in Controls, then click the brand.',
|
|
437
|
+
table: { category: 'Events' },
|
|
438
|
+
},
|
|
439
|
+
};
|
|
440
|
+
TopNavigation.parameters = {
|
|
441
|
+
layout: 'fullscreen',
|
|
442
|
+
design: TOP_NAV_FIGMA_DESIGN,
|
|
443
|
+
viewport: {
|
|
444
|
+
viewports: Object.assign(Object.assign({}, INITIAL_VIEWPORTS), { mobile600: TOP_NAV_MOBILE600_VIEWPORT }),
|
|
445
|
+
},
|
|
446
|
+
'web-component': {
|
|
447
|
+
render: TopNavigation(TopNavigation.args),
|
|
448
|
+
},
|
|
449
|
+
html: {
|
|
450
|
+
render: HtmlTopNavigation(TopNavigation.args),
|
|
451
|
+
},
|
|
452
|
+
};
|
|
453
|
+
export const TopNavItem = (args) => {
|
|
454
|
+
const attrs = [
|
|
455
|
+
args.active === true ? ' active' : '',
|
|
456
|
+
args.href != null && args.href !== '' ? `href="${escapeAttr(args.href)}"` : '',
|
|
457
|
+
args.label != null && args.label !== '' ? `label="${escapeAttr(args.label)}"` : '',
|
|
458
|
+
args.icon != null && args.icon !== '' ? `icon="${escapeAttr(args.icon)}"` : '',
|
|
459
|
+
args.itemAriaLabel != null && args.itemAriaLabel !== ''
|
|
460
|
+
? `item-aria-label="${escapeAttr(args.itemAriaLabel)}"`
|
|
461
|
+
: '',
|
|
462
|
+
args.selected === true ? ' selected' : '',
|
|
463
|
+
]
|
|
464
|
+
.filter(Boolean)
|
|
465
|
+
.join(' ');
|
|
466
|
+
const hasLabel = args.label != null && args.label !== '';
|
|
467
|
+
return `
|
|
468
|
+
<div class="dark sb-top-nav-item-story-bar">
|
|
469
|
+
<xpl-top-nav-item ${attrs.trim()}>
|
|
470
|
+
${hasLabel ? '' : ' <span>Custom slot content</span>'}
|
|
471
|
+
</xpl-top-nav-item>
|
|
472
|
+
</div>
|
|
473
|
+
`.trim();
|
|
474
|
+
};
|
|
475
|
+
const HtmlTopNavItem = (args) => {
|
|
476
|
+
var _a;
|
|
477
|
+
const label = args.label != null && args.label !== '' ? args.label : 'Custom slot content';
|
|
478
|
+
const selected = args.selected === true;
|
|
479
|
+
const hasIcon = args.icon != null && args.icon !== '';
|
|
480
|
+
const hasHref = args.href != null && args.href !== '';
|
|
481
|
+
const ariaCurrent = selected ? ' aria-current="page"' : '';
|
|
482
|
+
const iconPlaceholder = hasIcon ? '<span class="sb-top-nav-html-item-icon">◆</span>' : '';
|
|
483
|
+
const innerContent = hasIcon
|
|
484
|
+
? ` ${iconPlaceholder}\n <span>${label}</span>`
|
|
485
|
+
: ` <span>${label}</span>`;
|
|
486
|
+
const innerClasses = [
|
|
487
|
+
'sb-top-nav-html-item-inner',
|
|
488
|
+
selected ? 'sb-top-nav-html-item-inner--selected' : '',
|
|
489
|
+
]
|
|
490
|
+
.filter(Boolean)
|
|
491
|
+
.join(' ');
|
|
492
|
+
const innerTag = hasHref
|
|
493
|
+
? ` <a href="${escapeAttr((_a = args.href) !== null && _a !== void 0 ? _a : '')}"${ariaCurrent} class="${innerClasses}">`
|
|
494
|
+
: ` <div role="button" tabindex="0"${ariaCurrent} class="${innerClasses}">`;
|
|
495
|
+
const innerClose = hasHref ? ' </a>' : ' </div>';
|
|
496
|
+
const lines = [
|
|
497
|
+
'<div class="dark sb-top-nav-item-story-bar">',
|
|
498
|
+
' <div role="listitem">',
|
|
499
|
+
innerTag,
|
|
500
|
+
innerContent,
|
|
501
|
+
innerClose,
|
|
502
|
+
' </div>',
|
|
503
|
+
'</div>',
|
|
504
|
+
];
|
|
505
|
+
return lines.join('\n');
|
|
506
|
+
};
|
|
507
|
+
TopNavItem.args = {
|
|
508
|
+
href: '',
|
|
509
|
+
label: 'Nav item',
|
|
510
|
+
selected: false,
|
|
511
|
+
};
|
|
512
|
+
TopNavItem.argTypes = {
|
|
513
|
+
active: {
|
|
514
|
+
control: 'boolean',
|
|
515
|
+
description: 'Adds `xpl-top-nav-item--active` for accent styling (separate from `selected` / current page).',
|
|
516
|
+
},
|
|
517
|
+
href: {
|
|
518
|
+
control: 'text',
|
|
519
|
+
description: 'When set, the item renders as a native `<a>` link instead of a `div[role="button"]`. Use `#` for in-page demo. Clear to switch back to button mode.',
|
|
520
|
+
},
|
|
521
|
+
label: {
|
|
522
|
+
control: 'text',
|
|
523
|
+
description: 'Optional label to display as text. Omit to use the default slot for custom content.',
|
|
524
|
+
},
|
|
525
|
+
icon: {
|
|
526
|
+
control: 'text',
|
|
527
|
+
description: 'Icon name from the Apollo icon set to display before the label (e.g. house-4, wrench). Empty = no icon.',
|
|
528
|
+
},
|
|
529
|
+
itemAriaLabel: {
|
|
530
|
+
control: 'text',
|
|
531
|
+
description: 'Maps to `item-aria-label`: accessible name for icon-only items (no label / default-slot text).',
|
|
532
|
+
},
|
|
533
|
+
selected: {
|
|
534
|
+
control: 'boolean',
|
|
535
|
+
description: 'Whether the item is selected. Sets aria-current="page" and selected styling.',
|
|
536
|
+
},
|
|
537
|
+
navItemClick: {
|
|
538
|
+
control: false,
|
|
539
|
+
description: '**Event** (not a prop): `navItemClick` — `CustomEvent<MouseEvent>`; `detail` is the originating click. Not emitted when `slot="dropdown"` is used.',
|
|
540
|
+
table: { category: 'Events' },
|
|
541
|
+
},
|
|
542
|
+
};
|
|
543
|
+
TopNavItem.parameters = {
|
|
544
|
+
layout: 'centered',
|
|
545
|
+
design: TOP_NAV_FIGMA_DESIGN,
|
|
546
|
+
'web-component': {
|
|
547
|
+
render: TopNavItem(TopNavItem.args),
|
|
548
|
+
},
|
|
549
|
+
html: {
|
|
550
|
+
render: HtmlTopNavItem(TopNavItem.args),
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
export const TopNavMenu = (args) => {
|
|
554
|
+
const attrs = [
|
|
555
|
+
args.username != null && args.username !== ''
|
|
556
|
+
? `username="${escapeAttr(args.username)}"`
|
|
557
|
+
: '',
|
|
558
|
+
args.email != null && args.email !== '' ? `email="${escapeAttr(args.email)}"` : '',
|
|
559
|
+
]
|
|
560
|
+
.filter(Boolean)
|
|
561
|
+
.join(' ');
|
|
562
|
+
const rightAsideMobile = args.showRightAsideMobile !== false
|
|
563
|
+
? `
|
|
564
|
+
<xpl-top-nav-item slot="right-aside-mobile" label="Inbox" icon="message-writing"></xpl-top-nav-item>`
|
|
565
|
+
: '';
|
|
566
|
+
return `
|
|
567
|
+
<div class="dark sb-top-nav-menu-shell">
|
|
568
|
+
<xpl-nav-header-menu ${attrs.trim()}>${rightAsideMobile}
|
|
569
|
+
<xpl-top-nav-item label="View Account" icon="house-4" selected></xpl-top-nav-item>
|
|
570
|
+
<xpl-top-nav-item label="Change Account" icon="refresh"></xpl-top-nav-item>
|
|
571
|
+
<xpl-top-nav-item label="Logout" icon="open-rect-arrow-out"></xpl-top-nav-item>
|
|
572
|
+
</xpl-nav-header-menu>
|
|
573
|
+
</div>
|
|
574
|
+
`.trim();
|
|
575
|
+
};
|
|
576
|
+
const HtmlTopNavMenu = (args) => {
|
|
577
|
+
const username = args.username != null && args.username !== '' ? args.username : '';
|
|
578
|
+
const email = args.email != null && args.email !== '' ? args.email : '';
|
|
579
|
+
const lines = [
|
|
580
|
+
'<div class="dark sb-top-nav-menu-shell--min">',
|
|
581
|
+
' <div class="sb-top-nav-menu-profile">',
|
|
582
|
+
' <div class="sb-top-nav-menu-profile-inner">',
|
|
583
|
+
];
|
|
584
|
+
if (username) {
|
|
585
|
+
lines.push(` <div class="sb-top-nav-menu-username">${escapeAttr(username)}</div>`);
|
|
586
|
+
}
|
|
587
|
+
if (email) {
|
|
588
|
+
lines.push(` <div class="sb-top-nav-menu-email">${escapeAttr(email)}</div>`);
|
|
589
|
+
}
|
|
590
|
+
lines.push(' </div>', ' </div>');
|
|
591
|
+
if (args.showRightAsideMobile !== false) {
|
|
592
|
+
lines.push(' <div class="sb-top-nav-menu-right-aside-mobile">', ' <a href="#">Inbox</a>', ' </div>');
|
|
593
|
+
}
|
|
594
|
+
lines.push(' <div role="list" class="sb-top-nav-menu-list">', ' <a href="#">View Account</a>', ' <a href="#">Change Account</a>', ' <a href="#">Logout</a>', ' </div>', '</div>');
|
|
595
|
+
return lines.join('\n');
|
|
596
|
+
};
|
|
597
|
+
TopNavMenu.args = {
|
|
598
|
+
username: 'Katie Wilson',
|
|
599
|
+
email: 'katie01@email.com',
|
|
600
|
+
showRightAsideMobile: true,
|
|
601
|
+
};
|
|
602
|
+
TopNavMenu.argTypes = {
|
|
603
|
+
username: {
|
|
604
|
+
control: 'text',
|
|
605
|
+
description: 'Username to display.',
|
|
606
|
+
},
|
|
607
|
+
email: {
|
|
608
|
+
control: 'text',
|
|
609
|
+
description: 'Email to display.',
|
|
610
|
+
},
|
|
611
|
+
showRightAsideMobile: {
|
|
612
|
+
control: 'boolean',
|
|
613
|
+
description: '**`slot="right-aside-mobile"`** strip (Inbox) between profile and list — matches **`xpl-top-nav`** narrow **`right-aside`** duplication.',
|
|
614
|
+
},
|
|
615
|
+
};
|
|
616
|
+
TopNavMenu.parameters = {
|
|
617
|
+
layout: 'centered',
|
|
618
|
+
design: TOP_NAV_FIGMA_DESIGN,
|
|
619
|
+
'web-component': {
|
|
620
|
+
render: TopNavMenu(TopNavMenu.args),
|
|
621
|
+
},
|
|
622
|
+
html: {
|
|
623
|
+
render: HtmlTopNavMenu(TopNavMenu.args),
|
|
624
|
+
},
|
|
625
|
+
};
|