@hashicorp/design-system-components 4.3.0 → 4.4.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/declarations/components/hds/accordion/index.d.ts +20 -0
- package/declarations/components/hds/accordion/index.d.ts.map +1 -0
- package/declarations/components/hds/accordion/item/button.d.ts +26 -0
- package/declarations/components/hds/accordion/item/button.d.ts.map +1 -0
- package/declarations/components/hds/accordion/item/index.d.ts +44 -0
- package/declarations/components/hds/accordion/item/index.d.ts.map +1 -0
- package/declarations/components/hds/alert/description.d.ts +14 -0
- package/declarations/components/hds/alert/description.d.ts.map +1 -0
- package/declarations/components/hds/alert/index.d.ts +82 -0
- package/declarations/components/hds/alert/index.d.ts.map +1 -0
- package/declarations/components/hds/alert/title.d.ts +14 -0
- package/declarations/components/hds/alert/title.d.ts.map +1 -0
- package/declarations/components/hds/alert/types.d.ts +19 -0
- package/declarations/components/hds/alert/types.d.ts.map +1 -0
- package/declarations/components/hds/app-footer/copyright.d.ts +21 -0
- package/declarations/components/hds/app-footer/copyright.d.ts.map +1 -0
- package/declarations/components/hds/app-footer/index.d.ts +54 -0
- package/declarations/components/hds/app-footer/index.d.ts.map +1 -0
- package/declarations/components/hds/app-footer/item.d.ts +14 -0
- package/declarations/components/hds/app-footer/item.d.ts.map +1 -0
- package/declarations/components/hds/app-footer/legal-links.d.ts +55 -0
- package/declarations/components/hds/app-footer/legal-links.d.ts.map +1 -0
- package/declarations/components/hds/app-footer/link.d.ts +22 -0
- package/declarations/components/hds/app-footer/link.d.ts.map +1 -0
- package/declarations/components/hds/app-footer/status-link.d.ts +63 -0
- package/declarations/components/hds/app-footer/status-link.d.ts.map +1 -0
- package/declarations/components/hds/app-footer/types.d.ts +21 -0
- package/declarations/components/hds/app-footer/types.d.ts.map +1 -0
- package/declarations/components/hds/app-frame/index.d.ts +67 -0
- package/declarations/components/hds/app-frame/index.d.ts.map +1 -0
- package/declarations/components/hds/app-frame/parts/footer.d.ts +14 -0
- package/declarations/components/hds/app-frame/parts/footer.d.ts.map +1 -0
- package/declarations/components/hds/app-frame/parts/header.d.ts +14 -0
- package/declarations/components/hds/app-frame/parts/header.d.ts.map +1 -0
- package/declarations/components/hds/app-frame/parts/main.d.ts +14 -0
- package/declarations/components/hds/app-frame/parts/main.d.ts.map +1 -0
- package/declarations/components/hds/app-frame/parts/modals.d.ts +14 -0
- package/declarations/components/hds/app-frame/parts/modals.d.ts.map +1 -0
- package/declarations/components/hds/app-frame/parts/sidebar.d.ts +14 -0
- package/declarations/components/hds/app-frame/parts/sidebar.d.ts.map +1 -0
- package/declarations/components/hds/application-state/body.d.ts +2 -0
- package/declarations/components/hds/application-state/body.d.ts.map +1 -0
- package/declarations/components/hds/application-state/footer.d.ts +19 -0
- package/declarations/components/hds/application-state/footer.d.ts.map +1 -0
- package/declarations/components/hds/application-state/header.d.ts +2 -0
- package/declarations/components/hds/application-state/header.d.ts.map +1 -0
- package/declarations/components/hds/application-state/index.d.ts +2 -0
- package/declarations/components/hds/application-state/index.d.ts.map +1 -0
- package/declarations/components/hds/badge/index.d.ts +81 -0
- package/declarations/components/hds/badge/index.d.ts.map +1 -0
- package/declarations/components/hds/badge/types.d.ts +26 -0
- package/declarations/components/hds/badge/types.d.ts.map +1 -0
- package/declarations/components/hds/badge-count/index.d.ts +59 -0
- package/declarations/components/hds/badge-count/index.d.ts.map +1 -0
- package/declarations/components/hds/badge-count/types.d.ts +22 -0
- package/declarations/components/hds/badge-count/types.d.ts.map +1 -0
- package/declarations/components/hds/breadcrumb/index.d.ts +29 -0
- package/declarations/components/hds/breadcrumb/index.d.ts.map +1 -0
- package/declarations/components/hds/breadcrumb/item.d.ts +24 -0
- package/declarations/components/hds/breadcrumb/item.d.ts.map +1 -0
- package/declarations/components/hds/breadcrumb/truncation.d.ts +11 -0
- package/declarations/components/hds/breadcrumb/truncation.d.ts.map +1 -0
- package/declarations/components/hds/button/index.d.ts +92 -0
- package/declarations/components/hds/button/index.d.ts.map +1 -0
- package/declarations/components/hds/button-set/index.d.ts +14 -0
- package/declarations/components/hds/button-set/index.d.ts.map +1 -0
- package/declarations/components/hds/card/container.d.ts +79 -0
- package/declarations/components/hds/card/container.d.ts.map +1 -0
- package/declarations/components/hds/card/types.d.ts +21 -0
- package/declarations/components/hds/card/types.d.ts.map +1 -0
- package/declarations/components/hds/code-block/copy-button.d.ts +2 -0
- package/declarations/components/hds/code-block/copy-button.d.ts.map +1 -0
- package/declarations/components/hds/code-block/description.d.ts +2 -0
- package/declarations/components/hds/code-block/description.d.ts.map +1 -0
- package/declarations/components/hds/code-block/index.d.ts +53 -0
- package/declarations/components/hds/code-block/index.d.ts.map +1 -0
- package/declarations/components/hds/code-block/title.d.ts +2 -0
- package/declarations/components/hds/code-block/title.d.ts.map +1 -0
- package/declarations/components/hds/copy/button/index.d.ts +52 -0
- package/declarations/components/hds/copy/button/index.d.ts.map +1 -0
- package/declarations/components/hds/copy/button/types.d.ts +10 -0
- package/declarations/components/hds/copy/button/types.d.ts.map +1 -0
- package/declarations/components/hds/copy/snippet/index.d.ts +73 -0
- package/declarations/components/hds/copy/snippet/index.d.ts.map +1 -0
- package/declarations/components/hds/copy/snippet/types.d.ts +10 -0
- package/declarations/components/hds/copy/snippet/types.d.ts.map +1 -0
- package/declarations/components/hds/disclosure-primitive/index.d.ts +31 -0
- package/declarations/components/hds/disclosure-primitive/index.d.ts.map +1 -0
- package/declarations/components/hds/dismiss-button/index.d.ts +20 -0
- package/declarations/components/hds/dismiss-button/index.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/footer.d.ts +2 -0
- package/declarations/components/hds/dropdown/footer.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/header.d.ts +2 -0
- package/declarations/components/hds/dropdown/header.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/index.d.ts +27 -0
- package/declarations/components/hds/dropdown/index.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/list-item/checkbox.d.ts +9 -0
- package/declarations/components/hds/dropdown/list-item/checkbox.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/list-item/checkmark.d.ts +11 -0
- package/declarations/components/hds/dropdown/list-item/checkmark.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/list-item/copy-item.d.ts +24 -0
- package/declarations/components/hds/dropdown/list-item/copy-item.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/list-item/description.d.ts +11 -0
- package/declarations/components/hds/dropdown/list-item/description.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/list-item/generic.d.ts +2 -0
- package/declarations/components/hds/dropdown/list-item/generic.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/list-item/interactive.d.ts +26 -0
- package/declarations/components/hds/dropdown/list-item/interactive.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/list-item/radio.d.ts +9 -0
- package/declarations/components/hds/dropdown/list-item/radio.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/list-item/separator.d.ts +2 -0
- package/declarations/components/hds/dropdown/list-item/separator.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/list-item/title.d.ts +11 -0
- package/declarations/components/hds/dropdown/list-item/title.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/toggle/button.d.ts +61 -0
- package/declarations/components/hds/dropdown/toggle/button.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/toggle/chevron.d.ts +2 -0
- package/declarations/components/hds/dropdown/toggle/chevron.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/toggle/icon.d.ts +50 -0
- package/declarations/components/hds/dropdown/toggle/icon.d.ts.map +1 -0
- package/declarations/components/hds/flyout/body.d.ts +2 -0
- package/declarations/components/hds/flyout/body.d.ts.map +1 -0
- package/declarations/components/hds/flyout/description.d.ts +2 -0
- package/declarations/components/hds/flyout/description.d.ts.map +1 -0
- package/declarations/components/hds/flyout/footer.d.ts +2 -0
- package/declarations/components/hds/flyout/footer.d.ts.map +1 -0
- package/declarations/components/hds/flyout/header.d.ts +2 -0
- package/declarations/components/hds/flyout/header.d.ts.map +1 -0
- package/declarations/components/hds/flyout/index.d.ts +35 -0
- package/declarations/components/hds/flyout/index.d.ts.map +1 -0
- package/declarations/components/hds/form/character-count/index.d.ts +60 -0
- package/declarations/components/hds/form/character-count/index.d.ts.map +1 -0
- package/declarations/components/hds/form/checkbox/base.d.ts +2 -0
- package/declarations/components/hds/form/checkbox/base.d.ts.map +1 -0
- package/declarations/components/hds/form/checkbox/field.d.ts +2 -0
- package/declarations/components/hds/form/checkbox/field.d.ts.map +1 -0
- package/declarations/components/hds/form/checkbox/group.d.ts +2 -0
- package/declarations/components/hds/form/checkbox/group.d.ts.map +1 -0
- package/declarations/components/hds/form/error/index.d.ts +24 -0
- package/declarations/components/hds/form/error/index.d.ts.map +1 -0
- package/declarations/components/hds/form/error/message.d.ts +2 -0
- package/declarations/components/hds/form/error/message.d.ts.map +1 -0
- package/declarations/components/hds/form/field/index.d.ts +39 -0
- package/declarations/components/hds/form/field/index.d.ts.map +1 -0
- package/declarations/components/hds/form/fieldset/index.d.ts +39 -0
- package/declarations/components/hds/form/fieldset/index.d.ts.map +1 -0
- package/declarations/components/hds/form/file-input/base.d.ts +2 -0
- package/declarations/components/hds/form/file-input/base.d.ts.map +1 -0
- package/declarations/components/hds/form/file-input/field.d.ts +2 -0
- package/declarations/components/hds/form/file-input/field.d.ts.map +1 -0
- package/declarations/components/hds/form/helper-text/index.d.ts +24 -0
- package/declarations/components/hds/form/helper-text/index.d.ts.map +1 -0
- package/declarations/components/hds/form/indicator/index.d.ts +11 -0
- package/declarations/components/hds/form/indicator/index.d.ts.map +1 -0
- package/declarations/components/hds/form/label/index.d.ts +18 -0
- package/declarations/components/hds/form/label/index.d.ts.map +1 -0
- package/declarations/components/hds/form/legend/index.d.ts +11 -0
- package/declarations/components/hds/form/legend/index.d.ts.map +1 -0
- package/declarations/components/hds/form/masked-input/base.d.ts +35 -0
- package/declarations/components/hds/form/masked-input/base.d.ts.map +1 -0
- package/declarations/components/hds/form/masked-input/field.d.ts +2 -0
- package/declarations/components/hds/form/masked-input/field.d.ts.map +1 -0
- package/declarations/components/hds/form/radio/base.d.ts +2 -0
- package/declarations/components/hds/form/radio/base.d.ts.map +1 -0
- package/declarations/components/hds/form/radio/field.d.ts +2 -0
- package/declarations/components/hds/form/radio/field.d.ts.map +1 -0
- package/declarations/components/hds/form/radio/group.d.ts +2 -0
- package/declarations/components/hds/form/radio/group.d.ts.map +1 -0
- package/declarations/components/hds/form/radio-card/description.d.ts +2 -0
- package/declarations/components/hds/form/radio-card/description.d.ts.map +1 -0
- package/declarations/components/hds/form/radio-card/group.d.ts +2 -0
- package/declarations/components/hds/form/radio-card/group.d.ts.map +1 -0
- package/declarations/components/hds/form/radio-card/index.d.ts +36 -0
- package/declarations/components/hds/form/radio-card/index.d.ts.map +1 -0
- package/declarations/components/hds/form/radio-card/label.d.ts +2 -0
- package/declarations/components/hds/form/radio-card/label.d.ts.map +1 -0
- package/declarations/components/hds/form/select/base.d.ts +11 -0
- package/declarations/components/hds/form/select/base.d.ts.map +1 -0
- package/declarations/components/hds/form/select/field.d.ts +2 -0
- package/declarations/components/hds/form/select/field.d.ts.map +1 -0
- package/declarations/components/hds/form/super-select/after-options.d.ts +2 -0
- package/declarations/components/hds/form/super-select/after-options.d.ts.map +1 -0
- package/declarations/components/hds/form/super-select/multiple/base.d.ts +52 -0
- package/declarations/components/hds/form/super-select/multiple/base.d.ts.map +1 -0
- package/declarations/components/hds/form/super-select/multiple/field.d.ts +5 -0
- package/declarations/components/hds/form/super-select/multiple/field.d.ts.map +1 -0
- package/declarations/components/hds/form/super-select/option-group.d.ts +10 -0
- package/declarations/components/hds/form/super-select/option-group.d.ts.map +1 -0
- package/declarations/components/hds/form/super-select/placeholder.d.ts +2 -0
- package/declarations/components/hds/form/super-select/placeholder.d.ts.map +1 -0
- package/declarations/components/hds/form/super-select/single/base.d.ts +32 -0
- package/declarations/components/hds/form/super-select/single/base.d.ts.map +1 -0
- package/declarations/components/hds/form/super-select/single/field.d.ts +5 -0
- package/declarations/components/hds/form/super-select/single/field.d.ts.map +1 -0
- package/declarations/components/hds/form/text-input/base.d.ts +21 -0
- package/declarations/components/hds/form/text-input/base.d.ts.map +1 -0
- package/declarations/components/hds/form/text-input/field.d.ts +27 -0
- package/declarations/components/hds/form/text-input/field.d.ts.map +1 -0
- package/declarations/components/hds/form/textarea/base.d.ts +11 -0
- package/declarations/components/hds/form/textarea/base.d.ts.map +1 -0
- package/declarations/components/hds/form/textarea/field.d.ts +2 -0
- package/declarations/components/hds/form/textarea/field.d.ts.map +1 -0
- package/declarations/components/hds/form/toggle/base.d.ts +2 -0
- package/declarations/components/hds/form/toggle/base.d.ts.map +1 -0
- package/declarations/components/hds/form/toggle/field.d.ts +2 -0
- package/declarations/components/hds/form/toggle/field.d.ts.map +1 -0
- package/declarations/components/hds/form/toggle/group.d.ts +2 -0
- package/declarations/components/hds/form/toggle/group.d.ts.map +1 -0
- package/declarations/components/hds/form/visibility-toggle/index.d.ts +2 -0
- package/declarations/components/hds/form/visibility-toggle/index.d.ts.map +1 -0
- package/declarations/components/hds/icon-tile/index.d.ts +85 -0
- package/declarations/components/hds/icon-tile/index.d.ts.map +1 -0
- package/declarations/components/hds/icon-tile/types.d.ts +29 -0
- package/declarations/components/hds/icon-tile/types.d.ts.map +1 -0
- package/declarations/components/hds/interactive/index.d.ts +42 -0
- package/declarations/components/hds/interactive/index.d.ts.map +1 -0
- package/declarations/components/hds/link/inline.d.ts +47 -0
- package/declarations/components/hds/link/inline.d.ts.map +1 -0
- package/declarations/components/hds/link/standalone.d.ts +75 -0
- package/declarations/components/hds/link/standalone.d.ts.map +1 -0
- package/declarations/components/hds/link/types.d.ts +21 -0
- package/declarations/components/hds/link/types.d.ts.map +1 -0
- package/declarations/components/hds/menu-primitive/index.d.ts +12 -0
- package/declarations/components/hds/menu-primitive/index.d.ts.map +1 -0
- package/declarations/components/hds/modal/body.d.ts +2 -0
- package/declarations/components/hds/modal/body.d.ts.map +1 -0
- package/declarations/components/hds/modal/footer.d.ts +2 -0
- package/declarations/components/hds/modal/footer.d.ts.map +1 -0
- package/declarations/components/hds/modal/header.d.ts +2 -0
- package/declarations/components/hds/modal/header.d.ts.map +1 -0
- package/declarations/components/hds/modal/index.d.ts +46 -0
- package/declarations/components/hds/modal/index.d.ts.map +1 -0
- package/declarations/components/hds/page-header/actions.d.ts +2 -0
- package/declarations/components/hds/page-header/actions.d.ts.map +1 -0
- package/declarations/components/hds/page-header/badges.d.ts +2 -0
- package/declarations/components/hds/page-header/badges.d.ts.map +1 -0
- package/declarations/components/hds/page-header/description.d.ts +2 -0
- package/declarations/components/hds/page-header/description.d.ts.map +1 -0
- package/declarations/components/hds/page-header/index.d.ts +2 -0
- package/declarations/components/hds/page-header/index.d.ts.map +1 -0
- package/declarations/components/hds/page-header/subtitle.d.ts +2 -0
- package/declarations/components/hds/page-header/subtitle.d.ts.map +1 -0
- package/declarations/components/hds/page-header/title.d.ts +2 -0
- package/declarations/components/hds/page-header/title.d.ts.map +1 -0
- package/declarations/components/hds/pagination/compact/index.d.ts +35 -0
- package/declarations/components/hds/pagination/compact/index.d.ts.map +1 -0
- package/declarations/components/hds/pagination/info/index.d.ts +11 -0
- package/declarations/components/hds/pagination/info/index.d.ts.map +1 -0
- package/declarations/components/hds/pagination/nav/arrow.d.ts +25 -0
- package/declarations/components/hds/pagination/nav/arrow.d.ts.map +1 -0
- package/declarations/components/hds/pagination/nav/ellipsis.d.ts +2 -0
- package/declarations/components/hds/pagination/nav/ellipsis.d.ts.map +1 -0
- package/declarations/components/hds/pagination/nav/number.d.ts +13 -0
- package/declarations/components/hds/pagination/nav/number.d.ts.map +1 -0
- package/declarations/components/hds/pagination/numbered/index.d.ts +51 -0
- package/declarations/components/hds/pagination/numbered/index.d.ts.map +1 -0
- package/declarations/components/hds/pagination/size-selector/index.d.ts +31 -0
- package/declarations/components/hds/pagination/size-selector/index.d.ts.map +1 -0
- package/declarations/components/hds/popover-primitive/index.d.ts +44 -0
- package/declarations/components/hds/popover-primitive/index.d.ts.map +1 -0
- package/declarations/components/hds/reveal/index.d.ts +34 -0
- package/declarations/components/hds/reveal/index.d.ts.map +1 -0
- package/declarations/components/hds/reveal/toggle/button.d.ts +22 -0
- package/declarations/components/hds/reveal/toggle/button.d.ts.map +1 -0
- package/declarations/components/hds/rich-tooltip/bubble.d.ts +27 -0
- package/declarations/components/hds/rich-tooltip/bubble.d.ts.map +1 -0
- package/declarations/components/hds/rich-tooltip/index.d.ts +10 -0
- package/declarations/components/hds/rich-tooltip/index.d.ts.map +1 -0
- package/declarations/components/hds/rich-tooltip/toggle.d.ts +34 -0
- package/declarations/components/hds/rich-tooltip/toggle.d.ts.map +1 -0
- package/declarations/components/hds/segmented-group/index.d.ts +2 -0
- package/declarations/components/hds/segmented-group/index.d.ts.map +1 -0
- package/declarations/components/hds/separator/index.d.ts +34 -0
- package/declarations/components/hds/separator/index.d.ts.map +1 -0
- package/declarations/components/hds/separator/types.d.ts +10 -0
- package/declarations/components/hds/separator/types.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/base.d.ts +2 -0
- package/declarations/components/hds/side-nav/base.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/header/home-link.d.ts +11 -0
- package/declarations/components/hds/side-nav/header/home-link.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/header/icon-button.d.ts +11 -0
- package/declarations/components/hds/side-nav/header/icon-button.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/header/index.d.ts +2 -0
- package/declarations/components/hds/side-nav/header/index.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/index.d.ts +30 -0
- package/declarations/components/hds/side-nav/index.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/list/back-link.d.ts +2 -0
- package/declarations/components/hds/side-nav/list/back-link.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/list/index.d.ts +2 -0
- package/declarations/components/hds/side-nav/list/index.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/list/item.d.ts +2 -0
- package/declarations/components/hds/side-nav/list/item.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/list/link.d.ts +2 -0
- package/declarations/components/hds/side-nav/list/link.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/list/title.d.ts +2 -0
- package/declarations/components/hds/side-nav/list/title.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/portal/index.d.ts +2 -0
- package/declarations/components/hds/side-nav/portal/index.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/portal/target.d.ts +14 -0
- package/declarations/components/hds/side-nav/portal/target.d.ts.map +1 -0
- package/declarations/components/hds/side-nav/toggle-button.d.ts +2 -0
- package/declarations/components/hds/side-nav/toggle-button.d.ts.map +1 -0
- package/declarations/components/hds/stepper/step/indicator.d.ts +39 -0
- package/declarations/components/hds/stepper/step/indicator.d.ts.map +1 -0
- package/declarations/components/hds/stepper/task/indicator.d.ts +44 -0
- package/declarations/components/hds/stepper/task/indicator.d.ts.map +1 -0
- package/declarations/components/hds/stepper/types.d.ts +13 -0
- package/declarations/components/hds/stepper/types.d.ts.map +1 -0
- package/declarations/components/hds/table/index.d.ts +76 -0
- package/declarations/components/hds/table/index.d.ts.map +1 -0
- package/declarations/components/hds/table/td.d.ts +18 -0
- package/declarations/components/hds/table/td.d.ts.map +1 -0
- package/declarations/components/hds/table/th-button-sort.d.ts +38 -0
- package/declarations/components/hds/table/th-button-sort.d.ts.map +1 -0
- package/declarations/components/hds/table/th-button-tooltip.d.ts +17 -0
- package/declarations/components/hds/table/th-button-tooltip.d.ts.map +1 -0
- package/declarations/components/hds/table/th-selectable.d.ts +16 -0
- package/declarations/components/hds/table/th-selectable.d.ts.map +1 -0
- package/declarations/components/hds/table/th-sort.d.ts +32 -0
- package/declarations/components/hds/table/th-sort.d.ts.map +1 -0
- package/declarations/components/hds/table/th.d.ts +24 -0
- package/declarations/components/hds/table/th.d.ts.map +1 -0
- package/declarations/components/hds/table/tr.d.ts +11 -0
- package/declarations/components/hds/table/tr.d.ts.map +1 -0
- package/declarations/components/hds/tabs/index.d.ts +45 -0
- package/declarations/components/hds/tabs/index.d.ts.map +1 -0
- package/declarations/components/hds/tabs/panel.d.ts +24 -0
- package/declarations/components/hds/tabs/panel.d.ts.map +1 -0
- package/declarations/components/hds/tabs/tab.d.ts +28 -0
- package/declarations/components/hds/tabs/tab.d.ts.map +1 -0
- package/declarations/components/hds/tag/index.d.ts +54 -0
- package/declarations/components/hds/tag/index.d.ts.map +1 -0
- package/declarations/components/hds/tag/types.d.ts +10 -0
- package/declarations/components/hds/tag/types.d.ts.map +1 -0
- package/declarations/components/hds/text/body.d.ts +50 -0
- package/declarations/components/hds/text/body.d.ts.map +1 -0
- package/declarations/components/hds/text/code.d.ts +50 -0
- package/declarations/components/hds/text/code.d.ts.map +1 -0
- package/declarations/components/hds/text/display.d.ts +46 -0
- package/declarations/components/hds/text/display.d.ts.map +1 -0
- package/declarations/components/hds/text/index.d.ts +72 -0
- package/declarations/components/hds/text/index.d.ts.map +1 -0
- package/declarations/components/hds/text/types.d.ts +59 -0
- package/declarations/components/hds/text/types.d.ts.map +1 -0
- package/declarations/components/hds/toast/index.d.ts +12 -0
- package/declarations/components/hds/toast/index.d.ts.map +1 -0
- package/declarations/components/hds/tooltip-button/index.d.ts +26 -0
- package/declarations/components/hds/tooltip-button/index.d.ts.map +1 -0
- package/declarations/components/hds/yield/index.d.ts +13 -0
- package/declarations/components/hds/yield/index.d.ts.map +1 -0
- package/declarations/components.d.ts +29 -0
- package/declarations/components.d.ts.map +1 -0
- package/declarations/helpers/hds-link-to-models.d.ts +11 -0
- package/declarations/helpers/hds-link-to-models.d.ts.map +1 -0
- package/declarations/helpers/hds-link-to-query.d.ts +8 -0
- package/declarations/helpers/hds-link-to-query.d.ts.map +1 -0
- package/declarations/helpers.d.ts +1 -0
- package/declarations/helpers.d.ts.map +1 -0
- package/declarations/modifiers/hds-anchored-position.d.ts +16 -0
- package/declarations/modifiers/hds-anchored-position.d.ts.map +1 -0
- package/declarations/modifiers/hds-clipboard.d.ts +36 -0
- package/declarations/modifiers/hds-clipboard.d.ts.map +1 -0
- package/declarations/modifiers/hds-register-event.d.ts +9 -0
- package/declarations/modifiers/hds-register-event.d.ts.map +1 -0
- package/declarations/modifiers/hds-tooltip.d.ts +34 -0
- package/declarations/modifiers/hds-tooltip.d.ts.map +1 -0
- package/declarations/modifiers.d.ts +1 -0
- package/declarations/modifiers.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +142 -0
- package/declarations/template-registry.d.ts.map +1 -0
- package/declarations/utils/hds-get-element-id.d.ts +2 -0
- package/declarations/utils/hds-get-element-id.d.ts.map +1 -0
- package/declarations/utils/hds-set-aria-described-by.d.ts +6 -0
- package/declarations/utils/hds-set-aria-described-by.d.ts.map +1 -0
- package/dist/components/hds/copy/button/index.js +8 -7
- package/dist/components/hds/copy/button/index.js.map +1 -1
- package/dist/components/hds/copy/button/types.js +13 -0
- package/dist/components/hds/copy/button/types.js.map +1 -0
- package/dist/components/hds/copy/snippet/index.js +26 -10
- package/dist/components/hds/copy/snippet/index.js.map +1 -1
- package/dist/components/hds/copy/snippet/types.js +13 -0
- package/dist/components/hds/copy/snippet/types.js.map +1 -0
- package/dist/components/hds/dropdown/list-item/checkbox.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/radio.js.map +1 -1
- package/dist/components/hds/flyout/index.js.map +1 -1
- package/dist/components/hds/form/field/index.js.map +1 -1
- package/dist/components/hds/form/fieldset/index.js.map +1 -1
- package/dist/components/hds/form/masked-input/base.js.map +1 -1
- package/dist/components/hds/form/radio-card/index.js.map +1 -1
- package/dist/components/hds/form/super-select/multiple/base.js.map +1 -1
- package/dist/components/hds/form/super-select/multiple/field.js.map +1 -1
- package/dist/components/hds/form/super-select/single/base.js.map +1 -1
- package/dist/components/hds/form/super-select/single/field.js.map +1 -1
- package/dist/components/hds/modal/index.js.map +1 -1
- package/dist/components/hds/popover-primitive/index.js.map +1 -1
- package/dist/components/hds/rich-tooltip/bubble.js.map +1 -1
- package/dist/components/hds/rich-tooltip/index.js.map +1 -1
- package/dist/components.js +28 -0
- package/dist/components.js.map +1 -0
- package/dist/helpers.js +2 -0
- package/dist/helpers.js.map +1 -0
- package/dist/modifiers/hds-clipboard.js +9 -7
- package/dist/modifiers/hds-clipboard.js.map +1 -1
- package/dist/modifiers.js +2 -0
- package/dist/modifiers.js.map +1 -0
- package/package.json +7 -6
- /package/{addon-main.js → addon-main.cjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/form/fieldset/index.hbs","../../../../../src/components/hds/form/fieldset/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<fieldset class={{this.classNames}} id={{this.id}} {{did-insert this.setAriaDescribedBy}} ...attributes>\\n {{yield\\n (hash\\n Legend=(component\\n \\\"hds/form/legend\\\" isRequired=this.isRequired isOptional=this.isOptional contextualClass=\\\"hds-form-group__legend\\\"\\n )\\n )\\n }}\\n {{yield\\n (hash\\n HelperText=(component\\n \\\"hds/form/helper-text\\\"\\n controlId=this.id\\n onInsert=this.appendDescriptor\\n contextualClass=\\\"hds-form-group__helper-text\\\"\\n )\\n )\\n }}\\n <div class=\\\"hds-form-group__control-fields-wrapper\\\">\\n {{yield (hash Control=(component \\\"hds/yield\\\") ariaDescribedBy=this.ariaDescribedBy)}}\\n </div>\\n {{yield\\n (hash\\n Error=(component\\n \\\"hds/form/error\\\" controlId=this.id onInsert=this.appendDescriptor contextualClass=\\\"hds-form-group__error\\\"\\n )\\n )\\n }}\\n</fieldset>\")","/**\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 { getElementId } from '../../../../utils/hds-get-element-id';\nimport { setAriaDescribedBy } from '../../../../utils/hds-set-aria-described-by';\n\nexport default class HdsFormFieldsetIndexComponent extends Component {\n @tracked ariaDescribedBy = this.args.extraAriaDescribedBy;\n @tracked descriptors = [];\n\n @action\n appendDescriptor(element) {\n this.descriptors.push(element.id);\n }\n\n @action\n setAriaDescribedBy() {\n setAriaDescribedBy(this);\n }\n\n /**\n * Sets the layout of the group\n *\n * @param layout\n * @type {enum}\n * @default 'vertical'\n */\n get layout() {\n return this.args.layout ?? 'vertical';\n }\n\n /**\n * Calculates the unique ID to assign to the fieldset\n */\n get id() {\n return getElementId(this);\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 // we just need a class for the layout\n let classes = ['hds-form-group'];\n\n // add a class based on the @layout argument\n classes.push(`hds-form-group--layout-${this.layout}`);\n\n return classes.join(' ');\n }\n\n /**\n * @param isRequired\n * @type {boolean}\n * @default false\n */\n get isRequired() {\n return this.args.isRequired || false;\n }\n\n /**\n * @param isOptional\n * @type {boolean}\n * @default false\n */\n get isOptional() {\n return this.args.isOptional || false;\n }\n}\n"],"names":["HdsFormFieldsetIndexComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","appendDescriptor","element","descriptors","push","id","setAriaDescribedBy","layout","getElementId","classNames","classes","join","isRequired","isOptional","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","extraAriaDescribedBy","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,o/BAAo/B;;;ACUjgCA,IAAAA,6BAA6B,IAAAC,MAAA,GAAnC,MAAMD,6BAA6B,SAASE,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,0BAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAA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AAA,WAAA,cAAA;AAAA,IAAA,OAAmB,IAAI,CAACvB,IAAI,CAACwB,oBAAoB,CAAA;AAAA,GAAA;AAAA,CAAArB,CAAAA,EAAAA,YAAA,GAAAc,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,kBACxDC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAe,EAAE,CAAA;AAAA,GAAA;AAAA,CAAA,CAAA,EAAAN,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,EAAA,kBAAA,EAAA,CAExBO,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAA9B,MAAA,CAAAqB,SAAA,EAAArB,kBAAAA,CAAAA,EAAAA,MAAA,CAAAqB,SAAA,CAAA,EAAAD,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,yBAKNO,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAA9B,MAAA,CAAAqB,SAAA,EAAA,oBAAA,CAAA,EAAArB,MAAA,CAAAqB,SAAA,IAAArB,MAAA,EAAA;AATyC+B,oBAAA,CAAAC,QAAA,EAA7BjC,6BAA6B,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/form/fieldset/index.hbs","../../../../../src/components/hds/form/fieldset/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<fieldset class={{this.classNames}} id={{this.id}} {{did-insert this.setAriaDescribedBy}} ...attributes>\\n {{yield\\n (hash\\n Legend=(component\\n \\\"hds/form/legend\\\" isRequired=this.isRequired isOptional=this.isOptional contextualClass=\\\"hds-form-group__legend\\\"\\n )\\n )\\n }}\\n {{yield\\n (hash\\n HelperText=(component\\n \\\"hds/form/helper-text\\\"\\n controlId=this.id\\n onInsert=this.appendDescriptor\\n contextualClass=\\\"hds-form-group__helper-text\\\"\\n )\\n )\\n }}\\n <div class=\\\"hds-form-group__control-fields-wrapper\\\">\\n {{yield (hash Control=(component \\\"hds/yield\\\") ariaDescribedBy=this.ariaDescribedBy)}}\\n </div>\\n {{yield\\n (hash\\n Error=(component\\n \\\"hds/form/error\\\" controlId=this.id onInsert=this.appendDescriptor contextualClass=\\\"hds-form-group__error\\\"\\n )\\n )\\n }}\\n</fieldset>\")","/**\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 { getElementId } from '../../../../utils/hds-get-element-id.js';\nimport { setAriaDescribedBy } from '../../../../utils/hds-set-aria-described-by.js';\n\nexport default class HdsFormFieldsetIndexComponent extends Component {\n @tracked ariaDescribedBy = this.args.extraAriaDescribedBy;\n @tracked descriptors = [];\n\n @action\n appendDescriptor(element) {\n this.descriptors.push(element.id);\n }\n\n @action\n setAriaDescribedBy() {\n setAriaDescribedBy(this);\n }\n\n /**\n * Sets the layout of the group\n *\n * @param layout\n * @type {enum}\n * @default 'vertical'\n */\n get layout() {\n return this.args.layout ?? 'vertical';\n }\n\n /**\n * Calculates the unique ID to assign to the fieldset\n */\n get id() {\n return getElementId(this);\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 // we just need a class for the layout\n let classes = ['hds-form-group'];\n\n // add a class based on the @layout argument\n classes.push(`hds-form-group--layout-${this.layout}`);\n\n return classes.join(' ');\n }\n\n /**\n * @param isRequired\n * @type {boolean}\n * @default false\n */\n get isRequired() {\n return this.args.isRequired || false;\n }\n\n /**\n * @param isOptional\n * @type {boolean}\n * @default false\n */\n get isOptional() {\n return this.args.isOptional || false;\n }\n}\n"],"names":["HdsFormFieldsetIndexComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","appendDescriptor","element","descriptors","push","id","setAriaDescribedBy","layout","getElementId","classNames","classes","join","isRequired","isOptional","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","extraAriaDescribedBy","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,o/BAAo/B;;;ACUjgCA,IAAAA,6BAA6B,IAAAC,MAAA,GAAnC,MAAMD,6BAA6B,SAASE,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,0BAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,sBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAKnEC,gBAAgBA,CAACC,OAAO,EAAE;IACxB,IAAI,CAACC,WAAW,CAACC,IAAI,CAACF,OAAO,CAACG,EAAE,CAAC,CAAA;AACnC,GAAA;AAGAC,EAAAA,kBAAkBA,GAAG;IACnBA,kBAAkB,CAAC,IAAI,CAAC,CAAA;AAC1B,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,MAAMA,GAAG;AACX,IAAA,OAAO,IAAI,CAACV,IAAI,CAACU,MAAM,IAAI,UAAU,CAAA;AACvC,GAAA;;AAEA;AACF;AACA;EACE,IAAIF,EAAEA,GAAG;IACP,OAAOG,YAAY,CAAC,IAAI,CAAC,CAAA;AAC3B,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,UAAUA,GAAG;AACf;AACA,IAAA,IAAIC,OAAO,GAAG,CAAC,gBAAgB,CAAC,CAAA;;AAEhC;IACAA,OAAO,CAACN,IAAI,CAAE,CAAA,uBAAA,EAAyB,IAAI,CAACG,MAAO,EAAC,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AAArB,MAAA,CAAAqB,SAAA,IAAArB,MAAA,EAAA;AATyC+B,oBAAA,CAAAC,QAAA,EAA7BjC,6BAA6B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../src/components/hds/form/masked-input/base.hbs","../../../../../src/components/hds/form/masked-input/base.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class={{this.classNames}} {{style width=@width}}>\\n {{#if @isMultiline}}\\n <Hds::Form::Textarea::Base\\n class=\\\"hds-form-masked-input__control\\\"\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n @height={{@height}}\\n id={{this.id}}\\n ...attributes\\n />\\n {{else}}\\n <Hds::Form::TextInput::Base\\n class=\\\"hds-form-masked-input__control\\\"\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n id={{this.id}}\\n ...attributes\\n />\\n {{/if}}\\n <Hds::Form::VisibilityToggle\\n @isVisible={{this.isContentMasked}}\\n @ariaLabel={{this.visibilityToggleAriaLabel}}\\n @ariaMessageText={{this.visibilityToggleAriaMessageText}}\\n aria-controls={{this.id}}\\n class=\\\"hds-form-masked-input__toggle-button\\\"\\n {{on \\\"click\\\" this.onClickToggleMasking}}\\n />\\n {{#if @hasCopyButton}}\\n <Hds::Copy::Button\\n class=\\\"hds-form-masked-input__copy-button\\\"\\n @text={{this.copyButtonText}}\\n @isIconOnly={{true}}\\n @targetToCopy=\\\"#{{this.id}}\\\"\\n />\\n {{/if}}\\n</div>\")","/**\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 { getElementId } from '../../../../utils/hds-get-element-id';\n\nexport default class HdsFormMaskedInputBaseComponent extends Component {\n @tracked isContentMasked = this.args.isContentMasked ?? true;\n\n @action\n onClickToggleMasking() {\n this.isContentMasked = !this.isContentMasked;\n }\n\n /**\n * Calculates the unique ID to assign to the form control\n */\n get id() {\n return getElementId(this);\n }\n\n /**\n * @param ariaLabel\n * @type {string}\n * @default 'Show masked content'\n */\n get visibilityToggleAriaLabel() {\n if (this.args.visibilityToggleAriaLabel) {\n return this.args.visibilityToggleAriaLabel;\n } else if (this.isContentMasked) {\n return 'Show masked content';\n } else {\n return 'Hide masked content';\n }\n }\n\n /**\n * @param ariaMessageText\n * @type {string}\n * @default 'Input content is now hidden'\n */\n get visibilityToggleAriaMessageText() {\n if (this.args.visibilityToggleAriaMessageText) {\n return this.args.visibilityToggleAriaMessageText;\n } else if (this.isContentMasked) {\n return 'Input content is hidden';\n } else {\n return 'Input content is visible';\n }\n }\n\n /**\n * @param copyButtonText\n * @type {string}\n * @default 'Copy masked content'\n */\n get copyButtonText() {\n if (this.args.copyButtonText) {\n return this.args.copyButtonText;\n } else {\n return 'Copy masked content';\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-form-masked-input'];\n\n if (this.isContentMasked) {\n classes.push(`hds-form-masked-input--is-masked`);\n } else {\n classes.push(`hds-form-masked-input--is-not-masked`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["HdsFormMaskedInputBaseComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","onClickToggleMasking","isContentMasked","id","getElementId","visibilityToggleAriaLabel","visibilityToggleAriaMessageText","copyButtonText","classNames","classes","push","join","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,gqCAAgqC;;;ACS7qCA,IAAAA,+BAA+B,IAAAC,MAAA,GAArC,MAAMD,+BAA+B,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AA,OAAO,qBAAqB,CAAA;AAC9B,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,UAAUA,GAAG;AACf,IAAA,IAAIC,OAAO,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAEvC,IAAI,IAAI,CAACP,eAAe,EAAE;AACxBO,MAAAA,OAAO,CAACC,IAAI,CAAE,CAAA,gCAAA,CAAiC,CAAC,CAAA;AAClD,KAAC,MAAM;AACLD,MAAAA,OAAO,CAACC,IAAI,CAAE,CAAA,oCAAA,CAAqC,CAAC,CAAA;AACtD,KAAA;AAEA,IAAA,OAAOD,OAAO,CAACE,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAC,GAAAX,WAAA,GAAAY,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAAA,iBAAA,EAAA,CAzEEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAmB,IAAI,CAACpB,IAAI,CAACI,eAAe,IAAI,IAAI,CAAA;AAAA,GAAA;AAAA,CAAAU,CAAAA,EAAAA,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAE3DM,sBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAA1B,MAAA,CAAAkB,SAAA,EAAA,sBAAA,CAAA,EAAAlB,MAAA,CAAAkB,SAAA,IAAAlB,MAAA,EAAA;AAH2C2B,oBAAA,CAAAC,QAAA,EAA/B7B,+BAA+B,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/hds/form/masked-input/base.hbs","../../../../../src/components/hds/form/masked-input/base.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class={{this.classNames}} {{style width=@width}}>\\n {{#if @isMultiline}}\\n <Hds::Form::Textarea::Base\\n class=\\\"hds-form-masked-input__control\\\"\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n @height={{@height}}\\n id={{this.id}}\\n ...attributes\\n />\\n {{else}}\\n <Hds::Form::TextInput::Base\\n class=\\\"hds-form-masked-input__control\\\"\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n id={{this.id}}\\n ...attributes\\n />\\n {{/if}}\\n <Hds::Form::VisibilityToggle\\n @isVisible={{this.isContentMasked}}\\n @ariaLabel={{this.visibilityToggleAriaLabel}}\\n @ariaMessageText={{this.visibilityToggleAriaMessageText}}\\n aria-controls={{this.id}}\\n class=\\\"hds-form-masked-input__toggle-button\\\"\\n {{on \\\"click\\\" this.onClickToggleMasking}}\\n />\\n {{#if @hasCopyButton}}\\n <Hds::Copy::Button\\n class=\\\"hds-form-masked-input__copy-button\\\"\\n @text={{this.copyButtonText}}\\n @isIconOnly={{true}}\\n @targetToCopy=\\\"#{{this.id}}\\\"\\n />\\n {{/if}}\\n</div>\")","/**\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 { getElementId } from '../../../../utils/hds-get-element-id.js';\n\nexport default class HdsFormMaskedInputBaseComponent extends Component {\n @tracked isContentMasked = this.args.isContentMasked ?? true;\n\n @action\n onClickToggleMasking() {\n this.isContentMasked = !this.isContentMasked;\n }\n\n /**\n * Calculates the unique ID to assign to the form control\n */\n get id() {\n return getElementId(this);\n }\n\n /**\n * @param ariaLabel\n * @type {string}\n * @default 'Show masked content'\n */\n get visibilityToggleAriaLabel() {\n if (this.args.visibilityToggleAriaLabel) {\n return this.args.visibilityToggleAriaLabel;\n } else if (this.isContentMasked) {\n return 'Show masked content';\n } else {\n return 'Hide masked content';\n }\n }\n\n /**\n * @param ariaMessageText\n * @type {string}\n * @default 'Input content is now hidden'\n */\n get visibilityToggleAriaMessageText() {\n if (this.args.visibilityToggleAriaMessageText) {\n return this.args.visibilityToggleAriaMessageText;\n } else if (this.isContentMasked) {\n return 'Input content is hidden';\n } else {\n return 'Input content is visible';\n }\n }\n\n /**\n * @param copyButtonText\n * @type {string}\n * @default 'Copy masked content'\n */\n get copyButtonText() {\n if (this.args.copyButtonText) {\n return this.args.copyButtonText;\n } else {\n return 'Copy masked content';\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-form-masked-input'];\n\n if (this.isContentMasked) {\n classes.push(`hds-form-masked-input--is-masked`);\n } else {\n classes.push(`hds-form-masked-input--is-not-masked`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["HdsFormMaskedInputBaseComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","onClickToggleMasking","isContentMasked","id","getElementId","visibilityToggleAriaLabel","visibilityToggleAriaMessageText","copyButtonText","classNames","classes","push","join","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,gqCAAgqC;;;ACS7qCA,IAAAA,+BAA+B,IAAAC,MAAA,GAArC,MAAMD,+BAA+B,SAASE,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,0BAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAIrEC,EAAAA,oBAAoBA,GAAG;AACrB,IAAA,IAAI,CAACC,eAAe,GAAG,CAAC,IAAI,CAACA,eAAe,CAAA;AAC9C,GAAA;;AAEA;AACF;AACA;EACE,IAAIC,EAAEA,G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AAqC,CAAC,CAAA;AACtD,KAAA;AAEA,IAAA,OAAOD,OAAO,CAACE,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAC,GAAAX,WAAA,GAAAY,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAAA,iBAAA,EAAA,CAzEEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAmB,IAAI,CAACpB,IAAI,CAACI,eAAe,IAAI,IAAI,CAAA;AAAA,GAAA;AAAA,CAAAU,CAAAA,EAAAA,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAE3DM,sBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAA1B,MAAA,CAAAkB,SAAA,EAAA,sBAAA,CAAA,EAAAlB,MAAA,CAAAkB,SAAA,IAAAlB,MAAA,EAAA;AAH2C2B,oBAAA,CAAAC,QAAA,EAA/B7B,+BAA+B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/form/radio-card/index.hbs","../../../../../src/components/hds/form/radio-card/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<label class={{this.classNames}} {{did-insert this.setAriaDescribedBy}} {{style maxWidth=@maxWidth}}>\\n <span class=\\\"hds-form-radio-card__content\\\">\\n {{yield (hash Icon=(component \\\"flight-icon\\\" size=\\\"24\\\" isInlineBlock=false))}}\\n {{yield (hash Label=(component \\\"hds/form/radio-card/label\\\"))}}\\n {{yield (hash Badge=(component \\\"hds/badge\\\"))}}\\n {{yield (hash Description=(component \\\"hds/form/radio-card/description\\\"))}}\\n {{yield (hash Generic=(component \\\"hds/yield\\\"))}}\\n </span>\\n <span class=\\\"hds-form-radio-card__control-wrapper\\\">\\n <Hds::Form::Radio::Base\\n class=\\\"hds-form-radio-card__control\\\"\\n @value={{@value}}\\n name={{@name}}\\n checked={{@checked}}\\n disabled={{@disabled}}\\n aria-describedby={{this.ariaDescribedBy}}\\n ...attributes\\n />\\n </span>\\n</label>\")","/**\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 } from '@ember/debug';\nimport { schedule } from '@ember/runloop';\nimport { setAriaDescribedBy } from '../../../../utils/hds-set-aria-described-by';\n\nexport const DEFAULT_CONTROL_POSITION = 'bottom';\nexport const DEFAULT_ALIGNMENT = 'left';\nexport const CONTROL_POSITIONS = ['bottom', 'left'];\nexport const ALIGNMENTS = ['left', 'center'];\n\nexport default class HdsFormRadioCardIndexComponent extends Component {\n @tracked ariaDescribedBy = this.args.extraAriaDescribedBy;\n @tracked descriptors = [];\n\n @action\n setAriaDescribedBy() {\n // we schedule this afterRender to capture all descriptors registered onInsert\n schedule('afterRender', () => {\n setAriaDescribedBy(this);\n });\n }\n\n /**\n * Sets the position of the control\n * Accepted values: buttom, left\n *\n * @param type\n * @type {string}\n * @default 'bottom'\n */\n get controlPosition() {\n let { controlPosition = DEFAULT_CONTROL_POSITION } = this.args;\n\n assert(\n `@controlPosition for \"Hds::Form::RadioCard\" must be one of the following: ${CONTROL_POSITIONS.join(\n ', '\n )}; received: ${controlPosition}`,\n CONTROL_POSITIONS.includes(controlPosition)\n );\n\n return controlPosition;\n }\n\n /**\n * Sets the alignment of the content\n * Accepted values: left, center\n *\n * @param alignnment\n * @type {string}\n * @default 'left'\n */\n get alignment() {\n let { alignment = DEFAULT_ALIGNMENT } = this.args;\n\n assert(\n `@alignment for \"Hds::Form::RadioCard\" must be one of the following: ${ALIGNMENTS.join(\n ', '\n )}; received: ${alignment}`,\n ALIGNMENTS.includes(alignment)\n );\n\n return alignment;\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-form-radio-card'];\n\n if (this.args.checked) {\n classes.push('hds-form-radio-card--checked');\n }\n if (this.args.disabled) {\n classes.push('hds-form-radio-card--disabled');\n }\n if (this.args.maxWidth) {\n classes.push('hds-form-radio-card--has-fixed-width');\n } else {\n classes.push('hds-form-radio-card--has-fluid-width');\n }\n\n // add a class based on the @controlPosition argument\n classes.push(`hds-form-radio-card--control-${this.controlPosition}`);\n\n // add a class based on the @alignment argument\n classes.push(`hds-form-radio-card--align-${this.alignment}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_CONTROL_POSITION","DEFAULT_ALIGNMENT","CONTROL_POSITIONS","ALIGNMENTS","HdsFormRadioCardIndexComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","setAriaDescribedBy","schedule","controlPosition","assert","join","includes","alignment","classNames","classes","checked","push","disabled","maxWidth","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","extraAriaDescribedBy","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,u8BAAu8B;;;ACWl+B,MAAMA,wBAAwB,GAAG,SAAQ;AACzC,MAAMC,iBAAiB,GAAG,OAAM;MAC1BC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAC;MACtCC,UAAU,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAC;AAEvBC,IAAAA,8BAA8B,IAAAC,MAAA,GAApC,MAAMD,8BAA8B,SAASE,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,0BAAAC,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A,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAA9B,MAAA,CAAAqB,SAAA,EAAA,oBAAA,CAAA,EAAArB,MAAA,CAAAqB,SAAA,IAAArB,MAAA,EAAA;AAJ0C+B,oBAAA,CAAAC,QAAA,EAA9BjC,8BAA8B,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/form/radio-card/index.hbs","../../../../../src/components/hds/form/radio-card/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<label class={{this.classNames}} {{did-insert this.setAriaDescribedBy}} {{style maxWidth=@maxWidth}}>\\n <span class=\\\"hds-form-radio-card__content\\\">\\n {{yield (hash Icon=(component \\\"flight-icon\\\" size=\\\"24\\\" isInlineBlock=false))}}\\n {{yield (hash Label=(component \\\"hds/form/radio-card/label\\\"))}}\\n {{yield (hash Badge=(component \\\"hds/badge\\\"))}}\\n {{yield (hash Description=(component \\\"hds/form/radio-card/description\\\"))}}\\n {{yield (hash Generic=(component \\\"hds/yield\\\"))}}\\n </span>\\n <span class=\\\"hds-form-radio-card__control-wrapper\\\">\\n <Hds::Form::Radio::Base\\n class=\\\"hds-form-radio-card__control\\\"\\n @value={{@value}}\\n name={{@name}}\\n checked={{@checked}}\\n disabled={{@disabled}}\\n aria-describedby={{this.ariaDescribedBy}}\\n ...attributes\\n />\\n </span>\\n</label>\")","/**\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 } from '@ember/debug';\nimport { schedule } from '@ember/runloop';\nimport { setAriaDescribedBy } from '../../../../utils/hds-set-aria-described-by.js';\n\nexport const DEFAULT_CONTROL_POSITION = 'bottom';\nexport const DEFAULT_ALIGNMENT = 'left';\nexport const CONTROL_POSITIONS = ['bottom', 'left'];\nexport const ALIGNMENTS = ['left', 'center'];\n\nexport default class HdsFormRadioCardIndexComponent extends Component {\n @tracked ariaDescribedBy = this.args.extraAriaDescribedBy;\n @tracked descriptors = [];\n\n @action\n setAriaDescribedBy() {\n // we schedule this afterRender to capture all descriptors registered onInsert\n schedule('afterRender', () => {\n setAriaDescribedBy(this);\n });\n }\n\n /**\n * Sets the position of the control\n * Accepted values: buttom, left\n *\n * @param type\n * @type {string}\n * @default 'bottom'\n */\n get controlPosition() {\n let { controlPosition = DEFAULT_CONTROL_POSITION } = this.args;\n\n assert(\n `@controlPosition for \"Hds::Form::RadioCard\" must be one of the following: ${CONTROL_POSITIONS.join(\n ', '\n )}; received: ${controlPosition}`,\n CONTROL_POSITIONS.includes(controlPosition)\n );\n\n return controlPosition;\n }\n\n /**\n * Sets the alignment of the content\n * Accepted values: left, center\n *\n * @param alignnment\n * @type {string}\n * @default 'left'\n */\n get alignment() {\n let { alignment = DEFAULT_ALIGNMENT } = this.args;\n\n assert(\n `@alignment for \"Hds::Form::RadioCard\" must be one of the following: ${ALIGNMENTS.join(\n ', '\n )}; received: ${alignment}`,\n ALIGNMENTS.includes(alignment)\n );\n\n return alignment;\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-form-radio-card'];\n\n if (this.args.checked) {\n classes.push('hds-form-radio-card--checked');\n }\n if (this.args.disabled) {\n classes.push('hds-form-radio-card--disabled');\n }\n if (this.args.maxWidth) {\n classes.push('hds-form-radio-card--has-fixed-width');\n } else {\n classes.push('hds-form-radio-card--has-fluid-width');\n }\n\n // add a class based on the @controlPosition argument\n classes.push(`hds-form-radio-card--control-${this.controlPosition}`);\n\n // add a class based on the @alignment argument\n classes.push(`hds-form-radio-card--align-${this.alignment}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_CONTROL_POSITION","DEFAULT_ALIGNMENT","CONTROL_POSITIONS","ALIGNMENTS","HdsFormRadioCardIndexComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","setAriaDescribedBy","schedule","controlPosition","assert","join","includes","alignment","classNames","classes","checked","push","disabled","maxWidth","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","extraAriaDescribedBy","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,u8BAAu8B;;;ACWl+B,MAAMA,wBAAwB,GAAG,SAAQ;AACzC,MAAMC,iBAAiB,GAAG,OAAM;MAC1BC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAC;MACtCC,UAAU,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAC;AAEvBC,IAAAA,8BAA8B,IAAAC,MAAA,GAApC,MAAMD,8BAA8B,SAASE,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,0BAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,sBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAKpEC,EAAAA,kBAAkBA,GAAG;AACnB;IACAC,QAAQ,CAAC,aAAa,EAAE,MAAM;MAC5BD,kBAAkB,CAAC,IAAI,CAAC,CAAA;AAC1B,KAAC,CAAC,CAAA;AACJ,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIE,eAAeA,GAAG;IACpB,IAAI;AAAEA,MAAAA,eAAe,GAAGd,wBAAAA;KAA0B,GAAG,IAAI,CAACQ,IAAI,CAAA;AAE9DO,IAAAA,MAAM,CACH,CAA4Eb,0EAAAA,EAAAA,iBAAiB,CAACc,IAAI,CACjG,IACF,CAAE,CAAA,YAA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,CAACJ,SAAU,EAAC,CAAC,CAAA;AAE5D,IAAA,OAAOE,OAAO,CAACJ,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAC,GAAAN,WAAA,GAAAe,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,EAAA,iBAAA,EAAA,CAjFEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAmB,IAAI,CAACvB,IAAI,CAACwB,oBAAoB,CAAA;AAAA,GAAA;AAAA,CAAArB,CAAAA,EAAAA,YAAA,GAAAc,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,kBACxDC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAe,EAAE,CAAA;AAAA,GAAA;AAAA,CAAAN,CAAAA,EAAAA,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,EAExBO,oBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAA9B,MAAA,CAAAqB,SAAA,EAAA,oBAAA,CAAA,EAAArB,MAAA,CAAAqB,SAAA,IAAArB,MAAA,EAAA;AAJ0C+B,oBAAA,CAAAC,QAAA,EAA9BjC,8BAA8B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../../src/components/hds/form/super-select/multiple/base.hbs","../../../../../../src/components/hds/form/super-select/multiple/base.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{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\\n <PowerSelectMultiple\\n @afterOptionsComponent={{if\\n this.showAfterOptions\\n (or\\n @afterOptionsComponent\\n (component\\n \\\"hds/form/super-select/after-options\\\"\\n content=@afterOptionsContent\\n resultCountMessage=this.resultCountMessage\\n showNoSelectedMessage=this.showNoSelectedMessage\\n showOnlySelected=this.showOnlySelected\\n showSelected=this.showSelected\\n showAll=this.showAll\\n clearSelected=this.clearSelected\\n selectedCount=this.selectedCount\\n )\\n )\\n }}\\n @ariaDescribedBy={{@ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{@ariaLabelledBy}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\\n @closeOnSelect={{false}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @extra={{@extra}}\\n @groupComponent={{component \\\"hds/form/super-select/option-group\\\"}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{this.setPowerSelectAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{this.searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{@triggerId}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadMatcher={{@typeAheadMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n ...attributes\\n as |option select|\\n >\\n {{! even if technically what is yielded here are _a list_ of options, we\\'ve decided to keep the `option` name for consistency with the existing `PowerSelect` API }}\\n {{yield option select}}\\n </PowerSelectMultiple>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport PowerSelectComponent from 'ember-power-select/components/power-select';\nimport anchoredPositionModifier from '../../../../../modifiers/hds-anchored-position';\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\n\nconst DEFAULT_HORIZONTAL_POSITION = 'bottom-start';\nconst HORIZONTAL_POSITION_MAPPING = {\n left: 'bottom-start',\n center: 'bottom',\n right: 'bottom-end',\n};\n\nexport default class HdsSuperSelectMultipleBaseComponent extends PowerSelectComponent {\n @tracked powerSelectAPI;\n @tracked showOnlySelected = false;\n @tracked showNoSelectedMessage = false;\n\n get selectedCount() {\n return this.selected?.length || '0';\n }\n\n get optionsCount() {\n return this.options?.length || '0';\n }\n\n get resultCountMessage() {\n return `${this.selectedCount} selected of ${this.optionsCount} total`;\n }\n\n @action calculatePosition(trigger, content) {\n // use `hds-anchored-position` to calculate and set position\n anchoredPositionModifier(content, [trigger], {\n placement: this.args.horizontalPosition\n ? HORIZONTAL_POSITION_MAPPING[this.args.horizontalPosition]\n : DEFAULT_HORIZONTAL_POSITION,\n offsetOptions: 4,\n enableCollisionDetection: true,\n });\n // prevent PowerSelect from setting position\n return {};\n }\n\n /**\n * This action sets the powerSelectAPI property and optionally calls a registerAPI function.\n *\n * @param {Object} powerSelectAPI - The API object for the PowerSelect component.\n *\n * If a `registerAPI` function is passed in through the component's arguments,\n * this function will be called with the `powerSelectAPI` as its argument.\n * This allows parent components or controllers to have access to the PowerSelect API.\n *\n * The `powerSelectAPI` is also stored on the component instance and used in `clearSelected`\n */\n @action\n setPowerSelectAPI(powerSelectAPI) {\n if (typeof this.args.registerAPI === 'function') {\n this.args.registerAPI(powerSelectAPI);\n }\n this.powerSelectAPI = powerSelectAPI;\n }\n\n @action showSelected() {\n this.showNoSelectedMessage = this.selectedCount === '0';\n this.showOnlySelected = true;\n }\n\n @action showAll() {\n this.showNoSelectedMessage = false;\n this.showOnlySelected = false;\n }\n\n @action clearSelected() {\n this.powerSelectAPI.actions.select(null);\n // show all options after clearing all selection\n this.showNoSelectedMessage = false;\n this.showOnlySelected = false;\n }\n\n /**\n * Determine if `@afterOptionsComponent` gets displayed\n * @param showAfterOptions\n * @type {boolean}\n * @default true\n */\n get showAfterOptions() {\n return this.args.showAfterOptions ?? true;\n }\n\n // NOTE: The searchPlaceholder doesn't currently work for the multiple select\n /**\n * Get the search placeholder text\n * @param searchPlaceholder\n * @type {string}\n * @default 'Search'\n */\n get searchPlaceholder() {\n return this.args.searchPlaceholder ?? 'Search';\n }\n\n /**\n * Get the maxWidth to apply to the dropdown\n * @param dropdownMaxWidth\n * @type {string}\n * @default 'none'\n */\n get dropdownMaxWidthStyle() {\n const maxWidthStyle = {};\n if (this.args.dropdownMaxWidth) {\n maxWidthStyle['--hds-form-super-select-dropdown-max-width'] =\n this.args.dropdownMaxWidth;\n }\n return maxWidthStyle;\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-form-super-select', 'hds-form-super-select-multiple'];\n\n // add a class based on the @matchTriggerWidth argument or whether dropdownMaxWidth is set\n if (this.args.matchTriggerWidth === false || this.args.dropdownMaxWidth) {\n classes.push('hds-form-super-select--dropdown-content-auto-width');\n }\n\n // add a class based on the @isInvalid argument\n if (this.args.isInvalid) {\n classes.push(`hds-form-super-select--is-invalid`);\n }\n\n // add a class based on the showOnlySelected\n if (this.showOnlySelected) {\n classes.push(`hds-form-super-select--show-only-selected`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_HORIZONTAL_POSITION","HORIZONTAL_POSITION_MAPPING","left","center","right","HdsSuperSelectMultipleBaseComponent","_class","PowerSelectComponent","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","selectedCount","selected","length","optionsCount","options","resultCountMessage","calculatePosition","trigger","content","anchoredPositionModifier","placement","horizontalPosition","offsetOptions","enableCollisionDetection","setPowerSelectAPI","powerSelectAPI","registerAPI","showSelected","showNoSelectedMessage","showOnlySelected","showAll","clearSelected","actions","select","showAfterOptions","searchPlaceholder","dropdownMaxWidthStyle","maxWidthStyle","dropdownMaxWidth","classNames","classes","matchTriggerWidth","push","isInvalid","join","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,o9FAAo9F;;;ACSt/F,MAAMA,2BAA2B,GAAG,cAAc,CAAA;AAClD,MAAMC,2BAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,YAAA;AACT,CAAC,CAAA;AAEoBC,IAAAA,mCAAmC,IAAAC,MAAA,GAAzC,MAAMD,mCAAmC,SAASE,oBAAoB,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,yBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,2BAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAAF,IAAAA,0BAAA,gCAAAG,YAAA,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,MAAA,CAAA4C,SAAA,EAAA5C,mBAAAA,CAAAA,EAAAA,MAAA,CAAA4C,SAAA,CAAA,EAAAD,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAwBNM,mBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAApD,MAAA,CAAA4C,SAAA,EAAA5C,mBAAAA,CAAAA,EAAAA,MAAA,CAAA4C,SAAA,CAAA,EAAAD,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAAA,cAAA,EAAA,CAQNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAApD,MAAA,CAAA4C,SAAA,EAAA,cAAA,CAAA,EAAA5C,MAAA,CAAA4C,SAAA,CAAAD,EAAAA,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAAA,SAAA,EAAA,CAKNM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAApD,MAAA,CAAA4C,SAAA,EAAA,SAAA,CAAA,EAAA5C,MAAA,CAAA4C,SAAA,GAAAD,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAKNM,eAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAApD,MAAA,CAAA4C,SAAA,oBAAA5C,MAAA,CAAA4C,SAAA,CAAA,GAAA5C,MAAA,EAAA;AA3D+CqD,oBAAA,CAAAC,QAAA,EAAnCvD,mCAAmC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../../src/components/hds/form/super-select/multiple/base.hbs","../../../../../../src/components/hds/form/super-select/multiple/base.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{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\\n <PowerSelectMultiple\\n @afterOptionsComponent={{if\\n this.showAfterOptions\\n (or\\n @afterOptionsComponent\\n (component\\n \\\"hds/form/super-select/after-options\\\"\\n content=@afterOptionsContent\\n resultCountMessage=this.resultCountMessage\\n showNoSelectedMessage=this.showNoSelectedMessage\\n showOnlySelected=this.showOnlySelected\\n showSelected=this.showSelected\\n showAll=this.showAll\\n clearSelected=this.clearSelected\\n selectedCount=this.selectedCount\\n )\\n )\\n }}\\n @ariaDescribedBy={{@ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{@ariaLabelledBy}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\\n @closeOnSelect={{false}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @extra={{@extra}}\\n @groupComponent={{component \\\"hds/form/super-select/option-group\\\"}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{this.setPowerSelectAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{this.searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{@triggerId}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadMatcher={{@typeAheadMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n ...attributes\\n as |option select|\\n >\\n {{! even if technically what is yielded here are _a list_ of options, we\\'ve decided to keep the `option` name for consistency with the existing `PowerSelect` API }}\\n {{yield option select}}\\n </PowerSelectMultiple>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport PowerSelectComponent from 'ember-power-select/components/power-select';\nimport anchoredPositionModifier from '../../../../../modifiers/hds-anchored-position.js';\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\n\nconst DEFAULT_HORIZONTAL_POSITION = 'bottom-start';\nconst HORIZONTAL_POSITION_MAPPING = {\n left: 'bottom-start',\n center: 'bottom',\n right: 'bottom-end',\n};\n\nexport default class HdsSuperSelectMultipleBaseComponent extends PowerSelectComponent {\n @tracked powerSelectAPI;\n @tracked showOnlySelected = false;\n @tracked showNoSelectedMessage = false;\n\n get selectedCount() {\n return this.selected?.length || '0';\n }\n\n get optionsCount() {\n return this.options?.length || '0';\n }\n\n get resultCountMessage() {\n return `${this.selectedCount} selected of ${this.optionsCount} total`;\n }\n\n @action calculatePosition(trigger, content) {\n // use `hds-anchored-position` to calculate and set position\n anchoredPositionModifier(content, [trigger], {\n placement: this.args.horizontalPosition\n ? HORIZONTAL_POSITION_MAPPING[this.args.horizontalPosition]\n : DEFAULT_HORIZONTAL_POSITION,\n offsetOptions: 4,\n enableCollisionDetection: true,\n });\n // prevent PowerSelect from setting position\n return {};\n }\n\n /**\n * This action sets the powerSelectAPI property and optionally calls a registerAPI function.\n *\n * @param {Object} powerSelectAPI - The API object for the PowerSelect component.\n *\n * If a `registerAPI` function is passed in through the component's arguments,\n * this function will be called with the `powerSelectAPI` as its argument.\n * This allows parent components or controllers to have access to the PowerSelect API.\n *\n * The `powerSelectAPI` is also stored on the component instance and used in `clearSelected`\n */\n @action\n setPowerSelectAPI(powerSelectAPI) {\n if (typeof this.args.registerAPI === 'function') {\n this.args.registerAPI(powerSelectAPI);\n }\n this.powerSelectAPI = powerSelectAPI;\n }\n\n @action showSelected() {\n this.showNoSelectedMessage = this.selectedCount === '0';\n this.showOnlySelected = true;\n }\n\n @action showAll() {\n this.showNoSelectedMessage = false;\n this.showOnlySelected = false;\n }\n\n @action clearSelected() {\n this.powerSelectAPI.actions.select(null);\n // show all options after clearing all selection\n this.showNoSelectedMessage = false;\n this.showOnlySelected = false;\n }\n\n /**\n * Determine if `@afterOptionsComponent` gets displayed\n * @param showAfterOptions\n * @type {boolean}\n * @default true\n */\n get showAfterOptions() {\n return this.args.showAfterOptions ?? true;\n }\n\n // NOTE: The searchPlaceholder doesn't currently work for the multiple select\n /**\n * Get the search placeholder text\n * @param searchPlaceholder\n * @type {string}\n * @default 'Search'\n */\n get searchPlaceholder() {\n return this.args.searchPlaceholder ?? 'Search';\n }\n\n /**\n * Get the maxWidth to apply to the dropdown\n * @param dropdownMaxWidth\n * @type {string}\n * @default 'none'\n */\n get dropdownMaxWidthStyle() {\n const maxWidthStyle = {};\n if (this.args.dropdownMaxWidth) {\n maxWidthStyle['--hds-form-super-select-dropdown-max-width'] =\n this.args.dropdownMaxWidth;\n }\n return maxWidthStyle;\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-form-super-select', 'hds-form-super-select-multiple'];\n\n // add a class based on the @matchTriggerWidth argument or whether dropdownMaxWidth is set\n if (this.args.matchTriggerWidth === false || this.args.dropdownMaxWidth) {\n classes.push('hds-form-super-select--dropdown-content-auto-width');\n }\n\n // add a class based on the @isInvalid argument\n if (this.args.isInvalid) {\n classes.push(`hds-form-super-select--is-invalid`);\n }\n\n // add a class based on the showOnlySelected\n if (this.showOnlySelected) {\n classes.push(`hds-form-super-select--show-only-selected`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_HORIZONTAL_POSITION","HORIZONTAL_POSITION_MAPPING","left","center","right","HdsSuperSelectMultipleBaseComponent","_class","PowerSelectComponent","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","selectedCount","selected","length","optionsCount","options","resultCountMessage","calculatePosition","trigger","content","anchoredPositionModifier","placement","horizontalPosition","offsetOptions","enableCollisionDetection","setPowerSelectAPI","powerSelectAPI","registerAPI","showSelected","showNoSelectedMessage","showOnlySelected","showAll","clearSelected","actions","select","showAfterOptions","searchPlaceholder","dropdownMaxWidthStyle","maxWidthStyle","dropdownMaxWidth","classNames","classes","matchTriggerWidth","push","isInvalid","join","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,o9FAAo9F;;;ACSt/F,MAAMA,2BAA2B,GAAG,cAAc,CAAA;AAClD,MAAMC,2BAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,YAAA;AACT,CAAC,CAAA;AAEoBC,IAAAA,mCAAmC,IAAAC,MAAA,GAAzC,MAAMD,mCAAmC,SAASE,oBAAoB,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,yBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,2BAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAAF,IAAAA,0BAAA,gCAAAG,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EA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CAAAA,EAAAA,MAAA,CAAA4C,SAAA,CAAA,EAAAD,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAwBNM,mBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAApD,MAAA,CAAA4C,SAAA,EAAA5C,mBAAAA,CAAAA,EAAAA,MAAA,CAAA4C,SAAA,CAAA,EAAAD,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAAA,cAAA,EAAA,CAQNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAApD,MAAA,CAAA4C,SAAA,EAAA,cAAA,CAAA,EAAA5C,MAAA,CAAA4C,SAAA,CAAAD,EAAAA,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAAA,SAAA,EAAA,CAKNM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAApD,MAAA,CAAA4C,SAAA,EAAA,SAAA,CAAA,EAAA5C,MAAA,CAAA4C,SAAA,GAAAD,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAKNM,eAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAApD,MAAA,CAAA4C,SAAA,oBAAA5C,MAAA,CAAA4C,SAAA,CAAA,GAAA5C,MAAA,EAAA;AA3D+CqD,oBAAA,CAAAC,QAAA,EAAnCvD,mCAAmC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sources":["../../../../../../src/components/hds/form/super-select/multiple/field.hbs","../../../../../../src/components/hds/form/super-select/multiple/field.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}\\n {{yield (hash HelperText=F.HelperText Error=F.Error)}}\\n <F.Control>\\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\\n <Hds::Form::SuperSelect::Multiple::Base\\n @afterOptionsComponent={{@afterOptionsComponent}}\\n @afterOptionsContent={{@afterOptionsContent}}\\n @ariaDescribedBy={{F.ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @dropdownMaxWidth={{@dropdownMaxWidth}}\\n @extra={{@extra}}\\n @groupComponent={{@groupComponent}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{@matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{@searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @showAfterOptions={{@showAfterOptions}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{F.id}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadMatcher={{@typeAheadMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n @isInvalid={{@isInvalid}}\\n ...attributes\\n as |options select|\\n >\\n {{yield (hash options=options select=select Options=(component \\\"hds/yield\\\" options=options select=select))}}\\n </Hds::Form::SuperSelect::Multiple::Base>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport PowerSelectComponent from 'ember-power-select/components/power-select';\nimport { ID_PREFIX } from '../../label/index';\n\nexport default class HdsSuperSelectMultipleFieldComponent extends PowerSelectComponent {\n get idPrefix() {\n return ID_PREFIX;\n }\n}\n"],"names":["HdsSuperSelectMultipleFieldComponent","PowerSelectComponent","idPrefix","ID_PREFIX","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,m8FAAm8F;;ACDr+F;AACA;AACA;AACA;;AAKe,MAAMA,oCAAoC,SAASC,oBAAoB,CAAC;EACrF,IAAIC,QAAQA,GAAG;AACb,IAAA,OAAOC,SAAS,CAAA;AAClB,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAJoBL,oCAAoC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"field.js","sources":["../../../../../../src/components/hds/form/super-select/multiple/field.hbs","../../../../../../src/components/hds/form/super-select/multiple/field.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}\\n {{yield (hash HelperText=F.HelperText Error=F.Error)}}\\n <F.Control>\\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\\n <Hds::Form::SuperSelect::Multiple::Base\\n @afterOptionsComponent={{@afterOptionsComponent}}\\n @afterOptionsContent={{@afterOptionsContent}}\\n @ariaDescribedBy={{F.ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @dropdownMaxWidth={{@dropdownMaxWidth}}\\n @extra={{@extra}}\\n @groupComponent={{@groupComponent}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{@matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{@searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @showAfterOptions={{@showAfterOptions}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{F.id}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadMatcher={{@typeAheadMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n @isInvalid={{@isInvalid}}\\n ...attributes\\n as |options select|\\n >\\n {{yield (hash options=options select=select Options=(component \\\"hds/yield\\\" options=options select=select))}}\\n </Hds::Form::SuperSelect::Multiple::Base>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport PowerSelectComponent from 'ember-power-select/components/power-select';\nimport { ID_PREFIX } from '../../label/index.js';\n\nexport default class HdsSuperSelectMultipleFieldComponent extends PowerSelectComponent {\n get idPrefix() {\n return ID_PREFIX;\n }\n}\n"],"names":["HdsSuperSelectMultipleFieldComponent","PowerSelectComponent","idPrefix","ID_PREFIX","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,m8FAAm8F;;ACDr+F;AACA;AACA;AACA;;AAKe,MAAMA,oCAAoC,SAASC,oBAAoB,CAAC;EACrF,IAAIC,QAAQA,GAAG;AACb,IAAA,OAAOC,SAAS,CAAA;AAClB,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAJoBL,oCAAoC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../../src/components/hds/form/super-select/single/base.hbs","../../../../../../src/components/hds/form/super-select/single/base.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{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\\n <PowerSelect\\n @afterOptionsComponent={{if\\n this.showAfterOptions\\n (or\\n @afterOptionsComponent\\n (component\\n \\\"hds/form/super-select/after-options\\\" content=@afterOptionsContent resultCountMessage=this.resultCountMessage\\n )\\n )\\n }}\\n @ariaDescribedBy={{@ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{@ariaLabelledBy}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\\n @closeOnSelect={{@closeOnSelect}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @extra={{@extra}}\\n @groupComponent={{component \\\"hds/form/super-select/option-group\\\"}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{component \\\"hds/form/super-select/placeholder\\\"}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{this.searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{@triggerId}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadMatcher={{@typeAheadMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n ...attributes\\n as |option select|\\n >\\n <Hds::Text::Body>{{yield option select}}</Hds::Text::Body>\\n </PowerSelect>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport PowerSelectComponent from 'ember-power-select/components/power-select';\nimport anchoredPositionModifier from '../../../../../modifiers/hds-anchored-position';\nimport { action } from '@ember/object';\n\nconst DEFAULT_HORIZONTAL_POSITION = 'bottom-start';\nconst HORIZONTAL_POSITION_MAPPING = {\n left: 'bottom-start',\n center: 'bottom',\n right: 'bottom-end',\n};\n\nexport default class HdsSuperSelectSingleBaseComponent extends PowerSelectComponent {\n @action calculatePosition(trigger, content) {\n // use `hds-anchored-position` to calculate and set position\n anchoredPositionModifier(content, [trigger], {\n placement: this.args.horizontalPosition\n ? HORIZONTAL_POSITION_MAPPING[this.args.horizontalPosition]\n : DEFAULT_HORIZONTAL_POSITION,\n offsetOptions: 4,\n enableCollisionDetection: true,\n });\n // prevent PowerSelect from setting position\n return {};\n }\n\n /**\n * Determine if `@afterOptionsComponent` gets displayed\n * @param showAfterOptions\n * @type {boolean}\n * @default false\n */\n get showAfterOptions() {\n return this.args.showAfterOptions ?? this.args.afterOptionsContent ?? false;\n }\n\n /**\n * Get the search placeholder text\n * @param searchPlaceholder\n * @type {string}\n * @default 'Search'\n */\n get searchPlaceholder() {\n return this.args.searchPlaceholder ?? 'Search';\n }\n\n /**\n * Get the maxWidth to apply to the dropdown\n * @param dropdownMaxWidth\n * @type {string}\n * @default 'none'\n */\n get dropdownMaxWidthStyle() {\n const maxWidthStyle = {};\n if (this.args.dropdownMaxWidth) {\n maxWidthStyle['--hds-form-super-select-dropdown-max-width'] =\n this.args.dropdownMaxWidth;\n }\n return maxWidthStyle;\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-form-super-select', 'hds-form-super-select-single'];\n\n // add a class based on the @matchTriggerWidth argument or whether dropdownMaxWidth is set\n if (this.args.matchTriggerWidth === false || this.args.dropdownMaxWidth) {\n classes.push('hds-form-super-select--dropdown-content-auto-width');\n }\n\n // add a class based on the @isInvalid argument\n if (this.args.isInvalid) {\n classes.push(`hds-form-super-select--is-invalid`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_HORIZONTAL_POSITION","HORIZONTAL_POSITION_MAPPING","left","center","right","HdsSuperSelectSingleBaseComponent","_class","PowerSelectComponent","calculatePosition","trigger","content","anchoredPositionModifier","placement","args","horizontalPosition","offsetOptions","enableCollisionDetection","showAfterOptions","afterOptionsContent","searchPlaceholder","dropdownMaxWidthStyle","maxWidthStyle","dropdownMaxWidth","classNames","classes","matchTriggerWidth","push","isInvalid","join","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,+iFAA+iF;;;ACQjlF,MAAMA,2BAA2B,GAAG,cAAc,CAAA;AAClD,MAAMC,2BAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,YAAA;AACT,CAAC,CAAA;AAEoBC,IAAAA,iCAAiC,IAAAC,MAAA,GAAvC,MAAMD,iCAAiC,SAASE,oBAAoB,CAAC;AAC1EC,EAAAA,iBAAiBA,CAACC,OAAO,EAAEC,OAAO,EAAE;AAC1C;AACAC,IAAAA,wBAAwB,CAACD,OAAO,EAAE,CAACD,OAAO,CAAC,EAAE;AAC3CG,MA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SAAS,EAAE;AACvBH,MAAAA,OAAO,CAACE,IAAI,CAAE,CAAA,iCAAA,CAAkC,CAAC,CAAA;AACnD,KAAA;AAEA,IAAA,OAAOF,OAAO,CAACI,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAC,GAAAC,yBAAA,CAAAvB,MAAA,CAAAwB,SAAA,EAAA,mBAAA,EAAA,CApEEC,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAA3B,MAAA,CAAAwB,SAAA,wBAAAxB,MAAA,CAAAwB,SAAA,CAAA,GAAAxB,MAAA,EAAA;AAD6C4B,oBAAA,CAAAC,QAAA,EAAjC9B,iCAAiC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../../src/components/hds/form/super-select/single/base.hbs","../../../../../../src/components/hds/form/super-select/single/base.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{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\\n <PowerSelect\\n @afterOptionsComponent={{if\\n this.showAfterOptions\\n (or\\n @afterOptionsComponent\\n (component\\n \\\"hds/form/super-select/after-options\\\" content=@afterOptionsContent resultCountMessage=this.resultCountMessage\\n )\\n )\\n }}\\n @ariaDescribedBy={{@ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{@ariaLabelledBy}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\\n @closeOnSelect={{@closeOnSelect}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @extra={{@extra}}\\n @groupComponent={{component \\\"hds/form/super-select/option-group\\\"}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{component \\\"hds/form/super-select/placeholder\\\"}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{this.searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{@triggerId}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadMatcher={{@typeAheadMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n ...attributes\\n as |option select|\\n >\\n <Hds::Text::Body>{{yield option select}}</Hds::Text::Body>\\n </PowerSelect>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport PowerSelectComponent from 'ember-power-select/components/power-select';\nimport anchoredPositionModifier from '../../../../../modifiers/hds-anchored-position.js';\nimport { action } from '@ember/object';\n\nconst DEFAULT_HORIZONTAL_POSITION = 'bottom-start';\nconst HORIZONTAL_POSITION_MAPPING = {\n left: 'bottom-start',\n center: 'bottom',\n right: 'bottom-end',\n};\n\nexport default class HdsSuperSelectSingleBaseComponent extends PowerSelectComponent {\n @action calculatePosition(trigger, content) {\n // use `hds-anchored-position` to calculate and set position\n anchoredPositionModifier(content, [trigger], {\n placement: this.args.horizontalPosition\n ? HORIZONTAL_POSITION_MAPPING[this.args.horizontalPosition]\n : DEFAULT_HORIZONTAL_POSITION,\n offsetOptions: 4,\n enableCollisionDetection: true,\n });\n // prevent PowerSelect from setting position\n return {};\n }\n\n /**\n * Determine if `@afterOptionsComponent` gets displayed\n * @param showAfterOptions\n * @type {boolean}\n * @default false\n */\n get showAfterOptions() {\n return this.args.showAfterOptions ?? this.args.afterOptionsContent ?? false;\n }\n\n /**\n * Get the search placeholder text\n * @param searchPlaceholder\n * @type {string}\n * @default 'Search'\n */\n get searchPlaceholder() {\n return this.args.searchPlaceholder ?? 'Search';\n }\n\n /**\n * Get the maxWidth to apply to the dropdown\n * @param dropdownMaxWidth\n * @type {string}\n * @default 'none'\n */\n get dropdownMaxWidthStyle() {\n const maxWidthStyle = {};\n if (this.args.dropdownMaxWidth) {\n maxWidthStyle['--hds-form-super-select-dropdown-max-width'] =\n this.args.dropdownMaxWidth;\n }\n return maxWidthStyle;\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-form-super-select', 'hds-form-super-select-single'];\n\n // add a class based on the @matchTriggerWidth argument or whether dropdownMaxWidth is set\n if (this.args.matchTriggerWidth === false || this.args.dropdownMaxWidth) {\n classes.push('hds-form-super-select--dropdown-content-auto-width');\n }\n\n // add a class based on the @isInvalid argument\n if (this.args.isInvalid) {\n classes.push(`hds-form-super-select--is-invalid`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_HORIZONTAL_POSITION","HORIZONTAL_POSITION_MAPPING","left","center","right","HdsSuperSelectSingleBaseComponent","_class","PowerSelectComponent","calculatePosition","trigger","content","anchoredPositionModifier","placement","args","horizontalPosition","offsetOptions","enableCollisionDetection","showAfterOptions","afterOptionsContent","searchPlaceholder","dropdownMaxWidthStyle","maxWidthStyle","dropdownMaxWidth","classNames","classes","matchTriggerWidth","push","isInvalid","join","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,+iFAA+iF;;;ACQjlF,MAAMA,2BAA2B,GAAG,cAAc,CAAA;AAClD,MAAMC,2BAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,YAAA;AACT,CAAC,CAAA;AAEoBC,IAAAA,iCAAiC,IAAAC,MAAA,GAAvC,MAAMD,iCAAiC,SAASE,oBAAoB,CAAC;AAC1EC,EAAAA,iBAAiBA,CAACC,OAAO,EAAEC,OAAO,EAAE;AAC1C;AACAC,IAAAA,wBAAwB,CAACD,OAAO,EAAE,CAACD,OAAO,CAAC,EAAE;AAC3CG,MAAAA,SAAS,EAAE,IAAI,CAACC,IAAI,CAACC,kBAAkB,GACnCb,2BAA2B,CAAC,IAAI,CAACY,IAAI,CAACC,kBAAkB,CAAC,GACzDd,2BAA2B;AAC/Be,MAAAA,aAAa,EAAE,CAAC;AAChBC,MAAAA,wBAAwB,EAAE,IAAA;AAC5B,KAAC,CAAC,CAAA;AACF;AACA,IAAA,OAAO,EAAE,CAAA;AACX,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,gBAAgBA,GAAG;AACrB,IAAA,OAAO,IAAI,CAACJ,IAAI,CAACI,gBAAgB,IAAI,IAAI,CAACJ,IAAI,CAACK,mBAAmB,IAAI,KAAK,CAAA;AAC7E,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,iBAAiBA,GAAG;AACtB,IAAA,OAAO,IAAI,CAACN,IAAI,CAACM,iBAAiB,IAAI,QAAQ,CAAA;AAChD,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,qBAAqBA,GAAG;IAC1B,MAAMC,aAAa,GAAG,EAAE,CAAA;AACxB,IAAA,IAAI,IAAI,CAACR,IAAI,CAACS,gBAAgB,EAAE;MAC9BD,aAAa,CAAC,4CAA4C,CAAC,GACzD,IAAI,CAACR,IAAI,CAACS,gBAAgB,CAAA;AAC9B,KAAA;AACA,IAAA,OAAOD,aAAa,CAAA;AACtB,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIE,UAAUA,GAAG;AACf,IAAA,IAAIC,OAAO,GAAG,CAAC,uBAAuB,EAAE,8BAA8B,CAAC,CAAA;;AAEvE;AACA,IAAA,IAAI,IAAI,CAACX,IAAI,CAACY,iBAAiB,KAAK,KAAK,IAAI,IAAI,CAACZ,IAAI,CAACS,gBAAgB,EAAE;AACvEE,MAAAA,OAAO,CAACE,IAAI,CAAC,oDAAoD,CAAC,CAAA;AACpE,KAAA;;AAEA;AACA,IAAA,IAAI,IAAI,CAACb,IAAI,CAACc,SAAS,EAAE;AACvBH,MAAAA,OAAO,CAACE,IAAI,CAAE,CAAA,iCAAA,CAAkC,CAAC,CAAA;AACnD,KAAA;AAEA,IAAA,OAAOF,OAAO,CAACI,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAC,GAAAC,yBAAA,CAAAvB,MAAA,CAAAwB,SAAA,EAAA,mBAAA,EAAA,CApEEC,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAA3B,MAAA,CAAAwB,SAAA,wBAAAxB,MAAA,CAAAwB,SAAA,CAAA,GAAAxB,MAAA,EAAA;AAD6C4B,oBAAA,CAAAC,QAAA,EAAjC9B,iCAAiC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sources":["../../../../../../src/components/hds/form/super-select/single/field.hbs","../../../../../../src/components/hds/form/super-select/single/field.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}\\n {{yield (hash HelperText=F.HelperText Error=F.Error)}}\\n <F.Control>\\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\\n <Hds::Form::SuperSelect::Single::Base\\n @afterOptionsComponent={{@afterOptionsComponent}}\\n @afterOptionsContent={{@afterOptionsContent}}\\n @ariaDescribedBy={{F.ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @closeOnSelect={{@closeOnSelect}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @dropdownMaxWidth={{@dropdownMaxWidth}}\\n @extra={{@extra}}\\n @groupComponent={{@groupComponent}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{@matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{@searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @showAfterOptions={{@showAfterOptions}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{F.id}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadMatcher={{@typeAheadMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n @isInvalid={{@isInvalid}}\\n ...attributes\\n as |options select|\\n >\\n {{yield (hash options=options select=select Options=(component \\\"hds/yield\\\" options=options select=select))}}\\n </Hds::Form::SuperSelect::Single::Base>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport PowerSelectComponent from 'ember-power-select/components/power-select';\nimport { ID_PREFIX } from '../../label/index';\n\nexport default class HdsSuperSelectSingleFieldComponent extends PowerSelectComponent {\n get idPrefix() {\n return ID_PREFIX;\n }\n}\n"],"names":["HdsSuperSelectSingleFieldComponent","PowerSelectComponent","idPrefix","ID_PREFIX","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,w+FAAw+F;;ACD1gG;AACA;AACA;AACA;;AAKe,MAAMA,kCAAkC,SAASC,oBAAoB,CAAC;EACnF,IAAIC,QAAQA,GAAG;AACb,IAAA,OAAOC,SAAS,CAAA;AAClB,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAJoBL,kCAAkC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"field.js","sources":["../../../../../../src/components/hds/form/super-select/single/field.hbs","../../../../../../src/components/hds/form/super-select/single/field.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}\\n {{yield (hash HelperText=F.HelperText Error=F.Error)}}\\n <F.Control>\\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\\n <Hds::Form::SuperSelect::Single::Base\\n @afterOptionsComponent={{@afterOptionsComponent}}\\n @afterOptionsContent={{@afterOptionsContent}}\\n @ariaDescribedBy={{F.ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @closeOnSelect={{@closeOnSelect}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @dropdownMaxWidth={{@dropdownMaxWidth}}\\n @extra={{@extra}}\\n @groupComponent={{@groupComponent}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{@matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{@searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @showAfterOptions={{@showAfterOptions}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{F.id}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadMatcher={{@typeAheadMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n @isInvalid={{@isInvalid}}\\n ...attributes\\n as |options select|\\n >\\n {{yield (hash options=options select=select Options=(component \\\"hds/yield\\\" options=options select=select))}}\\n </Hds::Form::SuperSelect::Single::Base>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport PowerSelectComponent from 'ember-power-select/components/power-select';\nimport { ID_PREFIX } from '../../label/index.js';\n\nexport default class HdsSuperSelectSingleFieldComponent extends PowerSelectComponent {\n get idPrefix() {\n return ID_PREFIX;\n }\n}\n"],"names":["HdsSuperSelectSingleFieldComponent","PowerSelectComponent","idPrefix","ID_PREFIX","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,w+FAAw+F;;ACD1gG;AACA;AACA;AACA;;AAKe,MAAMA,kCAAkC,SAASC,oBAAoB,CAAC;EACnF,IAAIC,QAAQA,GAAG;AACb,IAAA,OAAOC,SAAS,CAAA;AAClB,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAJoBL,kCAAkC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/modal/index.hbs","../../../../src/components/hds/modal/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<dialog\\n class={{this.classNames}}\\n ...attributes\\n aria-labelledby={{this.id}}\\n {{did-insert this.didInsert}}\\n {{will-destroy this.willDestroyNode}}\\n {{focus-trap isActive=this.isOpen focusTrapOptions=(hash onDeactivate=this.onDismiss clickOutsideDeactivates=true)}}\\n>\\n {{yield (hash Header=(component \\\"hds/modal/header\\\" id=this.id onDismiss=this.onDismiss))}}\\n {{yield (hash Body=(component \\\"hds/modal/body\\\"))}}\\n {{yield (hash Footer=(component \\\"hds/modal/footer\\\" onDismiss=this.onDismiss))}}\\n</dialog>\\n{{#if this.isOpen}}\\n <div class=\\\"hds-modal__overlay\\\"></div>\\n{{/if}}\")","/**\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 } from '@ember/debug';\nimport { getElementId } from '../../../utils/hds-get-element-id';\nimport { buildWaiter } from '@ember/test-waiters';\n\nlet waiter = buildWaiter('@hashicorp/design-system-components:modal');\n\nexport const DEFAULT_SIZE = 'medium';\nexport const DEFAULT_COLOR = 'neutral';\nexport const SIZES = ['small', 'medium', 'large'];\nexport const COLORS = ['neutral', 'warning', 'critical'];\n\nexport default class HdsModalIndexComponent extends Component {\n @tracked isOpen = false;\n @tracked isDismissDisabled = this.args.isDismissDisabled ?? false;\n\n /**\n * Sets the size of the modal dialog\n * Accepted values: small, 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::Modal\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Sets the color of the modal dialog\n * Accepted values: neutral, warning, critical\n *\n * @param color\n * @type {string}\n * @default 'neutral'\n */\n get color() {\n let { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Modal\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * Calculates the unique ID to assign to the title\n */\n get id() {\n return getElementId(this);\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-modal'];\n\n // add a class based on the @size argument\n classes.push(`hds-modal--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-modal--color-${this.color}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback() {\n if (\n !this.isDismissDisabled &&\n this.args.onClose &&\n typeof this.args.onClose === 'function'\n ) {\n this.args.onClose();\n }\n\n // If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed\n if (this.isDismissDisabled) {\n // If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail\n // so we add this safeguard condition that checks for the `<dialog>` to have a parent\n if (this.element.parentElement) {\n // As there is no way to `preventDefault` on `close` events, we call the `showModal` function\n // preserving the state of the modal dialog\n this.element.showModal();\n }\n } else {\n this.isOpen = false;\n }\n }\n\n @action\n didInsert(element) {\n // Store references of `<dialog>` and `<body>` elements\n this.element = element;\n this.body = document.body;\n\n if (this.body) {\n // Store the initial `overflow` value of `<body>` so we can reset to it\n this.bodyInitialOverflowValue =\n this.body.style.getPropertyValue('overflow');\n }\n\n // Register \"onClose\" callback function to be called when a native 'close' event is dispatched\n this.element.addEventListener('close', this.registerOnCloseCallback, true);\n\n // If the modal dialog is not already open\n if (!this.element.open) {\n this.open();\n }\n }\n\n @action\n willDestroyNode() {\n if (this.element) {\n this.element.removeEventListener(\n 'close',\n this.registerOnCloseCallback,\n true\n );\n }\n }\n\n @action\n open() {\n // Make modal dialog visible using the native `showModal` method\n this.element.showModal();\n this.isOpen = true;\n\n // Prevent page from scrolling when the dialog is open\n if (this.body) this.body.style.setProperty('overflow', 'hidden');\n\n // Call \"onOpen\" callback function\n if (this.args.onOpen && typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n }\n\n @action\n async onDismiss() {\n // allow ember test helpers to be aware of when the `close` event fires\n // when using `click` or other helpers from '@ember/test-helpers'\n // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)\n if (this.element.open) {\n let token = waiter.beginAsync();\n let listener = () => {\n waiter.endAsync(token);\n this.element.removeEventListener('close', listener);\n };\n this.element.addEventListener('close', listener);\n }\n\n // Make modal dialog invisible using the native `close` method\n this.element.close();\n\n // Reset page `overflow` property\n if (this.body) {\n this.body.style.removeProperty('overflow');\n if (this.bodyInitialOverflowValue === '') {\n if (this.body.style.length === 0) {\n this.body.removeAttribute('style');\n }\n } else {\n this.body.style.setProperty('overflow', this.bodyInitialOverflowValue);\n }\n }\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","DEFAULT_COLOR","SIZES","COLORS","HdsModalIndexComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","size","assert","join","includes","color","id","getElementId","classNames","classes","push","registerOnCloseCallback","isDismissDisabled","onClose","element","parentElement","showModal","isOpen","didInsert","body","document","bodyInitialOverflowValue","style","getPropertyValue","addEventListener","open","willDestroyNode","removeEventListener","setProperty","onOpen","onDismiss","token","beginAsync","listener","endAsync","close","removeProperty","length","removeAttribute","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,otBAAotB;;;ACWtvB,I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AAA,OAAqB,IAAI,CAAChD,IAAI,CAACe,iBAAiB,IAAI,KAAK,CAAA;AAAA,GAAA;AAAA,CAAA2B,CAAAA,EAAAA,yBAAA,CAAA7C,MAAA,CAAA8C,SAAA,EAoEhEM,yBAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,EAAA9C,yBAAAA,CAAAA,EAAAA,MAAA,CAAA8C,SAAA,CAAA,EAAAD,yBAAA,CAAA7C,MAAA,CAAA8C,SAAA,EAuBNM,WAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,EAAA9C,WAAAA,CAAAA,EAAAA,MAAA,CAAA8C,SAAA,CAAA,EAAAD,yBAAA,CAAA7C,MAAA,CAAA8C,SAAA,EAAA,iBAAA,EAAA,CAqBNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,EAAA,iBAAA,CAAA,EAAA9C,MAAA,CAAA8C,SAAA,CAAAD,EAAAA,yBAAA,CAAA7C,MAAA,CAAA8C,SAAA,EAAA,MAAA,EAAA,CAWNM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,EAAA,MAAA,CAAA,EAAA9C,MAAA,CAAA8C,SAAA,GAAAD,yBAAA,CAAA7C,MAAA,CAAA8C,SAAA,EAeNM,WAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,gBAAA9C,MAAA,CAAA8C,SAAA,CAAA,GAAA9C,MAAA,EAAA;AA5IkCuD,oBAAA,CAAAC,QAAA,EAAtBzD,sBAAsB,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/modal/index.hbs","../../../../src/components/hds/modal/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<dialog\\n class={{this.classNames}}\\n ...attributes\\n aria-labelledby={{this.id}}\\n {{did-insert this.didInsert}}\\n {{will-destroy this.willDestroyNode}}\\n {{focus-trap isActive=this.isOpen focusTrapOptions=(hash onDeactivate=this.onDismiss clickOutsideDeactivates=true)}}\\n>\\n {{yield (hash Header=(component \\\"hds/modal/header\\\" id=this.id onDismiss=this.onDismiss))}}\\n {{yield (hash Body=(component \\\"hds/modal/body\\\"))}}\\n {{yield (hash Footer=(component \\\"hds/modal/footer\\\" onDismiss=this.onDismiss))}}\\n</dialog>\\n{{#if this.isOpen}}\\n <div class=\\\"hds-modal__overlay\\\"></div>\\n{{/if}}\")","/**\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 } from '@ember/debug';\nimport { getElementId } from '../../../utils/hds-get-element-id.js';\nimport { buildWaiter } from '@ember/test-waiters';\n\nlet waiter = buildWaiter('@hashicorp/design-system-components:modal');\n\nexport const DEFAULT_SIZE = 'medium';\nexport const DEFAULT_COLOR = 'neutral';\nexport const SIZES = ['small', 'medium', 'large'];\nexport const COLORS = ['neutral', 'warning', 'critical'];\n\nexport default class HdsModalIndexComponent extends Component {\n @tracked isOpen = false;\n @tracked isDismissDisabled = this.args.isDismissDisabled ?? false;\n\n /**\n * Sets the size of the modal dialog\n * Accepted values: small, 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::Modal\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Sets the color of the modal dialog\n * Accepted values: neutral, warning, critical\n *\n * @param color\n * @type {string}\n * @default 'neutral'\n */\n get color() {\n let { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Modal\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * Calculates the unique ID to assign to the title\n */\n get id() {\n return getElementId(this);\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-modal'];\n\n // add a class based on the @size argument\n classes.push(`hds-modal--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-modal--color-${this.color}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback() {\n if (\n !this.isDismissDisabled &&\n this.args.onClose &&\n typeof this.args.onClose === 'function'\n ) {\n this.args.onClose();\n }\n\n // If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed\n if (this.isDismissDisabled) {\n // If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail\n // so we add this safeguard condition that checks for the `<dialog>` to have a parent\n if (this.element.parentElement) {\n // As there is no way to `preventDefault` on `close` events, we call the `showModal` function\n // preserving the state of the modal dialog\n this.element.showModal();\n }\n } else {\n this.isOpen = false;\n }\n }\n\n @action\n didInsert(element) {\n // Store references of `<dialog>` and `<body>` elements\n this.element = element;\n this.body = document.body;\n\n if (this.body) {\n // Store the initial `overflow` value of `<body>` so we can reset to it\n this.bodyInitialOverflowValue =\n this.body.style.getPropertyValue('overflow');\n }\n\n // Register \"onClose\" callback function to be called when a native 'close' event is dispatched\n this.element.addEventListener('close', this.registerOnCloseCallback, true);\n\n // If the modal dialog is not already open\n if (!this.element.open) {\n this.open();\n }\n }\n\n @action\n willDestroyNode() {\n if (this.element) {\n this.element.removeEventListener(\n 'close',\n this.registerOnCloseCallback,\n true\n );\n }\n }\n\n @action\n open() {\n // Make modal dialog visible using the native `showModal` method\n this.element.showModal();\n this.isOpen = true;\n\n // Prevent page from scrolling when the dialog is open\n if (this.body) this.body.style.setProperty('overflow', 'hidden');\n\n // Call \"onOpen\" callback function\n if (this.args.onOpen && typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n }\n\n @action\n async onDismiss() {\n // allow ember test helpers to be aware of when the `close` event fires\n // when using `click` or other helpers from '@ember/test-helpers'\n // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)\n if (this.element.open) {\n let token = waiter.beginAsync();\n let listener = () => {\n waiter.endAsync(token);\n this.element.removeEventListener('close', listener);\n };\n this.element.addEventListener('close', listener);\n }\n\n // Make modal dialog invisible using the native `close` method\n this.element.close();\n\n // Reset page `overflow` property\n if (this.body) {\n this.body.style.removeProperty('overflow');\n if (this.bodyInitialOverflowValue === '') {\n if (this.body.style.length === 0) {\n this.body.removeAttribute('style');\n }\n } else {\n this.body.style.setProperty('overflow', this.bodyInitialOverflowValue);\n }\n }\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","DEFAULT_COLOR","SIZES","COLORS","HdsModalIndexComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","size","assert","join","includes","color","id","getElementId","classNames","classes","push","registerOnCloseCallback","isDismissDisabled","onClose","element","parentElement","showModal","isOpen","didInsert","body","document","bodyInitialOverflowValue","style","getPropertyValue","addEventListener","open","willDestroyNode","removeEventListener","setProperty","onOpen","onDismiss","token","beginAsync","listener","endAsync","close","removeProperty","length","removeAttribute","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,otBAAotB;;;ACWtvB,IAAIA,MAAM,GAAGC,WAAW,CAAC,2CAA2C,CAAC,CAAA;AAE9D,MAAMC,YAAY,GAAG,SAAQ;AAC7B,MAAMC,aAAa,GAAG,UAAS;AAC/B,MAAMC,KAA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AAA,EAoEhEM,yBAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,EAAA9C,yBAAAA,CAAAA,EAAAA,MAAA,CAAA8C,SAAA,CAAA,EAAAD,yBAAA,CAAA7C,MAAA,CAAA8C,SAAA,EAuBNM,WAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,EAAA9C,WAAAA,CAAAA,EAAAA,MAAA,CAAA8C,SAAA,CAAA,EAAAD,yBAAA,CAAA7C,MAAA,CAAA8C,SAAA,EAAA,iBAAA,EAAA,CAqBNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,EAAA,iBAAA,CAAA,EAAA9C,MAAA,CAAA8C,SAAA,CAAAD,EAAAA,yBAAA,CAAA7C,MAAA,CAAA8C,SAAA,EAAA,MAAA,EAAA,CAWNM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,EAAA,MAAA,CAAA,EAAA9C,MAAA,CAAA8C,SAAA,GAAAD,yBAAA,CAAA7C,MAAA,CAAA8C,SAAA,EAeNM,WAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAtD,MAAA,CAAA8C,SAAA,gBAAA9C,MAAA,CAAA8C,SAAA,CAAA,GAAA9C,MAAA,EAAA;AA5IkCuD,oBAAA,CAAAC,QAAA,EAAtBzD,sBAAsB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/popover-primitive/index.hbs","../../../../src/components/hds/popover-primitive/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n{{yield\\n (hash\\n setupPrimitiveContainer=this.setupPrimitiveContainer\\n setupPrimitiveToggle=this.setupPrimitiveToggle\\n setupPrimitivePopover=this.setupPrimitivePopover\\n toggleElement=this.toggleElement\\n arrowElement=this.arrowElement\\n popoverElement=this.popoverElement\\n isOpen=this.isOpen\\n showPopover=this.showPopover\\n hidePopover=this.hidePopover\\n togglePopover=this.togglePopover\\n )\\n}}\")","/**\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 } from '@ember/runloop';\nimport { guidFor } from '@ember/object/internals';\nimport { modifier } from 'ember-modifier';\n\nimport registerEvent from '../../../modifiers/hds-register-event';\nimport anchoredPositionModifier from '../../../modifiers/hds-anchored-position';\n\n// https://github.com/oddbird/popover-polyfill?tab=readme-ov-file#with-npm\n// this is needed until Firefox releases the version 126 (up to 125 didn't support the Popover API)\nimport {\n // this call polyfills some of the browser methods to emulate the Popover API\n apply as applyPopoverApiPolyfill,\n // we'll use these two flags to overwrite the popover positioning strategy\n // this is specifically done for Firefox (we need Firefox 126 to be released, to support the last 2 versions)\n // see: https://whattrainisitnow.com/release/?version=126\n isSupported as isPopoverApiSupported,\n isPolyfilled as isPopoverApiPolyfilled,\n} from '@oddbird/popover-polyfill/fn';\n\n// we use this to re-export the values\nexport {\n PLACEMENTS,\n DEFAULT_PLACEMENT,\n} from '../../../modifiers/hds-anchored-position';\n\nexport default class HdsPopoverPrimitiveComponent extends Component {\n @tracked isOpen = this.args.isOpen ?? false;\n @tracked isClosing = false;\n // this will enable \"soft\" events for the toggle (\"hover\" and \"focus\")\n enableSoftEvents = this.args.enableSoftEvents ?? false;\n // this will enable \"click\" events for the toggle\n enableClickEvents = this.args.enableClickEvents ?? false;\n\n constructor() {\n super(...arguments);\n\n // if the Popover API is not supported we need to polyfill it\n if (!isPopoverApiSupported()) {\n warn(\n \"The browser used does not support the Popover API so it's been emulated and some functionalities may not work as expected.\",\n {\n id: 'hds-popover.no-popover-api-support.polyfill-applied',\n }\n );\n // this function polyfills quite a few DOM methods and adds emulation for the Popover API\n // see: https://github.com/oddbird/popover-polyfill/blob/main/src/popover.ts#L123\n applyPopoverApiPolyfill();\n }\n }\n\n setupPrimitiveContainer = modifier(\n (element) => {\n this.containerElement = element;\n\n // we register the \"soft\" events\n if (this.enableSoftEvents) {\n registerEvent(this.containerElement, ['mouseenter', this.onMouseEnter]);\n registerEvent(this.containerElement, ['mouseleave', this.onMouseLeave]);\n registerEvent(this.containerElement, ['focusin', this.onFocusIn]);\n }\n // we always want the focusOut event\n registerEvent(this.containerElement, ['focusout', this.onFocusOut]);\n },\n { eager: true }\n );\n\n setupPrimitiveToggle = modifier(\n (element) => {\n this.toggleElement = element;\n\n assert(\n `The toggle element of \"Hds::PopoverPrimitive\" must be a <button>; element received: <${element.tagName.toLowerCase()}>`,\n element instanceof HTMLButtonElement\n );\n },\n { eager: true }\n );\n\n setupPrimitivePopover = modifier(\n (element, _positional, named = {}) => {\n this.popoverElement = element;\n\n // for the click events we don't use `onclick` event listeners, but we rely on the `popovertarget` attribute\n // provided by the Popover API which does all the magic for us without needing JS code\n // (important: to work it needs to be applied to a button)\n if (this.enableClickEvents) {\n let popoverId;\n if (this.popoverElement.id) {\n popoverId = this.popoverElement.id;\n } else {\n // we need a DOM id for the `popovertarget` attribute\n popoverId = guidFor(this);\n this.popoverElement.id = popoverId;\n }\n this.toggleElement.setAttribute('popovertarget', popoverId);\n }\n\n // this should be an extremely edge case, but in the case the popover needs to be initially forced to be open\n // we need to use the \"manual\" state to support the case of multiple \"menus\" opened at the same time\n // IMPORTANT! if a \"popover\" is set to \"open\" with a \"manual\" state, then it can't be closed via `esc` and `click outside`\n if (this.args.isOpen) {\n this.popoverElement.popover = 'manual';\n this.popoverElement.showPopover();\n } else {\n this.popoverElement.popover = 'auto';\n }\n\n // Register \"onBeforeToggle\" + \"onToggle\" callback functions to be called when a native 'toggle' event is dispatched\n registerEvent(this.popoverElement, [\n 'beforetoggle',\n this.onBeforeTogglePopover,\n ]);\n registerEvent(this.popoverElement, ['toggle', this.onTogglePopover]);\n\n // we need to spread the argument because if it's set via `{{ hash … }}` Ember complains when we overwrite one of its values\n const anchoredPositionOptions = { ...named.anchoredPositionOptions };\n\n // we overwrite the \"strategy\" if the Popover API is not supported (polyfill applied for the first time) of it's already been polyfilled (see above)\n // this is specifically done for Firefox: currently it doesn't support it, but will soon (we need Firefox 127 to support the last 2 versions)\n // see: https://wiki.mozilla.org/Release_Management/Release_owners\n if (!isPopoverApiSupported() || isPopoverApiPolyfilled()) {\n // when using the \"absolute\" strategy, the presence of a parent with \"relative\" position leads to wrong layout rendering (known issue in the polyfill library)\n // see: https://github.com/oddbird/popover-polyfill/tree/main?tab=readme-ov-file#caveats\n anchoredPositionOptions.strategy = 'fixed';\n }\n\n // Apply the `hds-anchored-position` modifier to the \"popover\" element\n // (notice: this function runs the first time when the element the modifier was applied to is inserted into the DOM, and it autotracks while running.\n // Any tracked values that it accesses will be tracked, including the arguments it receives, and if any of them changes, the function will run again)\n // This modifiers uses the Floating UI library to provide:\n // - positioning of the \"popover\" in relation to the \"toggle\"\n // - collision detection (optional)\n next(() => {\n anchoredPositionModifier(\n this.popoverElement, // element the modifier is attached to\n [this.toggleElement], // positional arguments\n anchoredPositionOptions // named arguments\n );\n });\n },\n { eager: true }\n );\n\n @action\n showPopover() {\n try {\n this.popoverElement.showPopover();\n } catch (error) {\n warn(\n 'The invocation of `showPopover` for the popover element caused an unexpected error.',\n {\n id: 'hds-popover.show-popover-action.invocation-failed',\n error: error,\n }\n );\n }\n }\n\n @action\n hidePopover() {\n try {\n this.popoverElement.hidePopover();\n } catch (error) {\n warn(\n 'The invocation of `hidePopover` for the popover element caused an unexpected error.',\n {\n id: 'hds-popover.hide-popover-action.invocation-failed',\n error: error,\n }\n );\n }\n }\n\n @action\n togglePopover() {\n try {\n this.popoverElement.togglePopover();\n } catch (error) {\n warn(\n 'The invocation of `togglePopover` for the popover element caused an unexpected error.',\n {\n id: 'hds-popover.toggle-popover-action.invocation-failed',\n error: error,\n }\n );\n }\n }\n\n // fired just _before_ the \"popover\" is shown or hidden\n @action\n onBeforeTogglePopover(event) {\n if (event.newState === 'closed') {\n // we need this flag to check if it's in the \"closing\" process,\n // because the browser automatically returns the focus to the \"trigger\" button\n // and this would re-open immediately the popover because of the `focusin` event\n this.isClosing = true;\n }\n }\n\n // fired just _after_ the \"popover\" is shown or hidden\n @action\n onTogglePopover(event) {\n if (event.newState === 'open') {\n this.isOpen = true;\n\n // we call the \"onOpen\" callback if it exists (and is a function)\n let { onOpen } = this.args;\n if (typeof onOpen === 'function') {\n onOpen();\n }\n } else {\n this.isOpen = false;\n\n // reset the \"isClosing\" flag (the `toggle` event is fired _after_ the popover is closed)\n this.isClosing = false;\n\n // if the popover was initially forced to be open (using the \"manual\" state) then revert its status to `auto` once the user interacts with it\n if (this.args.isOpen) {\n this.popoverElement.popover = 'auto';\n }\n\n // we call the \"onClose\" callback if it exists (and is a function)\n let { onClose } = this.args;\n if (typeof onClose === 'function') {\n onClose();\n }\n }\n }\n\n @action\n onMouseEnter() {\n if (this.timer) {\n clearTimeout(this.timer);\n }\n this.showPopover();\n }\n\n @action\n onFocusIn() {\n // don't re-open the popover if the focus is returned because the closing\n if (!this.isClosing) {\n if (this.timer) {\n clearTimeout(this.timer);\n }\n this.showPopover();\n }\n }\n\n @action\n onMouseLeave() {\n this.timer = setTimeout(() => this.hidePopover(), 500);\n }\n\n @action\n onFocusOut(event) {\n // due to inconsistent implementation of relatedTarget across browsers we use the activeElement as a fallback\n // if the related target is not part of the disclosed content we close the disclosed container\n if (\n !this.containerElement.contains(\n event.relatedTarget || document.activeElement\n )\n ) {\n this.hidePopover();\n }\n }\n}\n"],"names":["HdsPopoverPrimitiveComponent","_class","Component","constructor","arguments","_initializerDefineProperty","_descriptor","_descriptor2","_defineProperty","args","enableSoftEvents","enableClickEvents","modifier","element","containerElement","registerEvent","onMouseEnter","onMouseLeave","onFocusIn","onFocusOut","eager","toggleElement","assert","tagName","toLowerCase","HTMLButtonElement","_positional","named","popoverElement","popoverId","id","guidFor","setAttribute","isOpen","popover","showPopover","onBeforeTogglePopover","onTogglePopover","anchoredPositionOptions","isPopoverApiSupported","isPopoverApiPolyfilled","strategy","next","anchoredPositionModifier","warn","applyPopoverApiPolyfill","error","hidePopover","togglePopover","event","newState","isClosing","onOpen","onClose","timer","clearTimeout","setTimeout","contains","relatedTarget","document","activeElement","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,0iBAA0iB;;;ACiCvjBA,IAAAA,4BAA4B,IAAAC,MAAA,GAAlC,MAAMD,4BAA4B,SAASE,SAAS,CAAC;AAQlEC,EAAAA,WAAWA,GAAG;IACZ,KAAK,CAAC,GAAGC,SAAS,CAAC,CAAA;;AAEnB;AAAAC,IAAAA,0BAAA,iBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,oBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AARF;AAAAC,IAAAA,eAAA,2BACmB,IAAI,CAACC,IAAI,CAACC,gBAAgB,IAAI,KAAK,CAAA,CAAA;AACtD;AAAAF,IAAAA,eAAA,4BACoB,IAAI,CAACC,IAAI,CAACE,iBAAiB,IAAI,KAAK,CAAA,CAAA;AAAAH,IAAAA,eAAA,CAmB9BI,IAAAA,EAAAA,yBAAAA,EAAAA,QAAQ,CAC/BC,OAAO,IAAK;MACX,IAAI,CAACC,gBAAgB,GAAGD,OAAO,CAAA;;AAE/B;MACA,IAAI,IAAI,CAACH,gBAAgB,EAAE;AACzBK,QAAAA,aAAa,CAAC,IAAI,CAACD,gBAAgB,EAAE,CA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AAA,EAAA;AApOwCsE,oBAAA,CAAAC,QAAA,EAA5BxE,4BAA4B,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/popover-primitive/index.hbs","../../../../src/components/hds/popover-primitive/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n{{yield\\n (hash\\n setupPrimitiveContainer=this.setupPrimitiveContainer\\n setupPrimitiveToggle=this.setupPrimitiveToggle\\n setupPrimitivePopover=this.setupPrimitivePopover\\n toggleElement=this.toggleElement\\n arrowElement=this.arrowElement\\n popoverElement=this.popoverElement\\n isOpen=this.isOpen\\n showPopover=this.showPopover\\n hidePopover=this.hidePopover\\n togglePopover=this.togglePopover\\n )\\n}}\")","/**\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 } from '@ember/runloop';\nimport { guidFor } from '@ember/object/internals';\nimport { modifier } from 'ember-modifier';\n\nimport registerEvent from '../../../modifiers/hds-register-event.js';\nimport anchoredPositionModifier from '../../../modifiers/hds-anchored-position.js';\n\n// https://github.com/oddbird/popover-polyfill?tab=readme-ov-file#with-npm\n// this is needed until Firefox releases the version 126 (up to 125 didn't support the Popover API)\nimport {\n // this call polyfills some of the browser methods to emulate the Popover API\n apply as applyPopoverApiPolyfill,\n // we'll use these two flags to overwrite the popover positioning strategy\n // this is specifically done for Firefox (we need Firefox 126 to be released, to support the last 2 versions)\n // see: https://whattrainisitnow.com/release/?version=126\n isSupported as isPopoverApiSupported,\n isPolyfilled as isPopoverApiPolyfilled,\n} from '@oddbird/popover-polyfill/fn';\n\n// we use this to re-export the values\nexport {\n PLACEMENTS,\n DEFAULT_PLACEMENT,\n} from '../../../modifiers/hds-anchored-position.js';\n\nexport default class HdsPopoverPrimitiveComponent extends Component {\n @tracked isOpen = this.args.isOpen ?? false;\n @tracked isClosing = false;\n // this will enable \"soft\" events for the toggle (\"hover\" and \"focus\")\n enableSoftEvents = this.args.enableSoftEvents ?? false;\n // this will enable \"click\" events for the toggle\n enableClickEvents = this.args.enableClickEvents ?? false;\n\n constructor() {\n super(...arguments);\n\n // if the Popover API is not supported we need to polyfill it\n if (!isPopoverApiSupported()) {\n warn(\n \"The browser used does not support the Popover API so it's been emulated and some functionalities may not work as expected.\",\n {\n id: 'hds-popover.no-popover-api-support.polyfill-applied',\n }\n );\n // this function polyfills quite a few DOM methods and adds emulation for the Popover API\n // see: https://github.com/oddbird/popover-polyfill/blob/main/src/popover.ts#L123\n applyPopoverApiPolyfill();\n }\n }\n\n setupPrimitiveContainer = modifier(\n (element) => {\n this.containerElement = element;\n\n // we register the \"soft\" events\n if (this.enableSoftEvents) {\n registerEvent(this.containerElement, ['mouseenter', this.onMouseEnter]);\n registerEvent(this.containerElement, ['mouseleave', this.onMouseLeave]);\n registerEvent(this.containerElement, ['focusin', this.onFocusIn]);\n }\n // we always want the focusOut event\n registerEvent(this.containerElement, ['focusout', this.onFocusOut]);\n },\n { eager: true }\n );\n\n setupPrimitiveToggle = modifier(\n (element) => {\n this.toggleElement = element;\n\n assert(\n `The toggle element of \"Hds::PopoverPrimitive\" must be a <button>; element received: <${element.tagName.toLowerCase()}>`,\n element instanceof HTMLButtonElement\n );\n },\n { eager: true }\n );\n\n setupPrimitivePopover = modifier(\n (element, _positional, named = {}) => {\n this.popoverElement = element;\n\n // for the click events we don't use `onclick` event listeners, but we rely on the `popovertarget` attribute\n // provided by the Popover API which does all the magic for us without needing JS code\n // (important: to work it needs to be applied to a button)\n if (this.enableClickEvents) {\n let popoverId;\n if (this.popoverElement.id) {\n popoverId = this.popoverElement.id;\n } else {\n // we need a DOM id for the `popovertarget` attribute\n popoverId = guidFor(this);\n this.popoverElement.id = popoverId;\n }\n this.toggleElement.setAttribute('popovertarget', popoverId);\n }\n\n // this should be an extremely edge case, but in the case the popover needs to be initially forced to be open\n // we need to use the \"manual\" state to support the case of multiple \"menus\" opened at the same time\n // IMPORTANT! if a \"popover\" is set to \"open\" with a \"manual\" state, then it can't be closed via `esc` and `click outside`\n if (this.args.isOpen) {\n this.popoverElement.popover = 'manual';\n this.popoverElement.showPopover();\n } else {\n this.popoverElement.popover = 'auto';\n }\n\n // Register \"onBeforeToggle\" + \"onToggle\" callback functions to be called when a native 'toggle' event is dispatched\n registerEvent(this.popoverElement, [\n 'beforetoggle',\n this.onBeforeTogglePopover,\n ]);\n registerEvent(this.popoverElement, ['toggle', this.onTogglePopover]);\n\n // we need to spread the argument because if it's set via `{{ hash … }}` Ember complains when we overwrite one of its values\n const anchoredPositionOptions = { ...named.anchoredPositionOptions };\n\n // we overwrite the \"strategy\" if the Popover API is not supported (polyfill applied for the first time) of it's already been polyfilled (see above)\n // this is specifically done for Firefox: currently it doesn't support it, but will soon (we need Firefox 127 to support the last 2 versions)\n // see: https://wiki.mozilla.org/Release_Management/Release_owners\n if (!isPopoverApiSupported() || isPopoverApiPolyfilled()) {\n // when using the \"absolute\" strategy, the presence of a parent with \"relative\" position leads to wrong layout rendering (known issue in the polyfill library)\n // see: https://github.com/oddbird/popover-polyfill/tree/main?tab=readme-ov-file#caveats\n anchoredPositionOptions.strategy = 'fixed';\n }\n\n // Apply the `hds-anchored-position` modifier to the \"popover\" element\n // (notice: this function runs the first time when the element the modifier was applied to is inserted into the DOM, and it autotracks while running.\n // Any tracked values that it accesses will be tracked, including the arguments it receives, and if any of them changes, the function will run again)\n // This modifiers uses the Floating UI library to provide:\n // - positioning of the \"popover\" in relation to the \"toggle\"\n // - collision detection (optional)\n next(() => {\n anchoredPositionModifier(\n this.popoverElement, // element the modifier is attached to\n [this.toggleElement], // positional arguments\n anchoredPositionOptions // named arguments\n );\n });\n },\n { eager: true }\n );\n\n @action\n showPopover() {\n try {\n this.popoverElement.showPopover();\n } catch (error) {\n warn(\n 'The invocation of `showPopover` for the popover element caused an unexpected error.',\n {\n id: 'hds-popover.show-popover-action.invocation-failed',\n error: error,\n }\n );\n }\n }\n\n @action\n hidePopover() {\n try {\n this.popoverElement.hidePopover();\n } catch (error) {\n warn(\n 'The invocation of `hidePopover` for the popover element caused an unexpected error.',\n {\n id: 'hds-popover.hide-popover-action.invocation-failed',\n error: error,\n }\n );\n }\n }\n\n @action\n togglePopover() {\n try {\n this.popoverElement.togglePopover();\n } catch (error) {\n warn(\n 'The invocation of `togglePopover` for the popover element caused an unexpected error.',\n {\n id: 'hds-popover.toggle-popover-action.invocation-failed',\n error: error,\n }\n );\n }\n }\n\n // fired just _before_ the \"popover\" is shown or hidden\n @action\n onBeforeTogglePopover(event) {\n if (event.newState === 'closed') {\n // we need this flag to check if it's in the \"closing\" process,\n // because the browser automatically returns the focus to the \"trigger\" button\n // and this would re-open immediately the popover because of the `focusin` event\n this.isClosing = true;\n }\n }\n\n // fired just _after_ the \"popover\" is shown or hidden\n @action\n onTogglePopover(event) {\n if (event.newState === 'open') {\n this.isOpen = true;\n\n // we call the \"onOpen\" callback if it exists (and is a function)\n let { onOpen } = this.args;\n if (typeof onOpen === 'function') {\n onOpen();\n }\n } else {\n this.isOpen = false;\n\n // reset the \"isClosing\" flag (the `toggle` event is fired _after_ the popover is closed)\n this.isClosing = false;\n\n // if the popover was initially forced to be open (using the \"manual\" state) then revert its status to `auto` once the user interacts with it\n if (this.args.isOpen) {\n this.popoverElement.popover = 'auto';\n }\n\n // we call the \"onClose\" callback if it exists (and is a function)\n let { onClose } = this.args;\n if (typeof onClose === 'function') {\n onClose();\n }\n }\n }\n\n @action\n onMouseEnter() {\n if (this.timer) {\n clearTimeout(this.timer);\n }\n this.showPopover();\n }\n\n @action\n onFocusIn() {\n // don't re-open the popover if the focus is returned because the closing\n if (!this.isClosing) {\n if (this.timer) {\n clearTimeout(this.timer);\n }\n this.showPopover();\n }\n }\n\n @action\n onMouseLeave() {\n this.timer = setTimeout(() => this.hidePopover(), 500);\n }\n\n @action\n onFocusOut(event) {\n // due to inconsistent implementation of relatedTarget across browsers we use the activeElement as a fallback\n // if the related target is not part of the disclosed content we close the disclosed container\n if (\n !this.containerElement.contains(\n event.relatedTarget || document.activeElement\n )\n ) {\n this.hidePopover();\n }\n }\n}\n"],"names":["HdsPopoverPrimitiveComponent","_class","Component","constructor","arguments","_initializerDefineProperty","_descriptor","_descriptor2","_defineProperty","args","enableSoftEvents","enableClickEvents","modifier","element","containerElement","registerEvent","onMouseEnter","onMouseLeave","onFocusIn","onFocusOut","eager","toggleElement","assert","tagName","toLowerCase","HTMLButtonElement","_positional","named","popoverElement","popoverId","id","guidFor","setAttribute","isOpen","popover","showPopover","onBeforeTogglePopover","onTogglePopover","anchoredPositionOptions","isPopoverApiSupported","isPopoverApiPolyfilled","strategy","next","anchoredPositionModifier","warn","applyPopoverApiPolyfill","error","hidePopover","togglePopover","event","newState","isClosing","onOpen","onClose","timer","clearTimeout","setTimeout","contains","relatedTarget","document","activeElement","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,0iBAA0iB;;;ACiCvjBA,IAAAA,4BAA4B,IAAAC,MAAA,GAAlC,MAAMD,4BAA4B,SAASE,SAAS,CAAC;AAQlEC,EAAAA,WAAWA,GAAG;IACZ,KAAK,CAAC,GAAGC,SAAS,CAAC,CAAA;;AAEnB;AAAAC,IAAAA,0BAAA,iBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,oBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AARF;AAAAC,IAAAA,eAAA,2BACmB,IAAI,CAACC,IAAI,CAACC,gBAAgB,IAAI,KAAK,CAAA,CAAA;AACtD;AAAAF,IAAAA,eAAA,4BACoB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AAA,CAAAC,wBAAA,CAAArE,MAAA,CAAA6D,SAAA,EAAA,cAAA,CAAA,EAAA7D,MAAA,CAAA6D,SAAA,CAAAD,EAAAA,yBAAA,CAAA5D,MAAA,CAAA6D,SAAA,EAKNM,YAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAArE,MAAA,CAAA6D,SAAA,EAAA,YAAA,CAAA,EAAA7D,MAAA,CAAA6D,SAAA,IAAA7D,MAAA,EAAA;AApOwCsE,oBAAA,CAAAC,QAAA,EAA5BxE,4BAA4B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bubble.js","sources":["../../../../src/components/hds/rich-tooltip/bubble.hbs","../../../../src/components/hds/rich-tooltip/bubble.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, InPP.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div\\n class=\\\"hds-rich-tooltip__bubble\\\"\\n ...attributes\\n id={{@popoverId}}\\n tabindex=\\\"-1\\\"\\n role=\\\"tooltip\\\"\\n aria-hidden={{(unless @isOpen true)}}\\n {{style this.sizingStyles}}\\n {{@setupPrimitivePopover anchoredPositionOptions=this.anchoredPositionOptions}}\\n>\\n <div class=\\\"hds-rich-tooltip__bubble-arrow\\\" id={{@arrowId}} />\\n {{#if @isOpen}}\\n <div class=\\\"hds-rich-tooltip__bubble-inner-content\\\">\\n {{yield}}\\n </div>\\n {{/if}}\\n</div>\")","/**\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\nimport { PLACEMENTS as PRIMITIVE_PLACEMENTS } from '../popover-primitive/index';\n\nexport const DEFAULT_PLACEMENT = 'bottom';\nexport const PLACEMENTS = [...PRIMITIVE_PLACEMENTS];\n\nexport default class HdsRichTooltipBubbleComponent extends Component {\n /**\n * @param placement\n * @type {string}\n * @description Determines the position of the \"popover\"\n */\n get placement() {\n const { placement = DEFAULT_PLACEMENT } = this.args;\n\n assert(\n `@placement for \"Hds::RichTooltip::Bubble\" must be one of the following: ${PLACEMENTS.join(\n ', '\n )}; received: ${placement}`,\n PLACEMENTS.includes(placement)\n );\n\n return placement;\n }\n\n get enableCollisionDetection() {\n return this.args.enableCollisionDetection ?? true;\n }\n\n get sizingStyles() {\n const sizingStyles = {};\n\n if (this.args.width) {\n sizingStyles['width'] = this.args.width;\n sizingStyles['max-width'] = 'none';\n }\n\n if (this.args.height) {\n sizingStyles['height'] = this.args.height;\n sizingStyles['max-height'] = 'none';\n }\n\n return sizingStyles;\n }\n\n get anchoredPositionOptions() {\n // custom options specific for the `RichTooltip` component\n // for details see the `hds-anchored-position` modifier\n return {\n placement: this.placement,\n offsetOptions: this.args.offset ?? 12,\n enableCollisionDetection: this.args.enableCollisionDetection ?? true,\n arrowSelector: `#${this.args.arrowId}`,\n arrowPadding: 12,\n };\n }\n}\n"],"names":["DEFAULT_PLACEMENT","PLACEMENTS","PRIMITIVE_PLACEMENTS","HdsRichTooltipBubbleComponent","Component","placement","args","assert","join","includes","enableCollisionDetection","sizingStyles","width","height","anchoredPositionOptions","offsetOptions","offset","arrowSelector","arrowId","arrowPadding","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,klBAAklB;;ACDpnB;AACA;AACA;AACA;;AAOO,MAAMA,iBAAiB,GAAG,SAAQ;MAC5BC,UAAU,GAAG,CAAC,GAAGC,YAAoB,EAAC;AAEpC,MAAMC,6BAA6B,SAASC,SAAS,CAAC;AACnE;AACF;AACA;AACA;AACA;EACE,IAAIC,SAASA,GAAG;IACd,MAAM;AAAEA,MAAAA,SAAS,GAAGL,iBAAAA;KAAmB,GAAG,IAAI,CAACM,IAAI,CAAA;AAEnDC,IAAAA,MAAM,CACH,CAA0EN,wEAAAA,EAA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;"}
|
|
1
|
+
{"version":3,"file":"bubble.js","sources":["../../../../src/components/hds/rich-tooltip/bubble.hbs","../../../../src/components/hds/rich-tooltip/bubble.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, InPP.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div\\n class=\\\"hds-rich-tooltip__bubble\\\"\\n ...attributes\\n id={{@popoverId}}\\n tabindex=\\\"-1\\\"\\n role=\\\"tooltip\\\"\\n aria-hidden={{(unless @isOpen true)}}\\n {{style this.sizingStyles}}\\n {{@setupPrimitivePopover anchoredPositionOptions=this.anchoredPositionOptions}}\\n>\\n <div class=\\\"hds-rich-tooltip__bubble-arrow\\\" id={{@arrowId}} />\\n {{#if @isOpen}}\\n <div class=\\\"hds-rich-tooltip__bubble-inner-content\\\">\\n {{yield}}\\n </div>\\n {{/if}}\\n</div>\")","/**\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\nimport { PLACEMENTS as PRIMITIVE_PLACEMENTS } from '../popover-primitive/index.js';\n\nexport const DEFAULT_PLACEMENT = 'bottom';\nexport const PLACEMENTS = [...PRIMITIVE_PLACEMENTS];\n\nexport default class HdsRichTooltipBubbleComponent extends Component {\n /**\n * @param placement\n * @type {string}\n * @description Determines the position of the \"popover\"\n */\n get placement() {\n const { placement = DEFAULT_PLACEMENT } = this.args;\n\n assert(\n `@placement for \"Hds::RichTooltip::Bubble\" must be one of the following: ${PLACEMENTS.join(\n ', '\n )}; received: ${placement}`,\n PLACEMENTS.includes(placement)\n );\n\n return placement;\n }\n\n get enableCollisionDetection() {\n return this.args.enableCollisionDetection ?? true;\n }\n\n get sizingStyles() {\n const sizingStyles = {};\n\n if (this.args.width) {\n sizingStyles['width'] = this.args.width;\n sizingStyles['max-width'] = 'none';\n }\n\n if (this.args.height) {\n sizingStyles['height'] = this.args.height;\n sizingStyles['max-height'] = 'none';\n }\n\n return sizingStyles;\n }\n\n get anchoredPositionOptions() {\n // custom options specific for the `RichTooltip` component\n // for details see the `hds-anchored-position` modifier\n return {\n placement: this.placement,\n offsetOptions: this.args.offset ?? 12,\n enableCollisionDetection: this.args.enableCollisionDetection ?? true,\n arrowSelector: `#${this.args.arrowId}`,\n arrowPadding: 12,\n };\n }\n}\n"],"names":["DEFAULT_PLACEMENT","PLACEMENTS","PRIMITIVE_PLACEMENTS","HdsRichTooltipBubbleComponent","Component","placement","args","assert","join","includes","enableCollisionDetection","sizingStyles","width","height","anchoredPositionOptions","offsetOptions","offset","arrowSelector","arrowId","arrowPadding","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,klBAAklB;;ACDpnB;AACA;AACA;AACA;;AAOO,MAAMA,iBAAiB,GAAG,SAAQ;MAC5BC,UAAU,GAAG,CAAC,GAAGC,YAAoB,EAAC;AAEpC,MAAMC,6BAA6B,SAASC,SAAS,CAAC;AACnE;AACF;AACA;AACA;AACA;EACE,IAAIC,SAASA,GAAG;IACd,MAAM;AAAEA,MAAAA,SAAS,GAAGL,iBAAAA;KAAmB,GAAG,IAAI,CAACM,IAAI,CAAA;AAEnDC,IAAAA,MAAM,CACH,CAA0EN,wEAAAA,EAAAA,UAAU,CAACO,IAAI,CACxF,IACF,CAAE,CAAA,YAAA,EAAcH,SAAU,CAAA,CAAC,EAC3BJ,UAAU,CAACQ,QAAQ,CAACJ,SAAS,CAC/B,CAAC,CAAA;AAED,IAAA,OAAOA,SAAS,CAAA;AAClB,GAAA;EAEA,IAAIK,wBAAwBA,GAAG;AAC7B,IAAA,OAAO,IAAI,CAACJ,IAAI,CAACI,wBAAwB,IAAI,IAAI,CAAA;AACnD,GAAA;EAEA,IAAIC,YAAYA,GAAG;IACjB,MAAMA,YAAY,GAAG,EAAE,CAAA;AAEvB,IAAA,IAAI,IAAI,CAACL,IAAI,CAACM,KAAK,EAAE;MACnBD,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAACL,IAAI,CAACM,KAAK,CAAA;AACvCD,MAAAA,YAAY,CAAC,WAAW,CAAC,GAAG,MAAM,CAAA;AACpC,KAAA;AAEA,IAAA,IAAI,IAAI,CAACL,IAAI,CAACO,MAAM,EAAE;MACpBF,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAI,CAACL,IAAI,CAACO,MAAM,CAAA;AACzCF,MAAAA,YAAY,CAAC,YAAY,CAAC,GAAG,MAAM,CAAA;AACrC,KAAA;AAEA,IAAA,OAAOA,YAAY,CAAA;AACrB,GAAA;EAEA,IAAIG,uBAAuBA,GAAG;AAC5B;AACA;IACA,OAAO;MACLT,SAAS,EAAE,IAAI,CAACA,SAAS;AACzBU,MAAAA,aAAa,EAAE,IAAI,CAACT,IAAI,CAACU,MAAM,IAAI,EAAE;AACrCN,MAAAA,wBAAwB,EAAE,IAAI,CAACJ,IAAI,CAACI,wBAAwB,IAAI,IAAI;AACpEO,MAAAA,aAAa,EAAG,CAAG,CAAA,EAAA,IAAI,CAACX,IAAI,CAACY,OAAQ,CAAC,CAAA;AACtCC,MAAAA,YAAY,EAAE,EAAA;KACf,CAAA;AACH,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAlDoBlB,6BAA6B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/rich-tooltip/index.hbs","../../../../src/components/hds/rich-tooltip/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, InPP.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n{{! IMPORTANT: we need to add \\\"squishies\\\" here (~) because otherwise the whitespace added by Ember becomes visible in the underlined text (being an inline element) - See https://handlebarsjs.com/guide/expressions.html#whitespace-control }}\\n<Hds::PopoverPrimitive\\n @isOpen={{@isOpen}}\\n @onOpen={{@onOpen}}\\n @onClose={{@onClose}}\\n @enableSoftEvents={{this.enableSoftEvents}}\\n @enableClickEvents={{this.enableClickEvents}}\\n as |PP|\\n><div class=\\\"hds-rich-tooltip\\\" ...attributes {{PP.setupPrimitiveContainer}}>\\n {{~yield\\n (hash\\n Toggle=(component\\n \\\"hds/rich-tooltip/toggle\\\"\\n popoverId=this.popoverId\\n setupPrimitiveToggle=PP.setupPrimitiveToggle\\n isOpen=PP.isOpen\\n )\\n Bubble=(component\\n \\\"hds/rich-tooltip/bubble\\\"\\n arrowId=this.arrowId\\n popoverId=this.popoverId\\n setupPrimitivePopover=PP.setupPrimitivePopover\\n isOpen=PP.isOpen\\n )\\n isOpen=PP.isOpen\\n close=PP.hidePopover\\n )\\n ~}}\\n </div></Hds::PopoverPrimitive>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { getElementId } from '../../../utils/hds-get-element-id';\n\nexport default class HdsRichTooltipIndexComponent extends Component {\n elementId = getElementId(this);\n arrowId = `arrow-${this.elementId}`;\n popoverId = `popover-${this.elementId}`;\n\n get enableSoftEvents() {\n return this.args.enableClickEvents !== true;\n }\n\n get enableClickEvents() {\n return this.args.enableClickEvents ?? false;\n }\n}\n"],"names":["HdsRichTooltipIndexComponent","Component","constructor","args","_defineProperty","getElementId","elementId","enableSoftEvents","enableClickEvents","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,wrCAAwrC;;ACO3sC,MAAMA,4BAA4B,SAASC,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,eAAA,CACtDC,IAAAA,EAAAA,WAAAA,EAAAA,YAAY,CAAC,IAAI,CAAC,CAAA,CAAA;AAAAD,IAAAA,eAAA,CACnB,IAAA,EAAA,SAAA,EAAA,CAAA,MAAA,EAAQ,IAAI,CAACE,SAAU,CAAC,CAAA,CAAA,CAAA;AAAAF,IAAAA,eAAA,CACtB,IAAA,EAAA,WAAA,EAAA,CAAA,QAAA,EAAU,IAAI,CAACE,SAAU,CAAC,CAAA,CAAA,CAAA;AAAA,GAAA;EAEvC,IAAIC,gBAAgBA,GAAG;AACrB,IAAA,OAAO,IAAI,CAACJ,IAAI,CAACK,iBAAiB,KAAK,IAAI,CAAA;AAC7C,GAAA;EAEA,IAAIA,iBAAiBA,GAAG;AACtB,IAAA,OAAO,IAAI,CAACL,IAAI,CAACK,iBAAiB,IAAI,KAAK,CAAA;AAC7C,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAZoBV,4BAA4B,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/rich-tooltip/index.hbs","../../../../src/components/hds/rich-tooltip/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, InPP.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n{{! IMPORTANT: we need to add \\\"squishies\\\" here (~) because otherwise the whitespace added by Ember becomes visible in the underlined text (being an inline element) - See https://handlebarsjs.com/guide/expressions.html#whitespace-control }}\\n<Hds::PopoverPrimitive\\n @isOpen={{@isOpen}}\\n @onOpen={{@onOpen}}\\n @onClose={{@onClose}}\\n @enableSoftEvents={{this.enableSoftEvents}}\\n @enableClickEvents={{this.enableClickEvents}}\\n as |PP|\\n><div class=\\\"hds-rich-tooltip\\\" ...attributes {{PP.setupPrimitiveContainer}}>\\n {{~yield\\n (hash\\n Toggle=(component\\n \\\"hds/rich-tooltip/toggle\\\"\\n popoverId=this.popoverId\\n setupPrimitiveToggle=PP.setupPrimitiveToggle\\n isOpen=PP.isOpen\\n )\\n Bubble=(component\\n \\\"hds/rich-tooltip/bubble\\\"\\n arrowId=this.arrowId\\n popoverId=this.popoverId\\n setupPrimitivePopover=PP.setupPrimitivePopover\\n isOpen=PP.isOpen\\n )\\n isOpen=PP.isOpen\\n close=PP.hidePopover\\n )\\n ~}}\\n </div></Hds::PopoverPrimitive>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { getElementId } from '../../../utils/hds-get-element-id.js';\n\nexport default class HdsRichTooltipIndexComponent extends Component {\n elementId = getElementId(this);\n arrowId = `arrow-${this.elementId}`;\n popoverId = `popover-${this.elementId}`;\n\n get enableSoftEvents() {\n return this.args.enableClickEvents !== true;\n }\n\n get enableClickEvents() {\n return this.args.enableClickEvents ?? false;\n }\n}\n"],"names":["HdsRichTooltipIndexComponent","Component","constructor","args","_defineProperty","getElementId","elementId","enableSoftEvents","enableClickEvents","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,wrCAAwrC;;ACO3sC,MAAMA,4BAA4B,SAASC,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,eAAA,CACtDC,IAAAA,EAAAA,WAAAA,EAAAA,YAAY,CAAC,IAAI,CAAC,CAAA,CAAA;AAAAD,IAAAA,eAAA,CACnB,IAAA,EAAA,SAAA,EAAA,CAAA,MAAA,EAAQ,IAAI,CAACE,SAAU,CAAC,CAAA,CAAA,CAAA;AAAAF,IAAAA,eAAA,CACtB,IAAA,EAAA,WAAA,EAAA,CAAA,QAAA,EAAU,IAAI,CAACE,SAAU,CAAC,CAAA,CAAA,CAAA;AAAA,GAAA;EAEvC,IAAIC,gBAAgBA,GAAG;AACrB,IAAA,OAAO,IAAI,CAACJ,IAAI,CAACK,iBAAiB,KAAK,IAAI,CAAA;AAC7C,GAAA;EAEA,IAAIA,iBAAiBA,GAAG;AACtB,IAAA,OAAO,IAAI,CAACL,IAAI,CAACK,iBAAiB,IAAI,KAAK,CAAA;AAC7C,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAZoBV,4BAA4B,CAAA;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export { default as HdsAccordion } from './components/hds/accordion/index.js';
|
|
2
|
+
export { default as HdsAlert } from './components/hds/alert/index.js';
|
|
3
|
+
export { default as HdsAppFooter } from './components/hds/app-footer/index.js';
|
|
4
|
+
export { default as HdsAppFrame } from './components/hds/app-frame/index.js';
|
|
5
|
+
export { default as HdsBadge } from './components/hds/badge/index.js';
|
|
6
|
+
export { default as HdsBadgeCount } from './components/hds/badge-count/index.js';
|
|
7
|
+
export { default as HdsButton } from './components/hds/button/index.js';
|
|
8
|
+
export { default as HdsButtonSet } from './components/hds/button-set/index.js';
|
|
9
|
+
export { default as HdsCard } from './components/hds/card/container.js';
|
|
10
|
+
export { default as HdsCopyButton } from './components/hds/copy/button/index.js';
|
|
11
|
+
export { default as HdsCopySnippet } from './components/hds/copy/snippet/index.js';
|
|
12
|
+
export { default as HdsDisclosurePrimitive } from './components/hds/disclosure-primitive/index.js';
|
|
13
|
+
export { default as HdsDismissButton } from './components/hds/dismiss-button/index.js';
|
|
14
|
+
export { default as HdsIconTile } from './components/hds/icon-tile/index.js';
|
|
15
|
+
export { default as HdsInteractive } from './components/hds/interactive/index.js';
|
|
16
|
+
export { default as HdsLinkInline } from './components/hds/link/inline.js';
|
|
17
|
+
export { default as HdsLinkStandalone } from './components/hds/link/standalone.js';
|
|
18
|
+
export { default as HdsReveal } from './components/hds/reveal/index.js';
|
|
19
|
+
export { default as HdsSeparator } from './components/hds/separator/index.js';
|
|
20
|
+
export { default as HdsStepperStepIndicator } from './components/hds/stepper/step/indicator.js';
|
|
21
|
+
export { default as HdsStepperTaskIndicator } from './components/hds/stepper/task/indicator.js';
|
|
22
|
+
export { default as HdsTag } from './components/hds/tag/index.js';
|
|
23
|
+
export { default as HdsText } from './components/hds/text/index.js';
|
|
24
|
+
export { default as HdsTextBody } from './components/hds/text/body.js';
|
|
25
|
+
export { default as HdsTextCode } from './components/hds/text/code.js';
|
|
26
|
+
export { default as HdsTextDisplay } from './components/hds/text/display.js';
|
|
27
|
+
export { default as HdsToast } from './components/hds/toast/index.js';
|
|
28
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/helpers.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -7,7 +7,7 @@ import { assert, warn } from '@ember/debug';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const getTextToCopy = text => {
|
|
10
|
-
let textToCopy;
|
|
10
|
+
let textToCopy = '';
|
|
11
11
|
if (text) {
|
|
12
12
|
if (typeof text === 'string') {
|
|
13
13
|
textToCopy = text;
|
|
@@ -29,7 +29,7 @@ const getTargetElement = target => {
|
|
|
29
29
|
console.error('`hds-clipboard` modifier - `target` selector provided does not point to an existing DOM node, check your selector string', targetElement);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
} else if (target instanceof
|
|
32
|
+
} else if (target instanceof HTMLElement) {
|
|
33
33
|
targetElement = target;
|
|
34
34
|
} else {
|
|
35
35
|
if (target instanceof NodeList) {
|
|
@@ -41,8 +41,8 @@ const getTargetElement = target => {
|
|
|
41
41
|
return targetElement;
|
|
42
42
|
};
|
|
43
43
|
const getTextToCopyFromTargetElement = targetElement => {
|
|
44
|
-
let textToCopy;
|
|
45
|
-
if (targetElement instanceof
|
|
44
|
+
let textToCopy = '';
|
|
45
|
+
if (targetElement instanceof HTMLElement) {
|
|
46
46
|
if (targetElement instanceof HTMLInputElement ||
|
|
47
47
|
// targetElement.nodeName === 'INPUT' ||
|
|
48
48
|
targetElement instanceof HTMLTextAreaElement ||
|
|
@@ -90,12 +90,14 @@ const writeTextToClipboard = async textToCopy => {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
const copyToClipboard = async (text, target) => {
|
|
93
|
-
let textToCopy;
|
|
93
|
+
let textToCopy = '';
|
|
94
94
|
if (text) {
|
|
95
95
|
textToCopy = getTextToCopy(text);
|
|
96
96
|
} else if (target) {
|
|
97
97
|
const targetElement = getTargetElement(target);
|
|
98
|
-
|
|
98
|
+
if (targetElement) {
|
|
99
|
+
textToCopy = getTextToCopyFromTargetElement(targetElement);
|
|
100
|
+
}
|
|
99
101
|
} else {
|
|
100
102
|
assert('`hds-clipboard` modifier - either a `text` or a `target` argument is required');
|
|
101
103
|
}
|
|
@@ -107,7 +109,7 @@ const copyToClipboard = async (text, target) => {
|
|
|
107
109
|
// because it's quite simple in its logic, and doesn't require injecting services
|
|
108
110
|
// see: https://github.com/ember-modifier/ember-modifier#function-based-modifiers
|
|
109
111
|
|
|
110
|
-
var hdsClipboard = modifier((element,
|
|
112
|
+
var hdsClipboard = modifier((element, _positional, named) => {
|
|
111
113
|
assert('`hds-clipboard` modifier - the modifier must be applied to an element', element);
|
|
112
114
|
const {
|
|
113
115
|
text,
|