@re-code/aurora 0.2.0 → 0.3.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/README.md +1 -1
- package/dist/aurora/aurora.esm.js +1 -1
- package/dist/aurora/{p-8ed72e5b.entry.js → p-01ff4d34.entry.js} +1 -1
- package/dist/aurora/{p-c3668073.entry.js → p-0554ffea.entry.js} +1 -1
- package/dist/aurora/{p-278d3434.entry.js → p-0a0a2bfe.entry.js} +1 -1
- package/dist/aurora/{p-e1c97234.entry.js → p-0a7e9e8e.entry.js} +1 -1
- package/dist/aurora/{p-c330982c.entry.js → p-1670a9bd.entry.js} +1 -1
- package/dist/aurora/{p-efd60427.entry.js → p-17c6de2c.entry.js} +1 -1
- package/dist/aurora/{p-a87dc1d3.entry.js → p-24ff90e0.entry.js} +1 -1
- package/dist/aurora/p-27da7b8a.entry.js +1 -0
- package/dist/aurora/p-380d8ebe.entry.js +1 -0
- package/dist/aurora/{p-a1e257c7.entry.js → p-3cfccef1.entry.js} +1 -1
- package/dist/aurora/{p-e72126a2.entry.js → p-4fd71d14.entry.js} +1 -1
- package/dist/aurora/{p-89b66c7a.entry.js → p-5606ed9c.entry.js} +1 -1
- package/dist/aurora/p-56fc4315.entry.js +1 -0
- package/dist/aurora/{p-685b9e53.entry.js → p-5a027df1.entry.js} +1 -1
- package/dist/aurora/{p-487df7d8.entry.js → p-5dd73182.entry.js} +1 -1
- package/dist/aurora/{p-17e65032.entry.js → p-62d79933.entry.js} +1 -1
- package/dist/aurora/p-6a1363da.entry.js +1 -0
- package/dist/aurora/{p-fd4e9cdd.entry.js → p-6e9c8e27.entry.js} +1 -1
- package/dist/aurora/{p-31a86367.entry.js → p-742abb2c.entry.js} +1 -1
- package/dist/aurora/{p-40bb52c3.entry.js → p-7a9bc20f.entry.js} +1 -1
- package/dist/aurora/{p-35edd036.entry.js → p-7cc6bb71.entry.js} +1 -1
- package/dist/aurora/{p-689f37db.entry.js → p-7fa0ee48.entry.js} +1 -1
- package/dist/aurora/{p-ee2ea46e.entry.js → p-815611f9.entry.js} +1 -1
- package/dist/aurora/{p-a8e984e1.entry.js → p-8800c466.entry.js} +1 -1
- package/dist/aurora/{p-5d2a88ca.entry.js → p-9e9377b5.entry.js} +1 -1
- package/dist/aurora/p-DMeUBbqF.js +7 -0
- package/dist/aurora/{p-DXbj-yic.js → p-DNpzZvak.js} +1 -1
- package/dist/aurora/p-DjW6oMgu.js +7 -0
- package/dist/aurora/{p-DzNA1eDU.js → p-DqAwSryz.js} +1 -1
- package/dist/aurora/p-NvNa2Iiu.js +1 -0
- package/dist/aurora/p-a376a248.entry.js +1 -0
- package/dist/aurora/{p-0608e910.entry.js → p-a63d1f80.entry.js} +1 -1
- package/dist/aurora/p-b0ebcc51.entry.js +1 -0
- package/dist/aurora/p-be98a1d7.entry.js +1 -0
- package/dist/aurora/{p-ed998b0c.entry.js → p-bf922703.entry.js} +1 -1
- package/dist/aurora/{p-ee4475a6.entry.js → p-c1422894.entry.js} +1 -1
- package/dist/aurora/{p-372a3416.entry.js → p-c2164ffe.entry.js} +1 -1
- package/dist/aurora/{p-2a16d544.entry.js → p-cb63ca43.entry.js} +1 -1
- package/dist/aurora/p-cc1015fe.entry.js +1 -0
- package/dist/aurora/{p-88b72de7.entry.js → p-cf16464e.entry.js} +1 -1
- package/dist/aurora/p-cfa0166b.entry.js +1 -0
- package/dist/aurora/{p-e7c81a6b.entry.js → p-d85e1d60.entry.js} +1 -1
- package/dist/aurora/{p-64229ad2.entry.js → p-f176be8b.entry.js} +1 -1
- package/dist/aurora/{p-bd1f6486.entry.js → p-f3383f3c.entry.js} +1 -1
- package/dist/aurora/p-f5d3aefa.entry.js +1 -0
- package/dist/aurora/{p-038b2190.entry.js → p-f85687a5.entry.js} +1 -1
- package/dist/aurora/{p-546a2f69.entry.js → p-fe143404.entry.js} +1 -1
- package/dist/cjs/au-alert.cjs.entry.js +1 -1
- package/dist/cjs/au-breadcrumb-item.cjs.entry.js +1 -1
- package/dist/cjs/au-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/au-checkbox.cjs.entry.js +4 -4
- package/dist/cjs/au-combobox.cjs.entry.js +6 -6
- package/dist/cjs/au-container.cjs.entry.js +1 -1
- package/dist/cjs/au-dialog.cjs.entry.js +4 -4
- package/dist/cjs/au-divider.cjs.entry.js +1 -1
- package/dist/cjs/au-field.cjs.entry.js +1 -1
- package/dist/cjs/{au-icon-D0L9Wwy0.js → au-icon-0-khGfX2.js} +1 -1
- package/dist/cjs/au-icon.cjs.entry.js +1 -1
- package/dist/cjs/au-input.cjs.entry.js +6 -6
- package/dist/cjs/au-kbd.cjs.entry.js +355 -0
- package/dist/cjs/au-list-item.cjs.entry.js +195 -0
- package/dist/cjs/au-list.cjs.entry.js +78 -0
- package/dist/cjs/au-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/au-menu.cjs.entry.js +1 -1
- package/dist/cjs/au-nav-link.cjs.entry.js +1 -1
- package/dist/cjs/au-navbar.cjs.entry.js +4 -4
- package/dist/cjs/au-number-input.cjs.entry.js +4 -4
- package/dist/cjs/au-popover.cjs.entry.js +1 -1
- package/dist/cjs/au-progress.cjs.entry.js +107 -0
- package/dist/cjs/au-radio-group.cjs.entry.js +3 -3
- package/dist/cjs/au-radio.cjs.entry.js +1 -1
- package/dist/cjs/au-segmented-control.cjs.entry.js +3 -3
- package/dist/cjs/au-segmented-option.cjs.entry.js +1 -1
- package/dist/cjs/au-select.cjs.entry.js +4 -4
- package/dist/cjs/au-sidebar-nav.cjs.entry.js +1 -1
- package/dist/cjs/au-skeleton.cjs.entry.js +106 -0
- package/dist/cjs/au-slider.cjs.entry.js +3 -3
- package/dist/cjs/au-splitter.cjs.entry.js +2 -2
- package/dist/cjs/au-stat.cjs.entry.js +262 -0
- package/dist/cjs/au-switch.cjs.entry.js +4 -4
- package/dist/cjs/au-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/au-tab.cjs.entry.js +1 -1
- package/dist/cjs/au-table.cjs.entry.js +337 -0
- package/dist/cjs/au-tabs.cjs.entry.js +4 -4
- package/dist/cjs/au-textarea.cjs.entry.js +3 -3
- package/dist/cjs/au-toast-region.cjs.entry.js +1 -1
- package/dist/cjs/au-toast.cjs.entry.js +1 -1
- package/dist/cjs/au-toc.cjs.entry.js +1 -1
- package/dist/cjs/au-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/aurora.cjs.js +1 -1
- package/dist/cjs/{icon-loader-DyRasOnf.js → icon-loader-Dij7pYkP.js} +3 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/trending-down-BKjmYE1H.js +19 -0
- package/dist/cjs/trending-up-CoWuXxqz.js +19 -0
- package/dist/collection/collection-manifest.json +7 -0
- package/dist/collection/components/data-display/au-kbd/au-kbd.constants.js +85 -0
- package/dist/collection/components/data-display/au-kbd/au-kbd.css +98 -0
- package/dist/collection/components/data-display/au-kbd/au-kbd.js +189 -0
- package/dist/collection/components/data-display/au-kbd/au-kbd.types.js +1 -0
- package/dist/collection/components/data-display/au-kbd/index.js +2 -0
- package/dist/collection/components/data-display/au-kbd/internal/describe.js +67 -0
- package/dist/collection/components/data-display/au-kbd/internal/parse.js +85 -0
- package/dist/collection/components/data-display/au-kbd/internal/platform.js +19 -0
- package/dist/collection/components/data-display/au-list/au-list.constants.js +8 -0
- package/dist/collection/components/data-display/au-list/au-list.css +30 -0
- package/dist/collection/components/data-display/au-list/au-list.js +132 -0
- package/dist/collection/components/data-display/au-list/au-list.types.js +1 -0
- package/dist/collection/components/data-display/au-list/index.js +2 -0
- package/dist/collection/components/data-display/au-list-item/au-list-item.css +196 -0
- package/dist/collection/components/data-display/au-list-item/au-list-item.js +305 -0
- package/dist/collection/components/data-display/au-list-item/index.js +1 -0
- package/dist/collection/components/data-display/au-list-item/internal/interactive-content.js +29 -0
- package/dist/collection/components/data-display/au-stat/au-stat.constants.js +44 -0
- package/dist/collection/components/data-display/au-stat/au-stat.css +139 -0
- package/dist/collection/components/data-display/au-stat/au-stat.js +491 -0
- package/dist/collection/components/data-display/au-stat/au-stat.types.js +1 -0
- package/dist/collection/components/data-display/au-stat/index.js +2 -0
- package/dist/collection/components/data-display/au-stat/internal/announcement.js +13 -0
- package/dist/collection/components/data-display/au-table/au-table.constants.js +21 -0
- package/dist/collection/components/data-display/au-table/au-table.css +20 -0
- package/dist/collection/components/data-display/au-table/au-table.js +482 -0
- package/dist/collection/components/data-display/au-table/au-table.types.js +1 -0
- package/dist/collection/components/data-display/au-table/index.js +2 -0
- package/dist/collection/components/data-display/au-table/internal/scroller-label.js +11 -0
- package/dist/collection/components/data-display/au-table/internal/sort.js +17 -0
- package/dist/collection/components/feedback/au-alert/au-alert.js +1 -1
- package/dist/collection/components/feedback/au-progress/au-progress.constants.js +38 -0
- package/dist/collection/components/feedback/au-progress/au-progress.css +201 -0
- package/dist/collection/components/feedback/au-progress/au-progress.js +226 -0
- package/dist/collection/components/feedback/au-progress/au-progress.types.js +1 -0
- package/dist/collection/components/feedback/au-progress/index.js +2 -0
- package/dist/collection/components/feedback/au-skeleton/au-skeleton.constants.js +33 -0
- package/dist/collection/components/feedback/au-skeleton/au-skeleton.css +108 -0
- package/dist/collection/components/feedback/au-skeleton/au-skeleton.js +159 -0
- package/dist/collection/components/feedback/au-skeleton/au-skeleton.types.js +1 -0
- package/dist/collection/components/feedback/au-skeleton/index.js +2 -0
- package/dist/collection/components/feedback/au-toast/au-toast.js +1 -1
- package/dist/collection/components/feedback/au-toast-region/au-toast-region.js +1 -1
- package/dist/collection/components/forms/au-checkbox/au-checkbox.js +4 -4
- package/dist/collection/components/forms/au-combobox/au-combobox.js +6 -6
- package/dist/collection/components/forms/au-field/au-field.js +1 -1
- package/dist/collection/components/forms/au-input/au-input.js +6 -6
- package/dist/collection/components/forms/au-number-input/au-number-input.js +4 -4
- package/dist/collection/components/forms/au-radio/au-radio.js +1 -1
- package/dist/collection/components/forms/au-radio-group/au-radio-group.js +3 -3
- package/dist/collection/components/forms/au-segmented-control/au-segmented-control.js +3 -3
- package/dist/collection/components/forms/au-segmented-option/au-segmented-option.js +1 -1
- package/dist/collection/components/forms/au-select/au-select.js +4 -4
- package/dist/collection/components/forms/au-slider/au-slider.js +3 -3
- package/dist/collection/components/forms/au-switch/au-switch.js +4 -4
- package/dist/collection/components/forms/au-textarea/au-textarea.js +3 -3
- package/dist/collection/components/layout/au-container/au-container.js +1 -1
- package/dist/collection/components/layout/au-divider/au-divider.js +1 -1
- package/dist/collection/components/layout/au-splitter/au-splitter.js +2 -2
- package/dist/collection/components/navigation/au-breadcrumb/au-breadcrumb.js +1 -1
- package/dist/collection/components/navigation/au-breadcrumb-item/au-breadcrumb-item.js +1 -1
- package/dist/collection/components/navigation/au-nav-link/au-nav-link.js +1 -1
- package/dist/collection/components/navigation/au-navbar/au-navbar.js +4 -4
- package/dist/collection/components/navigation/au-sidebar-nav/au-sidebar-nav.js +1 -1
- package/dist/collection/components/navigation/au-tab/au-tab.js +1 -1
- package/dist/collection/components/navigation/au-tab-panel/au-tab-panel.js +1 -1
- package/dist/collection/components/navigation/au-tabs/au-tabs.js +4 -4
- package/dist/collection/components/navigation/au-toc/au-toc.js +1 -1
- package/dist/collection/components/overlays/au-dialog/au-dialog.js +4 -4
- package/dist/collection/components/overlays/au-menu/au-menu.js +1 -1
- package/dist/collection/components/overlays/au-menu-item/au-menu-item.js +1 -1
- package/dist/collection/components/overlays/au-popover/au-popover.js +1 -1
- package/dist/collection/components/overlays/au-tooltip/au-tooltip.js +1 -1
- package/dist/collection/components/primitives/au-icon/core-icons.js +2 -0
- package/dist/components/au-alert.js +1 -1
- package/dist/components/au-avatar.js +1 -1
- package/dist/components/au-breadcrumb-item.js +1 -1
- package/dist/components/au-breadcrumb.js +1 -1
- package/dist/components/au-checkbox.js +1 -1
- package/dist/components/au-chip.js +1 -1
- package/dist/components/au-code-block.js +1 -1
- package/dist/components/au-combobox.js +1 -1
- package/dist/components/au-container.js +1 -1
- package/dist/components/au-dialog.js +1 -1
- package/dist/components/au-divider.js +1 -1
- package/dist/components/au-field.js +1 -1
- package/dist/components/au-icon.js +1 -1
- package/dist/components/au-input.js +1 -1
- package/dist/components/au-kbd.d.ts +11 -0
- package/dist/components/au-kbd.js +1 -0
- package/dist/components/au-list-item.d.ts +11 -0
- package/dist/components/au-list-item.js +1 -0
- package/dist/components/au-list.d.ts +11 -0
- package/dist/components/au-list.js +1 -0
- package/dist/components/au-menu-item.js +1 -1
- package/dist/components/au-menu.js +1 -1
- package/dist/components/au-nav-link.js +1 -1
- package/dist/components/au-navbar.js +1 -1
- package/dist/components/au-number-input.js +1 -1
- package/dist/components/au-popover.js +1 -1
- package/dist/components/au-progress.d.ts +11 -0
- package/dist/components/au-progress.js +1 -0
- package/dist/components/au-radio-group.js +1 -1
- package/dist/components/au-radio.js +1 -1
- package/dist/components/au-segmented-control.js +1 -1
- package/dist/components/au-segmented-option.js +1 -1
- package/dist/components/au-select.js +1 -1
- package/dist/components/au-sidebar-nav.js +1 -1
- package/dist/components/au-skeleton.d.ts +11 -0
- package/dist/components/au-skeleton.js +1 -0
- package/dist/components/au-slider.js +1 -1
- package/dist/components/au-splitter.js +1 -1
- package/dist/components/au-stat.d.ts +11 -0
- package/dist/components/au-stat.js +1 -0
- package/dist/components/au-switch.js +1 -1
- package/dist/components/au-tab-panel.js +1 -1
- package/dist/components/au-tab.js +1 -1
- package/dist/components/au-table.d.ts +11 -0
- package/dist/components/au-table.js +1 -0
- package/dist/components/au-tabs.js +1 -1
- package/dist/components/au-textarea.js +1 -1
- package/dist/components/au-toast-region.js +1 -1
- package/dist/components/au-toast.js +1 -1
- package/dist/components/au-toc.js +1 -1
- package/dist/components/au-tooltip.js +1 -1
- package/dist/components/p-B5BhPkwP.js +1 -0
- package/dist/components/p-DMeUBbqF.js +7 -0
- package/dist/components/p-DjW6oMgu.js +7 -0
- package/dist/components/{p-DzNA1eDU.js → p-DqAwSryz.js} +1 -1
- package/dist/components/{p-DAqsVCAy.js → p-Dw0zb4x_.js} +1 -1
- package/dist/components/{p-DIL-tsh4.js → p-ZpauIcNt.js} +1 -1
- package/dist/custom-elements.json +1338 -66
- package/dist/esm/au-alert.entry.js +1 -1
- package/dist/esm/au-breadcrumb-item.entry.js +1 -1
- package/dist/esm/au-breadcrumb.entry.js +1 -1
- package/dist/esm/au-checkbox.entry.js +4 -4
- package/dist/esm/au-code-block.entry.js +1 -1
- package/dist/esm/au-combobox.entry.js +7 -7
- package/dist/esm/au-container.entry.js +1 -1
- package/dist/esm/au-dialog.entry.js +4 -4
- package/dist/esm/au-divider.entry.js +1 -1
- package/dist/esm/au-field.entry.js +1 -1
- package/dist/esm/{au-icon-B17psn7x.js → au-icon-6iJTkDID.js} +1 -1
- package/dist/esm/au-icon.entry.js +1 -1
- package/dist/esm/au-input.entry.js +6 -6
- package/dist/esm/au-kbd.entry.js +353 -0
- package/dist/esm/au-list-item.entry.js +193 -0
- package/dist/esm/au-list.entry.js +76 -0
- package/dist/esm/au-menu-item.entry.js +1 -1
- package/dist/esm/au-menu.entry.js +1 -1
- package/dist/esm/au-nav-link.entry.js +1 -1
- package/dist/esm/au-navbar.entry.js +4 -4
- package/dist/esm/au-number-input.entry.js +4 -4
- package/dist/esm/au-popover.entry.js +1 -1
- package/dist/esm/au-progress.entry.js +105 -0
- package/dist/esm/au-radio-group.entry.js +3 -3
- package/dist/esm/au-radio.entry.js +1 -1
- package/dist/esm/au-segmented-control.entry.js +3 -3
- package/dist/esm/au-segmented-option.entry.js +1 -1
- package/dist/esm/au-select.entry.js +4 -4
- package/dist/esm/au-sidebar-nav.entry.js +1 -1
- package/dist/esm/au-skeleton.entry.js +104 -0
- package/dist/esm/au-slider.entry.js +3 -3
- package/dist/esm/au-splitter.entry.js +2 -2
- package/dist/esm/au-stat.entry.js +260 -0
- package/dist/esm/au-switch.entry.js +4 -4
- package/dist/esm/au-tab-panel.entry.js +1 -1
- package/dist/esm/au-tab.entry.js +1 -1
- package/dist/esm/au-table.entry.js +335 -0
- package/dist/esm/au-tabs.entry.js +4 -4
- package/dist/esm/au-textarea.entry.js +3 -3
- package/dist/esm/au-toast-region.entry.js +2 -2
- package/dist/esm/au-toast.entry.js +1 -1
- package/dist/esm/au-toc.entry.js +1 -1
- package/dist/esm/au-tooltip.entry.js +1 -1
- package/dist/esm/aurora.js +1 -1
- package/dist/esm/{icon-loader-CqLCmu4h.js → icon-loader-B2WSNZ27.js} +3 -1
- package/dist/esm/{live-announcer-CXd2OhYs.js → live-announcer-IAjNBWYI.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/trending-down-DjW6oMgu.js +17 -0
- package/dist/esm/trending-up-DMeUBbqF.js +17 -0
- package/dist/styles.css +139 -0
- package/dist/types/components/data-display/au-kbd/au-kbd.constants.d.ts +41 -0
- package/dist/types/components/data-display/au-kbd/au-kbd.d.ts +36 -0
- package/dist/types/components/data-display/au-kbd/au-kbd.types.d.ts +1 -0
- package/dist/types/components/data-display/au-kbd/index.d.ts +3 -0
- package/dist/types/components/data-display/au-kbd/internal/describe.d.ts +13 -0
- package/dist/types/components/data-display/au-kbd/internal/parse.d.ts +18 -0
- package/dist/types/components/data-display/au-kbd/internal/platform.d.ts +13 -0
- package/dist/types/components/data-display/au-list/au-list.constants.d.ts +8 -0
- package/dist/types/components/data-display/au-list/au-list.d.ts +29 -0
- package/dist/types/components/data-display/au-list/au-list.types.d.ts +1 -0
- package/dist/types/components/data-display/au-list/index.d.ts +3 -0
- package/dist/types/components/data-display/au-list-item/au-list-item.d.ts +61 -0
- package/dist/types/components/data-display/au-list-item/index.d.ts +1 -0
- package/dist/types/components/data-display/au-list-item/internal/interactive-content.d.ts +2 -0
- package/dist/types/components/data-display/au-stat/au-stat.constants.d.ts +44 -0
- package/dist/types/components/data-display/au-stat/au-stat.d.ts +67 -0
- package/dist/types/components/data-display/au-stat/au-stat.types.d.ts +1 -0
- package/dist/types/components/data-display/au-stat/index.d.ts +3 -0
- package/dist/types/components/data-display/au-stat/internal/announcement.d.ts +16 -0
- package/dist/types/components/data-display/au-table/au-table.constants.d.ts +26 -0
- package/dist/types/components/data-display/au-table/au-table.d.ts +86 -0
- package/dist/types/components/data-display/au-table/au-table.types.d.ts +1 -0
- package/dist/types/components/data-display/au-table/index.d.ts +3 -0
- package/dist/types/components/data-display/au-table/internal/scroller-label.d.ts +9 -0
- package/dist/types/components/data-display/au-table/internal/sort.d.ts +11 -0
- package/dist/types/components/feedback/au-progress/au-progress.constants.d.ts +31 -0
- package/dist/types/components/feedback/au-progress/au-progress.d.ts +32 -0
- package/dist/types/components/feedback/au-progress/au-progress.types.d.ts +1 -0
- package/dist/types/components/feedback/au-progress/index.d.ts +3 -0
- package/dist/types/components/feedback/au-skeleton/au-skeleton.constants.d.ts +27 -0
- package/dist/types/components/feedback/au-skeleton/au-skeleton.d.ts +31 -0
- package/dist/types/components/feedback/au-skeleton/au-skeleton.types.d.ts +1 -0
- package/dist/types/components/feedback/au-skeleton/index.d.ts +3 -0
- package/dist/types/components.d.ts +712 -0
- package/dist/types/vue.d.ts +7 -0
- package/package.json +53 -1
- package/dist/aurora/p-746825ce.entry.js +0 -1
- package/dist/aurora/p-CoyAdNcI.js +0 -1
- package/dist/aurora/p-b2feddb2.entry.js +0 -1
- package/dist/aurora/p-f89bde2b.entry.js +0 -1
- package/dist/components/p-M21eKzKU.js +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { warnOncePerDocument } from "../../../shared/warn-once.js";
|
|
3
|
+
import { KBD_PLATFORM, isKbdPlatform, } from "./au-kbd.constants.js";
|
|
4
|
+
import { describeKbdKey } from "./internal/describe.js";
|
|
5
|
+
import { parseKbdKeys } from "./internal/parse.js";
|
|
6
|
+
import { detectKbdPlatform } from "./internal/platform.js";
|
|
7
|
+
const SPACE = ' ';
|
|
8
|
+
/**
|
|
9
|
+
* A keyboard shortcut hint: one key combination drawn as nested native `kbd` elements. The
|
|
10
|
+
* `Mod` key and the modifier glyphs follow the platform, symbols get a visually hidden name,
|
|
11
|
+
* and the separator is silent. It presents a shortcut; it never listens for it.
|
|
12
|
+
*
|
|
13
|
+
* @slot - The text of one key, used only when `keys` is blank (a label with no meaning to the component, such as `Fn`). Plain text, never interactive.
|
|
14
|
+
*/
|
|
15
|
+
export class AuKbd {
|
|
16
|
+
host;
|
|
17
|
+
/** One key combination written with `+` (`Mod+K`, `Shift+Alt+ArrowUp`, `Ctrl++`). Blank shows the default slot instead. */
|
|
18
|
+
keys = '';
|
|
19
|
+
/** `auto` detects the platform when rendering. `apple` (macOS, iOS, iPadOS) and `other` are deterministic. An unsupported value acts as `auto` and warns once. */
|
|
20
|
+
platform = KBD_PLATFORM.auto;
|
|
21
|
+
/** JavaScript property only: overrides the visually hidden names (never the glyphs) of known keys, by key id. Blank values are ignored. */
|
|
22
|
+
keyNames;
|
|
23
|
+
parsed = { tokens: [], malformed: false };
|
|
24
|
+
componentWillLoad() {
|
|
25
|
+
this.syncEmpty();
|
|
26
|
+
}
|
|
27
|
+
componentWillRender() {
|
|
28
|
+
this.parsed = parseKbdKeys(this.keys);
|
|
29
|
+
this.warnAboutProperties();
|
|
30
|
+
this.syncEmpty();
|
|
31
|
+
}
|
|
32
|
+
warn(key, message) {
|
|
33
|
+
warnOncePerDocument(this.host.ownerDocument, `au-kbd:${key}`, `[au-kbd] ${message}`);
|
|
34
|
+
}
|
|
35
|
+
warnAboutProperties() {
|
|
36
|
+
if (this.parsed.malformed) {
|
|
37
|
+
this.warn('keys', `The keys value ${JSON.stringify(this.keys)} has an empty key (a stray "+"); the empty key is dropped. Write the plus key as "Plus" or as a trailing "++".`);
|
|
38
|
+
}
|
|
39
|
+
if (!isKbdPlatform(this.platform)) {
|
|
40
|
+
this.warn('platform', `Unsupported platform ${JSON.stringify(this.platform)}; it acts as "auto". Use "auto", "apple" or "other".`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** `apple` or `other` as written; anything else is detected from `navigator`, so it is read at render time. */
|
|
44
|
+
resolvePlatform() {
|
|
45
|
+
if (this.platform === KBD_PLATFORM.apple || this.platform === KBD_PLATFORM.other) {
|
|
46
|
+
return this.platform;
|
|
47
|
+
}
|
|
48
|
+
return detectKbdPlatform(typeof navigator === 'undefined' ? undefined : navigator);
|
|
49
|
+
}
|
|
50
|
+
get usesKeys() {
|
|
51
|
+
return typeof this.keys === 'string' && this.keys.trim() !== '';
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The component-owned `empty` attribute (KD-D13): blank `keys` and no content in the host. It is
|
|
55
|
+
* set imperatively, not through `<Host>`, so a consumer-written `empty` is removed as well.
|
|
56
|
+
*/
|
|
57
|
+
syncEmpty() {
|
|
58
|
+
const hasContent = Array.from(this.host.childNodes).some((node) => node.nodeType === 1 || (node.nodeType === 3 && (node.textContent ?? '').trim() !== ''));
|
|
59
|
+
if (!this.usesKeys && !hasContent)
|
|
60
|
+
this.host.setAttribute('empty', '');
|
|
61
|
+
else
|
|
62
|
+
this.host.removeAttribute('empty');
|
|
63
|
+
}
|
|
64
|
+
handleSlotChange = () => {
|
|
65
|
+
this.syncEmpty();
|
|
66
|
+
};
|
|
67
|
+
get names() {
|
|
68
|
+
return typeof this.keyNames === 'object' && this.keyNames !== null ? this.keyNames : undefined;
|
|
69
|
+
}
|
|
70
|
+
renderKey(token, platform) {
|
|
71
|
+
const { glyph, name } = describeKbdKey(token, platform, this.names);
|
|
72
|
+
if (glyph === name) {
|
|
73
|
+
return (h("kbd", { part: "key", class: "kbd__key" }, glyph));
|
|
74
|
+
}
|
|
75
|
+
// No whitespace between the two spans: the hidden name follows the glyph without a gap.
|
|
76
|
+
return (h("kbd", { part: "key", class: "kbd__key" }, h("span", { part: "glyph", "aria-hidden": "true" }, glyph), h("span", { class: "kbd__name" }, name)));
|
|
77
|
+
}
|
|
78
|
+
/** Keys, with one literal space between a key and what follows (KD-D6), and a silent `+` outside Apple (KD-D7). */
|
|
79
|
+
renderKeys(platform) {
|
|
80
|
+
const children = [];
|
|
81
|
+
this.parsed.tokens.forEach((token, index) => {
|
|
82
|
+
if (index > 0) {
|
|
83
|
+
if (platform === KBD_PLATFORM.apple) {
|
|
84
|
+
children.push(SPACE);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
children.push(SPACE, h("span", { part: "separator", class: "kbd__separator", "aria-hidden": "true" }, "+"), SPACE);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
children.push(this.renderKey(token, platform));
|
|
91
|
+
});
|
|
92
|
+
return children;
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
if (!this.usesKeys) {
|
|
96
|
+
return (h(Host, null, h("kbd", { part: "base", class: "kbd" }, h("kbd", { part: "key", class: "kbd__key" }, h("slot", { onSlotchange: this.handleSlotChange })))));
|
|
97
|
+
}
|
|
98
|
+
const platform = this.resolvePlatform();
|
|
99
|
+
return (h(Host, null, h("kbd", { part: "base", class: `kbd kbd--${platform}` }, this.renderKeys(platform))));
|
|
100
|
+
}
|
|
101
|
+
static get is() { return "au-kbd"; }
|
|
102
|
+
static get encapsulation() { return "shadow"; }
|
|
103
|
+
static get originalStyleUrls() {
|
|
104
|
+
return {
|
|
105
|
+
"$": ["au-kbd.scss"]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
static get styleUrls() {
|
|
109
|
+
return {
|
|
110
|
+
"$": ["au-kbd.css"]
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
static get properties() {
|
|
114
|
+
return {
|
|
115
|
+
"keys": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"mutable": false,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "string",
|
|
120
|
+
"resolved": "string",
|
|
121
|
+
"references": {}
|
|
122
|
+
},
|
|
123
|
+
"required": false,
|
|
124
|
+
"optional": false,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": "One key combination written with `+` (`Mod+K`, `Shift+Alt+ArrowUp`, `Ctrl++`). Blank shows the default slot instead."
|
|
128
|
+
},
|
|
129
|
+
"getter": false,
|
|
130
|
+
"setter": false,
|
|
131
|
+
"reflect": true,
|
|
132
|
+
"attribute": "keys",
|
|
133
|
+
"defaultValue": "''"
|
|
134
|
+
},
|
|
135
|
+
"platform": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"complexType": {
|
|
139
|
+
"original": "KbdPlatform",
|
|
140
|
+
"resolved": "\"apple\" | \"auto\" | \"other\"",
|
|
141
|
+
"references": {
|
|
142
|
+
"KbdPlatform": {
|
|
143
|
+
"location": "import",
|
|
144
|
+
"path": "./au-kbd.constants",
|
|
145
|
+
"id": "src/components/data-display/au-kbd/au-kbd.constants.ts::KbdPlatform",
|
|
146
|
+
"referenceLocation": "KbdPlatform"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"required": false,
|
|
151
|
+
"optional": false,
|
|
152
|
+
"docs": {
|
|
153
|
+
"tags": [],
|
|
154
|
+
"text": "`auto` detects the platform when rendering. `apple` (macOS, iOS, iPadOS) and `other` are deterministic. An unsupported value acts as `auto` and warns once."
|
|
155
|
+
},
|
|
156
|
+
"getter": false,
|
|
157
|
+
"setter": false,
|
|
158
|
+
"reflect": true,
|
|
159
|
+
"attribute": "platform",
|
|
160
|
+
"defaultValue": "'auto'"
|
|
161
|
+
},
|
|
162
|
+
"keyNames": {
|
|
163
|
+
"type": "unknown",
|
|
164
|
+
"mutable": false,
|
|
165
|
+
"complexType": {
|
|
166
|
+
"original": "KbdKeyNames",
|
|
167
|
+
"resolved": "\"alt\" | \"backspace\" | \"capslock\" | \"ctrl\" | \"delete\" | \"down\" | \"end\" | \"enter\" | \"escape\" | \"home\" | \"left\" | \"meta\" | \"mod\" | \"pagedown\" | \"pageup\" | \"plus\" | \"right\" | \"shift\" | \"space\" | \"tab\" | \"up\" | string | undefined",
|
|
168
|
+
"references": {
|
|
169
|
+
"KbdKeyNames": {
|
|
170
|
+
"location": "import",
|
|
171
|
+
"path": "./au-kbd.constants",
|
|
172
|
+
"id": "src/components/data-display/au-kbd/au-kbd.constants.ts::KbdKeyNames",
|
|
173
|
+
"referenceLocation": "KbdKeyNames"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": true,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "JavaScript property only: overrides the visually hidden names (never the glyphs) of known keys, by key id. Blank values are ignored."
|
|
182
|
+
},
|
|
183
|
+
"getter": false,
|
|
184
|
+
"setter": false
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
static get elementRef() { return "host"; }
|
|
189
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { KBD_DEFAULT_NAMES, KBD_KEY, } from "../au-kbd.constants.js";
|
|
2
|
+
import { normalizeKbdText } from "./parse.js";
|
|
3
|
+
const K = KBD_KEY;
|
|
4
|
+
/** The drawn glyph of each known key, per platform (spec section 3.3). */
|
|
5
|
+
const GLYPHS = {
|
|
6
|
+
apple: {
|
|
7
|
+
[K.mod]: '⌘',
|
|
8
|
+
[K.meta]: '⌘',
|
|
9
|
+
[K.ctrl]: '⌃',
|
|
10
|
+
[K.alt]: '⌥',
|
|
11
|
+
[K.shift]: '⇧',
|
|
12
|
+
[K.enter]: '↩',
|
|
13
|
+
[K.escape]: 'Esc',
|
|
14
|
+
[K.tab]: '⇥',
|
|
15
|
+
[K.backspace]: '⌫',
|
|
16
|
+
[K.delete]: '⌦',
|
|
17
|
+
[K.space]: 'Space',
|
|
18
|
+
[K.up]: '↑',
|
|
19
|
+
[K.down]: '↓',
|
|
20
|
+
[K.left]: '←',
|
|
21
|
+
[K.right]: '→',
|
|
22
|
+
[K.home]: 'Home',
|
|
23
|
+
[K.end]: 'End',
|
|
24
|
+
[K.pageup]: 'PgUp',
|
|
25
|
+
[K.pagedown]: 'PgDn',
|
|
26
|
+
[K.capslock]: '⇪',
|
|
27
|
+
[K.plus]: '+',
|
|
28
|
+
},
|
|
29
|
+
other: {
|
|
30
|
+
[K.mod]: 'Ctrl',
|
|
31
|
+
[K.meta]: 'Meta',
|
|
32
|
+
[K.ctrl]: 'Ctrl',
|
|
33
|
+
[K.alt]: 'Alt',
|
|
34
|
+
[K.shift]: 'Shift',
|
|
35
|
+
[K.enter]: 'Enter',
|
|
36
|
+
[K.escape]: 'Esc',
|
|
37
|
+
[K.tab]: 'Tab',
|
|
38
|
+
[K.backspace]: 'Backspace',
|
|
39
|
+
[K.delete]: 'Del',
|
|
40
|
+
[K.space]: 'Space',
|
|
41
|
+
[K.up]: '↑',
|
|
42
|
+
[K.down]: '↓',
|
|
43
|
+
[K.left]: '←',
|
|
44
|
+
[K.right]: '→',
|
|
45
|
+
[K.home]: 'Home',
|
|
46
|
+
[K.end]: 'End',
|
|
47
|
+
[K.pageup]: 'PgUp',
|
|
48
|
+
[K.pagedown]: 'PgDn',
|
|
49
|
+
[K.capslock]: 'Caps Lock',
|
|
50
|
+
[K.plus]: '+',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The glyph and the name of one key (KD-D4). Pure. `names` overrides the default **names** of
|
|
55
|
+
* known keys; a blank override is ignored. Any other token reads as it is drawn.
|
|
56
|
+
*/
|
|
57
|
+
export function describeKbdKey(token, platform, names) {
|
|
58
|
+
if (token.id !== null) {
|
|
59
|
+
const override = names?.[token.id];
|
|
60
|
+
const name = typeof override === 'string' && override.trim() !== ''
|
|
61
|
+
? override.trim()
|
|
62
|
+
: KBD_DEFAULT_NAMES[platform][token.id];
|
|
63
|
+
return { glyph: GLYPHS[platform][token.id], name };
|
|
64
|
+
}
|
|
65
|
+
const glyph = normalizeKbdText(token.text);
|
|
66
|
+
return { glyph, name: glyph };
|
|
67
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { KBD_KEY } from "../au-kbd.constants.js";
|
|
2
|
+
/** Case-insensitive aliases (KD-D4, spec section 3.3). */
|
|
3
|
+
const ALIASES = {
|
|
4
|
+
mod: KBD_KEY.mod,
|
|
5
|
+
meta: KBD_KEY.meta,
|
|
6
|
+
cmd: KBD_KEY.meta,
|
|
7
|
+
command: KBD_KEY.meta,
|
|
8
|
+
super: KBD_KEY.meta,
|
|
9
|
+
win: KBD_KEY.meta,
|
|
10
|
+
ctrl: KBD_KEY.ctrl,
|
|
11
|
+
control: KBD_KEY.ctrl,
|
|
12
|
+
alt: KBD_KEY.alt,
|
|
13
|
+
option: KBD_KEY.alt,
|
|
14
|
+
opt: KBD_KEY.alt,
|
|
15
|
+
shift: KBD_KEY.shift,
|
|
16
|
+
enter: KBD_KEY.enter,
|
|
17
|
+
return: KBD_KEY.enter,
|
|
18
|
+
escape: KBD_KEY.escape,
|
|
19
|
+
esc: KBD_KEY.escape,
|
|
20
|
+
tab: KBD_KEY.tab,
|
|
21
|
+
backspace: KBD_KEY.backspace,
|
|
22
|
+
delete: KBD_KEY.delete,
|
|
23
|
+
del: KBD_KEY.delete,
|
|
24
|
+
space: KBD_KEY.space,
|
|
25
|
+
arrowup: KBD_KEY.up,
|
|
26
|
+
up: KBD_KEY.up,
|
|
27
|
+
arrowdown: KBD_KEY.down,
|
|
28
|
+
down: KBD_KEY.down,
|
|
29
|
+
arrowleft: KBD_KEY.left,
|
|
30
|
+
left: KBD_KEY.left,
|
|
31
|
+
arrowright: KBD_KEY.right,
|
|
32
|
+
right: KBD_KEY.right,
|
|
33
|
+
home: KBD_KEY.home,
|
|
34
|
+
end: KBD_KEY.end,
|
|
35
|
+
pageup: KBD_KEY.pageup,
|
|
36
|
+
pgup: KBD_KEY.pageup,
|
|
37
|
+
pagedown: KBD_KEY.pagedown,
|
|
38
|
+
pgdn: KBD_KEY.pagedown,
|
|
39
|
+
capslock: KBD_KEY.capslock,
|
|
40
|
+
plus: KBD_KEY.plus,
|
|
41
|
+
};
|
|
42
|
+
const FUNCTION_KEY = /^f([1-9]|1\d|2[0-4])$/i;
|
|
43
|
+
const PLUS = { id: KBD_KEY.plus, text: KBD_KEY.plus };
|
|
44
|
+
/** A single character and an F-key are upper-cased; any other text is kept as written. */
|
|
45
|
+
export function normalizeKbdText(raw) {
|
|
46
|
+
return Array.from(raw).length === 1 || FUNCTION_KEY.test(raw) ? raw.toUpperCase() : raw;
|
|
47
|
+
}
|
|
48
|
+
function toToken(raw) {
|
|
49
|
+
const id = Object.hasOwn(ALIASES, raw.toLowerCase()) ? ALIASES[raw.toLowerCase()] : undefined;
|
|
50
|
+
if (id !== undefined)
|
|
51
|
+
return { id, text: id };
|
|
52
|
+
return { id: null, text: normalizeKbdText(raw) };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parse one key combination (KD-D2). Pure. `+` separates keys; a lone `+` and a trailing `++`
|
|
56
|
+
* are the plus key. Empty tokens are dropped and flag the input as malformed. Order is kept.
|
|
57
|
+
*/
|
|
58
|
+
export function parseKbdKeys(input) {
|
|
59
|
+
if (typeof input !== 'string')
|
|
60
|
+
return { tokens: [], malformed: false };
|
|
61
|
+
const value = input.trim();
|
|
62
|
+
if (value === '')
|
|
63
|
+
return { tokens: [], malformed: false };
|
|
64
|
+
if (value === '+')
|
|
65
|
+
return { tokens: [{ ...PLUS }], malformed: false };
|
|
66
|
+
const trailingPlus = value.endsWith('++');
|
|
67
|
+
const rest = trailingPlus ? value.slice(0, -2) : value;
|
|
68
|
+
let malformed = false;
|
|
69
|
+
const tokens = [];
|
|
70
|
+
if (rest !== '' || !trailingPlus) {
|
|
71
|
+
for (const part of rest.split('+')) {
|
|
72
|
+
const raw = part.trim();
|
|
73
|
+
if (raw === '')
|
|
74
|
+
malformed = true;
|
|
75
|
+
else
|
|
76
|
+
tokens.push(toToken(raw));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
malformed = true;
|
|
81
|
+
}
|
|
82
|
+
if (trailingPlus)
|
|
83
|
+
tokens.push({ ...PLUS });
|
|
84
|
+
return { tokens, malformed };
|
|
85
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { KBD_PLATFORM } from "../au-kbd.constants.js";
|
|
2
|
+
const APPLE_UA_DATA = /^(macos|ios)$/i;
|
|
3
|
+
const APPLE_PLATFORM = /^(Mac|iPhone|iPad|iPod)/i;
|
|
4
|
+
/**
|
|
5
|
+
* Resolve `auto` (KD-D3). Pure. A non-blank `userAgentData.platform` decides alone; otherwise
|
|
6
|
+
* `navigator.platform` (iPadOS reports `MacIntel`). With no navigator (SSR, a Node test) it is `other`.
|
|
7
|
+
*/
|
|
8
|
+
export function detectKbdPlatform(navigatorLike) {
|
|
9
|
+
if (!navigatorLike)
|
|
10
|
+
return KBD_PLATFORM.other;
|
|
11
|
+
const hinted = navigatorLike.userAgentData?.platform;
|
|
12
|
+
if (typeof hinted === 'string' && hinted.trim() !== '') {
|
|
13
|
+
return APPLE_UA_DATA.test(hinted.trim()) ? KBD_PLATFORM.apple : KBD_PLATFORM.other;
|
|
14
|
+
}
|
|
15
|
+
const legacy = navigatorLike.platform;
|
|
16
|
+
return typeof legacy === 'string' && APPLE_PLATFORM.test(legacy.trim())
|
|
17
|
+
? KBD_PLATFORM.apple
|
|
18
|
+
: KBD_PLATFORM.other;
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Literals only: no import from the foundations, so the `/constants` subpath stays standalone. */
|
|
2
|
+
/** Row density. `small` is the compact density, `medium` the default. */
|
|
3
|
+
export const LIST_SIZE = {
|
|
4
|
+
small: 'small',
|
|
5
|
+
medium: 'medium',
|
|
6
|
+
};
|
|
7
|
+
const sizes = new Set(Object.values(LIST_SIZE));
|
|
8
|
+
export const isListSize = (value) => typeof value === 'string' && sizes.has(value);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--_aurora-list-item-padding-block: var(
|
|
3
|
+
--aurora-list-item-padding-block-medium,
|
|
4
|
+
var(--aurora-spacing-small, 0.5rem)
|
|
5
|
+
);
|
|
6
|
+
--_aurora-list-item-font-size: var(
|
|
7
|
+
--aurora-list-item-font-size-medium,
|
|
8
|
+
var(--aurora-font-size-md, 1rem)
|
|
9
|
+
);
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host([size=small]) {
|
|
14
|
+
--_aurora-list-item-padding-block: var(
|
|
15
|
+
--aurora-list-item-padding-block-small,
|
|
16
|
+
var(--aurora-spacing-extra-small, 0.25rem)
|
|
17
|
+
);
|
|
18
|
+
--_aurora-list-item-font-size: var(
|
|
19
|
+
--aurora-list-item-font-size-small,
|
|
20
|
+
var(--aurora-font-size-sm, 0.875rem)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([dividers]) {
|
|
25
|
+
--_aurora-list-divider-width: 1px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.list {
|
|
29
|
+
display: block;
|
|
30
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { warnOncePerDocument } from "../../../shared/warn-once.js";
|
|
3
|
+
import { LIST_SIZE, isListSize } from "./au-list.constants.js";
|
|
4
|
+
const ITEM_TAG = 'au-list-item';
|
|
5
|
+
/** Elements that render nothing and so never count as a foreign child. */
|
|
6
|
+
const IGNORED_TAGS = new Set(['template', 'script', 'style']);
|
|
7
|
+
/**
|
|
8
|
+
* A list of rows. The host is the `list` (component-owned role), and its items are
|
|
9
|
+
* `au-list-item` children. The consumer names the list on the host (`aria-label` or
|
|
10
|
+
* `aria-labelledby`); the component writes no name. `size` and `dividers` reach the items through
|
|
11
|
+
* private inherited custom properties, so the parent writes nothing on its children.
|
|
12
|
+
*
|
|
13
|
+
* @slot - `au-list-item` elements only.
|
|
14
|
+
*/
|
|
15
|
+
export class AuList {
|
|
16
|
+
host;
|
|
17
|
+
/** Row density: `small` or `medium`. Unsupported values render `medium` and warn once. */
|
|
18
|
+
size = LIST_SIZE.medium;
|
|
19
|
+
/** Draws a divider between rows (a border above every item but the first). */
|
|
20
|
+
dividers = false;
|
|
21
|
+
slotElement;
|
|
22
|
+
sizeChanged() {
|
|
23
|
+
this.normalizeSize();
|
|
24
|
+
}
|
|
25
|
+
componentWillLoad() {
|
|
26
|
+
this.normalizeSize();
|
|
27
|
+
}
|
|
28
|
+
componentDidLoad() {
|
|
29
|
+
this.warnAboutChildren();
|
|
30
|
+
}
|
|
31
|
+
componentDidRender() {
|
|
32
|
+
this.enforceRole();
|
|
33
|
+
}
|
|
34
|
+
/** The component is the one writer of `role`: a consumer value (`log`, `menu`) is put back. */
|
|
35
|
+
enforceRole() {
|
|
36
|
+
if (this.host.getAttribute('role') !== 'list')
|
|
37
|
+
this.host.setAttribute('role', 'list');
|
|
38
|
+
}
|
|
39
|
+
/** An unsupported size renders `medium` (also on the reflected attribute) and warns once. */
|
|
40
|
+
normalizeSize() {
|
|
41
|
+
if (isListSize(this.size))
|
|
42
|
+
return;
|
|
43
|
+
warnOncePerDocument(this.host.ownerDocument, 'au-list:size', `au-list: size=${JSON.stringify(this.size)} is not supported and renders "medium". Use "small" or "medium".`);
|
|
44
|
+
this.size = LIST_SIZE.medium;
|
|
45
|
+
}
|
|
46
|
+
handleSlotChange = () => {
|
|
47
|
+
this.warnAboutChildren();
|
|
48
|
+
};
|
|
49
|
+
/** Discovery is only used to warn: the list writes nothing on its items. */
|
|
50
|
+
warnAboutChildren() {
|
|
51
|
+
const nodes = this.slotElement?.assignedElements({ flatten: true }) ?? [];
|
|
52
|
+
const foreign = nodes.find((element) => element.localName !== ITEM_TAG && !IGNORED_TAGS.has(element.localName));
|
|
53
|
+
if (!foreign)
|
|
54
|
+
return;
|
|
55
|
+
warnOncePerDocument(this.host.ownerDocument, 'au-list:foreign-child', `au-list: <${foreign.localName}> is not an ${ITEM_TAG}. It would be a child of the list that is not a listitem. Only ${ITEM_TAG} belongs in the default slot.`);
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
return (h(Host, { key: '6931b6bf4cb4dc1ac4972fd9faf6f07df4e20098', role: "list" }, h("div", { key: '3459c848d615a5936c3e5167b43a9473803dc4ff', part: "base", class: "list" }, h("slot", { key: '41fe35d5b1fca2b3731140b474199950f0a177f4', onSlotchange: this.handleSlotChange, ref: (element) => {
|
|
59
|
+
this.slotElement = element;
|
|
60
|
+
} }))));
|
|
61
|
+
}
|
|
62
|
+
static get is() { return "au-list"; }
|
|
63
|
+
static get encapsulation() { return "shadow"; }
|
|
64
|
+
static get originalStyleUrls() {
|
|
65
|
+
return {
|
|
66
|
+
"$": ["au-list.scss"]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static get styleUrls() {
|
|
70
|
+
return {
|
|
71
|
+
"$": ["au-list.css"]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
static get properties() {
|
|
75
|
+
return {
|
|
76
|
+
"size": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"mutable": true,
|
|
79
|
+
"complexType": {
|
|
80
|
+
"original": "ListSize",
|
|
81
|
+
"resolved": "\"medium\" | \"small\"",
|
|
82
|
+
"references": {
|
|
83
|
+
"ListSize": {
|
|
84
|
+
"location": "import",
|
|
85
|
+
"path": "./au-list.types",
|
|
86
|
+
"id": "src/components/data-display/au-list/au-list.types.ts::ListSize",
|
|
87
|
+
"referenceLocation": "ListSize"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"required": false,
|
|
92
|
+
"optional": false,
|
|
93
|
+
"docs": {
|
|
94
|
+
"tags": [],
|
|
95
|
+
"text": "Row density: `small` or `medium`. Unsupported values render `medium` and warn once."
|
|
96
|
+
},
|
|
97
|
+
"getter": false,
|
|
98
|
+
"setter": false,
|
|
99
|
+
"reflect": true,
|
|
100
|
+
"attribute": "size",
|
|
101
|
+
"defaultValue": "'medium'"
|
|
102
|
+
},
|
|
103
|
+
"dividers": {
|
|
104
|
+
"type": "boolean",
|
|
105
|
+
"mutable": false,
|
|
106
|
+
"complexType": {
|
|
107
|
+
"original": "boolean",
|
|
108
|
+
"resolved": "boolean",
|
|
109
|
+
"references": {}
|
|
110
|
+
},
|
|
111
|
+
"required": false,
|
|
112
|
+
"optional": false,
|
|
113
|
+
"docs": {
|
|
114
|
+
"tags": [],
|
|
115
|
+
"text": "Draws a divider between rows (a border above every item but the first)."
|
|
116
|
+
},
|
|
117
|
+
"getter": false,
|
|
118
|
+
"setter": false,
|
|
119
|
+
"reflect": true,
|
|
120
|
+
"attribute": "dividers",
|
|
121
|
+
"defaultValue": "false"
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
static get elementRef() { return "host"; }
|
|
126
|
+
static get watchers() {
|
|
127
|
+
return [{
|
|
128
|
+
"propName": "size",
|
|
129
|
+
"methodName": "sizeChanged"
|
|
130
|
+
}];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|