@hashicorp/design-system-components 4.13.1 → 4.14.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/app-side-nav/index.d.ts +45 -0
- package/declarations/components/hds/app-side-nav/index.d.ts.map +1 -0
- package/declarations/components/hds/app-side-nav/list/back-link.d.ts +15 -0
- package/declarations/components/hds/app-side-nav/list/back-link.d.ts.map +1 -0
- package/declarations/components/hds/app-side-nav/list/index.d.ts +32 -0
- package/declarations/components/hds/app-side-nav/list/index.d.ts.map +1 -0
- package/declarations/components/hds/app-side-nav/list/item.d.ts +14 -0
- package/declarations/components/hds/app-side-nav/list/item.d.ts.map +1 -0
- package/declarations/components/hds/app-side-nav/list/link.d.ts +24 -0
- package/declarations/components/hds/app-side-nav/list/link.d.ts.map +1 -0
- package/declarations/components/hds/app-side-nav/list/title.d.ts +19 -0
- package/declarations/components/hds/app-side-nav/list/title.d.ts.map +1 -0
- package/declarations/components/hds/app-side-nav/portal/index.d.ts +27 -0
- package/declarations/components/hds/app-side-nav/portal/index.d.ts.map +1 -0
- package/declarations/components/hds/app-side-nav/portal/target.d.ts +37 -0
- package/declarations/components/hds/app-side-nav/portal/target.d.ts.map +1 -0
- package/declarations/components/hds/app-side-nav/toggle-button.d.ts +15 -0
- package/declarations/components/hds/app-side-nav/toggle-button.d.ts.map +1 -0
- package/declarations/components/hds/dropdown/index.d.ts +3 -0
- package/declarations/components/hds/dropdown/index.d.ts.map +1 -1
- package/declarations/components/hds/form/masked-input/base.d.ts +1 -23
- package/declarations/components/hds/form/masked-input/base.d.ts.map +1 -1
- package/declarations/components/hds/form/text-input/field.d.ts +2 -16
- package/declarations/components/hds/form/text-input/field.d.ts.map +1 -1
- package/declarations/components/hds/pagination/compact/index.d.ts.map +1 -1
- package/declarations/components/hds/pagination/numbered/index.d.ts +1 -1
- package/declarations/components/hds/pagination/numbered/index.d.ts.map +1 -1
- package/declarations/components/hds/popover-primitive/index.d.ts +1 -0
- package/declarations/components/hds/popover-primitive/index.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/index.d.ts +9 -8
- package/declarations/components/hds/side-nav/index.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/list/index.d.ts +6 -3
- package/declarations/components/hds/side-nav/list/index.d.ts.map +1 -1
- package/declarations/components/hds/side-nav/list/title.d.ts +8 -3
- package/declarations/components/hds/side-nav/list/title.d.ts.map +1 -1
- package/declarations/components/hds/table/index.d.ts +1 -0
- package/declarations/components/hds/table/index.d.ts.map +1 -1
- package/declarations/components/hds/table/th-selectable.d.ts +1 -0
- package/declarations/components/hds/table/th-selectable.d.ts.map +1 -1
- package/declarations/components/hds/tabs/index.d.ts.map +1 -1
- package/declarations/modifiers/hds-anchored-position.d.ts +1 -0
- package/declarations/modifiers/hds-anchored-position.d.ts.map +1 -1
- package/declarations/modifiers/hds-clipboard.d.ts.map +1 -1
- package/declarations/template-registry.d.ts +36 -0
- package/declarations/template-registry.d.ts.map +1 -1
- package/dist/components/hds/alert/description.js +2 -2
- package/dist/components/hds/app-footer/item.js +2 -2
- package/dist/components/hds/app-footer/link.js +2 -2
- package/dist/components/hds/app-frame/parts/footer.js +2 -2
- package/dist/components/hds/app-frame/parts/header.js +2 -2
- package/dist/components/hds/app-frame/parts/main.js +2 -2
- package/dist/components/hds/app-frame/parts/modals.js +2 -2
- package/dist/components/hds/app-frame/parts/sidebar.js +2 -2
- package/dist/components/hds/app-side-nav/index.js +187 -0
- package/dist/components/hds/app-side-nav/index.js.map +1 -0
- package/dist/components/hds/app-side-nav/list/back-link.js +16 -0
- package/dist/components/hds/app-side-nav/list/back-link.js.map +1 -0
- package/dist/components/hds/app-side-nav/list/index.js +33 -0
- package/dist/components/hds/app-side-nav/list/index.js.map +1 -0
- package/dist/components/hds/app-side-nav/list/item.js +16 -0
- package/dist/components/hds/app-side-nav/list/item.js.map +1 -0
- package/dist/components/hds/app-side-nav/list/link.js +16 -0
- package/dist/components/hds/app-side-nav/list/link.js.map +1 -0
- package/dist/components/hds/app-side-nav/list/title.js +29 -0
- package/dist/components/hds/app-side-nav/list/title.js.map +1 -0
- package/dist/components/hds/app-side-nav/portal/index.js +16 -0
- package/dist/components/hds/app-side-nav/portal/index.js.map +1 -0
- package/dist/components/hds/app-side-nav/portal/target.js +173 -0
- package/dist/components/hds/app-side-nav/portal/target.js.map +1 -0
- package/dist/components/hds/app-side-nav/toggle-button.js +16 -0
- package/dist/components/hds/app-side-nav/toggle-button.js.map +1 -0
- package/dist/components/hds/application-state/body.js +2 -2
- package/dist/components/hds/application-state/footer.js +2 -2
- package/dist/components/hds/application-state/media.js +2 -2
- package/dist/components/hds/button-set/index.js +2 -2
- package/dist/components/hds/code-block/copy-button.js +2 -2
- package/dist/components/hds/code-block/description.js +2 -2
- package/dist/components/hds/dialog-primitive/body.js +2 -2
- package/dist/components/hds/dialog-primitive/description.js +2 -2
- package/dist/components/hds/dialog-primitive/overlay.js +2 -2
- package/dist/components/hds/dialog-primitive/wrapper.js +2 -2
- package/dist/components/hds/dropdown/footer.js +2 -2
- package/dist/components/hds/dropdown/header.js +2 -2
- package/dist/components/hds/dropdown/index.js +7 -3
- package/dist/components/hds/dropdown/index.js.map +1 -1
- package/dist/components/hds/dropdown/list-item/generic.js +2 -2
- package/dist/components/hds/dropdown/list-item/separator.js +2 -2
- package/dist/components/hds/dropdown/toggle/chevron.js +2 -2
- package/dist/components/hds/form/checkbox/base.js +2 -2
- package/dist/components/hds/form/checkbox/field.js +2 -2
- package/dist/components/hds/form/checkbox/group.js +2 -2
- package/dist/components/hds/form/error/message.js +2 -2
- package/dist/components/hds/form/file-input/base.js +2 -2
- package/dist/components/hds/form/file-input/field.js +2 -2
- package/dist/components/hds/form/masked-input/base.js +5 -34
- package/dist/components/hds/form/masked-input/base.js.map +1 -1
- package/dist/components/hds/form/masked-input/field.js +2 -2
- package/dist/components/hds/form/radio/base.js +2 -2
- package/dist/components/hds/form/radio/field.js +2 -2
- package/dist/components/hds/form/radio/group.js +2 -2
- package/dist/components/hds/form/radio-card/description.js +2 -2
- package/dist/components/hds/form/radio-card/group.js +2 -2
- package/dist/components/hds/form/radio-card/label.js +2 -2
- package/dist/components/hds/form/select/field.js +2 -2
- package/dist/components/hds/form/super-select/after-options.js +2 -2
- package/dist/components/hds/form/super-select/placeholder.js +2 -2
- package/dist/components/hds/form/text-input/field.js +10 -33
- package/dist/components/hds/form/text-input/field.js.map +1 -1
- package/dist/components/hds/form/textarea/field.js +2 -2
- package/dist/components/hds/form/toggle/base.js +2 -2
- package/dist/components/hds/form/toggle/field.js +2 -2
- package/dist/components/hds/form/toggle/group.js +2 -2
- package/dist/components/hds/form/visibility-toggle/index.js +2 -2
- package/dist/components/hds/page-header/actions.js +2 -2
- package/dist/components/hds/page-header/badges.js +2 -2
- package/dist/components/hds/page-header/description.js +2 -2
- package/dist/components/hds/page-header/index.js +2 -2
- package/dist/components/hds/page-header/subtitle.js +2 -2
- package/dist/components/hds/page-header/title.js +2 -2
- package/dist/components/hds/pagination/compact/index.js +4 -3
- package/dist/components/hds/pagination/compact/index.js.map +1 -1
- package/dist/components/hds/pagination/nav/ellipsis.js +2 -2
- package/dist/components/hds/pagination/numbered/index.js +5 -7
- package/dist/components/hds/pagination/numbered/index.js.map +1 -1
- package/dist/components/hds/popover-primitive/index.js +4 -5
- package/dist/components/hds/popover-primitive/index.js.map +1 -1
- package/dist/components/hds/segmented-group/index.js +2 -2
- package/dist/components/hds/side-nav/base.js +3 -3
- package/dist/components/hds/side-nav/base.js.map +1 -1
- package/dist/components/hds/side-nav/header/index.js +2 -2
- package/dist/components/hds/side-nav/index.js +37 -36
- package/dist/components/hds/side-nav/index.js.map +1 -1
- package/dist/components/hds/side-nav/list/back-link.js +2 -2
- package/dist/components/hds/side-nav/list/index.js +27 -10
- package/dist/components/hds/side-nav/list/index.js.map +1 -1
- package/dist/components/hds/side-nav/list/item.js +2 -2
- package/dist/components/hds/side-nav/list/link.js +2 -2
- package/dist/components/hds/side-nav/list/title.js +23 -10
- package/dist/components/hds/side-nav/list/title.js.map +1 -1
- package/dist/components/hds/side-nav/portal/index.js +2 -2
- package/dist/components/hds/side-nav/toggle-button.js +2 -2
- package/dist/components/hds/table/index.js +6 -8
- package/dist/components/hds/table/index.js.map +1 -1
- package/dist/components/hds/table/th-selectable.js +4 -5
- package/dist/components/hds/table/th-selectable.js.map +1 -1
- package/dist/components/hds/tabs/index.js +2 -3
- package/dist/components/hds/tabs/index.js.map +1 -1
- package/dist/components/hds/toast/index.js +2 -2
- package/dist/components/hds/yield/index.js +2 -2
- package/dist/modifiers/hds-anchored-position.js +15 -16
- package/dist/modifiers/hds-anchored-position.js.map +1 -1
- package/dist/modifiers/hds-clipboard.js +15 -6
- package/dist/modifiers/hds-clipboard.js.map +1 -1
- package/dist/styles/@hashicorp/design-system-components.css +41 -293
- package/dist/styles/@hashicorp/design-system-components.scss +2 -1
- package/dist/styles/components/app-side-nav/content.scss +182 -0
- package/dist/styles/components/app-side-nav/index.scss +9 -0
- package/dist/styles/components/app-side-nav/main.scss +147 -0
- package/dist/styles/components/app-side-nav/toggle-button.scss +101 -0
- package/dist/styles/components/app-side-nav/vars.scss +36 -0
- package/dist/styles/components/dropdown.scss +6 -0
- package/dist/styles/components/side-nav/content.scss +5 -0
- package/package.json +2 -4
- package/dist/_app_/components/hds/app-header/home-link.js +0 -1
- package/dist/_app_/components/hds/app-header/index.js +0 -1
- package/dist/_app_/components/hds/app-header/menu-button.js +0 -1
|
@@ -1 +1 @@
|
|
|
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::PopoverPrimitive @isOpen={{@isOpen}} @onClose={{@onClose}} @enableClickEvents={{true}} as |PP|>\\n <div class={{this.classNames}} ...attributes {{PP.setupPrimitiveContainer}}>\\n {{yield\\n (hash\\n ToggleButton=(component\\n \\\"hds/dropdown/toggle/button\\\" isOpen=PP.isOpen setupPrimitiveToggle=PP.setupPrimitiveToggle\\n )\\n ToggleIcon=(component \\\"hds/dropdown/toggle/icon\\\" isOpen=PP.isOpen setupPrimitiveToggle=PP.setupPrimitiveToggle)\\n )\\n }}\\n <div\\n tabindex=\\\"-1\\\"\\n class={{this.classNamesContent}}\\n {{style width=@width max-height=@height}}\\n {{PP.setupPrimitivePopover anchoredPositionOptions=this.anchoredPositionOptions}}\\n >\\n {{#if (or PP.isOpen @preserveContentInDom)}}\\n {{yield (hash Header=(component \\\"hds/dropdown/header\\\"))}}\\n <ul class=\\\"hds-dropdown__list\\\" {{did-insert this.didInsertList}}>\\n {{yield\\n (hash\\n close=PP.hidePopover\\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=PP.hidePopover Footer=(component \\\"hds/dropdown/footer\\\"))}}\\n {{/if}}\\n </div>\\n </div>\\n</Hds::PopoverPrimitive>\")","/**\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 {\n // map Dropdown's `listPosition` values to PopoverPrimitive's `placement` values\n HdsDropdownPositionToPlacementValues,\n // Dropdown's `listPosition` values\n HdsDropdownPositionValues,\n} 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\nimport type { FloatingUIOptions } from '../../../modifiers/hds-anchored-position.ts';\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 isOpen?: boolean;\n listPosition?: HdsDropdownPositions;\n width?: string;\n enableCollisionDetection?: FloatingUIOptions['enableCollisionDetection'];\n preserveContentInDom?: boolean;\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 HdsDropdown 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 get enableCollisionDetection(): FloatingUIOptions['enableCollisionDetection'] {\n return this.args.enableCollisionDetection ?? false;\n }\n\n get anchoredPositionOptions(): {\n placement: FloatingUIOptions['placement'];\n offsetOptions: FloatingUIOptions['offsetOptions'];\n enableCollisionDetection: FloatingUIOptions['enableCollisionDetection'];\n } {\n // custom options specific for the `RichTooltip` component\n // for details see the `hds-anchored-position` modifier\n return {\n placement: HdsDropdownPositionToPlacementValues[this.listPosition],\n offsetOptions: 4,\n enableCollisionDetection: this.enableCollisionDetection ? 'flip' : false,\n };\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 // TODO: we preserved these classes to avoid introducing breaking changes for consumers who rely on these classes for tests, but we aim to remove them in the next major release\n // context: https://github.com/hashicorp/design-system/pull/2309#discussion_r1706941892\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","HdsDropdown","_class","Component","listPosition","args","assert","join","includes","enableCollisionDetection","anchoredPositionOptions","placement","HdsDropdownPositionToPlacementValues","offsetOptions","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,y3DAAy3D;;;ACkC94DA,MAAAA,gBAAgB,GAAGC,yBAAyB,CAACC,YAAW;AAC9D,MAAMC,SAAmB,GAAGC,MAAM,CAACC,MAAM,CAACJ,yBAAyB,EAAC;AAmCtDK,IAAAA,WAAW,IAAAC,MAAA,GAAjB,MAAMD,WAAW,SAASE,SAAS,CAAuB;AACvE;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,CACt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AAA;AAC1B,GAAA;EAGAa,aAAaA,CAACC,OAAyB,EAAQ;AAC7C,IAAA,MAAMC,cAAc,GAAGD,OAAO,CAACE,gBAAgB,CAAC,iBAAiB,CAAC,CAAA;IAClE,IAAID,cAAc,CAACE,MAAM,EAAE;AACzB,MAAA,MAAMC,cAAc,GAAGJ,OAAO,CAC3BK,OAAO,CAAC,eAAe,CAAC,EACvBC,aAAa,CAAC,6BAA6B,CAAC,EAC5CC,YAAY,CAAC,IAAI,CAAC,CAAA;AAEtBP,MAAAA,OAAO,CAACQ,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEvC,MAAA,IAAIJ,cAAc,EAAE;AAClBJ,QAAAA,OAAO,CAACQ,YAAY,CAAC,iBAAiB,EAAEJ,cAAc,CAAC,CAAA;AACzD,OAAA;AACF,KAAA;AACF,GAAA;AACF,CAAC,GAAAK,yBAAA,CAAA5B,MAAA,CAAA6B,SAAA,EAAA,eAAA,EAAA,CAhBEC,MAAM,CAAAjC,EAAAA,MAAA,CAAAkC,wBAAA,CAAA/B,MAAA,CAAA6B,SAAA,oBAAA7B,MAAA,CAAA6B,SAAA,CAAA,GAAA7B,MAAA,EAAA;AA3EuBgC,oBAAA,CAAAC,QAAA,EAAXlC,WAAW,CAAA;;;;"}
|
|
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::PopoverPrimitive @isOpen={{@isOpen}} @onClose={{@onClose}} @enableClickEvents={{true}} as |PP|>\\n <div class={{this.classNames}} ...attributes {{PP.setupPrimitiveContainer}}>\\n {{yield\\n (hash\\n ToggleButton=(component\\n \\\"hds/dropdown/toggle/button\\\" isOpen=PP.isOpen setupPrimitiveToggle=PP.setupPrimitiveToggle\\n )\\n ToggleIcon=(component \\\"hds/dropdown/toggle/icon\\\" isOpen=PP.isOpen setupPrimitiveToggle=PP.setupPrimitiveToggle)\\n )\\n }}\\n <div\\n tabindex=\\\"-1\\\"\\n class={{this.classNamesContent}}\\n {{style width=@width max-height=@height}}\\n {{PP.setupPrimitivePopover anchoredPositionOptions=this.anchoredPositionOptions}}\\n >\\n {{#if (or PP.isOpen @preserveContentInDom)}}\\n {{yield (hash Header=(component \\\"hds/dropdown/header\\\"))}}\\n <ul class=\\\"hds-dropdown__list\\\" {{did-insert this.didInsertList}}>\\n {{yield\\n (hash\\n close=PP.hidePopover\\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=PP.hidePopover Footer=(component \\\"hds/dropdown/footer\\\"))}}\\n {{/if}}\\n </div>\\n </div>\\n</Hds::PopoverPrimitive>\")","/**\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 {\n // map Dropdown's `listPosition` values to PopoverPrimitive's `placement` values\n HdsDropdownPositionToPlacementValues,\n // Dropdown's `listPosition` values\n HdsDropdownPositionValues,\n} 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\nimport type { FloatingUIOptions } from '../../../modifiers/hds-anchored-position.ts';\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 isOpen?: boolean;\n listPosition?: HdsDropdownPositions;\n width?: string;\n enableCollisionDetection?: FloatingUIOptions['enableCollisionDetection'];\n preserveContentInDom?: boolean;\n matchToggleWidth?: boolean;\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 HdsDropdown 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 get enableCollisionDetection(): FloatingUIOptions['enableCollisionDetection'] {\n return this.args.enableCollisionDetection ?? false;\n }\n\n get matchToggleWidth(): FloatingUIOptions['matchToggleWidth'] {\n return this.args.matchToggleWidth ?? false;\n }\n\n get anchoredPositionOptions(): {\n placement: FloatingUIOptions['placement'];\n offsetOptions: FloatingUIOptions['offsetOptions'];\n enableCollisionDetection: FloatingUIOptions['enableCollisionDetection'];\n matchToggleWidth: FloatingUIOptions['matchToggleWidth'];\n } {\n // custom options specific for the `RichTooltip` component\n // for details see the `hds-anchored-position` modifier\n return {\n placement: HdsDropdownPositionToPlacementValues[this.listPosition],\n offsetOptions: 4,\n enableCollisionDetection: this.enableCollisionDetection ? 'flip' : false,\n matchToggleWidth: this.matchToggleWidth,\n };\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 // TODO: we preserved these classes to avoid introducing breaking changes for consumers who rely on these classes for tests, but we aim to remove them in the next major release\n // context: https://github.com/hashicorp/design-system/pull/2309#discussion_r1706941892\n classes.push(`hds-dropdown__content--position-${this.listPosition}`);\n\n // add a class based on the @width or @matchToggleWidth arguments\n if (this.args.width || this.args.matchToggleWidth) {\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","HdsDropdown","_class","Component","listPosition","args","assert","join","includes","enableCollisionDetection","matchToggleWidth","anchoredPositionOptions","placement","HdsDropdownPositionToPlacementValues","offsetOptions","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,y3DAAy3D;;;ACkC94DA,MAAAA,gBAAgB,GAAGC,yBAAyB,CAACC,YAAW;AAC9D,MAAMC,SAAmB,GAAGC,MAAM,CAACC,MAAM,CAACJ,yBAAyB,EAAC;AAoCtDK,IAAAA,WAAW,IAAAC,MAAA,GAAjB,MAAMD,WAAW,SAASE,SAAS,CAAuB;AACvE;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,YAAYA,GAAyB;IACvC,MAAM;AAAEA,MAAAA,YAAY,GAAGT,gBAAAA;KAAkB,GAAG,IAAI,CAACU,IAAI,CAAA;AAErDC,IA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ACd,YAAY,EAAE,CAAC,CAAA;;AAEpE;IACA,IAAI,IAAI,CAACC,IAAI,CAACe,KAAK,IAAI,IAAI,CAACf,IAAI,CAACK,gBAAgB,EAAE;AACjDM,MAAAA,OAAO,CAACE,IAAI,CAAC,oCAAoC,CAAC,CAAA;AACpD,KAAA;AAEA,IAAA,OAAOF,OAAO,CAACT,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;EAGAc,aAAaA,CAACC,OAAyB,EAAQ;AAC7C,IAAA,MAAMC,cAAc,GAAGD,OAAO,CAACE,gBAAgB,CAAC,iBAAiB,CAAC,CAAA;IAClE,IAAID,cAAc,CAACE,MAAM,EAAE;AACzB,MAAA,MAAMC,cAAc,GAAGJ,OAAO,CAC3BK,OAAO,CAAC,eAAe,CAAC,EACvBC,aAAa,CAAC,6BAA6B,CAAC,EAC5CC,YAAY,CAAC,IAAI,CAAC,CAAA;AAEtBP,MAAAA,OAAO,CAACQ,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEvC,MAAA,IAAIJ,cAAc,EAAE;AAClBJ,QAAAA,OAAO,CAACQ,YAAY,CAAC,iBAAiB,EAAEJ,cAAc,CAAC,CAAA;AACzD,OAAA;AACF,KAAA;AACF,GAAA;AACF,CAAC,GAAAK,yBAAA,CAAA7B,MAAA,CAAA8B,SAAA,EAAA,eAAA,EAAA,CAhBEC,MAAM,CAAAlC,EAAAA,MAAA,CAAAmC,wBAAA,CAAAhC,MAAA,CAAA8B,SAAA,oBAAA9B,MAAA,CAAA8B,SAAA,CAAA,GAAA9B,MAAA,EAAA;AAjFuBiC,oBAAA,CAAAC,QAAA,EAAXnC,WAAW,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsDropdownListItemGeneric =
|
|
12
|
+
const HdsDropdownListItemGeneric = TemplateOnlyComponent();
|
|
13
13
|
var generic = setComponentTemplate(TEMPLATE, HdsDropdownListItemGeneric);
|
|
14
14
|
|
|
15
15
|
export { generic as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsDropdownListItemSeparator =
|
|
12
|
+
const HdsDropdownListItemSeparator = TemplateOnlyComponent();
|
|
13
13
|
var separator = setComponentTemplate(TEMPLATE, HdsDropdownListItemSeparator);
|
|
14
14
|
|
|
15
15
|
export { separator as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsDropdownToggleChevron =
|
|
12
|
+
const HdsDropdownToggleChevron = TemplateOnlyComponent();
|
|
13
13
|
var chevron = setComponentTemplate(TEMPLATE, HdsDropdownToggleChevron);
|
|
14
14
|
|
|
15
15
|
export { chevron as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormCheckboxBase =
|
|
12
|
+
const HdsFormCheckboxBase = TemplateOnlyComponent();
|
|
13
13
|
var base = setComponentTemplate(TEMPLATE, HdsFormCheckboxBase);
|
|
14
14
|
|
|
15
15
|
export { base as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormCheckboxField =
|
|
12
|
+
const HdsFormCheckboxField = TemplateOnlyComponent();
|
|
13
13
|
var field = setComponentTemplate(TEMPLATE, HdsFormCheckboxField);
|
|
14
14
|
|
|
15
15
|
export { field as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormCheckboxGroup =
|
|
12
|
+
const HdsFormCheckboxGroup = TemplateOnlyComponent();
|
|
13
13
|
var group = setComponentTemplate(TEMPLATE, HdsFormCheckboxGroup);
|
|
14
14
|
|
|
15
15
|
export { group as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormErrorMessage =
|
|
12
|
+
const HdsFormErrorMessage = TemplateOnlyComponent();
|
|
13
13
|
var message = setComponentTemplate(TEMPLATE, HdsFormErrorMessage);
|
|
14
14
|
|
|
15
15
|
export { message as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormFileInputBase =
|
|
12
|
+
const HdsFormFileInputBase = TemplateOnlyComponent();
|
|
13
13
|
var base = setComponentTemplate(TEMPLATE, HdsFormFileInputBase);
|
|
14
14
|
|
|
15
15
|
export { base as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormFileInputField =
|
|
12
|
+
const HdsFormFileInputField = TemplateOnlyComponent();
|
|
13
13
|
var field = setComponentTemplate(TEMPLATE, HdsFormFileInputField);
|
|
14
14
|
|
|
15
15
|
export { field as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../../_rollupPluginBabelHelpers-KIi_qCIU.js';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
|
-
import { tracked } from '@glimmer/tracking';
|
|
4
3
|
import { action } from '@ember/object';
|
|
5
4
|
import { getElementId } from '../../../../utils/hds-get-element-id.js';
|
|
5
|
+
import { tracked } from '@glimmer/tracking';
|
|
6
6
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
7
|
import { setComponentTemplate } from '@ember/component';
|
|
8
8
|
|
|
@@ -10,26 +10,17 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
10
10
|
|
|
11
11
|
var _class, _descriptor;
|
|
12
12
|
let HdsFormMaskedInputBase = (_class = class HdsFormMaskedInputBase extends Component {
|
|
13
|
-
constructor(
|
|
14
|
-
super(
|
|
13
|
+
constructor(owner, args) {
|
|
14
|
+
super(owner, args);
|
|
15
15
|
_initializerDefineProperty(this, "isContentMasked", _descriptor, this);
|
|
16
|
+
this.isContentMasked = this.args.isContentMasked ?? true;
|
|
16
17
|
}
|
|
17
18
|
onClickToggleMasking() {
|
|
18
19
|
this.isContentMasked = !this.isContentMasked;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Calculates the unique ID to assign to the form control
|
|
23
|
-
*/
|
|
24
21
|
get id() {
|
|
25
22
|
return getElementId(this);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param ariaLabel
|
|
30
|
-
* @type {string}
|
|
31
|
-
* @default 'Show masked content'
|
|
32
|
-
*/
|
|
33
24
|
get visibilityToggleAriaLabel() {
|
|
34
25
|
if (this.args.visibilityToggleAriaLabel) {
|
|
35
26
|
return this.args.visibilityToggleAriaLabel;
|
|
@@ -39,12 +30,6 @@ let HdsFormMaskedInputBase = (_class = class HdsFormMaskedInputBase extends Comp
|
|
|
39
30
|
return 'Hide masked content';
|
|
40
31
|
}
|
|
41
32
|
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @param ariaMessageText
|
|
45
|
-
* @type {string}
|
|
46
|
-
* @default 'Input content is now hidden'
|
|
47
|
-
*/
|
|
48
33
|
get visibilityToggleAriaMessageText() {
|
|
49
34
|
if (this.args.visibilityToggleAriaMessageText) {
|
|
50
35
|
return this.args.visibilityToggleAriaMessageText;
|
|
@@ -54,12 +39,6 @@ let HdsFormMaskedInputBase = (_class = class HdsFormMaskedInputBase extends Comp
|
|
|
54
39
|
return 'Input content is visible';
|
|
55
40
|
}
|
|
56
41
|
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @param copyButtonText
|
|
60
|
-
* @type {string}
|
|
61
|
-
* @default 'Copy masked content'
|
|
62
|
-
*/
|
|
63
42
|
get copyButtonText() {
|
|
64
43
|
if (this.args.copyButtonText) {
|
|
65
44
|
return this.args.copyButtonText;
|
|
@@ -67,12 +46,6 @@ let HdsFormMaskedInputBase = (_class = class HdsFormMaskedInputBase extends Comp
|
|
|
67
46
|
return 'Copy masked content';
|
|
68
47
|
}
|
|
69
48
|
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Get the class names to apply to the component.
|
|
73
|
-
* @method classNames
|
|
74
|
-
* @return {string} The "class" attribute to apply to the component.
|
|
75
|
-
*/
|
|
76
49
|
get classNames() {
|
|
77
50
|
const classes = ['hds-form-masked-input'];
|
|
78
51
|
if (this.isContentMasked) {
|
|
@@ -86,9 +59,7 @@ let HdsFormMaskedInputBase = (_class = class HdsFormMaskedInputBase extends Comp
|
|
|
86
59
|
configurable: true,
|
|
87
60
|
enumerable: true,
|
|
88
61
|
writable: true,
|
|
89
|
-
initializer:
|
|
90
|
-
return this.args.isContentMasked ?? true;
|
|
91
|
-
}
|
|
62
|
+
initializer: null
|
|
92
63
|
}), _applyDecoratedDescriptor(_class.prototype, "onClickToggleMasking", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onClickToggleMasking"), _class.prototype)), _class);
|
|
93
64
|
setComponentTemplate(TEMPLATE, HdsFormMaskedInputBase);
|
|
94
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../../../src/components/hds/form/masked-input/base.hbs","../../../../../src/components/hds/form/masked-input/base.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}} {{style width=@width}}>\\n {{#if @isMultiline}}\\n <Hds::Form::Textarea::Base\\n class=\\\"hds-form-masked-input__control\\\"\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n @height={{@height}}\\n id={{this.id}}\\n ...attributes\\n />\\n {{else}}\\n <Hds::Form::TextInput::Base\\n class=\\\"hds-form-masked-input__control\\\"\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n id={{this.id}}\\n ...attributes\\n />\\n {{/if}}\\n <Hds::Form::VisibilityToggle\\n @isVisible={{this.isContentMasked}}\\n @ariaLabel={{this.visibilityToggleAriaLabel}}\\n @ariaMessageText={{this.visibilityToggleAriaMessageText}}\\n aria-controls={{this.id}}\\n class=\\\"hds-form-masked-input__toggle-button\\\"\\n {{on \\\"click\\\" this.onClickToggleMasking}}\\n />\\n {{#if @hasCopyButton}}\\n <Hds::Copy::Button\\n class=\\\"hds-form-masked-input__copy-button\\\"\\n @text={{this.copyButtonText}}\\n @isIconOnly={{true}}\\n @targetToCopy=\\\"#{{this.id}}\\\"\\n />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport {
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/hds/form/masked-input/base.hbs","../../../../../src/components/hds/form/masked-input/base.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}} {{style width=@width}}>\\n {{#if @isMultiline}}\\n <Hds::Form::Textarea::Base\\n class=\\\"hds-form-masked-input__control\\\"\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n @height={{@height}}\\n id={{this.id}}\\n ...attributes\\n />\\n {{else}}\\n <Hds::Form::TextInput::Base\\n class=\\\"hds-form-masked-input__control\\\"\\n @value={{@value}}\\n @isInvalid={{@isInvalid}}\\n id={{this.id}}\\n ...attributes\\n />\\n {{/if}}\\n <Hds::Form::VisibilityToggle\\n @isVisible={{this.isContentMasked}}\\n @ariaLabel={{this.visibilityToggleAriaLabel}}\\n @ariaMessageText={{this.visibilityToggleAriaMessageText}}\\n aria-controls={{this.id}}\\n class=\\\"hds-form-masked-input__toggle-button\\\"\\n {{on \\\"click\\\" this.onClickToggleMasking}}\\n />\\n {{#if @hasCopyButton}}\\n <Hds::Copy::Button\\n class=\\\"hds-form-masked-input__copy-button\\\"\\n @text={{this.copyButtonText}}\\n @isIconOnly={{true}}\\n @targetToCopy=\\\"#{{this.id}}\\\"\\n />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { getElementId } from '../../../../utils/hds-get-element-id.ts';\nimport type { HdsCopyButtonSignature } from '../../copy/button/index.ts';\nimport type { HdsFormVisibilityToggleSignature } from '../visibility-toggle/index.ts';\nimport { tracked } from '@glimmer/tracking';\n\nexport interface HdsFormMaskedInputBaseSignature {\n Args: {\n copyButtonText?: HdsCopyButtonSignature['Args']['text'];\n hasCopyButton?: boolean;\n isContentMasked?: boolean;\n isInvalid?: boolean;\n isMultiline?: boolean;\n id?: string;\n value?: string;\n visibilityToggleAriaLabel?: HdsFormVisibilityToggleSignature['Args']['ariaLabel'];\n visibilityToggleAriaMessageText?: HdsFormVisibilityToggleSignature['Args']['ariaMessageText'];\n width?: string;\n height?: string;\n };\n Element: HTMLElement;\n}\n\nexport default class HdsFormMaskedInputBase extends Component<HdsFormMaskedInputBaseSignature> {\n @tracked isContentMasked;\n\n constructor(owner: unknown, args: HdsFormMaskedInputBaseSignature['Args']) {\n super(owner, args);\n this.isContentMasked = this.args.isContentMasked ?? true;\n }\n\n @action\n onClickToggleMasking(): void {\n this.isContentMasked = !this.isContentMasked;\n }\n\n get id(): string {\n return getElementId(this);\n }\n\n get visibilityToggleAriaLabel(): string {\n if (this.args.visibilityToggleAriaLabel) {\n return this.args.visibilityToggleAriaLabel;\n } else if (this.isContentMasked) {\n return 'Show masked content';\n } else {\n return 'Hide masked content';\n }\n }\n\n get visibilityToggleAriaMessageText(): string {\n if (this.args.visibilityToggleAriaMessageText) {\n return this.args.visibilityToggleAriaMessageText;\n } else if (this.isContentMasked) {\n return 'Input content is hidden';\n } else {\n return 'Input content is visible';\n }\n }\n\n get copyButtonText(): string {\n if (this.args.copyButtonText) {\n return this.args.copyButtonText;\n } else {\n return 'Copy masked content';\n }\n }\n\n get classNames(): string {\n const classes = ['hds-form-masked-input'];\n\n if (this.isContentMasked) {\n classes.push(`hds-form-masked-input--is-masked`);\n } else {\n classes.push(`hds-form-masked-input--is-not-masked`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["HdsFormMaskedInputBase","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","isContentMasked","onClickToggleMasking","id","getElementId","visibilityToggleAriaLabel","visibilityToggleAriaMessageText","copyButtonText","classNames","classes","push","join","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,unCAAunC;;;AC4BpoCA,IAAAA,sBAAsB,IAAAC,MAAA,GAA5B,MAAMD,sBAAsB,SAASE,SAAS,CAAkC;AAG7FC,EAAAA,WAAWA,CAACC,KAAc,EAAEC,IAA6C,EAAE;AACzE,IAAA,KAAK,CAACD,KAAK,EAAEC,IAAI,CAAC,CAAA;AAACC,IAAAA,0BAAA,0BAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;IACnB,IAAI,CAACC,eAAe,GAAG,IAAI,CAACH,IAAI,CAACG,eAAe,IAAI,IAAI,CAAA;AAC1D,GAAA;AAGAC,EAAAA,oBAAoBA,GAAS;AAC3B,IAAA,IAAI,CAACD,eAAe,GAAG,CAAC,IAAI,CAACA,eAAe,CAAA;AAC9C,GAAA;EAEA,IAAIE,EAAEA,GAAW;IACf,OAAOC,YAAY,CAAC,IAAI,CAAC,CAAA;AAC3B,GAAA;EAEA,IAAIC,yBAAyBA,GAAW;AACtC,IAAA,IAAI,IAAI,CAACP,IAAI,CAACO,yBAAyB,EAAE;AACvC,MAAA,OAAO,IAAI,CAACP,IAAI,CAACO,yBAAyB,CAAA;AAC5C,KAAC,MAAM,IAAI,IAAI,CAACJ,eAAe,EAAE;AAC/B,MAAA,OAAO,qBAAqB,CAAA;AAC9B,KAAC,MAAM;AACL,MAAA,OAAO,qBAAqB,CAAA;AAC9B,KAAA;AACF,GA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,MAAA,CAAAmB,SAAA,EAAA,sBAAA,CAAA,EAAAnB,MAAA,CAAAmB,SAAA,IAAAnB,MAAA,EAAA;AARkC4B,oBAAA,CAAAC,QAAA,EAAtB9B,sBAAsB,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormMaskedInputField =
|
|
12
|
+
const HdsFormMaskedInputField = TemplateOnlyComponent();
|
|
13
13
|
var field = setComponentTemplate(TEMPLATE, HdsFormMaskedInputField);
|
|
14
14
|
|
|
15
15
|
export { field as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormRadioBase =
|
|
12
|
+
const HdsFormRadioBase = TemplateOnlyComponent();
|
|
13
13
|
var base = setComponentTemplate(TEMPLATE, HdsFormRadioBase);
|
|
14
14
|
|
|
15
15
|
export { base as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormRadioField =
|
|
12
|
+
const HdsFormRadioField = TemplateOnlyComponent();
|
|
13
13
|
var field = setComponentTemplate(TEMPLATE, HdsFormRadioField);
|
|
14
14
|
|
|
15
15
|
export { field as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormRadioGroup =
|
|
12
|
+
const HdsFormRadioGroup = TemplateOnlyComponent();
|
|
13
13
|
var group = setComponentTemplate(TEMPLATE, HdsFormRadioGroup);
|
|
14
14
|
|
|
15
15
|
export { group as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormRadioCardDescription =
|
|
12
|
+
const HdsFormRadioCardDescription = TemplateOnlyComponent();
|
|
13
13
|
var description = setComponentTemplate(TEMPLATE, HdsFormRadioCardDescription);
|
|
14
14
|
|
|
15
15
|
export { description as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormRadioCardGroup =
|
|
12
|
+
const HdsFormRadioCardGroup = TemplateOnlyComponent();
|
|
13
13
|
var group = setComponentTemplate(TEMPLATE, HdsFormRadioCardGroup);
|
|
14
14
|
|
|
15
15
|
export { group as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormRadioCardLabel =
|
|
12
|
+
const HdsFormRadioCardLabel = TemplateOnlyComponent();
|
|
13
13
|
var label = setComponentTemplate(TEMPLATE, HdsFormRadioCardLabel);
|
|
14
14
|
|
|
15
15
|
export { label as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormSelectField =
|
|
12
|
+
const HdsFormSelectField = TemplateOnlyComponent();
|
|
13
13
|
var field = setComponentTemplate(TEMPLATE, HdsFormSelectField);
|
|
14
14
|
|
|
15
15
|
export { field as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormSuperSelectAfterOptions =
|
|
12
|
+
const HdsFormSuperSelectAfterOptions = TemplateOnlyComponent();
|
|
13
13
|
var afterOptions = setComponentTemplate(TEMPLATE, HdsFormSuperSelectAfterOptions);
|
|
14
14
|
|
|
15
15
|
export { afterOptions as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormSuperSelectPlaceholder =
|
|
12
|
+
const HdsFormSuperSelectPlaceholder = TemplateOnlyComponent();
|
|
13
13
|
var placeholder = setComponentTemplate(TEMPLATE, HdsFormSuperSelectPlaceholder);
|
|
14
14
|
|
|
15
15
|
export { placeholder as default };
|
|
@@ -8,28 +8,20 @@ import { setComponentTemplate } from '@ember/component';
|
|
|
8
8
|
|
|
9
9
|
var TEMPLATE = precompileTemplate("{{!\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 HelperText=F.HelperText Error=F.Error)}}\n {{#if F.CharacterCount}}\n {{yield (hash CharacterCount=(component F.CharacterCount value=@value))}}\n {{/if}}\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>");
|
|
10
10
|
|
|
11
|
-
var _class, _descriptor, _descriptor2
|
|
11
|
+
var _class, _descriptor, _descriptor2;
|
|
12
12
|
let HdsFormTextInputField = (_class = class HdsFormTextInputField extends Component {
|
|
13
|
-
constructor(
|
|
14
|
-
super(
|
|
13
|
+
constructor(owner, args) {
|
|
14
|
+
super(owner, args);
|
|
15
15
|
_initializerDefineProperty(this, "isPasswordMasked", _descriptor, this);
|
|
16
|
-
_initializerDefineProperty(this, "
|
|
17
|
-
|
|
16
|
+
_initializerDefineProperty(this, "type", _descriptor2, this);
|
|
17
|
+
this.type = this.args.type ?? 'text';
|
|
18
|
+
}
|
|
19
|
+
get hasVisibilityToggle() {
|
|
20
|
+
return this.args.hasVisibilityToggle ?? true;
|
|
18
21
|
}
|
|
19
|
-
/**
|
|
20
|
-
* @param showVisibilityToggle
|
|
21
|
-
* @type {boolean}
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
22
|
get showVisibilityToggle() {
|
|
25
23
|
return this.args.type === 'password' && this.hasVisibilityToggle;
|
|
26
24
|
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param visibilityToggleAriaLabel
|
|
30
|
-
* @type {string}
|
|
31
|
-
* @default 'Show password'
|
|
32
|
-
*/
|
|
33
25
|
get visibilityToggleAriaLabel() {
|
|
34
26
|
if (this.args.visibilityToggleAriaLabel) {
|
|
35
27
|
return this.args.visibilityToggleAriaLabel;
|
|
@@ -39,12 +31,6 @@ let HdsFormTextInputField = (_class = class HdsFormTextInputField extends Compon
|
|
|
39
31
|
return 'Hide password';
|
|
40
32
|
}
|
|
41
33
|
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @param visibilityToggleAriaMessageText
|
|
45
|
-
* @type {string}
|
|
46
|
-
* @default 'Password is now hidden'
|
|
47
|
-
*/
|
|
48
34
|
get visibilityToggleAriaMessageText() {
|
|
49
35
|
if (this.args.visibilityToggleAriaMessageText) {
|
|
50
36
|
return this.args.visibilityToggleAriaMessageText;
|
|
@@ -65,20 +51,11 @@ let HdsFormTextInputField = (_class = class HdsFormTextInputField extends Compon
|
|
|
65
51
|
initializer: function () {
|
|
66
52
|
return true;
|
|
67
53
|
}
|
|
68
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "
|
|
69
|
-
configurable: true,
|
|
70
|
-
enumerable: true,
|
|
71
|
-
writable: true,
|
|
72
|
-
initializer: function () {
|
|
73
|
-
return this.args.hasVisibilityToggle ?? true;
|
|
74
|
-
}
|
|
75
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "type", [tracked], {
|
|
54
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "type", [tracked], {
|
|
76
55
|
configurable: true,
|
|
77
56
|
enumerable: true,
|
|
78
57
|
writable: true,
|
|
79
|
-
initializer:
|
|
80
|
-
return this.args.type ?? 'text';
|
|
81
|
-
}
|
|
58
|
+
initializer: null
|
|
82
59
|
}), _applyDecoratedDescriptor(_class.prototype, "onClickTogglePasswordReadability", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onClickTogglePasswordReadability"), _class.prototype)), _class);
|
|
83
60
|
setComponentTemplate(TEMPLATE, HdsFormTextInputField);
|
|
84
61
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sources":["../../../../../src/components/hds/form/text-input/field.hbs","../../../../../src/components/hds/form/text-input/field.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::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 HelperText=F.HelperText Error=F.Error)}}\\n {{#if F.CharacterCount}}\\n {{yield (hash CharacterCount=(component F.CharacterCount value=@value))}}\\n {{/if}}\\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\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\nimport type { HdsFormFieldSignature } from '../field';\nimport type { HdsFormTextInputBaseSignature } from './base';\nimport type { HdsFormErrorSignature } from '../error';\nimport type { HdsFormHelperTextSignature } from '../helper-text';\nimport type { HdsFormLabelSignature } from '../label';\nimport type { HdsFormVisibilityToggleSignature } from '../visibility-toggle';\nimport HdsFormCharacterCountComponent from '../character-count/index.ts';\n\nexport interface HdsFormTextInputFieldSignature {\n Args: Omit<HdsFormFieldSignature['Args'], 'contextualClass' | 'layout'> &\n HdsFormTextInputBaseSignature['Args'] & {\n visibilityToggleAriaLabel?: HdsFormVisibilityToggleSignature['Args']['ariaLabel'];\n visibilityToggleAriaMessageText?: HdsFormVisibilityToggleSignature['Args']['ariaMessageText'];\n };\n Blocks: {\n default: [\n {\n Label?: ComponentLike<HdsFormLabelSignature>;\n HelperText?: ComponentLike<HdsFormHelperTextSignature>;\n Error?: ComponentLike<HdsFormErrorSignature>;\n CharacterCount?: WithBoundArgs<\n typeof HdsFormCharacterCountComponent,\n 'value'\n >;\n },\n ];\n };\n Element: HdsFormFieldSignature['Element'];\n}\n\nexport default class HdsFormTextInputField extends Component<HdsFormTextInputFieldSignature> {\n @tracked isPasswordMasked = true;\n @tracked
|
|
1
|
+
{"version":3,"file":"field.js","sources":["../../../../../src/components/hds/form/text-input/field.hbs","../../../../../src/components/hds/form/text-input/field.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::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 HelperText=F.HelperText Error=F.Error)}}\\n {{#if F.CharacterCount}}\\n {{yield (hash CharacterCount=(component F.CharacterCount value=@value))}}\\n {{/if}}\\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\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\nimport type { HdsFormFieldSignature } from '../field';\nimport type { HdsFormTextInputBaseSignature } from './base';\nimport type { HdsFormErrorSignature } from '../error';\nimport type { HdsFormHelperTextSignature } from '../helper-text';\nimport type { HdsFormLabelSignature } from '../label';\nimport type { HdsFormVisibilityToggleSignature } from '../visibility-toggle';\nimport HdsFormCharacterCountComponent from '../character-count/index.ts';\n\nexport interface HdsFormTextInputFieldSignature {\n Args: Omit<HdsFormFieldSignature['Args'], 'contextualClass' | 'layout'> &\n HdsFormTextInputBaseSignature['Args'] & {\n visibilityToggleAriaLabel?: HdsFormVisibilityToggleSignature['Args']['ariaLabel'];\n visibilityToggleAriaMessageText?: HdsFormVisibilityToggleSignature['Args']['ariaMessageText'];\n };\n Blocks: {\n default: [\n {\n Label?: ComponentLike<HdsFormLabelSignature>;\n HelperText?: ComponentLike<HdsFormHelperTextSignature>;\n Error?: ComponentLike<HdsFormErrorSignature>;\n CharacterCount?: WithBoundArgs<\n typeof HdsFormCharacterCountComponent,\n 'value'\n >;\n },\n ];\n };\n Element: HdsFormFieldSignature['Element'];\n}\n\nexport default class HdsFormTextInputField extends Component<HdsFormTextInputFieldSignature> {\n @tracked isPasswordMasked = true;\n @tracked type;\n\n constructor(owner: unknown, args: HdsFormTextInputFieldSignature['Args']) {\n super(owner, args);\n this.type = this.args.type ?? 'text';\n }\n\n get hasVisibilityToggle(): boolean {\n return this.args.hasVisibilityToggle ?? true;\n }\n\n get showVisibilityToggle(): boolean {\n return this.args.type === 'password' && this.hasVisibilityToggle;\n }\n\n get visibilityToggleAriaLabel(): string | undefined {\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 get visibilityToggleAriaMessageText(): string | undefined {\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(): void {\n this.isPasswordMasked = !this.isPasswordMasked;\n this.type = this.isPasswordMasked ? 'password' : 'text';\n }\n}\n"],"names":["HdsFormTextInputField","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","_descriptor2","type","hasVisibilityToggle","showVisibilityToggle","visibilityToggleAriaLabel","isPasswordMasked","visibilityToggleAriaMessageText","onClickTogglePasswordReadability","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,0+CAA0+C;;;ACuCv/CA,IAAAA,qBAAqB,IAAAC,MAAA,GAA3B,MAAMD,qBAAqB,SAASE,SAAS,CAAiC;AAI3FC,EAAAA,WAAWA,CAACC,KAAc,EAAEC,IAA4C,EAAE;AACxE,IAAA,KAAK,CAACD,KAAK,EAAEC,IAAI,CAAC,CAAA;AAACC,IAAAA,0BAAA,2BAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,eAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;IACnB,IAAI,CAACC,IAAI,GAAG,IAAI,CAACJ,IAAI,CAACI,IAAI,IAAI,MAAM,CAAA;AACtC,GAAA;EAEA,IAAIC,mBAAmBA,GAAY;AACjC,IAAA,OAAO,IAAI,CAACL,IAAI,CAACK,mBAAmB,IAAI,IAAI,CAAA;AAC9C,GAAA;EAEA,IAAIC,oBAAoBA,GAAY;IAClC,OAAO,IAAI,CAACN,IAAI,CAACI,IAAI,KAAK,UAAU,IAAI,IAAI,CAACC,mBAAmB,CAAA;AAClE,GAAA;EAEA,IAAIE,yBAAyBA,GAAuB;AAClD,IAAA,IAAI,IAAI,CAACP,IAAI,CAACO,yBAAyB,EAAE;AACvC,MAAA,OAAO,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AAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAxB,MAAA,CAAAgB,SAAA,EAAA,kCAAA,CAAA,EAAAhB,MAAA,CAAAgB,SAAA,IAAAhB,MAAA,EAAA;AArCiCyB,oBAAA,CAAAC,QAAA,EAArB3B,qBAAqB,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import TemplateOnlyComponent from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const HdsFormTextareaField =
|
|
12
|
+
const HdsFormTextareaField = TemplateOnlyComponent();
|
|
13
13
|
var field = setComponentTemplate(TEMPLATE, HdsFormTextareaField);
|
|
14
14
|
|
|
15
15
|
export { field as default };
|