@hashicorp/design-system-components 4.7.0 → 4.8.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/alert/index.d.ts +1 -1
- package/declarations/components/hds/alert/index.d.ts.map +1 -1
- package/declarations/components/hds/app-header/home-link.d.ts +19 -0
- package/declarations/components/hds/app-header/home-link.d.ts.map +1 -0
- package/declarations/components/hds/app-header/index.d.ts +32 -0
- package/declarations/components/hds/app-header/index.d.ts.map +1 -0
- package/declarations/components/hds/app-header/menu-button.d.ts +19 -0
- package/declarations/components/hds/app-header/menu-button.d.ts.map +1 -0
- package/declarations/components/hds/application-state/footer.d.ts +7 -17
- package/declarations/components/hds/application-state/footer.d.ts.map +1 -1
- package/declarations/components/hds/application-state/header.d.ts +6 -3
- package/declarations/components/hds/application-state/header.d.ts.map +1 -1
- package/declarations/components/hds/application-state/index.d.ts +12 -3
- package/declarations/components/hds/application-state/index.d.ts.map +1 -1
- package/declarations/components/hds/application-state/media.d.ts +14 -0
- package/declarations/components/hds/application-state/media.d.ts.map +1 -0
- package/declarations/components/hds/application-state/types.d.ts +6 -0
- package/declarations/components/hds/application-state/types.d.ts.map +1 -0
- package/declarations/components/hds/badge-count/index.d.ts +1 -2
- package/declarations/components/hds/badge-count/index.d.ts.map +1 -1
- package/declarations/components/hds/breadcrumb/index.d.ts +18 -4
- package/declarations/components/hds/breadcrumb/index.d.ts.map +1 -1
- package/declarations/components/hds/breadcrumb/item.d.ts +26 -5
- package/declarations/components/hds/breadcrumb/item.d.ts.map +1 -1
- package/declarations/components/hds/breadcrumb/truncation.d.ts +15 -3
- package/declarations/components/hds/breadcrumb/truncation.d.ts.map +1 -1
- package/declarations/components/hds/copy/snippet/index.d.ts +1 -2
- package/declarations/components/hds/copy/snippet/index.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/footer.d.ts +16 -1
- package/declarations/components/hds/dropdown/footer.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/header.d.ts +16 -1
- package/declarations/components/hds/dropdown/header.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/index.d.ts +56 -7
- package/declarations/components/hds/dropdown/index.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/checkbox.d.ts +18 -3
- package/declarations/components/hds/dropdown/list-item/checkbox.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/checkmark.d.ts +19 -3
- package/declarations/components/hds/dropdown/list-item/checkmark.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/copy-item.d.ts +17 -5
- package/declarations/components/hds/dropdown/list-item/copy-item.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/description.d.ts +13 -3
- package/declarations/components/hds/dropdown/list-item/description.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/generic.d.ts +13 -1
- package/declarations/components/hds/dropdown/list-item/generic.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/interactive.d.ts +23 -6
- package/declarations/components/hds/dropdown/list-item/interactive.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/radio.d.ts +18 -3
- package/declarations/components/hds/dropdown/list-item/radio.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/separator.d.ts +10 -1
- package/declarations/components/hds/dropdown/list-item/separator.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/title.d.ts +13 -3
- package/declarations/components/hds/dropdown/list-item/title.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/list-item/types.d.ts +10 -0
- package/declarations/components/hds/dropdown/list-item/types.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/toggle/button.d.ts +34 -11
- package/declarations/components/hds/dropdown/toggle/button.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/toggle/chevron.d.ts +9 -1
- package/declarations/components/hds/dropdown/toggle/chevron.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/toggle/icon.d.ts +27 -8
- package/declarations/components/hds/dropdown/toggle/icon.d.ts.map +1 -1
- package/declarations/components/hds/dropdown/toggle/types.d.ts +20 -0
- package/declarations/components/hds/dropdown/toggle/types.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/types.d.ts +12 -0
- package/declarations/components/hds/dropdown/types.d.ts.map +1 -0
- package/declarations/components/hds/flyout/index.d.ts.map +1 -1
- package/declarations/components/hds/flyout/types.d.ts +4 -0
- package/declarations/components/hds/flyout/types.d.ts.map +1 -1
- package/declarations/components/hds/form/checkbox/base.d.ts +1 -1
- package/declarations/components/hds/form/checkbox/base.d.ts.map +1 -1
- package/declarations/components/hds/icon-tile/index.d.ts +1 -1
- package/declarations/components/hds/icon-tile/index.d.ts.map +1 -1
- package/declarations/components/hds/link/standalone.d.ts +1 -1
- package/declarations/components/hds/link/standalone.d.ts.map +1 -1
- package/declarations/components/hds/menu-primitive/index.d.ts +32 -9
- package/declarations/components/hds/menu-primitive/index.d.ts.map +1 -1
- package/declarations/components/hds/modal/index.d.ts.map +1 -1
- package/declarations/components/hds/popover-primitive/index.d.ts.map +1 -1
- package/declarations/components/hds/segmented-group/index.d.ts +27 -1
- package/declarations/components/hds/segmented-group/index.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/index.d.ts +1 -0
- package/declarations/components/hds/side-nav/index.d.ts.map +1 -1
- package/declarations/components.d.ts +11 -1
- package/declarations/components.d.ts.map +1 -1
- package/declarations/modifiers/hds-tooltip.d.ts +24 -8
- package/declarations/modifiers/hds-tooltip.d.ts.map +1 -1
- package/declarations/template-registry.d.ts +74 -0
- package/declarations/template-registry.d.ts.map +1 -1
- package/dist/_app_/components/hds/app-header/home-link.js +1 -0
- package/dist/_app_/components/hds/app-header/index.js +1 -0
- package/dist/_app_/components/hds/app-header/menu-button.js +1 -0
- package/dist/_app_/components/hds/application-state/media.js +1 -0
- package/dist/components/hds/alert/index.js.map +1 -1
- package/dist/components/hds/app-header/home-link.js +25 -0
- package/dist/components/hds/app-header/home-link.js.map +1 -0
- package/dist/components/hds/app-header/index.js +88 -0
- package/dist/components/hds/app-header/index.js.map +1 -0
- package/dist/components/hds/app-header/menu-button.js +26 -0
- package/dist/components/hds/app-header/menu-button.js.map +1 -0
- package/dist/components/hds/application-state/footer.js +5 -31
- package/dist/components/hds/application-state/footer.js.map +1 -1
- package/dist/components/hds/application-state/header.js +9 -5
- package/dist/components/hds/application-state/header.js.map +1 -1
- package/dist/components/hds/application-state/index.js +21 -5
- package/dist/components/hds/application-state/index.js.map +1 -1
- package/dist/components/hds/application-state/media.js +16 -0
- package/dist/components/hds/application-state/media.js.map +1 -0
- package/dist/components/hds/application-state/types.js +8 -0
- package/dist/components/hds/application-state/types.js.map +1 -0
- package/dist/components/hds/badge-count/index.js.map +1 -1
- package/dist/components/hds/breadcrumb/index.js +3 -3
- package/dist/components/hds/breadcrumb/index.js.map +1 -1
- package/dist/components/hds/breadcrumb/item.js +3 -3
- package/dist/components/hds/breadcrumb/item.js.map +1 -1
- package/dist/components/hds/breadcrumb/truncation.js +1 -1
- package/dist/components/hds/breadcrumb/truncation.js.map +1 -1
- package/dist/components/hds/copy/snippet/index.js.map +1 -1
- package/dist/components/hds/dialog-primitive/header.js.map +1 -1
- package/dist/components/hds/dropdown/footer.js +8 -2
- package/dist/components/hds/dropdown/footer.js.map +1 -1
- package/dist/components/hds/dropdown/header.js +8 -2
- package/dist/components/hds/dropdown/header.js.map +1 -1
- package/dist/components/hds/dropdown/index.js +13 -10
- package/dist/components/hds/dropdown/index.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/checkbox.js +1 -1
- package/dist/components/hds/dropdown/list-item/checkbox.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/checkmark.js +2 -2
- package/dist/components/hds/dropdown/list-item/checkmark.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/copy-item.js +4 -4
- package/dist/components/hds/dropdown/list-item/copy-item.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/description.js +2 -2
- package/dist/components/hds/dropdown/list-item/description.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/generic.js +8 -2
- package/dist/components/hds/dropdown/list-item/generic.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/interactive.js +7 -6
- package/dist/components/hds/dropdown/list-item/interactive.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/radio.js +1 -1
- package/dist/components/hds/dropdown/list-item/radio.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/separator.js +8 -2
- package/dist/components/hds/dropdown/list-item/separator.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/title.js +2 -2
- package/dist/components/hds/dropdown/list-item/title.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/types.js +13 -0
- package/dist/components/hds/dropdown/list-item/types.js.map +1 -0
- package/dist/components/hds/dropdown/toggle/button.js +11 -10
- package/dist/components/hds/dropdown/toggle/button.js.map +1 -1
- package/dist/components/hds/dropdown/toggle/chevron.js +8 -2
- package/dist/components/hds/dropdown/toggle/chevron.js.map +1 -1
- package/dist/components/hds/dropdown/toggle/icon.js +10 -9
- package/dist/components/hds/dropdown/toggle/icon.js.map +1 -1
- package/dist/components/hds/dropdown/toggle/types.js +23 -0
- package/dist/components/hds/dropdown/toggle/types.js.map +1 -0
- package/dist/components/hds/dropdown/types.js +15 -0
- package/dist/components/hds/dropdown/types.js.map +1 -0
- package/dist/components/hds/flyout/index.js.map +1 -1
- package/dist/components/hds/flyout/types.js +5 -0
- package/dist/components/hds/flyout/types.js.map +1 -1
- package/dist/components/hds/form/checkbox/base.js.map +1 -1
- package/dist/components/hds/icon-tile/index.js.map +1 -1
- package/dist/components/hds/link/standalone.js.map +1 -1
- package/dist/components/hds/menu-primitive/index.js +13 -7
- package/dist/components/hds/menu-primitive/index.js.map +1 -1
- package/dist/components/hds/modal/index.js.map +1 -1
- package/dist/components/hds/popover-primitive/index.js.map +1 -1
- package/dist/components/hds/segmented-group/index.js +8 -2
- package/dist/components/hds/segmented-group/index.js.map +1 -1
- package/dist/components/hds/side-nav/base.js +1 -1
- package/dist/components/hds/side-nav/base.js.map +1 -1
- package/dist/components/hds/side-nav/header/index.js +1 -1
- package/dist/components/hds/side-nav/header/index.js.map +1 -1
- package/dist/components/hds/side-nav/index.js +6 -1
- package/dist/components/hds/side-nav/index.js.map +1 -1
- package/dist/components.js +10 -0
- package/dist/components.js.map +1 -1
- package/dist/modifiers/hds-tooltip.js +42 -27
- package/dist/modifiers/hds-tooltip.js.map +1 -1
- package/dist/styles/@hashicorp/design-system-components.css +674 -58
- package/dist/styles/@hashicorp/design-system-components.scss +1 -0
- package/dist/styles/components/app-frame.scss +13 -0
- package/dist/styles/components/app-header.scss +106 -0
- package/dist/styles/components/application-state.scss +56 -15
- package/dist/styles/components/side-nav/header.scss +13 -41
- package/dist/styles/components/side-nav/main.scss +29 -1
- package/dist/styles/components/side-nav/toggle-button.scss +6 -1
- package/dist/styles/mixins/_interactive-dark-theme.scss +106 -0
- package/package.json +7 -2
|
@@ -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 * @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,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAwC;IAC9C,IAAIA,IAAyC,GAAGf,YAAY,CAAA;AAC5D,IAAA,IA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,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;;;;"}
|
|
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\nexport interface 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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f,MAAM,GAAGb,cAAc,CAAA;KAC7B,EAAE,IAAI,CAAC,CAAA;AACV,GAAA;AACF,CAAC,GAAAO,WAAA,GAAAsB,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;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.js","sources":["../../../../src/components/hds/dialog-primitive/header.hbs","../../../../src/components/hds/dialog-primitive/header.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\\n class=\\\"hds-dialog-primitive__header {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__header\\')}}\\\"\\n ...attributes\\n>\\n {{#if @icon}}\\n <FlightIcon\\n class=\\\"hds-dialog-primitive__icon {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__icon\\')}}\\\"\\n @name={{@icon}}\\n @size=\\\"24\\\"\\n @isInlineBlock={{false}}\\n />\\n {{/if}}\\n\\n <div\\n class=\\\"hds-dialog-primitive__title {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__title\\')}}\\\"\\n id={{@id}}\\n >\\n {{#if @tagline}}\\n <Hds::Text::Body\\n class=\\\"hds-dialog-primitive__tagline {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__tagline\\')}}\\\"\\n @tag=\\\"div\\\"\\n @size=\\\"100\\\"\\n >\\n {{@tagline}}\\n </Hds::Text::Body>\\n {{/if}}\\n\\n <Hds::Text::Display @tag=\\\"div\\\" @size=\\\"300\\\" @weight=\\\"semibold\\\">\\n {{yield}}\\n </Hds::Text::Display>\\n </div>\\n\\n <Hds::DismissButton\\n class=\\\"hds-dialog-primitive__dismiss {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__dismiss\\')}}\\\"\\n {{on \\\"click\\\" this.onDismiss}}\\n />\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport interface HdsDialogPrimitiveHeaderSignature {\n Args: {\n contextualClassPrefix?: string;\n id?: string;\n tagline?: string;\n icon?: FlightIconSignature['Args']['name'];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onDismiss?: (event: MouseEvent, ...args: any[]) => void;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\n\nconst NOOP = () => {};\n\nexport default class HdsDialogPrimitiveHeaderComponent extends Component<HdsDialogPrimitiveHeaderSignature> {\n /**\n * @param onDismiss\n * @type {function}\n * @default () => {}\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get onDismiss(): (event: MouseEvent, ...args: any[]) => void {\n const { onDismiss } = this.args;\n\n // notice: this is a guard used in case the button is used as standalone element (eg. in the showcase)\n // in reality it's always used inside the main components as a yielded component, so the onDismiss handler is always defined\n if (typeof onDismiss === 'function') {\n return onDismiss;\n } else {\n return NOOP;\n }\n }\n}\n"],"names":["NOOP","HdsDialogPrimitiveHeaderComponent","Component","onDismiss","args","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,2sCAA2sC;;ACD7uC;AACA;AACA;AACA;;AAoBA,MAAMA,IAAI,GAAGA,
|
|
1
|
+
{"version":3,"file":"header.js","sources":["../../../../src/components/hds/dialog-primitive/header.hbs","../../../../src/components/hds/dialog-primitive/header.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\\n class=\\\"hds-dialog-primitive__header {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__header\\')}}\\\"\\n ...attributes\\n>\\n {{#if @icon}}\\n <FlightIcon\\n class=\\\"hds-dialog-primitive__icon {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__icon\\')}}\\\"\\n @name={{@icon}}\\n @size=\\\"24\\\"\\n @isInlineBlock={{false}}\\n />\\n {{/if}}\\n\\n <div\\n class=\\\"hds-dialog-primitive__title {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__title\\')}}\\\"\\n id={{@id}}\\n >\\n {{#if @tagline}}\\n <Hds::Text::Body\\n class=\\\"hds-dialog-primitive__tagline {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__tagline\\')}}\\\"\\n @tag=\\\"div\\\"\\n @size=\\\"100\\\"\\n >\\n {{@tagline}}\\n </Hds::Text::Body>\\n {{/if}}\\n\\n <Hds::Text::Display @tag=\\\"div\\\" @size=\\\"300\\\" @weight=\\\"semibold\\\">\\n {{yield}}\\n </Hds::Text::Display>\\n </div>\\n\\n <Hds::DismissButton\\n class=\\\"hds-dialog-primitive__dismiss {{if @contextualClassPrefix (concat @contextualClassPrefix \\'__dismiss\\')}}\\\"\\n {{on \\\"click\\\" this.onDismiss}}\\n />\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport interface HdsDialogPrimitiveHeaderSignature {\n Args: {\n contextualClassPrefix?: string;\n id?: string;\n tagline?: string;\n icon?: FlightIconSignature['Args']['name'];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onDismiss?: (event: MouseEvent, ...args: any[]) => void;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\n\nconst NOOP = (): void => {};\n\nexport default class HdsDialogPrimitiveHeaderComponent extends Component<HdsDialogPrimitiveHeaderSignature> {\n /**\n * @param onDismiss\n * @type {function}\n * @default () => {}\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get onDismiss(): (event: MouseEvent, ...args: any[]) => void {\n const { onDismiss } = this.args;\n\n // notice: this is a guard used in case the button is used as standalone element (eg. in the showcase)\n // in reality it's always used inside the main components as a yielded component, so the onDismiss handler is always defined\n if (typeof onDismiss === 'function') {\n return onDismiss;\n } else {\n return NOOP;\n }\n }\n}\n"],"names":["NOOP","HdsDialogPrimitiveHeaderComponent","Component","onDismiss","args","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,2sCAA2sC;;ACD7uC;AACA;AACA;AACA;;AAoBA,MAAMA,IAAI,GAAGA,MAAY,EAAE,CAAA;AAEZ,MAAMC,iCAAiC,SAASC,SAAS,CAAoC;AAC1G;AACF;AACA;AACA;AACA;AACE;EACA,IAAIC,SAASA,GAAgD;IAC3D,MAAM;AAAEA,MAAAA,SAAAA;KAAW,GAAG,IAAI,CAACC,IAAI,CAAA;;AAE/B;AACA;AACA,IAAA,IAAI,OAAOD,SAAS,KAAK,UAAU,EAAE;AACnC,MAAA,OAAOA,SAAS,CAAA;AAClB,KAAC,MAAM;AACL,MAAA,OAAOH,IAAI,CAAA;AACb,KAAA;AACF,GAAA;AACF,CAAA;AAACK,oBAAA,CAAAC,QAAA,EAlBoBL,iCAAiC,CAAA;;;;"}
|
|
@@ -2,9 +2,15 @@ import templateOnlyComponent from '@ember/component/template-only';
|
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
5
|
-
var TEMPLATE = precompileTemplate("{{
|
|
5
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class=\"hds-dropdown__footer {{if @hasDivider \'hds-dropdown__footer--with-divider\'}}\" ...attributes>\n {{yield}}\n</div>");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) HashiCorp, Inc.
|
|
9
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const HdsDropdownFooterComponent = templateOnlyComponent();
|
|
13
|
+
var footer = setComponentTemplate(TEMPLATE, HdsDropdownFooterComponent);
|
|
8
14
|
|
|
9
15
|
export { footer as default };
|
|
10
16
|
//# sourceMappingURL=footer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sources":["../../../../src/components/hds/dropdown/footer.hbs","../../../../src/components/hds/dropdown/footer.
|
|
1
|
+
{"version":3,"file":"footer.js","sources":["../../../../src/components/hds/dropdown/footer.hbs","../../../../src/components/hds/dropdown/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<div class=\\\"hds-dropdown__footer {{if @hasDivider \\'hds-dropdown__footer--with-divider\\'}}\\\" ...attributes>\\n {{yield}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport templateOnlyComponent from '@ember/component/template-only';\n\nexport interface HdsDropdownFooterSignature {\n Args: {\n hasDivider: boolean;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\n\nconst HdsDropdownFooterComponent =\n templateOnlyComponent<HdsDropdownFooterSignature>();\n\nexport default HdsDropdownFooterComponent;\n"],"names":["HdsDropdownFooterComponent","templateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,iNAAiN;;ACDnP;AACA;AACA;AACA;;AAcA,MAAMA,0BAA0B,GAC9BC,qBAAqB,EAA8B,CAAA;AAErD,aAAAC,oBAAA,CAAAC,QAAA,EAAeH,0BAA0B,CAAA;;;;"}
|
|
@@ -2,9 +2,15 @@ import templateOnlyComponent from '@ember/component/template-only';
|
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
5
|
-
var TEMPLATE = precompileTemplate("{{
|
|
5
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class=\"hds-dropdown__header {{if @hasDivider \'hds-dropdown__header--with-divider\'}}\" ...attributes>\n {{yield}}\n</div>");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) HashiCorp, Inc.
|
|
9
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const HdsDropdownHeaderComponent = templateOnlyComponent();
|
|
13
|
+
var header = setComponentTemplate(TEMPLATE, HdsDropdownHeaderComponent);
|
|
8
14
|
|
|
9
15
|
export { header as default };
|
|
10
16
|
//# sourceMappingURL=header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.js","sources":["../../../../src/components/hds/dropdown/header.hbs","../../../../src/components/hds/dropdown/header.
|
|
1
|
+
{"version":3,"file":"header.js","sources":["../../../../src/components/hds/dropdown/header.hbs","../../../../src/components/hds/dropdown/header.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-dropdown__header {{if @hasDivider \\'hds-dropdown__header--with-divider\\'}}\\\" ...attributes>\\n {{yield}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport templateOnlyComponent from '@ember/component/template-only';\n\nexport interface HdsDropdownHeaderSignature {\n Args: {\n hasDivider: boolean;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLDivElement;\n}\n\nconst HdsDropdownHeaderComponent =\n templateOnlyComponent<HdsDropdownHeaderSignature>();\n\nexport default HdsDropdownHeaderComponent;\n"],"names":["HdsDropdownHeaderComponent","templateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,iNAAiN;;ACDnP;AACA;AACA;AACA;;AAcA,MAAMA,0BAA0B,GAC9BC,qBAAqB,EAA8B,CAAA;AAErD,aAAAC,oBAAA,CAAAC,QAAA,EAAeH,0BAA0B,CAAA;;;;"}
|
|
@@ -2,15 +2,16 @@ import { _ as _applyDecoratedDescriptor } from '../../../_rollupPluginBabelHelpe
|
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
4
|
import { assert } from '@ember/debug';
|
|
5
|
+
import { HdsDropdownPositionValues } from './types.js';
|
|
5
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
7
|
import { setComponentTemplate } from '@ember/component';
|
|
7
8
|
|
|
8
|
-
var TEMPLATE = precompileTemplate("{{
|
|
9
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::MenuPrimitive class={{this.classNames}} @onClose={{@onClose}} ...attributes>\n <:toggle as |t|>\n {{yield\n (hash\n ToggleButton=(component \"hds/dropdown/toggle/button\" isOpen=t.isOpen onClick=t.onClickToggle)\n ToggleIcon=(component \"hds/dropdown/toggle/icon\" isOpen=t.isOpen onClick=t.onClickToggle)\n )\n }}\n </:toggle>\n <:content as |c|>\n <div class={{this.classNamesContent}} {{style width=@width max-height=@height}}>\n {{yield (hash Header=(component \"hds/dropdown/header\"))}}\n <ul class=\"hds-dropdown__list\" {{did-insert this.didInsertList}}>\n {{yield\n (hash\n close=c.close\n Checkbox=(component \"hds/dropdown/list-item/checkbox\")\n Checkmark=(component \"hds/dropdown/list-item/checkmark\")\n CopyItem=(component \"hds/dropdown/list-item/copy-item\")\n Description=(component \"hds/dropdown/list-item/description\")\n Generic=(component \"hds/dropdown/list-item/generic\")\n Interactive=(component \"hds/dropdown/list-item/interactive\")\n Radio=(component \"hds/dropdown/list-item/radio\")\n Separator=(component \"hds/dropdown/list-item/separator\")\n Title=(component \"hds/dropdown/list-item/title\")\n )\n }}\n </ul>\n {{yield (hash close=c.close Footer=(component \"hds/dropdown/footer\"))}}\n </div>\n </:content>\n</Hds::MenuPrimitive>");
|
|
9
10
|
|
|
10
11
|
var _class;
|
|
11
|
-
const DEFAULT_POSITION =
|
|
12
|
-
const POSITIONS =
|
|
13
|
-
let
|
|
12
|
+
const DEFAULT_POSITION = HdsDropdownPositionValues.BottomRight;
|
|
13
|
+
const POSITIONS = Object.values(HdsDropdownPositionValues);
|
|
14
|
+
let HdsDropdownComponent = (_class = class HdsDropdownComponent extends Component {
|
|
14
15
|
/**
|
|
15
16
|
* @param listPosition
|
|
16
17
|
* @type {string}
|
|
@@ -18,7 +19,7 @@ let HdsDropdownIndexComponent = (_class = class HdsDropdownIndexComponent extend
|
|
|
18
19
|
* @description Determines the position of the "list"
|
|
19
20
|
*/
|
|
20
21
|
get listPosition() {
|
|
21
|
-
|
|
22
|
+
const {
|
|
22
23
|
listPosition = DEFAULT_POSITION
|
|
23
24
|
} = this.args;
|
|
24
25
|
assert(`@listPosition for "Hds::Dropdown::Index" must be one of the following: ${POSITIONS.join(', ')}; received: ${listPosition}`, POSITIONS.includes(listPosition));
|
|
@@ -31,7 +32,7 @@ let HdsDropdownIndexComponent = (_class = class HdsDropdownIndexComponent extend
|
|
|
31
32
|
* @return {string} The "class" attribute to apply to the root element
|
|
32
33
|
*/
|
|
33
34
|
get classNames() {
|
|
34
|
-
|
|
35
|
+
const classes = ['hds-dropdown'];
|
|
35
36
|
|
|
36
37
|
// add a class based on the @isInline argument
|
|
37
38
|
if (this.args.isInline) {
|
|
@@ -46,7 +47,7 @@ let HdsDropdownIndexComponent = (_class = class HdsDropdownIndexComponent extend
|
|
|
46
47
|
* @return {string} The "class" attribute to apply to the disclosed content
|
|
47
48
|
*/
|
|
48
49
|
get classNamesContent() {
|
|
49
|
-
|
|
50
|
+
const classes = ['hds-dropdown__content'];
|
|
50
51
|
|
|
51
52
|
// add a class based on the @listPosition argument
|
|
52
53
|
classes.push(`hds-dropdown__content--position-${this.listPosition}`);
|
|
@@ -62,11 +63,13 @@ let HdsDropdownIndexComponent = (_class = class HdsDropdownIndexComponent extend
|
|
|
62
63
|
if (checkmarkItems.length) {
|
|
63
64
|
const toggleButtonId = element.closest('.hds-dropdown')?.querySelector('.hds-dropdown-toggle-button')?.getAttribute('id');
|
|
64
65
|
element.setAttribute('role', 'listbox');
|
|
65
|
-
|
|
66
|
+
if (toggleButtonId) {
|
|
67
|
+
element.setAttribute('aria-labelledby', toggleButtonId);
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
}, (_applyDecoratedDescriptor(_class.prototype, "didInsertList", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didInsertList"), _class.prototype)), _class);
|
|
69
|
-
setComponentTemplate(TEMPLATE,
|
|
72
|
+
setComponentTemplate(TEMPLATE, HdsDropdownComponent);
|
|
70
73
|
|
|
71
|
-
export { DEFAULT_POSITION, POSITIONS,
|
|
74
|
+
export { DEFAULT_POSITION, POSITIONS, HdsDropdownComponent as default };
|
|
72
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/dropdown/index.hbs","../../../../src/components/hds/dropdown/index.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/dropdown/index.hbs","../../../../src/components/hds/dropdown/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::MenuPrimitive class={{this.classNames}} @onClose={{@onClose}} ...attributes>\\n <:toggle as |t|>\\n {{yield\\n (hash\\n ToggleButton=(component \\\"hds/dropdown/toggle/button\\\" isOpen=t.isOpen onClick=t.onClickToggle)\\n ToggleIcon=(component \\\"hds/dropdown/toggle/icon\\\" isOpen=t.isOpen onClick=t.onClickToggle)\\n )\\n }}\\n </:toggle>\\n <:content as |c|>\\n <div class={{this.classNamesContent}} {{style width=@width max-height=@height}}>\\n {{yield (hash Header=(component \\\"hds/dropdown/header\\\"))}}\\n <ul class=\\\"hds-dropdown__list\\\" {{did-insert this.didInsertList}}>\\n {{yield\\n (hash\\n close=c.close\\n Checkbox=(component \\\"hds/dropdown/list-item/checkbox\\\")\\n Checkmark=(component \\\"hds/dropdown/list-item/checkmark\\\")\\n CopyItem=(component \\\"hds/dropdown/list-item/copy-item\\\")\\n Description=(component \\\"hds/dropdown/list-item/description\\\")\\n Generic=(component \\\"hds/dropdown/list-item/generic\\\")\\n Interactive=(component \\\"hds/dropdown/list-item/interactive\\\")\\n Radio=(component \\\"hds/dropdown/list-item/radio\\\")\\n Separator=(component \\\"hds/dropdown/list-item/separator\\\")\\n Title=(component \\\"hds/dropdown/list-item/title\\\")\\n )\\n }}\\n </ul>\\n {{yield (hash close=c.close Footer=(component \\\"hds/dropdown/footer\\\"))}}\\n </div>\\n </:content>\\n</Hds::MenuPrimitive>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\n\nimport { HdsDropdownPositionValues } from './types.ts';\n\nimport type { ComponentLike } from '@glint/template';\nimport type { MenuPrimitiveSignature } from '../menu-primitive';\nimport type { HdsDropdownFooterSignature } from './footer';\nimport type { HdsDropdownHeaderSignature } from './header';\nimport type { HdsDropdownListItemCheckboxSignature } from './list-item/checkbox';\nimport type { HdsDropdownListItemCheckmarkSignature } from './list-item/checkmark';\nimport type { HdsDropdownListItemCopyItemSignature } from './list-item/copy-item';\nimport type { HdsDropdownListItemDescriptionSignature } from './list-item/description';\nimport type { HdsDropdownListItemGenericSignature } from './list-item/generic';\nimport type { HdsDropdownListItemInteractiveSignature } from './list-item/interactive';\nimport type { HdsDropdownListItemRadioSignature } from './list-item/radio';\nimport type { HdsDropdownListItemSeparatorSignature } from './list-item/separator';\nimport type { HdsDropdownListItemTitleSignature } from './list-item/title';\nimport type { HdsDropdownToggleButtonSignature } from './toggle/button';\nimport type { HdsDropdownToggleIconSignature } from './toggle/icon';\nimport type { HdsDropdownPositions } from './types';\n\nexport const DEFAULT_POSITION = HdsDropdownPositionValues.BottomRight;\nexport const POSITIONS: string[] = Object.values(HdsDropdownPositionValues);\n\nexport interface HdsDropdownSignature {\n Args: MenuPrimitiveSignature['Args'] & {\n height?: string;\n isInline?: boolean;\n listPosition?: HdsDropdownPositions;\n width?: string;\n };\n Blocks: {\n default: [\n {\n Footer?: ComponentLike<HdsDropdownFooterSignature>;\n Header?: ComponentLike<HdsDropdownHeaderSignature>;\n Checkbox?: ComponentLike<HdsDropdownListItemCheckboxSignature>;\n Checkmark?: ComponentLike<HdsDropdownListItemCheckmarkSignature>;\n CopyItem?: ComponentLike<HdsDropdownListItemCopyItemSignature>;\n Description?: ComponentLike<HdsDropdownListItemDescriptionSignature>;\n Generic?: ComponentLike<HdsDropdownListItemGenericSignature>;\n Interactive?: ComponentLike<HdsDropdownListItemInteractiveSignature>;\n Radio?: ComponentLike<HdsDropdownListItemRadioSignature>;\n Separator?: ComponentLike<HdsDropdownListItemSeparatorSignature>;\n Title?: ComponentLike<HdsDropdownListItemTitleSignature>;\n ToggleButton?: ComponentLike<HdsDropdownToggleButtonSignature>;\n ToggleIcon?: ComponentLike<HdsDropdownToggleIconSignature>;\n close?: () => void;\n },\n ];\n };\n Element: MenuPrimitiveSignature['Element'];\n}\n\nexport default class HdsDropdownComponent extends Component<HdsDropdownSignature> {\n /**\n * @param listPosition\n * @type {string}\n * @default bottom-right\n * @description Determines the position of the \"list\"\n */\n get listPosition(): HdsDropdownPositions {\n const { listPosition = DEFAULT_POSITION } = this.args;\n\n assert(\n `@listPosition for \"Hds::Dropdown::Index\" must be one of the following: ${POSITIONS.join(\n ', '\n )}; received: ${listPosition}`,\n POSITIONS.includes(listPosition)\n );\n\n return listPosition;\n }\n\n /**\n * Get the class names to apply to the element\n * @method classNames\n * @return {string} The \"class\" attribute to apply to the root element\n */\n get classNames(): string {\n const classes = ['hds-dropdown'];\n\n // add a class based on the @isInline argument\n if (this.args.isInline) {\n classes.push('hds-dropdown--is-inline');\n }\n\n return classes.join(' ');\n }\n\n /**\n * Get the class names to apply to the content\n * @method classNamesContent\n * @return {string} The \"class\" attribute to apply to the disclosed content\n */\n get classNamesContent(): string {\n const classes = ['hds-dropdown__content'];\n\n // add a class based on the @listPosition argument\n classes.push(`hds-dropdown__content--position-${this.listPosition}`);\n\n // add a class based on the @width argument\n if (this.args.width) {\n classes.push('hds-dropdown__content--fixed-width');\n }\n\n return classes.join(' ');\n }\n\n @action\n didInsertList(element: HTMLUListElement): void {\n const checkmarkItems = element.querySelectorAll(`[role=\"option\"]`);\n if (checkmarkItems.length) {\n const toggleButtonId = element\n .closest('.hds-dropdown')\n ?.querySelector('.hds-dropdown-toggle-button')\n ?.getAttribute('id');\n\n element.setAttribute('role', 'listbox');\n\n if (toggleButtonId) {\n element.setAttribute('aria-labelledby', toggleButtonId);\n }\n }\n }\n}\n"],"names":["DEFAULT_POSITION","HdsDropdownPositionValues","BottomRight","POSITIONS","Object","values","HdsDropdownComponent","_class","Component","listPosition","args","assert","join","includes","classNames","classes","isInline","push","classNamesContent","width","didInsertList","element","checkmarkItems","querySelectorAll","length","toggleButtonId","closest","querySelector","getAttribute","setAttribute","_applyDecoratedDescriptor","prototype","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,qhDAAqhD;;;AC2B1iDA,MAAAA,gBAAgB,GAAGC,yBAAyB,CAACC,YAAW;AAC9D,MAAMC,SAAmB,GAAGC,MAAM,CAACC,MAAM,CAACJ,yBAAyB,EAAC;AAgCtDK,IAAAA,oBAAoB,IAAAC,MAAA,GAA1B,MAAMD,oBAAoB,SAASE,SAAS,CAAuB;AAChF;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,YAAYA,GAAyB;IACvC,MAAM;AAAEA,MAAAA,YAAY,GAAGT,gBAAAA;KAAkB,GAAG,IAAI,CAACU,IAAI,CAAA;AAErDC,IAAAA,MAAM,CACJ,CAA0ER,uEAAAA,EAAAA,SAAS,CAACS,IAAI,CACtF,IACF,CAAC,CAAA,YAAA,EAAeH,YAAY,CAAA,CAAE,EAC9BN,SAAS,CAACU,QAAQ,CAACJ,YAAY,CACjC,CAAC,CAAA;AAED,IAAA,OAAOA,YAAY,CAAA;AACrB,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIK,UAAUA,GAAW;AACvB,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,SAAA,EAAA,eAAA,EAAA,CAhBEC,MAAM,CAAA5B,EAAAA,MAAA,CAAA6B,wBAAA,CAAA1B,MAAA,CAAAwB,SAAA,oBAAAxB,MAAA,CAAAwB,SAAA,CAAA,GAAAxB,MAAA,EAAA;AAvDgC2B,oBAAA,CAAAC,QAAA,EAApB7B,oBAAoB,CAAA;;;;"}
|
|
@@ -3,7 +3,7 @@ import { getElementId } from '../../../../utils/hds-get-element-id.js';
|
|
|
3
3
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
4
|
import { setComponentTemplate } from '@ember/component';
|
|
5
5
|
|
|
6
|
-
var TEMPLATE = precompileTemplate("{{
|
|
6
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<li class=\"hds-dropdown-list-item hds-dropdown-list-item--variant-checkbox\">\n <label class=\"hds-dropdown-list-item__label hds-typography-body-200\" for={{this.id}}>\n <Hds::Form::Checkbox::Base class=\"hds-dropdown-list-item__control\" id={{this.id}} @value={{@value}} ...attributes />\n {{#if @icon}}\n <span class=\"hds-dropdown-list-item__icon\">\n <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />\n </span>\n {{/if}}\n <span class=\"hds-dropdown-list-item__text-content\">{{yield}}</span>\n {{#if @count}}\n <span class=\"hds-dropdown-list-item__count hds-typography-body-100 hds-font-weight-medium\">{{@count}}</span>\n {{/if}}\n </label>\n</li>");
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sources":["../../../../../src/components/hds/dropdown/list-item/checkbox.hbs","../../../../../src/components/hds/dropdown/list-item/checkbox.
|
|
1
|
+
{"version":3,"file":"checkbox.js","sources":["../../../../../src/components/hds/dropdown/list-item/checkbox.hbs","../../../../../src/components/hds/dropdown/list-item/checkbox.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<li class=\\\"hds-dropdown-list-item hds-dropdown-list-item--variant-checkbox\\\">\\n <label class=\\\"hds-dropdown-list-item__label hds-typography-body-200\\\" for={{this.id}}>\\n <Hds::Form::Checkbox::Base class=\\\"hds-dropdown-list-item__control\\\" id={{this.id}} @value={{@value}} ...attributes />\\n {{#if @icon}}\\n <span class=\\\"hds-dropdown-list-item__icon\\\">\\n <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />\\n </span>\\n {{/if}}\\n <span class=\\\"hds-dropdown-list-item__text-content\\\">{{yield}}</span>\\n {{#if @count}}\\n <span class=\\\"hds-dropdown-list-item__count hds-typography-body-100 hds-font-weight-medium\\\">{{@count}}</span>\\n {{/if}}\\n </label>\\n</li>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { getElementId } from '../../../../utils/hds-get-element-id.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\nimport type { HdsFormCheckboxBaseSignature } from '../../form/checkbox/base.ts';\n\nexport interface HdsDropdownListItemCheckboxSignature {\n Args: HdsFormCheckboxBaseSignature['Args'] & {\n count?: string | number;\n icon?: FlightIconSignature['Args']['name'];\n };\n Blocks: {\n default: [];\n };\n Element: HdsFormCheckboxBaseSignature['Element'];\n}\n\nexport default class HdsDropdownListItemCheckboxComponent extends Component<HdsDropdownListItemCheckboxSignature> {\n /**\n * Determines the unique ID to assign to the checkbox control\n */\n get id(): string {\n return getElementId(this);\n }\n}\n"],"names":["HdsDropdownListItemCheckboxComponent","Component","id","getElementId","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,+wBAA+wB;;ACDjzB;AACA;AACA;AACA;;AAkBe,MAAMA,oCAAoC,SAASC,SAAS,CAAuC;AAChH;AACF;AACA;EACE,IAAIC,EAAEA,GAAW;IACf,OAAOC,YAAY,CAAC,IAAI,CAAC,CAAA;AAC3B,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAPoBL,oCAAoC,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("{{
|
|
5
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n{{! template-lint-disable no-invalid-role require-context-role require-presentational-children }}\n<li class={{this.classNames}} role=\"none\">\n <Hds::Interactive\n @current-when={{@current-when}}\n @models={{hds-link-to-models @model @models}}\n @query={{hds-link-to-query @query}}\n @replace={{@replace}}\n @route={{@route}}\n @isRouteExternal={{@isRouteExternal}}\n @href={{@href}}\n @isHrefExternal={{@isHrefExternal}}\n class=\"hds-dropdown-list-item__interactive\"\n ...attributes\n role=\"option\"\n aria-selected={{if @selected \"true\" \"false\"}}\n >\n {{#if @icon}}\n <span class=\"hds-dropdown-list-item__interactive-icon hds-dropdown-list-item__interactive-icon--leading\">\n <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />\n </span>\n {{/if}}\n <Hds::Text::Body @tag=\"span\" @size=\"200\" @weight=\"medium\" class=\"hds-dropdown-list-item__interactive-text\">\n {{yield}}\n </Hds::Text::Body>\n {{#if @count}}\n <Hds::Text::Body\n class=\"hds-dropdown-list-item__count\"\n @tag=\"span\"\n @size=\"100\"\n @weight=\"medium\"\n @color=\"faint\"\n >{{@count}}</Hds::Text::Body>\n {{/if}}\n <span class=\"hds-dropdown-list-item__checkmark\">\n {{#if @selected}}\n <FlightIcon class=\"hds-dropdown-list-item__checkmark-icon\" @name=\"check\" @isInlineBlock={{false}} />\n {{/if}}\n </span>\n </Hds::Interactive>\n</li>\n{{! template-lint-enable no-invalid-role require-context-role require-presentational-children }}");
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -16,7 +16,7 @@ class HdsDropdownListItemCheckmarkComponent extends Component {
|
|
|
16
16
|
* @return {string} The "class" attribute to apply to the component.
|
|
17
17
|
*/
|
|
18
18
|
get classNames() {
|
|
19
|
-
|
|
19
|
+
const classes = ['hds-dropdown-list-item', 'hds-dropdown-list-item--color-action', 'hds-dropdown-list-item--variant-checkmark'];
|
|
20
20
|
|
|
21
21
|
// add a class based on the @selected argument
|
|
22
22
|
if (this.args.selected) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkmark.js","sources":["../../../../../src/components/hds/dropdown/list-item/checkmark.hbs","../../../../../src/components/hds/dropdown/list-item/checkmark.
|
|
1
|
+
{"version":3,"file":"checkmark.js","sources":["../../../../../src/components/hds/dropdown/list-item/checkmark.hbs","../../../../../src/components/hds/dropdown/list-item/checkmark.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{{! template-lint-disable no-invalid-role require-context-role require-presentational-children }}\\n<li class={{this.classNames}} role=\\\"none\\\">\\n <Hds::Interactive\\n @current-when={{@current-when}}\\n @models={{hds-link-to-models @model @models}}\\n @query={{hds-link-to-query @query}}\\n @replace={{@replace}}\\n @route={{@route}}\\n @isRouteExternal={{@isRouteExternal}}\\n @href={{@href}}\\n @isHrefExternal={{@isHrefExternal}}\\n class=\\\"hds-dropdown-list-item__interactive\\\"\\n ...attributes\\n role=\\\"option\\\"\\n aria-selected={{if @selected \\\"true\\\" \\\"false\\\"}}\\n >\\n {{#if @icon}}\\n <span class=\\\"hds-dropdown-list-item__interactive-icon hds-dropdown-list-item__interactive-icon--leading\\\">\\n <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />\\n </span>\\n {{/if}}\\n <Hds::Text::Body @tag=\\\"span\\\" @size=\\\"200\\\" @weight=\\\"medium\\\" class=\\\"hds-dropdown-list-item__interactive-text\\\">\\n {{yield}}\\n </Hds::Text::Body>\\n {{#if @count}}\\n <Hds::Text::Body\\n class=\\\"hds-dropdown-list-item__count\\\"\\n @tag=\\\"span\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"medium\\\"\\n @color=\\\"faint\\\"\\n >{{@count}}</Hds::Text::Body>\\n {{/if}}\\n <span class=\\\"hds-dropdown-list-item__checkmark\\\">\\n {{#if @selected}}\\n <FlightIcon class=\\\"hds-dropdown-list-item__checkmark-icon\\\" @name=\\\"check\\\" @isInlineBlock={{false}} />\\n {{/if}}\\n </span>\\n </Hds::Interactive>\\n</li>\\n{{! template-lint-enable no-invalid-role require-context-role require-presentational-children }}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\nimport type { HdsInteractiveSignature } from '../../interactive';\n\nexport interface HdsDropdownListItemCheckmarkSignature {\n Args: HdsInteractiveSignature['Args'] & {\n count?: string | number;\n icon?: FlightIconSignature['Args']['name'];\n selected?: boolean;\n };\n Blocks: {\n default: [];\n };\n Element: HdsInteractiveSignature['Element'];\n}\n\nexport default class HdsDropdownListItemCheckmarkComponent extends Component<HdsDropdownListItemCheckmarkSignature> {\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 = [\n 'hds-dropdown-list-item',\n 'hds-dropdown-list-item--color-action',\n 'hds-dropdown-list-item--variant-checkmark',\n ];\n\n // add a class based on the @selected argument\n if (this.args.selected) {\n classes.push('hds-dropdown-list-item--variant-checkmark-selected');\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["HdsDropdownListItemCheckmarkComponent","Component","classNames","classes","args","selected","push","join","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,8nDAA8nD;;ACDhqD;AACA;AACA;AACA;;AAkBe,MAAMA,qCAAqC,SAASC,SAAS,CAAwC;AAClH;AACF;AACA;AACA;AACA;EACE,IAAIC,UAAUA,GAAW;IACvB,MAAMC,OAAO,GAAG,CACd,wBAAwB,EACxB,sCAAsC,EACtC,2CAA2C,CAC5C,CAAA;;AAED;AACA,IAAA,IAAI,IAAI,CAACC,IAAI,CAACC,QAAQ,EAAE;AACtBF,MAAAA,OAAO,CAACG,IAAI,CAAC,oDAAoD,CAAC,CAAA;AACpE,KAAA;AAEA,IAAA,OAAOH,OAAO,CAACI,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EApBoBT,qCAAqC,CAAA;;;;"}
|
|
@@ -3,7 +3,7 @@ import { assert } from '@ember/debug';
|
|
|
3
3
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
4
|
import { setComponentTemplate } from '@ember/component';
|
|
5
5
|
|
|
6
|
-
var TEMPLATE = precompileTemplate("{{
|
|
6
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<li class={{this.classNames}} ...attributes>\n {{#if @copyItemTitle}}\n <Hds::Text::Body\n class=\"hds-dropdown-list-item__copy-item-title\"\n @tag=\"div\"\n @size=\"100\"\n @weight=\"semibold\"\n @color=\"faint\"\n >{{@copyItemTitle}}</Hds::Text::Body>\n {{/if}}\n <Hds::Copy::Snippet @color=\"secondary\" @textToCopy={{this.text}} @isTruncated={{this.isTruncated}} />\n</li>");
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -17,7 +17,7 @@ class HdsDropdownListItemCopyItemComponent extends Component {
|
|
|
17
17
|
* @description The text of the item. If no text value is defined an error will be thrown
|
|
18
18
|
*/
|
|
19
19
|
get text() {
|
|
20
|
-
|
|
20
|
+
const {
|
|
21
21
|
text
|
|
22
22
|
} = this.args;
|
|
23
23
|
assert('@text for "Hds::Dropdown::ListItem::CopyItem" must have a valid value', text !== undefined);
|
|
@@ -31,7 +31,7 @@ class HdsDropdownListItemCopyItemComponent extends Component {
|
|
|
31
31
|
* @description Indicates that the text should be truncated instead of wrapping and using multiple lines.
|
|
32
32
|
*/
|
|
33
33
|
get isTruncated() {
|
|
34
|
-
|
|
34
|
+
const {
|
|
35
35
|
isTruncated = true
|
|
36
36
|
} = this.args;
|
|
37
37
|
return isTruncated;
|
|
@@ -43,7 +43,7 @@ class HdsDropdownListItemCopyItemComponent extends Component {
|
|
|
43
43
|
* @return {string} The "class" attribute to apply to the component.
|
|
44
44
|
*/
|
|
45
45
|
get classNames() {
|
|
46
|
-
|
|
46
|
+
const classes = ['hds-dropdown-list-item', 'hds-dropdown-list-item--variant-copy-item'];
|
|
47
47
|
return classes.join(' ');
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-item.js","sources":["../../../../../src/components/hds/dropdown/list-item/copy-item.hbs","../../../../../src/components/hds/dropdown/list-item/copy-item.
|
|
1
|
+
{"version":3,"file":"copy-item.js","sources":["../../../../../src/components/hds/dropdown/list-item/copy-item.hbs","../../../../../src/components/hds/dropdown/list-item/copy-item.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<li class={{this.classNames}} ...attributes>\\n {{#if @copyItemTitle}}\\n <Hds::Text::Body\\n class=\\\"hds-dropdown-list-item__copy-item-title\\\"\\n @tag=\\\"div\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"semibold\\\"\\n @color=\\\"faint\\\"\\n >{{@copyItemTitle}}</Hds::Text::Body>\\n {{/if}}\\n <Hds::Copy::Snippet @color=\\\"secondary\\\" @textToCopy={{this.text}} @isTruncated={{this.isTruncated}} />\\n</li>\")","/**\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 type { HdsCopySnippetSignature } from '../../copy/snippet';\n\nexport interface HdsDropdownListItemCopyItemSignature {\n Args: {\n copyItemTitle?: string;\n isTruncated?: HdsCopySnippetSignature['Args']['isTruncated'];\n text: HdsCopySnippetSignature['Args']['textToCopy'];\n };\n Element: HTMLLIElement;\n}\n\nexport default class HdsDropdownListItemCopyItemComponent extends Component<HdsDropdownListItemCopyItemSignature> {\n /**\n * @param text\n * @type {string}\n * @description The text of the item. If no text value is defined an error will be thrown\n */\n get text(): HdsCopySnippetSignature['Args']['textToCopy'] {\n const { text } = this.args;\n\n assert(\n '@text for \"Hds::Dropdown::ListItem::CopyItem\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * @param isTruncated\n * @type {boolean}\n * @default true\n * @description Indicates that the text should be truncated instead of wrapping and using multiple lines.\n */\n get isTruncated(): HdsCopySnippetSignature['Args']['isTruncated'] {\n const { isTruncated = true } = this.args;\n\n return isTruncated;\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 = [\n 'hds-dropdown-list-item',\n 'hds-dropdown-list-item--variant-copy-item',\n ];\n\n return classes.join(' ');\n }\n}\n"],"names":["HdsDropdownListItemCopyItemComponent","Component","text","args","assert","undefined","isTruncated","classNames","classes","join","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,0eAA0e;;ACD5gB;AACA;AACA;AACA;;AAee,MAAMA,oCAAoC,SAASC,SAAS,CAAuC;AAChH;AACF;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAkD;IACxD,MAAM;AAAEA,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACC,IAAI,CAAA;AAE1BC,IAAAA,MAAM,CACJ,uEAAuE,EACvEF,IAAI,KAAKG,SACX,CAAC,CAAA;AAED,IAAA,OAAOH,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAII,WAAWA,GAAmD;IAChE,MAAM;AAAEA,MAAAA,WAAW,GAAG,IAAA;KAAM,GAAG,IAAI,CAACH,IAAI,CAAA;AAExC,IAAA,OAAOG,WAAW,CAAA;AACpB,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,UAAUA,GAAW;AACvB,IAAA,MAAMC,OAAO,GAAG,CACd,wBAAwB,EACxB,2CAA2C,CAC5C,CAAA;AAED,IAAA,OAAOA,OAAO,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EA1CoBX,oCAAoC,CAAA;;;;"}
|
|
@@ -3,7 +3,7 @@ import { assert } from '@ember/debug';
|
|
|
3
3
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
4
|
import { setComponentTemplate } from '@ember/component';
|
|
5
5
|
|
|
6
|
-
var TEMPLATE = precompileTemplate("{{
|
|
6
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Text::Body\n class=\"hds-dropdown-list-item hds-dropdown-list-item--variant-description\"\n @tag=\"li\"\n @size=\"100\"\n @weight=\"regular\"\n @color=\"faint\"\n ...attributes\n>\n {{this.text}}\n</Hds::Text::Body>");
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -17,7 +17,7 @@ class HdsDropdownListItemDescriptionComponent extends Component {
|
|
|
17
17
|
* @description The text of the item. If no text value is defined an error will be thrown
|
|
18
18
|
*/
|
|
19
19
|
get text() {
|
|
20
|
-
|
|
20
|
+
const {
|
|
21
21
|
text
|
|
22
22
|
} = this.args;
|
|
23
23
|
assert('@text for "Hds::Dropdown::ListItem::Description" must have a valid value', text !== undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"description.js","sources":["../../../../../src/components/hds/dropdown/list-item/description.hbs","../../../../../src/components/hds/dropdown/list-item/description.
|
|
1
|
+
{"version":3,"file":"description.js","sources":["../../../../../src/components/hds/dropdown/list-item/description.hbs","../../../../../src/components/hds/dropdown/list-item/description.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::Text::Body\\n class=\\\"hds-dropdown-list-item hds-dropdown-list-item--variant-description\\\"\\n @tag=\\\"li\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"regular\\\"\\n @color=\\\"faint\\\"\\n ...attributes\\n>\\n {{this.text}}\\n</Hds::Text::Body>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport type { HdsTextBodySignature } from '../../text/body';\n\nexport interface HdsDropdownListItemDescriptionSignature {\n Args: {\n text: string;\n };\n Element: HdsTextBodySignature['Element'];\n}\n\nexport default class HdsDropdownListItemDescriptionComponent extends Component<HdsDropdownListItemDescriptionSignature> {\n /**\n * @param text\n * @type {string}\n * @description The text of the item. 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::Dropdown::ListItem::Description\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n}\n"],"names":["HdsDropdownListItemDescriptionComponent","Component","text","args","assert","undefined","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,oTAAoT;;ACDtV;AACA;AACA;AACA;;AAae,MAAMA,uCAAuC,SAASC,SAAS,CAA0C;AACtH;AACF;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAW;IACjB,MAAM;AAAEA,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACC,IAAI,CAAA;AAE1BC,IAAAA,MAAM,CACJ,0EAA0E,EAC1EF,IAAI,KAAKG,SACX,CAAC,CAAA;AAED,IAAA,OAAOH,IAAI,CAAA;AACb,GAAA;AACF,CAAA;AAACI,oBAAA,CAAAC,QAAA,EAhBoBP,uCAAuC,CAAA;;;;"}
|
|
@@ -2,9 +2,15 @@ import templateOnlyComponent from '@ember/component/template-only';
|
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
5
|
-
var TEMPLATE = precompileTemplate("{{
|
|
5
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<li class=\"hds-dropdown-list-item hds-dropdown-list-item--variant-generic\" ...attributes>\n {{yield}}\n</li>");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) HashiCorp, Inc.
|
|
9
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const HdsDropdownListItemGenericComponent = templateOnlyComponent();
|
|
13
|
+
var generic = setComponentTemplate(TEMPLATE, HdsDropdownListItemGenericComponent);
|
|
8
14
|
|
|
9
15
|
export { generic as default };
|
|
10
16
|
//# sourceMappingURL=generic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","sources":["../../../../../src/components/hds/dropdown/list-item/generic.hbs","../../../../../src/components/hds/dropdown/list-item/generic.
|
|
1
|
+
{"version":3,"file":"generic.js","sources":["../../../../../src/components/hds/dropdown/list-item/generic.hbs","../../../../../src/components/hds/dropdown/list-item/generic.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<li class=\\\"hds-dropdown-list-item hds-dropdown-list-item--variant-generic\\\" ...attributes>\\n {{yield}}\\n</li>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport templateOnlyComponent from '@ember/component/template-only';\n\nexport interface HdsDropdownListItemGenericSignature {\n Blocks: {\n default: [];\n };\n Element: HTMLLIElement;\n}\n\nconst HdsDropdownListItemGenericComponent =\n templateOnlyComponent<HdsDropdownListItemGenericSignature>();\n\nexport default HdsDropdownListItemGenericComponent;\n"],"names":["HdsDropdownListItemGenericComponent","templateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,+LAA+L;;ACDjO;AACA;AACA;AACA;;AAWA,MAAMA,mCAAmC,GACvCC,qBAAqB,EAAuC,CAAA;AAE9D,cAAAC,oBAAA,CAAAC,QAAA,EAAeH,mCAAmC,CAAA;;;;"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { assert } from '@ember/debug';
|
|
3
|
+
import { HdsDropdownListItemInteractiveColorValues } from './types.js';
|
|
3
4
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
5
|
import { setComponentTemplate } from '@ember/component';
|
|
5
6
|
|
|
6
|
-
var TEMPLATE = precompileTemplate("{{
|
|
7
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<li class={{this.classNames}}>\n {{#if @isLoading}}\n <div class=\"hds-dropdown-list-item__interactive-loading-wrapper\" ...attributes>\n <div class=\"hds-dropdown-list-item__interactive-icon hds-dropdown-list-item__interactive-icon--leading\">\n <FlightIcon @name=\"loading\" @isInlineBlock={{false}} />\n </div>\n <Hds::Text::Body @tag=\"div\" @size=\"100\" @weight=\"regular\" class=\"hds-dropdown-list-item__interactive-text\">\n {{this.text}}\n </Hds::Text::Body>\n </div>\n {{else}}\n <Hds::Interactive\n @current-when={{@current-when}}\n @models={{hds-link-to-models @model @models}}\n @query={{hds-link-to-query @query}}\n @replace={{@replace}}\n @route={{@route}}\n @isRouteExternal={{@isRouteExternal}}\n @href={{@href}}\n @isHrefExternal={{@isHrefExternal}}\n ...attributes\n >\n {{#if @icon}}\n <span class=\"hds-dropdown-list-item__interactive-icon hds-dropdown-list-item__interactive-icon--leading\">\n <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />\n </span>\n {{/if}}\n <Hds::Text::Body class=\"hds-dropdown-list-item__interactive-text\" @tag=\"span\" @size=\"200\" @weight=\"medium\">\n {{this.text}}\n </Hds::Text::Body>\n {{#if @trailingIcon}}\n <span class=\"hds-dropdown-list-item__interactive-icon hds-dropdown-list-item__interactive-icon--trailing\">\n <FlightIcon @name={{@trailingIcon}} @isInlineBlock={{false}} />\n </span>\n {{/if}}\n </Hds::Interactive>\n {{/if}}\n</li>");
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Copyright (c) HashiCorp, Inc.
|
|
10
11
|
* SPDX-License-Identifier: MPL-2.0
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
|
-
const DEFAULT_COLOR =
|
|
14
|
-
const COLORS =
|
|
14
|
+
const DEFAULT_COLOR = HdsDropdownListItemInteractiveColorValues.Action;
|
|
15
|
+
const COLORS = Object.values(HdsDropdownListItemInteractiveColorValues);
|
|
15
16
|
class HdsDropdownListItemInteractiveComponent extends Component {
|
|
16
17
|
/**
|
|
17
18
|
* @param text
|
|
@@ -19,7 +20,7 @@ class HdsDropdownListItemInteractiveComponent extends Component {
|
|
|
19
20
|
* @description The text of the item. If no text value is defined an error will be thrown
|
|
20
21
|
*/
|
|
21
22
|
get text() {
|
|
22
|
-
|
|
23
|
+
const {
|
|
23
24
|
text
|
|
24
25
|
} = this.args;
|
|
25
26
|
assert('@text for "Hds::Dropdown::ListItem::Interactive" must have a valid value', text !== undefined);
|
|
@@ -33,7 +34,7 @@ class HdsDropdownListItemInteractiveComponent extends Component {
|
|
|
33
34
|
* @description Determines the color of the item (when item is set to interactive)
|
|
34
35
|
*/
|
|
35
36
|
get color() {
|
|
36
|
-
|
|
37
|
+
const {
|
|
37
38
|
color = DEFAULT_COLOR
|
|
38
39
|
} = this.args;
|
|
39
40
|
assert(`@color for "Hds::Dropdown::ListItem::Interactive" must be one of the following: ${COLORS.join(', ')}; received: ${color}`, COLORS.includes(color));
|
|
@@ -46,7 +47,7 @@ class HdsDropdownListItemInteractiveComponent extends Component {
|
|
|
46
47
|
* @return {string} The "class" attribute to apply to the component.
|
|
47
48
|
*/
|
|
48
49
|
get classNames() {
|
|
49
|
-
|
|
50
|
+
const classes = ['hds-dropdown-list-item', 'hds-dropdown-list-item--variant-interactive'];
|
|
50
51
|
|
|
51
52
|
// add a class based on the @color argument
|
|
52
53
|
classes.push(`hds-dropdown-list-item--color-${this.color}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive.js","sources":["../../../../../src/components/hds/dropdown/list-item/interactive.hbs","../../../../../src/components/hds/dropdown/list-item/interactive.
|
|
1
|
+
{"version":3,"file":"interactive.js","sources":["../../../../../src/components/hds/dropdown/list-item/interactive.hbs","../../../../../src/components/hds/dropdown/list-item/interactive.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<li class={{this.classNames}}>\\n {{#if @isLoading}}\\n <div class=\\\"hds-dropdown-list-item__interactive-loading-wrapper\\\" ...attributes>\\n <div class=\\\"hds-dropdown-list-item__interactive-icon hds-dropdown-list-item__interactive-icon--leading\\\">\\n <FlightIcon @name=\\\"loading\\\" @isInlineBlock={{false}} />\\n </div>\\n <Hds::Text::Body @tag=\\\"div\\\" @size=\\\"100\\\" @weight=\\\"regular\\\" class=\\\"hds-dropdown-list-item__interactive-text\\\">\\n {{this.text}}\\n </Hds::Text::Body>\\n </div>\\n {{else}}\\n <Hds::Interactive\\n @current-when={{@current-when}}\\n @models={{hds-link-to-models @model @models}}\\n @query={{hds-link-to-query @query}}\\n @replace={{@replace}}\\n @route={{@route}}\\n @isRouteExternal={{@isRouteExternal}}\\n @href={{@href}}\\n @isHrefExternal={{@isHrefExternal}}\\n ...attributes\\n >\\n {{#if @icon}}\\n <span class=\\\"hds-dropdown-list-item__interactive-icon hds-dropdown-list-item__interactive-icon--leading\\\">\\n <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />\\n </span>\\n {{/if}}\\n <Hds::Text::Body class=\\\"hds-dropdown-list-item__interactive-text\\\" @tag=\\\"span\\\" @size=\\\"200\\\" @weight=\\\"medium\\\">\\n {{this.text}}\\n </Hds::Text::Body>\\n {{#if @trailingIcon}}\\n <span class=\\\"hds-dropdown-list-item__interactive-icon hds-dropdown-list-item__interactive-icon--trailing\\\">\\n <FlightIcon @name={{@trailingIcon}} @isInlineBlock={{false}} />\\n </span>\\n {{/if}}\\n </Hds::Interactive>\\n {{/if}}\\n</li>\")","/**\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 { HdsDropdownListItemInteractiveColorValues } from './types.ts';\n\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\nimport type { HdsInteractiveSignature } from '../../interactive';\nimport type { HdsDropdownListItemInteractiveColors } from './types.ts';\n\nexport const DEFAULT_COLOR = HdsDropdownListItemInteractiveColorValues.Action;\nexport const COLORS: string[] = Object.values(\n HdsDropdownListItemInteractiveColorValues\n);\n\nexport interface HdsDropdownListItemInteractiveSignature {\n Args: HdsInteractiveSignature['Args'] & {\n color: HdsDropdownListItemInteractiveColors;\n icon?: FlightIconSignature['Args']['name'];\n isLoading?: boolean;\n text: string;\n trailingIcon?: FlightIconSignature['Args']['name'];\n };\n Element: HTMLDivElement | HdsInteractiveSignature['Element'];\n}\n\nexport default class HdsDropdownListItemInteractiveComponent extends Component<HdsDropdownListItemInteractiveSignature> {\n /**\n * @param text\n * @type {string}\n * @description The text of the item. 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::Dropdown::ListItem::Interactive\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * @param color\n * @type {string}\n * @default primary\n * @description Determines the color of the item (when item is set to interactive)\n */\n get color(): HdsDropdownListItemInteractiveColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Dropdown::ListItem::Interactive\" 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 classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = [\n 'hds-dropdown-list-item',\n 'hds-dropdown-list-item--variant-interactive',\n ];\n\n // add a class based on the @color argument\n classes.push(`hds-dropdown-list-item--color-${this.color}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_COLOR","HdsDropdownListItemInteractiveColorValues","Action","COLORS","Object","values","HdsDropdownListItemInteractiveComponent","Component","text","args","assert","undefined","color","join","includes","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,moDAAmoD;;ACDrqD;AACA;AACA;AACA;;AAWaA,MAAAA,aAAa,GAAGC,yCAAyC,CAACC,OAAM;AACtE,MAAMC,MAAgB,GAAGC,MAAM,CAACC,MAAM,CAC3CJ,yCACF,EAAC;AAac,MAAMK,uCAAuC,SAASC,SAAS,CAA0C;AACtH;AACF;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAW;IACjB,MAAM;AAAEA,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACC,IAAI,CAAA;AAE1BC,IAAAA,MAAM,CACJ,0EAA0E,EAC1EF,IAAI,KAAKG,SACX,CAAC,CAAA;AAED,IAAA,OAAOH,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAII,KAAKA,GAAyC;IAChD,MAAM;AAAEA,MAAAA,KAAK,GAAGZ,aAAAA;KAAe,GAAG,IAAI,CAACS,IAAI,CAAA;AAE3CC,IAAAA,MAAM,CACJ,CAAmFP,gFAAAA,EAAAA,MAAM,CAACU,IAAI,CAC5F,IACF,CAAC,CAAA,YAAA,EAAeD,KAAK,CAAA,CAAE,EACvBT,MAAM,CAACW,QAAQ,CAACF,KAAK,CACvB,CAAC,CAAA;AAED,IAAA,OAAOA,KAAK,CAAA;AACd,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIG,UAAUA,GAAW;AACvB,IAAA,MAAMC,OAAO,GAAG,CACd,wBAAwB,EACxB,6CAA6C,CAC9C,CAAA;;AAED;IACAA,OAAO,CAACC,IAAI,CAAC,CAAA,8BAAA,EAAiC,IAAI,CAACL,KAAK,EAAE,CAAC,CAAA;AAE3D,IAAA,OAAOI,OAAO,CAACH,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACK,oBAAA,CAAAC,QAAA,EApDoBb,uCAAuC,CAAA;;;;"}
|
|
@@ -3,7 +3,7 @@ import { getElementId } from '../../../../utils/hds-get-element-id.js';
|
|
|
3
3
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
4
|
import { setComponentTemplate } from '@ember/component';
|
|
5
5
|
|
|
6
|
-
var TEMPLATE = precompileTemplate("{{
|
|
6
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<li class=\"hds-dropdown-list-item hds-dropdown-list-item--variant-radio\">\n <label class=\"hds-dropdown-list-item__label hds-typography-body-200\" for={{this.id}}>\n <Hds::Form::Radio::Base class=\"hds-dropdown-list-item__control\" id={{this.id}} @value={{@value}} ...attributes />\n {{#if @icon}}\n <div class=\"hds-dropdown-list-item__icon\">\n <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />\n </div>\n {{/if}}\n <span class=\"hds-dropdown-list-item__text-content\">{{yield}}</span>\n\n {{#if @count}}\n <Hds::Text::Body\n class=\"hds-dropdown-list-item__count\"\n @tag=\"span\"\n @size=\"100\"\n @weight=\"medium\"\n >{{@count}}</Hds::Text::Body>\n {{/if}}\n </label>\n</li>");
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sources":["../../../../../src/components/hds/dropdown/list-item/radio.hbs","../../../../../src/components/hds/dropdown/list-item/radio.
|
|
1
|
+
{"version":3,"file":"radio.js","sources":["../../../../../src/components/hds/dropdown/list-item/radio.hbs","../../../../../src/components/hds/dropdown/list-item/radio.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<li class=\\\"hds-dropdown-list-item hds-dropdown-list-item--variant-radio\\\">\\n <label class=\\\"hds-dropdown-list-item__label hds-typography-body-200\\\" for={{this.id}}>\\n <Hds::Form::Radio::Base class=\\\"hds-dropdown-list-item__control\\\" id={{this.id}} @value={{@value}} ...attributes />\\n {{#if @icon}}\\n <div class=\\\"hds-dropdown-list-item__icon\\\">\\n <FlightIcon @name={{@icon}} @isInlineBlock={{false}} />\\n </div>\\n {{/if}}\\n <span class=\\\"hds-dropdown-list-item__text-content\\\">{{yield}}</span>\\n\\n {{#if @count}}\\n <Hds::Text::Body\\n class=\\\"hds-dropdown-list-item__count\\\"\\n @tag=\\\"span\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"medium\\\"\\n >{{@count}}</Hds::Text::Body>\\n {{/if}}\\n </label>\\n</li>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { getElementId } from '../../../../utils/hds-get-element-id.ts';\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\nimport type { HdsFormRadioBaseSignature } from '../../form/radio/base.ts';\n\nexport interface HdsDropdownListItemRadioSignature {\n Args: HdsFormRadioBaseSignature['Args'] & {\n count?: string | number;\n icon?: FlightIconSignature['Args']['name'];\n };\n Blocks: {\n default: [];\n };\n Element: HdsFormRadioBaseSignature['Element'];\n}\n\nexport default class HdsDropdownListItemRadioComponent extends Component<HdsDropdownListItemRadioSignature> {\n /**\n * Determines the unique ID to assign to the radio control\n */\n get id(): string {\n return getElementId(this);\n }\n}\n"],"names":["HdsDropdownListItemRadioComponent","Component","id","getElementId","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,20BAA20B;;ACD72B;AACA;AACA;AACA;;AAkBe,MAAMA,iCAAiC,SAASC,SAAS,CAAoC;AAC1G;AACF;AACA;EACE,IAAIC,EAAEA,GAAW;IACf,OAAOC,YAAY,CAAC,IAAI,CAAC,CAAA;AAC3B,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAPoBL,iCAAiC,CAAA;;;;"}
|