@hashicorp/design-system-components 3.5.0 → 4.0.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 +2 -0
- package/addon-main.js +7 -0
- package/dist/LICENSE.md +375 -0
- package/dist/README.md +69 -0
- package/dist/_app_/components/hds/accordion/index.js +1 -0
- package/dist/_app_/components/hds/accordion/item/button.js +1 -0
- package/dist/_app_/components/hds/accordion/item/index.js +1 -0
- package/dist/_app_/components/hds/alert/description.js +1 -0
- package/dist/_app_/components/hds/alert/index.js +1 -0
- package/dist/_app_/components/hds/alert/title.js +1 -0
- package/dist/_app_/components/hds/app-footer/copyright.js +1 -0
- package/dist/_app_/components/hds/app-footer/index.js +1 -0
- package/dist/_app_/components/hds/app-footer/item.js +1 -0
- package/dist/_app_/components/hds/app-footer/legal-links.js +1 -0
- package/dist/_app_/components/hds/app-footer/link.js +1 -0
- package/dist/_app_/components/hds/app-footer/status-link.js +1 -0
- package/dist/_app_/components/hds/app-frame/index.js +1 -0
- package/dist/_app_/components/hds/app-frame/parts/footer.js +1 -0
- package/dist/_app_/components/hds/app-frame/parts/header.js +1 -0
- package/dist/_app_/components/hds/app-frame/parts/main.js +1 -0
- package/dist/_app_/components/hds/app-frame/parts/modals.js +1 -0
- package/dist/_app_/components/hds/app-frame/parts/sidebar.js +1 -0
- package/dist/_app_/components/hds/application-state/body.js +1 -0
- package/dist/_app_/components/hds/application-state/footer.js +1 -0
- package/dist/_app_/components/hds/application-state/header.js +1 -0
- package/dist/_app_/components/hds/application-state/index.js +1 -0
- package/dist/_app_/components/hds/badge/index.js +1 -0
- package/dist/_app_/components/hds/badge-count/index.js +1 -0
- package/dist/_app_/components/hds/breadcrumb/index.js +1 -0
- package/dist/_app_/components/hds/breadcrumb/item.js +1 -0
- package/dist/_app_/components/hds/breadcrumb/truncation.js +1 -0
- package/dist/_app_/components/hds/button/index.js +1 -0
- package/dist/_app_/components/hds/button-set/index.js +1 -0
- package/dist/_app_/components/hds/card/container.js +1 -0
- package/dist/_app_/components/hds/code-block/copy-button.js +1 -0
- package/dist/_app_/components/hds/code-block/description.js +1 -0
- package/dist/_app_/components/hds/code-block/index.js +1 -0
- package/dist/_app_/components/hds/code-block/title.js +1 -0
- package/dist/_app_/components/hds/copy/button/index.js +1 -0
- package/dist/_app_/components/hds/copy/snippet/index.js +1 -0
- package/dist/_app_/components/hds/disclosure-primitive/index.js +1 -0
- package/dist/_app_/components/hds/dismiss-button/index.js +1 -0
- package/dist/_app_/components/hds/dropdown/footer.js +1 -0
- package/dist/_app_/components/hds/dropdown/header.js +1 -0
- package/dist/_app_/components/hds/dropdown/index.js +1 -0
- package/dist/_app_/components/hds/dropdown/list-item/checkbox.js +1 -0
- package/dist/_app_/components/hds/dropdown/list-item/checkmark.js +1 -0
- package/dist/_app_/components/hds/dropdown/list-item/copy-item.js +1 -0
- package/dist/_app_/components/hds/dropdown/list-item/description.js +1 -0
- package/dist/_app_/components/hds/dropdown/list-item/generic.js +1 -0
- package/dist/_app_/components/hds/dropdown/list-item/interactive.js +1 -0
- package/dist/_app_/components/hds/dropdown/list-item/radio.js +1 -0
- package/dist/_app_/components/hds/dropdown/list-item/separator.js +1 -0
- package/dist/_app_/components/hds/dropdown/list-item/title.js +1 -0
- package/dist/_app_/components/hds/dropdown/toggle/button.js +1 -0
- package/dist/_app_/components/hds/dropdown/toggle/chevron.js +1 -0
- package/dist/_app_/components/hds/dropdown/toggle/icon.js +1 -0
- package/dist/_app_/components/hds/flyout/body.js +1 -0
- package/dist/_app_/components/hds/flyout/description.js +1 -0
- package/dist/_app_/components/hds/flyout/footer.js +1 -0
- package/dist/_app_/components/hds/flyout/header.js +1 -0
- package/dist/_app_/components/hds/flyout/index.js +1 -0
- package/dist/_app_/components/hds/form/character-count/index.js +1 -0
- package/dist/_app_/components/hds/form/checkbox/base.js +1 -0
- package/dist/_app_/components/hds/form/checkbox/field.js +1 -0
- package/dist/_app_/components/hds/form/checkbox/group.js +1 -0
- package/dist/_app_/components/hds/form/error/index.js +1 -0
- package/dist/_app_/components/hds/form/error/message.js +1 -0
- package/dist/_app_/components/hds/form/field/index.js +1 -0
- package/dist/_app_/components/hds/form/fieldset/index.js +1 -0
- package/dist/_app_/components/hds/form/file-input/base.js +1 -0
- package/dist/_app_/components/hds/form/file-input/field.js +1 -0
- package/dist/_app_/components/hds/form/helper-text/index.js +1 -0
- package/dist/_app_/components/hds/form/indicator/index.js +1 -0
- package/dist/_app_/components/hds/form/label/index.js +1 -0
- package/dist/_app_/components/hds/form/legend/index.js +1 -0
- package/dist/_app_/components/hds/form/masked-input/base.js +1 -0
- package/dist/_app_/components/hds/form/masked-input/field.js +1 -0
- package/dist/_app_/components/hds/form/radio/base.js +1 -0
- package/dist/_app_/components/hds/form/radio/field.js +1 -0
- package/dist/_app_/components/hds/form/radio/group.js +1 -0
- package/dist/_app_/components/hds/form/radio-card/description.js +1 -0
- package/dist/_app_/components/hds/form/radio-card/group.js +1 -0
- package/dist/_app_/components/hds/form/radio-card/index.js +1 -0
- package/dist/_app_/components/hds/form/radio-card/label.js +1 -0
- package/dist/_app_/components/hds/form/select/base.js +1 -0
- package/dist/_app_/components/hds/form/select/field.js +1 -0
- package/dist/_app_/components/hds/form/text-input/base.js +1 -0
- package/dist/_app_/components/hds/form/text-input/field.js +1 -0
- package/dist/_app_/components/hds/form/textarea/base.js +1 -0
- package/dist/_app_/components/hds/form/textarea/field.js +1 -0
- package/dist/_app_/components/hds/form/toggle/base.js +1 -0
- package/dist/_app_/components/hds/form/toggle/field.js +1 -0
- package/dist/_app_/components/hds/form/toggle/group.js +1 -0
- package/dist/_app_/components/hds/form/visibility-toggle/index.js +1 -0
- package/dist/_app_/components/hds/icon-tile/index.js +1 -0
- package/dist/_app_/components/hds/interactive/index.js +1 -0
- package/dist/_app_/components/hds/link/inline.js +1 -0
- package/dist/_app_/components/hds/link/standalone.js +1 -0
- package/dist/_app_/components/hds/menu-primitive/index.js +1 -0
- package/dist/_app_/components/hds/modal/body.js +1 -0
- package/dist/_app_/components/hds/modal/footer.js +1 -0
- package/dist/_app_/components/hds/modal/header.js +1 -0
- package/dist/_app_/components/hds/modal/index.js +1 -0
- package/dist/_app_/components/hds/page-header/actions.js +1 -0
- package/dist/_app_/components/hds/page-header/badges.js +1 -0
- package/dist/_app_/components/hds/page-header/description.js +1 -0
- package/dist/_app_/components/hds/page-header/index.js +1 -0
- package/dist/_app_/components/hds/page-header/subtitle.js +1 -0
- package/dist/_app_/components/hds/page-header/title.js +1 -0
- package/dist/_app_/components/hds/pagination/compact/index.js +1 -0
- package/dist/_app_/components/hds/pagination/info/index.js +1 -0
- package/dist/_app_/components/hds/pagination/nav/arrow.js +1 -0
- package/dist/_app_/components/hds/pagination/nav/ellipsis.js +1 -0
- package/dist/_app_/components/hds/pagination/nav/number.js +1 -0
- package/dist/_app_/components/hds/pagination/numbered/index.js +1 -0
- package/dist/_app_/components/hds/pagination/size-selector/index.js +1 -0
- package/dist/_app_/components/hds/reveal/index.js +1 -0
- package/dist/_app_/components/hds/reveal/toggle/button.js +1 -0
- package/dist/_app_/components/hds/segmented-group/index.js +1 -0
- package/dist/_app_/components/hds/separator/index.js +1 -0
- package/dist/_app_/components/hds/side-nav/base.js +1 -0
- package/dist/_app_/components/hds/side-nav/header/home-link.js +1 -0
- package/dist/_app_/components/hds/side-nav/header/icon-button.js +1 -0
- package/dist/_app_/components/hds/side-nav/header/index.js +1 -0
- package/dist/_app_/components/hds/side-nav/index.js +1 -0
- package/dist/_app_/components/hds/side-nav/list/back-link.js +1 -0
- package/dist/_app_/components/hds/side-nav/list/index.js +1 -0
- package/dist/_app_/components/hds/side-nav/list/item.js +1 -0
- package/dist/_app_/components/hds/side-nav/list/link.js +1 -0
- package/dist/_app_/components/hds/side-nav/list/title.js +1 -0
- package/dist/_app_/components/hds/side-nav/portal/index.js +1 -0
- package/dist/_app_/components/hds/side-nav/portal/target.js +1 -0
- package/dist/_app_/components/hds/side-nav/toggle-button.js +1 -0
- package/dist/_app_/components/hds/stepper/step/indicator.js +1 -0
- package/dist/_app_/components/hds/stepper/task/indicator.js +1 -0
- package/dist/_app_/components/hds/table/index.js +1 -0
- package/dist/_app_/components/hds/table/td.js +1 -0
- package/dist/_app_/components/hds/table/th-button-sort.js +1 -0
- package/dist/_app_/components/hds/table/th-button-tooltip.js +1 -0
- package/dist/_app_/components/hds/table/th-selectable.js +1 -0
- package/dist/_app_/components/hds/table/th-sort.js +1 -0
- package/dist/_app_/components/hds/table/th.js +1 -0
- package/dist/_app_/components/hds/table/tr.js +1 -0
- package/dist/_app_/components/hds/tabs/index.js +1 -0
- package/dist/_app_/components/hds/tabs/panel.js +1 -0
- package/dist/_app_/components/hds/tabs/tab.js +1 -0
- package/dist/_app_/components/hds/tag/index.js +1 -0
- package/dist/_app_/components/hds/text/body.js +1 -0
- package/dist/_app_/components/hds/text/code.js +1 -0
- package/dist/_app_/components/hds/text/display.js +1 -0
- package/dist/_app_/components/hds/text/index.js +1 -0
- package/dist/_app_/components/hds/toast/index.js +1 -0
- package/dist/_app_/components/hds/tooltip-button/index.js +1 -0
- package/dist/_app_/components/hds/yield/index.js +1 -0
- package/dist/_app_/helpers/hds-link-to-models.js +1 -0
- package/dist/_app_/helpers/hds-link-to-query.js +1 -0
- package/dist/_app_/modifiers/hds-clipboard.js +1 -0
- package/dist/_app_/modifiers/hds-tooltip.js +1 -0
- package/dist/_rollupPluginBabelHelpers-lqPQKyNs.js +78 -0
- package/dist/_rollupPluginBabelHelpers-lqPQKyNs.js.map +1 -0
- package/dist/components/hds/accordion/index.js +10 -0
- package/dist/components/hds/accordion/index.js.map +1 -0
- package/dist/components/hds/accordion/item/button.js +36 -0
- package/dist/components/hds/accordion/item/button.js.map +1 -0
- package/dist/components/hds/accordion/item/index.js +62 -0
- package/dist/components/hds/accordion/item/index.js.map +1 -0
- package/dist/components/hds/alert/description.js +10 -0
- package/dist/components/hds/alert/description.js.map +1 -0
- package/dist/components/hds/alert/index.js +153 -0
- package/dist/components/hds/alert/index.js.map +1 -0
- package/dist/components/hds/alert/title.js +10 -0
- package/dist/components/hds/alert/title.js.map +1 -0
- package/dist/components/hds/app-footer/copyright.js +26 -0
- package/dist/components/hds/app-footer/copyright.js.map +1 -0
- package/dist/components/hds/app-footer/index.js +48 -0
- package/dist/components/hds/app-footer/index.js.map +1 -0
- package/dist/components/hds/app-footer/item.js +10 -0
- package/dist/components/hds/app-footer/item.js.map +1 -0
- package/dist/components/hds/app-footer/legal-links.js +70 -0
- package/dist/components/hds/app-footer/legal-links.js.map +1 -0
- package/dist/components/hds/app-footer/link.js +10 -0
- package/dist/components/hds/app-footer/link.js.map +1 -0
- package/dist/components/hds/app-footer/status-link.js +116 -0
- package/dist/components/hds/app-footer/status-link.js.map +1 -0
- package/dist/components/hds/app-frame/index.js +60 -0
- package/dist/components/hds/app-frame/index.js.map +1 -0
- package/dist/components/hds/app-frame/parts/footer.js +10 -0
- package/dist/components/hds/app-frame/parts/footer.js.map +1 -0
- package/dist/components/hds/app-frame/parts/header.js +10 -0
- package/dist/components/hds/app-frame/parts/header.js.map +1 -0
- package/dist/components/hds/app-frame/parts/main.js +10 -0
- package/dist/components/hds/app-frame/parts/main.js.map +1 -0
- package/dist/components/hds/app-frame/parts/modals.js +10 -0
- package/dist/components/hds/app-frame/parts/modals.js.map +1 -0
- package/dist/components/hds/app-frame/parts/sidebar.js +10 -0
- package/dist/components/hds/app-frame/parts/sidebar.js.map +1 -0
- package/dist/components/hds/application-state/body.js +10 -0
- package/dist/components/hds/application-state/body.js.map +1 -0
- package/dist/components/hds/application-state/footer.js +42 -0
- package/dist/components/hds/application-state/footer.js.map +1 -0
- package/dist/components/hds/application-state/header.js +10 -0
- package/dist/components/hds/application-state/header.js.map +1 -0
- package/dist/components/hds/application-state/index.js +10 -0
- package/dist/components/hds/application-state/index.js.map +1 -0
- package/dist/components/hds/badge/index.js +127 -0
- package/dist/components/hds/badge/index.js.map +1 -0
- package/dist/components/hds/badge-count/index.js +90 -0
- package/dist/components/hds/badge-count/index.js.map +1 -0
- package/dist/components/hds/breadcrumb/index.js +66 -0
- package/dist/components/hds/breadcrumb/index.js.map +1 -0
- package/dist/components/hds/breadcrumb/item.js +59 -0
- package/dist/components/hds/breadcrumb/item.js.map +1 -0
- package/dist/components/hds/breadcrumb/truncation.js +25 -0
- package/dist/components/hds/breadcrumb/truncation.js.map +1 -0
- package/dist/components/hds/button/index.js +157 -0
- package/dist/components/hds/button/index.js.map +1 -0
- package/dist/components/hds/button-set/index.js +10 -0
- package/dist/components/hds/button-set/index.js.map +1 -0
- package/dist/components/hds/card/container.js +130 -0
- package/dist/components/hds/card/container.js.map +1 -0
- package/dist/components/hds/code-block/copy-button.js +10 -0
- package/dist/components/hds/code-block/copy-button.js.map +1 -0
- package/dist/components/hds/code-block/description.js +10 -0
- package/dist/components/hds/code-block/description.js.map +1 -0
- package/dist/components/hds/code-block/index.js +160 -0
- package/dist/components/hds/code-block/index.js.map +1 -0
- package/dist/components/hds/code-block/title.js +10 -0
- package/dist/components/hds/code-block/title.js.map +1 -0
- package/dist/components/hds/copy/button/index.js +109 -0
- package/dist/components/hds/copy/button/index.js.map +1 -0
- package/dist/components/hds/copy/snippet/index.js +142 -0
- package/dist/components/hds/copy/snippet/index.js.map +1 -0
- package/dist/components/hds/disclosure-primitive/index.js +41 -0
- package/dist/components/hds/disclosure-primitive/index.js.map +1 -0
- package/dist/components/hds/dismiss-button/index.js +25 -0
- package/dist/components/hds/dismiss-button/index.js.map +1 -0
- package/dist/components/hds/dropdown/footer.js +10 -0
- package/dist/components/hds/dropdown/footer.js.map +1 -0
- package/dist/components/hds/dropdown/header.js +10 -0
- package/dist/components/hds/dropdown/header.js.map +1 -0
- package/dist/components/hds/dropdown/index.js +72 -0
- package/dist/components/hds/dropdown/index.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/checkbox.js +24 -0
- package/dist/components/hds/dropdown/list-item/checkbox.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/checkmark.js +31 -0
- package/dist/components/hds/dropdown/list-item/checkmark.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/copy-item.js +53 -0
- package/dist/components/hds/dropdown/list-item/copy-item.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/description.js +30 -0
- package/dist/components/hds/dropdown/list-item/description.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/generic.js +10 -0
- package/dist/components/hds/dropdown/list-item/generic.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/interactive.js +59 -0
- package/dist/components/hds/dropdown/list-item/interactive.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/radio.js +24 -0
- package/dist/components/hds/dropdown/list-item/radio.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/separator.js +10 -0
- package/dist/components/hds/dropdown/list-item/separator.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/title.js +30 -0
- package/dist/components/hds/dropdown/list-item/title.js.map +1 -0
- package/dist/components/hds/dropdown/toggle/button.js +134 -0
- package/dist/components/hds/dropdown/toggle/button.js.map +1 -0
- package/dist/components/hds/dropdown/toggle/chevron.js +10 -0
- package/dist/components/hds/dropdown/toggle/chevron.js.map +1 -0
- package/dist/components/hds/dropdown/toggle/icon.js +116 -0
- package/dist/components/hds/dropdown/toggle/icon.js.map +1 -0
- package/dist/components/hds/flyout/body.js +10 -0
- package/dist/components/hds/flyout/body.js.map +1 -0
- package/dist/components/hds/flyout/description.js +10 -0
- package/dist/components/hds/flyout/description.js.map +1 -0
- package/dist/components/hds/flyout/footer.js +10 -0
- package/dist/components/hds/flyout/footer.js.map +1 -0
- package/dist/components/hds/flyout/header.js +10 -0
- package/dist/components/hds/flyout/header.js.map +1 -0
- package/dist/components/hds/flyout/index.js +156 -0
- package/dist/components/hds/flyout/index.js.map +1 -0
- package/dist/components/hds/form/character-count/index.js +149 -0
- package/dist/components/hds/form/character-count/index.js.map +1 -0
- package/dist/components/hds/form/checkbox/base.js +10 -0
- package/dist/components/hds/form/checkbox/base.js.map +1 -0
- package/dist/components/hds/form/checkbox/field.js +10 -0
- package/dist/components/hds/form/checkbox/field.js.map +1 -0
- package/dist/components/hds/form/checkbox/group.js +10 -0
- package/dist/components/hds/form/checkbox/group.js.map +1 -0
- package/dist/components/hds/form/error/index.js +68 -0
- package/dist/components/hds/form/error/index.js.map +1 -0
- package/dist/components/hds/form/error/message.js +10 -0
- package/dist/components/hds/form/error/message.js.map +1 -0
- package/dist/components/hds/form/field/index.js +107 -0
- package/dist/components/hds/form/field/index.js.map +1 -0
- package/dist/components/hds/form/fieldset/index.js +93 -0
- package/dist/components/hds/form/fieldset/index.js.map +1 -0
- package/dist/components/hds/form/file-input/base.js +10 -0
- package/dist/components/hds/form/file-input/base.js.map +1 -0
- package/dist/components/hds/form/file-input/field.js +10 -0
- package/dist/components/hds/form/file-input/field.js.map +1 -0
- package/dist/components/hds/form/helper-text/index.js +68 -0
- package/dist/components/hds/form/helper-text/index.js.map +1 -0
- package/dist/components/hds/form/indicator/index.js +30 -0
- package/dist/components/hds/form/indicator/index.js.map +1 -0
- package/dist/components/hds/form/label/index.js +36 -0
- package/dist/components/hds/form/label/index.js.map +1 -0
- package/dist/components/hds/form/legend/index.js +36 -0
- package/dist/components/hds/form/legend/index.js.map +1 -0
- package/dist/components/hds/form/masked-input/base.js +96 -0
- package/dist/components/hds/form/masked-input/base.js.map +1 -0
- package/dist/components/hds/form/masked-input/field.js +10 -0
- package/dist/components/hds/form/masked-input/field.js.map +1 -0
- package/dist/components/hds/form/radio/base.js +10 -0
- package/dist/components/hds/form/radio/base.js.map +1 -0
- package/dist/components/hds/form/radio/field.js +10 -0
- package/dist/components/hds/form/radio/field.js.map +1 -0
- package/dist/components/hds/form/radio/group.js +10 -0
- package/dist/components/hds/form/radio/group.js.map +1 -0
- package/dist/components/hds/form/radio-card/description.js +10 -0
- package/dist/components/hds/form/radio-card/description.js.map +1 -0
- package/dist/components/hds/form/radio-card/group.js +10 -0
- package/dist/components/hds/form/radio-card/group.js.map +1 -0
- package/dist/components/hds/form/radio-card/index.js +107 -0
- package/dist/components/hds/form/radio-card/index.js.map +1 -0
- package/dist/components/hds/form/radio-card/label.js +10 -0
- package/dist/components/hds/form/radio-card/label.js.map +1 -0
- package/dist/components/hds/form/select/base.js +34 -0
- package/dist/components/hds/form/select/base.js.map +1 -0
- package/dist/components/hds/form/select/field.js +10 -0
- package/dist/components/hds/form/select/field.js.map +1 -0
- package/dist/components/hds/form/text-input/base.js +62 -0
- package/dist/components/hds/form/text-input/base.js.map +1 -0
- package/dist/components/hds/form/text-input/field.js +85 -0
- package/dist/components/hds/form/text-input/field.js.map +1 -0
- package/dist/components/hds/form/textarea/base.js +34 -0
- package/dist/components/hds/form/textarea/base.js.map +1 -0
- package/dist/components/hds/form/textarea/field.js +10 -0
- package/dist/components/hds/form/textarea/field.js.map +1 -0
- package/dist/components/hds/form/toggle/base.js +10 -0
- package/dist/components/hds/form/toggle/base.js.map +1 -0
- package/dist/components/hds/form/toggle/field.js +10 -0
- package/dist/components/hds/form/toggle/field.js.map +1 -0
- package/dist/components/hds/form/toggle/group.js +10 -0
- package/dist/components/hds/form/toggle/group.js.map +1 -0
- package/dist/components/hds/form/visibility-toggle/index.js +10 -0
- package/dist/components/hds/form/visibility-toggle/index.js.map +1 -0
- package/dist/components/hds/icon-tile/index.js +158 -0
- package/dist/components/hds/icon-tile/index.js.map +1 -0
- package/dist/components/hds/interactive/index.js +41 -0
- package/dist/components/hds/interactive/index.js.map +1 -0
- package/dist/components/hds/link/inline.js +72 -0
- package/dist/components/hds/link/inline.js.map +1 -0
- package/dist/components/hds/link/standalone.js +132 -0
- package/dist/components/hds/link/standalone.js.map +1 -0
- package/dist/components/hds/menu-primitive/index.js +68 -0
- package/dist/components/hds/menu-primitive/index.js.map +1 -0
- package/dist/components/hds/modal/body.js +10 -0
- package/dist/components/hds/modal/body.js.map +1 -0
- package/dist/components/hds/modal/footer.js +10 -0
- package/dist/components/hds/modal/footer.js.map +1 -0
- package/dist/components/hds/modal/header.js +10 -0
- package/dist/components/hds/modal/header.js.map +1 -0
- package/dist/components/hds/modal/index.js +196 -0
- package/dist/components/hds/modal/index.js.map +1 -0
- package/dist/components/hds/page-header/actions.js +10 -0
- package/dist/components/hds/page-header/actions.js.map +1 -0
- package/dist/components/hds/page-header/badges.js +10 -0
- package/dist/components/hds/page-header/badges.js.map +1 -0
- package/dist/components/hds/page-header/description.js +10 -0
- package/dist/components/hds/page-header/description.js.map +1 -0
- package/dist/components/hds/page-header/index.js +10 -0
- package/dist/components/hds/page-header/index.js.map +1 -0
- package/dist/components/hds/page-header/subtitle.js +10 -0
- package/dist/components/hds/page-header/subtitle.js.map +1 -0
- package/dist/components/hds/page-header/title.js +10 -0
- package/dist/components/hds/page-header/title.js.map +1 -0
- package/dist/components/hds/pagination/compact/index.js +159 -0
- package/dist/components/hds/pagination/compact/index.js.map +1 -0
- package/dist/components/hds/pagination/info/index.js +25 -0
- package/dist/components/hds/pagination/info/index.js.map +1 -0
- package/dist/components/hds/pagination/nav/arrow.js +70 -0
- package/dist/components/hds/pagination/nav/arrow.js.map +1 -0
- package/dist/components/hds/pagination/nav/ellipsis.js +10 -0
- package/dist/components/hds/pagination/nav/ellipsis.js.map +1 -0
- package/dist/components/hds/pagination/nav/number.js +44 -0
- package/dist/components/hds/pagination/nav/number.js.map +1 -0
- package/dist/components/hds/pagination/numbered/index.js +305 -0
- package/dist/components/hds/pagination/numbered/index.js.map +1 -0
- package/dist/components/hds/pagination/size-selector/index.js +72 -0
- package/dist/components/hds/pagination/size-selector/index.js.map +1 -0
- package/dist/components/hds/reveal/index.js +36 -0
- package/dist/components/hds/reveal/index.js.map +1 -0
- package/dist/components/hds/reveal/toggle/button.js +31 -0
- package/dist/components/hds/reveal/toggle/button.js.map +1 -0
- package/dist/components/hds/segmented-group/index.js +10 -0
- package/dist/components/hds/segmented-group/index.js.map +1 -0
- package/dist/components/hds/separator/index.js +48 -0
- package/dist/components/hds/separator/index.js.map +1 -0
- package/dist/components/hds/side-nav/base.js +10 -0
- package/dist/components/hds/side-nav/base.js.map +1 -0
- package/dist/components/hds/side-nav/header/home-link.js +30 -0
- package/dist/components/hds/side-nav/header/home-link.js.map +1 -0
- package/dist/components/hds/side-nav/header/icon-button.js +30 -0
- package/dist/components/hds/side-nav/header/icon-button.js.map +1 -0
- package/dist/components/hds/side-nav/header/index.js +10 -0
- package/dist/components/hds/side-nav/header/index.js.map +1 -0
- package/dist/components/hds/side-nav/index.js +176 -0
- package/dist/components/hds/side-nav/index.js.map +1 -0
- package/dist/components/hds/side-nav/list/back-link.js +10 -0
- package/dist/components/hds/side-nav/list/back-link.js.map +1 -0
- package/dist/components/hds/side-nav/list/index.js +10 -0
- package/dist/components/hds/side-nav/list/index.js.map +1 -0
- package/dist/components/hds/side-nav/list/item.js +10 -0
- package/dist/components/hds/side-nav/list/item.js.map +1 -0
- package/dist/components/hds/side-nav/list/link.js +10 -0
- package/dist/components/hds/side-nav/list/link.js.map +1 -0
- package/dist/components/hds/side-nav/list/title.js +10 -0
- package/dist/components/hds/side-nav/list/title.js.map +1 -0
- package/dist/components/hds/side-nav/portal/index.js +10 -0
- package/dist/components/hds/side-nav/portal/index.js.map +1 -0
- package/dist/components/hds/side-nav/portal/target.js +173 -0
- package/dist/components/hds/side-nav/portal/target.js.map +1 -0
- package/dist/components/hds/side-nav/toggle-button.js +10 -0
- package/dist/components/hds/side-nav/toggle-button.js.map +1 -0
- package/dist/components/hds/stepper/step/indicator.js +59 -0
- package/dist/components/hds/stepper/step/indicator.js.map +1 -0
- package/dist/components/hds/stepper/task/indicator.js +74 -0
- package/dist/components/hds/stepper/task/indicator.js.map +1 -0
- package/dist/components/hds/table/index.js +269 -0
- package/dist/components/hds/table/index.js.map +1 -0
- package/dist/components/hds/table/td.js +48 -0
- package/dist/components/hds/table/td.js.map +1 -0
- package/dist/components/hds/table/th-button-sort.js +82 -0
- package/dist/components/hds/table/th-button-sort.js.map +1 -0
- package/dist/components/hds/table/th-button-tooltip.js +32 -0
- package/dist/components/hds/table/th-button-tooltip.js.map +1 -0
- package/dist/components/hds/table/th-selectable.js +81 -0
- package/dist/components/hds/table/th-selectable.js.map +1 -0
- package/dist/components/hds/table/th-sort.js +73 -0
- package/dist/components/hds/table/th-sort.js.map +1 -0
- package/dist/components/hds/table/th.js +54 -0
- package/dist/components/hds/table/th.js.map +1 -0
- package/dist/components/hds/table/tr.js +30 -0
- package/dist/components/hds/table/tr.js.map +1 -0
- package/dist/components/hds/tabs/index.js +242 -0
- package/dist/components/hds/tabs/index.js.map +1 -0
- package/dist/components/hds/tabs/panel.js +60 -0
- package/dist/components/hds/tabs/panel.js.map +1 -0
- package/dist/components/hds/tabs/tab.js +94 -0
- package/dist/components/hds/tabs/tab.js.map +1 -0
- package/dist/components/hds/tag/index.js +92 -0
- package/dist/components/hds/tag/index.js.map +1 -0
- package/dist/components/hds/text/body.js +63 -0
- package/dist/components/hds/text/body.js.map +1 -0
- package/dist/components/hds/text/code.js +63 -0
- package/dist/components/hds/text/code.js.map +1 -0
- package/dist/components/hds/text/display.js +76 -0
- package/dist/components/hds/text/display.js.map +1 -0
- package/dist/components/hds/text/index.js +131 -0
- package/dist/components/hds/text/index.js.map +1 -0
- package/dist/components/hds/toast/index.js +10 -0
- package/dist/components/hds/toast/index.js.map +1 -0
- package/dist/components/hds/tooltip-button/index.js +74 -0
- package/dist/components/hds/tooltip-button/index.js.map +1 -0
- package/dist/components/hds/yield/index.js +10 -0
- package/dist/components/hds/yield/index.js.map +1 -0
- package/dist/helpers/hds-link-to-models.js +34 -0
- package/dist/helpers/hds-link-to-models.js.map +1 -0
- package/dist/helpers/hds-link-to-query.js +29 -0
- package/dist/helpers/hds-link-to-query.js.map +1 -0
- package/dist/modifiers/hds-clipboard.js +152 -0
- package/dist/modifiers/hds-clipboard.js.map +1 -0
- package/dist/modifiers/hds-tooltip.js +153 -0
- package/dist/modifiers/hds-tooltip.js.map +1 -0
- package/dist/styles/@hashicorp/design-system-components.css +6600 -0
- package/dist/styles/@hashicorp/design-system-components.scss +67 -0
- package/dist/styles/@hashicorp/design-system-components.scss.map +1 -0
- package/dist/styles/components/flyout.scss +113 -0
- package/dist/styles/components/table.scss +277 -0
- package/dist/styles/components/tabs.scss +152 -0
- package/dist/template-registry.js +2 -0
- package/dist/template-registry.js.map +1 -0
- package/dist/utils/hds-get-element-id.js +22 -0
- package/dist/utils/hds-get-element-id.js.map +1 -0
- package/dist/utils/hds-set-aria-described-by.js +17 -0
- package/dist/utils/hds-set-aria-described-by.js.map +1 -0
- package/package.json +196 -62
- package/.stylelintignore +0 -26
- package/CHANGELOG-FIGMA-COMPONENTS.md +0 -191
- package/CHANGELOG-FIGMA-FOUNDATIONS.md +0 -13
- package/CHANGELOG.md +0 -1597
- package/HOW-TO-TEST-A-COMPONENT-IN-CLOUD-UI.md +0 -100
- package/NEW-COMPONENT-CHECKLIST.md +0 -166
- package/RELEASE.md +0 -40
- package/addon/components/hds/accordion/index.hbs +0 -8
- package/addon/components/hds/accordion/item/button.hbs +0 -16
- package/addon/components/hds/accordion/item/button.js +0 -31
- package/addon/components/hds/accordion/item/index.hbs +0 -41
- package/addon/components/hds/accordion/item/index.js +0 -58
- package/addon/components/hds/alert/description.hbs +0 -5
- package/addon/components/hds/alert/index.hbs +0 -38
- package/addon/components/hds/alert/index.js +0 -164
- package/addon/components/hds/alert/title.hbs +0 -5
- package/addon/components/hds/app-footer/copyright.hbs +0 -9
- package/addon/components/hds/app-footer/copyright.js +0 -18
- package/addon/components/hds/app-footer/index.hbs +0 -20
- package/addon/components/hds/app-footer/index.js +0 -41
- package/addon/components/hds/app-footer/item.hbs +0 -8
- package/addon/components/hds/app-footer/legal-links.hbs +0 -14
- package/addon/components/hds/app-footer/legal-links.js +0 -67
- package/addon/components/hds/app-footer/link.hbs +0 -22
- package/addon/components/hds/app-footer/status-link.hbs +0 -20
- package/addon/components/hds/app-footer/status-link.js +0 -121
- package/addon/components/hds/app-frame/index.hbs +0 -24
- package/addon/components/hds/app-frame/index.js +0 -52
- package/addon/components/hds/app-frame/parts/footer.hbs +0 -7
- package/addon/components/hds/app-frame/parts/header.hbs +0 -7
- package/addon/components/hds/app-frame/parts/main.hbs +0 -7
- package/addon/components/hds/app-frame/parts/modals.hbs +0 -6
- package/addon/components/hds/app-frame/parts/sidebar.hbs +0 -7
- package/addon/components/hds/application-state/body.hbs +0 -13
- package/addon/components/hds/application-state/footer.hbs +0 -7
- package/addon/components/hds/application-state/footer.js +0 -35
- package/addon/components/hds/application-state/header.hbs +0 -20
- package/addon/components/hds/application-state/index.hbs +0 -13
- package/addon/components/hds/badge/index.hbs +0 -18
- package/addon/components/hds/badge/index.js +0 -146
- package/addon/components/hds/badge-count/index.hbs +0 -7
- package/addon/components/hds/badge-count/index.js +0 -99
- package/addon/components/hds/breadcrumb/index.hbs +0 -9
- package/addon/components/hds/breadcrumb/index.js +0 -59
- package/addon/components/hds/breadcrumb/item.hbs +0 -50
- package/addon/components/hds/breadcrumb/item.js +0 -55
- package/addon/components/hds/breadcrumb/truncation.hbs +0 -26
- package/addon/components/hds/breadcrumb/truncation.js +0 -17
- package/addon/components/hds/button/index.hbs +0 -45
- package/addon/components/hds/button/index.ts +0 -199
- package/addon/components/hds/button-set/index.hbs +0 -7
- package/addon/components/hds/card/container.hbs +0 -7
- package/addon/components/hds/card/container.js +0 -161
- package/addon/components/hds/code-block/copy-button.hbs +0 -13
- package/addon/components/hds/code-block/description.hbs +0 -8
- package/addon/components/hds/code-block/index.hbs +0 -27
- package/addon/components/hds/code-block/index.js +0 -167
- package/addon/components/hds/code-block/title.hbs +0 -8
- package/addon/components/hds/copy/button/index.hbs +0 -16
- package/addon/components/hds/copy/button/index.js +0 -103
- package/addon/components/hds/copy/snippet/index.hbs +0 -15
- package/addon/components/hds/copy/snippet/index.js +0 -135
- package/addon/components/hds/disclosure-primitive/index.hbs +0 -14
- package/addon/components/hds/disclosure-primitive/index.js +0 -30
- package/addon/components/hds/dismiss-button/index.hbs +0 -7
- package/addon/components/hds/dismiss-button/index.js +0 -17
- package/addon/components/hds/dropdown/footer.hbs +0 -8
- package/addon/components/hds/dropdown/header.hbs +0 -8
- package/addon/components/hds/dropdown/index.hbs +0 -36
- package/addon/components/hds/dropdown/index.js +0 -80
- package/addon/components/hds/dropdown/list-item/checkbox.hbs +0 -20
- package/addon/components/hds/dropdown/list-item/checkbox.js +0 -16
- package/addon/components/hds/dropdown/list-item/checkmark.hbs +0 -46
- package/addon/components/hds/dropdown/list-item/checkmark.js +0 -28
- package/addon/components/hds/dropdown/list-item/copy-item.hbs +0 -16
- package/addon/components/hds/dropdown/list-item/copy-item.js +0 -51
- package/addon/components/hds/dropdown/list-item/description.hbs +0 -14
- package/addon/components/hds/dropdown/list-item/description.js +0 -25
- package/addon/components/hds/dropdown/list-item/generic.hbs +0 -7
- package/addon/components/hds/dropdown/list-item/interactive.hbs +0 -37
- package/addon/components/hds/dropdown/list-item/interactive.js +0 -64
- package/addon/components/hds/dropdown/list-item/radio.hbs +0 -25
- package/addon/components/hds/dropdown/list-item/radio.js +0 -16
- package/addon/components/hds/dropdown/list-item/separator.hbs +0 -10
- package/addon/components/hds/dropdown/list-item/title.hbs +0 -14
- package/addon/components/hds/dropdown/list-item/title.js +0 -25
- package/addon/components/hds/dropdown/toggle/button.hbs +0 -38
- package/addon/components/hds/dropdown/toggle/button.js +0 -134
- package/addon/components/hds/dropdown/toggle/chevron.hbs +0 -8
- package/addon/components/hds/dropdown/toggle/icon.hbs +0 -23
- package/addon/components/hds/dropdown/toggle/icon.js +0 -119
- package/addon/components/hds/flyout/body.hbs +0 -7
- package/addon/components/hds/flyout/description.hbs +0 -7
- package/addon/components/hds/flyout/footer.hbs +0 -7
- package/addon/components/hds/flyout/header.hbs +0 -18
- package/addon/components/hds/flyout/index.hbs +0 -20
- package/addon/components/hds/flyout/index.js +0 -168
- package/addon/components/hds/form/character-count/index.hbs +0 -28
- package/addon/components/hds/form/character-count/index.js +0 -178
- package/addon/components/hds/form/checkbox/base.hbs +0 -5
- package/addon/components/hds/form/checkbox/field.hbs +0 -24
- package/addon/components/hds/form/checkbox/group.hbs +0 -29
- package/addon/components/hds/form/error/index.hbs +0 -10
- package/addon/components/hds/form/error/index.js +0 -58
- package/addon/components/hds/form/error/message.hbs +0 -7
- package/addon/components/hds/form/field/index.hbs +0 -47
- package/addon/components/hds/form/field/index.js +0 -97
- package/addon/components/hds/form/fieldset/index.hbs +0 -33
- package/addon/components/hds/form/fieldset/index.js +0 -76
- package/addon/components/hds/form/file-input/base.hbs +0 -6
- package/addon/components/hds/form/file-input/field.hbs +0 -24
- package/addon/components/hds/form/helper-text/index.hbs +0 -15
- package/addon/components/hds/form/helper-text/index.js +0 -58
- package/addon/components/hds/form/indicator/index.hbs +0 -10
- package/addon/components/hds/form/indicator/index.js +0 -24
- package/addon/components/hds/form/label/index.hbs +0 -8
- package/addon/components/hds/form/label/index.js +0 -29
- package/addon/components/hds/form/legend/index.hbs +0 -8
- package/addon/components/hds/form/legend/index.js +0 -29
- package/addon/components/hds/form/masked-input/base.hbs +0 -40
- package/addon/components/hds/form/masked-input/base.js +0 -85
- package/addon/components/hds/form/masked-input/field.hbs +0 -33
- package/addon/components/hds/form/radio/base.hbs +0 -5
- package/addon/components/hds/form/radio/field.hbs +0 -24
- package/addon/components/hds/form/radio/group.hbs +0 -29
- package/addon/components/hds/form/radio-card/description.hbs +0 -10
- package/addon/components/hds/form/radio-card/group.hbs +0 -30
- package/addon/components/hds/form/radio-card/index.hbs +0 -24
- package/addon/components/hds/form/radio-card/index.js +0 -100
- package/addon/components/hds/form/radio-card/label.hbs +0 -11
- package/addon/components/hds/form/select/base.hbs +0 -7
- package/addon/components/hds/form/select/base.js +0 -27
- package/addon/components/hds/form/select/field.hbs +0 -30
- package/addon/components/hds/form/text-input/base.hbs +0 -5
- package/addon/components/hds/form/text-input/base.js +0 -72
- package/addon/components/hds/form/text-input/field.hbs +0 -41
- package/addon/components/hds/form/text-input/field.js +0 -59
- package/addon/components/hds/form/textarea/base.hbs +0 -6
- package/addon/components/hds/form/textarea/base.js +0 -27
- package/addon/components/hds/form/textarea/field.hbs +0 -28
- package/addon/components/hds/form/toggle/base.hbs +0 -8
- package/addon/components/hds/form/toggle/field.hbs +0 -23
- package/addon/components/hds/form/toggle/group.hbs +0 -21
- package/addon/components/hds/form/visibility-toggle/index.hbs +0 -8
- package/addon/components/hds/icon-tile/index.hbs +0 -23
- package/addon/components/hds/icon-tile/index.js +0 -189
- package/addon/components/hds/interactive/index.hbs +0 -32
- package/addon/components/hds/interactive/index.ts +0 -63
- package/addon/components/hds/link/inline.hbs +0 -22
- package/addon/components/hds/link/inline.js +0 -76
- package/addon/components/hds/link/standalone.hbs +0 -28
- package/addon/components/hds/link/standalone.js +0 -147
- package/addon/components/hds/menu-primitive/index.hbs +0 -22
- package/addon/components/hds/menu-primitive/index.js +0 -59
- package/addon/components/hds/modal/body.hbs +0 -7
- package/addon/components/hds/modal/footer.hbs +0 -7
- package/addon/components/hds/modal/header.hbs +0 -18
- package/addon/components/hds/modal/index.hbs +0 -19
- package/addon/components/hds/modal/index.js +0 -209
- package/addon/components/hds/page-header/actions.hbs +0 -5
- package/addon/components/hds/page-header/badges.hbs +0 -5
- package/addon/components/hds/page-header/description.hbs +0 -11
- package/addon/components/hds/page-header/index.hbs +0 -28
- package/addon/components/hds/page-header/subtitle.hbs +0 -11
- package/addon/components/hds/page-header/title.hbs +0 -11
- package/addon/components/hds/pagination/compact/index.hbs +0 -39
- package/addon/components/hds/pagination/compact/index.js +0 -163
- package/addon/components/hds/pagination/info/index.hbs +0 -11
- package/addon/components/hds/pagination/info/index.js +0 -17
- package/addon/components/hds/pagination/nav/arrow.hbs +0 -44
- package/addon/components/hds/pagination/nav/arrow.js +0 -77
- package/addon/components/hds/pagination/nav/ellipsis.hbs +0 -5
- package/addon/components/hds/pagination/nav/number.hbs +0 -17
- package/addon/components/hds/pagination/nav/number.js +0 -45
- package/addon/components/hds/pagination/numbered/index.hbs +0 -70
- package/addon/components/hds/pagination/numbered/index.js +0 -341
- package/addon/components/hds/pagination/size-selector/index.hbs +0 -16
- package/addon/components/hds/pagination/size-selector/index.js +0 -73
- package/addon/components/hds/reveal/index.hbs +0 -21
- package/addon/components/hds/reveal/index.js +0 -33
- package/addon/components/hds/reveal/toggle/button.hbs +0 -13
- package/addon/components/hds/reveal/toggle/button.js +0 -24
- package/addon/components/hds/segmented-group/index.hbs +0 -15
- package/addon/components/hds/separator/index.hbs +0 -5
- package/addon/components/hds/separator/index.js +0 -47
- package/addon/components/hds/side-nav/base.hbs +0 -19
- package/addon/components/hds/side-nav/header/home-link.hbs +0 -20
- package/addon/components/hds/side-nav/header/home-link.js +0 -25
- package/addon/components/hds/side-nav/header/icon-button.hbs +0 -20
- package/addon/components/hds/side-nav/header/icon-button.js +0 -25
- package/addon/components/hds/side-nav/header/index.hbs +0 -13
- package/addon/components/hds/side-nav/index.hbs +0 -42
- package/addon/components/hds/side-nav/index.js +0 -147
- package/addon/components/hds/side-nav/list/back-link.hbs +0 -24
- package/addon/components/hds/side-nav/list/index.hbs +0 -19
- package/addon/components/hds/side-nav/list/item.hbs +0 -8
- package/addon/components/hds/side-nav/list/link.hbs +0 -50
- package/addon/components/hds/side-nav/list/title.hbs +0 -8
- package/addon/components/hds/side-nav/portal/index.hbs +0 -12
- package/addon/components/hds/side-nav/portal/target.hbs +0 -14
- package/addon/components/hds/side-nav/portal/target.js +0 -162
- package/addon/components/hds/side-nav/toggle-button.hbs +0 -7
- package/addon/components/hds/stepper/step/indicator.hbs +0 -28
- package/addon/components/hds/stepper/step/indicator.js +0 -59
- package/addon/components/hds/stepper/task/indicator.hbs +0 -7
- package/addon/components/hds/stepper/task/indicator.js +0 -74
- package/addon/components/hds/table/index.hbs +0 -78
- package/addon/components/hds/table/index.js +0 -182
- package/addon/components/hds/table/td.hbs +0 -7
- package/addon/components/hds/table/td.js +0 -50
- package/addon/components/hds/table/th-sort.hbs +0 -18
- package/addon/components/hds/table/th-sort.js +0 -94
- package/addon/components/hds/table/th.hbs +0 -11
- package/addon/components/hds/table/th.js +0 -50
- package/addon/components/hds/table/tr.hbs +0 -7
- package/addon/components/hds/tabs/index.hbs +0 -47
- package/addon/components/hds/tabs/index.js +0 -211
- package/addon/components/hds/tabs/panel.hbs +0 -16
- package/addon/components/hds/tabs/panel.js +0 -59
- package/addon/components/hds/tabs/tab.hbs +0 -31
- package/addon/components/hds/tabs/tab.js +0 -98
- package/addon/components/hds/tag/index.hbs +0 -30
- package/addon/components/hds/tag/index.js +0 -91
- package/addon/components/hds/text/body.hbs +0 -13
- package/addon/components/hds/text/body.js +0 -73
- package/addon/components/hds/text/code.hbs +0 -13
- package/addon/components/hds/text/code.js +0 -73
- package/addon/components/hds/text/display.hbs +0 -13
- package/addon/components/hds/text/display.js +0 -85
- package/addon/components/hds/text/index.hbs +0 -10
- package/addon/components/hds/text/index.js +0 -146
- package/addon/components/hds/toast/index.hbs +0 -17
- package/addon/components/hds/tooltip-button/index.hbs +0 -11
- package/addon/components/hds/tooltip-button/index.js +0 -86
- package/addon/components/hds/yield/index.hbs +0 -6
- package/addon/helpers/hds-link-to-models.js +0 -35
- package/addon/helpers/hds-link-to-query.js +0 -26
- package/addon/modifiers/hds-clipboard.js +0 -163
- package/addon/modifiers/hds-tooltip.js +0 -164
- package/addon/template-registry.ts +0 -12
- package/addon/utils/hds-get-element-id.js +0 -19
- package/addon/utils/hds-set-aria-described-by.js +0 -15
- package/app/components/hds/accordion/index.js +0 -6
- package/app/components/hds/accordion/item/button.js +0 -6
- package/app/components/hds/accordion/item/index.js +0 -6
- package/app/components/hds/alert/description.js +0 -6
- package/app/components/hds/alert/index.js +0 -6
- package/app/components/hds/alert/title.js +0 -6
- package/app/components/hds/app-footer/copyright.js +0 -6
- package/app/components/hds/app-footer/index.js +0 -6
- package/app/components/hds/app-footer/item.js +0 -6
- package/app/components/hds/app-footer/legal-links.js +0 -6
- package/app/components/hds/app-footer/link.js +0 -6
- package/app/components/hds/app-footer/status-link.js +0 -6
- package/app/components/hds/app-frame/index.js +0 -6
- package/app/components/hds/app-frame/parts/footer.js +0 -6
- package/app/components/hds/app-frame/parts/header.js +0 -6
- package/app/components/hds/app-frame/parts/main.js +0 -6
- package/app/components/hds/app-frame/parts/modals.js +0 -6
- package/app/components/hds/app-frame/parts/sidebar.js +0 -6
- package/app/components/hds/application-state/body.js +0 -6
- package/app/components/hds/application-state/footer.js +0 -6
- package/app/components/hds/application-state/header.js +0 -6
- package/app/components/hds/application-state/index.js +0 -6
- package/app/components/hds/badge/index.js +0 -6
- package/app/components/hds/badge-count/index.js +0 -6
- package/app/components/hds/breadcrumb/index.js +0 -6
- package/app/components/hds/breadcrumb/item.js +0 -6
- package/app/components/hds/breadcrumb/truncation.js +0 -6
- package/app/components/hds/button/index.js +0 -6
- package/app/components/hds/button-set/index.js +0 -6
- package/app/components/hds/card/container.js +0 -6
- package/app/components/hds/code-block/copy-button.js +0 -6
- package/app/components/hds/code-block/description.js +0 -6
- package/app/components/hds/code-block/index.js +0 -6
- package/app/components/hds/code-block/title.js +0 -6
- package/app/components/hds/copy/button/index.js +0 -6
- package/app/components/hds/copy/snippet/index.js +0 -6
- package/app/components/hds/disclosure-primitive/index.js +0 -6
- package/app/components/hds/dismiss-button/index.js +0 -6
- package/app/components/hds/dropdown/footer.js +0 -6
- package/app/components/hds/dropdown/header.js +0 -6
- package/app/components/hds/dropdown/index.js +0 -6
- package/app/components/hds/dropdown/list-item/checkbox.js +0 -6
- package/app/components/hds/dropdown/list-item/checkmark.js +0 -6
- package/app/components/hds/dropdown/list-item/copy-item.js +0 -6
- package/app/components/hds/dropdown/list-item/description.js +0 -6
- package/app/components/hds/dropdown/list-item/generic.js +0 -6
- package/app/components/hds/dropdown/list-item/interactive.js +0 -6
- package/app/components/hds/dropdown/list-item/radio.js +0 -6
- package/app/components/hds/dropdown/list-item/separator.js +0 -6
- package/app/components/hds/dropdown/list-item/title.js +0 -6
- package/app/components/hds/dropdown/toggle/button.js +0 -6
- package/app/components/hds/dropdown/toggle/chevron.js +0 -6
- package/app/components/hds/dropdown/toggle/icon.js +0 -6
- package/app/components/hds/flyout/body.js +0 -6
- package/app/components/hds/flyout/description.js +0 -6
- package/app/components/hds/flyout/footer.js +0 -6
- package/app/components/hds/flyout/header.js +0 -6
- package/app/components/hds/flyout/index.js +0 -6
- package/app/components/hds/form/character-count/index.js +0 -6
- package/app/components/hds/form/checkbox/base.js +0 -6
- package/app/components/hds/form/checkbox/field.js +0 -6
- package/app/components/hds/form/checkbox/group.js +0 -6
- package/app/components/hds/form/error/index.js +0 -6
- package/app/components/hds/form/error/message.js +0 -6
- package/app/components/hds/form/field/index.js +0 -6
- package/app/components/hds/form/fieldset/index.js +0 -6
- package/app/components/hds/form/file-input/base.js +0 -6
- package/app/components/hds/form/file-input/field.js +0 -6
- package/app/components/hds/form/helper-text/index.js +0 -6
- package/app/components/hds/form/indicator/index.js +0 -6
- package/app/components/hds/form/label/index.js +0 -6
- package/app/components/hds/form/legend/index.js +0 -6
- package/app/components/hds/form/masked-input/base.js +0 -6
- package/app/components/hds/form/masked-input/field.js +0 -6
- package/app/components/hds/form/radio/base.js +0 -6
- package/app/components/hds/form/radio/field.js +0 -6
- package/app/components/hds/form/radio/group.js +0 -6
- package/app/components/hds/form/radio-card/description.js +0 -6
- package/app/components/hds/form/radio-card/group.js +0 -6
- package/app/components/hds/form/radio-card/index.js +0 -6
- package/app/components/hds/form/radio-card/label.js +0 -6
- package/app/components/hds/form/select/base.js +0 -6
- package/app/components/hds/form/select/field.js +0 -6
- package/app/components/hds/form/text-input/base.js +0 -6
- package/app/components/hds/form/text-input/field.js +0 -6
- package/app/components/hds/form/textarea/base.js +0 -6
- package/app/components/hds/form/textarea/field.js +0 -6
- package/app/components/hds/form/toggle/base.js +0 -6
- package/app/components/hds/form/toggle/field.js +0 -6
- package/app/components/hds/form/toggle/group.js +0 -6
- package/app/components/hds/form/visibility-toggle/index.js +0 -6
- package/app/components/hds/icon-tile/index.js +0 -6
- package/app/components/hds/interactive/index.js +0 -6
- package/app/components/hds/link/inline.js +0 -6
- package/app/components/hds/link/standalone.js +0 -6
- package/app/components/hds/menu-primitive/index.js +0 -6
- package/app/components/hds/modal/body.js +0 -6
- package/app/components/hds/modal/footer.js +0 -6
- package/app/components/hds/modal/header.js +0 -6
- package/app/components/hds/modal/index.js +0 -6
- package/app/components/hds/page-header/actions.js +0 -6
- package/app/components/hds/page-header/badges.js +0 -6
- package/app/components/hds/page-header/description.js +0 -6
- package/app/components/hds/page-header/index.js +0 -6
- package/app/components/hds/page-header/subtitle.js +0 -6
- package/app/components/hds/page-header/title.js +0 -6
- package/app/components/hds/pagination/compact/index.js +0 -6
- package/app/components/hds/pagination/info.js +0 -6
- package/app/components/hds/pagination/nav/arrow.js +0 -6
- package/app/components/hds/pagination/nav/ellipsis.js +0 -6
- package/app/components/hds/pagination/nav/number.js +0 -6
- package/app/components/hds/pagination/numbered/index.js +0 -6
- package/app/components/hds/pagination/size-selector.js +0 -6
- package/app/components/hds/reveal/index.js +0 -6
- package/app/components/hds/reveal/toggle/button.js +0 -6
- package/app/components/hds/segmented-group/index.js +0 -6
- package/app/components/hds/separator/index.js +0 -6
- package/app/components/hds/side-nav/base.js +0 -6
- package/app/components/hds/side-nav/header/home-link.js +0 -6
- package/app/components/hds/side-nav/header/icon-button.js +0 -6
- package/app/components/hds/side-nav/header/index.js +0 -6
- package/app/components/hds/side-nav/index.js +0 -6
- package/app/components/hds/side-nav/list/back-link.js +0 -6
- package/app/components/hds/side-nav/list/index.js +0 -6
- package/app/components/hds/side-nav/list/item.js +0 -6
- package/app/components/hds/side-nav/list/link.js +0 -6
- package/app/components/hds/side-nav/list/title.js +0 -6
- package/app/components/hds/side-nav/portal/index.js +0 -6
- package/app/components/hds/side-nav/portal/target.js +0 -6
- package/app/components/hds/side-nav/toggle-button.js +0 -6
- package/app/components/hds/stepper/step/indicator.js +0 -6
- package/app/components/hds/stepper/task/indicator.js +0 -6
- package/app/components/hds/table/index.js +0 -6
- package/app/components/hds/table/td.js +0 -6
- package/app/components/hds/table/th-sort.js +0 -6
- package/app/components/hds/table/th.js +0 -6
- package/app/components/hds/table/tr.js +0 -6
- package/app/components/hds/tabs/index.js +0 -6
- package/app/components/hds/tabs/panel.js +0 -6
- package/app/components/hds/tabs/tab.js +0 -6
- package/app/components/hds/tag/index.js +0 -6
- package/app/components/hds/text/body.js +0 -6
- package/app/components/hds/text/code.js +0 -6
- package/app/components/hds/text/display.js +0 -6
- package/app/components/hds/text/index.js +0 -6
- package/app/components/hds/toast/index.js +0 -6
- package/app/components/hds/tooltip-button/index.js +0 -6
- package/app/components/hds/yield/index.js +0 -6
- package/app/helpers/hds-link-to-models.js +0 -6
- package/app/helpers/hds-link-to-query.js +0 -6
- package/app/modifiers/hds-clipboard.js +0 -6
- package/app/modifiers/hds-tooltip.js +0 -6
- package/app/styles/@hashicorp/design-system-components.scss +0 -64
- package/app/styles/components/flyout.scss +0 -111
- package/app/styles/components/table.scss +0 -208
- package/app/styles/components/tabs.scss +0 -117
- package/blueprints/hds-component/files/addon/components/hds/__name__/index.hbs +0 -8
- package/blueprints/hds-component/files/addon/components/hds/__name__/index.js +0 -28
- package/blueprints/hds-component/files/app/components/hds/__name__/index.js +0 -6
- package/blueprints/hds-component/files/app/styles/components/__name__.scss +0 -12
- package/blueprints/hds-component/index.js +0 -65
- package/blueprints/hds-component-test/files/tests/acceptance/components/hds/__name__.js +0 -21
- package/blueprints/hds-component-test/files/tests/dummy/app/routes/components/__name__.js +0 -8
- package/blueprints/hds-component-test/files/tests/dummy/app/styles/showcase-pages/__dummyCSSFileName__.scss +0 -6
- package/blueprints/hds-component-test/files/tests/dummy/app/templates/components/__name__.hbs +0 -17
- package/blueprints/hds-component-test/files/tests/integration/components/hds/__name__/index-test.js +0 -25
- package/blueprints/hds-component-test/index.js +0 -151
- package/config/environment.js +0 -10
- package/index.js +0 -32
- package/tsconfig.declarations.json +0 -10
- package/tsconfig.json +0 -47
- package/types/dummy/index.d.ts +0 -7
- package/types/global.d.ts +0 -12
- package/vercel.json +0 -13
- /package/{app → dist}/styles/@hashicorp/design-system-power-select-overrides.scss +0 -0
- /package/{app → dist}/styles/components/accordion.scss +0 -0
- /package/{app → dist}/styles/components/alert.scss +0 -0
- /package/{app → dist}/styles/components/app-footer.scss +0 -0
- /package/{app → dist}/styles/components/app-frame.scss +0 -0
- /package/{app → dist}/styles/components/application-state.scss +0 -0
- /package/{app → dist}/styles/components/badge-count.scss +0 -0
- /package/{app → dist}/styles/components/badge.scss +0 -0
- /package/{app → dist}/styles/components/breadcrumb.scss +0 -0
- /package/{app → dist}/styles/components/button-set.scss +0 -0
- /package/{app → dist}/styles/components/button.scss +0 -0
- /package/{app → dist}/styles/components/card/container.scss +0 -0
- /package/{app → dist}/styles/components/card/index.scss +0 -0
- /package/{app → dist}/styles/components/code-block/index.scss +0 -0
- /package/{app → dist}/styles/components/code-block/theme.scss +0 -0
- /package/{app → dist}/styles/components/copy/button.scss +0 -0
- /package/{app → dist}/styles/components/copy/index.scss +0 -0
- /package/{app → dist}/styles/components/copy/snippet.scss +0 -0
- /package/{app → dist}/styles/components/disclosure-primitive.scss +0 -0
- /package/{app → dist}/styles/components/dismiss-button.scss +0 -0
- /package/{app → dist}/styles/components/dropdown.scss +0 -0
- /package/{app → dist}/styles/components/form/character-count.scss +0 -0
- /package/{app → dist}/styles/components/form/checkbox.scss +0 -0
- /package/{app → dist}/styles/components/form/error.scss +0 -0
- /package/{app → dist}/styles/components/form/field.scss +0 -0
- /package/{app → dist}/styles/components/form/file-input.scss +0 -0
- /package/{app → dist}/styles/components/form/group.scss +0 -0
- /package/{app → dist}/styles/components/form/helper-text.scss +0 -0
- /package/{app → dist}/styles/components/form/index.scss +0 -0
- /package/{app → dist}/styles/components/form/indicator.scss +0 -0
- /package/{app → dist}/styles/components/form/label.scss +0 -0
- /package/{app → dist}/styles/components/form/legend.scss +0 -0
- /package/{app → dist}/styles/components/form/masked-input.scss +0 -0
- /package/{app → dist}/styles/components/form/radio-card.scss +0 -0
- /package/{app → dist}/styles/components/form/radio.scss +0 -0
- /package/{app → dist}/styles/components/form/select.scss +0 -0
- /package/{app → dist}/styles/components/form/text-input.scss +0 -0
- /package/{app → dist}/styles/components/form/textarea.scss +0 -0
- /package/{app → dist}/styles/components/form/toggle.scss +0 -0
- /package/{app → dist}/styles/components/form/visibility-toggle.scss +0 -0
- /package/{app → dist}/styles/components/icon-tile.scss +0 -0
- /package/{app → dist}/styles/components/link/index.scss +0 -0
- /package/{app → dist}/styles/components/link/inline.scss +0 -0
- /package/{app → dist}/styles/components/link/standalone.scss +0 -0
- /package/{app → dist}/styles/components/menu-primitive.scss +0 -0
- /package/{app → dist}/styles/components/modal.scss +0 -0
- /package/{app → dist}/styles/components/page-header.scss +0 -0
- /package/{app → dist}/styles/components/pagination.scss +0 -0
- /package/{app → dist}/styles/components/reveal.scss +0 -0
- /package/{app → dist}/styles/components/segmented-group.scss +0 -0
- /package/{app → dist}/styles/components/separator.scss +0 -0
- /package/{app → dist}/styles/components/side-nav/a11y-refocus.scss +0 -0
- /package/{app → dist}/styles/components/side-nav/content.scss +0 -0
- /package/{app → dist}/styles/components/side-nav/header.scss +0 -0
- /package/{app → dist}/styles/components/side-nav/index.scss +0 -0
- /package/{app → dist}/styles/components/side-nav/main.scss +0 -0
- /package/{app → dist}/styles/components/side-nav/toggle-button.scss +0 -0
- /package/{app → dist}/styles/components/side-nav/vars.scss +0 -0
- /package/{app → dist}/styles/components/stepper/index.scss +0 -0
- /package/{app → dist}/styles/components/stepper/step-indicator.scss +0 -0
- /package/{app → dist}/styles/components/stepper/task-indicator.scss +0 -0
- /package/{app → dist}/styles/components/tag.scss +0 -0
- /package/{app → dist}/styles/components/text.scss +0 -0
- /package/{app → dist}/styles/components/toast.scss +0 -0
- /package/{app → dist}/styles/components/tooltip.scss +0 -0
- /package/{app → dist}/styles/mixins/_button.scss +0 -0
- /package/{app → dist}/styles/mixins/_focus-ring.scss +0 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { a as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../_rollupPluginBabelHelpers-lqPQKyNs.js';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
import { action } from '@ember/object';
|
|
5
|
+
import { assert, warn } from '@ember/debug';
|
|
6
|
+
import { schedule, next } from '@ember/runloop';
|
|
7
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
8
|
+
import { setComponentTemplate } from '@ember/component';
|
|
9
|
+
|
|
10
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n{{! template-lint-disable no-invalid-role }}\n<div\n class={{this.classNames}}\n {{did-insert this.didInsert}}\n {{did-update this.didUpdateSelectedTabIndex this.selectedTabIndex}}\n {{did-update this.didUpdateSelectedTabId this.selectedTabId}}\n {{did-update this.didUpdateParentVisibility @isParentVisible}}\n ...attributes\n>\n <div class=\"hds-tabs__tablist-wrapper\">\n <ul class=\"hds-tabs__tablist\" role=\"tablist\">\n {{yield\n (hash\n Tab=(component\n \"hds/tabs/tab\"\n didInsertNode=this.didInsertTab\n didUpdateNode=this.didUpdateTab\n willDestroyNode=this.willDestroyTab\n tabIds=this.tabIds\n selectedTabIndex=this.selectedTabIndex\n onClick=this.onClick\n onKeyUp=this.onKeyUp\n )\n )\n }}\n <li class=\"hds-tabs__tab-indicator\" role=\"presentation\"></li>\n </ul>\n </div>\n\n {{yield\n (hash\n Panel=(component\n \"hds/tabs/panel\"\n didInsertNode=this.didInsertPanel\n willDestroyNode=this.willDestroyPanel\n tabIds=this.tabIds\n panelIds=this.panelIds\n selectedTabIndex=this.selectedTabIndex\n )\n )\n }}\n</div>\n{{! template-lint-enable no-invalid-role }}");
|
|
11
|
+
|
|
12
|
+
var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7;
|
|
13
|
+
const DEFAULT_SIZE = 'medium';
|
|
14
|
+
const SIZES = ['medium', 'large'];
|
|
15
|
+
let HdsTabsIndexComponent = (_class = class HdsTabsIndexComponent extends Component {
|
|
16
|
+
/**
|
|
17
|
+
* Sets the size of Tabs
|
|
18
|
+
* Accepted values: medium, large
|
|
19
|
+
*
|
|
20
|
+
* @param size
|
|
21
|
+
* @type {string}
|
|
22
|
+
* @default 'medium'
|
|
23
|
+
*/
|
|
24
|
+
get size() {
|
|
25
|
+
let {
|
|
26
|
+
size = DEFAULT_SIZE
|
|
27
|
+
} = this.args;
|
|
28
|
+
assert(`@size for "Hds::Tabs" must be one of the following: ${SIZES.join(', ')}; received: ${size}`, SIZES.includes(size));
|
|
29
|
+
return size;
|
|
30
|
+
}
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
|
|
34
|
+
// this is to determine if the "selected" tab logic is controlled in the consumers' code or is maintained as an internal state
|
|
35
|
+
_initializerDefineProperty(this, "tabNodes", _descriptor, this);
|
|
36
|
+
_initializerDefineProperty(this, "tabIds", _descriptor2, this);
|
|
37
|
+
_initializerDefineProperty(this, "panelNodes", _descriptor3, this);
|
|
38
|
+
_initializerDefineProperty(this, "panelIds", _descriptor4, this);
|
|
39
|
+
_initializerDefineProperty(this, "_selectedTabIndex", _descriptor5, this);
|
|
40
|
+
_initializerDefineProperty(this, "selectedTabId", _descriptor6, this);
|
|
41
|
+
_initializerDefineProperty(this, "isControlled", _descriptor7, this);
|
|
42
|
+
this.isControlled = this.args.selectedTabIndex !== undefined;
|
|
43
|
+
}
|
|
44
|
+
get selectedTabIndex() {
|
|
45
|
+
if (this.isControlled) {
|
|
46
|
+
return this.args.selectedTabIndex;
|
|
47
|
+
} else {
|
|
48
|
+
return this._selectedTabIndex;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
set selectedTabIndex(value) {
|
|
52
|
+
if (this.isControlled) ; else {
|
|
53
|
+
this._selectedTabIndex = value;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get the class names to apply to the component.
|
|
59
|
+
* @method classNames
|
|
60
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
61
|
+
*/
|
|
62
|
+
get classNames() {
|
|
63
|
+
let classes = ['hds-tabs'];
|
|
64
|
+
|
|
65
|
+
// add a class based on the @size argument
|
|
66
|
+
classes.push(`hds-tabs--size-${this.size}`);
|
|
67
|
+
return classes.join(' ');
|
|
68
|
+
}
|
|
69
|
+
didInsert() {
|
|
70
|
+
assert('The number of Tabs must be equal to the number of Panels', this.tabNodes.length === this.panelNodes.length);
|
|
71
|
+
if (this.selectedTabId) {
|
|
72
|
+
this.selectedTabIndex = this.tabIds.indexOf(this.selectedTabId);
|
|
73
|
+
}
|
|
74
|
+
schedule('afterRender', () => {
|
|
75
|
+
this.setTabIndicator();
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
didUpdateSelectedTabIndex() {
|
|
79
|
+
schedule('afterRender', () => {
|
|
80
|
+
this.setTabIndicator();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
didUpdateSelectedTabId() {
|
|
84
|
+
// if the selected tab is set dynamically (eg. in a `each` loop)
|
|
85
|
+
// the `Tab` nodes will be re-inserted/rendered, which means the `this.selectedTabId` variable changes
|
|
86
|
+
// but the parent `Tabs` component has already been rendered/inserted but doesn't re-render
|
|
87
|
+
// so the value of the `selectedTabIndex` is not updated, unless we trigger a recalculation
|
|
88
|
+
// using the `did-update` modifier that checks for changes in the `this.selectedTabId` variable
|
|
89
|
+
if (this.selectedTabId) {
|
|
90
|
+
this.selectedTabIndex = this.tabIds.indexOf(this.selectedTabId);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
didUpdateParentVisibility() {
|
|
94
|
+
schedule('afterRender', () => {
|
|
95
|
+
this.setTabIndicator();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
didInsertTab(element, isSelected) {
|
|
99
|
+
this.tabNodes = [...this.tabNodes, element];
|
|
100
|
+
this.tabIds = [...this.tabIds, element.id];
|
|
101
|
+
if (isSelected) {
|
|
102
|
+
this.selectedTabId = element.id;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
didUpdateTab(tabIndex, isSelected) {
|
|
106
|
+
if (isSelected) {
|
|
107
|
+
this.selectedTabIndex = tabIndex;
|
|
108
|
+
}
|
|
109
|
+
this.setTabIndicator();
|
|
110
|
+
}
|
|
111
|
+
willDestroyTab(element) {
|
|
112
|
+
this.tabNodes = this.tabNodes.filter(node => node.id !== element.id);
|
|
113
|
+
this.tabIds = this.tabIds.filter(tabId => tabId !== element.id);
|
|
114
|
+
}
|
|
115
|
+
didInsertPanel(element, panelId) {
|
|
116
|
+
this.panelNodes = [...this.panelNodes, element];
|
|
117
|
+
this.panelIds = [...this.panelIds, panelId];
|
|
118
|
+
}
|
|
119
|
+
willDestroyPanel(element) {
|
|
120
|
+
this.panelNodes = this.panelNodes.filter(node => node.id !== element.id);
|
|
121
|
+
this.panelIds = this.panelIds.filter(panelId => panelId !== element.id);
|
|
122
|
+
}
|
|
123
|
+
onClick(event, tabIndex) {
|
|
124
|
+
this.selectedTabIndex = tabIndex;
|
|
125
|
+
this.setTabIndicator();
|
|
126
|
+
|
|
127
|
+
// invoke the callback function if it's provided as argument
|
|
128
|
+
if (typeof this.args.onClickTab === 'function') {
|
|
129
|
+
this.args.onClickTab(event, tabIndex);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
onKeyUp(tabIndex, event) {
|
|
133
|
+
const leftArrow = 37;
|
|
134
|
+
const rightArrow = 39;
|
|
135
|
+
const enterKey = 13;
|
|
136
|
+
const spaceKey = 32;
|
|
137
|
+
if (event.keyCode === rightArrow) {
|
|
138
|
+
const nextTabIndex = (tabIndex + 1) % this.tabIds.length;
|
|
139
|
+
this.focusTab(nextTabIndex, event);
|
|
140
|
+
} else if (event.keyCode === leftArrow) {
|
|
141
|
+
const prevTabIndex = (tabIndex + this.tabIds.length - 1) % this.tabIds.length;
|
|
142
|
+
this.focusTab(prevTabIndex, event);
|
|
143
|
+
} else if (event.keyCode === enterKey || event.keyCode === spaceKey) {
|
|
144
|
+
this.selectedTabIndex = tabIndex;
|
|
145
|
+
}
|
|
146
|
+
// scroll selected tab into view (it may be out of view when activated using a keyboard with `prev/next`)
|
|
147
|
+
this.tabNodes[this.selectedTabIndex].parentNode.scrollIntoView({
|
|
148
|
+
behavior: 'smooth',
|
|
149
|
+
block: 'nearest',
|
|
150
|
+
inline: 'nearest'
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Focus tab for keyboard & mouse navigation:
|
|
155
|
+
focusTab(tabIndex, e) {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
this.tabNodes[tabIndex].focus();
|
|
158
|
+
}
|
|
159
|
+
setSelectedPanelFocus(tabIndex, e) {
|
|
160
|
+
e.preventDefault();
|
|
161
|
+
this.panelNodes[tabIndex].focus();
|
|
162
|
+
}
|
|
163
|
+
setTabIndicator() {
|
|
164
|
+
next(() => {
|
|
165
|
+
const tabElem = this.tabNodes[this.selectedTabIndex];
|
|
166
|
+
if (tabElem) {
|
|
167
|
+
const tabsParentElem = tabElem.closest('.hds-tabs__tablist');
|
|
168
|
+
|
|
169
|
+
// this condition is `null` if any of the parents has `display: none`
|
|
170
|
+
if (tabElem.parentNode.offsetParent) {
|
|
171
|
+
const tabLeftPos = tabElem.parentNode.offsetLeft;
|
|
172
|
+
const tabWidth = tabElem.parentNode.offsetWidth;
|
|
173
|
+
|
|
174
|
+
// Set CSS custom properties for indicator
|
|
175
|
+
tabsParentElem.style.setProperty('--indicator-left-pos', tabLeftPos + 'px');
|
|
176
|
+
tabsParentElem.style.setProperty('--indicator-width', tabWidth + 'px');
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
let message;
|
|
180
|
+
message += '"Hds::Tabs" has tried to set the indicator for an element that doesn\'t exist';
|
|
181
|
+
if (this.tabNodes.length === 0) {
|
|
182
|
+
message += ' (the array `this.tabNodes` is empty, there are no tabs, probably already destroyed)';
|
|
183
|
+
} else {
|
|
184
|
+
message += ` (the value ${this.selectedTabIndex} of \`this.selectedTabIndex\` is out of bound for the array \`this.tabNodes\`, whose index range is [0 - ${this.tabNodes.length - 1}])`;
|
|
185
|
+
}
|
|
186
|
+
// https://api.emberjs.com/ember/5.3/classes/@ember%2Fdebug/methods/warn?anchor=warn
|
|
187
|
+
warn(message, true, {
|
|
188
|
+
id: 'hds-debug.tabs.setTabIndicator-tabElem-not-available'
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "tabNodes", [tracked], {
|
|
194
|
+
configurable: true,
|
|
195
|
+
enumerable: true,
|
|
196
|
+
writable: true,
|
|
197
|
+
initializer: function () {
|
|
198
|
+
return [];
|
|
199
|
+
}
|
|
200
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "tabIds", [tracked], {
|
|
201
|
+
configurable: true,
|
|
202
|
+
enumerable: true,
|
|
203
|
+
writable: true,
|
|
204
|
+
initializer: function () {
|
|
205
|
+
return [];
|
|
206
|
+
}
|
|
207
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "panelNodes", [tracked], {
|
|
208
|
+
configurable: true,
|
|
209
|
+
enumerable: true,
|
|
210
|
+
writable: true,
|
|
211
|
+
initializer: function () {
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "panelIds", [tracked], {
|
|
215
|
+
configurable: true,
|
|
216
|
+
enumerable: true,
|
|
217
|
+
writable: true,
|
|
218
|
+
initializer: function () {
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
}), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "_selectedTabIndex", [tracked], {
|
|
222
|
+
configurable: true,
|
|
223
|
+
enumerable: true,
|
|
224
|
+
writable: true,
|
|
225
|
+
initializer: function () {
|
|
226
|
+
return this.args.selectedTabIndex ?? 0;
|
|
227
|
+
}
|
|
228
|
+
}), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "selectedTabId", [tracked], {
|
|
229
|
+
configurable: true,
|
|
230
|
+
enumerable: true,
|
|
231
|
+
writable: true,
|
|
232
|
+
initializer: null
|
|
233
|
+
}), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, "isControlled", [tracked], {
|
|
234
|
+
configurable: true,
|
|
235
|
+
enumerable: true,
|
|
236
|
+
writable: true,
|
|
237
|
+
initializer: null
|
|
238
|
+
}), _applyDecoratedDescriptor(_class.prototype, "didInsert", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didInsert"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "didUpdateSelectedTabIndex", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didUpdateSelectedTabIndex"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "didUpdateSelectedTabId", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didUpdateSelectedTabId"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "didUpdateParentVisibility", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didUpdateParentVisibility"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "didInsertTab", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didInsertTab"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "didUpdateTab", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didUpdateTab"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "willDestroyTab", [action], Object.getOwnPropertyDescriptor(_class.prototype, "willDestroyTab"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "didInsertPanel", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didInsertPanel"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "willDestroyPanel", [action], Object.getOwnPropertyDescriptor(_class.prototype, "willDestroyPanel"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onClick"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onKeyUp", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onKeyUp"), _class.prototype)), _class);
|
|
239
|
+
setComponentTemplate(TEMPLATE, HdsTabsIndexComponent);
|
|
240
|
+
|
|
241
|
+
export { DEFAULT_SIZE, SIZES, HdsTabsIndexComponent as default };
|
|
242
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/tabs/index.hbs","../../../../src/components/hds/tabs/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n{{! template-lint-disable no-invalid-role }}\\n<div\\n class={{this.classNames}}\\n {{did-insert this.didInsert}}\\n {{did-update this.didUpdateSelectedTabIndex this.selectedTabIndex}}\\n {{did-update this.didUpdateSelectedTabId this.selectedTabId}}\\n {{did-update this.didUpdateParentVisibility @isParentVisible}}\\n ...attributes\\n>\\n <div class=\\\"hds-tabs__tablist-wrapper\\\">\\n <ul class=\\\"hds-tabs__tablist\\\" role=\\\"tablist\\\">\\n {{yield\\n (hash\\n Tab=(component\\n \\\"hds/tabs/tab\\\"\\n didInsertNode=this.didInsertTab\\n didUpdateNode=this.didUpdateTab\\n willDestroyNode=this.willDestroyTab\\n tabIds=this.tabIds\\n selectedTabIndex=this.selectedTabIndex\\n onClick=this.onClick\\n onKeyUp=this.onKeyUp\\n )\\n )\\n }}\\n <li class=\\\"hds-tabs__tab-indicator\\\" role=\\\"presentation\\\"></li>\\n </ul>\\n </div>\\n\\n {{yield\\n (hash\\n Panel=(component\\n \\\"hds/tabs/panel\\\"\\n didInsertNode=this.didInsertPanel\\n willDestroyNode=this.willDestroyPanel\\n tabIds=this.tabIds\\n panelIds=this.panelIds\\n selectedTabIndex=this.selectedTabIndex\\n )\\n )\\n }}\\n</div>\\n{{! template-lint-enable no-invalid-role }}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert, warn } from '@ember/debug';\nimport { next, schedule } from '@ember/runloop';\n\nexport const DEFAULT_SIZE = 'medium';\nexport const SIZES = ['medium', 'large'];\n\nexport default class HdsTabsIndexComponent extends Component {\n @tracked tabNodes = [];\n @tracked tabIds = [];\n @tracked panelNodes = [];\n @tracked panelIds = [];\n @tracked _selectedTabIndex = this.args.selectedTabIndex ?? 0;\n @tracked selectedTabId;\n @tracked isControlled;\n\n /**\n * Sets the size of Tabs\n * Accepted values: medium, large\n *\n * @param size\n * @type {string}\n * @default 'medium'\n */\n get size() {\n let { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Tabs\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n constructor() {\n super(...arguments);\n\n // this is to determine if the \"selected\" tab logic is controlled in the consumers' code or is maintained as an internal state\n this.isControlled = this.args.selectedTabIndex !== undefined;\n }\n\n get selectedTabIndex() {\n if (this.isControlled) {\n return this.args.selectedTabIndex;\n } else {\n return this._selectedTabIndex;\n }\n }\n\n set selectedTabIndex(value) {\n if (this.isControlled) {\n // noop\n } else {\n this._selectedTabIndex = value;\n }\n }\n\n /**\n * Get the class names to apply to the component.\n * @method classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n let classes = ['hds-tabs'];\n\n // add a class based on the @size argument\n classes.push(`hds-tabs--size-${this.size}`);\n\n return classes.join(' ');\n }\n\n @action\n didInsert() {\n assert(\n 'The number of Tabs must be equal to the number of Panels',\n this.tabNodes.length === this.panelNodes.length\n );\n\n if (this.selectedTabId) {\n this.selectedTabIndex = this.tabIds.indexOf(this.selectedTabId);\n }\n\n schedule('afterRender', () => {\n this.setTabIndicator();\n });\n }\n\n @action\n didUpdateSelectedTabIndex() {\n schedule('afterRender', () => {\n this.setTabIndicator();\n });\n }\n\n @action\n didUpdateSelectedTabId() {\n // if the selected tab is set dynamically (eg. in a `each` loop)\n // the `Tab` nodes will be re-inserted/rendered, which means the `this.selectedTabId` variable changes\n // but the parent `Tabs` component has already been rendered/inserted but doesn't re-render\n // so the value of the `selectedTabIndex` is not updated, unless we trigger a recalculation\n // using the `did-update` modifier that checks for changes in the `this.selectedTabId` variable\n if (this.selectedTabId) {\n this.selectedTabIndex = this.tabIds.indexOf(this.selectedTabId);\n }\n }\n\n @action\n didUpdateParentVisibility() {\n schedule('afterRender', () => {\n this.setTabIndicator();\n });\n }\n\n @action\n didInsertTab(element, isSelected) {\n this.tabNodes = [...this.tabNodes, element];\n this.tabIds = [...this.tabIds, element.id];\n if (isSelected) {\n this.selectedTabId = element.id;\n }\n }\n\n @action\n didUpdateTab(tabIndex, isSelected) {\n if (isSelected) {\n this.selectedTabIndex = tabIndex;\n }\n this.setTabIndicator();\n }\n\n @action\n willDestroyTab(element) {\n this.tabNodes = this.tabNodes.filter((node) => node.id !== element.id);\n this.tabIds = this.tabIds.filter((tabId) => tabId !== element.id);\n }\n\n @action\n didInsertPanel(element, panelId) {\n this.panelNodes = [...this.panelNodes, element];\n this.panelIds = [...this.panelIds, panelId];\n }\n\n @action\n willDestroyPanel(element) {\n this.panelNodes = this.panelNodes.filter((node) => node.id !== element.id);\n this.panelIds = this.panelIds.filter((panelId) => panelId !== element.id);\n }\n\n @action\n onClick(event, tabIndex) {\n this.selectedTabIndex = tabIndex;\n this.setTabIndicator();\n\n // invoke the callback function if it's provided as argument\n if (typeof this.args.onClickTab === 'function') {\n this.args.onClickTab(event, tabIndex);\n }\n }\n\n @action\n onKeyUp(tabIndex, event) {\n const leftArrow = 37;\n const rightArrow = 39;\n const enterKey = 13;\n const spaceKey = 32;\n\n if (event.keyCode === rightArrow) {\n const nextTabIndex = (tabIndex + 1) % this.tabIds.length;\n this.focusTab(nextTabIndex, event);\n } else if (event.keyCode === leftArrow) {\n const prevTabIndex =\n (tabIndex + this.tabIds.length - 1) % this.tabIds.length;\n this.focusTab(prevTabIndex, event);\n } else if (event.keyCode === enterKey || event.keyCode === spaceKey) {\n this.selectedTabIndex = tabIndex;\n }\n // scroll selected tab into view (it may be out of view when activated using a keyboard with `prev/next`)\n this.tabNodes[this.selectedTabIndex].parentNode.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n\n // Focus tab for keyboard & mouse navigation:\n focusTab(tabIndex, e) {\n e.preventDefault();\n this.tabNodes[tabIndex].focus();\n }\n\n setSelectedPanelFocus(tabIndex, e) {\n e.preventDefault();\n this.panelNodes[tabIndex].focus();\n }\n\n setTabIndicator() {\n next(() => {\n const tabElem = this.tabNodes[this.selectedTabIndex];\n\n if (tabElem) {\n const tabsParentElem = tabElem.closest('.hds-tabs__tablist');\n\n // this condition is `null` if any of the parents has `display: none`\n if (tabElem.parentNode.offsetParent) {\n const tabLeftPos = tabElem.parentNode.offsetLeft;\n const tabWidth = tabElem.parentNode.offsetWidth;\n\n // Set CSS custom properties for indicator\n tabsParentElem.style.setProperty(\n '--indicator-left-pos',\n tabLeftPos + 'px'\n );\n tabsParentElem.style.setProperty(\n '--indicator-width',\n tabWidth + 'px'\n );\n }\n } else {\n let message;\n message +=\n '\"Hds::Tabs\" has tried to set the indicator for an element that doesn\\'t exist';\n if (this.tabNodes.length === 0) {\n message +=\n ' (the array `this.tabNodes` is empty, there are no tabs, probably already destroyed)';\n } else {\n message += ` (the value ${\n this.selectedTabIndex\n } of \\`this.selectedTabIndex\\` is out of bound for the array \\`this.tabNodes\\`, whose index range is [0 - ${\n this.tabNodes.length - 1\n }])`;\n }\n // https://api.emberjs.com/ember/5.3/classes/@ember%2Fdebug/methods/warn?anchor=warn\n warn(message, true, {\n id: 'hds-debug.tabs.setTabIndicator-tabElem-not-available',\n });\n }\n });\n }\n}\n"],"names":["DEFAULT_SIZE","SIZES","HdsTabsIndexComponent","_class","Component","size","args","assert","join","includes","constructor","arguments","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","_descriptor4","_descriptor5","_descriptor6","_descriptor7","isControlled","selectedTabIndex","undefined","_selectedTabIndex","value","classNames","classes","push","didInsert","tabNodes","length","panelNodes","selectedTabId","tabIds","indexOf","schedule","setTabIndicator","didUpdateSelectedTabIndex","didUpdateSelectedTabId","didUpdateParentVisibility","didInsertTab","element","isSelected","id","didUpdateTab","tabIndex","willDestroyTab","filter","node","tabId","didInsertPanel","panelId","panelIds","willDestroyPanel","onClick","event","onClickTab","onKeyUp","leftArrow","rightArrow","enterKey","spaceKey","keyCode","nextTabIndex","focusTab","prevTabIndex","parentNode","scrollIntoView","behavior","block","inline","e","preventDefault","focus","setSelectedPanelFocus","next","tabElem","tabsParentElem","closest","offsetParent","tabLeftPos","offsetLeft","tabWidth","offsetWidth","style","setProperty","message","warn","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,w1CAAw1C;;;ACUn3C,MAAMA,YAAY,GAAG,SAAQ;MACvBC,KAAK,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAC;AAEnBC,IAAAA,qBAAqB,IAAAC,MAAA,GAA3B,MAAMD,qBAAqB,SAASE,SAAS,CAAC;AAS3D;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAG;IACT,IAAI;AAAEA,MAAAA,IAAI,GAAGL,YAAAA;KAAc,GAAG,IAAI,CAACM,IAAI,CAAA;AAEvCC,IAAAA,MAAM,CACH,CAAsDN,oDAAAA,EAAAA,KAAK,CAACO,IAAI,CAC/D,IACF,CAAE,CAAA,YAAA,EAAcH,IAAK,CAAA,CAAC,EACtBJ,KAAK,CAACQ,QAAQ,CAACJ,I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,MAAA,CAAAsF,SAAA,EAAA,kBAAA,EAAA,CAMNM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAA9F,MAAA,CAAAsF,SAAA,EAAA,kBAAA,CAAA,EAAAtF,MAAA,CAAAsF,SAAA,CAAA,EAAAD,yBAAA,CAAArF,MAAA,CAAAsF,SAAA,EAMNM,SAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAA9F,MAAA,CAAAsF,SAAA,EAAAtF,SAAAA,CAAAA,EAAAA,MAAA,CAAAsF,SAAA,CAAAD,EAAAA,yBAAA,CAAArF,MAAA,CAAAsF,SAAA,EAAA,SAAA,EAAA,CAWNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAA9F,MAAA,CAAAsF,SAAA,cAAAtF,MAAA,CAAAsF,SAAA,CAAA,GAAAtF,MAAA,EAAA;AA3JiC+F,oBAAA,CAAAC,QAAA,EAAAjG,qBAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { a as _applyDecoratedDescriptor, _ as _defineProperty } from '../../../_rollupPluginBabelHelpers-lqPQKyNs.js';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { guidFor } from '@ember/object/internals';
|
|
4
|
+
import { action } from '@ember/object';
|
|
5
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
|
+
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
|
|
8
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<section\n class=\"hds-tabs__panel\"\n ...attributes\n role=\"tabpanel\"\n id={{this.panelId}}\n hidden={{not this.isVisible}}\n aria-labelledby={{this.coupledTabId}}\n {{did-insert this.didInsertNode}}\n {{will-destroy this.willDestroyNode}}\n>\n {{yield (hash isVisible=this.isVisible)}}\n</section>");
|
|
9
|
+
|
|
10
|
+
var _class;
|
|
11
|
+
let HdsTabsPanelComponent = (_class = class HdsTabsPanelComponent extends Component {
|
|
12
|
+
constructor(...args) {
|
|
13
|
+
super(...args);
|
|
14
|
+
/**
|
|
15
|
+
* Generate a unique ID for the Panel
|
|
16
|
+
* @return {string}
|
|
17
|
+
*/
|
|
18
|
+
_defineProperty(this, "panelId", 'panel-' + guidFor(this));
|
|
19
|
+
}
|
|
20
|
+
get nodeIndex() {
|
|
21
|
+
return this.args.panelIds ? this.args.panelIds.indexOf(this.panelId) : undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Check the condition if the panel is visible (because the coupled/associated tab is selected) or not
|
|
26
|
+
* @returns {boolean}
|
|
27
|
+
*/
|
|
28
|
+
get isVisible() {
|
|
29
|
+
return this.nodeIndex === this.args.selectedTabIndex;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Get the ID of the tab coupled/associated with the panel (it's used by the `aria-labelledby` attribute)
|
|
34
|
+
* @returns string}
|
|
35
|
+
*/
|
|
36
|
+
get coupledTabId() {
|
|
37
|
+
return this.nodeIndex !== undefined ? this.args.tabIds[this.nodeIndex] : undefined;
|
|
38
|
+
}
|
|
39
|
+
didInsertNode(element) {
|
|
40
|
+
let {
|
|
41
|
+
didInsertNode
|
|
42
|
+
} = this.args;
|
|
43
|
+
if (typeof didInsertNode === 'function') {
|
|
44
|
+
this.elementId = element.id;
|
|
45
|
+
didInsertNode(element, this.elementId);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
willDestroyNode(element) {
|
|
49
|
+
let {
|
|
50
|
+
willDestroyNode
|
|
51
|
+
} = this.args;
|
|
52
|
+
if (typeof willDestroyNode === 'function') {
|
|
53
|
+
willDestroyNode(element);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, (_applyDecoratedDescriptor(_class.prototype, "didInsertNode", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didInsertNode"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "willDestroyNode", [action], Object.getOwnPropertyDescriptor(_class.prototype, "willDestroyNode"), _class.prototype)), _class);
|
|
57
|
+
setComponentTemplate(TEMPLATE, HdsTabsPanelComponent);
|
|
58
|
+
|
|
59
|
+
export { HdsTabsPanelComponent as default };
|
|
60
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.js","sources":["../../../../src/components/hds/tabs/panel.hbs","../../../../src/components/hds/tabs/panel.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<section\\n class=\\\"hds-tabs__panel\\\"\\n ...attributes\\n role=\\\"tabpanel\\\"\\n id={{this.panelId}}\\n hidden={{not this.isVisible}}\\n aria-labelledby={{this.coupledTabId}}\\n {{did-insert this.didInsertNode}}\\n {{will-destroy this.willDestroyNode}}\\n>\\n {{yield (hash isVisible=this.isVisible)}}\\n</section>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { guidFor } from '@ember/object/internals';\nimport { action } from '@ember/object';\n\nexport default class HdsTabsPanelComponent extends Component {\n /**\n * Generate a unique ID for the Panel\n * @return {string}\n */\n panelId = 'panel-' + guidFor(this);\n\n get nodeIndex() {\n return this.args.panelIds\n ? this.args.panelIds.indexOf(this.panelId)\n : undefined;\n }\n\n /**\n * Check the condition if the panel is visible (because the coupled/associated tab is selected) or not\n * @returns {boolean}\n */\n get isVisible() {\n return this.nodeIndex === this.args.selectedTabIndex;\n }\n\n /**\n * Get the ID of the tab coupled/associated with the panel (it's used by the `aria-labelledby` attribute)\n * @returns string}\n */\n get coupledTabId() {\n return this.nodeIndex !== undefined\n ? this.args.tabIds[this.nodeIndex]\n : undefined;\n }\n\n @action\n didInsertNode(element) {\n let { didInsertNode } = this.args;\n\n if (typeof didInsertNode === 'function') {\n this.elementId = element.id;\n didInsertNode(element, this.elementId);\n }\n }\n\n @action\n willDestroyNode(element) {\n let { willDestroyNode } = this.args;\n\n if (typeof willDestroyNode === 'function') {\n willDestroyNode(element);\n }\n }\n}\n"],"names":["HdsTabsPanelComponent","_class","Component","constructor","args","_defineProperty","guidFor","nodeIndex","panelIds","indexOf","panelId","undefined","isVisible","selectedTabIndex","coupledTabId","tabIds","didInsertNode","element","elementId","id","willDestroyNode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,sYAAsY;;;ACQnZA,IAAAA,qBAAqB,IAAAC,MAAA,GAA3B,MAAMD,qBAAqB,SAASE,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAC3D;AACF;AACA;AACA;AAHEC,IAAAA,eAAA,kBAIU,QAAQ,GAAGC,OAAO,CAAC,IAAI,CAAC,CAAA,CAAA;AAAA,GAAA;EAElC,IAAIC,SAASA,GAAG;AACd,IAAA,OAAO,IAAI,CAACH,IAAI,CAACI,QAAQ,GACrB,IAAI,CAACJ,IAAI,CAACI,QAAQ,CAACC,OAAO,CAAC,IAAI,CAACC,OAAO,CAAC,GACxCC,SAAS,CAAA;AACf,GAAA;;AAEA;AACF;AACA;AACA;EACE,IAAIC,SAASA,GAAG;IACd,OAAO,IAAI,CAACL,SAAS,KAAK,IAAI,CAACH,IAAI,CAACS,gBAAgB,CAAA;AACtD,GAAA;;AAEA;AACF;AACA;AACA;EACE,IAAIC,YAAYA,GAAG;AACjB,IAAA,OAAO,IAAI,CAACP,SAAS,KAAKI,SAAS,GAC/B,IAAI,CAACP,IAAI,CAACW,MAAM,CAAC,IAAI,CAACR,SAAS,CAAC,GAChCI,SAAS,CAAA;AACf,GAAA;EAGAK,aAAaA,CAACC,OAAO,EAAE;IACrB,IAAI;AAAED,MAAAA,aAAAA;KAAe,GAAG,IAAI,CAACZ,IAAI,CAAA;AAEjC,IAAA,IAAI,OAAOY,aAAa,KAAK,UAAU,EAAE;AACvC,MAAA,IAAI,CAACE,SAAS,GAAGD,OAAO,CAACE,EAAE,CAAA;AAC3BH,MAAAA,aAAa,CAACC,OAAO,EAAE,IAAI,CAACC,SAAS,CAAC,CAAA;AACxC,KAAA;AACF,GAAA;EAGAE,eAAeA,CAACH,OAAO,EAAE;IACvB,IAAI;AAAEG,MAAAA,eAAAA;KAAiB,GAAG,IAAI,CAAChB,IAAI,CAAA;AAEnC,IAAA,IAAI,OAAOgB,eAAe,KAAK,UAAU,EAAE;MACzCA,eAAe,CAACH,OAAO,CAAC,CAAA;AAC1B,KAAA;AACF,GAAA;AACF,CAAC,GAAAI,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,oBAlBEC,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAxB,MAAA,CAAAqB,SAAA,EAAA,eAAA,CAAA,EAAArB,MAAA,CAAAqB,SAAA,CAAAD,EAAAA,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,EAUNC,iBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAxB,MAAA,CAAAqB,SAAA,EAAA,iBAAA,CAAA,EAAArB,MAAA,CAAAqB,SAAA,IAAArB,MAAA,EAAA;AAzCiCyB,oBAAA,CAAAC,QAAA,EAAA3B,qBAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { a as _applyDecoratedDescriptor, _ as _defineProperty } from '../../../_rollupPluginBabelHelpers-lqPQKyNs.js';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { guidFor } from '@ember/object/internals';
|
|
4
|
+
import { action } from '@ember/object';
|
|
5
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
|
+
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
|
|
8
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n{{! template-lint-disable require-context-role no-invalid-role }}\n<li class={{this.classNames}} ...attributes role=\"presentation\">\n <button\n class=\"hds-tabs__tab-button\"\n role=\"tab\"\n type=\"button\"\n id={{this.tabId}}\n aria-selected={{if this.isSelected \"true\" \"false\"}}\n tabindex={{unless this.isSelected \"-1\"}}\n {{did-insert this.didInsertNode @isSelected}}\n {{did-update this.didUpdateNode @count @isSelected}}\n {{will-destroy this.willDestroyNode}}\n {{on \"click\" this.onClick}}\n {{on \"keyup\" this.onKeyUp}}\n >\n {{#if @icon}}\n <FlightIcon @name={{@icon}} class=\"hds-tabs__tab-icon\" role=\"presentation\" />\n {{/if}}\n\n {{yield}}\n\n {{#if @count}}\n <Hds::BadgeCount @text={{@count}} @size=\"small\" class=\"hds-tabs__tab-count\" role=\"presentation\" />\n {{/if}}\n </button>\n</li>\n{{! template-lint-enable require-context-role no-invalid-role }}");
|
|
9
|
+
|
|
10
|
+
var _class;
|
|
11
|
+
let HdsTabsTabComponent = (_class = class HdsTabsTabComponent extends Component {
|
|
12
|
+
constructor(...args) {
|
|
13
|
+
super(...args);
|
|
14
|
+
/**
|
|
15
|
+
* Generate a unique ID for the Tab
|
|
16
|
+
* @return {string}
|
|
17
|
+
*/
|
|
18
|
+
_defineProperty(this, "tabId", 'tab-' + guidFor(this));
|
|
19
|
+
}
|
|
20
|
+
get nodeIndex() {
|
|
21
|
+
return this.args.tabIds ? this.args.tabIds.indexOf(this.tabId) : undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Determine if the tab is the selected tab
|
|
26
|
+
* @return {boolean}
|
|
27
|
+
* @default false (1st tab is selected by default)
|
|
28
|
+
*/
|
|
29
|
+
get isSelected() {
|
|
30
|
+
return this.nodeIndex !== undefined && this.nodeIndex === this.args.selectedTabIndex;
|
|
31
|
+
}
|
|
32
|
+
didInsertNode(element, positional) {
|
|
33
|
+
let {
|
|
34
|
+
didInsertNode
|
|
35
|
+
} = this.args;
|
|
36
|
+
const isSelected = positional[0];
|
|
37
|
+
if (typeof didInsertNode === 'function') {
|
|
38
|
+
didInsertNode(element, isSelected);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
didUpdateNode() {
|
|
42
|
+
let {
|
|
43
|
+
didUpdateNode
|
|
44
|
+
} = this.args;
|
|
45
|
+
if (typeof didUpdateNode === 'function') {
|
|
46
|
+
didUpdateNode(this.nodeIndex, this.args.isSelected);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
willDestroyNode(element) {
|
|
50
|
+
let {
|
|
51
|
+
willDestroyNode
|
|
52
|
+
} = this.args;
|
|
53
|
+
if (typeof willDestroyNode === 'function') {
|
|
54
|
+
willDestroyNode(element);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
onClick(event) {
|
|
58
|
+
let {
|
|
59
|
+
onClick
|
|
60
|
+
} = this.args;
|
|
61
|
+
if (typeof onClick === 'function') {
|
|
62
|
+
onClick(event, this.nodeIndex);
|
|
63
|
+
} else {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
onKeyUp(event) {
|
|
68
|
+
let {
|
|
69
|
+
onKeyUp
|
|
70
|
+
} = this.args;
|
|
71
|
+
if (typeof onKeyUp === 'function') {
|
|
72
|
+
onKeyUp(this.nodeIndex, event);
|
|
73
|
+
} else {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get the class names to apply to the component.
|
|
80
|
+
* @method classNames
|
|
81
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
82
|
+
*/
|
|
83
|
+
get classNames() {
|
|
84
|
+
let classes = ['hds-tabs__tab'];
|
|
85
|
+
if (this.isSelected) {
|
|
86
|
+
classes.push(`hds-tabs__tab--is-selected`);
|
|
87
|
+
}
|
|
88
|
+
return classes.join(' ');
|
|
89
|
+
}
|
|
90
|
+
}, (_applyDecoratedDescriptor(_class.prototype, "didInsertNode", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didInsertNode"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "didUpdateNode", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didUpdateNode"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "willDestroyNode", [action], Object.getOwnPropertyDescriptor(_class.prototype, "willDestroyNode"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onClick"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onKeyUp", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onKeyUp"), _class.prototype)), _class);
|
|
91
|
+
setComponentTemplate(TEMPLATE, HdsTabsTabComponent);
|
|
92
|
+
|
|
93
|
+
export { HdsTabsTabComponent as default };
|
|
94
|
+
//# sourceMappingURL=tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab.js","sources":["../../../../src/components/hds/tabs/tab.hbs","../../../../src/components/hds/tabs/tab.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n{{! template-lint-disable require-context-role no-invalid-role }}\\n<li class={{this.classNames}} ...attributes role=\\\"presentation\\\">\\n <button\\n class=\\\"hds-tabs__tab-button\\\"\\n role=\\\"tab\\\"\\n type=\\\"button\\\"\\n id={{this.tabId}}\\n aria-selected={{if this.isSelected \\\"true\\\" \\\"false\\\"}}\\n tabindex={{unless this.isSelected \\\"-1\\\"}}\\n {{did-insert this.didInsertNode @isSelected}}\\n {{did-update this.didUpdateNode @count @isSelected}}\\n {{will-destroy this.willDestroyNode}}\\n {{on \\\"click\\\" this.onClick}}\\n {{on \\\"keyup\\\" this.onKeyUp}}\\n >\\n {{#if @icon}}\\n <FlightIcon @name={{@icon}} class=\\\"hds-tabs__tab-icon\\\" role=\\\"presentation\\\" />\\n {{/if}}\\n\\n {{yield}}\\n\\n {{#if @count}}\\n <Hds::BadgeCount @text={{@count}} @size=\\\"small\\\" class=\\\"hds-tabs__tab-count\\\" role=\\\"presentation\\\" />\\n {{/if}}\\n </button>\\n</li>\\n{{! template-lint-enable require-context-role no-invalid-role }}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { guidFor } from '@ember/object/internals';\nimport { action } from '@ember/object';\n\nexport default class HdsTabsTabComponent extends Component {\n /**\n * Generate a unique ID for the Tab\n * @return {string}\n */\n tabId = 'tab-' + guidFor(this);\n\n get nodeIndex() {\n return this.args.tabIds ? this.args.tabIds.indexOf(this.tabId) : undefined;\n }\n\n /**\n * Determine if the tab is the selected tab\n * @return {boolean}\n * @default false (1st tab is selected by default)\n */\n get isSelected() {\n return (\n this.nodeIndex !== undefined &&\n this.nodeIndex === this.args.selectedTabIndex\n );\n }\n\n @action\n didInsertNode(element, positional) {\n let { didInsertNode } = this.args;\n\n const isSelected = positional[0];\n\n if (typeof didInsertNode === 'function') {\n didInsertNode(element, isSelected);\n }\n }\n\n @action\n didUpdateNode() {\n let { didUpdateNode } = this.args;\n\n if (typeof didUpdateNode === 'function') {\n didUpdateNode(this.nodeIndex, this.args.isSelected);\n }\n }\n\n @action\n willDestroyNode(element) {\n let { willDestroyNode } = this.args;\n\n if (typeof willDestroyNode === 'function') {\n willDestroyNode(element);\n }\n }\n\n @action\n onClick(event) {\n let { onClick } = this.args;\n\n if (typeof onClick === 'function') {\n onClick(event, this.nodeIndex);\n } else {\n return false;\n }\n }\n\n @action\n onKeyUp(event) {\n let { onKeyUp } = this.args;\n\n if (typeof onKeyUp === 'function') {\n onKeyUp(this.nodeIndex, event);\n } else {\n return false;\n }\n }\n\n /**\n * Get the class names to apply to the component.\n * @method classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n let classes = ['hds-tabs__tab'];\n\n if (this.isSelected) {\n classes.push(`hds-tabs__tab--is-selected`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["HdsTabsTabComponent","_class","Component","constructor","args","_defineProperty","guidFor","nodeIndex","tabIds","indexOf","tabId","undefined","isSelected","selectedTabIndex","didInsertNode","element","positional","didUpdateNode","willDestroyNode","onClick","event","onKeyUp","classNames","classes","push","join","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,qgCAAqgC;;;ACQlhCA,IAAAA,mBAAmB,IAAAC,MAAA,GAAzB,MAAMD,mBAAmB,SAASE,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AACzD;AACF;AACA;AACA;AAHEC,IAAAA,eAAA,gBAIQ,MAAM,GAAGC,OAAO,CAAC,IAAI,CAAC,CAAA,CAAA;AAAA,GAAA;EAE9B,IAAIC,SAASA,GAAG;AACd,IAAA,OAAO,IAAI,CAACH,IAAI,CAACI,MAAM,GAAG,IAAI,CAACJ,IAAI,CAACI,MAAM,CAACC,OAAO,CAAC,IAAI,CAACC,KAAK,CAAC,GAAGC,SAAS,CAAA;AAC5E,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,UAAUA,GAAG;AACf,IAAA,OACE,IAAI,CAACL,SAAS,KAAKI,SAAS,IAC5B,IAAI,CAACJ,SAAS,KAAK,IAAI,CAACH,IAAI,CAACS,gBAAgB,CAAA;AAEjD,GAAA;AAGAC,EAAAA,aAAaA,CAACC,OAAO,EAAEC,UAAU,EAAE;IACjC,IAAI;AAAEF,MAAAA,aAAAA;KAAe,GAAG,IAAI,CAACV,IAAI,CAAA;AAEjC,IAAA,MAA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CAAAC,QAAA,EAAAhC,mBAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
|
+
import { setComponentTemplate } from '@ember/component';
|
|
5
|
+
|
|
6
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Text::Body class={{this.classNames}} @tag=\"span\" @size=\"100\" @weight=\"medium\" @color=\"primary\" ...attributes>\n {{#if this.onDismiss}}\n <button class=\"hds-tag__dismiss\" type=\"button\" aria-label={{this.ariaLabel}} {{on \"click\" this.onDismiss}}>\n <FlightIcon class=\"hds-tag__dismiss-icon\" @name=\"x\" @size=\"16\" @isInlineBlock={{false}} />\n </button>\n {{/if}}\n {{#if (or @href @route)}}\n <Hds::Interactive\n class=\"hds-tag__link\"\n @current-when={{@current-when}}\n @models={{hds-link-to-models @model @models}}\n @query={{hds-link-to-query @query}}\n @replace={{@replace}}\n @route={{@route}}\n @isRouteExternal={{@isRouteExternal}}\n @href={{@href}}\n @isHrefExternal={{@isHrefExternal}}\n >\n {{this.text}}\n </Hds::Interactive>\n {{else}}\n <span class=\"hds-tag__text\">\n {{this.text}}\n </span>\n {{/if}}\n</Hds::Text::Body>");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (c) HashiCorp, Inc.
|
|
10
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const DEFAULT_COLOR = 'primary';
|
|
14
|
+
const COLORS = ['primary', 'secondary'];
|
|
15
|
+
class HdsTagIndexComponent extends Component {
|
|
16
|
+
/**
|
|
17
|
+
* @param onDismiss
|
|
18
|
+
* @type {function}
|
|
19
|
+
* @default () => {}
|
|
20
|
+
*/
|
|
21
|
+
get onDismiss() {
|
|
22
|
+
let {
|
|
23
|
+
onDismiss
|
|
24
|
+
} = this.args;
|
|
25
|
+
if (typeof onDismiss === 'function') {
|
|
26
|
+
return onDismiss;
|
|
27
|
+
} else {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param text
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @description The text of the tag. If no text value is defined, an error will be thrown.
|
|
36
|
+
*/
|
|
37
|
+
get text() {
|
|
38
|
+
let {
|
|
39
|
+
text
|
|
40
|
+
} = this.args;
|
|
41
|
+
assert('@text for "Hds::Tag" must have a valid value', text !== undefined);
|
|
42
|
+
return text;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param ariaLabel
|
|
47
|
+
* @type {string}
|
|
48
|
+
* @default 'Dismiss'
|
|
49
|
+
*/
|
|
50
|
+
get ariaLabel() {
|
|
51
|
+
let tagAriaLabel = this.args.ariaLabel ?? 'Dismiss';
|
|
52
|
+
return tagAriaLabel + ' ' + this.args.text;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @param color
|
|
57
|
+
* @type {string}
|
|
58
|
+
* @default primary
|
|
59
|
+
* @description Determines the color of link to be used; acceptable values are `primary` and `secondary`
|
|
60
|
+
*/
|
|
61
|
+
get color() {
|
|
62
|
+
if (this.args.href || this.args.route) {
|
|
63
|
+
let {
|
|
64
|
+
color = DEFAULT_COLOR
|
|
65
|
+
} = this.args;
|
|
66
|
+
assert(`@color for "Hds::Tag" must be one of the following: ${COLORS.join(', ')}; received: ${color}`, COLORS.includes(color));
|
|
67
|
+
return color;
|
|
68
|
+
} else if (this.args.color) {
|
|
69
|
+
assert('@color can only be applied to "Hds::Tag" along with either @href or @route', this.args.href || this.args.route);
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get the class names to apply to the component.
|
|
76
|
+
* @method classNames
|
|
77
|
+
* @return {string} The "class" attribute to apply to the component.
|
|
78
|
+
*/
|
|
79
|
+
get classNames() {
|
|
80
|
+
let classes = ['hds-tag'];
|
|
81
|
+
|
|
82
|
+
// add a class based on the @color argument
|
|
83
|
+
if (this.color) {
|
|
84
|
+
classes.push(`hds-tag--color-${this.color}`);
|
|
85
|
+
}
|
|
86
|
+
return classes.join(' ');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
setComponentTemplate(TEMPLATE, HdsTagIndexComponent);
|
|
90
|
+
|
|
91
|
+
export { COLORS, DEFAULT_COLOR, HdsTagIndexComponent as default };
|
|
92
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/tag/index.hbs","../../../../src/components/hds/tag/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text::Body class={{this.classNames}} @tag=\\\"span\\\" @size=\\\"100\\\" @weight=\\\"medium\\\" @color=\\\"primary\\\" ...attributes>\\n {{#if this.onDismiss}}\\n <button class=\\\"hds-tag__dismiss\\\" type=\\\"button\\\" aria-label={{this.ariaLabel}} {{on \\\"click\\\" this.onDismiss}}>\\n <FlightIcon class=\\\"hds-tag__dismiss-icon\\\" @name=\\\"x\\\" @size=\\\"16\\\" @isInlineBlock={{false}} />\\n </button>\\n {{/if}}\\n {{#if (or @href @route)}}\\n <Hds::Interactive\\n class=\\\"hds-tag__link\\\"\\n @current-when={{@current-when}}\\n @models={{hds-link-to-models @model @models}}\\n @query={{hds-link-to-query @query}}\\n @replace={{@replace}}\\n @route={{@route}}\\n @isRouteExternal={{@isRouteExternal}}\\n @href={{@href}}\\n @isHrefExternal={{@isHrefExternal}}\\n >\\n {{this.text}}\\n </Hds::Interactive>\\n {{else}}\\n <span class=\\\"hds-tag__text\\\">\\n {{this.text}}\\n </span>\\n {{/if}}\\n</Hds::Text::Body>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\n\nexport const DEFAULT_COLOR = 'primary';\nexport const COLORS = ['primary', 'secondary'];\n\nexport default class HdsTagIndexComponent extends Component {\n /**\n * @param onDismiss\n * @type {function}\n * @default () => {}\n */\n get onDismiss() {\n let { onDismiss } = this.args;\n\n if (typeof onDismiss === 'function') {\n return onDismiss;\n } else {\n return false;\n }\n }\n\n /**\n * @param text\n * @type {string}\n * @description The text of the tag. If no text value is defined, an error will be thrown.\n */\n get text() {\n let { text } = this.args;\n\n assert('@text for \"Hds::Tag\" must have a valid value', text !== undefined);\n\n return text;\n }\n\n /**\n * @param ariaLabel\n * @type {string}\n * @default 'Dismiss'\n */\n get ariaLabel() {\n let tagAriaLabel = this.args.ariaLabel ?? 'Dismiss';\n return tagAriaLabel + ' ' + this.args.text;\n }\n\n /**\n * @param color\n * @type {string}\n * @default primary\n * @description Determines the color of link to be used; acceptable values are `primary` and `secondary`\n */\n get color() {\n if (this.args.href || this.args.route) {\n let { color = DEFAULT_COLOR } = this.args;\n assert(\n `@color for \"Hds::Tag\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n return color;\n } else if (this.args.color) {\n assert(\n '@color can only be applied to \"Hds::Tag\" along with either @href or @route',\n this.args.href || this.args.route\n );\n }\n return false;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n let classes = ['hds-tag'];\n\n // add a class based on the @color argument\n if (this.color) {\n classes.push(`hds-tag--color-${this.color}`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_COLOR","COLORS","HdsTagIndexComponent","Component","onDismiss","args","text","assert","undefined","ariaLabel","tagAriaLabel","color","href","route","join","includes","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,mgCAAmgC;;ACDriC;AACA;AACA;AACA;;AAKO,MAAMA,aAAa,GAAG,UAAS;MACzBC,MAAM,GAAG,CAAC,SAAS,EAAE,WAAW,EAAC;AAE/B,MAAMC,oBAAoB,SAASC,SAAS,CAAC;AAC1D;AACF;AACA;AACA;AACA;EACE,IAAIC,SAASA,GAAG;IACd,IAAI;AAAEA,MAAAA,SAAAA;KAAW,GAAG,IAAI,CAACC,IAAI,CAAA;AAE7B,IAAA,IAAI,OAAOD,SAAS,KAAK,UAAU,EAAE;AACnC,MAAA,OAAOA,SAAS,CAAA;AAClB,KAAC,MAAM;AACL,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIE,IAAIA,GAAG;IACT,IAAI;AAAEA,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACD,IAAI,CAAA;AAExBE,IAAAA,MAAM,CAAC,8CAA8C,EAAED,IAAI,KAAKE,SAAS,CAAC,CAAA;AAE1E,IAAA,OAAOF,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIG,SAASA,GAAG;IACd,IAAIC,YAAY,GAAG,IAAI,CAACL,IAAI,CAACI,SAAS,IAAI,SAAS,CAAA;IACnD,OAAOC,YAAY,GAAG,GAAG,GAAG,IAAI,CAACL,IAAI,CAACC,IAAI,CAAA;AAC5C,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIK,KAAKA,GAAG;IACV,IAAI,IAAI,CAACN,IAAI,CAACO,IAAI,IAAI,IAAI,CAACP,IAAI,CAACQ,KAAK,EAAE;MACrC,IAAI;AAAEF,QAAAA,KAAK,GAAGX,aAAAA;OAAe,GAAG,IAAI,CAACK,IAAI,CAAA;AACzCE,MAAAA,MAAM,CACH,CAAsDN,oDAAAA,EAAAA,MAAM,CAACa,IAAI,CAChE,IACF,CAAE,CAAA,YAAA,EAAcH,KAAM,CAAA,CAAC,EACvBV,MAAM,CAACc,QAAQ,CAACJ,KAAK,CACvB,CAAC,CAAA;AACD,MAAA,OAAOA,KAAK,CAAA;AACd,KAAC,MAAM,IAAI,IAAI,CAACN,IAAI,CAACM,KAAK,EAAE;AAC1BJ,MAAAA,MAAM,CACJ,4EAA4E,EAC5E,IAAI,CAACF,IAAI,CAACO,IAAI,IAAI,IAAI,CAACP,IAAI,CAACQ,KAC9B,CAAC,CAAA;AACH,KAAA;AACA,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIG,UAAUA,GAAG;AACf,IAAA,IAAIC,OAAO,GAAG,CAAC,SAAS,CAAC,CAAA;;AAEzB;IACA,IAAI,IAAI,CAACN,KAAK,EAAE;MACdM,OAAO,CAACC,IAAI,CAAE,CAAA,eAAA,EAAiB,IAAI,CAACP,KAAM,EAAC,CAAC,CAAA;AAC9C,KAAA;AAEA,IAAA,OAAOM,OAAO,CAACH,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACK,oBAAA,CAAAC,QAAA,EA/EoBlB,oBAAoB,CAAA;;;;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
|
+
import { setComponentTemplate } from '@ember/component';
|
|
5
|
+
|
|
6
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Text\n @group=\"body\"\n @size={{this.size}}\n @weight={{this.weight}}\n @align={{@align}}\n @color={{@color}}\n @tag={{@tag}}\n ...attributes\n>{{yield}}</Hds::Text>");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (c) HashiCorp, Inc.
|
|
10
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const DEFAULT_SIZE = '200';
|
|
14
|
+
const AVAILABLE_SIZES = [300, 200, 100];
|
|
15
|
+
const DEFAULT_WEIGHT = 'regular';
|
|
16
|
+
const AVAILABLE_WEIGHTS_PER_SIZE = {
|
|
17
|
+
300: ['regular', 'medium', 'semibold'],
|
|
18
|
+
200: ['regular', 'medium', 'semibold'],
|
|
19
|
+
100: ['regular', 'medium', 'semibold']
|
|
20
|
+
};
|
|
21
|
+
class HdsTextBodyComponent extends Component {
|
|
22
|
+
/**
|
|
23
|
+
* Sets the "size" for the text
|
|
24
|
+
* Accepted values: see AVAILABLE_SIZES
|
|
25
|
+
*
|
|
26
|
+
* @type {string}
|
|
27
|
+
*
|
|
28
|
+
* @param size
|
|
29
|
+
*/
|
|
30
|
+
get size() {
|
|
31
|
+
let {
|
|
32
|
+
size = DEFAULT_SIZE
|
|
33
|
+
} = this.args;
|
|
34
|
+
|
|
35
|
+
// let's be a bit forgiving with the consumers
|
|
36
|
+
if (typeof size === 'string') {
|
|
37
|
+
size = parseInt(size, 10);
|
|
38
|
+
}
|
|
39
|
+
assert(`@size for "Hds::Text::Body" must be one of the following: ${AVAILABLE_SIZES.join(', ')}; received: ${size}`, AVAILABLE_SIZES.includes(size));
|
|
40
|
+
return size;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Sets the "weight" for the text
|
|
45
|
+
* Accepted values: see AVAILABLE_WEIGHTS_PER_SIZE
|
|
46
|
+
*
|
|
47
|
+
* @type {string}
|
|
48
|
+
*
|
|
49
|
+
* @param variant
|
|
50
|
+
*/
|
|
51
|
+
get weight() {
|
|
52
|
+
let {
|
|
53
|
+
weight = DEFAULT_WEIGHT
|
|
54
|
+
} = this.args;
|
|
55
|
+
const availableWeights = AVAILABLE_WEIGHTS_PER_SIZE[this.size];
|
|
56
|
+
assert(`@weight for "Hds::Text::Body" with @size=${this.size} must be one of the following: ${availableWeights.join(', ')}; received: ${weight}`, availableWeights.includes(weight));
|
|
57
|
+
return weight;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
setComponentTemplate(TEMPLATE, HdsTextBodyComponent);
|
|
61
|
+
|
|
62
|
+
export { AVAILABLE_SIZES, AVAILABLE_WEIGHTS_PER_SIZE, DEFAULT_SIZE, DEFAULT_WEIGHT, HdsTextBodyComponent as default };
|
|
63
|
+
//# sourceMappingURL=body.js.map
|