@hashicorp/design-system-components 4.5.2 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/components/hds/accordion/index.d.ts +32 -3
- package/declarations/components/hds/accordion/index.d.ts.map +1 -1
- package/declarations/components/hds/accordion/item/button.d.ts +2 -0
- package/declarations/components/hds/accordion/item/button.d.ts.map +1 -1
- package/declarations/components/hds/accordion/item/index.d.ts +39 -2
- package/declarations/components/hds/accordion/item/index.d.ts.map +1 -1
- package/declarations/components/hds/accordion/types.d.ts +21 -0
- package/declarations/components/hds/accordion/types.d.ts.map +1 -0
- package/declarations/components/hds/alert/index.d.ts +4 -4
- package/declarations/components/hds/alert/index.d.ts.map +1 -1
- package/declarations/components/hds/app-footer/copyright.d.ts.map +1 -1
- package/declarations/components/hds/app-footer/index.d.ts +1 -1
- package/declarations/components/hds/app-footer/index.d.ts.map +1 -1
- package/declarations/components/hds/app-footer/legal-links.d.ts.map +1 -1
- package/declarations/components/hds/app-footer/status-link.d.ts +3 -3
- package/declarations/components/hds/app-footer/status-link.d.ts.map +1 -1
- package/declarations/components/hds/app-frame/index.d.ts.map +1 -1
- package/declarations/components/hds/application-state/footer.d.ts.map +1 -1
- package/declarations/components/hds/badge/index.d.ts +4 -4
- package/declarations/components/hds/badge/index.d.ts.map +1 -1
- package/declarations/components/hds/badge-count/index.d.ts +6 -6
- package/declarations/components/hds/badge-count/index.d.ts.map +1 -1
- package/declarations/components/hds/badge-count/types.d.ts +2 -2
- package/declarations/components/hds/badge-count/types.d.ts.map +1 -1
- package/declarations/components/hds/button/index.d.ts +1 -1
- package/declarations/components/hds/copy/button/index.d.ts +3 -2
- package/declarations/components/hds/copy/button/index.d.ts.map +1 -1
- package/declarations/components/hds/copy/snippet/index.d.ts +6 -5
- package/declarations/components/hds/copy/snippet/index.d.ts.map +1 -1
- package/declarations/components/hds/disclosure-primitive/index.d.ts +6 -1
- package/declarations/components/hds/disclosure-primitive/index.d.ts.map +1 -1
- package/declarations/components/hds/dismiss-button/index.d.ts.map +1 -1
- package/declarations/components/hds/form/super-select/single/base.d.ts.map +1 -1
- package/declarations/components/hds/icon-tile/index.d.ts +4 -4
- package/declarations/components/hds/icon-tile/index.d.ts.map +1 -1
- package/declarations/components/hds/interactive/index.d.ts.map +1 -1
- package/declarations/components/hds/link/inline.d.ts +3 -3
- package/declarations/components/hds/link/inline.d.ts.map +1 -1
- package/declarations/components/hds/link/standalone.d.ts +7 -7
- package/declarations/components/hds/link/standalone.d.ts.map +1 -1
- package/declarations/components/hds/popover-primitive/index.d.ts +66 -20
- package/declarations/components/hds/popover-primitive/index.d.ts.map +1 -1
- package/declarations/components/hds/reveal/toggle/button.d.ts.map +1 -1
- package/declarations/components/hds/rich-tooltip/bubble.d.ts +33 -17
- package/declarations/components/hds/rich-tooltip/bubble.d.ts.map +1 -1
- package/declarations/components/hds/rich-tooltip/index.d.ts +27 -5
- package/declarations/components/hds/rich-tooltip/index.d.ts.map +1 -1
- package/declarations/components/hds/rich-tooltip/toggle.d.ts +32 -8
- package/declarations/components/hds/rich-tooltip/toggle.d.ts.map +1 -1
- package/declarations/components/hds/rich-tooltip/types.d.ts +16 -0
- package/declarations/components/hds/rich-tooltip/types.d.ts.map +1 -0
- package/declarations/components/hds/separator/index.d.ts +3 -3
- package/declarations/components/hds/separator/index.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/header/home-link.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/header/icon-button.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/index.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/portal/target.d.ts.map +1 -1
- package/declarations/components/hds/stepper/step/indicator.d.ts +1 -1
- package/declarations/components/hds/stepper/step/indicator.d.ts.map +1 -1
- package/declarations/components/hds/stepper/task/indicator.d.ts +4 -3
- package/declarations/components/hds/stepper/task/indicator.d.ts.map +1 -1
- package/declarations/components/hds/tabs/index.d.ts.map +1 -1
- package/declarations/components/hds/tabs/panel.d.ts.map +1 -1
- package/declarations/components/hds/tabs/tab.d.ts +1 -1
- package/declarations/components/hds/tabs/tab.d.ts.map +1 -1
- package/declarations/components/hds/tabs/types.d.ts +4 -0
- package/declarations/components/hds/tabs/types.d.ts.map +1 -1
- package/declarations/components/hds/tag/index.d.ts +2 -2
- package/declarations/components/hds/tag/index.d.ts.map +1 -1
- package/declarations/components/hds/text/body.d.ts +6 -6
- package/declarations/components/hds/text/body.d.ts.map +1 -1
- package/declarations/components/hds/text/code.d.ts +3 -3
- package/declarations/components/hds/text/code.d.ts.map +1 -1
- package/declarations/components/hds/text/display.d.ts +3 -3
- package/declarations/components/hds/text/display.d.ts.map +1 -1
- package/declarations/components/hds/text/index.d.ts +7 -8
- package/declarations/components/hds/text/index.d.ts.map +1 -1
- package/declarations/helpers/hds-link-to-query.d.ts +3 -1
- package/declarations/helpers/hds-link-to-query.d.ts.map +1 -1
- package/declarations/modifiers/hds-anchored-position.d.ts +28 -9
- package/declarations/modifiers/hds-anchored-position.d.ts.map +1 -1
- package/declarations/modifiers/hds-clipboard.d.ts.map +1 -1
- package/declarations/modifiers/hds-register-event.d.ts +9 -3
- package/declarations/modifiers/hds-register-event.d.ts.map +1 -1
- package/declarations/template-registry.d.ts +19 -0
- package/declarations/template-registry.d.ts.map +1 -1
- package/dist/components/hds/accordion/index.js +53 -5
- package/dist/components/hds/accordion/index.js.map +1 -1
- package/dist/components/hds/accordion/item/button.js +6 -1
- package/dist/components/hds/accordion/item/button.js.map +1 -1
- package/dist/components/hds/accordion/item/index.js +64 -2
- package/dist/components/hds/accordion/item/index.js.map +1 -1
- package/dist/components/hds/accordion/types.js +24 -0
- package/dist/components/hds/accordion/types.js.map +1 -0
- package/dist/components/hds/alert/index.js +2 -1
- package/dist/components/hds/alert/index.js.map +1 -1
- package/dist/components/hds/app-footer/copyright.js.map +1 -1
- package/dist/components/hds/app-footer/index.js.map +1 -1
- package/dist/components/hds/app-footer/legal-links.js.map +1 -1
- package/dist/components/hds/app-footer/status-link.js.map +1 -1
- package/dist/components/hds/app-frame/index.js.map +1 -1
- package/dist/components/hds/application-state/footer.js.map +1 -1
- package/dist/components/hds/application-state/index.js.map +1 -1
- package/dist/components/hds/badge/index.js.map +1 -1
- package/dist/components/hds/badge-count/index.js.map +1 -1
- package/dist/components/hds/badge-count/types.js.map +1 -1
- package/dist/components/hds/copy/button/index.js.map +1 -1
- package/dist/components/hds/copy/snippet/index.js +3 -3
- package/dist/components/hds/copy/snippet/index.js.map +1 -1
- package/dist/components/hds/disclosure-primitive/index.js +37 -6
- package/dist/components/hds/disclosure-primitive/index.js.map +1 -1
- package/dist/components/hds/dismiss-button/index.js.map +1 -1
- package/dist/components/hds/form/error/index.js +1 -1
- package/dist/components/hds/form/error/index.js.map +1 -1
- package/dist/components/hds/form/field/index.js +1 -1
- package/dist/components/hds/form/field/index.js.map +1 -1
- package/dist/components/hds/form/fieldset/index.js +1 -1
- package/dist/components/hds/form/fieldset/index.js.map +1 -1
- package/dist/components/hds/form/radio-card/index.js +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/single/base.js.map +1 -1
- package/dist/components/hds/icon-tile/index.js.map +1 -1
- package/dist/components/hds/interactive/index.js.map +1 -1
- package/dist/components/hds/link/inline.js +1 -1
- package/dist/components/hds/link/inline.js.map +1 -1
- package/dist/components/hds/link/standalone.js +2 -2
- package/dist/components/hds/link/standalone.js.map +1 -1
- package/dist/components/hds/page-header/index.js.map +1 -1
- package/dist/components/hds/popover-primitive/index.js +53 -51
- package/dist/components/hds/popover-primitive/index.js.map +1 -1
- package/dist/components/hds/reveal/toggle/button.js.map +1 -1
- package/dist/components/hds/rich-tooltip/bubble.js +3 -6
- package/dist/components/hds/rich-tooltip/bubble.js.map +1 -1
- package/dist/components/hds/rich-tooltip/index.js +6 -4
- package/dist/components/hds/rich-tooltip/index.js.map +1 -1
- package/dist/components/hds/rich-tooltip/toggle.js +6 -5
- package/dist/components/hds/rich-tooltip/toggle.js.map +1 -1
- package/dist/components/hds/rich-tooltip/types.js +19 -0
- package/dist/components/hds/rich-tooltip/types.js.map +1 -0
- package/dist/components/hds/separator/index.js +2 -2
- package/dist/components/hds/separator/index.js.map +1 -1
- package/dist/components/hds/side-nav/header/home-link.js.map +1 -1
- package/dist/components/hds/side-nav/header/icon-button.js.map +1 -1
- package/dist/components/hds/side-nav/index.js.map +1 -1
- package/dist/components/hds/side-nav/list/index.js.map +1 -1
- package/dist/components/hds/side-nav/portal/target.js.map +1 -1
- package/dist/components/hds/stepper/step/indicator.js.map +1 -1
- package/dist/components/hds/stepper/task/indicator.js.map +1 -1
- package/dist/components/hds/tabs/index.js.map +1 -1
- package/dist/components/hds/tabs/panel.js.map +1 -1
- package/dist/components/hds/tabs/tab.js +0 -2
- package/dist/components/hds/tabs/tab.js.map +1 -1
- package/dist/components/hds/tabs/types.js +5 -0
- package/dist/components/hds/tabs/types.js.map +1 -1
- package/dist/components/hds/tag/index.js +1 -0
- package/dist/components/hds/tag/index.js.map +1 -1
- package/dist/components/hds/text/body.js +4 -4
- package/dist/components/hds/text/body.js.map +1 -1
- package/dist/components/hds/text/code.js +1 -1
- package/dist/components/hds/text/code.js.map +1 -1
- package/dist/components/hds/text/display.js +2 -2
- package/dist/components/hds/text/display.js.map +1 -1
- package/dist/components/hds/text/index.js +4 -5
- package/dist/components/hds/text/index.js.map +1 -1
- package/dist/helpers/hds-link-to-models.js.map +1 -1
- package/dist/helpers/hds-link-to-query.js.map +1 -1
- package/dist/modifiers/hds-anchored-position.js +8 -6
- package/dist/modifiers/hds-anchored-position.js.map +1 -1
- package/dist/modifiers/hds-clipboard.js.map +1 -1
- package/dist/modifiers/hds-register-event.js +0 -1
- package/dist/modifiers/hds-register-event.js.map +1 -1
- package/dist/styles/@hashicorp/design-system-components.css +109 -45
- package/dist/styles/components/accordion.scss +131 -53
- package/dist/styles/components/rich-tooltip.scss +0 -5
- package/package.json +6 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/app-footer/index.hbs","../../../../src/components/hds/app-footer/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n\\n<div class={{this.classNames}} ...attributes>\\n {{yield (hash ExtraBefore=(component \\\"hds/yield\\\"))}}\\n <ul class=\\\"hds-app-footer__list\\\" aria-label={{this.ariaLabel}}>\\n {{yield (hash StatusLink=(component \\\"hds/app-footer/status-link\\\"))}}\\n {{yield\\n (hash\\n Link=(component \\\"hds/app-footer/link\\\")\\n LegalLinks=(component \\\"hds/app-footer/legal-links\\\")\\n Item=(component \\\"hds/app-footer/item\\\")\\n )\\n }}\\n </ul>\\n {{yield (hash ExtraAfter=(component \\\"hds/yield\\\"))}}\\n <Hds::AppFooter::Copyright @year={{@copyrightYear}} />\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\n\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsYieldSignature } from '../yield';\nimport type HdsAppFooterItemSignature from './legal-links';\nimport type HdsAppFooterLegalLinksSignature from './legal-links';\nimport type HdsAppFooterLinkSignature from './link';\nimport type HdsAppFooterStatusLinkSignature from './status-link';\nimport type { HdsAppFooterThemeTypes } from './types.ts';\n\nexport interface HdsAppFooterSignature {\n Args: {\n ariaLabel?: string;\n copyrightYear?: string;\n theme?: HdsAppFooterThemeTypes;\n };\n Blocks: {\n default: [\n {\n ExtraBefore?: ComponentLike<HdsYieldSignature>;\n StatusLink?: ComponentLike<HdsAppFooterStatusLinkSignature>;\n LegalLinks?: ComponentLike<HdsAppFooterLegalLinksSignature>;\n Link?: ComponentLike<HdsAppFooterLinkSignature>;\n Item?: ComponentLike<HdsAppFooterItemSignature>;\n ExtraAfter?: ComponentLike<HdsYieldSignature>;\n }
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/app-footer/index.hbs","../../../../src/components/hds/app-footer/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n\\n<div class={{this.classNames}} ...attributes>\\n {{yield (hash ExtraBefore=(component \\\"hds/yield\\\"))}}\\n <ul class=\\\"hds-app-footer__list\\\" aria-label={{this.ariaLabel}}>\\n {{yield (hash StatusLink=(component \\\"hds/app-footer/status-link\\\"))}}\\n {{yield\\n (hash\\n Link=(component \\\"hds/app-footer/link\\\")\\n LegalLinks=(component \\\"hds/app-footer/legal-links\\\")\\n Item=(component \\\"hds/app-footer/item\\\")\\n )\\n }}\\n </ul>\\n {{yield (hash ExtraAfter=(component \\\"hds/yield\\\"))}}\\n <Hds::AppFooter::Copyright @year={{@copyrightYear}} />\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\n\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsYieldSignature } from '../yield';\nimport type HdsAppFooterItemSignature from './legal-links';\nimport type HdsAppFooterLegalLinksSignature from './legal-links';\nimport type HdsAppFooterLinkSignature from './link';\nimport type HdsAppFooterStatusLinkSignature from './status-link';\nimport type { HdsAppFooterThemeTypes } from './types.ts';\n\nexport interface HdsAppFooterSignature {\n Args: {\n ariaLabel?: string;\n copyrightYear?: string;\n theme?: HdsAppFooterThemeTypes;\n };\n Blocks: {\n default: [\n {\n ExtraBefore?: ComponentLike<HdsYieldSignature>;\n StatusLink?: ComponentLike<HdsAppFooterStatusLinkSignature>;\n LegalLinks?: ComponentLike<HdsAppFooterLegalLinksSignature>;\n Link?: ComponentLike<HdsAppFooterLinkSignature>;\n Item?: ComponentLike<HdsAppFooterItemSignature>;\n ExtraAfter?: ComponentLike<HdsYieldSignature>;\n },\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsAppFooterComponent extends Component<HdsAppFooterSignature> {\n /**\n * @param ariaLabel\n * @type {string}\n * @default 'Footer items'\n */\n get ariaLabel(): string {\n return this.args.ariaLabel ?? 'Footer items';\n }\n\n /**\n * @param theme\n * @type {HdsAppFooterThemeTypes}\n * @description The component theme\n * @default 'light'\n */\n get theme(): HdsAppFooterThemeTypes {\n return this.args.theme ?? 'light';\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(): string {\n const classes = ['hds-app-footer'];\n\n // add a class based on the @theme argument\n classes.push(`hds-app-footer--theme-${this.theme}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["HdsAppFooterComponent","Component","ariaLabel","args","theme","classNames","classes","push","join","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,4pBAA4pB;;ACD9rB;AACA;AACA;AACA;;AAiCe,MAAMA,qBAAqB,SAASC,SAAS,CAAwB;AAClF;AACF;AACA;AACA;AACA;EACE,IAAIC,SAASA,GAAW;AACtB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,SAAS,IAAI,cAAc,CAAA;AAC9C,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIE,KAAKA,GAA2B;AAClC,IAAA,OAAO,IAAI,CAACD,IAAI,CAACC,KAAK,IAAI,OAAO,CAAA;AACnC,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,UAAUA,GAAW;AACvB,IAAA,MAAMC,OAAO,GAAG,CAAC,gBAAgB,CAAC,CAAA;;AAElC;IACAA,OAAO,CAACC,IAAI,CAAC,CAAA,sBAAA,EAAyB,IAAI,CAACH,KAAK,EAAE,CAAC,CAAA;AAEnD,IAAA,OAAOE,OAAO,CAACE,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAjCoBV,qBAAqB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legal-links.js","sources":["../../../../src/components/hds/app-footer/legal-links.hbs","../../../../src/components/hds/app-footer/legal-links.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n\\n<Hds::AppFooter::Item>\\n <ul class=\\\"hds-app-footer__legal-links\\\" aria-label={{this.ariaLabel}} ...attributes>\\n <Hds::AppFooter::Link @href={{this.hrefForSupport}}>Support</Hds::AppFooter::Link>\\n <Hds::AppFooter::Link @href={{this.hrefForTerms}}>Terms</Hds::AppFooter::Link>\\n <Hds::AppFooter::Link @href={{this.hrefForPrivacy}}>Privacy</Hds::AppFooter::Link>\\n <Hds::AppFooter::Link @href={{this.hrefForSecurity}}>Security</Hds::AppFooter::Link>\\n <Hds::AppFooter::Link @href={{this.hrefForAccessibility}}>Accessibility</Hds::AppFooter::Link>\\n </ul>\\n</Hds::AppFooter::Item>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\n\nexport interface HdsAppFooterLegalLinksSignature {\n Args: {\n ariaLabel?: string;\n hrefForTerms?: string;\n hrefForPrivacy?: string;\n hrefForSecurity?: string;\n hrefForSupport?: string;\n hrefForAccessibility?: string;\n };\n Element: HTMLUListElement;\n}\n\nexport default class HdsAppFooterLegalLinksComponent extends Component<HdsAppFooterLegalLinksSignature> {\n /**\n * @param ariaLabel\n * @type {string}\n * @default 'Legal links'\n */\n get ariaLabel() {\n return this.args.ariaLabel ?? 'Legal links';\n }\n\n /**\n * @param hrefForSupport\n * @type {string}\n * @description The href value of the \"Support\" link\n */\n get hrefForSupport() {\n return this.args.hrefForSupport ?? 'https://www.hashicorp.com/support';\n }\n\n /**\n * @param hrefForTerms\n * @type {string}\n * @description The href value of the \"Terms\" link\n */\n get hrefForTerms() {\n return (\n this.args.hrefForTerms ?? 'https://www.hashicorp.com/terms-of-service'\n );\n }\n\n /**\n * @param hrefForPrivacy\n * @type {string}\n * @description The href value of the \"Privacy\" link\n */\n get hrefForPrivacy() {\n return this.args.hrefForPrivacy ?? 'https://www.hashicorp.com/privacy';\n }\n\n /**\n * @param hrefForSecurity\n * @type {string}\n * @description The href value of the \"Security\" link\n */\n get hrefForSecurity() {\n return this.args.hrefForSecurity ?? 'https://www.hashicorp.com/security';\n }\n\n /**\n * @param hrefForAccessibility\n * @type {string}\n * @description The href value of the \"Accessibility\" link\n */\n get hrefForAccessibility() {\n return (\n this.args.hrefForAccessibility ??\n 'https://www.hashicorp.com/accessibility'\n );\n }\n}\n"],"names":["HdsAppFooterLegalLinksComponent","Component","ariaLabel","args","hrefForSupport","hrefForTerms","hrefForPrivacy","hrefForSecurity","hrefForAccessibility","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,sqBAAsqB;;ACDxsB;AACA;AACA;AACA;;AAgBe,MAAMA,+BAA+B,SAASC,SAAS,CAAkC;AACtG;AACF;AACA;AACA;AACA;EACE,IAAIC,SAASA,
|
|
1
|
+
{"version":3,"file":"legal-links.js","sources":["../../../../src/components/hds/app-footer/legal-links.hbs","../../../../src/components/hds/app-footer/legal-links.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n\\n<Hds::AppFooter::Item>\\n <ul class=\\\"hds-app-footer__legal-links\\\" aria-label={{this.ariaLabel}} ...attributes>\\n <Hds::AppFooter::Link @href={{this.hrefForSupport}}>Support</Hds::AppFooter::Link>\\n <Hds::AppFooter::Link @href={{this.hrefForTerms}}>Terms</Hds::AppFooter::Link>\\n <Hds::AppFooter::Link @href={{this.hrefForPrivacy}}>Privacy</Hds::AppFooter::Link>\\n <Hds::AppFooter::Link @href={{this.hrefForSecurity}}>Security</Hds::AppFooter::Link>\\n <Hds::AppFooter::Link @href={{this.hrefForAccessibility}}>Accessibility</Hds::AppFooter::Link>\\n </ul>\\n</Hds::AppFooter::Item>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\n\nexport interface HdsAppFooterLegalLinksSignature {\n Args: {\n ariaLabel?: string;\n hrefForTerms?: string;\n hrefForPrivacy?: string;\n hrefForSecurity?: string;\n hrefForSupport?: string;\n hrefForAccessibility?: string;\n };\n Element: HTMLUListElement;\n}\n\nexport default class HdsAppFooterLegalLinksComponent extends Component<HdsAppFooterLegalLinksSignature> {\n /**\n * @param ariaLabel\n * @type {string}\n * @default 'Legal links'\n */\n get ariaLabel(): string {\n return this.args.ariaLabel ?? 'Legal links';\n }\n\n /**\n * @param hrefForSupport\n * @type {string}\n * @description The href value of the \"Support\" link\n */\n get hrefForSupport(): string {\n return this.args.hrefForSupport ?? 'https://www.hashicorp.com/support';\n }\n\n /**\n * @param hrefForTerms\n * @type {string}\n * @description The href value of the \"Terms\" link\n */\n get hrefForTerms(): string {\n return (\n this.args.hrefForTerms ?? 'https://www.hashicorp.com/terms-of-service'\n );\n }\n\n /**\n * @param hrefForPrivacy\n * @type {string}\n * @description The href value of the \"Privacy\" link\n */\n get hrefForPrivacy(): string {\n return this.args.hrefForPrivacy ?? 'https://www.hashicorp.com/privacy';\n }\n\n /**\n * @param hrefForSecurity\n * @type {string}\n * @description The href value of the \"Security\" link\n */\n get hrefForSecurity(): string {\n return this.args.hrefForSecurity ?? 'https://www.hashicorp.com/security';\n }\n\n /**\n * @param hrefForAccessibility\n * @type {string}\n * @description The href value of the \"Accessibility\" link\n */\n get hrefForAccessibility(): string {\n return (\n this.args.hrefForAccessibility ??\n 'https://www.hashicorp.com/accessibility'\n );\n }\n}\n"],"names":["HdsAppFooterLegalLinksComponent","Component","ariaLabel","args","hrefForSupport","hrefForTerms","hrefForPrivacy","hrefForSecurity","hrefForAccessibility","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,sqBAAsqB;;ACDxsB;AACA;AACA;AACA;;AAgBe,MAAMA,+BAA+B,SAASC,SAAS,CAAkC;AACtG;AACF;AACA;AACA;AACA;EACE,IAAIC,SAASA,GAAW;AACtB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,SAAS,IAAI,aAAa,CAAA;AAC7C,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIE,cAAcA,GAAW;AAC3B,IAAA,OAAO,IAAI,CAACD,IAAI,CAACC,cAAc,IAAI,mCAAmC,CAAA;AACxE,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,YAAYA,GAAW;AACzB,IAAA,OACE,IAAI,CAACF,IAAI,CAACE,YAAY,IAAI,4CAA4C,CAAA;AAE1E,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,cAAcA,GAAW;AAC3B,IAAA,OAAO,IAAI,CAACH,IAAI,CAACG,cAAc,IAAI,mCAAmC,CAAA;AACxE,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,eAAeA,GAAW;AAC5B,IAAA,OAAO,IAAI,CAACJ,IAAI,CAACI,eAAe,IAAI,oCAAoC,CAAA;AAC1E,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,oBAAoBA,GAAW;AACjC,IAAA,OACE,IAAI,CAACL,IAAI,CAACK,oBAAoB,IAC9B,yCAAyC,CAAA;AAE7C,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EA3DoBV,+BAA+B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-link.js","sources":["../../../../src/components/hds/app-footer/status-link.hbs","../../../../src/components/hds/app-footer/status-link.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n\\n<Hds::AppFooter::Link\\n class={{this.classNames}}\\n style={{this.itemStyle}}\\n @current-when={{@current-when}}\\n @models={{hds-link-to-models @model @models}}\\n @query={{hds-link-to-query @query}}\\n @replace={{@replace}}\\n @route={{@route}}\\n @isRouteExternal={{@isRouteExternal}}\\n @href={{this.href}}\\n @isHrefExternal={{@isHrefExternal}}\\n @icon={{this.statusIcon}}\\n @iconPosition=\\\"leading\\\"\\n ...attributes\\n>{{this.text}}</Hds::AppFooter::Link>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { htmlSafe } from '@ember/template';\nimport type { SafeString } from '@ember/template/-private/handlebars';\nimport { assert } from '@ember/debug';\n\nimport type { HdsInteractiveSignature } from '../interactive/';\nimport { HdsAppFooterStatusLinkStatusValues } from './types.ts';\nimport type { HdsAppFooterStatusTypes } from './types.ts';\nimport type { HdsAppFooterLinkSignature } from './link.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const STATUSES = HdsAppFooterStatusLinkStatusValues;\n\nexport interface HdsAppFooterStatusLinkSignature {\n Args: HdsInteractiveSignature['Args'] & {\n itemStyle?: SafeString;\n status?: HdsAppFooterStatusTypes;\n statusIcon?: FlightIconSignature['Args']['name'];\n statusIconColor?: string;\n text?: string;\n };\n Element: HdsAppFooterLinkSignature['Element'];\n}\n\nexport default class HdsAppFooterStatusLinkComponent extends Component<HdsAppFooterStatusLinkSignature> {\n constructor(owner: unknown, args: HdsInteractiveSignature['Args']) {\n super(owner, args);\n\n assert(\n 'Either @status or @text for \"Hds::AppFooter::StatusLink\" must have a valid value',\n this.args.text !== undefined || this.args.status\n );\n }\n\n /**\n * @param status\n * @type {HdsAppFooterStatusTypes}\n * @description The name of the status which the StatusLink is being set to\n */\n get status() {\n let status;\n if (this.args.status) {\n status = this.args.status.toLowerCase();\n assert(\n `@status for \"Hds::AppFooter\" must be one of the following: ${Object.keys(\n STATUSES\n ).join(', ')} received: ${this.args.status}`,\n\n status in STATUSES\n );\n return status as HdsAppFooterStatusTypes;\n }\n return status;\n }\n\n /**\n * @param statusIcon\n * @type {string}\n * @description The name for the StatusLink icon\n */\n get statusIcon() {\n if (this.status && !this.args.statusIcon) {\n return STATUSES[this.status]?.iconName;\n }\n return this.args.statusIcon;\n }\n\n /**\n * Get the inline style to apply to the item.\n * @method StatusLink#itemStyle\n * @return {string} The \"style\" attribute to apply to the item.\n */\n get itemStyle() {\n if (this.args.statusIconColor) {\n return htmlSafe(\n `--hds-app-footer-status-icon-color: ${this.args.statusIconColor}`\n );\n } else {\n return undefined;\n }\n }\n\n /**\n * @param text\n * @type {string}\n * @description The text content of the StatusLink\n */\n get text() {\n if (!this.args.text && this.status) {\n return STATUSES[this.status]?.text;\n }\n return this.args.text;\n }\n\n /**\n * @param href\n * @type {string}\n * @description The href value of the StatusLink\n */\n get href() {\n return this.args.href ?? 'https://status.hashicorp.com';\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 const classes = ['hds-app-footer__status-link'];\n\n // add a class based on status if no statusIconColor is explicitly specified\n if (this.status && !this.args.statusIconColor) {\n classes.push(`hds-app-footer__status-link--${this.status}`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["STATUSES","HdsAppFooterStatusLinkStatusValues","HdsAppFooterStatusLinkComponent","Component","constructor","owner","args","assert","text","undefined","status","toLowerCase","Object","keys","join","statusIcon","iconName","itemStyle","statusIconColor","htmlSafe","href","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,kiBAAkiB;;ACDpkB;AACA;AACA;AACA;;AAaO,MAAMA,QAAQ,GAAGC,mCAAkC;AAa3C,MAAMC,+BAA+B,SAASC,SAAS,CAAkC;AACtGC,EAAAA,WAAWA,CAACC,KAAc,EAAEC,IAAqC,EAAE;AACjE,IAAA,KAAK,CAACD,KAAK,EAAEC,IAAI,CAAC,CAAA;AAElBC,IAAAA,MAAM,CACJ,kFAAkF,EAClF,IAAI,CAACD,IAAI,CAACE,IAAI,KAAKC,SAAS,IAAI,IAAI,CAACH,IAAI,CAACI,MAC5C,CAAC,CAAA;AACH,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIA,MAAMA,
|
|
1
|
+
{"version":3,"file":"status-link.js","sources":["../../../../src/components/hds/app-footer/status-link.hbs","../../../../src/components/hds/app-footer/status-link.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n\\n<Hds::AppFooter::Link\\n class={{this.classNames}}\\n style={{this.itemStyle}}\\n @current-when={{@current-when}}\\n @models={{hds-link-to-models @model @models}}\\n @query={{hds-link-to-query @query}}\\n @replace={{@replace}}\\n @route={{@route}}\\n @isRouteExternal={{@isRouteExternal}}\\n @href={{this.href}}\\n @isHrefExternal={{@isHrefExternal}}\\n @icon={{this.statusIcon}}\\n @iconPosition=\\\"leading\\\"\\n ...attributes\\n>{{this.text}}</Hds::AppFooter::Link>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { htmlSafe } from '@ember/template';\nimport type { SafeString } from '@ember/template/-private/handlebars';\nimport { assert } from '@ember/debug';\n\nimport type { HdsInteractiveSignature } from '../interactive/';\nimport { HdsAppFooterStatusLinkStatusValues } from './types.ts';\nimport type { HdsAppFooterStatusTypes } from './types.ts';\nimport type { HdsAppFooterLinkSignature } from './link.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const STATUSES = HdsAppFooterStatusLinkStatusValues;\n\nexport interface HdsAppFooterStatusLinkSignature {\n Args: HdsInteractiveSignature['Args'] & {\n itemStyle?: SafeString;\n status?: HdsAppFooterStatusTypes;\n statusIcon?: FlightIconSignature['Args']['name'];\n statusIconColor?: string;\n text?: string;\n };\n Element: HdsAppFooterLinkSignature['Element'];\n}\n\nexport default class HdsAppFooterStatusLinkComponent extends Component<HdsAppFooterStatusLinkSignature> {\n constructor(owner: unknown, args: HdsInteractiveSignature['Args']) {\n super(owner, args);\n\n assert(\n 'Either @status or @text for \"Hds::AppFooter::StatusLink\" must have a valid value',\n this.args.text !== undefined || this.args.status\n );\n }\n\n /**\n * @param status\n * @type {HdsAppFooterStatusTypes}\n * @description The name of the status which the StatusLink is being set to\n */\n get status(): HdsAppFooterStatusTypes | undefined {\n let status;\n if (this.args.status) {\n status = this.args.status.toLowerCase();\n assert(\n `@status for \"Hds::AppFooter\" must be one of the following: ${Object.keys(\n STATUSES\n ).join(', ')} received: ${this.args.status}`,\n\n status in STATUSES\n );\n return status as HdsAppFooterStatusTypes;\n }\n return status;\n }\n\n /**\n * @param statusIcon\n * @type {string}\n * @description The name for the StatusLink icon\n */\n get statusIcon(): FlightIconSignature['Args']['name'] {\n if (this.status && !this.args.statusIcon) {\n return STATUSES[this.status]?.iconName;\n }\n return this.args.statusIcon;\n }\n\n /**\n * Get the inline style to apply to the item.\n * @method StatusLink#itemStyle\n * @return {string} The \"style\" attribute to apply to the item.\n */\n get itemStyle(): SafeString | undefined {\n if (this.args.statusIconColor) {\n return htmlSafe(\n `--hds-app-footer-status-icon-color: ${this.args.statusIconColor}`\n );\n } else {\n return undefined;\n }\n }\n\n /**\n * @param text\n * @type {string}\n * @description The text content of the StatusLink\n */\n get text(): string | undefined {\n if (!this.args.text && this.status) {\n return STATUSES[this.status]?.text;\n }\n return this.args.text;\n }\n\n /**\n * @param href\n * @type {string}\n * @description The href value of the StatusLink\n */\n get href(): string {\n return this.args.href ?? 'https://status.hashicorp.com';\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(): string {\n const classes = ['hds-app-footer__status-link'];\n\n // add a class based on status if no statusIconColor is explicitly specified\n if (this.status && !this.args.statusIconColor) {\n classes.push(`hds-app-footer__status-link--${this.status}`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["STATUSES","HdsAppFooterStatusLinkStatusValues","HdsAppFooterStatusLinkComponent","Component","constructor","owner","args","assert","text","undefined","status","toLowerCase","Object","keys","join","statusIcon","iconName","itemStyle","statusIconColor","htmlSafe","href","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,kiBAAkiB;;ACDpkB;AACA;AACA;AACA;;AAaO,MAAMA,QAAQ,GAAGC,mCAAkC;AAa3C,MAAMC,+BAA+B,SAASC,SAAS,CAAkC;AACtGC,EAAAA,WAAWA,CAACC,KAAc,EAAEC,IAAqC,EAAE;AACjE,IAAA,KAAK,CAACD,KAAK,EAAEC,IAAI,CAAC,CAAA;AAElBC,IAAAA,MAAM,CACJ,kFAAkF,EAClF,IAAI,CAACD,IAAI,CAACE,IAAI,KAAKC,SAAS,IAAI,IAAI,CAACH,IAAI,CAACI,MAC5C,CAAC,CAAA;AACH,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIA,MAAMA,GAAwC;AAChD,IAAA,IAAIA,MAAM,CAAA;AACV,IAAA,IAAI,IAAI,CAACJ,IAAI,CAACI,MAAM,EAAE;MACpBA,MAAM,GAAG,IAAI,CAACJ,IAAI,CAACI,MAAM,CAACC,WAAW,EAAE,CAAA;MACvCJ,MAAM,CACJ,CAA8DK,2DAAAA,EAAAA,MAAM,CAACC,IAAI,CACvEb,QACF,CAAC,CAACc,IAAI,CAAC,IAAI,CAAC,CAAc,WAAA,EAAA,IAAI,CAACR,IAAI,CAACI,MAAM,EAAE,EAE5CA,MAAM,IAAIV,QACZ,CAAC,CAAA;AACD,MAAA,OAAOU,MAAM,CAAA;AACf,KAA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AO,CAACC,IAAI,CAAC,CAAA,6BAAA,EAAgC,IAAI,CAACb,MAAM,EAAE,CAAC,CAAA;AAC7D,KAAA;AAEA,IAAA,OAAOY,OAAO,CAACR,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACU,oBAAA,CAAAC,QAAA,EA9FoBvB,+BAA+B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/app-frame/index.hbs","../../../../src/components/hds/app-frame/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-app-frame\\\" ...attributes>\\n {{#if this.hasHeader}}\\n {{yield (hash Header=(component \\\"hds/app-frame/parts/header\\\"))}}\\n {{/if}}\\n {{#if this.hasSidebar}}\\n {{yield (hash Sidebar=(component \\\"hds/app-frame/parts/sidebar\\\"))}}\\n {{/if}}\\n {{!\\n IMPORTANT: since the modals may be injected via portal or `in-element` with code that lives in the \\\"main\\\" container,\\n the \\\"modal\\\" container needs to be present in the DOM _before_ the \\\"main\\\" block, otherwise it may cause errors\\n where the target DOM element is not found (for example in tests where the modal may be immediately opened on first render).\\n }}\\n {{#if this.hasModals}}\\n {{yield (hash Modals=(component \\\"hds/app-frame/parts/modals\\\"))}}\\n {{/if}}\\n {{yield (hash Main=(component \\\"hds/app-frame/parts/main\\\"))}}\\n {{#if this.hasFooter}}\\n {{yield (hash Footer=(component \\\"hds/app-frame/parts/footer\\\"))}}\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsAppFrameFooterSignature } from './parts/footer.ts';\nimport type { HdsAppFrameHeaderSignature } from './parts/header.ts';\nimport type { HdsAppFrameMainSignature } from './parts/main.ts';\nimport type { HdsAppFrameModalsSignature } from './parts/modals.ts';\nimport type { HdsAppFrameSidebarSignature } from './parts/sidebar.ts';\nexport interface HdsAppFrameSignature {\n Args: {\n hasFooter?: boolean;\n hasHeader?: boolean;\n hasMain?: boolean;\n hasModals?: boolean;\n hasSidebar?: boolean;\n };\n Blocks: {\n default: [\n {\n Footer?: ComponentLike<HdsAppFrameFooterSignature>;\n Header?: ComponentLike<HdsAppFrameHeaderSignature>;\n Main?: ComponentLike<HdsAppFrameMainSignature>;\n Modals?: ComponentLike<HdsAppFrameModalsSignature>;\n Sidebar?: ComponentLike<HdsAppFrameSidebarSignature>;\n }
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/app-frame/index.hbs","../../../../src/components/hds/app-frame/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-app-frame\\\" ...attributes>\\n {{#if this.hasHeader}}\\n {{yield (hash Header=(component \\\"hds/app-frame/parts/header\\\"))}}\\n {{/if}}\\n {{#if this.hasSidebar}}\\n {{yield (hash Sidebar=(component \\\"hds/app-frame/parts/sidebar\\\"))}}\\n {{/if}}\\n {{!\\n IMPORTANT: since the modals may be injected via portal or `in-element` with code that lives in the \\\"main\\\" container,\\n the \\\"modal\\\" container needs to be present in the DOM _before_ the \\\"main\\\" block, otherwise it may cause errors\\n where the target DOM element is not found (for example in tests where the modal may be immediately opened on first render).\\n }}\\n {{#if this.hasModals}}\\n {{yield (hash Modals=(component \\\"hds/app-frame/parts/modals\\\"))}}\\n {{/if}}\\n {{yield (hash Main=(component \\\"hds/app-frame/parts/main\\\"))}}\\n {{#if this.hasFooter}}\\n {{yield (hash Footer=(component \\\"hds/app-frame/parts/footer\\\"))}}\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsAppFrameFooterSignature } from './parts/footer.ts';\nimport type { HdsAppFrameHeaderSignature } from './parts/header.ts';\nimport type { HdsAppFrameMainSignature } from './parts/main.ts';\nimport type { HdsAppFrameModalsSignature } from './parts/modals.ts';\nimport type { HdsAppFrameSidebarSignature } from './parts/sidebar.ts';\nexport interface HdsAppFrameSignature {\n Args: {\n hasFooter?: boolean;\n hasHeader?: boolean;\n hasMain?: boolean;\n hasModals?: boolean;\n hasSidebar?: boolean;\n };\n Blocks: {\n default: [\n {\n Footer?: ComponentLike<HdsAppFrameFooterSignature>;\n Header?: ComponentLike<HdsAppFrameHeaderSignature>;\n Main?: ComponentLike<HdsAppFrameMainSignature>;\n Modals?: ComponentLike<HdsAppFrameModalsSignature>;\n Sidebar?: ComponentLike<HdsAppFrameSidebarSignature>;\n },\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsAppFrameComponent extends Component<HdsAppFrameSignature> {\n /**\n * Indicates if the \"header\" container should be displayed\n *\n * @param hasHeader\n * @type {boolean}\n * @default true\n */\n get hasHeader(): boolean {\n return this.args.hasHeader ?? true;\n }\n\n /**\n * Indicates if the \"sidebar\" container should be displayed\n *\n * @param hasSidebar\n * @type {boolean}\n * @default true\n */\n get hasSidebar(): boolean {\n return this.args.hasSidebar ?? true;\n }\n\n /**\n * Indicates if the \"footer\" container should be displayed\n *\n * @param hasFooter\n * @type {boolean}\n * @default true\n */\n get hasFooter(): boolean {\n return this.args.hasFooter ?? true;\n }\n\n /**\n * Indicates if the \"modals\" container should be displayed\n *\n * @param hasModals\n * @type {boolean}\n * @default true\n */\n get hasModals(): boolean {\n return this.args.hasModals ?? true;\n }\n}\n"],"names":["HdsAppFrameComponent","Component","hasHeader","args","hasSidebar","hasFooter","hasModals","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,6/BAA6/B;;ACD/hC;AACA;AACA;AACA;;AA+Be,MAAMA,oBAAoB,SAASC,SAAS,CAAuB;AAChF;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,SAASA,GAAY;AACvB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,SAAS,IAAI,IAAI,CAAA;AACpC,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIE,UAAUA,GAAY;AACxB,IAAA,OAAO,IAAI,CAACD,IAAI,CAACC,UAAU,IAAI,IAAI,CAAA;AACrC,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,SAASA,GAAY;AACvB,IAAA,OAAO,IAAI,CAACF,IAAI,CAACE,SAAS,IAAI,IAAI,CAAA;AACpC,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,SAASA,GAAY;AACvB,IAAA,OAAO,IAAI,CAACH,IAAI,CAACG,SAAS,IAAI,IAAI,CAAA;AACpC,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EA5CoBR,oBAAoB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sources":["../../../../src/components/hds/application-state/footer.hbs","../../../../src/components/hds/application-state/footer.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n\\n<div class={{this.classNames}} ...attributes>\\n {{yield (hash LinkStandalone=(component \\\"hds/link/standalone\\\"))}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsLinkStandaloneSignature } from '../link/standalone';\n\nexport interface HdsApplicationStateFooterSignature {\n Args: {\n hasDivider?: boolean;\n };\n Blocks: {\n default?: [\n {\n LinkStandalone?: ComponentLike<HdsLinkStandaloneSignature>;\n }
|
|
1
|
+
{"version":3,"file":"footer.js","sources":["../../../../src/components/hds/application-state/footer.hbs","../../../../src/components/hds/application-state/footer.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n\\n<div class={{this.classNames}} ...attributes>\\n {{yield (hash LinkStandalone=(component \\\"hds/link/standalone\\\"))}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsLinkStandaloneSignature } from '../link/standalone';\n\nexport interface HdsApplicationStateFooterSignature {\n Args: {\n hasDivider?: boolean;\n };\n Blocks: {\n default?: [\n {\n LinkStandalone?: ComponentLike<HdsLinkStandaloneSignature>;\n },\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsApplicationStateFooterComponent extends Component<HdsApplicationStateFooterSignature> {\n /**\n * Indicate if the footer should have a top border or not.\n *\n * @param hasDivider\n * @type {boolean}\n * @default false\n */\n get hasDivider(): boolean {\n return this.args.hasDivider ?? false;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-application-state__footer'];\n\n // add a class based on the existence of @hasDivider argument\n if (this.hasDivider) {\n classes.push(`hds-application-state__footer--has-divider`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["HdsApplicationStateFooterComponent","Component","hasDivider","args","classNames","classes","push","join","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,8MAA8M;;ACDhP;AACA;AACA;AACA;;AAoBe,MAAMA,kCAAkC,SAASC,SAAS,CAAqC;AAC5G;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,UAAUA,GAAY;AACxB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,UAAU,IAAI,KAAK,CAAA;AACtC,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIE,UAAUA,GAAW;AACvB,IAAA,MAAMC,OAAO,GAAG,CAAC,+BAA+B,CAAC,CAAA;;AAEjD;IACA,IAAI,IAAI,CAACH,UAAU,EAAE;AACnBG,MAAAA,OAAO,CAACC,IAAI,CAAC,CAAA,0CAAA,CAA4C,CAAC,CAAA;AAC5D,KAAA;AAEA,IAAA,OAAOD,OAAO,CAACE,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EA3BoBT,kCAAkC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/application-state/index.hbs","../../../../src/components/hds/application-state/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-application-state\\\" ...attributes>\\n {{yield\\n (hash\\n Header=(component \\\"hds/application-state/header\\\")\\n Body=(component \\\"hds/application-state/body\\\")\\n Footer=(component \\\"hds/application-state/footer\\\")\\n )\\n }}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport TemplateOnlyComponent from '@ember/component/template-only';\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsApplicationStateHeaderSignature } from './header';\nimport type { HdsApplicationStateBodySignature } from './body';\nimport type { HdsApplicationStateFooterSignature } from './footer';\n\nexport interface HdsApplicationStateSignature {\n Blocks: {\n default: [\n {\n Header?: ComponentLike<HdsApplicationStateHeaderSignature>;\n Body?: ComponentLike<HdsApplicationStateBodySignature>;\n Footer?: ComponentLike<HdsApplicationStateFooterSignature>;\n }
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/application-state/index.hbs","../../../../src/components/hds/application-state/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-application-state\\\" ...attributes>\\n {{yield\\n (hash\\n Header=(component \\\"hds/application-state/header\\\")\\n Body=(component \\\"hds/application-state/body\\\")\\n Footer=(component \\\"hds/application-state/footer\\\")\\n )\\n }}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport TemplateOnlyComponent from '@ember/component/template-only';\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsApplicationStateHeaderSignature } from './header';\nimport type { HdsApplicationStateBodySignature } from './body';\nimport type { HdsApplicationStateFooterSignature } from './footer';\n\nexport interface HdsApplicationStateSignature {\n Blocks: {\n default: [\n {\n Header?: ComponentLike<HdsApplicationStateHeaderSignature>;\n Body?: ComponentLike<HdsApplicationStateBodySignature>;\n Footer?: ComponentLike<HdsApplicationStateFooterSignature>;\n },\n ];\n };\n Element: HTMLDivElement;\n}\n\nconst HdsApplicationStateComponent =\n TemplateOnlyComponent<HdsApplicationStateSignature>();\n\nexport default HdsApplicationStateComponent;\n"],"names":["HdsApplicationStateComponent","TemplateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,2VAA2V;;ACD7X;AACA;AACA;AACA;;AAqBA,MAAMA,4BAA4B,GAChCC,YAAqB,EAAgC,CAAA;AAEvD,YAAAC,oBAAA,CAAAC,QAAA,EAAeH,4BAA4B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/badge/index.hbs","../../../../src/components/hds/badge/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class={{this.classNames}} ...attributes>\\n {{#if this.icon}}\\n <div class=\\\"hds-badge__icon\\\">\\n <FlightIcon @name={{this.icon}} @size=\\\"16\\\" @stretched={{true}} />\\n </div>\\n {{/if}}\\n {{#if this.isIconOnly}}\\n <span class=\\\"sr-only\\\">{{this.text}}</span>\\n {{else}}\\n <div class=\\\"hds-badge__text\\\">\\n {{this.text}}\\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 {\n HdsBadgeColorValues,\n HdsBadgeSizeValues,\n HdsBadgeTypeValues,\n} from './types.ts';\n\nimport type { HdsBadgeColors, HdsBadgeSizes, HdsBadgeTypes } from './types.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const SIZES: string[] = Object.values(HdsBadgeSizeValues);\nexport const TYPES: string[] = Object.values(HdsBadgeTypeValues);\nexport const COLORS: string[] = Object.values(HdsBadgeColorValues);\nexport const DEFAULT_SIZE = HdsBadgeSizeValues.Medium;\nexport const DEFAULT_TYPE = HdsBadgeTypeValues.Filled;\nexport const DEFAULT_COLOR = HdsBadgeColorValues.Neutral;\n\nexport interface HdsBadgeSignature {\n Args: {\n size?: HdsBadgeSizes;\n type?: HdsBadgeTypes;\n color?: HdsBadgeColors;\n text: string;\n icon?: FlightIconSignature['Args']['name'];\n isIconOnly?: boolean;\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsBadgeComponent extends Component<HdsBadgeSignature> {\n /**\n * Sets the size for the component\n * Accepted values: small, medium, large\n *\n * @param size\n * @type {HdsBadgeSizes}\n * @default 'medium'\n */\n get size() {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Badge\" 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 type of the component\n * Accepted values: filled, inverted, outlined\n *\n * @param type\n * @type {HdsBadgeTypes}\n * @default 'filled'\n */\n get type() {\n const { type = DEFAULT_TYPE } = this.args;\n\n assert(\n `@type for \"Hds::Badge\" must be one of the following: ${TYPES.join(\n ', '\n )}; received: ${type}`,\n TYPES.includes(type)\n );\n\n return type;\n }\n\n /**\n * Sets the color scheme for the component\n * Accepted values: neutral, neutral-dark-mode, highlight, success, warning, critical\n *\n * @param color\n * @type {HdsBadgeColors}\n * @default 'neutral'\n */\n get color() {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Badge\" 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 * @param text\n * @type {string}\n * @description The text of the badge. If `isIconOnly` is set to `true`, the text will be visually hidden but still available to assistive technology. If no text value is defined, an error will be thrown.\n */\n get text() {\n const { text } = this.args;\n\n assert(\n '@text for \"Hds::Badge\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * Sets the icon name if there is one\n *\n * @param icon\n * @type {string|null}\n * @default null\n */\n get icon() {\n return this.args.icon ?? null;\n }\n\n /**\n * @param isIconOnly\n * @type {boolean}\n * @default false\n * @description Indicates if the badge will only contain an icon; component will also ensure that accessible text is still applied to the component.\n */\n get isIconOnly() {\n if (this.icon) {\n return this.args.isIconOnly ?? false;\n }\n return false;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method Badge#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n const classes = ['hds-badge'];\n\n // add a class based on the @size argument\n classes.push(`hds-badge--size-${this.size}`);\n\n // add a class based on the @type argument\n classes.push(`hds-badge--type-${this.type}`);\n\n // add a class based on the @color argument\n classes.push(`hds-badge--color-${this.color}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["SIZES","Object","values","HdsBadgeSizeValues","TYPES","HdsBadgeTypeValues","COLORS","HdsBadgeColorValues","DEFAULT_SIZE","Medium","DEFAULT_TYPE","Filled","DEFAULT_COLOR","Neutral","HdsBadgeComponent","Component","size","args","assert","join","includes","type","color","text","undefined","icon","isIconOnly","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,2cAA2c;;ACD7e;AACA;AACA;AACA;;AAcO,MAAMA,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACC,kBAAkB,EAAC;AACzD,MAAMC,KAAe,GAAGH,MAAM,CAACC,MAAM,CAACG,kBAAkB,EAAC;AACzD,MAAMC,MAAgB,GAAGL,MAAM,CAACC,MAAM,CAACK,mBAAmB,EAAC;AACrDC,MAAAA,YAAY,GAAGL,kBAAkB,CAACM,OAAM;AACxCC,MAAAA,YAAY,GAAGL,kBAAkB,CAACM,OAAM;AACxCC,MAAAA,aAAa,GAAGL,mBAAmB,CAACM,QAAO;AAczC,MAAMC,iBAAiB,SAASC,SAAS,CAAoB;AAC1E;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,IAAIA,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/badge/index.hbs","../../../../src/components/hds/badge/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class={{this.classNames}} ...attributes>\\n {{#if this.icon}}\\n <div class=\\\"hds-badge__icon\\\">\\n <FlightIcon @name={{this.icon}} @size=\\\"16\\\" @stretched={{true}} />\\n </div>\\n {{/if}}\\n {{#if this.isIconOnly}}\\n <span class=\\\"sr-only\\\">{{this.text}}</span>\\n {{else}}\\n <div class=\\\"hds-badge__text\\\">\\n {{this.text}}\\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 {\n HdsBadgeColorValues,\n HdsBadgeSizeValues,\n HdsBadgeTypeValues,\n} from './types.ts';\n\nimport type { HdsBadgeColors, HdsBadgeSizes, HdsBadgeTypes } from './types.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const SIZES: string[] = Object.values(HdsBadgeSizeValues);\nexport const TYPES: string[] = Object.values(HdsBadgeTypeValues);\nexport const COLORS: string[] = Object.values(HdsBadgeColorValues);\nexport const DEFAULT_SIZE = HdsBadgeSizeValues.Medium;\nexport const DEFAULT_TYPE = HdsBadgeTypeValues.Filled;\nexport const DEFAULT_COLOR = HdsBadgeColorValues.Neutral;\n\nexport interface HdsBadgeSignature {\n Args: {\n size?: HdsBadgeSizes;\n type?: HdsBadgeTypes;\n color?: HdsBadgeColors;\n text: string;\n icon?: FlightIconSignature['Args']['name'];\n isIconOnly?: boolean;\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsBadgeComponent extends Component<HdsBadgeSignature> {\n /**\n * Sets the size for the component\n * Accepted values: small, medium, large\n *\n * @param size\n * @type {HdsBadgeSizes}\n * @default 'medium'\n */\n get size(): HdsBadgeSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Badge\" 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 type of the component\n * Accepted values: filled, inverted, outlined\n *\n * @param type\n * @type {HdsBadgeTypes}\n * @default 'filled'\n */\n get type(): HdsBadgeTypes {\n const { type = DEFAULT_TYPE } = this.args;\n\n assert(\n `@type for \"Hds::Badge\" must be one of the following: ${TYPES.join(\n ', '\n )}; received: ${type}`,\n TYPES.includes(type)\n );\n\n return type;\n }\n\n /**\n * Sets the color scheme for the component\n * Accepted values: neutral, neutral-dark-mode, highlight, success, warning, critical\n *\n * @param color\n * @type {HdsBadgeColors}\n * @default 'neutral'\n */\n get color(): HdsBadgeColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Badge\" 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 * @param text\n * @type {string}\n * @description The text of the badge. If `isIconOnly` is set to `true`, the text will be visually hidden but still available to assistive technology. If no text value is defined, an error will be thrown.\n */\n get text(): string {\n const { text } = this.args;\n\n assert(\n '@text for \"Hds::Badge\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * Sets the icon name if there is one\n *\n * @param icon\n * @type {string|null}\n * @default null\n */\n get icon(): FlightIconSignature['Args']['name'] | null {\n return this.args.icon ?? null;\n }\n\n /**\n * @param isIconOnly\n * @type {boolean}\n * @default false\n * @description Indicates if the badge will only contain an icon; component will also ensure that accessible text is still applied to the component.\n */\n get isIconOnly(): boolean {\n if (this.icon) {\n return this.args.isIconOnly ?? false;\n }\n return false;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method Badge#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-badge'];\n\n // add a class based on the @size argument\n classes.push(`hds-badge--size-${this.size}`);\n\n // add a class based on the @type argument\n classes.push(`hds-badge--type-${this.type}`);\n\n // add a class based on the @color argument\n classes.push(`hds-badge--color-${this.color}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["SIZES","Object","values","HdsBadgeSizeValues","TYPES","HdsBadgeTypeValues","COLORS","HdsBadgeColorValues","DEFAULT_SIZE","Medium","DEFAULT_TYPE","Filled","DEFAULT_COLOR","Neutral","HdsBadgeComponent","Component","size","args","assert","join","includes","type","color","text","undefined","icon","isIconOnly","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,2cAA2c;;ACD7e;AACA;AACA;AACA;;AAcO,MAAMA,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACC,kBAAkB,E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AI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACW,oBAAA,CAAAC,QAAA,EA3HoBjB,iBAAiB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/badge-count/index.hbs","../../../../src/components/hds/badge-count/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class={{this.classNames}} ...attributes>\\n {{@text}}\\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 {\n HdsBadgeCountColorValues,\n HdsBadgeCountSizeValues,\n HdsBadgeCountTypeValues,\n} from './types.ts';\nimport type {\n HdsBadgeCountColors,\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/badge-count/index.hbs","../../../../src/components/hds/badge-count/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class={{this.classNames}} ...attributes>\\n {{@text}}\\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 {\n HdsBadgeCountColorValues,\n HdsBadgeCountSizeValues,\n HdsBadgeCountTypeValues,\n} from './types.ts';\nimport type {\n HdsBadgeCountColors,\n HdsBadgeCountSizes,\n HdsBadgeCountTypes,\n} from './types.ts';\n\nexport const SIZES: string[] = Object.values(HdsBadgeCountSizeValues);\nexport const TYPES: string[] = Object.values(HdsBadgeCountTypeValues);\nexport const COLORS: string[] = Object.values(HdsBadgeCountColorValues);\nexport const DEFAULT_SIZE = HdsBadgeCountSizeValues.Medium;\nexport const DEFAULT_TYPE = HdsBadgeCountTypeValues.Filled;\nexport const DEFAULT_COLOR = HdsBadgeCountColorValues.Neutral;\n\ninterface HdsBadgeCountSignature {\n Args: {\n size?: HdsBadgeCountSizes;\n type?: HdsBadgeCountTypes;\n color?: HdsBadgeCountColors;\n text: string;\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsBadgeCountComponent extends Component<HdsBadgeCountSignature> {\n /**\n * Sets the size for the component\n * Accepted sizes: small, medium, large\n *\n * @param size\n * @type {string}\n * @default 'medium'\n */\n get size(): HdsBadgeCountSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::BadgeCount\" 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 type of the component\n * Accepted values: filled, inverted, outlined\n *\n * @param type\n * @type {string}\n * @default 'filled'\n */\n get type(): HdsBadgeCountTypes {\n const { type = DEFAULT_TYPE } = this.args;\n\n assert(\n `@type for \"Hds::BadgeCount\" must be one of the following: ${TYPES.join(\n ', '\n )}; received: ${type}`,\n TYPES.includes(type)\n );\n\n return type;\n }\n\n /**\n * Sets the color scheme for the component\n * Accepted colors: neutral, neutral-dark-mode\n *\n * @param color\n * @type {string}\n * @default 'neutral'\n */\n get color(): HdsBadgeCountColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::BadgeCount\" 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 * Get the class names to apply to the component.\n * @method BadgeCount#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-badge-count'];\n\n // add a class based on the @size argument\n classes.push(`hds-badge-count--size-${this.size}`);\n\n // add a class based on the @type argument\n classes.push(`hds-badge-count--type-${this.type}`);\n\n // add a class based on the @color argument\n classes.push(`hds-badge-count--color-${this.color}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["SIZES","Object","values","HdsBadgeCountSizeValues","TYPES","HdsBadgeCountTypeValues","COLORS","HdsBadgeCountColorValues","DEFAULT_SIZE","Medium","DEFAULT_TYPE","Filled","DEFAULT_COLOR","Neutral","HdsBadgeCountComponent","Component","size","args","assert","join","includes","type","color","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,kJAAkJ;;ACDpL;AACA;AACA;AACA;;AAgBO,MAAMA,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACC,uBAAuB,EAAC;AAC9D,MAAMC,KAAe,GAAGH,MAAM,CAACC,MAAM,CAACG,uBAAuB,EAAC;AAC9D,MAAMC,MAAgB,GAAGL,MAAM,CAACC,MAAM,CAACK,wBAAwB,EAAC;AAC1DC,MAAAA,YAAY,GAAGL,uBAAuB,CAACM,OAAM;AAC7CC,MAAAA,YAAY,GAAGL,uBAAuB,CAACM,OAAM;AAC7CC,MAAAA,aAAa,GAAGL,wBAAwB,CAACM,QAAO;AAY9C,MAAMC,sBAAsB,SAASC,SAAS,CAAyB;AACpF;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAuB;IAC7B,MAAM;AAAEA,MAAAA,IAAI,GAAGR,YAAAA;KAAc,GAAG,IAAI,CAACS,IAAI,CAAA;AAEzCC,IAAAA,MAAM,CACJ,CAA6DlB,0DAAAA,EAAAA,KAAK,CAACmB,IAAI,CACrE,IACF,CAAC,CAAA,YAAA,EAAeH,IAAI,CAAA,CAAE,EACtBhB,KAAK,CAACoB,QAAQ,CAACJ,IAAI,CACrB,CAAC,CAAA;AAED,IAAA,OAAOA,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIK,IAAIA,GAAuB;IAC7B,MAAM;AAAEA,MAAAA,IAAI,GAAGX,YAAAA;KAAc,GAAG,IAAI,C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.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsBadgeCountSizeValues {\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\nexport type
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/hds/badge-count/types.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsBadgeCountSizeValues {\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\nexport type HdsBadgeCountSizes = `${HdsBadgeCountSizeValues}`;\n\nexport enum HdsBadgeCountTypeValues {\n Filled = 'filled',\n Inverted = 'inverted',\n Outlined = 'outlined',\n}\nexport type HdsBadgeCountTypes = `${HdsBadgeCountTypeValues}`;\n\nexport enum HdsBadgeCountColorValues {\n Neutral = 'neutral',\n NeutralDarkMode = 'neutral-dark-mode',\n}\nexport type HdsBadgeCountColors = `${HdsBadgeCountColorValues}`;\n"],"names":["HdsBadgeCountSizeValues","HdsBadgeCountTypeValues","HdsBadgeCountColorValues"],"mappings":"AAAA;AACA;AACA;AACA;;AAEYA,IAAAA,uBAAuB,0BAAvBA,uBAAuB,EAAA;EAAvBA,uBAAuB,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;EAAvBA,uBAAuB,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAAvBA,uBAAuB,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAAvBA,uBAAuB,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAOvBC,IAAAA,uBAAuB,0BAAvBA,uBAAuB,EAAA;EAAvBA,uBAAuB,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAAvBA,uBAAuB,CAAA,UAAA,CAAA,GAAA,UAAA,CAAA;EAAvBA,uBAAuB,CAAA,UAAA,CAAA,GAAA,UAAA,CAAA;AAAA,EAAA,OAAvBA,uBAAuB,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAOvBC,IAAAA,wBAAwB,0BAAxBA,wBAAwB,EAAA;EAAxBA,wBAAwB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;EAAxBA,wBAAwB,CAAA,iBAAA,CAAA,GAAA,mBAAA,CAAA;AAAA,EAAA,OAAxBA,wBAAwB,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/copy/button/index.hbs","../../../../../src/components/hds/copy/button/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Button\\n class={{this.classNames}}\\n @size={{this.size}}\\n @isFullWidth={{@isFullWidth}}\\n @text={{@text}}\\n @icon={{this.icon}}\\n @isIconOnly={{@isIconOnly}}\\n @color=\\\"secondary\\\"\\n @iconPosition=\\\"trailing\\\"\\n {{hds-clipboard text=@textToCopy target=@targetToCopy onSuccess=this.onSuccess onError=this.onError}}\\n ...attributes\\n/>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { HdsCopyButtonSizeValues } from './types.ts';\nimport type { HdsCopyButtonSizes } from './types.ts';\nimport type { HdsButtonSignature } from '../../button/';\nimport type { HdsClipboardModifierSignature } from '../../../../modifiers/hds-clipboard.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const DEFAULT_SIZE = HdsCopyButtonSizeValues.Medium;\nexport const SIZES: string[] = Object.values(HdsCopyButtonSizeValues);\nexport const DEFAULT_ICON = 'clipboard-copy';\nexport const SUCCESS_ICON = 'clipboard-checked';\nexport const ERROR_ICON = 'clipboard-x';\nexport const DEFAULT_STATUS = 'idle';\n\nexport interface HdsCopyButtonSignature {\n Args: HdsButtonSignature['Args'] & {\n size?: HdsCopyButtonSizes;\n textToCopy?: HdsClipboardModifierSignature['Args']['Named']['text'];\n targetToCopy?: HdsClipboardModifierSignature['Args']['Named']['target'];\n onSuccess?: HdsClipboardModifierSignature['Args']['Named']['onSuccess'];\n onError?: HdsClipboardModifierSignature['Args']['Named']['onError'];\n };\n Element: HdsButtonSignature['Element'];\n}\n\nexport default class HdsCopyButtonComponent extends Component<HdsCopyButtonSignature> {\n @tracked status = DEFAULT_STATUS;\n @tracked timer: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * @param icon\n * @type {string}\n * @description The icon to be displayed for each status; automatically calculated based on the tracked property `status`.\n */\n get icon() {\n let icon: FlightIconSignature['Args']['name'] = DEFAULT_ICON;\n if (this.status === 'success') {\n icon = SUCCESS_ICON;\n } else if (this.status === 'error') {\n icon = ERROR_ICON;\n }\n return icon;\n }\n\n /**\n * @param size\n * @type {string}\n * @default medium\n * @description The size of the copy/button; acceptable values are `small` and `medium`\n */\n get size() {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Copy::Button\" 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 * Get the class names to apply to the component.\n * @method CopyButton#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n const classes = ['hds-copy-button'];\n\n // add a class based on the @size argument\n classes.push(`hds-button--size-${this.size}`);\n\n classes.push(`hds-copy-button--status-${this.status}`);\n\n return classes.join(' ');\n }\n\n @action\n onSuccess(args: HdsClipboardModifierSignature['Args']['Named']['onSuccess']) {\n this.status = 'success';\n this.resetStatusDelayed();\n\n const { onSuccess } = this.args;\n\n if (typeof onSuccess === 'function') {\n onSuccess(args);\n }\n }\n\n @action\n onError(args: HdsClipboardModifierSignature['Args']['Named']['onError']) {\n this.status = 'error';\n this.resetStatusDelayed();\n\n const { onError } = this.args;\n\n if (typeof onError === 'function') {\n onError(args);\n }\n }\n\n resetStatusDelayed() {\n clearTimeout(this.timer);\n // make it fade back to the default state\n this.timer = setTimeout(() => {\n this.status = DEFAULT_STATUS;\n }, 1500);\n }\n}\n"],"names":["DEFAULT_SIZE","HdsCopyButtonSizeValues","Medium","SIZES","Object","values","DEFAULT_ICON","SUCCESS_ICON","ERROR_ICON","DEFAULT_STATUS","HdsCopyButtonComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","icon","status","size","assert","join","includes","classNames","classes","push","onSuccess","resetStatusDelayed","onError","clearTimeout","timer","setTimeout","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,8aAA8a;;;ACcncA,MAAAA,YAAY,GAAGC,uBAAuB,CAACC,OAAM;AACnD,MAAMC,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACJ,uBAAuB,EAAC;AAC9D,MAAMK,YAAY,GAAG,iBAAgB;AACrC,MAAMC,YAAY,GAAG,oBAAmB;AACxC,MAAMC,UAAU,GAAG,cAAa;AAChC,MAAMC,cAAc,GAAG,OAAM;AAafC,IAAAA,sBAAsB,IAAAC,MAAA,GAA5B,MAAMD,sBAAsB,SAASE,SAAS,CAAyB;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,iBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,gBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAIpF;AACF;AACA;AACA;AACA;EACE,IAAIC,IAAIA,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/copy/button/index.hbs","../../../../../src/components/hds/copy/button/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Button\\n class={{this.classNames}}\\n @size={{this.size}}\\n @isFullWidth={{@isFullWidth}}\\n @text={{@text}}\\n @icon={{this.icon}}\\n @isIconOnly={{@isIconOnly}}\\n @color=\\\"secondary\\\"\\n @iconPosition=\\\"trailing\\\"\\n {{hds-clipboard text=@textToCopy target=@targetToCopy onSuccess=this.onSuccess onError=this.onError}}\\n ...attributes\\n/>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { HdsCopyButtonSizeValues } from './types.ts';\nimport type { HdsCopyButtonSizes } from './types.ts';\nimport type { HdsButtonSignature } from '../../button/';\nimport type { HdsClipboardModifierSignature } from '../../../../modifiers/hds-clipboard.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const DEFAULT_SIZE = HdsCopyButtonSizeValues.Medium;\nexport const SIZES: string[] = Object.values(HdsCopyButtonSizeValues);\nexport const DEFAULT_ICON = 'clipboard-copy';\nexport const SUCCESS_ICON = 'clipboard-checked';\nexport const ERROR_ICON = 'clipboard-x';\nexport const DEFAULT_STATUS = 'idle';\n\nexport interface HdsCopyButtonSignature {\n Args: HdsButtonSignature['Args'] & {\n size?: HdsCopyButtonSizes;\n textToCopy?: HdsClipboardModifierSignature['Args']['Named']['text'];\n targetToCopy?: HdsClipboardModifierSignature['Args']['Named']['target'];\n onSuccess?: HdsClipboardModifierSignature['Args']['Named']['onSuccess'];\n onError?: HdsClipboardModifierSignature['Args']['Named']['onError'];\n };\n Element: HdsButtonSignature['Element'];\n}\n\nexport default class HdsCopyButtonComponent extends Component<HdsCopyButtonSignature> {\n @tracked status = DEFAULT_STATUS;\n @tracked timer: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * @param icon\n * @type {string}\n * @description The icon to be displayed for each status; automatically calculated based on the tracked property `status`.\n */\n get icon(): FlightIconSignature['Args']['name'] {\n let icon: FlightIconSignature['Args']['name'] = DEFAULT_ICON;\n if (this.status === 'success') {\n icon = SUCCESS_ICON;\n } else if (this.status === 'error') {\n icon = ERROR_ICON;\n }\n return icon;\n }\n\n /**\n * @param size\n * @type {string}\n * @default medium\n * @description The size of the copy/button; acceptable values are `small` and `medium`\n */\n get size(): HdsCopyButtonSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Copy::Button\" 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 * Get the class names to apply to the component.\n * @method CopyButton#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-copy-button'];\n\n // add a class based on the @size argument\n classes.push(`hds-button--size-${this.size}`);\n\n classes.push(`hds-copy-button--status-${this.status}`);\n\n return classes.join(' ');\n }\n\n @action\n onSuccess(\n args: HdsClipboardModifierSignature['Args']['Named']['onSuccess']\n ): void {\n this.status = 'success';\n this.resetStatusDelayed();\n\n const { onSuccess } = this.args;\n\n if (typeof onSuccess === 'function') {\n onSuccess(args);\n }\n }\n\n @action\n onError(\n args: HdsClipboardModifierSignature['Args']['Named']['onError']\n ): void {\n this.status = 'error';\n this.resetStatusDelayed();\n\n const { onError } = this.args;\n\n if (typeof onError === 'function') {\n onError(args);\n }\n }\n\n resetStatusDelayed(): void {\n clearTimeout(this.timer);\n // make it fade back to the default state\n this.timer = setTimeout((): void => {\n this.status = DEFAULT_STATUS;\n }, 1500);\n }\n}\n"],"names":["DEFAULT_SIZE","HdsCopyButtonSizeValues","Medium","SIZES","Object","values","DEFAULT_ICON","SUCCESS_ICON","ERROR_ICON","DEFAULT_STATUS","HdsCopyButtonComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","icon","status","size","assert","join","includes","classNames","classes","push","onSuccess","resetStatusDelayed","onError","clearTimeout","timer","setTimeout","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,8aAA8a;;;ACcncA,MAAAA,YAAY,GAAGC,uBAAuB,CAACC,OAAM;AACnD,MAAMC,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACJ,uBAAuB,EAAC;AAC9D,MAAMK,YAAY,GAAG,iBAAgB;AACrC,MAAMC,YAAY,GAAG,oBAAmB;AACxC,MAAMC,UAAU,GAAG,cAAa;AAChC,MAAMC,cAAc,GAAG,OAAM;AAafC,IAAAA,sBAAsB,IAAAC,MAAA,GAA5B,MAAMD,sBAAsB,SAASE,SAAS,CAAyB;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,iBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,gBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAIpF;AACF;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAwC;IAC9C,IAAIA,IAAyC,GAAGZ,YAAY,CAAA;AAC5D,IAAA,IAAI,IAAI,CAACa,MAAM,KAAK,SAAS,EAAE;AAC7BD,MAAAA,IAAI,GAAGX,YAAY,CAAA;AACrB,KAAC,MAAM,IAAI,IAAI,CAACY,MAAM,KAAK,OAAO,EAAE;AAClCD,MAAAA,IAAI,GAAGV,UAAU,CAAA;AACnB,KAAA;AACA,IAAA,OAAOU,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIE,IAAIA,GAAuB;IAC7B,MAAM;AAA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CopySnippetComponent extends Co
|
|
|
23
23
|
_initializerDefineProperty(this, "timer", _descriptor2, this);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* @
|
|
27
|
-
* @
|
|
26
|
+
* @method textToShow
|
|
27
|
+
* @return {string}
|
|
28
28
|
*/
|
|
29
29
|
get textToShow() {
|
|
30
30
|
const {
|
|
@@ -40,7 +40,7 @@ let HdsCopySnippetComponent = (_class = class HdsCopySnippetComponent extends Co
|
|
|
40
40
|
/**
|
|
41
41
|
* @param icon
|
|
42
42
|
* @type {string}
|
|
43
|
-
* @default
|
|
43
|
+
* @default clipboard-copy
|
|
44
44
|
* @description Determines the icon to be used, based on the success state. Note that this is auto-tracked because it depends on a tracked property (status).
|
|
45
45
|
*/
|
|
46
46
|
get icon() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/copy/snippet/index.hbs","../../../../../src/components/hds/copy/snippet/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<button\\n type=\\\"button\\\"\\n class={{this.classNames}}\\n {{hds-clipboard text=@textToCopy onSuccess=this.onSuccess onError=this.onError}}\\n aria-label={{concat \\\"copy \\\" @textToCopy}}\\n ...attributes\\n>\\n <Hds::Text::Code class=\\\"hds-copy-snippet__text\\\" @tag=\\\"span\\\" @size=\\\"100\\\">\\n {{this.textToShow}}\\n </Hds::Text::Code>\\n <FlightIcon @name={{this.icon}} class=\\\"hds-copy-snippet__icon\\\" />\\n</button>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { HdsCopySnippetColorValues } from './types.ts';\nimport type { HdsCopySnippetColors } from './types.ts';\nimport type { HdsClipboardModifierSignature } from '../../../../modifiers/hds-clipboard.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const DEFAULT_COLOR = HdsCopySnippetColorValues.Primary;\nexport const COLORS: string[] = Object.values(HdsCopySnippetColorValues);\n\nexport const DEFAULT_ICON = 'clipboard-copy';\nexport const SUCCESS_ICON = 'clipboard-checked';\nexport const ERROR_ICON = 'clipboard-x';\nexport const DEFAULT_STATUS = 'idle';\n\ninterface HdsCopySnippetSignature {\n Args: {\n color?: HdsCopySnippetColors;\n isFullWidth?: boolean;\n textToCopy: HdsClipboardModifierSignature['Args']['Named']['text'];\n isTruncated?: boolean;\n onSuccess?: HdsClipboardModifierSignature['Args']['Named']['onSuccess'];\n onError?: HdsClipboardModifierSignature['Args']['Named']['onError'];\n };\n Element: HTMLButtonElement;\n}\n\nexport default class HdsCopySnippetComponent extends Component<HdsCopySnippetSignature> {\n @tracked status = DEFAULT_STATUS;\n @tracked timer: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * @param textToCopy\n * @type {string | number | bigint | undefined} ???\n */\n get textToShow() {\n const { textToCopy = '' } = this.args;\n\n if (typeof textToCopy === 'string') {\n return textToCopy;\n } else {\n return textToCopy.toString();\n }\n }\n\n /**\n * @param icon\n * @type {string}\n * @default DEFAULT_ICON\n * @description Determines the icon to be used, based on the success state. Note that this is auto-tracked because it depends on a tracked property (status).\n */\n get icon() {\n let icon: FlightIconSignature['Args']['name'] = DEFAULT_ICON;\n if (this.status === 'success') {\n icon = SUCCESS_ICON;\n } else if (this.status === 'error') {\n icon = ERROR_ICON;\n }\n return icon;\n }\n\n /**\n * @param color\n * @type {string}\n * @default primary\n * @description Determines the color of button to be used; acceptable values are `primary` and `secondary`\n */\n get color() {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Copy::Snippet\" 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 * @param isFullWidth\n * @type {boolean}\n * @default false\n * @description Indicates that the component should take up the full width of the parent container.\n */\n get isFullWidth() {\n return this.args.isFullWidth ?? false;\n }\n\n /**\n * @param isTruncated\n * @type {boolean}\n * @default false\n * @description Indicates that the component should be truncated instead of wrapping text and using multiple lines.\n */\n get isTruncated() {\n return this.args.isTruncated ?? false;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method CopySnippet#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n const classes = ['hds-copy-snippet'];\n\n // add a class based on the @color argument\n classes.push(`hds-copy-snippet--color-${this.color}`);\n\n // add a class based on the tracked status (idle/success/error)\n classes.push(`hds-copy-snippet--status-${this.status}`);\n\n // add a class based on the @isTruncated argument\n if (this.isTruncated) {\n classes.push('hds-copy-snippet--is-truncated');\n }\n\n // add a class based on the @isFullWidth argument\n if (this.isFullWidth) {\n classes.push('hds-copy-snippet--width-full');\n }\n\n return classes.join(' ');\n }\n\n @action\n onSuccess(args: HdsClipboardModifierSignature['Args']['Named']['onSuccess']) {\n this.status = 'success';\n this.resetStatusDelayed();\n\n const { onSuccess } = this.args;\n\n if (typeof onSuccess === 'function') {\n onSuccess(args);\n }\n }\n\n @action\n onError(args: HdsClipboardModifierSignature['Args']['Named']['onError']) {\n this.status = 'error';\n this.resetStatusDelayed();\n\n const { onError } = this.args;\n\n if (typeof onError === 'function') {\n onError(args);\n }\n }\n\n resetStatusDelayed() {\n clearTimeout(this.timer);\n // make it fade back to the default state\n this.timer = setTimeout(() => {\n this.status = DEFAULT_STATUS;\n }, 1500);\n }\n}\n"],"names":["DEFAULT_COLOR","HdsCopySnippetColorValues","Primary","COLORS","Object","values","DEFAULT_ICON","SUCCESS_ICON","ERROR_ICON","DEFAULT_STATUS","HdsCopySnippetComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","textToShow","textToCopy","toString","icon","status","color","assert","join","includes","isFullWidth","isTruncated","classNames","classes","push","onSuccess","resetStatusDelayed","onError","clearTimeout","timer","setTimeout","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,ifAAif;;;ACatgBA,MAAAA,aAAa,GAAGC,yBAAyB,CAACC,QAAO;AACvD,MAAMC,MAAgB,GAAGC,MAAM,CAACC,MAAM,CAACJ,yBAAyB,EAAC;AAEjE,MAAMK,YAAY,GAAG,iBAAgB;AACrC,MAAMC,YAAY,GAAG,oBAAmB;AACxC,MAAMC,UAAU,GAAG,cAAa;AAChC,MAAMC,cAAc,GAAG,OAAM;AAcfC,IAAAA,uBAAuB,IAAAC,MAAA,GAA7B,MAAMD,uBAAuB,SAASE,SAAS,CAA0B;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,iBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,gBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAItF;AACF;AACA;AACA;EACE,IAAIC,UAAUA,GAAG;IACf,MAAM;AAAEC,MAAAA,UAAU,GAAG,EAAA;KAAI,GAAG,IAAI,CAACL,IAAI,CAAA;AAErC,IAAA,IAAI,OAAOK,UAAU,KAAK,QAAQ,EAAE;AAClC,MAAA,OAAOA,UAAU,CAAA;AACnB,KAAC,MAAM;AACL,MAAA,OAAOA,UAAU,CAACC,QAAQ,EAAE,CAAA;AAC9B,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAG;IACT,IAAIA,IAAyC,GAAGf,YAAY,CAAA;AAC5D,IAAA,IAAI,IAAI,CAACgB,MAAM,KAAK,SAAS,EAAE;AAC7BD,MAAAA,IAAI,GAAGd,YAAY,CAAA;AACrB,KAAC,MAA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GAAA;AAAA,CAAAQ,CAAAA,EAAAA,YAAA,GAAAqB,yBAAA,CAAA3B,MAAA,CAAA4B,SAAA,YAC/BC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAA,CAAA,EAAAN,yBAAA,CAAA3B,MAAA,CAAA4B,SAAA,EAAA,WAAA,EAAA,CAkGPM,MAAM,CAAAzC,EAAAA,MAAA,CAAA0C,wBAAA,CAAAnC,MAAA,CAAA4B,SAAA,EAAA5B,WAAAA,CAAAA,EAAAA,MAAA,CAAA4B,SAAA,CAAA,EAAAD,yBAAA,CAAA3B,MAAA,CAAA4B,SAAA,cAYNM,MAAM,CAAA,EAAAzC,MAAA,CAAA0C,wBAAA,CAAAnC,MAAA,CAAA4B,SAAA,EAAA,SAAA,CAAA,EAAA5B,MAAA,CAAA4B,SAAA,IAAA5B,MAAA,EAAA;AAhHmCoC,oBAAA,CAAAC,QAAA,EAAvBtC,uBAAuB,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/copy/snippet/index.hbs","../../../../../src/components/hds/copy/snippet/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<button\\n type=\\\"button\\\"\\n class={{this.classNames}}\\n {{hds-clipboard text=@textToCopy onSuccess=this.onSuccess onError=this.onError}}\\n aria-label={{concat \\\"copy \\\" @textToCopy}}\\n ...attributes\\n>\\n <Hds::Text::Code class=\\\"hds-copy-snippet__text\\\" @tag=\\\"span\\\" @size=\\\"100\\\">\\n {{this.textToShow}}\\n </Hds::Text::Code>\\n <FlightIcon @name={{this.icon}} class=\\\"hds-copy-snippet__icon\\\" />\\n</button>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { HdsCopySnippetColorValues } from './types.ts';\nimport type { HdsCopySnippetColors } from './types.ts';\nimport type { HdsClipboardModifierSignature } from '../../../../modifiers/hds-clipboard.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const DEFAULT_COLOR = HdsCopySnippetColorValues.Primary;\nexport const COLORS: string[] = Object.values(HdsCopySnippetColorValues);\n\nexport const DEFAULT_ICON = 'clipboard-copy';\nexport const SUCCESS_ICON = 'clipboard-checked';\nexport const ERROR_ICON = 'clipboard-x';\nexport const DEFAULT_STATUS = 'idle';\n\ninterface HdsCopySnippetSignature {\n Args: {\n color?: HdsCopySnippetColors;\n isFullWidth?: boolean;\n textToCopy: HdsClipboardModifierSignature['Args']['Named']['text'];\n isTruncated?: boolean;\n onSuccess?: HdsClipboardModifierSignature['Args']['Named']['onSuccess'];\n onError?: HdsClipboardModifierSignature['Args']['Named']['onError'];\n };\n Element: HTMLButtonElement;\n}\n\nexport default class HdsCopySnippetComponent extends Component<HdsCopySnippetSignature> {\n @tracked status = DEFAULT_STATUS;\n @tracked timer: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * @method textToShow\n * @return {string}\n */\n get textToShow(): string {\n const { textToCopy = '' } = this.args;\n\n if (typeof textToCopy === 'string') {\n return textToCopy;\n } else {\n return textToCopy.toString();\n }\n }\n\n /**\n * @param icon\n * @type {string}\n * @default clipboard-copy\n * @description Determines the icon to be used, based on the success state. Note that this is auto-tracked because it depends on a tracked property (status).\n */\n get icon(): FlightIconSignature['Args']['name'] {\n let icon: FlightIconSignature['Args']['name'] = DEFAULT_ICON;\n if (this.status === 'success') {\n icon = SUCCESS_ICON;\n } else if (this.status === 'error') {\n icon = ERROR_ICON;\n }\n return icon;\n }\n\n /**\n * @param color\n * @type {string}\n * @default primary\n * @description Determines the color of button to be used; acceptable values are `primary` and `secondary`\n */\n get color(): HdsCopySnippetColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Copy::Snippet\" 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 * @param isFullWidth\n * @type {boolean}\n * @default false\n * @description Indicates that the component should take up the full width of the parent container.\n */\n get isFullWidth(): boolean {\n return this.args.isFullWidth ?? false;\n }\n\n /**\n * @param isTruncated\n * @type {boolean}\n * @default false\n * @description Indicates that the component should be truncated instead of wrapping text and using multiple lines.\n */\n get isTruncated(): boolean {\n return this.args.isTruncated ?? false;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method CopySnippet#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-copy-snippet'];\n\n // add a class based on the @color argument\n classes.push(`hds-copy-snippet--color-${this.color}`);\n\n // add a class based on the tracked status (idle/success/error)\n classes.push(`hds-copy-snippet--status-${this.status}`);\n\n // add a class based on the @isTruncated argument\n if (this.isTruncated) {\n classes.push('hds-copy-snippet--is-truncated');\n }\n\n // add a class based on the @isFullWidth argument\n if (this.isFullWidth) {\n classes.push('hds-copy-snippet--width-full');\n }\n\n return classes.join(' ');\n }\n\n @action\n onSuccess(\n args: HdsClipboardModifierSignature['Args']['Named']['onSuccess']\n ): void {\n this.status = 'success';\n this.resetStatusDelayed();\n\n const { onSuccess } = this.args;\n\n if (typeof onSuccess === 'function') {\n onSuccess(args);\n }\n }\n\n @action\n onError(\n args: HdsClipboardModifierSignature['Args']['Named']['onError']\n ): void {\n this.status = 'error';\n this.resetStatusDelayed();\n\n const { onError } = this.args;\n\n if (typeof onError === 'function') {\n onError(args);\n }\n }\n\n resetStatusDelayed(): void {\n clearTimeout(this.timer);\n // make it fade back to the default state\n this.timer = setTimeout((): void => {\n this.status = DEFAULT_STATUS;\n }, 1500);\n }\n}\n"],"names":["DEFAULT_COLOR","HdsCopySnippetColorValues","Primary","COLORS","Object","values","DEFAULT_ICON","SUCCESS_ICON","ERROR_ICON","DEFAULT_STATUS","HdsCopySnippetComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","textToShow","textToCopy","toString","icon","status","color","assert","join","includes","isFullWidth","isTruncated","classNames","classes","push","onSuccess","resetStatusDelayed","onError","clearTimeout","timer","setTimeout","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,ifAAif;;;ACatgBA,MAAAA,aAAa,GAAGC,yBAAyB,CAACC,QAAO;AACvD,MAAMC,MAAgB,GAAGC,MAAM,CAACC,MAAM,CAACJ,yBAAyB,EAAC;AAEjE,MAAMK,YAAY,GAAG,iBAAgB;AACrC,MAAMC,YAAY,GAAG,oBAAmB;AACxC,MAAMC,UAAU,GAAG,cAAa;AAChC,MAAMC,cAAc,GAAG,OAAM;AAcfC,IAAAA,uBAAuB,IAAAC,MAAA,GAA7B,MAAMD,uBAAuB,SAASE,SAAS,CAA0B;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,iBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,gBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAItF;AACF;AACA;AACA;EACE,IAAIC,UAAUA,GAAW;IACvB,MAAM;AAAEC,MAAAA,UAAU,GAAG,EAAA;KAAI,GAAG,IAAI,CAACL,IAAI,CAAA;AAErC,IAAA,IAAI,OAAOK,UAAU,KAAK,QAAQ,EAAE;AAClC,MAAA,OAAOA,UAAU,CAAA;AACnB,KAAC,MAAM;AACL,MAAA,OAAOA,UAAU,CAACC,QAAQ,EAAE,CAAA;AAC9B,KAA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sB,yBAAA,CAAA3B,MAAA,CAAA4B,SAAA,EAAA,QAAA,EAAA,CAtIEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAUnC,cAAc,CAAA;AAAA,GAAA;AAAA,CAAAQ,CAAAA,EAAAA,YAAA,GAAAqB,yBAAA,CAAA3B,MAAA,CAAA4B,SAAA,YAC/BC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAA,CAAA,EAAAN,yBAAA,CAAA3B,MAAA,CAAA4B,SAAA,EAAA,WAAA,EAAA,CAkGPM,MAAM,CAAAzC,EAAAA,MAAA,CAAA0C,wBAAA,CAAAnC,MAAA,CAAA4B,SAAA,EAAA5B,WAAAA,CAAAA,EAAAA,MAAA,CAAA4B,SAAA,CAAA,EAAAD,yBAAA,CAAA3B,MAAA,CAAA4B,SAAA,cAcNM,MAAM,CAAA,EAAAzC,MAAA,CAAA0C,wBAAA,CAAAnC,MAAA,CAAA4B,SAAA,EAAA,SAAA,CAAA,EAAA5B,MAAA,CAAA4B,SAAA,IAAA5B,MAAA,EAAA;AAlHmCoC,oBAAA,CAAAC,QAAA,EAAvBtC,uBAAuB,CAAA;;;;"}
|
|
@@ -6,16 +6,40 @@ import { schedule } from '@ember/runloop';
|
|
|
6
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
7
|
import { setComponentTemplate } from '@ember/component';
|
|
8
8
|
|
|
9
|
-
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class=\"hds-disclosure-primitive\" ...attributes>\n <div class=\"hds-disclosure-primitive__toggle\">\n {{yield (hash onClickToggle=this.onClickToggle isOpen=this.isOpen) to=\"toggle\"}}\n </div>\n {{#if this.isOpen}}\n <div class=\"hds-disclosure-primitive__content\">\n {{yield (hash close=this.close) to=\"content\"}}\n </div>\n {{/if}}\n</div>");
|
|
9
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class=\"hds-disclosure-primitive\" {{did-update this.onStateChange @isOpen}} ...attributes>\n <div class=\"hds-disclosure-primitive__toggle\">\n {{yield (hash onClickToggle=this.onClickToggle isOpen=this.isOpen) to=\"toggle\"}}\n </div>\n {{#if this.isOpen}}\n <div class=\"hds-disclosure-primitive__content\">\n {{yield (hash close=this.close) to=\"content\"}}\n </div>\n {{/if}}\n</div>");
|
|
10
10
|
|
|
11
|
-
var _class, _descriptor;
|
|
11
|
+
var _class, _descriptor, _descriptor2;
|
|
12
12
|
let HdsDisclosurePrimitiveComponent = (_class = class HdsDisclosurePrimitiveComponent extends Component {
|
|
13
13
|
constructor(...args) {
|
|
14
14
|
super(...args);
|
|
15
|
-
_initializerDefineProperty(this, "
|
|
15
|
+
_initializerDefineProperty(this, "_isOpen", _descriptor, this);
|
|
16
|
+
_initializerDefineProperty(this, "_isControlled", _descriptor2, this);
|
|
17
|
+
}
|
|
18
|
+
get isOpen() {
|
|
19
|
+
if (this._isControlled) {
|
|
20
|
+
// if the state is controlled from outside, the argument overrides the internal state
|
|
21
|
+
return this.args.isOpen ?? this._isOpen;
|
|
22
|
+
} else {
|
|
23
|
+
// if the state changes internally, the internal state overrides the argument
|
|
24
|
+
return this._isOpen;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
set isOpen(value) {
|
|
28
|
+
this._isOpen = value || false;
|
|
16
29
|
}
|
|
17
30
|
onClickToggle() {
|
|
18
31
|
this.isOpen = !this.isOpen;
|
|
32
|
+
this._isControlled = false;
|
|
33
|
+
// we call the "onClickToggle" callback if it exists and it's a function
|
|
34
|
+
if (this.args.onClickToggle && typeof this.args.onClickToggle === 'function') {
|
|
35
|
+
this.args.onClickToggle(this.isOpen);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
onStateChange() {
|
|
39
|
+
if (this.args.isOpen !== undefined) {
|
|
40
|
+
this.isOpen = this.args.isOpen;
|
|
41
|
+
}
|
|
42
|
+
this._isControlled = true;
|
|
19
43
|
}
|
|
20
44
|
close() {
|
|
21
45
|
// we schedule this afterRender to avoid an error in tests caused by updating `isOpen` multiple times in the same computation
|
|
@@ -27,14 +51,21 @@ let HdsDisclosurePrimitiveComponent = (_class = class HdsDisclosurePrimitiveComp
|
|
|
27
51
|
}
|
|
28
52
|
});
|
|
29
53
|
}
|
|
30
|
-
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "
|
|
54
|
+
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "_isOpen", [tracked], {
|
|
55
|
+
configurable: true,
|
|
56
|
+
enumerable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
initializer: function () {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "_isControlled", [tracked], {
|
|
31
62
|
configurable: true,
|
|
32
63
|
enumerable: true,
|
|
33
64
|
writable: true,
|
|
34
65
|
initializer: function () {
|
|
35
|
-
return this.args.isOpen
|
|
66
|
+
return this.args.isOpen !== undefined;
|
|
36
67
|
}
|
|
37
|
-
}), _applyDecoratedDescriptor(_class.prototype, "onClickToggle", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onClickToggle"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "close", [action], Object.getOwnPropertyDescriptor(_class.prototype, "close"), _class.prototype)), _class);
|
|
68
|
+
}), _applyDecoratedDescriptor(_class.prototype, "onClickToggle", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onClickToggle"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onStateChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onStateChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "close", [action], Object.getOwnPropertyDescriptor(_class.prototype, "close"), _class.prototype)), _class);
|
|
38
69
|
setComponentTemplate(TEMPLATE, HdsDisclosurePrimitiveComponent);
|
|
39
70
|
|
|
40
71
|
export { HdsDisclosurePrimitiveComponent as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/disclosure-primitive/index.hbs","../../../../src/components/hds/disclosure-primitive/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-disclosure-primitive\\\" ...attributes>\\n <div class=\\\"hds-disclosure-primitive__toggle\\\">\\n {{yield (hash onClickToggle=this.onClickToggle isOpen=this.isOpen) to=\\\"toggle\\\"}}\\n </div>\\n {{#if this.isOpen}}\\n <div class=\\\"hds-disclosure-primitive__content\\\">\\n {{yield (hash close=this.close) to=\\\"content\\\"}}\\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 { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { schedule } from '@ember/runloop';\n\nexport interface HdsDisclosurePrimitiveSignature {\n Args: {\n isOpen?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClose?: (...args: any[]) => void;\n };\n Blocks: {\n toggle: [\n {\n isOpen: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClickToggle: (...args: any[]) => void;\n }
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/disclosure-primitive/index.hbs","../../../../src/components/hds/disclosure-primitive/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-disclosure-primitive\\\" {{did-update this.onStateChange @isOpen}} ...attributes>\\n <div class=\\\"hds-disclosure-primitive__toggle\\\">\\n {{yield (hash onClickToggle=this.onClickToggle isOpen=this.isOpen) to=\\\"toggle\\\"}}\\n </div>\\n {{#if this.isOpen}}\\n <div class=\\\"hds-disclosure-primitive__content\\\">\\n {{yield (hash close=this.close) to=\\\"content\\\"}}\\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 { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { schedule } from '@ember/runloop';\n\nexport interface HdsDisclosurePrimitiveSignature {\n Args: {\n isOpen?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClose?: (...args: any[]) => void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClickToggle?: (...args: any[]) => void;\n };\n Blocks: {\n toggle: [\n {\n isOpen: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClickToggle: (...args: any[]) => void;\n },\n ];\n content: [\n {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n close: (...args: any[]) => void;\n },\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsDisclosurePrimitiveComponent extends Component<HdsDisclosurePrimitiveSignature> {\n @tracked _isOpen = false;\n @tracked _isControlled = this.args.isOpen !== undefined;\n\n get isOpen(): boolean {\n if (this._isControlled) {\n // if the state is controlled from outside, the argument overrides the internal state\n return this.args.isOpen ?? this._isOpen;\n } else {\n // if the state changes internally, the internal state overrides the argument\n return this._isOpen;\n }\n }\n\n set isOpen(value) {\n this._isOpen = value || false;\n }\n\n @action\n onClickToggle(): void {\n this.isOpen = !this.isOpen;\n this._isControlled = false;\n // we call the \"onClickToggle\" callback if it exists and it's a function\n if (\n this.args.onClickToggle &&\n typeof this.args.onClickToggle === 'function'\n ) {\n this.args.onClickToggle(this.isOpen);\n }\n }\n\n @action\n onStateChange(): void {\n if (this.args.isOpen !== undefined) {\n this.isOpen = this.args.isOpen;\n }\n this._isControlled = true;\n }\n\n @action\n close(): void {\n // we schedule this afterRender to avoid an error in tests caused by updating `isOpen` multiple times in the same computation\n schedule('afterRender', (): void => {\n this.isOpen = false;\n // we call the \"onClose\" callback if it exists (and is a function)\n if (this.args.onClose && typeof this.args.onClose === 'function') {\n this.args.onClose();\n }\n });\n }\n}\n"],"names":["HdsDisclosurePrimitiveComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","isOpen","_isControlled","_isOpen","value","onClickToggle","onStateChange","undefined","close","schedule","onClose","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,2eAA2e;;;ACmCxfA,IAAAA,+BAA+B,IAAAC,MAAA,GAArC,MAAMD,+BAA+B,SAASE,SAAS,CAAkC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,kBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,wBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAItG,IAAIC,MAAMA,GAAY;IACpB,IAAI,IAAI,CAACC,aAAa,EAAE;AACtB;MACA,OAAO,IAAI,CAACL,IAAI,CAACI,MAAM,IAAI,IAAI,CAACE,OAAO,CAAA;AACzC,KAAC,MAAM;AACL;MACA,OAAO,IAAI,CAACA,OAAO,CAAA;AACrB,KAAA;AACF,GAAA;EAEA,IAAIF,MAAMA,CAACG,KAAK,EAAE;AAChB,IAAA,IAAI,CAACD,OAAO,GAAGC,KAAK,IAAI,KAAK,CAAA;AAC/B,GAAA;AAGAC,EA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,SAAA,oBACvBC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAiB,IAAI,CAACpB,IAAI,CAACI,MAAM,KAAKM,SAAS,CAAA;AAAA,GAAA;AAAA,CAAA,CAAA,EAAAI,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAAA,eAAA,EAAA,CAgBtDM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAA1B,MAAA,CAAAkB,SAAA,EAAA,eAAA,CAAA,EAAAlB,MAAA,CAAAkB,SAAA,CAAA,EAAAD,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAAA,eAAA,EAAA,CAaNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAA1B,MAAA,CAAAkB,SAAA,EAAA,eAAA,CAAA,EAAAlB,MAAA,CAAAkB,SAAA,CAAA,EAAAD,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAAA,OAAA,EAAA,CAQNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAA1B,MAAA,CAAAkB,SAAA,EAAA,OAAA,CAAA,EAAAlB,MAAA,CAAAkB,SAAA,CAAA,GAAAlB,MAAA,EAAA;AAvC2C2B,oBAAA,CAAAC,QAAA,EAA/B7B,+BAA+B,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/dismiss-button/index.hbs","../../../../src/components/hds/dismiss-button/index.ts"],"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<button class=\\\"hds-dismiss-button\\\" type=\\\"button\\\" aria-label={{this.ariaLabel}} ...attributes>\\n <FlightIcon @name=\\\"x\\\" @size=\\\"16\\\" @isInlineBlock={{false}} />\\n</button>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\n\nexport interface HdsDismissButtonSignature {\n Args: {\n ariaLabel?: string;\n };\n Element: HTMLButtonElement;\n}\n\nexport default class HdsDismissButtonComponent extends Component<HdsDismissButtonSignature> {\n /**\n * @param ariaLabel\n * @type {string}\n * @default 'Dismiss'\n */\n get ariaLabel() {\n return this.args.ariaLabel ?? 'Dismiss';\n }\n}\n"],"names":["HdsDismissButtonComponent","Component","ariaLabel","args","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,ySAAyS;;ACD3U;AACA;AACA;AACA;;AAWe,MAAMA,yBAAyB,SAASC,SAAS,CAA4B;AAC1F;AACF;AACA;AACA;AACA;EACE,IAAIC,SAASA,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/dismiss-button/index.hbs","../../../../src/components/hds/dismiss-button/index.ts"],"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<button class=\\\"hds-dismiss-button\\\" type=\\\"button\\\" aria-label={{this.ariaLabel}} ...attributes>\\n <FlightIcon @name=\\\"x\\\" @size=\\\"16\\\" @isInlineBlock={{false}} />\\n</button>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\n\nexport interface HdsDismissButtonSignature {\n Args: {\n ariaLabel?: string;\n };\n Element: HTMLButtonElement;\n}\n\nexport default class HdsDismissButtonComponent extends Component<HdsDismissButtonSignature> {\n /**\n * @param ariaLabel\n * @type {string}\n * @default 'Dismiss'\n */\n get ariaLabel(): string {\n return this.args.ariaLabel ?? 'Dismiss';\n }\n}\n"],"names":["HdsDismissButtonComponent","Component","ariaLabel","args","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,ySAAyS;;ACD3U;AACA;AACA;AACA;;AAWe,MAAMA,yBAAyB,SAASC,SAAS,CAA4B;AAC1F;AACF;AACA;AACA;AACA;EACE,IAAIC,SAASA,GAAW;AACtB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,SAAS,IAAI,SAAS,CAAA;AACzC,GAAA;AACF,CAAA;AAACE,oBAAA,CAAAC,QAAA,EAToBL,yBAAyB,CAAA;;;;"}
|
|
@@ -2,7 +2,7 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
5
|
-
var TEMPLATE = 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}} id={{this.id}} {{did-insert this.onInsert}} {{will-destroy this.onRemove}} ...attributes>\n <FlightIcon class=\"hds-form-error__icon\" @name=\"alert-diamond-fill\" />\n <Hds::Text::Body class=\"hds-form-error__content\" @tag=\"div\" @size=\"100\" @weight=\"medium\">\n {{yield (hash Message=(component \"hds/form/error/message\"))}}\n </Hds::Text::Body>\n</div
|
|
5
|
+
var TEMPLATE = 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}} id={{this.id}} {{did-insert this.onInsert}} {{will-destroy this.onRemove}} ...attributes>\n <FlightIcon class=\"hds-form-error__icon\" @name=\"alert-diamond-fill\" />\n <Hds::Text::Body class=\"hds-form-error__content\" @tag=\"div\" @size=\"100\" @weight=\"medium\">\n {{yield (hash Message=(component \"hds/form/error/message\"))}}\n </Hds::Text::Body>\n</div>");
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/form/error/index.hbs","../../../../../src/components/hds/form/error/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<div class={{this.classNames}} id={{this.id}} {{did-insert this.onInsert}} {{will-destroy this.onRemove}} ...attributes>\\n <FlightIcon class=\\\"hds-form-error__icon\\\" @name=\\\"alert-diamond-fill\\\" />\\n <Hds::Text::Body class=\\\"hds-form-error__content\\\" @tag=\\\"div\\\" @size=\\\"100\\\" @weight=\\\"medium\\\">\\n {{yield (hash Message=(component \\\"hds/form/error/message\\\"))}}\\n </Hds::Text::Body>\\n</div
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/form/error/index.hbs","../../../../../src/components/hds/form/error/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<div class={{this.classNames}} id={{this.id}} {{did-insert this.onInsert}} {{will-destroy this.onRemove}} ...attributes>\\n <FlightIcon class=\\\"hds-form-error__icon\\\" @name=\\\"alert-diamond-fill\\\" />\\n <Hds::Text::Body class=\\\"hds-form-error__content\\\" @tag=\\\"div\\\" @size=\\\"100\\\" @weight=\\\"medium\\\">\\n {{yield (hash Message=(component \\\"hds/form/error/message\\\"))}}\\n </Hds::Text::Body>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nexport const ID_PREFIX = 'error-';\n\nconst NOOP = () => {};\n\nexport default class HdsFormErrorIndexComponent extends Component {\n /**\n * Determines the unique ID to assign to the element\n * @method id\n * @return {(string|null)} The \"id\" attribute to apply to the element or null, if no controlId is provided\n */\n get id() {\n let { controlId } = this.args;\n if (controlId) {\n return `${ID_PREFIX}${controlId}`;\n }\n return null;\n }\n\n /**\n * @param onInsert\n * @type {function}\n * @default () => {}\n */\n get onInsert() {\n let { onInsert } = this.args;\n\n // notice: this is a guard used to prevent triggering an error when the component is used as standalone element\n if (typeof onInsert === 'function') {\n return onInsert;\n } else {\n return NOOP;\n }\n }\n\n /**\n * @param onRemove\n * @type {function}\n * @default () => {}\n */\n get onRemove() {\n let { onRemove } = this.args;\n\n // notice: this is a guard used to prevent triggering an error when the component is used as standalone element\n if (typeof onRemove === 'function') {\n return onRemove;\n } else {\n return NOOP;\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-error'];\n\n // add a class based on the @contextualClass argument\n // notice: this will *not* be documented for public use\n // the reason for this is that the contextual component declarations don't pass attributes to the component\n if (this.args.contextualClass) {\n classes.push(this.args.contextualClass);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["ID_PREFIX","NOOP","HdsFormErrorIndexComponent","Component","id","controlId","args","onInsert","onRemove","classNames","classes","contextualClass","push","join","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,ugBAAugB;;ACDziB;AACA;AACA;AACA;;AAGO,MAAMA,SAAS,GAAG,SAAQ;AAEjC,MAAMC,IAAI,GAAGA,MAAM,EAAE,CAAA;AAEN,MAAMC,0BAA0B,SAASC,SAAS,CAAC;AAChE;AACF;AACA;AACA;AACA;EACE,IAAIC,EAAEA,GAAG;IACP,IAAI;AAAEC,MAAAA,SAAAA;KAAW,GAAG,IAAI,CAACC,IAAI,CAAA;AAC7B,IAAA,IAAID,SAAS,EAAE;AACb,MAAA,OAAO,CAAGL,EAAAA,SAAS,CAAGK,EAAAA,SAAS,CAAE,CAAA,CAAA;AACnC,KAAA;AACA,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIE,QAAQA,GAAG;IACb,IAAI;AAAEA,MAAAA,QAAAA;KAAU,GAAG,IAAI,CAACD,IAAI,CAAA;;AAE5B;AACA,IAAA,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;AAClC,MAAA,OAAOA,QAAQ,CAAA;AACjB,KAAC,MAAM;AACL,MAAA,OAAON,IAAI,CAAA;AACb,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIO,QAAQA,GAAG;IACb,IAAI;AAAEA,MAAAA,QAAAA;KAAU,GAAG,IAAI,CAACF,IAAI,CAAA;;AAE5B;AACA,IAAA,IAAI,OAAOE,QAAQ,KAAK,UAAU,EAAE;AAClC,MAAA,OAAOA,QAAQ,CAAA;AACjB,KAAC,MAAM;AACL,MAAA,OAAOP,IAAI,CAAA;AACb,KAAA;AACF,GAAA;AACA;AACF;AACA;AACA;AACA;EACE,IAAIQ,UAAUA,GAAG;AACf,IAAA,IAAIC,OAAO,GAAG,CAAC,gBAAgB,CAAC,CAAA;;AAEhC;AACA;AACA;AACA,IAAA,IAAI,IAAI,CAACJ,IAAI,CAACK,eAAe,EAAE;MAC7BD,OAAO,CAACE,IAAI,CAAC,IAAI,CAACN,IAAI,CAACK,eAAe,CAAC,CAAA;AACzC,KAAA;AAEA,IAAA,OAAOD,OAAO,CAACG,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EA9DoBb,0BAA0B,CAAA;;;;"}
|
|
@@ -8,7 +8,7 @@ import { precompileTemplate } from '@ember/template-compilation';
|
|
|
8
8
|
import { c } from 'decorator-transforms/runtime';
|
|
9
9
|
import { setComponentTemplate } from '@ember/component';
|
|
10
10
|
|
|
11
|
-
var TEMPLATE = 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}} ...attributes>\n {{yield\n (hash\n Label=(component\n \"hds/form/label\"\n controlId=this.id\n isRequired=this.isRequired\n isOptional=this.isOptional\n contextualClass=\"hds-form-field__label\"\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-field__helper-text\"\n )\n )\n }}\n <div class=\"hds-form-field__control\">\n {{yield (hash Control=(component \"hds/yield\") id=this.id ariaDescribedBy=this.ariaDescribedBy)}}\n </div>\n {{yield\n (hash\n CharacterCount=(component\n \"hds/form/character-count\"\n controlId=this.id\n onInsert=this.appendDescriptor\n contextualClass=\"hds-form-field__character-count\"\n )\n )\n }}\n {{yield\n (hash\n Error=(component\n \"hds/form/error\"\n controlId=this.id\n onInsert=this.appendDescriptor\n onRemove=this.removeDescriptor\n contextualClass=\"hds-form-field__error\"\n )\n )\n }}\n</div
|
|
11
|
+
var TEMPLATE = 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}} ...attributes>\n {{yield\n (hash\n Label=(component\n \"hds/form/label\"\n controlId=this.id\n isRequired=this.isRequired\n isOptional=this.isOptional\n contextualClass=\"hds-form-field__label\"\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-field__helper-text\"\n )\n )\n }}\n <div class=\"hds-form-field__control\">\n {{yield (hash Control=(component \"hds/yield\") id=this.id ariaDescribedBy=this.ariaDescribedBy)}}\n </div>\n {{yield\n (hash\n CharacterCount=(component\n \"hds/form/character-count\"\n controlId=this.id\n onInsert=this.appendDescriptor\n contextualClass=\"hds-form-field__character-count\"\n )\n )\n }}\n {{yield\n (hash\n Error=(component\n \"hds/form/error\"\n controlId=this.id\n onInsert=this.appendDescriptor\n onRemove=this.removeDescriptor\n contextualClass=\"hds-form-field__error\"\n )\n )\n }}\n</div>");
|
|
12
12
|
|
|
13
13
|
var _class;
|
|
14
14
|
const LAYOUT_TYPES = ['vertical', 'flag'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/form/field/index.hbs","../../../../../src/components/hds/form/field/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<div class={{this.classNames}} ...attributes>\\n {{yield\\n (hash\\n Label=(component\\n \\\"hds/form/label\\\"\\n controlId=this.id\\n isRequired=this.isRequired\\n isOptional=this.isOptional\\n contextualClass=\\\"hds-form-field__label\\\"\\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-field__helper-text\\\"\\n )\\n )\\n }}\\n <div class=\\\"hds-form-field__control\\\">\\n {{yield (hash Control=(component \\\"hds/yield\\\") id=this.id ariaDescribedBy=this.ariaDescribedBy)}}\\n </div>\\n {{yield\\n (hash\\n CharacterCount=(component\\n \\\"hds/form/character-count\\\"\\n controlId=this.id\\n onInsert=this.appendDescriptor\\n contextualClass=\\\"hds-form-field__character-count\\\"\\n )\\n )\\n }}\\n {{yield\\n (hash\\n Error=(component\\n \\\"hds/form/error\\\"\\n controlId=this.id\\n onInsert=this.appendDescriptor\\n onRemove=this.removeDescriptor\\n contextualClass=\\\"hds-form-field__error\\\"\\n )\\n )\\n }}\\n</div
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/hds/form/field/index.hbs","../../../../../src/components/hds/form/field/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<div class={{this.classNames}} ...attributes>\\n {{yield\\n (hash\\n Label=(component\\n \\\"hds/form/label\\\"\\n controlId=this.id\\n isRequired=this.isRequired\\n isOptional=this.isOptional\\n contextualClass=\\\"hds-form-field__label\\\"\\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-field__helper-text\\\"\\n )\\n )\\n }}\\n <div class=\\\"hds-form-field__control\\\">\\n {{yield (hash Control=(component \\\"hds/yield\\\") id=this.id ariaDescribedBy=this.ariaDescribedBy)}}\\n </div>\\n {{yield\\n (hash\\n CharacterCount=(component\\n \\\"hds/form/character-count\\\"\\n controlId=this.id\\n onInsert=this.appendDescriptor\\n contextualClass=\\\"hds-form-field__character-count\\\"\\n )\\n )\\n }}\\n {{yield\\n (hash\\n Error=(component\\n \\\"hds/form/error\\\"\\n controlId=this.id\\n onInsert=this.appendDescriptor\\n onRemove=this.removeDescriptor\\n contextualClass=\\\"hds-form-field__error\\\"\\n )\\n )\\n }}\\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';\nimport { action } from '@ember/object';\nimport { getElementId } from '../../../../utils/hds-get-element-id.js';\nimport {\n ariaDescribedBy,\n registerAriaDescriptionElement,\n unregisterAriaDescriptionElement,\n} from '../../../../utils/hds-aria-described-by.ts';\n\nexport const LAYOUT_TYPES = ['vertical', 'flag'];\n\n@ariaDescribedBy\nclass HdsFormFieldIndexComponent extends Component {\n @action\n appendDescriptor(element) {\n registerAriaDescriptionElement(this, element);\n }\n\n @action removeDescriptor(element) {\n unregisterAriaDescriptionElement(this, element);\n }\n\n /**\n * Sets the layout of the field\n *\n * @param layout\n * @type {string}\n */\n get layout() {\n let { layout } = this.args;\n\n assert(\n `@layout for \"Hds::Form::Field\" must be one of the following: ${LAYOUT_TYPES.join(\n ', '\n )}; received: ${layout}`,\n LAYOUT_TYPES.includes(layout)\n );\n\n return layout;\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 * 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 = [];\n\n if (this.args.layout) {\n classes.push(`hds-form-field--layout-${this.layout}`);\n }\n\n // add a class based on the @contextualClass argument\n // notice: this will *not* be documented for public use\n if (this.args.contextualClass) {\n classes.push(this.args.contextualClass);\n }\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\nexport default HdsFormFieldIndexComponent;\n"],"names":["LAYOUT_TYPES","HdsFormFieldIndexComponent","c","_class","Component","appendDescriptor","element","registerAriaDescriptionElement","removeDescriptor","unregisterAriaDescriptionElement","layout","args","assert","join","includes","id","getElementId","classNames","classes","push","contextualClass","isRequired","isOptional","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","ariaDescribedBy","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,yxCAAyxC;;;MCc9yCA,YAAY,GAAG,CAAC,UAAU,EAAE,MAAM,EAAC;AAAC,MAG3CC,0BAA0B,GAAAC,CAAA,EAAAC,MAAA,GAA1BF,MAAAA,0BAA0B,SAASG,SAAS,CAAC;EAEjDC,gBAAgBA,CAACC,OAAO,EAAE;AACxBC,IAAAA,8BAA8B,CAAC,IAAI,EAAED,OAAO,CAAC,CAAA;AAC/C,GAAA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CAACX,IAAI,CAACW,UAAU,IAAI,KAAK,CAAA;AACtC,GAAA;AACF,CAAC,GAAAC,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,uBAzEEC,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAxB,MAAA,CAAAqB,SAAA,EAAArB,kBAAAA,CAAAA,EAAAA,MAAA,CAAAqB,SAAA,CAAA,EAAAD,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,EAAA,kBAAA,EAAA,CAKNC,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAxB,MAAA,CAAAqB,SAAA,uBAAArB,MAAA,CAAAqB,SAAA,CAAArB,GAAAA,MAAA,IAPRyB,eAAe,CAAA,CAAA,CAAA;AA6EhB,YAAAC,oBAAA,CAAAC,QAAA,EAAe7B,0BAA0B,CAAA;;;;"}
|
|
@@ -7,7 +7,7 @@ import { c } from 'decorator-transforms/runtime';
|
|
|
7
7
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
8
8
|
import { setComponentTemplate } from '@ember/component';
|
|
9
9
|
|
|
10
|
-
var TEMPLATE = 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}} ...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\"
|
|
10
|
+
var TEMPLATE = 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}} ...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\"\n controlId=this.id\n onInsert=this.appendDescriptor\n onRemove=this.removeDescriptor\n contextualClass=\"hds-form-group__error\"\n )\n )\n }}\n</fieldset>");
|
|
11
11
|
|
|
12
12
|
var _class;
|
|
13
13
|
const HdsFormFieldsetIndexComponent = c((_class = class HdsFormFieldsetIndexComponent extends Component {
|