@hashicorp/design-system-components 4.1.2 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_app_/components/hds/form/super-select/after-options.js +1 -0
- package/dist/_app_/components/hds/form/super-select/multiple/base.js +1 -0
- package/dist/_app_/components/hds/form/super-select/multiple/field.js +1 -0
- package/dist/_app_/components/hds/form/super-select/option-group.js +1 -0
- package/dist/_app_/components/hds/form/super-select/placeholder.js +1 -0
- package/dist/_app_/components/hds/form/super-select/single/base.js +1 -0
- package/dist/_app_/components/hds/form/super-select/single/field.js +1 -0
- package/dist/_app_/components/hds/popover-primitive/index.js +1 -0
- package/dist/_app_/components/hds/rich-tooltip/bubble.js +1 -0
- package/dist/_app_/components/hds/rich-tooltip/index.js +1 -0
- package/dist/_app_/components/hds/rich-tooltip/toggle.js +1 -0
- package/dist/_app_/modifiers/hds-anchored-position.js +1 -0
- package/dist/_app_/modifiers/hds-register-event.js +1 -0
- package/dist/{_rollupPluginBabelHelpers-lqPQKyNs.js → _rollupPluginBabelHelpers-NoJJJNhk.js} +7 -9
- package/dist/{_rollupPluginBabelHelpers-lqPQKyNs.js.map → _rollupPluginBabelHelpers-NoJJJNhk.js.map} +1 -1
- package/dist/components/hds/accordion/index.js +8 -2
- package/dist/components/hds/accordion/index.js.map +1 -1
- package/dist/components/hds/accordion/item/button.js +12 -8
- package/dist/components/hds/accordion/item/button.js.map +1 -1
- package/dist/components/hds/accordion/item/index.js +6 -6
- package/dist/components/hds/accordion/item/index.js.map +1 -1
- package/dist/components/hds/alert/description.js +8 -2
- package/dist/components/hds/alert/description.js.map +1 -1
- package/dist/components/hds/alert/index.js +23 -22
- package/dist/components/hds/alert/index.js.map +1 -1
- package/dist/components/hds/alert/title.js +8 -2
- package/dist/components/hds/alert/title.js.map +1 -1
- package/dist/components/hds/alert/types.js +22 -0
- package/dist/components/hds/alert/types.js.map +1 -0
- package/dist/components/hds/app-footer/copyright.js +1 -1
- package/dist/components/hds/app-footer/copyright.js.map +1 -1
- package/dist/components/hds/app-footer/index.js +6 -6
- package/dist/components/hds/app-footer/index.js.map +1 -1
- package/dist/components/hds/app-footer/item.js +10 -4
- package/dist/components/hds/app-footer/item.js.map +1 -1
- package/dist/components/hds/app-footer/legal-links.js +1 -1
- package/dist/components/hds/app-footer/legal-links.js.map +1 -1
- package/dist/components/hds/app-footer/link.js +10 -4
- package/dist/components/hds/app-footer/link.js.map +1 -1
- package/dist/components/hds/app-footer/status-link.js +12 -27
- package/dist/components/hds/app-footer/status-link.js.map +1 -1
- package/dist/components/hds/app-footer/types.js +38 -0
- package/dist/components/hds/app-footer/types.js.map +1 -0
- package/dist/components/hds/app-frame/index.js +4 -4
- package/dist/components/hds/app-frame/index.js.map +1 -1
- package/dist/components/hds/app-frame/parts/footer.js +10 -4
- package/dist/components/hds/app-frame/parts/footer.js.map +1 -1
- package/dist/components/hds/app-frame/parts/header.js +10 -4
- package/dist/components/hds/app-frame/parts/header.js.map +1 -1
- package/dist/components/hds/app-frame/parts/main.js +10 -4
- package/dist/components/hds/app-frame/parts/main.js.map +1 -1
- package/dist/components/hds/app-frame/parts/modals.js +10 -4
- package/dist/components/hds/app-frame/parts/modals.js.map +1 -1
- package/dist/components/hds/app-frame/parts/sidebar.js +10 -4
- package/dist/components/hds/app-frame/parts/sidebar.js.map +1 -1
- package/dist/components/hds/badge/index.js +19 -18
- package/dist/components/hds/badge/index.js.map +1 -1
- package/dist/components/hds/badge/types.js +29 -0
- package/dist/components/hds/badge/types.js.map +1 -0
- package/dist/components/hds/badge-count/index.js +15 -14
- package/dist/components/hds/badge-count/index.js.map +1 -1
- package/dist/components/hds/badge-count/types.js +25 -0
- package/dist/components/hds/badge-count/types.js.map +1 -0
- package/dist/components/hds/button/index.js +9 -9
- package/dist/components/hds/button/index.js.map +1 -1
- package/dist/components/hds/button-set/index.js +8 -2
- package/dist/components/hds/button-set/index.js.map +1 -1
- package/dist/components/hds/card/container.js +25 -24
- package/dist/components/hds/card/container.js.map +1 -1
- package/dist/components/hds/card/types.js +24 -0
- package/dist/components/hds/card/types.js.map +1 -0
- package/dist/components/hds/code-block/index.js +1 -1
- package/dist/components/hds/code-block/index.js.map +1 -1
- package/dist/components/hds/copy/button/index.js +1 -1
- package/dist/components/hds/copy/button/index.js.map +1 -1
- package/dist/components/hds/copy/snippet/index.js +2 -2
- package/dist/components/hds/copy/snippet/index.js.map +1 -1
- package/dist/components/hds/disclosure-primitive/index.js +2 -2
- package/dist/components/hds/disclosure-primitive/index.js.map +1 -1
- package/dist/components/hds/dismiss-button/index.js +3 -3
- package/dist/components/hds/dismiss-button/index.js.map +1 -1
- package/dist/components/hds/dropdown/index.js +1 -1
- package/dist/components/hds/dropdown/index.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/checkmark.js +1 -1
- package/dist/components/hds/dropdown/list-item/checkmark.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/interactive.js +1 -1
- package/dist/components/hds/dropdown/list-item/interactive.js.map +1 -1
- package/dist/components/hds/dropdown/toggle/button.js +1 -1
- package/dist/components/hds/dropdown/toggle/icon.js +1 -1
- package/dist/components/hds/dropdown/toggle/icon.js.map +1 -1
- package/dist/components/hds/flyout/index.js +3 -9
- package/dist/components/hds/flyout/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/label/index.js +18 -2
- package/dist/components/hds/form/label/index.js.map +1 -1
- package/dist/components/hds/form/masked-input/base.js +1 -1
- package/dist/components/hds/form/masked-input/base.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/after-options.js +10 -0
- package/dist/components/hds/form/super-select/after-options.js.map +1 -0
- package/dist/components/hds/form/super-select/multiple/base.js +159 -0
- package/dist/components/hds/form/super-select/multiple/base.js.map +1 -0
- package/dist/components/hds/form/super-select/multiple/field.js +21 -0
- package/dist/components/hds/form/super-select/multiple/field.js.map +1 -0
- package/dist/components/hds/form/super-select/option-group.js +22 -0
- package/dist/components/hds/form/super-select/option-group.js.map +1 -0
- package/dist/components/hds/form/super-select/placeholder.js +10 -0
- package/dist/components/hds/form/super-select/placeholder.js.map +1 -0
- package/dist/components/hds/form/super-select/single/base.js +86 -0
- package/dist/components/hds/form/super-select/single/base.js.map +1 -0
- package/dist/components/hds/form/super-select/single/field.js +21 -0
- package/dist/components/hds/form/super-select/single/field.js.map +1 -0
- package/dist/components/hds/form/text-input/field.js +1 -1
- package/dist/components/hds/form/text-input/field.js.map +1 -1
- package/dist/components/hds/icon-tile/index.js +15 -11
- package/dist/components/hds/icon-tile/index.js.map +1 -1
- package/dist/components/hds/icon-tile/types.js +32 -0
- package/dist/components/hds/icon-tile/types.js.map +1 -0
- package/dist/components/hds/interactive/index.js +4 -4
- package/dist/components/hds/interactive/index.js.map +1 -1
- package/dist/components/hds/link/inline.js +11 -10
- package/dist/components/hds/link/inline.js.map +1 -1
- package/dist/components/hds/link/standalone.js +16 -15
- package/dist/components/hds/link/standalone.js.map +1 -1
- package/dist/components/hds/link/types.js +24 -0
- package/dist/components/hds/link/types.js.map +1 -0
- package/dist/components/hds/menu-primitive/index.js +1 -1
- package/dist/components/hds/menu-primitive/index.js.map +1 -1
- package/dist/components/hds/modal/index.js +3 -9
- package/dist/components/hds/modal/index.js.map +1 -1
- package/dist/components/hds/pagination/compact/index.js +1 -1
- package/dist/components/hds/pagination/compact/index.js.map +1 -1
- package/dist/components/hds/pagination/nav/arrow.js +1 -1
- package/dist/components/hds/pagination/nav/arrow.js.map +1 -1
- package/dist/components/hds/pagination/nav/number.js +1 -1
- package/dist/components/hds/pagination/nav/number.js.map +1 -1
- package/dist/components/hds/pagination/numbered/index.js +1 -1
- package/dist/components/hds/pagination/numbered/index.js.map +1 -1
- package/dist/components/hds/pagination/size-selector/index.js +1 -1
- package/dist/components/hds/pagination/size-selector/index.js.map +1 -1
- package/dist/components/hds/popover-primitive/index.js +238 -0
- package/dist/components/hds/popover-primitive/index.js.map +1 -0
- package/dist/components/hds/reveal/index.js +21 -17
- package/dist/components/hds/reveal/index.js.map +1 -1
- package/dist/components/hds/reveal/toggle/button.js +5 -5
- package/dist/components/hds/reveal/toggle/button.js.map +1 -1
- package/dist/components/hds/rich-tooltip/bubble.js +60 -0
- package/dist/components/hds/rich-tooltip/bubble.js.map +1 -0
- package/dist/components/hds/rich-tooltip/index.js +26 -0
- package/dist/components/hds/rich-tooltip/index.js.map +1 -0
- package/dist/components/hds/rich-tooltip/toggle.js +85 -0
- package/dist/components/hds/rich-tooltip/toggle.js.map +1 -0
- package/dist/components/hds/separator/index.js +9 -8
- package/dist/components/hds/separator/index.js.map +1 -1
- package/dist/components/hds/separator/types.js +13 -0
- package/dist/components/hds/separator/types.js.map +1 -0
- package/dist/components/hds/side-nav/index.js +1 -1
- package/dist/components/hds/side-nav/index.js.map +1 -1
- package/dist/components/hds/side-nav/portal/target.js +1 -1
- package/dist/components/hds/side-nav/portal/target.js.map +1 -1
- package/dist/components/hds/stepper/step/indicator.js +9 -8
- package/dist/components/hds/stepper/step/indicator.js.map +1 -1
- package/dist/components/hds/stepper/task/indicator.js +10 -14
- package/dist/components/hds/stepper/task/indicator.js.map +1 -1
- package/dist/components/hds/stepper/types.js +21 -0
- package/dist/components/hds/stepper/types.js.map +1 -0
- package/dist/components/hds/table/index.js +1 -1
- package/dist/components/hds/table/index.js.map +1 -1
- package/dist/components/hds/table/th-button-sort.js +1 -1
- package/dist/components/hds/table/th-button-tooltip.js +1 -1
- package/dist/components/hds/table/th-selectable.js +1 -1
- package/dist/components/hds/table/th-selectable.js.map +1 -1
- package/dist/components/hds/table/th-sort.js +1 -1
- package/dist/components/hds/table/th.js +1 -1
- package/dist/components/hds/tabs/index.js +1 -1
- package/dist/components/hds/tabs/index.js.map +1 -1
- package/dist/components/hds/tabs/panel.js +1 -1
- package/dist/components/hds/tabs/panel.js.map +1 -1
- package/dist/components/hds/tabs/tab.js +1 -1
- package/dist/components/hds/tabs/tab.js.map +1 -1
- package/dist/components/hds/tag/index.js +11 -10
- package/dist/components/hds/tag/index.js.map +1 -1
- package/dist/components/hds/tag/types.js +13 -0
- package/dist/components/hds/tag/types.js.map +1 -0
- package/dist/components/hds/text/body.js +8 -7
- package/dist/components/hds/text/body.js.map +1 -1
- package/dist/components/hds/text/code.js +8 -7
- package/dist/components/hds/text/code.js.map +1 -1
- package/dist/components/hds/text/display.js +19 -12
- package/dist/components/hds/text/display.js.map +1 -1
- package/dist/components/hds/text/index.js +17 -13
- package/dist/components/hds/text/index.js.map +1 -1
- package/dist/components/hds/text/types.js +58 -0
- package/dist/components/hds/text/types.js.map +1 -0
- package/dist/components/hds/toast/index.js +8 -2
- package/dist/components/hds/toast/index.js.map +1 -1
- package/dist/components/hds/yield/index.js +8 -2
- package/dist/components/hds/yield/index.js.map +1 -1
- package/dist/helpers/hds-link-to-models.js.map +1 -1
- package/dist/modifiers/hds-anchored-position.js +175 -0
- package/dist/modifiers/hds-anchored-position.js.map +1 -0
- package/dist/modifiers/hds-register-event.js +40 -0
- package/dist/modifiers/hds-register-event.js.map +1 -0
- package/dist/modifiers/hds-tooltip.js +10 -14
- package/dist/modifiers/hds-tooltip.js.map +1 -1
- package/dist/styles/@hashicorp/design-system-components.css +565 -3
- package/dist/styles/@hashicorp/design-system-components.scss +1 -0
- package/dist/styles/@hashicorp/design-system-power-select-overrides.scss +0 -1
- package/dist/styles/components/code-block/theme.scss +1 -1
- package/dist/styles/components/dropdown.scss +7 -0
- package/dist/styles/components/form/index.scss +1 -0
- package/dist/styles/components/form/select.scss +0 -1
- package/dist/styles/components/form/super-select.scss +515 -0
- package/dist/styles/components/form/text-input.scss +0 -1
- package/dist/styles/components/form/textarea.scss +0 -1
- package/dist/styles/components/page-header.scss +1 -0
- package/dist/styles/components/rich-tooltip.scss +247 -0
- package/dist/styles/components/tabs.scss +2 -1
- package/dist/styles/components/tooltip.scss +1 -1
- package/package.json +58 -23
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import PowerSelectComponent from 'ember-power-select/components/power-select';
|
|
2
|
+
import { ID_PREFIX } from '../../label/index.js';
|
|
3
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
|
+
import { setComponentTemplate } from '@ember/component';
|
|
5
|
+
|
|
6
|
+
var TEMPLATE = precompileTemplate("{{! @glint-nocheck: not typesafe yet }}\n{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Form::Field\n @layout=\"vertical\"\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\n @isRequired={{@isRequired}}\n @isOptional={{@isOptional}}\n @id={{@id}}\n as |F|\n>\n {{! Notice: the order of the elements is not relevant here, because is controlled at \"Hds::Form::Field\" component level }}\n {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}\n {{yield (hash HelperText=F.HelperText Error=F.Error)}}\n <F.Control>\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\n <Hds::Form::SuperSelect::Single::Base\n @afterOptionsComponent={{@afterOptionsComponent}}\n @afterOptionsContent={{@afterOptionsContent}}\n @ariaDescribedBy={{F.ariaDescribedBy}}\n @ariaInvalid={{@ariaInvalid}}\n @ariaLabel={{@ariaLabel}}\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @closeOnSelect={{@closeOnSelect}}\n @disabled={{@disabled}}\n @dropdownClass={{@dropdownClass}}\n @dropdownMaxWidth={{@dropdownMaxWidth}}\n @extra={{@extra}}\n @groupComponent={{@groupComponent}}\n @horizontalPosition={{@horizontalPosition}}\n @initiallyOpened={{@initiallyOpened}}\n @labelText={{@labelText}}\n @loadingMessage={{@loadingMessage}}\n @matcher={{@matcher}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @noMatchesMessage={{@noMatchesMessage}}\n @onBlur={{@onBlur}}\n @onChange={{@onChange}}\n @onClose={{@onClose}}\n @onFocus={{@onFocus}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @onOpen={{@onOpen}}\n @options={{@options}}\n @optionsComponent={{@optionsComponent}}\n @placeholder={{@placeholder}}\n @placeholderComponent={{@placeholderComponent}}\n @preventScroll={{@preventScroll}}\n @registerAPI={{@registerAPI}}\n @renderInPlace={{true}}\n @resultCountMessage={{@resultCountMessage}}\n @scrollTo={{@scrollTo}}\n @search={{@search}}\n @searchEnabled={{@searchEnabled}}\n @searchField={{@searchField}}\n @searchMessage={{@searchMessage}}\n @searchPlaceholder={{@searchPlaceholder}}\n @selected={{@selected}}\n @selectedItemComponent={{@selectedItemComponent}}\n @showAfterOptions={{@showAfterOptions}}\n @tabindex={{@tabindex}}\n @triggerClass={{@triggerClass}}\n @triggerComponent={{@triggerComponent}}\n @triggerId={{F.id}}\n @triggerRole={{@triggerRole}}\n @typeAheadMatcher={{@typeAheadMatcher}}\n @verticalPosition={{@verticalPosition}}\n @isInvalid={{@isInvalid}}\n ...attributes\n as |options select|\n >\n {{yield (hash options=options select=select Options=(component \"hds/yield\" options=options select=select))}}\n </Hds::Form::SuperSelect::Single::Base>\n </F.Control>\n</Hds::Form::Field>");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (c) HashiCorp, Inc.
|
|
10
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
class HdsSuperSelectSingleFieldComponent extends PowerSelectComponent {
|
|
14
|
+
get idPrefix() {
|
|
15
|
+
return ID_PREFIX;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
setComponentTemplate(TEMPLATE, HdsSuperSelectSingleFieldComponent);
|
|
19
|
+
|
|
20
|
+
export { HdsSuperSelectSingleFieldComponent as default };
|
|
21
|
+
//# sourceMappingURL=field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.js","sources":["../../../../../../src/components/hds/form/super-select/single/field.hbs","../../../../../../src/components/hds/form/super-select/single/field.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield (hash Label=F.Label isRequired=F.isRequired isOptional=F.isOptional)}}\\n {{yield (hash HelperText=F.HelperText Error=F.Error)}}\\n <F.Control>\\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\\n <Hds::Form::SuperSelect::Single::Base\\n @afterOptionsComponent={{@afterOptionsComponent}}\\n @afterOptionsContent={{@afterOptionsContent}}\\n @ariaDescribedBy={{F.ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @closeOnSelect={{@closeOnSelect}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @dropdownMaxWidth={{@dropdownMaxWidth}}\\n @extra={{@extra}}\\n @groupComponent={{@groupComponent}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{@matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{@searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @showAfterOptions={{@showAfterOptions}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{F.id}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadMatcher={{@typeAheadMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n @isInvalid={{@isInvalid}}\\n ...attributes\\n as |options select|\\n >\\n {{yield (hash options=options select=select Options=(component \\\"hds/yield\\\" options=options select=select))}}\\n </Hds::Form::SuperSelect::Single::Base>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport PowerSelectComponent from 'ember-power-select/components/power-select';\nimport { ID_PREFIX } from '../../label/index';\n\nexport default class HdsSuperSelectSingleFieldComponent extends PowerSelectComponent {\n get idPrefix() {\n return ID_PREFIX;\n }\n}\n"],"names":["HdsSuperSelectSingleFieldComponent","PowerSelectComponent","idPrefix","ID_PREFIX","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,w+FAAw+F;;ACD1gG;AACA;AACA;AACA;;AAKe,MAAMA,kCAAkC,SAASC,oBAAoB,CAAC;EACnF,IAAIC,QAAQA,GAAG;AACb,IAAA,OAAOC,SAAS,CAAA;AAClB,GAAA;AACF,CAAA;AAACC,oBAAA,CAAAC,QAAA,EAJoBL,kCAAkC,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../../_rollupPluginBabelHelpers-NoJJJNhk.js';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { tracked } from '@glimmer/tracking';
|
|
4
4
|
import { action } from '@ember/object';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sources":["../../../../../src/components/hds/form/text-input/field.hbs","../../../../../src/components/hds/form/text-input/field.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield\\n (hash\\n Label=F.Label\\n isRequired=F.isRequired\\n isOptional=F.isOptional\\n HelperText=F.HelperText\\n Error=F.Error\\n CharacterCount=(component F.CharacterCount value=@value)\\n )\\n }}\\n <F.Control>\\n <div class=\\\"hds-form-text-input__wrapper\\\" {{style width=@width}}>\\n <Hds::Form::TextInput::Base\\n @type={{this.type}}\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n @isLoading={{@isLoading}}\\n @hasVisibilityToggle={{this.showVisibilityToggle}}\\n required={{@isRequired}}\\n ...attributes\\n id={{F.id}}\\n aria-describedby={{F.ariaDescribedBy}}\\n />\\n {{#if this.showVisibilityToggle}}\\n <Hds::Form::VisibilityToggle\\n @isVisible={{this.isPasswordMasked}}\\n @ariaLabel={{this.visibilityToggleAriaLabel}}\\n @ariaMessageText={{this.visibilityToggleAriaMessageText}}\\n aria-controls={{F.id}}\\n class=\\\"hds-form-text-input__visibility-toggle\\\"\\n {{on \\\"click\\\" this.onClickTogglePasswordReadability}}\\n />\\n {{/if}}\\n </div>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\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';\n\nexport default class HdsFormTextInputFieldComponent extends Component {\n @tracked isPasswordMasked = true;\n @tracked hasVisibilityToggle = this.args.hasVisibilityToggle ?? true;\n @tracked type = this.args.type ?? 'text';\n\n /**\n * @param showVisibilityToggle\n * @type {boolean}\n * @default false\n */\n get showVisibilityToggle() {\n return this.args.type === 'password' && this.hasVisibilityToggle;\n }\n\n /**\n * @param visibilityToggleAriaLabel\n * @type {string}\n * @default 'Show password'\n */\n get visibilityToggleAriaLabel() {\n if (this.args.visibilityToggleAriaLabel) {\n return this.args.visibilityToggleAriaLabel;\n } else if (this.isPasswordMasked) {\n return 'Show password';\n } else {\n return 'Hide password';\n }\n }\n\n /**\n * @param visibilityToggleAriaMessageText\n * @type {string}\n * @default 'Password is now hidden'\n */\n get visibilityToggleAriaMessageText() {\n if (this.args.visibilityToggleAriaMessageText) {\n return this.args.visibilityToggleAriaMessageText;\n } else if (this.isPasswordMasked) {\n return 'Password is hidden';\n } else {\n return 'Password is visible';\n }\n }\n\n @action\n onClickTogglePasswordReadability() {\n this.isPasswordMasked = !this.isPasswordMasked;\n this.type = this.isPasswordMasked ? 'password' : 'text';\n }\n}\n"],"names":["HdsFormTextInputFieldComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","showVisibilityToggle","type","hasVisibilityToggle","visibilityToggleAriaLabel","isPasswordMasked","visibilityToggleAriaMessageText","onClickTogglePasswordReadability","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,+jDAA+jD;;;ACQ5kDA,IAAAA,8BAA8B,IAAAC,MAAA,GAApC,MAAMD,8BAA8B,SAASE,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,2BAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,8BAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAAF,IAAAA,0BAAA,eAAAG,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAKpE;AACF;AACA;AACA;AACA;EACE,IAAIC,oBAAoBA,GAAG;IACzB,OAAO,IAAI,CAACL,IAAI,CAACM,IAAI,KAAK,UAAU,IAAI,IAAI,CAACC,mBAAmB,CAAA;AAClE,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,yBAAyBA,GAAG;AAC9B,IAAA,IAAI,IAAI,CAACR,IAAI,CAACQ,yBAAyB,EAAE;AACvC,MAAA,OAAO,IAAI,CAACR,IAAI,CAACQ,yBAAyB,CAAA;AAC5C,KAAC,MAAM,IAAI,IAAI,CAACC,gBAAgB,EAAE;AAChC,MAAA,OAAO,eAAe,CAAA;AACxB,KAAC,MAAM;AACL,MAAA,OAAO,eAAe,CAAA;AACxB,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,+BAA+BA,GAAG;AACpC,IAAA,IAAI,IAAI,CAACV,IAAI,CAACU,+BAA+B,EAAE;AAC7C,MAAA,OAAO,IAAI,CAACV,IAAI,CAACU,+BAA+B,CAAA;AAClD,KAAC,MAAM,IAAI,IAAI,CAACD,gBAAgB,EAAE;AAChC,MAAA,OAAO,oBAAoB,CAAA;AAC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B,MAAA,CAAAgB,SAAA,EAAA,kCAAA,CAAA,EAAAhB,MAAA,CAAAgB,SAAA,IAAAhB,MAAA,EAAA;AA5C0CyB,oBAAA,CAAAC,QAAA,
|
|
1
|
+
{"version":3,"file":"field.js","sources":["../../../../../src/components/hds/form/text-input/field.hbs","../../../../../src/components/hds/form/text-input/field.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield\\n (hash\\n Label=F.Label\\n isRequired=F.isRequired\\n isOptional=F.isOptional\\n HelperText=F.HelperText\\n Error=F.Error\\n CharacterCount=(component F.CharacterCount value=@value)\\n )\\n }}\\n <F.Control>\\n <div class=\\\"hds-form-text-input__wrapper\\\" {{style width=@width}}>\\n <Hds::Form::TextInput::Base\\n @type={{this.type}}\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n @isLoading={{@isLoading}}\\n @hasVisibilityToggle={{this.showVisibilityToggle}}\\n required={{@isRequired}}\\n ...attributes\\n id={{F.id}}\\n aria-describedby={{F.ariaDescribedBy}}\\n />\\n {{#if this.showVisibilityToggle}}\\n <Hds::Form::VisibilityToggle\\n @isVisible={{this.isPasswordMasked}}\\n @ariaLabel={{this.visibilityToggleAriaLabel}}\\n @ariaMessageText={{this.visibilityToggleAriaMessageText}}\\n aria-controls={{F.id}}\\n class=\\\"hds-form-text-input__visibility-toggle\\\"\\n {{on \\\"click\\\" this.onClickTogglePasswordReadability}}\\n />\\n {{/if}}\\n </div>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\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';\n\nexport default class HdsFormTextInputFieldComponent extends Component {\n @tracked isPasswordMasked = true;\n @tracked hasVisibilityToggle = this.args.hasVisibilityToggle ?? true;\n @tracked type = this.args.type ?? 'text';\n\n /**\n * @param showVisibilityToggle\n * @type {boolean}\n * @default false\n */\n get showVisibilityToggle() {\n return this.args.type === 'password' && this.hasVisibilityToggle;\n }\n\n /**\n * @param visibilityToggleAriaLabel\n * @type {string}\n * @default 'Show password'\n */\n get visibilityToggleAriaLabel() {\n if (this.args.visibilityToggleAriaLabel) {\n return this.args.visibilityToggleAriaLabel;\n } else if (this.isPasswordMasked) {\n return 'Show password';\n } else {\n return 'Hide password';\n }\n }\n\n /**\n * @param visibilityToggleAriaMessageText\n * @type {string}\n * @default 'Password is now hidden'\n */\n get visibilityToggleAriaMessageText() {\n if (this.args.visibilityToggleAriaMessageText) {\n return this.args.visibilityToggleAriaMessageText;\n } else if (this.isPasswordMasked) {\n return 'Password is hidden';\n } else {\n return 'Password is visible';\n }\n }\n\n @action\n onClickTogglePasswordReadability() {\n this.isPasswordMasked = !this.isPasswordMasked;\n this.type = this.isPasswordMasked ? 'password' : 'text';\n }\n}\n"],"names":["HdsFormTextInputFieldComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","showVisibilityToggle","type","hasVisibilityToggle","visibilityToggleAriaLabel","isPasswordMasked","visibilityToggleAriaMessageText","onClickTogglePasswordReadability","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,+jDAA+jD;;;ACQ5kDA,IAAAA,8BAA8B,IAAAC,MAAA,GAApC,MAAMD,8BAA8B,SAASE,SAAS,CA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
|
2
2
|
import { assert } from '@ember/debug';
|
|
3
|
+
import { HdsIconTileColorNeutral, HdsIconTileProductValues, HdsIconTileSizeValues } 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<div class={{this.classNames}} aria-hidden=\"true\" ...attributes>\n {{#if @icon}}\n <div class=\"hds-icon-tile__icon\">\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\n </div>\n {{/if}}\n {{#if @logo}}\n <div class=\"hds-icon-tile__logo\">\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\n </div>\n {{/if}}\n {{#if this.iconSecondary}}\n <div class=\"hds-icon-tile__extra\">\n <div class=\"hds-icon-tile__extra-icon\">\n <FlightIcon @name={{this.iconSecondary}} @size=\"16\" @stretched={{true}} />\n </div>\n </div>\n {{/if}}\n</div>");
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -12,10 +13,13 @@ var TEMPLATE = precompileTemplate("{{! @glint-nocheck: not typesafe yet }}\n{{!\
|
|
|
12
13
|
|
|
13
14
|
const DEFAULT_SIZE = 'medium';
|
|
14
15
|
const DEFAULT_COLOR = 'neutral';
|
|
15
|
-
const SIZES =
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const SIZES = Object.values(HdsIconTileSizeValues);
|
|
17
|
+
const COLORS = Object.values({
|
|
18
|
+
...HdsIconTileColorNeutral,
|
|
19
|
+
...HdsIconTileProductValues
|
|
20
|
+
});
|
|
21
|
+
const PRODUCTS = Object.values(HdsIconTileProductValues);
|
|
22
|
+
class HdsIconTileComponent extends Component {
|
|
19
23
|
/**
|
|
20
24
|
* Sets the size for the component
|
|
21
25
|
* Accepted values: small, medium, large
|
|
@@ -25,7 +29,7 @@ class HdsIconTileIndexComponent extends Component {
|
|
|
25
29
|
* @default 'medium'
|
|
26
30
|
*/
|
|
27
31
|
get size() {
|
|
28
|
-
|
|
32
|
+
const {
|
|
29
33
|
size = DEFAULT_SIZE
|
|
30
34
|
} = this.args;
|
|
31
35
|
assert(`@size for "Hds::IconTile" must be one of the following: ${SIZES.join(', ')}; received: ${size}`, SIZES.includes(size));
|
|
@@ -68,7 +72,7 @@ class HdsIconTileIndexComponent extends Component {
|
|
|
68
72
|
} else if (this.args.icon) {
|
|
69
73
|
return this.args.icon;
|
|
70
74
|
} else {
|
|
71
|
-
return
|
|
75
|
+
return undefined;
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
|
|
@@ -94,7 +98,7 @@ class HdsIconTileIndexComponent extends Component {
|
|
|
94
98
|
* @default null
|
|
95
99
|
*/
|
|
96
100
|
get logo() {
|
|
97
|
-
|
|
101
|
+
const {
|
|
98
102
|
logo
|
|
99
103
|
} = this.args;
|
|
100
104
|
if (logo) {
|
|
@@ -139,7 +143,7 @@ class HdsIconTileIndexComponent extends Component {
|
|
|
139
143
|
*/
|
|
140
144
|
// hds-icon-tile {{this.entityClass}} {{this.sizeClass}} {{this.colorClass}}"
|
|
141
145
|
get classNames() {
|
|
142
|
-
|
|
146
|
+
const classes = ['hds-icon-tile'];
|
|
143
147
|
|
|
144
148
|
// add a class based on its entity argument
|
|
145
149
|
classes.push(`hds-icon-tile--${this.entity}`);
|
|
@@ -152,7 +156,7 @@ class HdsIconTileIndexComponent extends Component {
|
|
|
152
156
|
return classes.join(' ');
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
|
-
setComponentTemplate(TEMPLATE,
|
|
159
|
+
setComponentTemplate(TEMPLATE, HdsIconTileComponent);
|
|
156
160
|
|
|
157
|
-
export { COLORS, DEFAULT_COLOR, DEFAULT_SIZE, PRODUCTS, SIZES,
|
|
161
|
+
export { COLORS, DEFAULT_COLOR, DEFAULT_SIZE, PRODUCTS, SIZES, HdsIconTileComponent as default };
|
|
158
162
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/icon-tile/index.hbs","../../../../src/components/hds/icon-tile/index.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/icon-tile/index.hbs","../../../../src/components/hds/icon-tile/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}} aria-hidden=\\\"true\\\" ...attributes>\\n {{#if @icon}}\\n <div class=\\\"hds-icon-tile__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </div>\\n {{/if}}\\n {{#if @logo}}\\n <div class=\\\"hds-icon-tile__logo\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </div>\\n {{/if}}\\n {{#if this.iconSecondary}}\\n <div class=\\\"hds-icon-tile__extra\\\">\\n <div class=\\\"hds-icon-tile__extra-icon\\\">\\n <FlightIcon @name={{this.iconSecondary}} @size=\\\"16\\\" @stretched={{true}} />\\n </div>\\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 HdsIconTileColorNeutral,\n HdsIconTileProductValues,\n HdsIconTileSizeValues,\n} from './types.ts';\n\nimport type {\n HdsIconTileColors,\n HdsIconTileProducts,\n HdsIconTileSizes,\n} from './types.ts';\n\nexport const DEFAULT_SIZE = 'medium';\nexport const DEFAULT_COLOR = 'neutral';\nexport const SIZES: string[] = Object.values(HdsIconTileSizeValues);\nexport const COLORS: string[] = Object.values({\n ...HdsIconTileColorNeutral,\n ...HdsIconTileProductValues,\n});\nexport const PRODUCTS: string[] = Object.values(HdsIconTileProductValues);\n\nexport interface HdsIconTileSignature {\n Args: {\n size?: HdsIconTileSizes;\n color?: HdsIconTileColors;\n logo?: HdsIconTileProducts;\n icon?: string | null;\n iconSecondary?: string;\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsIconTileComponent extends Component<HdsIconTileSignature> {\n /**\n * Sets the size for the component\n * Accepted values: small, medium, large\n *\n * @param size\n * @type {string}\n * @default 'medium'\n */\n get size() {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::IconTile\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Sets the color scheme for the component\n * Accepted values: see THE COLORS LIST\n *\n * @param color\n * @type {string}\n * @default 'neutral'\n */\n get color() {\n let { color = DEFAULT_COLOR } = this.args;\n\n // if it's a \"logo\" then we overwrite any @color parameter passed\n // and just use the product \"brand\" color\n if (this.logo) {\n color = this.logo;\n }\n\n assert(\n `@color for \"Hds::IconTile\" 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 * Sets the icon name (one of the FlightIcons)\n *\n * @param icon\n * @type {string|null}\n * @default null\n */\n get icon() {\n if (this.args.logo) {\n // for the logo version we use the colored versions directly\n return `${this.args.logo}-color`;\n } else if (this.args.icon) {\n return this.args.icon;\n } else {\n return undefined;\n }\n }\n\n /**\n * @param iconSize\n * @type {string}\n * @default 16\n * @description ensures that the correct icon size is used. Automatically calculated.\n */\n get iconSize() {\n if (this.args.size === 'small') {\n return '16';\n } else {\n return '24';\n }\n }\n\n /**\n * Sets the logo name if there is one\n *\n * @param logo\n * @type {string|null}\n * @default null\n */\n get logo() {\n const { logo } = this.args;\n\n if (logo) {\n assert(\n `@logo for \"Hds::IconTile\" must be one of the following: ${PRODUCTS.join(\n ', '\n )}; received: ${logo}`,\n PRODUCTS.includes(logo)\n );\n }\n\n return logo ?? null;\n }\n\n /**\n * We need to differentiate between a logo and an icon\n * @method IconTile#entity\n * @return {string} The kind of entity we're dealing with (\"logo\" or \"icon\")\n */\n get entity() {\n let entity;\n\n assert(\n `you can't pass both @logo and @icon properties to the \"Hds::IconTile\" component`,\n !(this.args.logo && this.args.icon)\n );\n\n assert(\n `you need to pass @logo or @icon to the \"Hds::IconTile\" component`,\n !(this.args.logo === undefined && this.args.icon === undefined)\n );\n\n if (this.args.logo) {\n entity = 'logo';\n }\n if (this.args.icon) {\n entity = 'icon';\n }\n\n return entity;\n }\n\n /**\n * Sets the \"secondary\" icon name (one of the FlightIcons)\n *\n * @param iconSecondary\n * @type {string|null}\n * @default null\n */\n get iconSecondary() {\n return this.args.iconSecondary ?? null;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method IconTile#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n // hds-icon-tile {{this.entityClass}} {{this.sizeClass}} {{this.colorClass}}\"\n get classNames() {\n const classes = ['hds-icon-tile'];\n\n // add a class based on its entity argument\n classes.push(`hds-icon-tile--${this.entity}`);\n\n // add a class based on the @size argument\n classes.push(`hds-icon-tile--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-icon-tile--color-${this.color}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_SIZE","DEFAULT_COLOR","SIZES","Object","values","HdsIconTileSizeValues","COLORS","HdsIconTileColorNeutral","HdsIconTileProductValues","PRODUCTS","HdsIconTileComponent","Component","size","args","assert","join","includes","color","logo","icon","undefined","iconSize","entity","iconSecondary","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,4tBAA4tB;;ACD9vB;AACA;AACA;AACA;;AAiBO,MAAMA,YAAY,GAAG,SAAQ;AAC7B,MAAMC,aAAa,GAAG,UAAS;AAC/B,MAAMC,KAAe,GAAGC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AChE,CAAC,CAAA;AAED,IAAA,IAAI,IAAI,CAACP,IAAI,CAACK,IAAI,EAAE;AAClBI,MAAAA,MAAM,GAAG,MAAM,CAAA;AACjB,KAAA;AACA,IAAA,IAAI,IAAI,CAACT,IAAI,CAACM,IAAI,EAAE;AAClBG,MAAAA,MAAM,GAAG,MAAM,CAAA;AACjB,KAAA;AAEA,IAAA,OAAOA,MAAM,CAAA;AACf,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,aAAaA,GAAG;AAClB,IAAA,OAAO,IAAI,CAACV,IAAI,CAACU,aAAa,IAAI,IAAI,CAAA;AACxC,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACE;EACA,IAAIC,UAAUA,GAAG;AACf,IAAA,MAAMC,OAAO,GAAG,CAAC,eAAe,CAAC,CAAA;;AAEjC;IACAA,OAAO,CAACC,IAAI,CAAE,CAAA,eAAA,EAAiB,IAAI,CAACJ,MAAO,EAAC,CAAC,CAAA;;AAE7C;IACAG,OAAO,CAACC,IAAI,CAAE,CAAA,oBAAA,EAAsB,IAAI,CAACd,IAAK,EAAC,CAAC,CAAA;;AAEhD;IACAa,OAAO,CAACC,IAAI,CAAE,CAAA,qBAAA,EAAuB,IAAI,CAACT,KAAM,EAAC,CAAC,CAAA;AAElD,IAAA,OAAOQ,OAAO,CAACV,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACY,oBAAA,CAAAC,QAAA,EAlKoBlB,oBAAoB,CAAA;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
let HdsIconTileSizeValues = /*#__PURE__*/function (HdsIconTileSizeValues) {
|
|
7
|
+
HdsIconTileSizeValues["Small"] = "small";
|
|
8
|
+
HdsIconTileSizeValues["Medium"] = "medium";
|
|
9
|
+
HdsIconTileSizeValues["Large"] = "large";
|
|
10
|
+
return HdsIconTileSizeValues;
|
|
11
|
+
}({});
|
|
12
|
+
let HdsIconTileProductValues = /*#__PURE__*/function (HdsIconTileProductValues) {
|
|
13
|
+
HdsIconTileProductValues["Boundary"] = "boundary";
|
|
14
|
+
HdsIconTileProductValues["Consul"] = "consul";
|
|
15
|
+
HdsIconTileProductValues["HCP"] = "hcp";
|
|
16
|
+
HdsIconTileProductValues["Nomad"] = "nomad";
|
|
17
|
+
HdsIconTileProductValues["Packer"] = "packer";
|
|
18
|
+
HdsIconTileProductValues["Terraform"] = "terraform";
|
|
19
|
+
HdsIconTileProductValues["Vagrant"] = "vagrant";
|
|
20
|
+
HdsIconTileProductValues["Vault"] = "vault";
|
|
21
|
+
HdsIconTileProductValues["Vault Secrets"] = "vault-secrets";
|
|
22
|
+
HdsIconTileProductValues["Vault Radar"] = "vault-radar";
|
|
23
|
+
HdsIconTileProductValues["Waypoint"] = "waypoint";
|
|
24
|
+
return HdsIconTileProductValues;
|
|
25
|
+
}({});
|
|
26
|
+
let HdsIconTileColorNeutral = /*#__PURE__*/function (HdsIconTileColorNeutral) {
|
|
27
|
+
HdsIconTileColorNeutral["Neutral"] = "neutral";
|
|
28
|
+
return HdsIconTileColorNeutral;
|
|
29
|
+
}({});
|
|
30
|
+
|
|
31
|
+
export { HdsIconTileColorNeutral, HdsIconTileProductValues, HdsIconTileSizeValues };
|
|
32
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/hds/icon-tile/types.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsIconTileSizeValues {\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\n\nexport type HdsIconTileSizes = `${HdsIconTileSizeValues}`;\n\nexport enum HdsIconTileProductValues {\n Boundary = 'boundary',\n Consul = 'consul',\n HCP = 'hcp',\n Nomad = 'nomad',\n Packer = 'packer',\n Terraform = 'terraform',\n Vagrant = 'vagrant',\n Vault = 'vault',\n 'Vault Secrets' = 'vault-secrets',\n 'Vault Radar' = 'vault-radar',\n Waypoint = 'waypoint',\n}\n\nexport type HdsIconTileProducts = `${HdsIconTileProductValues}`;\n\nexport enum HdsIconTileColorNeutral {\n Neutral = 'neutral',\n}\n\nexport type HdsIconTileColors =\n | HdsIconTileProductValues\n | HdsIconTileColorNeutral;\n"],"names":["HdsIconTileSizeValues","HdsIconTileProductValues","HdsIconTileColorNeutral"],"mappings":"AAAA;AACA;AACA;AACA;;AAEYA,IAAAA,qBAAqB,0BAArBA,qBAAqB,EAAA;EAArBA,qBAAqB,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;EAArBA,qBAAqB,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAArBA,qBAAqB,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAArBA,qBAAqB,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAQrBC,IAAAA,wBAAwB,0BAAxBA,wBAAwB,EAAA;EAAxBA,wBAAwB,CAAA,UAAA,CAAA,GAAA,UAAA,CAAA;EAAxBA,wBAAwB,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAAxBA,wBAAwB,CAAA,KAAA,CAAA,GAAA,KAAA,CAAA;EAAxBA,wBAAwB,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;EAAxBA,wBAAwB,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAAxBA,wBAAwB,CAAA,WAAA,CAAA,GAAA,WAAA,CAAA;EAAxBA,wBAAwB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;EAAxBA,wBAAwB,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;EAAxBA,wBAAwB,CAAA,eAAA,CAAA,GAAA,eAAA,CAAA;EAAxBA,wBAAwB,CAAA,aAAA,CAAA,GAAA,aAAA,CAAA;EAAxBA,wBAAwB,CAAA,UAAA,CAAA,GAAA,UAAA,CAAA;AAAA,EAAA,OAAxBA,wBAAwB,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAgBxBC,IAAAA,uBAAuB,0BAAvBA,uBAAuB,EAAA;EAAvBA,uBAAuB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;AAAA,EAAA,OAAvBA,uBAAuB,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as _applyDecoratedDescriptor } from '../../../_rollupPluginBabelHelpers-NoJJJNhk.js';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
4
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
@@ -7,7 +7,7 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
7
7
|
var TEMPLATE = precompileTemplate("{{! IMPORTANT: we removed the newlines before/after the yield to reduce the issues with unexpected whitespaces (see https://github.com/hashicorp/design-system/pull/231#issuecomment-1123502499) }}\n{{! IMPORTANT: we need to add \"squishies\" here (~) because otherwise the whitespace added by Ember becomes visible in the link (being an inline element) - See https://handlebarsjs.com/guide/expressions.html#whitespace-control }}\n{{! NOTICE: we can\'t support the direct use of the \"href\" HTML attribute via ...attributes in the <a> elements, because we need to rely on the \"@href\" Ember argument to differentiate between different types of generated output }}\n{{~#if @route~}}\n {{~#if this.isRouteExternal~}}\n <LinkToExternal\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 ...attributes\n >{{yield}}</LinkToExternal>\n {{~else~}}\n <LinkTo\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 ...attributes\n >{{yield}}</LinkTo>\n {{~/if~}}\n{{~else if @href~}}\n {{~#if this.isHrefExternal~}}\n <a target=\"_blank\" rel=\"noopener noreferrer\" ...attributes href={{@href}} {{on \"keyup\" this.onKeyUp}}>{{yield}}</a>\n {{~else~}}\n <a ...attributes href={{@href}} {{on \"keyup\" this.onKeyUp}}>{{yield}}</a>\n {{~/if~}}\n{{~else~}}\n <button type=\"button\" ...attributes>{{yield}}</button>\n{{~/if~}}");
|
|
8
8
|
|
|
9
9
|
var _class;
|
|
10
|
-
let
|
|
10
|
+
let HdsInteractiveComponent = (_class = class HdsInteractiveComponent extends Component {
|
|
11
11
|
/**
|
|
12
12
|
* Determines if a @href value is "external" (it adds target="_blank" rel="noopener noreferrer")
|
|
13
13
|
*
|
|
@@ -35,7 +35,7 @@ let HdsInteractiveIndexComponent = (_class = class HdsInteractiveIndexComponent
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}, (_applyDecoratedDescriptor(_class.prototype, "onKeyUp", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onKeyUp"), _class.prototype)), _class);
|
|
38
|
-
setComponentTemplate(TEMPLATE,
|
|
38
|
+
setComponentTemplate(TEMPLATE, HdsInteractiveComponent);
|
|
39
39
|
|
|
40
|
-
export {
|
|
40
|
+
export { HdsInteractiveComponent as default };
|
|
41
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/interactive/index.hbs","../../../../src/components/hds/interactive/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! IMPORTANT: we removed the newlines before/after the yield to reduce the issues with unexpected whitespaces (see https://github.com/hashicorp/design-system/pull/231#issuecomment-1123502499) }}\\n{{! IMPORTANT: we need to add \\\"squishies\\\" here (~) because otherwise the whitespace added by Ember becomes visible in the link (being an inline element) - See https://handlebarsjs.com/guide/expressions.html#whitespace-control }}\\n{{! NOTICE: we can\\'t support the direct use of the \\\"href\\\" HTML attribute via ...attributes in the <a> elements, because we need to rely on the \\\"@href\\\" Ember argument to differentiate between different types of generated output }}\\n{{~#if @route~}}\\n {{~#if this.isRouteExternal~}}\\n <LinkToExternal\\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 ...attributes\\n >{{yield}}</LinkToExternal>\\n {{~else~}}\\n <LinkTo\\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 ...attributes\\n >{{yield}}</LinkTo>\\n {{~/if~}}\\n{{~else if @href~}}\\n {{~#if this.isHrefExternal~}}\\n <a target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\" ...attributes href={{@href}} {{on \\\"keyup\\\" this.onKeyUp}}>{{yield}}</a>\\n {{~else~}}\\n <a ...attributes href={{@href}} {{on \\\"keyup\\\" this.onKeyUp}}>{{yield}}</a>\\n {{~/if~}}\\n{{~else~}}\\n <button type=\\\"button\\\" ...attributes>{{yield}}</button>\\n{{~/if~}}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\n\nexport interface HdsInteractiveSignature {\n Args: {\n href?: string;\n isHrefExternal?: boolean;\n isRouteExternal?: boolean;\n route?: string;\n models?: Array<string | number>;\n model?: string | number;\n query?: Record<string, string>;\n 'current-when'?: string;\n replace?: boolean;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLAnchorElement | HTMLButtonElement;\n}\n\nexport default class
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/interactive/index.hbs","../../../../src/components/hds/interactive/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! IMPORTANT: we removed the newlines before/after the yield to reduce the issues with unexpected whitespaces (see https://github.com/hashicorp/design-system/pull/231#issuecomment-1123502499) }}\\n{{! IMPORTANT: we need to add \\\"squishies\\\" here (~) because otherwise the whitespace added by Ember becomes visible in the link (being an inline element) - See https://handlebarsjs.com/guide/expressions.html#whitespace-control }}\\n{{! NOTICE: we can\\'t support the direct use of the \\\"href\\\" HTML attribute via ...attributes in the <a> elements, because we need to rely on the \\\"@href\\\" Ember argument to differentiate between different types of generated output }}\\n{{~#if @route~}}\\n {{~#if this.isRouteExternal~}}\\n <LinkToExternal\\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 ...attributes\\n >{{yield}}</LinkToExternal>\\n {{~else~}}\\n <LinkTo\\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 ...attributes\\n >{{yield}}</LinkTo>\\n {{~/if~}}\\n{{~else if @href~}}\\n {{~#if this.isHrefExternal~}}\\n <a target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\" ...attributes href={{@href}} {{on \\\"keyup\\\" this.onKeyUp}}>{{yield}}</a>\\n {{~else~}}\\n <a ...attributes href={{@href}} {{on \\\"keyup\\\" this.onKeyUp}}>{{yield}}</a>\\n {{~/if~}}\\n{{~else~}}\\n <button type=\\\"button\\\" ...attributes>{{yield}}</button>\\n{{~/if~}}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\n\nexport interface HdsInteractiveSignature {\n Args: {\n href?: string;\n isHrefExternal?: boolean;\n isRouteExternal?: boolean;\n route?: string;\n models?: Array<string | number>;\n model?: string | number;\n query?: Record<string, string>;\n 'current-when'?: string;\n replace?: boolean;\n };\n Blocks: {\n default: [];\n };\n Element: HTMLAnchorElement | HTMLButtonElement;\n}\n\nexport default class HdsInteractiveComponent extends Component<HdsInteractiveSignature> {\n /**\n * Determines if a @href value is \"external\" (it adds target=\"_blank\" rel=\"noopener noreferrer\")\n *\n * @param isHrefExternal\n * @type boolean\n * @default true\n */\n get isHrefExternal() {\n return this.args.isHrefExternal ?? true;\n }\n\n /**\n * Determines if a @route value is \"external\" (uses the LinkToExternal component instead of LinkTo)\n *\n * @param isRouteExternal\n * @type boolean\n * @default false\n */\n get isRouteExternal() {\n return this.args.isRouteExternal ?? false;\n }\n\n @action\n onKeyUp(event: KeyboardEvent) {\n if (event.key === ' ' || event.code === 'Space') {\n (event.target as HTMLElement).click();\n }\n }\n}\n"],"names":["HdsInteractiveComponent","_class","Component","isHrefExternal","args","isRouteExternal","onKeyUp","event","key","code","target","click","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,4lDAA4lD;;;ACyBzmDA,IAAAA,uBAAuB,IAAAC,MAAA,GAA7B,MAAMD,uBAAuB,SAASE,SAAS,CAA0B;AACtF;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,cAAcA,GAAG;AACnB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,cAAc,IAAI,IAAI,CAAA;AACzC,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIE,eAAeA,GAAG;AACpB,IAAA,OAAO,IAAI,CAACD,IAAI,CAACC,eAAe,IAAI,KAAK,CAAA;AAC3C,GAAA;EAGAC,OAAOA,CAACC,KAAoB,EAAE;IAC5B,IAAIA,KAAK,CAACC,GAAG,KAAK,GAAG,IAAID,KAAK,CAACE,IAAI,KAAK,OAAO,EAAE;AAC9CF,MAAAA,KAAK,CAACG,MAAM,CAAiBC,KAAK,EAAE,CAAA;AACvC,KAAA;AACF,GAAA;AACF,CAAC,GAAAC,yBAAA,CAAAX,MAAA,CAAAY,SAAA,EAAA,SAAA,EAAA,CANEC,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAf,MAAA,CAAAY,SAAA,cAAAZ,MAAA,CAAAY,SAAA,CAAA,GAAAZ,MAAA,EAAA;AAvBmCgB,oBAAA,CAAAC,QAAA,EAAvBlB,uBAAuB,CAAA;;;;"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { assert } from '@ember/debug';
|
|
3
|
+
import { HdsLinkIconPositionValues, HdsLinkColorValues } 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("{{! IMPORTANT: we removed the newlines before/after the yield to reduce the issues with unexpected whitespaces (see https://github.com/hashicorp/design-system/pull/231#issuecomment-1123502499) }}\n{{! IMPORTANT: we need to add \"squishies\" here (~) because otherwise the whitespace added by Ember becomes visible in the link (being an inline element) - See https://handlebarsjs.com/guide/expressions.html#whitespace-control }}\n<Hds::Interactive\n class={{this.classNames}}\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>{{#if (and @icon (eq this.iconPosition \"leading\"))~}}\n <span class=\"hds-link-inline__icon hds-link-inline__icon--leading\">\n <FlightIcon @name={{@icon}} @size=\"16\" @stretched={{true}} />\n </span>\n {{~/if~}}{{yield}}{{~#if (and @icon (eq this.iconPosition \"trailing\"))~}}\n <span class=\"hds-link-inline__icon hds-link-inline__icon--trailing\">\n <FlightIcon @name={{@icon}} @size=\"16\" @stretched={{true}} />\n </span>\n {{~/if}}</Hds::Interactive>");
|
|
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_ICONPOSITION =
|
|
14
|
-
const DEFAULT_COLOR =
|
|
15
|
-
const ICONPOSITIONS =
|
|
16
|
-
const COLORS =
|
|
14
|
+
const DEFAULT_ICONPOSITION = HdsLinkIconPositionValues.Trailing;
|
|
15
|
+
const DEFAULT_COLOR = HdsLinkColorValues.Primary;
|
|
16
|
+
const ICONPOSITIONS = Object.values(HdsLinkIconPositionValues);
|
|
17
|
+
const COLORS = Object.values(HdsLinkColorValues);
|
|
17
18
|
class HdsLinkInlineComponent extends Component {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(
|
|
19
|
+
constructor(owner, args) {
|
|
20
|
+
super(owner, args);
|
|
20
21
|
if (!(this.args.href || this.args.route)) {
|
|
21
22
|
assert('@href or @route must be defined for <Hds::Link::Inline>');
|
|
22
23
|
}
|
|
@@ -29,7 +30,7 @@ class HdsLinkInlineComponent extends Component {
|
|
|
29
30
|
* @description Determines the color of link to be used; acceptable values are `primary` and `secondary`
|
|
30
31
|
*/
|
|
31
32
|
get color() {
|
|
32
|
-
|
|
33
|
+
const {
|
|
33
34
|
color = DEFAULT_COLOR
|
|
34
35
|
} = this.args;
|
|
35
36
|
assert(`@color for "Hds::Link::Inline" must be one of the following: ${COLORS.join(', ')}; received: ${color}`, COLORS.includes(color));
|
|
@@ -43,7 +44,7 @@ class HdsLinkInlineComponent extends Component {
|
|
|
43
44
|
* @description Positions the icon before or after the text; allowed values are `leading` or `trailing`
|
|
44
45
|
*/
|
|
45
46
|
get iconPosition() {
|
|
46
|
-
|
|
47
|
+
const {
|
|
47
48
|
iconPosition = DEFAULT_ICONPOSITION
|
|
48
49
|
} = this.args;
|
|
49
50
|
assert(`@iconPosition for "Hds::Link::Inline" must be one of the following: ${ICONPOSITIONS.join(', ')}; received: ${iconPosition}`, ICONPOSITIONS.includes(iconPosition));
|
|
@@ -56,7 +57,7 @@ class HdsLinkInlineComponent extends Component {
|
|
|
56
57
|
* @return {string} The "class" attribute to apply to the component.
|
|
57
58
|
*/
|
|
58
59
|
get classNames() {
|
|
59
|
-
|
|
60
|
+
const classes = ['hds-link-inline'];
|
|
60
61
|
|
|
61
62
|
// add a class based on the @color argument
|
|
62
63
|
classes.push(`hds-link-inline--color-${this.color}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.js","sources":["../../../../src/components/hds/link/inline.hbs","../../../../src/components/hds/link/inline.
|
|
1
|
+
{"version":3,"file":"inline.js","sources":["../../../../src/components/hds/link/inline.hbs","../../../../src/components/hds/link/inline.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! IMPORTANT: we removed the newlines before/after the yield to reduce the issues with unexpected whitespaces (see https://github.com/hashicorp/design-system/pull/231#issuecomment-1123502499) }}\\n{{! IMPORTANT: we need to add \\\"squishies\\\" here (~) because otherwise the whitespace added by Ember becomes visible in the link (being an inline element) - See https://handlebarsjs.com/guide/expressions.html#whitespace-control }}\\n<Hds::Interactive\\n class={{this.classNames}}\\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>{{#if (and @icon (eq this.iconPosition \\\"leading\\\"))~}}\\n <span class=\\\"hds-link-inline__icon hds-link-inline__icon--leading\\\">\\n <FlightIcon @name={{@icon}} @size=\\\"16\\\" @stretched={{true}} />\\n </span>\\n {{~/if~}}{{yield}}{{~#if (and @icon (eq this.iconPosition \\\"trailing\\\"))~}}\\n <span class=\\\"hds-link-inline__icon hds-link-inline__icon--trailing\\\">\\n <FlightIcon @name={{@icon}} @size=\\\"16\\\" @stretched={{true}} />\\n </span>\\n {{~/if}}</Hds::Interactive>\")","/**\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 { HdsLinkColorValues, HdsLinkIconPositionValues } from './types.ts';\n\nimport type { HdsInteractiveSignature } from '../interactive/';\nimport type { HdsLinkColors, HdsLinkIconPositions } from './types.ts';\n\nexport const DEFAULT_ICONPOSITION = HdsLinkIconPositionValues.Trailing;\nexport const DEFAULT_COLOR = HdsLinkColorValues.Primary;\nexport const ICONPOSITIONS: string[] = Object.values(HdsLinkIconPositionValues);\nexport const COLORS: string[] = Object.values(HdsLinkColorValues);\n\nexport interface HdsLinkInlineSignature {\n Args: HdsInteractiveSignature['Args'] & {\n color?: HdsLinkColors;\n icon?: string;\n iconPosition?: HdsLinkIconPositions;\n };\n Blocks: {\n default: [];\n };\n Element: HdsInteractiveSignature['Element'];\n}\n\nexport default class HdsLinkInlineComponent extends Component<HdsLinkInlineSignature> {\n constructor(owner: unknown, args: HdsLinkInlineSignature['Args']) {\n super(owner, args);\n if (!(this.args.href || this.args.route)) {\n assert('@href or @route must be defined for <Hds::Link::Inline>');\n }\n }\n\n /**\n * @param color\n * @type {string}\n * @default primary\n * @description Determines the color of link to be used; acceptable values are `primary` and `secondary`\n */\n get color() {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Link::Inline\" 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 iconPosition\n * @type {string}\n * @default leading\n * @description Positions the icon before or after the text; allowed values are `leading` or `trailing`\n */\n get iconPosition() {\n const { iconPosition = DEFAULT_ICONPOSITION } = this.args;\n\n assert(\n `@iconPosition for \"Hds::Link::Inline\" must be one of the following: ${ICONPOSITIONS.join(\n ', '\n )}; received: ${iconPosition}`,\n ICONPOSITIONS.includes(iconPosition)\n );\n\n return iconPosition;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method LinkInline#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n const classes = ['hds-link-inline'];\n\n // add a class based on the @color argument\n classes.push(`hds-link-inline--color-${this.color}`);\n\n // add a class based on the @iconPosition argument\n classes.push(`hds-link-inline--icon-${this.iconPosition}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_ICONPOSITION","HdsLinkIconPositionValues","Trailing","DEFAULT_COLOR","HdsLinkColorValues","Primary","ICONPOSITIONS","Object","values","COLORS","HdsLinkInlineComponent","Component","constructor","owner","args","href","route","assert","color","join","includes","iconPosition","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,iuCAAiuC;;ACDnwC;AACA;AACA;AACA;;AASaA,MAAAA,oBAAoB,GAAGC,yBAAyB,CAACC,SAAQ;AACzDC,MAAAA,aAAa,GAAGC,kBAAkB,CAACC,QAAO;AAChD,MAAMC,aAAuB,GAAGC,MAAM,CAACC,MAAM,CAACP,yBAAyB,EAAC;AACxE,MAAMQ,MAAgB,GAAGF,MAAM,CAACC,MAAM,CAACJ,kBAAkB,EAAC;AAclD,MAAMM,sBAAsB,SAASC,SAAS,CAAyB;AACpFC,EAAAA,WAAWA,CAACC,KAAc,EAAEC,IAAoC,EAAE;AAChE,IAAA,KAAK,CAACD,KAAK,EAAEC,IAAI,CAAC,CAAA;AAClB,IAAA,IAAI,EAAE,IAAI,CAACA,IAAI,CAACC,IAAI,IAAI,IAAI,CAACD,IAAI,CAACE,KAAK,CAAC,EAAE;MACxCC,MAAM,CAAC,yDAAyD,CAAC,CAAA;AACnE,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,KAAKA,GAAG;IACV,MAAM;AAAEA,MAAAA,KAAK,GAAGf,aAAAA;KAAe,GAAG,IAAI,CAACW,IAAI,CAAA;AAE3CG,IAAAA,MAAM,CACH,CAA+DR,6DAAAA,EAAAA,MAAM,CAACU,IAAI,CACzE,IACF,CAAE,CAAA,YAAA,EAAcD,KAAM,CAAA,CAAC,EACvBT,MAAM,CAACW,QAAQ,CAACF,KAAK,CACvB,CAAC,CAAA;AAED,IAAA,OAAOA,KAAK,CAAA;AACd,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIG,YAAYA,GAAG;IACjB,MAAM;AAAEA,MAAAA,YAAY,GAAGrB,oBAAAA;KAAsB,GAAG,IAAI,CAACc,IAAI,CAAA;AAEzDG,IAAAA,MAAM,CACH,CAAsEX,oEAAAA,EAAAA,aAAa,CAACa,IAAI,CACvF,IACF,CAAE,CAAA,YAAA,EAAcE,YAAa,CAAA,CAAC,EAC9Bf,aAAa,CAACc,QAAQ,CAACC,YAAY,CACrC,CAAC,CAAA;AAED,IAAA,OAAOA,YAAY,CAAA;AACrB,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,UAAUA,GAAG;AACf,IAAA,MAAMC,OAAO,GAAG,CAAC,iBAAiB,CAAC,CAAA;;AAEnC;IACAA,OAAO,CAACC,IAAI,CAAE,CAAA,uBAAA,EAAyB,IAAI,CAACN,KAAM,EAAC,CAAC,CAAA;;AAEpD;IACAK,OAAO,CAACC,IAAI,CAAE,CAAA,sBAAA,EAAwB,IAAI,CAACH,YAAa,EAAC,CAAC,CAAA;AAE1D,IAAA,OAAOE,OAAO,CAACJ,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACM,oBAAA,CAAAC,QAAA,EA9DoBhB,sBAAsB,CAAA;;;;"}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { assert } from '@ember/debug';
|
|
3
|
+
import { HdsLinkIconPositionValues, HdsLinkColorValues, HdsLinkStandaloneSizeValues } 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("<Hds::Interactive\n class={{this.classNames}}\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 (eq this.iconPosition \"leading\")}}\n <span class=\"hds-link-standalone__icon\">\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\n </span>\n <span class=\"hds-link-standalone__text\">\n {{this.text}}\n </span>\n {{else}}\n <span class=\"hds-link-standalone__text\">\n {{this.text}}\n </span>\n <span class=\"hds-link-standalone__icon\">\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\n </span>\n {{/if}}\n</Hds::Interactive>");
|
|
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_ICONPOSITION =
|
|
14
|
-
const DEFAULT_COLOR =
|
|
15
|
-
const DEFAULT_SIZE =
|
|
16
|
-
const ICONPOSITIONS =
|
|
17
|
-
const COLORS =
|
|
18
|
-
const SIZES =
|
|
14
|
+
const DEFAULT_ICONPOSITION = HdsLinkIconPositionValues.Leading;
|
|
15
|
+
const DEFAULT_COLOR = HdsLinkColorValues.Primary;
|
|
16
|
+
const DEFAULT_SIZE = HdsLinkStandaloneSizeValues.Medium;
|
|
17
|
+
const ICONPOSITIONS = Object.values(HdsLinkIconPositionValues);
|
|
18
|
+
const COLORS = Object.values(HdsLinkColorValues);
|
|
19
|
+
const SIZES = Object.values(HdsLinkStandaloneSizeValues);
|
|
19
20
|
class HdsLinkStandaloneComponent extends Component {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(
|
|
21
|
+
constructor(owner, args) {
|
|
22
|
+
super(owner, args);
|
|
22
23
|
if (!(this.args.href || this.args.route)) {
|
|
23
24
|
assert('@href or @route must be defined for <Hds::Link::Standalone>');
|
|
24
25
|
}
|
|
@@ -30,7 +31,7 @@ class HdsLinkStandaloneComponent extends Component {
|
|
|
30
31
|
* @description The text of the link. If no text value is defined an error will be thrown.
|
|
31
32
|
*/
|
|
32
33
|
get text() {
|
|
33
|
-
|
|
34
|
+
const {
|
|
34
35
|
text
|
|
35
36
|
} = this.args;
|
|
36
37
|
assert('@text for "Hds::Link::Standalone" must have a valid value', text !== undefined);
|
|
@@ -44,7 +45,7 @@ class HdsLinkStandaloneComponent extends Component {
|
|
|
44
45
|
* @description Determines the color of link to be used; acceptable values are `primary` and `secondary`
|
|
45
46
|
*/
|
|
46
47
|
get color() {
|
|
47
|
-
|
|
48
|
+
const {
|
|
48
49
|
color = DEFAULT_COLOR
|
|
49
50
|
} = this.args;
|
|
50
51
|
assert(`@color for "Hds::Link::Standalone" must be one of the following: ${COLORS.join(', ')}; received: ${color}`, COLORS.includes(color));
|
|
@@ -58,7 +59,7 @@ class HdsLinkStandaloneComponent extends Component {
|
|
|
58
59
|
* @description The name of the icon to be used. An icon name must be defined.
|
|
59
60
|
*/
|
|
60
61
|
get icon() {
|
|
61
|
-
|
|
62
|
+
const {
|
|
62
63
|
icon
|
|
63
64
|
} = this.args;
|
|
64
65
|
assert('@icon for "Hds::Link::Standalone" must have a valid value', icon !== undefined);
|
|
@@ -72,7 +73,7 @@ class HdsLinkStandaloneComponent extends Component {
|
|
|
72
73
|
* @description Positions the icon before or after the text; allowed values are `leading` or `trailing`
|
|
73
74
|
*/
|
|
74
75
|
get iconPosition() {
|
|
75
|
-
|
|
76
|
+
const {
|
|
76
77
|
iconPosition = DEFAULT_ICONPOSITION
|
|
77
78
|
} = this.args;
|
|
78
79
|
assert(`@iconPosition for "Hds::Link::Standalone" must be one of the following: ${ICONPOSITIONS.join(', ')}; received: ${iconPosition}`, ICONPOSITIONS.includes(iconPosition));
|
|
@@ -86,7 +87,7 @@ class HdsLinkStandaloneComponent extends Component {
|
|
|
86
87
|
* @description The size of the standalone link; acceptable values are `small`, `medium`, and `large`
|
|
87
88
|
*/
|
|
88
89
|
get size() {
|
|
89
|
-
|
|
90
|
+
const {
|
|
90
91
|
size = DEFAULT_SIZE
|
|
91
92
|
} = this.args;
|
|
92
93
|
assert(`@size for "Hds::Link::Standalone" must be one of the following: ${SIZES.join(', ')}; received: ${size}`, SIZES.includes(size));
|
|
@@ -113,7 +114,7 @@ class HdsLinkStandaloneComponent extends Component {
|
|
|
113
114
|
* @return {string} The "class" attribute to apply to the component.
|
|
114
115
|
*/
|
|
115
116
|
get classNames() {
|
|
116
|
-
|
|
117
|
+
const classes = ['hds-link-standalone'];
|
|
117
118
|
|
|
118
119
|
// add a class based on the @size argument
|
|
119
120
|
classes.push(`hds-link-standalone--size-${this.size}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standalone.js","sources":["../../../../src/components/hds/link/standalone.hbs","../../../../src/components/hds/link/standalone.
|
|
1
|
+
{"version":3,"file":"standalone.js","sources":["../../../../src/components/hds/link/standalone.hbs","../../../../src/components/hds/link/standalone.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"<Hds::Interactive\\n class={{this.classNames}}\\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 (eq this.iconPosition \\\"leading\\\")}}\\n <span class=\\\"hds-link-standalone__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </span>\\n <span class=\\\"hds-link-standalone__text\\\">\\n {{this.text}}\\n </span>\\n {{else}}\\n <span class=\\\"hds-link-standalone__text\\\">\\n {{this.text}}\\n </span>\\n <span class=\\\"hds-link-standalone__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </span>\\n {{/if}}\\n</Hds::Interactive>\")","/**\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 {\n HdsLinkIconPositionValues,\n HdsLinkColorValues,\n HdsLinkStandaloneSizeValues,\n} from './types.ts';\n\nimport type { HdsInteractiveSignature } from '../interactive/';\nimport type {\n HdsLinkColors,\n HdsLinkIconPositions,\n HdsLinkStandaloneSizes,\n} from './types.ts';\n\nexport interface HdsLinkStandaloneSignature {\n Args: HdsInteractiveSignature['Args'] & {\n size?: HdsLinkStandaloneSizes;\n color?: HdsLinkColors;\n text: string;\n icon: string;\n iconPosition?: HdsLinkIconPositions;\n };\n Element: HdsInteractiveSignature['Element'];\n}\n\nexport const DEFAULT_ICONPOSITION = HdsLinkIconPositionValues.Leading;\nexport const DEFAULT_COLOR = HdsLinkColorValues.Primary;\nexport const DEFAULT_SIZE = HdsLinkStandaloneSizeValues.Medium;\nexport const ICONPOSITIONS: string[] = Object.values(HdsLinkIconPositionValues);\nexport const COLORS: string[] = Object.values(HdsLinkColorValues);\nexport const SIZES: string[] = Object.values(HdsLinkStandaloneSizeValues);\n\nexport default class HdsLinkStandaloneComponent extends Component<HdsLinkStandaloneSignature> {\n constructor(owner: unknown, args: HdsLinkStandaloneSignature['Args']) {\n super(owner, args);\n if (!(this.args.href || this.args.route)) {\n assert('@href or @route must be defined for <Hds::Link::Standalone>');\n }\n }\n\n /**\n * @param text\n * @type {string}\n * @description The text of the link. 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::Link::Standalone\" 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 link 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::Link::Standalone\" 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 icon\n * @type {string|null}\n * @default null\n * @description The name of the icon to be used. An icon name must be defined.\n */\n get icon() {\n const { icon } = this.args;\n\n assert(\n '@icon for \"Hds::Link::Standalone\" must have a valid value',\n icon !== undefined\n );\n\n return icon;\n }\n\n /**\n * @param iconPosition\n * @type {string}\n * @default leading\n * @description Positions the icon before or after the text; allowed values are `leading` or `trailing`\n */\n get iconPosition() {\n const { iconPosition = DEFAULT_ICONPOSITION } = this.args;\n\n assert(\n `@iconPosition for \"Hds::Link::Standalone\" must be one of the following: ${ICONPOSITIONS.join(\n ', '\n )}; received: ${iconPosition}`,\n ICONPOSITIONS.includes(iconPosition)\n );\n\n return iconPosition;\n }\n\n /**\n * @param size\n * @type {string}\n * @default medium\n * @description The size of the standalone link; acceptable values are `small`, `medium`, and `large`\n */\n get size() {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Link::Standalone\" 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 * @param iconSize\n * @type {string}\n * @default 16\n * @description ensures that the correct icon size is used. Automatically calculated.\n */\n get iconSize() {\n if (this.args.size === 'large') {\n return '24';\n } else {\n return '16';\n }\n }\n\n /**\n * Get the class names to apply to the component.\n * @method LinkStandalone#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n const classes = ['hds-link-standalone'];\n\n // add a class based on the @size argument\n classes.push(`hds-link-standalone--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-link-standalone--color-${this.color}`);\n\n // add a class based on the @iconPosition argument\n classes.push(`hds-link-standalone--icon-position-${this.iconPosition}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_ICONPOSITION","HdsLinkIconPositionValues","Leading","DEFAULT_COLOR","HdsLinkColorValues","Primary","DEFAULT_SIZE","HdsLinkStandaloneSizeValues","Medium","ICONPOSITIONS","Object","values","COLORS","SIZES","HdsLinkStandaloneComponent","Component","constructor","owner","args","href","route","assert","text","undefined","color","join","includes","icon","iconPosition","size","iconSize","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,o3BAAo3B;;ACDt5B;AACA;AACA;AACA;;AA4BaA,MAAAA,oBAAoB,GAAGC,yBAAyB,CAACC,QAAO;AACxDC,MAAAA,aAAa,GAAGC,kBAAkB,CAACC,QAAO;AAC1CC,MAAAA,YAAY,GAAGC,2BAA2B,CAACC,OAAM;AACvD,MAAMC,aAAuB,GAAGC,MAAM,CAACC,MAAM,CAACV,yBAAyB,EAAC;AACxE,MAAMW,MAAgB,GAAGF,MAAM,CAACC,MAAM,CAACP,kBAAkB,EAAC;AAC1D,MAAMS,KAAe,GAAGH,MAAM,CAACC,MAAM,CAACJ,2BAA2B,EAAC;AAE1D,MAAMO,0BAA0B,SAASC,SAAS,CAA6B;AAC5FC,EAAAA,WAAWA,CAACC,KAAc,EAAEC,IAAwC,EAAE;AACpE,IAAA,KAAK,CAACD,KAAK,EAAEC,IAAI,CAAC,CAAA;AAClB,IAAA,IAAI,EAAE,IAAI,CAACA,IAAI,CAACC,IAAI,IAAI,IAAI,CAACD,IAAI,CAACE,KAAK,CAAC,EAAE;MACxCC,MAAM,CAAC,6DAA6D,CAAC,CAAA;AACvE,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAG;IACT,MAAM;AAAEA,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACJ,IAAI,CAAA;AAE1BG,IAAAA,MAAM,CACJ,2DAA2D,EAC3DC,IAAI,KAAKC,SACX,CAAC,CAAA;AAED,IAAA,OAAOD,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIE,KAAKA,GAAG;IACV,MAAM;AAAEA,MAAAA,KAAK,GAAGrB,aAAAA;KAAe,GAAG,IAAI,CAACe,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ACA;AACA;EACE,IAAIC,QAAQA,GAAG;AACb,IAAA,IAAI,IAAI,CAACZ,IAAI,CAACW,IAAI,KAAK,OAAO,EAAE;AAC9B,MAAA,OAAO,IAAI,CAAA;AACb,KAAC,MAAM;AACL,MAAA,OAAO,IAAI,CAAA;AACb,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIE,UAAUA,GAAG;AACf,IAAA,MAAMC,OAAO,GAAG,CAAC,qBAAqB,CAAC,CAAA;;AAEvC;IACAA,OAAO,CAACC,IAAI,CAAE,CAAA,0BAAA,EAA4B,IAAI,CAACJ,IAAK,EAAC,CAAC,CAAA;;AAEtD;IACAG,OAAO,CAACC,IAAI,CAAE,CAAA,2BAAA,EAA6B,IAAI,CAACT,KAAM,EAAC,CAAC,CAAA;;AAExD;IACAQ,OAAO,CAACC,IAAI,CAAE,CAAA,mCAAA,EAAqC,IAAI,CAACL,YAAa,EAAC,CAAC,CAAA;AAEvE,IAAA,OAAOI,OAAO,CAACP,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACS,oBAAA,CAAAC,QAAA,EAnIoBrB,0BAA0B,CAAA;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) HashiCorp, Inc.
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
let HdsLinkIconPositionValues = /*#__PURE__*/function (HdsLinkIconPositionValues) {
|
|
7
|
+
HdsLinkIconPositionValues["Leading"] = "leading";
|
|
8
|
+
HdsLinkIconPositionValues["Trailing"] = "trailing";
|
|
9
|
+
return HdsLinkIconPositionValues;
|
|
10
|
+
}({});
|
|
11
|
+
let HdsLinkColorValues = /*#__PURE__*/function (HdsLinkColorValues) {
|
|
12
|
+
HdsLinkColorValues["Primary"] = "primary";
|
|
13
|
+
HdsLinkColorValues["Secondary"] = "secondary";
|
|
14
|
+
return HdsLinkColorValues;
|
|
15
|
+
}({});
|
|
16
|
+
let HdsLinkStandaloneSizeValues = /*#__PURE__*/function (HdsLinkStandaloneSizeValues) {
|
|
17
|
+
HdsLinkStandaloneSizeValues["Small"] = "small";
|
|
18
|
+
HdsLinkStandaloneSizeValues["Medium"] = "medium";
|
|
19
|
+
HdsLinkStandaloneSizeValues["Large"] = "large";
|
|
20
|
+
return HdsLinkStandaloneSizeValues;
|
|
21
|
+
}({});
|
|
22
|
+
|
|
23
|
+
export { HdsLinkColorValues, HdsLinkIconPositionValues, HdsLinkStandaloneSizeValues };
|
|
24
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/components/hds/link/types.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsLinkIconPositionValues {\n Leading = 'leading',\n Trailing = 'trailing',\n}\n\nexport type HdsLinkIconPositions = `${HdsLinkIconPositionValues}`;\n\nexport enum HdsLinkColorValues {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport type HdsLinkColors = `${HdsLinkColorValues}`;\n\nexport enum HdsLinkStandaloneSizeValues {\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\n\nexport type HdsLinkStandaloneSizes = `${HdsLinkStandaloneSizeValues}`;\n"],"names":["HdsLinkIconPositionValues","HdsLinkColorValues","HdsLinkStandaloneSizeValues"],"mappings":"AAAA;AACA;AACA;AACA;;AAEYA,IAAAA,yBAAyB,0BAAzBA,yBAAyB,EAAA;EAAzBA,yBAAyB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;EAAzBA,yBAAyB,CAAA,UAAA,CAAA,GAAA,UAAA,CAAA;AAAA,EAAA,OAAzBA,yBAAyB,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAOzBC,IAAAA,kBAAkB,0BAAlBA,kBAAkB,EAAA;EAAlBA,kBAAkB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;EAAlBA,kBAAkB,CAAA,WAAA,CAAA,GAAA,WAAA,CAAA;AAAA,EAAA,OAAlBA,kBAAkB,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAOlBC,IAAAA,2BAA2B,0BAA3BA,2BAA2B,EAAA;EAA3BA,2BAA2B,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;EAA3BA,2BAA2B,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAA3BA,2BAA2B,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAA3BA,2BAA2B,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../_rollupPluginBabelHelpers-NoJJJNhk.js';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { tracked } from '@glimmer/tracking';
|
|
4
4
|
import { action } from '@ember/object';
|