@hashicorp/design-system-components 4.2.0 → 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/{link/types.js → popover-primitive/index.js} +1 -1
- package/dist/_app_/components/hds/{card/types.js → rich-tooltip/bubble.js} +1 -1
- package/dist/_app_/components/hds/{alert/types.js → rich-tooltip/index.js} +1 -1
- package/dist/_app_/components/hds/{interactive/types.js → rich-tooltip/toggle.js} +1 -1
- 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 +9 -4
- package/dist/components/hds/alert/description.js.map +1 -1
- package/dist/components/hds/alert/index.js +4 -6
- package/dist/components/hds/alert/index.js.map +1 -1
- package/dist/components/hds/alert/title.js +9 -4
- package/dist/components/hds/alert/title.js.map +1 -1
- package/dist/components/hds/alert/types.js +5 -0
- package/dist/components/hds/alert/types.js.map +1 -1
- 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 +3 -3
- 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.map +1 -1
- package/dist/components/hds/card/types.js +5 -0
- package/dist/components/hds/card/types.js.map +1 -1
- 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 +1 -1
- 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 +1 -1
- 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.map +1 -1
- package/dist/components/hds/link/standalone.js.map +1 -1
- package/dist/components/hds/link/types.js +5 -0
- package/dist/components/hds/link/types.js.map +1 -1
- 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 +1 -1
- 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.map +1 -1
- package/dist/components/hds/text/code.js.map +1 -1
- package/dist/components/hds/text/display.js.map +1 -1
- package/dist/components/hds/text/index.js +3 -3
- package/dist/components/hds/text/index.js.map +1 -1
- 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 +4 -4
- package/dist/components/hds/yield/index.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 +54 -28
- package/dist/_app_/components/hds/text/types.js +0 -1
- package/dist/_app_/components/hds/yield/types.js +0 -1
- package/dist/components/hds/interactive/types.js +0 -2
- package/dist/components/hds/interactive/types.js.map +0 -1
- package/dist/components/hds/yield/types.js +0 -2
- package/dist/components/hds/yield/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body.js","sources":["../../../../src/components/hds/text/body.hbs","../../../../src/components/hds/text/body.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text\\n @group=\\\"body\\\"\\n @size={{this.size}}\\n @weight={{this.weight}}\\n @align={{@align}}\\n @color={{@color}}\\n @tag={{@tag}}\\n ...attributes\\n>{{yield}}</Hds::Text>\")","/**\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 { HdsTextSizeValues, HdsTextWeightValues } from './types.ts';\nimport type {\n HdsTextAligns,\n HdsTextColors,\n HdsTextTags,\n HdsTextWeights,\n} from './types.ts';\n\n// notice: only some combinations of size + font-weight are allowed (per design specs)\n// see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=1262%3A9192\n\n// Allow consumers to provide either string or number representation of size\ntype HdsTextBodySizeNumber = Extract<\n HdsTextSizeValues,\n | HdsTextSizeValues.OneHundred\n | HdsTextSizeValues.TwoHundred\n | HdsTextSizeValues.ThreeHundred\n>;\ntype HdsTextBodySizeString = `${HdsTextBodySizeNumber}`;\nexport type HdsTextBodySizes = HdsTextBodySizeNumber | HdsTextBodySizeString;\nexport const AVAILABLE_SIZES = [\n HdsTextSizeValues.ThreeHundred,\n HdsTextSizeValues.TwoHundred,\n HdsTextSizeValues.OneHundred,\n];\nexport const DEFAULT_SIZE = HdsTextSizeValues.TwoHundred;\n\nexport const DEFAULT_WEIGHT = HdsTextWeightValues.Regular;\nexport type HdsTextBodyWeight = Extract<\n HdsTextWeights,\n 'regular' | 'medium' | 'semibold'\n>;\nexport const AVAILABLE_WEIGHTS_PER_SIZE: Record<\n HdsTextBodySizes,\n HdsTextBodyWeight[]\n> = {\n 300: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n ],\n 200: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n ],\n 100: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n ],\n};\n\nexport interface HdsTextBodySignature {\n Args: {\n size?: HdsTextBodySizes;\n
|
|
1
|
+
{"version":3,"file":"body.js","sources":["../../../../src/components/hds/text/body.hbs","../../../../src/components/hds/text/body.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text\\n @group=\\\"body\\\"\\n @size={{this.size}}\\n @weight={{this.weight}}\\n @align={{@align}}\\n @color={{@color}}\\n @tag={{@tag}}\\n ...attributes\\n>{{yield}}</Hds::Text>\")","/**\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 { HdsTextSizeValues, HdsTextWeightValues } from './types.ts';\nimport type {\n HdsTextAligns,\n HdsTextColors,\n HdsTextTags,\n HdsTextWeights,\n} from './types.ts';\n\n// notice: only some combinations of size + font-weight are allowed (per design specs)\n// see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=1262%3A9192\n\n// Allow consumers to provide either string or number representation of size\ntype HdsTextBodySizeNumber = Extract<\n HdsTextSizeValues,\n | HdsTextSizeValues.OneHundred\n | HdsTextSizeValues.TwoHundred\n | HdsTextSizeValues.ThreeHundred\n>;\ntype HdsTextBodySizeString = `${HdsTextBodySizeNumber}`;\nexport type HdsTextBodySizes = HdsTextBodySizeNumber | HdsTextBodySizeString;\nexport const AVAILABLE_SIZES = [\n HdsTextSizeValues.ThreeHundred,\n HdsTextSizeValues.TwoHundred,\n HdsTextSizeValues.OneHundred,\n];\nexport const DEFAULT_SIZE = HdsTextSizeValues.TwoHundred;\n\nexport const DEFAULT_WEIGHT = HdsTextWeightValues.Regular;\nexport type HdsTextBodyWeight = Extract<\n HdsTextWeights,\n 'regular' | 'medium' | 'semibold'\n>;\nexport const AVAILABLE_WEIGHTS_PER_SIZE: Record<\n HdsTextBodySizes,\n HdsTextBodyWeight[]\n> = {\n 300: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n ],\n 200: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n ],\n 100: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n ],\n};\n\nexport interface HdsTextBodySignature {\n Args: {\n size?: HdsTextBodySizes;\n tag?: HdsTextTags;\n weight?: HdsTextBodyWeight;\n align?: HdsTextAligns;\n color?: string | HdsTextColors;\n };\n Element:\n | HTMLSpanElement\n | HTMLHeadingElement\n | HTMLParagraphElement\n | HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\nexport default class HdsTextBodyComponent extends Component<HdsTextBodySignature> {\n /**\n * Sets the \"size\" for the text\n * Accepted values: see AVAILABLE_SIZES\n *\n * @type {string}\n *\n * @param size\n */\n get size() {\n let { size = DEFAULT_SIZE } = this.args;\n\n // let's be a bit forgiving with the consumers\n if (typeof size === 'string') {\n size = parseInt(size, 10);\n }\n\n assert(\n `@size for \"Hds::Text::Body\" must be one of the following: ${AVAILABLE_SIZES.join(\n ', '\n )}; received: ${size}`,\n AVAILABLE_SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Sets the \"weight\" for the text\n * Accepted values: see AVAILABLE_WEIGHTS_PER_SIZE\n *\n * @type {string}\n *\n * @param variant\n */\n get weight() {\n const { weight = DEFAULT_WEIGHT } = this.args;\n\n const availableWeights = AVAILABLE_WEIGHTS_PER_SIZE[this.size];\n\n assert(\n `@weight for \"Hds::Text::Body\" with @size=${\n this.size\n } must be one of the following: ${availableWeights.join(\n ', '\n )}; received: ${weight}`,\n availableWeights.includes(weight)\n );\n\n return weight;\n }\n}\n"],"names":["AVAILABLE_SIZES","HdsTextSizeValues","ThreeHundred","TwoHundred","OneHundred","DEFAULT_SIZE","DEFAULT_WEIGHT","HdsTextWeightValues","Regular","AVAILABLE_WEIGHTS_PER_SIZE","Medium","Semibold","HdsTextBodyComponent","Component","size","args","parseInt","assert","join","includes","weight","availableWeights","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,mQAAmQ;;ACDrS;AACA;AACA;AACA;;AAwBaA,MAAAA,eAAe,GAAG,CAC7BC,iBAAiB,CAACC,YAAY,EAC9BD,iBAAiB,CAACE,UAAU,EAC5BF,iBAAiB,CAACG,UAAU,EAC7B;AACYC,MAAAA,YAAY,GAAGJ,iBAAiB,CAACE,WAAU;AAE3CG,MAAAA,cAAc,GAAGC,mBAAmB,CAACC,QAAO;AAKlD,MAAMC,0BAGZ,GAAG;AACF,EAAA,GAAG,EAAE,CACHF,mBAAmB,CAACC,OAAO,EAC3BD,mBAAmB,CAACG,MAAM,EAC1BH,mBAAmB,CAACI,QAAQ,CAC7B;AACD,EAAA,GAAG,EAAE,CACHJ,mBAAmB,CAACC,OAAO,EAC3BD,mBAAmB,CAACG,MAAM,EAC1BH,mBAAmB,CAACI,QAAQ,CAC7B;AACD,EAAA,GAAG,EAAE,CACHJ,mBAAmB,CAACC,OAAO,EAC3BD,mBAAmB,CAACG,MAAM,EAC1BH,mBAAmB,CAACI,QAAQ,CAAA;AAEhC,EAAC;AAoBc,MAAMC,oBAAoB,SAASC,SAAS,CAAuB;AAChF;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAG;IACT,IAAI;AAAEA,MAAAA,IAAI,GAAGT,YAAAA;KAAc,GAAG,IAAI,CAACU,IAAI,CAAA;;AAEvC;AACA,IAAA,IAAI,OAAOD,IAAI,KAAK,QAAQ,EAAE;AAC5BA,MAAAA,IAAI,GAAGE,QAAQ,CAACF,IAAI,EAAE,EAAE,CAAC,CAAA;AAC3B,KAAA;AAEAG,IAAAA,MAAM,CACH,CAA4DjB,0DAAAA,EAAAA,eAAe,CAACkB,IAAI,CAC/E,IACF,CAAE,CAAA,YAAA,EAAcJ,IAAK,CAAA,CAAC,EACtBd,eAAe,CAACmB,QAAQ,CAACL,IAAI,CAC/B,CAAC,CAAA;AAED,IAAA,OAAOA,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIM,MAAMA,GAAG;IACX,MAAM;AAAEA,MAAAA,MAAM,GAAGd,cAAAA;KAAgB,GAAG,IAAI,CAACS,IAAI,CAAA;AAE7C,IAAA,MAAMM,gBAAgB,GAAGZ,0BAA0B,CAAC,IAAI,CAACK,IAAI,CAAC,CAAA;IAE9DG,MAAM,CACH,4CACC,IAAI,CAACH,IACN,CAAiCO,+BAAAA,EAAAA,gBAAgB,CAACH,IAAI,CACrD,IACF,CAAE,CAAcE,YAAAA,EAAAA,MAAO,EAAC,EACxBC,gBAAgB,CAACF,QAAQ,CAACC,MAAM,CAClC,CAAC,CAAA;AAED,IAAA,OAAOA,MAAM,CAAA;AACf,GAAA;AACF,CAAA;AAACE,oBAAA,CAAAC,QAAA,EAnDoBX,oBAAoB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","sources":["../../../../src/components/hds/text/code.hbs","../../../../src/components/hds/text/code.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text\\n @group=\\\"code\\\"\\n @size={{this.size}}\\n @weight={{this.weight}}\\n @align={{@align}}\\n @color={{@color}}\\n @tag={{@tag}}\\n ...attributes\\n>{{yield}}</Hds::Text>\")","/**\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 { HdsTextSizeValues, HdsTextWeightValues } from './types.ts';\nimport type {\n HdsTextAligns,\n HdsTextColors,\n HdsTextTags,\n HdsTextWeights,\n} from './types.ts';\n\n// notice: only some combinations of size + font-weight are allowed (per design specs)\n// see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=1262%3A9192\n\n// Allow consumers to provide either string or number representation of size\ntype HdsTextCodeSizeNumber = Extract<\n HdsTextSizeValues,\n | HdsTextSizeValues.OneHundred\n | HdsTextSizeValues.TwoHundred\n | HdsTextSizeValues.ThreeHundred\n>;\ntype HdsTextCodeSizeString = `${HdsTextCodeSizeNumber}`;\nexport type HdsTextCodeSizes = HdsTextCodeSizeNumber | HdsTextCodeSizeString;\nexport const AVAILABLE_SIZES = [\n HdsTextSizeValues.ThreeHundred,\n HdsTextSizeValues.TwoHundred,\n HdsTextSizeValues.OneHundred,\n];\nexport const DEFAULT_SIZE = HdsTextSizeValues.TwoHundred;\n\nexport const DEFAULT_WEIGHT = HdsTextWeightValues.Regular;\nexport type HdsTextCodeWeight = Extract<HdsTextWeights, 'regular' | 'bold'>;\nexport const AVAILABLE_WEIGHTS_PER_SIZE: Record<\n HdsTextCodeSizes,\n HdsTextCodeWeight[]\n> = {\n [HdsTextSizeValues.ThreeHundred]: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Bold,\n ],\n [HdsTextSizeValues.TwoHundred]: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Bold,\n ],\n [HdsTextSizeValues.OneHundred]: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Bold,\n ],\n};\n\nexport interface HdsTextCodeSignature {\n Args: {\n size?: HdsTextCodeSizes;\n
|
|
1
|
+
{"version":3,"file":"code.js","sources":["../../../../src/components/hds/text/code.hbs","../../../../src/components/hds/text/code.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text\\n @group=\\\"code\\\"\\n @size={{this.size}}\\n @weight={{this.weight}}\\n @align={{@align}}\\n @color={{@color}}\\n @tag={{@tag}}\\n ...attributes\\n>{{yield}}</Hds::Text>\")","/**\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 { HdsTextSizeValues, HdsTextWeightValues } from './types.ts';\nimport type {\n HdsTextAligns,\n HdsTextColors,\n HdsTextTags,\n HdsTextWeights,\n} from './types.ts';\n\n// notice: only some combinations of size + font-weight are allowed (per design specs)\n// see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=1262%3A9192\n\n// Allow consumers to provide either string or number representation of size\ntype HdsTextCodeSizeNumber = Extract<\n HdsTextSizeValues,\n | HdsTextSizeValues.OneHundred\n | HdsTextSizeValues.TwoHundred\n | HdsTextSizeValues.ThreeHundred\n>;\ntype HdsTextCodeSizeString = `${HdsTextCodeSizeNumber}`;\nexport type HdsTextCodeSizes = HdsTextCodeSizeNumber | HdsTextCodeSizeString;\nexport const AVAILABLE_SIZES = [\n HdsTextSizeValues.ThreeHundred,\n HdsTextSizeValues.TwoHundred,\n HdsTextSizeValues.OneHundred,\n];\nexport const DEFAULT_SIZE = HdsTextSizeValues.TwoHundred;\n\nexport const DEFAULT_WEIGHT = HdsTextWeightValues.Regular;\nexport type HdsTextCodeWeight = Extract<HdsTextWeights, 'regular' | 'bold'>;\nexport const AVAILABLE_WEIGHTS_PER_SIZE: Record<\n HdsTextCodeSizes,\n HdsTextCodeWeight[]\n> = {\n [HdsTextSizeValues.ThreeHundred]: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Bold,\n ],\n [HdsTextSizeValues.TwoHundred]: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Bold,\n ],\n [HdsTextSizeValues.OneHundred]: [\n HdsTextWeightValues.Regular,\n HdsTextWeightValues.Bold,\n ],\n};\n\nexport interface HdsTextCodeSignature {\n Args: {\n size?: HdsTextCodeSizes;\n tag?: HdsTextTags;\n weight?: HdsTextCodeWeight;\n align?: HdsTextAligns;\n color?: string | HdsTextColors;\n };\n Element:\n | HTMLSpanElement\n | HTMLHeadingElement\n | HTMLParagraphElement\n | HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\nexport default class HdsTextCodeComponent extends Component<HdsTextCodeSignature> {\n /**\n * Sets the \"size\" for the text\n * Accepted values: see AVAILABLE_SIZES\n *\n * @type {string}\n *\n * @param size\n */\n get size() {\n let { size = DEFAULT_SIZE } = this.args;\n\n // let's be a bit forgiving with the consumers\n if (typeof size === 'string') {\n size = parseInt(size, 10);\n }\n\n assert(\n `@size for \"Hds::Text::Code\" must be one of the following: ${AVAILABLE_SIZES.join(\n ', '\n )}; received: ${size}`,\n AVAILABLE_SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Sets the \"weight\" for the text\n * Accepted values: see AVAILABLE_WEIGHTS_PER_SIZE\n *\n * @type {string}\n *\n * @param variant\n */\n get weight() {\n const { weight = DEFAULT_WEIGHT } = this.args;\n\n const availableWeights = AVAILABLE_WEIGHTS_PER_SIZE[this.size];\n\n assert(\n `@weight for \"Hds::Text::Code\" with @size=${\n this.size\n } must be one of the following: ${availableWeights.join(\n ', '\n )}; received: ${weight}`,\n availableWeights.includes(weight)\n );\n\n return weight;\n }\n}\n"],"names":["AVAILABLE_SIZES","HdsTextSizeValues","ThreeHundred","TwoHundred","OneHundred","DEFAULT_SIZE","DEFAULT_WEIGHT","HdsTextWeightValues","Regular","AVAILABLE_WEIGHTS_PER_SIZE","Bold","HdsTextCodeComponent","Component","size","args","parseInt","assert","join","includes","weight","availableWeights","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,mQAAmQ;;ACDrS;AACA;AACA;AACA;;AAwBaA,MAAAA,eAAe,GAAG,CAC7BC,iBAAiB,CAACC,YAAY,EAC9BD,iBAAiB,CAACE,UAAU,EAC5BF,iBAAiB,CAACG,UAAU,EAC7B;AACYC,MAAAA,YAAY,GAAGJ,iBAAiB,CAACE,WAAU;AAE3CG,MAAAA,cAAc,GAAGC,mBAAmB,CAACC,QAAO;AAElD,MAAMC,0BAGZ,GAAG;AACF,EAAA,CAACR,iBAAiB,CAACC,YAAY,GAAG,CAChCK,mBAAmB,CAACC,OAAO,EAC3BD,mBAAmB,CAACG,IAAI,CACzB;AACD,EAAA,CAACT,iBAAiB,CAACE,UAAU,GAAG,CAC9BI,mBAAmB,CAACC,OAAO,EAC3BD,mBAAmB,CAACG,IAAI,CACzB;EACD,CAACT,iBAAiB,CAACG,UAAU,GAAG,CAC9BG,mBAAmB,CAACC,OAAO,EAC3BD,mBAAmB,CAACG,IAAI,CAAA;AAE5B,EAAC;AAoBc,MAAMC,oBAAoB,SAASC,SAAS,CAAuB;AAChF;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAG;IACT,IAAI;AAAEA,MAAAA,IAAI,GAAGR,YAAAA;KAAc,GAAG,IAAI,CAACS,IAAI,CAAA;;AAEvC;AACA,IAAA,IAAI,OAAOD,IAAI,KAAK,QAAQ,EAAE;AAC5BA,MAAAA,IAAI,GAAGE,QAAQ,CAACF,IAAI,EAAE,EAAE,CAAC,CAAA;AAC3B,KAAA;AAEAG,IAAAA,MAAM,CACH,CAA4DhB,0DAAAA,EAAAA,eAAe,CAACiB,IAAI,CAC/E,IACF,CAAE,CAAA,YAAA,EAAcJ,IAAK,CAAA,CAAC,EACtBb,eAAe,CAACkB,QAAQ,CAACL,IAAI,CAC/B,CAAC,CAAA;AAED,IAAA,OAAOA,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIM,MAAMA,GAAG;IACX,MAAM;AAAEA,MAAAA,MAAM,GAAGb,cAAAA;KAAgB,GAAG,IAAI,CAACQ,IAAI,CAAA;AAE7C,IAAA,MAAMM,gBAAgB,GAAGX,0BAA0B,CAAC,IAAI,CAACI,IAAI,CAAC,CAAA;IAE9DG,MAAM,CACH,4CACC,IAAI,CAACH,IACN,CAAiCO,+BAAAA,EAAAA,gBAAgB,CAACH,IAAI,CACrD,IACF,CAAE,CAAcE,YAAAA,EAAAA,MAAO,EAAC,EACxBC,gBAAgB,CAACF,QAAQ,CAACC,MAAM,CAClC,CAAC,CAAA;AAED,IAAA,OAAOA,MAAM,CAAA;AACf,GAAA;AACF,CAAA;AAACE,oBAAA,CAAAC,QAAA,EAnDoBX,oBAAoB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","sources":["../../../../src/components/hds/text/display.hbs","../../../../src/components/hds/text/display.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text\\n @group=\\\"display\\\"\\n @size={{this.size}}\\n @weight={{this.weight}}\\n @align={{@align}}\\n @color={{@color}}\\n @tag={{@tag}}\\n ...attributes\\n>{{yield}}</Hds::Text>\")","/**\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 { HdsTextSizeValues, HdsTextWeightValues } from './types.ts';\nimport type {\n HdsTextAligns,\n HdsTextColors,\n HdsTextSizes,\n HdsTextTags,\n HdsTextWeights,\n} from './types.ts';\n\n// notice: only some combinations of size + font-weight are allowed (per design specs)\n// see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=1262%3A9192\n\nexport const DEFAULT_SIZE = HdsTextSizeValues.TwoHundred;\n\n// Filter out reverse mappings from enum\n// https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings\nexport const AVAILABLE_SIZES = Object.values(HdsTextSizeValues).filter(\n (v) => typeof v === 'number'\n);\n\nexport type HdsTextDisplayWeight = Extract<\n HdsTextWeights,\n 'medium' | 'semibold' | 'bold'\n>;\nexport const DEFAULT_WEIGHTS_PER_SIZE: Record<\n HdsTextSizeValues,\n HdsTextDisplayWeight\n> = {\n [HdsTextSizeValues.FiveHundred]: HdsTextWeightValues.Bold,\n [HdsTextSizeValues.FourHundred]: HdsTextWeightValues.Semibold,\n [HdsTextSizeValues.ThreeHundred]: HdsTextWeightValues.Semibold,\n [HdsTextSizeValues.TwoHundred]: HdsTextWeightValues.Semibold,\n [HdsTextSizeValues.OneHundred]: HdsTextWeightValues.Medium,\n};\nexport const AVAILABLE_WEIGHTS_PER_SIZE: Record<\n HdsTextSizes,\n HdsTextDisplayWeight[]\n> = {\n [HdsTextSizeValues.FiveHundred]: [HdsTextWeightValues.Bold],\n [HdsTextSizeValues.FourHundred]: [\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n HdsTextWeightValues.Bold,\n ],\n [HdsTextSizeValues.ThreeHundred]: [\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n HdsTextWeightValues.Bold,\n ],\n [HdsTextSizeValues.TwoHundred]: [HdsTextWeightValues.Semibold],\n [HdsTextSizeValues.OneHundred]: [HdsTextWeightValues.Medium],\n};\n\nexport interface HdsTextDisplaySignature {\n Args: {\n size?: HdsTextSizes;\n
|
|
1
|
+
{"version":3,"file":"display.js","sources":["../../../../src/components/hds/text/display.hbs","../../../../src/components/hds/text/display.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text\\n @group=\\\"display\\\"\\n @size={{this.size}}\\n @weight={{this.weight}}\\n @align={{@align}}\\n @color={{@color}}\\n @tag={{@tag}}\\n ...attributes\\n>{{yield}}</Hds::Text>\")","/**\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 { HdsTextSizeValues, HdsTextWeightValues } from './types.ts';\nimport type {\n HdsTextAligns,\n HdsTextColors,\n HdsTextSizes,\n HdsTextTags,\n HdsTextWeights,\n} from './types.ts';\n\n// notice: only some combinations of size + font-weight are allowed (per design specs)\n// see: https://www.figma.com/file/oQsMzMMnynfPWpMEt91OpH/HDS-Product---Foundations?node-id=1262%3A9192\n\nexport const DEFAULT_SIZE = HdsTextSizeValues.TwoHundred;\n\n// Filter out reverse mappings from enum\n// https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings\nexport const AVAILABLE_SIZES = Object.values(HdsTextSizeValues).filter(\n (v) => typeof v === 'number'\n);\n\nexport type HdsTextDisplayWeight = Extract<\n HdsTextWeights,\n 'medium' | 'semibold' | 'bold'\n>;\nexport const DEFAULT_WEIGHTS_PER_SIZE: Record<\n HdsTextSizeValues,\n HdsTextDisplayWeight\n> = {\n [HdsTextSizeValues.FiveHundred]: HdsTextWeightValues.Bold,\n [HdsTextSizeValues.FourHundred]: HdsTextWeightValues.Semibold,\n [HdsTextSizeValues.ThreeHundred]: HdsTextWeightValues.Semibold,\n [HdsTextSizeValues.TwoHundred]: HdsTextWeightValues.Semibold,\n [HdsTextSizeValues.OneHundred]: HdsTextWeightValues.Medium,\n};\nexport const AVAILABLE_WEIGHTS_PER_SIZE: Record<\n HdsTextSizes,\n HdsTextDisplayWeight[]\n> = {\n [HdsTextSizeValues.FiveHundred]: [HdsTextWeightValues.Bold],\n [HdsTextSizeValues.FourHundred]: [\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n HdsTextWeightValues.Bold,\n ],\n [HdsTextSizeValues.ThreeHundred]: [\n HdsTextWeightValues.Medium,\n HdsTextWeightValues.Semibold,\n HdsTextWeightValues.Bold,\n ],\n [HdsTextSizeValues.TwoHundred]: [HdsTextWeightValues.Semibold],\n [HdsTextSizeValues.OneHundred]: [HdsTextWeightValues.Medium],\n};\n\nexport interface HdsTextDisplaySignature {\n Args: {\n size?: HdsTextSizes;\n tag?: HdsTextTags;\n weight?: HdsTextDisplayWeight;\n align?: HdsTextAligns;\n color?: string | HdsTextColors;\n };\n Element:\n | HTMLSpanElement\n | HTMLHeadingElement\n | HTMLParagraphElement\n | HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\nexport default class HdsTextDisplayComponent extends Component<HdsTextDisplaySignature> {\n /**\n * Sets the \"size\" for the text\n * Accepted values: see AVAILABLE_SIZES\n *\n * @type {string}\n *\n * @param size\n */\n get size() {\n let { size = DEFAULT_SIZE } = this.args;\n\n // let's be a bit forgiving with the consumers\n if (typeof size === 'string') {\n size = parseInt(size, 10);\n }\n\n assert(\n `@size for \"Hds::Text::Display\" must be one of the following: ${AVAILABLE_SIZES.join(\n ', '\n )}; received: ${size}`,\n AVAILABLE_SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Sets the \"weight\" for the text\n * Accepted values: see AVAILABLE_WEIGHTS_PER_SIZE\n *\n * @type {string}\n *\n * @param variant\n */\n get weight() {\n let { weight } = this.args;\n\n if (weight) {\n const availableWeights = AVAILABLE_WEIGHTS_PER_SIZE[this.size];\n assert(\n `@weight for \"Hds::Text::Display\" with @size=${\n this.size\n } must be one of the following: ${availableWeights.join(\n ', '\n )}; received: ${weight}`,\n availableWeights.includes(weight)\n );\n } else {\n // use the default (first item in the array)\n weight = DEFAULT_WEIGHTS_PER_SIZE[this.size];\n }\n\n return weight;\n }\n}\n"],"names":["DEFAULT_SIZE","HdsTextSizeValues","TwoHundred","AVAILABLE_SIZES","Object","values","filter","v","DEFAULT_WEIGHTS_PER_SIZE","FiveHundred","HdsTextWeightValues","Bold","FourHundred","Semibold","ThreeHundred","OneHundred","Medium","AVAILABLE_WEIGHTS_PER_SIZE","HdsTextDisplayComponent","Component","size","args","parseInt","assert","join","includes","weight","availableWeights","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,sQAAsQ;;ACDxS;AACA;AACA;AACA;;AAaA;AACA;;AAEaA,MAAAA,YAAY,GAAGC,iBAAiB,CAACC,WAAU;;AAExD;AACA;MACaC,eAAe,GAAGC,MAAM,CAACC,MAAM,CAACJ,iBAAiB,CAAC,CAACK,MAAM,CACnEC,CAAC,IAAK,OAAOA,CAAC,KAAK,QACtB,EAAC;AAMM,MAAMC,wBAGZ,GAAG;AACF,EAAA,CAACP,iBAAiB,CAACQ,WAAW,GAAGC,mBAAmB,CAACC,IAAI;AACzD,EAAA,CAACV,iBAAiB,CAACW,WAAW,GAAGF,mBAAmB,CAACG,QAAQ;AAC7D,EAAA,CAACZ,iBAAiB,CAACa,YAAY,GAAGJ,mBAAmB,CAACG,QAAQ;AAC9D,EAAA,CAACZ,iBAAiB,CAACC,UAAU,GAAGQ,mBAAmB,CAACG,QAAQ;AAC5D,EAAA,CAACZ,iBAAiB,CAACc,UAAU,GAAGL,mBAAmB,CAACM,MAAAA;AACtD,EAAC;AACM,MAAMC,0BAGZ,GAAG;EACF,CAAChB,iBAAiB,CAACQ,WAAW,GAAG,CAACC,mBAAmB,CAACC,IAAI,CAAC;AAC3D,EAAA,CAACV,iBAAiB,CAACW,WAAW,GAAG,CAC/BF,mBAAmB,CAACM,MAAM,EAC1BN,mBAAmB,CAACG,QAAQ,EAC5BH,mBAAmB,CAACC,IAAI,CACzB;AACD,EAAA,CAACV,iBAAiB,CAACa,YAAY,GAAG,CAChCJ,mBAAmB,CAACM,MAAM,EAC1BN,mBAAmB,CAACG,QAAQ,EAC5BH,mBAAmB,CAACC,IAAI,CACzB;EACD,CAACV,iBAAiB,CAACC,UAAU,GAA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,KAAA;AAEA,IAAA,OAAOM,MAAM,CAAA;AACf,GAAA;AACF,CAAA;AAACE,oBAAA,CAAAC,QAAA,EAvDoBX,uBAAuB,CAAA;;;;"}
|
|
@@ -16,7 +16,7 @@ const AVAILABLE_ALIGNS = Object.values(HdsTextAlignValues);
|
|
|
16
16
|
|
|
17
17
|
// A union of all types in the HTMLElementTagNameMap interface
|
|
18
18
|
|
|
19
|
-
class
|
|
19
|
+
class HdsTextComponent extends Component {
|
|
20
20
|
/**
|
|
21
21
|
* Get a tag to render based on the `@tag` argument passed or the value of `this.size` (via mapping)
|
|
22
22
|
*
|
|
@@ -129,7 +129,7 @@ class HdsTextIndexComponent extends Component {
|
|
|
129
129
|
return classes.join(' ');
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
setComponentTemplate(TEMPLATE,
|
|
132
|
+
setComponentTemplate(TEMPLATE, HdsTextComponent);
|
|
133
133
|
|
|
134
|
-
export { AVAILABLE_ALIGNS, AVAILABLE_COLORS,
|
|
134
|
+
export { AVAILABLE_ALIGNS, AVAILABLE_COLORS, HdsTextComponent as default };
|
|
135
135
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/text/index.hbs","../../../../src/components/hds/text/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{{! IMPORTANT: we removed any extra newlines before/after the `let` to reduce the issues with unexpected whitespaces (see https://github.com/hashicorp/design-system/pull/1652) }}\\n{{#let (element this.componentTag) as |Tag|}}<Tag\\n class={{this.classNames}}\\n {{style color=this.customColor}}\\n ...attributes\\n >{{yield}}</Tag>{{/let}}\")","/**\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 { HdsTextAlignValues, HdsTextColorValues } from './types.ts';\nimport type {\n HdsTextAligns,\n HdsTextColors,\n HdsTextGroups,\n HdsTextSizes,\n HdsTextTags,\n HdsTextWeights,\n} from './types.ts';\n\nexport const AVAILABLE_COLORS: string[] = Object.values(HdsTextColorValues);\nexport const AVAILABLE_ALIGNS: string[] = Object.values(HdsTextAlignValues);\n\n// A union of all types in the HTMLElementTagNameMap interface\ntype AvailableElements = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];\n\nexport interface
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/text/index.hbs","../../../../src/components/hds/text/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{{! IMPORTANT: we removed any extra newlines before/after the `let` to reduce the issues with unexpected whitespaces (see https://github.com/hashicorp/design-system/pull/1652) }}\\n{{#let (element this.componentTag) as |Tag|}}<Tag\\n class={{this.classNames}}\\n {{style color=this.customColor}}\\n ...attributes\\n >{{yield}}</Tag>{{/let}}\")","/**\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 { HdsTextAlignValues, HdsTextColorValues } from './types.ts';\nimport type {\n HdsTextAligns,\n HdsTextColors,\n HdsTextGroups,\n HdsTextSizes,\n HdsTextTags,\n HdsTextWeights,\n} from './types.ts';\n\nexport const AVAILABLE_COLORS: string[] = Object.values(HdsTextColorValues);\nexport const AVAILABLE_ALIGNS: string[] = Object.values(HdsTextAlignValues);\n\n// A union of all types in the HTMLElementTagNameMap interface\ntype AvailableElements = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];\n\nexport interface HdsTextSignature {\n Args: {\n size: HdsTextSizes;\n tag?: HdsTextTags;\n weight?: HdsTextWeights;\n align?: HdsTextAligns;\n color?: string | HdsTextColors;\n group: HdsTextGroups;\n };\n Element: AvailableElements;\n Blocks: {\n default: [];\n };\n}\n\nexport default class HdsTextComponent extends Component<HdsTextSignature> {\n /**\n * Get a tag to render based on the `@tag` argument passed or the value of `this.size` (via mapping)\n *\n * @method #componentTag\n * @return {string} The html tag to use in the dynamic render of the component\n */\n get componentTag(): HdsTextTags {\n const { tag = 'span' } = this.args;\n\n return tag;\n }\n\n /**\n * Sets the \"variant\" (style) for the text\n * Accepted values: see AVAILABLE_VARIANTS\n *\n * @type {string}\n *\n * @param variant\n */\n get variant() {\n const { group, size } = this.args;\n\n // notice: for performance reasons we don't do any other extra check on these values\n // we assume they've already been validated by the \"parent\" components\n return `${group}-${size}`;\n }\n\n /**\n * Sets the alignment of the text\n * Accepted values: see AVAILABLE_ALIGNS\n *\n * @param align\n * @type {string}\n */\n get align() {\n const { align } = this.args;\n\n if (align) {\n assert(\n `@align for \"Hds::Text\" must be one of the following: ${AVAILABLE_ALIGNS.join(\n ', '\n )}; received: ${align}`,\n AVAILABLE_ALIGNS.includes(align)\n );\n }\n\n return align;\n }\n\n /**\n * Sets the color of the text as pre-defined value\n * Accepted values: see AVAILABLE_COLORS\n *\n * @param color\n * @type {string}\n */\n get predefinedColor() {\n const { color } = this.args;\n\n if (color && AVAILABLE_COLORS.includes(color)) {\n return color;\n } else {\n return undefined;\n }\n }\n\n /**\n * Sets the color of the text as custom value (via inline style)\n *\n * @param color\n * @type {string}\n */\n get customColor() {\n const { color } = this.args;\n\n if (color && !AVAILABLE_COLORS.includes(color)) {\n return color;\n } else {\n return undefined;\n }\n }\n\n /**\n * Get the class names to apply to the component.\n * @method #classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n const classes = ['hds-text'];\n\n // add a (helper) class based on the \"group + size\" variant\n classes.push(`hds-typography-${this.variant}`);\n\n // add a (helper) class based on the @weight argument\n if (this.args.weight) {\n classes.push(`hds-font-weight-${this.args.weight}`);\n }\n\n // add a class based on the @align argument\n if (this.align) {\n classes.push(`hds-text--align-${this.align}`);\n }\n\n // add a (helper) class based on the @color argument (if pre-defined)\n if (this.predefinedColor) {\n classes.push(`hds-foreground-${this.predefinedColor}`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["AVAILABLE_COLORS","Object","values","HdsTextColorValues","AVAILABLE_ALIGNS","HdsTextAlignValues","HdsTextComponent","Component","componentTag","tag","args","variant","group","size","align","assert","join","includes","predefinedColor","color","undefined","customColor","classNames","classes","push","weight","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,yaAAya;;ACD3c;AACA;AACA;AACA;;AAcO,MAAMA,gBAA0B,GAAGC,MAAM,CAACC,MAAM,CAACC,kBAAkB,EAAC;AACpE,MAAMC,gBAA0B,GAAGH,MAAM,CAACC,MAAM,CAACG,kBAAkB,EAAC;;AAE3E;;AAkBe,MAAMC,gBAAgB,SAASC,SAAS,CAAmB;AACxE;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,YAAYA,GAAgB;IAC9B,MAAM;AAAEC,MAAAA,GAAG,GAAG,MAAA;KAAQ,GAAG,IAAI,CAACC,IAAI,CAAA;AAElC,IAAA,OAAOD,GAAG,CAAA;AACZ,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIE,OAAOA,GAAG;IACZ,MAAM;MAAEC,KAAK;AAAEC,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACH,IAAI,CAAA;;AAEjC;AACA;AACA,IAAA,OAAQ,CAAEE,EAAAA,KAAM,CAAGC,CAAAA,EAAAA,IAAK,CAAC,CAAA,CAAA;AAC3B,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,KAAKA,GAAG;IACV,MAAM;AAAEA,MAAAA,KAAAA;KAAO,GAAG,IAAI,CAACJ,IAAI,CAAA;AAE3B,IAAA,IAAII,KAAK,EAAE;AACTC,MAAAA,MAAM,CACH,CAAuDX,qDAAAA,EAAAA,gBAAgB,CA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,IAAI,CAAE,CAAA,gBAAA,EAAkB,IAAI,CAACV,KAAM,EAAC,CAAC,CAAA;AAC/C,KAAA;;AAEA;IACA,IAAI,IAAI,CAACI,eAAe,EAAE;MACxBK,OAAO,CAACC,IAAI,CAAE,CAAA,eAAA,EAAiB,IAAI,CAACN,eAAgB,EAAC,CAAC,CAAA;AACxD,KAAA;AAEA,IAAA,OAAOK,OAAO,CAACP,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACU,oBAAA,CAAAC,QAAA,EAhHoBrB,gBAAgB,CAAA;;;;"}
|
|
@@ -2,9 +2,15 @@ import templateOnly from '@ember/component/template-only';
|
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
5
|
-
var TEMPLATE = precompileTemplate("{{
|
|
5
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Alert\n class=\"hds-toast\"\n @type=\"inline\"\n @color={{@color}}\n @icon={{@icon}}\n @onDismiss={{@onDismiss}}\n ...attributes\n as |A|\n>\n {{yield\n (hash Title=A.Title Description=A.Description Button=A.Button LinkStandalone=A.LinkStandalone Generic=A.Generic)\n }}\n</Hds::Alert>");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) HashiCorp, Inc.
|
|
9
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const HdsToastComponent = templateOnly();
|
|
13
|
+
var index = setComponentTemplate(TEMPLATE, HdsToastComponent);
|
|
8
14
|
|
|
9
15
|
export { index as default };
|
|
10
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/toast/index.hbs","../../../../src/components/hds/toast/index.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/toast/index.hbs","../../../../src/components/hds/toast/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::Alert\\n class=\\\"hds-toast\\\"\\n @type=\\\"inline\\\"\\n @color={{@color}}\\n @icon={{@icon}}\\n @onDismiss={{@onDismiss}}\\n ...attributes\\n as |A|\\n>\\n {{yield\\n (hash Title=A.Title Description=A.Description Button=A.Button LinkStandalone=A.LinkStandalone Generic=A.Generic)\\n }}\\n</Hds::Alert>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport TemplateOnlyComponent from '@ember/component/template-only';\nimport type { HdsAlertSignature } from '../alert/';\n\nexport interface HdsToastSignature extends Omit<HdsAlertSignature, 'Args'> {\n Args: Omit<HdsAlertSignature['Args'], 'type'>;\n}\n\nconst HdsToastComponent = TemplateOnlyComponent<HdsToastSignature>();\n\nexport default HdsToastComponent;\n"],"names":["HdsToastComponent","TemplateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,+XAA+X;;ACDja;AACA;AACA;AACA;;AASA,MAAMA,iBAAiB,GAAGC,YAAqB,EAAqB,CAAA;AAEpE,YAAAC,oBAAA,CAAAC,QAAA,EAAeH,iBAAiB,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import templateOnly from '@ember/component/template-only';
|
|
2
2
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
3
3
|
import { setComponentTemplate } from '@ember/component';
|
|
4
4
|
|
|
@@ -9,8 +9,8 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
|
|
|
9
9
|
* SPDX-License-Identifier: MPL-2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
setComponentTemplate(TEMPLATE, HdsYieldComponent);
|
|
12
|
+
const HdsYieldComponent = templateOnly();
|
|
13
|
+
var index = setComponentTemplate(TEMPLATE, HdsYieldComponent);
|
|
14
14
|
|
|
15
|
-
export {
|
|
15
|
+
export { index as default };
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/yield/index.hbs","../../../../src/components/hds/yield/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{{! template-lint-disable no-yield-only }}\\n{{yield}}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/yield/index.hbs","../../../../src/components/hds/yield/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{{! template-lint-disable no-yield-only }}\\n{{yield}}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport TemplateOnlyComponent from '@ember/component/template-only';\n\nexport interface HdsYieldSignature {\n Blocks: {\n default: [];\n };\n}\n\nconst HdsYieldComponent = TemplateOnlyComponent<HdsYieldSignature>();\n\nexport default HdsYieldComponent;\n"],"names":["HdsYieldComponent","TemplateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,qIAAqI;;ACDvK;AACA;AACA;AACA;;AAUA,MAAMA,iBAAiB,GAAGC,YAAqB,EAAqB,CAAA;AAEpE,YAAAC,oBAAA,CAAAC,QAAA,EAAeH,iBAAiB,CAAA;;;;"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { modifier } from 'ember-modifier';
|
|
2
|
+
import { assert } from '@ember/debug';
|
|
3
|
+
import { autoUpdate, limitShift, offset, flip, shift, autoPlacement, arrow, computePosition } from '@floating-ui/dom';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Copyright (c) HashiCorp, Inc.
|
|
7
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const DEFAULT_PLACEMENT = 'bottom';
|
|
11
|
+
const PLACEMENTS = ['top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end'];
|
|
12
|
+
|
|
13
|
+
// share the same default value of "padding" for `flip/shift/autoPlacement` options
|
|
14
|
+
// this refers to the minimum distance from the boundaries' edges (the viewport)
|
|
15
|
+
// before the floating element changes its position (flips, shifts, or autoplace itself)
|
|
16
|
+
const DEFAULT_EDGE_DISTANCE = 8;
|
|
17
|
+
|
|
18
|
+
// we use this function to process all the options provided to the modifier in a single place,
|
|
19
|
+
// in relation to the Floating UI APIs, and keep the modifier code more clean/simple
|
|
20
|
+
const getFloatingUIOptions = options => {
|
|
21
|
+
let {
|
|
22
|
+
placement = DEFAULT_PLACEMENT,
|
|
23
|
+
strategy = 'absolute',
|
|
24
|
+
// we don't need to use `fixed` if we use the Popover API for the "floating" element (it puts the element in the `top-layer`)
|
|
25
|
+
offsetOptions,
|
|
26
|
+
flipOptions = {
|
|
27
|
+
padding: DEFAULT_EDGE_DISTANCE
|
|
28
|
+
},
|
|
29
|
+
shiftOptions = {
|
|
30
|
+
padding: DEFAULT_EDGE_DISTANCE,
|
|
31
|
+
limiter: limitShift()
|
|
32
|
+
},
|
|
33
|
+
autoPlacementOptions = {
|
|
34
|
+
padding: DEFAULT_EDGE_DISTANCE
|
|
35
|
+
},
|
|
36
|
+
middlewareExtra = [],
|
|
37
|
+
enableCollisionDetection,
|
|
38
|
+
arrowElement,
|
|
39
|
+
arrowPadding
|
|
40
|
+
} = options;
|
|
41
|
+
|
|
42
|
+
// we build dynamically the list of middleware functions to invoke, depending on the options provided
|
|
43
|
+
|
|
44
|
+
const middleware = [];
|
|
45
|
+
|
|
46
|
+
// https://floating-ui.com/docs/offset
|
|
47
|
+
middleware.push(offset(offsetOptions));
|
|
48
|
+
|
|
49
|
+
// https://floating-ui.com/docs/flip
|
|
50
|
+
// https://floating-ui.com/docs/shift
|
|
51
|
+
// https://floating-ui.com/docs/autoPlacement
|
|
52
|
+
if (enableCollisionDetection === true || enableCollisionDetection === 'flip') {
|
|
53
|
+
middleware.push(flip(flipOptions));
|
|
54
|
+
}
|
|
55
|
+
if (enableCollisionDetection === true || enableCollisionDetection === 'shift') {
|
|
56
|
+
middleware.push(shift(shiftOptions));
|
|
57
|
+
}
|
|
58
|
+
if (enableCollisionDetection === 'auto') {
|
|
59
|
+
middleware.push(autoPlacement(autoPlacementOptions));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// https://floating-ui.com/docs/arrow
|
|
63
|
+
if (arrowElement) {
|
|
64
|
+
middleware.push(arrow({
|
|
65
|
+
element: arrowElement,
|
|
66
|
+
padding: arrowPadding ?? 0
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// TODO? commenting this for now, will need to make this conditional to some argument (and understand how this relates to the `@height` argument)
|
|
71
|
+
// https://floating-ui.com/docs/size#match-reference-width
|
|
72
|
+
// size({
|
|
73
|
+
// apply({ rects, elements }) {
|
|
74
|
+
// Object.assign(elements.floating.style, {
|
|
75
|
+
// width: `${rects.reference.width}px`,
|
|
76
|
+
// });
|
|
77
|
+
// },
|
|
78
|
+
// });
|
|
79
|
+
// size({
|
|
80
|
+
// apply: ({ availableWidth, availableHeight, middlewareData }) => {
|
|
81
|
+
// middlewareData.size = { availableWidth, availableHeight };
|
|
82
|
+
// },
|
|
83
|
+
// }),
|
|
84
|
+
|
|
85
|
+
middleware.push(...middlewareExtra);
|
|
86
|
+
return {
|
|
87
|
+
placement,
|
|
88
|
+
strategy,
|
|
89
|
+
middleware
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Notice: we use a function-based modifier here instead of a class-based one
|
|
94
|
+
// because it's quite simple in its logic, and doesn't require injecting services
|
|
95
|
+
// see: https://github.com/ember-modifier/ember-modifier#function-based-modifiers
|
|
96
|
+
|
|
97
|
+
var anchoredPositionModifier = modifier((element, positional, named = {}) => {
|
|
98
|
+
// the element that "floats" next to the "anchor" (whose position is calculated in relation to the anchor)
|
|
99
|
+
// notice: this is the element the Ember modifier is attached to
|
|
100
|
+
const floatingElement = element;
|
|
101
|
+
|
|
102
|
+
// the element that acts as an "anchor" for the "floating" element
|
|
103
|
+
// it can be a DOM (string) selector or a DOM element
|
|
104
|
+
// notice: it's expressed as "positional" argument (array of arguments) for the modifier
|
|
105
|
+
const _anchorTarget = positional[0];
|
|
106
|
+
const anchorElement = typeof _anchorTarget === 'string' ? document.querySelector(_anchorTarget) : _anchorTarget;
|
|
107
|
+
assert('`hds-anchored-position` modifier - the provided "anchoring" element is not defined correctly', anchorElement instanceof HTMLElement || anchorElement instanceof SVGElement);
|
|
108
|
+
|
|
109
|
+
// the "arrow" element (optional) associated with the "floating" element
|
|
110
|
+
// it can be a DOM selector (string) or a DOM element
|
|
111
|
+
// notice: it's declared inside the "named" argument (object) for the modifier
|
|
112
|
+
// but we need to extract it also here so it can be used to assign inline styles to it
|
|
113
|
+
let arrowElement;
|
|
114
|
+
if (named.arrowElement) {
|
|
115
|
+
assert('`hds-anchored-position` modifier - the `element` provided for the "arrow" element is not a valid DOM node', named.arrowElement instanceof HTMLElement || named.arrowElement instanceof SVGElement);
|
|
116
|
+
arrowElement = named.arrowElement;
|
|
117
|
+
} else if (named.arrowSelector) {
|
|
118
|
+
assert('`hds-anchored-position` modifier - the `selector` provided for the "arrow" element must be a string', typeof named.arrowSelector === 'string');
|
|
119
|
+
arrowElement = document.querySelector(named.arrowSelector);
|
|
120
|
+
assert('`hds-anchored-position` modifier - the `selector` provided for the "arrow" element is not a valid DOM selector', arrowElement);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// the Floating UI "options" to apply to the "floating" element
|
|
124
|
+
// notice: we spread the `named` argument and override its `arrowElement` value instead of setting it directly because Ember complains that modifier's arguments must be immutable
|
|
125
|
+
const floatingOptions = getFloatingUIOptions({
|
|
126
|
+
...named,
|
|
127
|
+
arrowElement
|
|
128
|
+
});
|
|
129
|
+
const computeFloatingPosition = async () => {
|
|
130
|
+
// important to know: `computePosition()` is not stateful, it only positions the "floating" element once
|
|
131
|
+
// see: https://floating-ui.com/docs/computePosition
|
|
132
|
+
const state = await computePosition(anchorElement, floatingElement, floatingOptions);
|
|
133
|
+
let {
|
|
134
|
+
x,
|
|
135
|
+
y,
|
|
136
|
+
placement,
|
|
137
|
+
strategy,
|
|
138
|
+
middlewareData
|
|
139
|
+
} = state;
|
|
140
|
+
Object.assign(floatingElement.style, {
|
|
141
|
+
position: strategy,
|
|
142
|
+
top: `${y}px`,
|
|
143
|
+
left: `${x}px`
|
|
144
|
+
// TODO? commenting this for now, will need to make this conditional to some argument (and understand how this relates to the `@height` argument)
|
|
145
|
+
// maxHeight: `${middlewareData.size.availableHeight - 10}px`,
|
|
146
|
+
});
|
|
147
|
+
if (arrowElement && middlewareData.arrow) {
|
|
148
|
+
// we assign a "data" attribute to the "arrow" element so we can use CSS (in the consuming components) to position/rotate it accordingly and we avoid calculating at runtime values that technically we already know
|
|
149
|
+
// (similar to what Tippy.js does: https://github.com/atomiks/tippyjs/blob/master/src/scss/svg-arrow.scss)
|
|
150
|
+
// IMPORTANT: floating-ui assumes the "arrow" container is square!
|
|
151
|
+
arrowElement.setAttribute('data-hds-anchored-arrow-placement', placement);
|
|
152
|
+
|
|
153
|
+
// we set `x` or `y` value (depends on the position of the arrow in relation to the "floating" element placement)
|
|
154
|
+
// see: https://floating-ui.com/docs/arrow#usage
|
|
155
|
+
Object.assign(arrowElement.style, {
|
|
156
|
+
left: middlewareData.arrow.x != null ? `${middlewareData.arrow.x}px` : '',
|
|
157
|
+
top: middlewareData.arrow.y != null ? `${middlewareData.arrow.y}px` : ''
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// the `autoUpdate` function automatically updates the position of the floating element when necessary.
|
|
163
|
+
// it should only be called when the floating element is mounted on the DOM or visible on the screen.
|
|
164
|
+
// it returns a "cleanup" function that should be invoked when the floating element is removed from the DOM or hidden from the screen.
|
|
165
|
+
// see: https://floating-ui.com/docs/autoUpdate
|
|
166
|
+
const cleanupFloatingUI = autoUpdate(anchorElement, floatingElement, computeFloatingPosition);
|
|
167
|
+
|
|
168
|
+
// this (teardown) function is run when the element is removed from the DOM
|
|
169
|
+
return () => {
|
|
170
|
+
cleanupFloatingUI();
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
export { DEFAULT_PLACEMENT, PLACEMENTS, anchoredPositionModifier as default, getFloatingUIOptions };
|
|
175
|
+
//# sourceMappingURL=hds-anchored-position.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hds-anchored-position.js","sources":["../../src/modifiers/hds-anchored-position.js"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport { modifier } from 'ember-modifier';\nimport { assert } from '@ember/debug';\n\nimport {\n autoUpdate,\n computePosition,\n offset,\n flip,\n shift,\n limitShift,\n autoPlacement,\n arrow,\n // ---\n // this could be used in the future if we want to give consumers an option to hide the \"floating\" element when the \"anchor\" hides from the viewport\n // see: https://floating-ui.com/docs/hide\n // hide,\n // ---\n // this could be used in the future if we want to give consumers an option to:\n // - let the \"floating\" element auto-resize when there is not enough space (usually vertical) in the viewport to contain the entire \"floating\" element\n // - let the \"floating\" element match the width of the \"trigger\" (it may have min/max width/heigh via CSS too)\n // see: https://floating-ui.com/docs/size\n // notice: below you can find a preliminary code implementation that was tested and worked relatively well\n // size,\n // ---\n} from '@floating-ui/dom';\n\nexport const DEFAULT_PLACEMENT = 'bottom';\nexport const PLACEMENTS = [\n 'top',\n 'top-start',\n 'top-end',\n 'right',\n 'right-start',\n 'right-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'left',\n 'left-start',\n 'left-end',\n];\n\n// share the same default value of \"padding\" for `flip/shift/autoPlacement` options\n// this refers to the minimum distance from the boundaries' edges (the viewport)\n// before the floating element changes its position (flips, shifts, or autoplace itself)\nconst DEFAULT_EDGE_DISTANCE = 8;\n\n// we use this function to process all the options provided to the modifier in a single place,\n// in relation to the Floating UI APIs, and keep the modifier code more clean/simple\nexport const getFloatingUIOptions = (options) => {\n let {\n placement = DEFAULT_PLACEMENT,\n strategy = 'absolute', // we don't need to use `fixed` if we use the Popover API for the \"floating\" element (it puts the element in the `top-layer`)\n offsetOptions,\n flipOptions = { padding: DEFAULT_EDGE_DISTANCE },\n shiftOptions = { padding: DEFAULT_EDGE_DISTANCE, limiter: limitShift() },\n autoPlacementOptions = { padding: DEFAULT_EDGE_DISTANCE },\n middlewareExtra = [],\n enableCollisionDetection,\n arrowElement,\n arrowPadding,\n } = options;\n\n // we build dynamically the list of middleware functions to invoke, depending on the options provided\n\n const middleware = [];\n\n // https://floating-ui.com/docs/offset\n middleware.push(offset(offsetOptions));\n\n // https://floating-ui.com/docs/flip\n // https://floating-ui.com/docs/shift\n // https://floating-ui.com/docs/autoPlacement\n if (\n enableCollisionDetection === true ||\n enableCollisionDetection === 'flip'\n ) {\n middleware.push(flip(flipOptions));\n }\n if (\n enableCollisionDetection === true ||\n enableCollisionDetection === 'shift'\n ) {\n middleware.push(shift(shiftOptions));\n }\n if (enableCollisionDetection === 'auto') {\n middleware.push(autoPlacement(autoPlacementOptions));\n }\n\n // https://floating-ui.com/docs/arrow\n if (arrowElement) {\n middleware.push(\n arrow({\n element: arrowElement,\n padding: arrowPadding ?? 0,\n })\n );\n }\n\n // TODO? commenting this for now, will need to make this conditional to some argument (and understand how this relates to the `@height` argument)\n // https://floating-ui.com/docs/size#match-reference-width\n // size({\n // apply({ rects, elements }) {\n // Object.assign(elements.floating.style, {\n // width: `${rects.reference.width}px`,\n // });\n // },\n // });\n // size({\n // apply: ({ availableWidth, availableHeight, middlewareData }) => {\n // middlewareData.size = { availableWidth, availableHeight };\n // },\n // }),\n\n middleware.push(...middlewareExtra);\n\n return {\n placement,\n strategy,\n middleware,\n };\n};\n\n// Notice: we use a function-based modifier here instead of a class-based one\n// because it's quite simple in its logic, and doesn't require injecting services\n// see: https://github.com/ember-modifier/ember-modifier#function-based-modifiers\n\nexport default modifier((element, positional, named = {}) => {\n // the element that \"floats\" next to the \"anchor\" (whose position is calculated in relation to the anchor)\n // notice: this is the element the Ember modifier is attached to\n const floatingElement = element;\n\n // the element that acts as an \"anchor\" for the \"floating\" element\n // it can be a DOM (string) selector or a DOM element\n // notice: it's expressed as \"positional\" argument (array of arguments) for the modifier\n const _anchorTarget = positional[0];\n const anchorElement =\n typeof _anchorTarget === 'string'\n ? document.querySelector(_anchorTarget)\n : _anchorTarget;\n\n assert(\n '`hds-anchored-position` modifier - the provided \"anchoring\" element is not defined correctly',\n anchorElement instanceof HTMLElement || anchorElement instanceof SVGElement\n );\n\n // the \"arrow\" element (optional) associated with the \"floating\" element\n // it can be a DOM selector (string) or a DOM element\n // notice: it's declared inside the \"named\" argument (object) for the modifier\n // but we need to extract it also here so it can be used to assign inline styles to it\n let arrowElement;\n if (named.arrowElement) {\n assert(\n '`hds-anchored-position` modifier - the `element` provided for the \"arrow\" element is not a valid DOM node',\n named.arrowElement instanceof HTMLElement ||\n named.arrowElement instanceof SVGElement\n );\n\n arrowElement = named.arrowElement;\n } else if (named.arrowSelector) {\n assert(\n '`hds-anchored-position` modifier - the `selector` provided for the \"arrow\" element must be a string',\n typeof named.arrowSelector === 'string'\n );\n\n arrowElement = document.querySelector(named.arrowSelector);\n\n assert(\n '`hds-anchored-position` modifier - the `selector` provided for the \"arrow\" element is not a valid DOM selector',\n arrowElement\n );\n }\n\n // the Floating UI \"options\" to apply to the \"floating\" element\n // notice: we spread the `named` argument and override its `arrowElement` value instead of setting it directly because Ember complains that modifier's arguments must be immutable\n const floatingOptions = getFloatingUIOptions({ ...named, arrowElement });\n\n const computeFloatingPosition = async () => {\n // important to know: `computePosition()` is not stateful, it only positions the \"floating\" element once\n // see: https://floating-ui.com/docs/computePosition\n const state = await computePosition(\n anchorElement,\n floatingElement,\n floatingOptions\n );\n\n let { x, y, placement, strategy, middlewareData } = state;\n\n Object.assign(floatingElement.style, {\n position: strategy,\n top: `${y}px`,\n left: `${x}px`,\n // TODO? commenting this for now, will need to make this conditional to some argument (and understand how this relates to the `@height` argument)\n // maxHeight: `${middlewareData.size.availableHeight - 10}px`,\n });\n\n if (arrowElement && middlewareData.arrow) {\n // we assign a \"data\" attribute to the \"arrow\" element so we can use CSS (in the consuming components) to position/rotate it accordingly and we avoid calculating at runtime values that technically we already know\n // (similar to what Tippy.js does: https://github.com/atomiks/tippyjs/blob/master/src/scss/svg-arrow.scss)\n // IMPORTANT: floating-ui assumes the \"arrow\" container is square!\n arrowElement.setAttribute('data-hds-anchored-arrow-placement', placement);\n\n // we set `x` or `y` value (depends on the position of the arrow in relation to the \"floating\" element placement)\n // see: https://floating-ui.com/docs/arrow#usage\n Object.assign(arrowElement.style, {\n left:\n middlewareData.arrow.x != null ? `${middlewareData.arrow.x}px` : '',\n top:\n middlewareData.arrow.y != null ? `${middlewareData.arrow.y}px` : '',\n });\n }\n };\n\n // the `autoUpdate` function automatically updates the position of the floating element when necessary.\n // it should only be called when the floating element is mounted on the DOM or visible on the screen.\n // it returns a \"cleanup\" function that should be invoked when the floating element is removed from the DOM or hidden from the screen.\n // see: https://floating-ui.com/docs/autoUpdate\n const cleanupFloatingUI = autoUpdate(\n anchorElement,\n floatingElement,\n computeFloatingPosition\n );\n\n // this (teardown) function is run when the element is removed from the DOM\n return () => {\n cleanupFloatingUI();\n };\n});\n"],"names":["DEFAULT_PLACEMENT","PLACEMENTS","DEFAULT_EDGE_DISTANCE","getFloatingUIOptions","options","placement","strategy","offsetOptions","flipOptions","padding","shiftOptions","limiter","limitShift","autoPlacementOptions","middlewareExtra","enableCollisionDetection","arrowElement","arrowPadding","middleware","push","offset","flip","shift","autoPlacement","arrow","element","modifier","positional","named","floatingElement","_anchorTarget","anchorElement","document","querySelector","assert","HTMLElement","SVGElement","arrowSelector","floatingOptions","computeFloatingPosition","state","computePosition","x","y","middlewareData","Object","assign","style","position","top","left","setAttribute","cleanupFloatingUI","autoUpdate"],"mappings":";;;;AAAA;AACA;AACA;AACA;;AA4BO,MAAMA,iBAAiB,GAAG,SAAQ;AAClC,MAAMC,UAAU,GAAG,CACxB,KAAK,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,aAAa,EACb,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,UAAU,EACX;;AAED;AACA;AACA;AACA,MAAMC,qBAAqB,GAAG,CAAC,CAAA;;AAE/B;AACA;AACaC,MAAAA,oBAAoB,GAAIC,OAAO,IAAK;EAC/C,IAAI;AACFC,IAAAA,SAAS,GAAGL,iBAAiB;AAC7BM,IAAAA,QAAQ,GAAG,UAAU;AAAE;IACvBC,aAAa;AACbC,IAAAA,WAAW,GAAG;AAAEC,MAAAA,OAAO,EAAEP,qBAAAA;KAAuB;AAChDQ,IAAAA,YAAY,GAAG;AAAED,MAAAA,OAAO,EAAEP,qBAAqB;MAAES,OAAO,EAAEC,UAAU,EAAC;KAAG;AACxEC,IAAAA,oBAAoB,GAAG;AAAEJ,MAAAA,OAAO,EAAEP,qBAAAA;KAAuB;AACzDY,IAAAA,eAAe,GAAG,EAAE;IACpBC,wBAAwB;IACxBC,YAAY;AACZC,IAAAA,YAAAA;AACF,GAAC,GAAGb,OAAO,CAAA;;AAEX;;EAEA,MAAMc,UAAU,GAAG,EA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2C,GAAG,EAAG,CAAEN,EAAAA,CAAE,CAAG,EAAA,CAAA;MACbO,IAAI,EAAG,GAAER,CAAE,CAAA,EAAA,CAAA;AACX;AACA;AACF,KAAC,CAAC,CAAA;AAEF,IAAA,IAAI1B,YAAY,IAAI4B,cAAc,CAACpB,KAAK,EAAE;AACxC;AACA;AACA;AACAR,MAAAA,YAAY,CAACmC,YAAY,CAAC,mCAAmC,EAAE9C,SAAS,CAAC,CAAA;;AAEzE;AACA;AACAwC,MAAAA,MAAM,CAACC,MAAM,CAAC9B,YAAY,CAAC+B,KAAK,EAAE;AAChCG,QAAAA,IAAI,EACFN,cAAc,CAACpB,KAAK,CAACkB,CAAC,IAAI,IAAI,GAAI,CAAA,EAAEE,cAAc,CAACpB,KAAK,CAACkB,CAAE,CAAA,EAAA,CAAG,GAAG,EAAE;AACrEO,QAAAA,GAAG,EACDL,cAAc,CAACpB,KAAK,CAACmB,CAAC,IAAI,IAAI,GAAI,CAAA,EAAEC,cAAc,CAACpB,KAAK,CAACmB,CAAE,IAAG,GAAG,EAAA;AACrE,OAAC,CAAC,CAAA;AACJ,KAAA;GACD,CAAA;;AAED;AACA;AACA;AACA;EACA,MAAMS,iBAAiB,GAAGC,UAAU,CAClCtB,aAAa,EACbF,eAAe,EACfU,uBACF,CAAC,CAAA;;AAED;AACA,EAAA,OAAO,MAAM;AACXa,IAAAA,iBAAiB,EAAE,CAAA;GACpB,CAAA;AACH,CAAC,CAAC;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { modifier } from 'ember-modifier';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) HashiCorp, Inc.
|
|
5
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Notice: we use a function-based modifier here instead of a class-based one
|
|
10
|
+
// because it's quite simple in its logic, and doesn't require injecting services
|
|
11
|
+
// see: https://github.com/ember-modifier/ember-modifier#function-based-modifiers
|
|
12
|
+
|
|
13
|
+
// this modifier is a "replacement" of the standard `{{on 'event' myFunction}}`
|
|
14
|
+
// it's needed because the {{on}} modifier can't be applied conditionally, apparently
|
|
15
|
+
// see: https://github.com/emberjs/ember.js/issues/19869#issuecomment-1909118910
|
|
16
|
+
// see: https://github.com/emberjs/ember.js/pull/20629
|
|
17
|
+
// see also: https://github.com/emberjs/ember.js/blob/main/packages/%40ember/-internals/glimmer/lib/modifiers/on.ts#L30
|
|
18
|
+
var registerEvent = modifier((element, positional, named = {}) => {
|
|
19
|
+
// the "target" element the listeners are added to
|
|
20
|
+
// notice: this is the element the Ember modifier is attached to
|
|
21
|
+
const targetElement = element;
|
|
22
|
+
// the event name and handler to apply to the element
|
|
23
|
+
// notice: it's expressed as "positional" argument (array) for the modifier
|
|
24
|
+
const [event, eventHandler] = positional;
|
|
25
|
+
// the options for the `addEventListener()` method
|
|
26
|
+
// see: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
|
|
27
|
+
// notice: it's expressed as "named" argument (object) for the modifier
|
|
28
|
+
const {
|
|
29
|
+
useCapture = false
|
|
30
|
+
} = named;
|
|
31
|
+
targetElement.addEventListener(event, eventHandler, useCapture);
|
|
32
|
+
|
|
33
|
+
// this (teardown) function is run when the element is removed from the DOM
|
|
34
|
+
return () => {
|
|
35
|
+
targetElement.removeEventListener(event, eventHandler, useCapture);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { registerEvent as default };
|
|
40
|
+
//# sourceMappingURL=hds-register-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hds-register-event.js","sources":["../../src/modifiers/hds-register-event.js"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport { modifier } from 'ember-modifier';\n\n// Notice: we use a function-based modifier here instead of a class-based one\n// because it's quite simple in its logic, and doesn't require injecting services\n// see: https://github.com/ember-modifier/ember-modifier#function-based-modifiers\n\n// this modifier is a \"replacement\" of the standard `{{on 'event' myFunction}}`\n// it's needed because the {{on}} modifier can't be applied conditionally, apparently\n// see: https://github.com/emberjs/ember.js/issues/19869#issuecomment-1909118910\n// see: https://github.com/emberjs/ember.js/pull/20629\n// see also: https://github.com/emberjs/ember.js/blob/main/packages/%40ember/-internals/glimmer/lib/modifiers/on.ts#L30\nexport default modifier((element, positional, named = {}) => {\n // the \"target\" element the listeners are added to\n // notice: this is the element the Ember modifier is attached to\n const targetElement = element;\n // the event name and handler to apply to the element\n // notice: it's expressed as \"positional\" argument (array) for the modifier\n const [event, eventHandler] = positional;\n // the options for the `addEventListener()` method\n // see: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\n // notice: it's expressed as \"named\" argument (object) for the modifier\n const { useCapture = false } = named;\n\n targetElement.addEventListener(event, eventHandler, useCapture);\n\n // this (teardown) function is run when the element is removed from the DOM\n return () => {\n targetElement.removeEventListener(event, eventHandler, useCapture);\n };\n});\n"],"names":["modifier","element","positional","named","targetElement","event","eventHandler","useCapture","addEventListener","removeEventListener"],"mappings":";;AAAA;AACA;AACA;AACA;;;AAIA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAeA,QAAQ,CAAC,CAACC,OAAO,EAAEC,UAAU,EAAEC,KAAK,GAAG,EAAE,KAAK;AAC3D;AACA;EACA,MAAMC,aAAa,GAAGH,OAAO,CAAA;AAC7B;AACA;AACA,EAAA,MAAM,CAACI,KAAK,EAAEC,YAAY,CAAC,GAAGJ,UAAU,CAAA;AACxC;AACA;AACA;EACA,MAAM;AAAEK,IAAAA,UAAU,GAAG,KAAA;AAAM,GAAC,GAAGJ,KAAK,CAAA;EAEpCC,aAAa,CAACI,gBAAgB,CAACH,KAAK,EAAEC,YAAY,EAAEC,UAAU,CAAC,CAAA;;AAE/D;AACA,EAAA,OAAO,MAAM;IACXH,aAAa,CAACK,mBAAmB,CAACJ,KAAK,EAAEC,YAAY,EAAEC,UAAU,CAAC,CAAA;GACnE,CAAA;AACH,CAAC,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as _classPrivateMethodInitSpec,
|
|
1
|
+
import { c as _classPrivateMethodInitSpec, a as _defineProperty, d as _assertClassBrand } from '../_rollupPluginBabelHelpers-NoJJJNhk.js';
|
|
2
2
|
import Modifier from 'ember-modifier';
|
|
3
3
|
import { assert } from '@ember/debug';
|
|
4
4
|
import { registerDestructor } from '@ember/destroyable';
|
|
@@ -31,15 +31,11 @@ function cleanup(instance) {
|
|
|
31
31
|
* @class TooltipModifier
|
|
32
32
|
*
|
|
33
33
|
*/
|
|
34
|
-
var
|
|
35
|
-
var _update = /*#__PURE__*/new WeakSet();
|
|
36
|
-
var _getTooltipProps = /*#__PURE__*/new WeakSet();
|
|
34
|
+
var _HdsTooltipModifier_brand = /*#__PURE__*/new WeakSet();
|
|
37
35
|
class HdsTooltipModifier extends Modifier {
|
|
38
36
|
constructor(owner, args) {
|
|
39
37
|
super(owner, args);
|
|
40
|
-
_classPrivateMethodInitSpec(this,
|
|
41
|
-
_classPrivateMethodInitSpec(this, _update);
|
|
42
|
-
_classPrivateMethodInitSpec(this, _setup);
|
|
38
|
+
_classPrivateMethodInitSpec(this, _HdsTooltipModifier_brand);
|
|
43
39
|
_defineProperty(this, "didSetup", false);
|
|
44
40
|
_defineProperty(this, "interval", null);
|
|
45
41
|
_defineProperty(this, "needsTabIndex", false);
|
|
@@ -70,21 +66,21 @@ class HdsTooltipModifier extends Modifier {
|
|
|
70
66
|
modify(element, positional, named) {
|
|
71
67
|
assert('Tooltip must have an element', element);
|
|
72
68
|
if (!this.didSetup) {
|
|
73
|
-
|
|
69
|
+
_assertClassBrand(_HdsTooltipModifier_brand, this, _setup).call(this, element, positional, named);
|
|
74
70
|
this.didSetup = true;
|
|
75
71
|
}
|
|
76
|
-
|
|
72
|
+
_assertClassBrand(_HdsTooltipModifier_brand, this, _update).call(this, element, positional, named);
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
|
-
function
|
|
80
|
-
const tooltipProps =
|
|
75
|
+
function _setup(element, positional, named) {
|
|
76
|
+
const tooltipProps = _assertClassBrand(_HdsTooltipModifier_brand, this, _getTooltipProps).call(this, element, positional, named);
|
|
81
77
|
this.tooltip = tippy(element, tooltipProps);
|
|
82
78
|
}
|
|
83
|
-
function
|
|
84
|
-
const tooltipProps =
|
|
79
|
+
function _update(element, positional, named) {
|
|
80
|
+
const tooltipProps = _assertClassBrand(_HdsTooltipModifier_brand, this, _getTooltipProps).call(this, element, positional, named);
|
|
85
81
|
this.tooltip.setProps(tooltipProps);
|
|
86
82
|
}
|
|
87
|
-
function
|
|
83
|
+
function _getTooltipProps(element, positional, named) {
|
|
88
84
|
const {
|
|
89
85
|
options = {}
|
|
90
86
|
} = named;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hds-tooltip.js","sources":["../../src/modifiers/hds-tooltip.js"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\n// Note: the majority of this code is a porting of the existing tooltip implementation in Cloud UI\n// (which was initially implemented in Structure)\n\nimport Modifier from 'ember-modifier';\nimport { assert } from '@ember/debug';\nimport { registerDestructor } from '@ember/destroyable';\n\nimport tippy, { followCursor } from 'tippy.js';\n// used by custom SVG arrow:\nimport 'tippy.js/dist/svg-arrow.css';\n\nfunction cleanup(instance) {\n const { interval, needsTabIndex, tooltip } = instance;\n if (needsTabIndex) {\n tooltip?.reference?.removeAttribute('tabindex');\n }\n clearInterval(interval);\n tooltip?.destroy();\n}\n\n/**\n *\n * `Tooltip` implements a modifier that uses Tippy.js to display a tooltip.\n *\n * Sample usage:\n * ```\n * <div {{hds-tooltip 'Text' options=(hash )}}>Hover me!</div>\n * ```\n *\n * @see https://atomiks.github.io/tippyjs\n * @class TooltipModifier\n *\n */\nexport default class HdsTooltipModifier extends Modifier {\n didSetup = false;\n\n interval = null;\n needsTabIndex = false;\n tooltip = null;\n\n constructor(owner, args) {\n super(owner, args);\n registerDestructor(this, cleanup);\n }\n\n hideOnEsc = {\n name: 'hideOnEsc',\n defaultValue: true,\n fn({ hide }) {\n function onKeyDown(event) {\n if (event.keyCode === 27) {\n hide();\n }\n }\n\n return {\n onShow() {\n document.addEventListener('keydown', onKeyDown);\n },\n onHide() {\n document.removeEventListener('keydown', onKeyDown);\n },\n };\n },\n };\n\n modify(element, positional, named) {\n assert('Tooltip must have an element', element);\n\n if (!this.didSetup) {\n this.#setup(element, positional, named);\n this.didSetup = true;\n }\n\n this.#update(element, positional, named);\n }\n\n #setup(element, positional, named) {\n const tooltipProps = this.#getTooltipProps(element, positional, named);\n this.tooltip = tippy(element, tooltipProps);\n }\n\n #update(element, positional, named) {\n const tooltipProps = this.#getTooltipProps(element, positional, named);\n this.tooltip.setProps(tooltipProps);\n }\n\n #getTooltipProps(element, positional, named) {\n const { options = {} } = named;\n let [content] = positional;\n\n let $anchor = element;\n\n // Make it easy to specify the modified element as the actual tooltip.\n if (typeof options.triggerTarget === 'string') {\n const $el = $anchor;\n switch (options.triggerTarget) {\n case 'parentNode':\n $anchor = $anchor.parentNode;\n break;\n default:\n $anchor = $anchor.querySelectorAll(options.triggerTarget);\n }\n content = $anchor.cloneNode(true);\n $el.remove();\n options.triggerTarget = undefined;\n }\n\n // The {{hds-tooltip}} will just use the HTML content.\n if (typeof content === 'undefined') {\n content = $anchor.innerHTML;\n $anchor.innerHTML = '';\n }\n\n if (options.trigger === 'manual') {\n // If we are manually triggering, a out delay means only show for the\n // amount of time specified by the delay.\n const delay = options.delay || [];\n\n if (typeof delay[1] !== 'undefined') {\n options.onShown = (tooltip) => {\n clearInterval(this.interval);\n this.interval = setTimeout(() => {\n tooltip.hide();\n }, delay[1]);\n };\n }\n }\n\n const $trigger = $anchor;\n\n if (!$trigger.hasAttribute('tabindex')) {\n this.needsTabIndex = true;\n $trigger.setAttribute('tabindex', '0');\n }\n\n return {\n theme: 'hds',\n triggerTarget: $trigger,\n arrow: `\n <svg class=\"hds-tooltip-pointer\" width=\"16\" height=\"7\" viewBox=\"0 0 16 7\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M0 7H16L9.11989 0.444571C8.49776 -0.148191 7.50224 -0.148191 6.88011 0.444572L0 7Z\" />\n </svg>`,\n // keeps tooltip itself open on hover:\n interactive: true,\n // fix accessibility features that get messed up with setting interactive: true\n aria: {\n content: 'describedby',\n expanded: null,\n },\n content: () => content,\n plugins: [\n typeof options.followCursor !== 'undefined' ? followCursor : undefined,\n this.hideOnEsc,\n ].filter((item) => Boolean(item)),\n ...options,\n };\n }\n}\n"],"names":["cleanup","instance","interval","needsTabIndex","tooltip","reference","removeAttribute","clearInterval","destroy","
|
|
1
|
+
{"version":3,"file":"hds-tooltip.js","sources":["../../src/modifiers/hds-tooltip.js"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\n// Note: the majority of this code is a porting of the existing tooltip implementation in Cloud UI\n// (which was initially implemented in Structure)\n\nimport Modifier from 'ember-modifier';\nimport { assert } from '@ember/debug';\nimport { registerDestructor } from '@ember/destroyable';\n\nimport tippy, { followCursor } from 'tippy.js';\n// used by custom SVG arrow:\nimport 'tippy.js/dist/svg-arrow.css';\n\nfunction cleanup(instance) {\n const { interval, needsTabIndex, tooltip } = instance;\n if (needsTabIndex) {\n tooltip?.reference?.removeAttribute('tabindex');\n }\n clearInterval(interval);\n tooltip?.destroy();\n}\n\n/**\n *\n * `Tooltip` implements a modifier that uses Tippy.js to display a tooltip.\n *\n * Sample usage:\n * ```\n * <div {{hds-tooltip 'Text' options=(hash )}}>Hover me!</div>\n * ```\n *\n * @see https://atomiks.github.io/tippyjs\n * @class TooltipModifier\n *\n */\nexport default class HdsTooltipModifier extends Modifier {\n didSetup = false;\n\n interval = null;\n needsTabIndex = false;\n tooltip = null;\n\n constructor(owner, args) {\n super(owner, args);\n registerDestructor(this, cleanup);\n }\n\n hideOnEsc = {\n name: 'hideOnEsc',\n defaultValue: true,\n fn({ hide }) {\n function onKeyDown(event) {\n if (event.keyCode === 27) {\n hide();\n }\n }\n\n return {\n onShow() {\n document.addEventListener('keydown', onKeyDown);\n },\n onHide() {\n document.removeEventListener('keydown', onKeyDown);\n },\n };\n },\n };\n\n modify(element, positional, named) {\n assert('Tooltip must have an element', element);\n\n if (!this.didSetup) {\n this.#setup(element, positional, named);\n this.didSetup = true;\n }\n\n this.#update(element, positional, named);\n }\n\n #setup(element, positional, named) {\n const tooltipProps = this.#getTooltipProps(element, positional, named);\n this.tooltip = tippy(element, tooltipProps);\n }\n\n #update(element, positional, named) {\n const tooltipProps = this.#getTooltipProps(element, positional, named);\n this.tooltip.setProps(tooltipProps);\n }\n\n #getTooltipProps(element, positional, named) {\n const { options = {} } = named;\n let [content] = positional;\n\n let $anchor = element;\n\n // Make it easy to specify the modified element as the actual tooltip.\n if (typeof options.triggerTarget === 'string') {\n const $el = $anchor;\n switch (options.triggerTarget) {\n case 'parentNode':\n $anchor = $anchor.parentNode;\n break;\n default:\n $anchor = $anchor.querySelectorAll(options.triggerTarget);\n }\n content = $anchor.cloneNode(true);\n $el.remove();\n options.triggerTarget = undefined;\n }\n\n // The {{hds-tooltip}} will just use the HTML content.\n if (typeof content === 'undefined') {\n content = $anchor.innerHTML;\n $anchor.innerHTML = '';\n }\n\n if (options.trigger === 'manual') {\n // If we are manually triggering, a out delay means only show for the\n // amount of time specified by the delay.\n const delay = options.delay || [];\n\n if (typeof delay[1] !== 'undefined') {\n options.onShown = (tooltip) => {\n clearInterval(this.interval);\n this.interval = setTimeout(() => {\n tooltip.hide();\n }, delay[1]);\n };\n }\n }\n\n const $trigger = $anchor;\n\n if (!$trigger.hasAttribute('tabindex')) {\n this.needsTabIndex = true;\n $trigger.setAttribute('tabindex', '0');\n }\n\n return {\n theme: 'hds',\n triggerTarget: $trigger,\n arrow: `\n <svg class=\"hds-tooltip-pointer\" width=\"16\" height=\"7\" viewBox=\"0 0 16 7\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M0 7H16L9.11989 0.444571C8.49776 -0.148191 7.50224 -0.148191 6.88011 0.444572L0 7Z\" />\n </svg>`,\n // keeps tooltip itself open on hover:\n interactive: true,\n // fix accessibility features that get messed up with setting interactive: true\n aria: {\n content: 'describedby',\n expanded: null,\n },\n content: () => content,\n plugins: [\n typeof options.followCursor !== 'undefined' ? followCursor : undefined,\n this.hideOnEsc,\n ].filter((item) => Boolean(item)),\n ...options,\n };\n }\n}\n"],"names":["cleanup","instance","interval","needsTabIndex","tooltip","reference","removeAttribute","clearInterval","destroy","_HdsTooltipModifier_brand","WeakSet","HdsTooltipModifier","Modifier","constructor","owner","args","_classPrivateMethodInitSpec","_defineProperty","name","defaultValue","fn","hide","onKeyDown","event","keyCode","onShow","document","addEventListener","onHide","removeEventListener","registerDestructor","modify","element","positional","named","assert","didSetup","_assertClassBrand","_setup","call","_update","tooltipProps","_getTooltipProps","tippy","setProps","options","content","$anchor","triggerTarget","$el","parentNode","querySelectorAll","cloneNode","remove","undefined","innerHTML","trigger","delay","onShown","setTimeout","$trigger","hasAttribute","setAttribute","theme","arrow","interactive","aria","expanded","plugins","followCursor","hideOnEsc","filter","item","Boolean"],"mappings":";;;;;;;AAgBA,SAASA,OAAOA,CAACC,QAAQ,EAAE;EACzB,MAAM;IAAEC,QAAQ;IAAEC,aAAa;AAAEC,IAAAA,OAAAA;AAAQ,GAAC,GAAGH,QAAQ,CAAA;AACrD,EAAA,IAAIE,aAAa,EAAE;AACjBC,IAAAA,OAAO,EAAEC,SAAS,EAAEC,eAAe,CAAC,UAAU,CAAC,CAAA;AACjD,GAAA;EACAC,aAAa,CAACL,QAAQ,CAAC,CAAA;EACvBE,OAAO,EAAEI,OAAO,EAAE,CAAA;AACpB,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,IAAAC,yBAAA,oBAAAC,OAAA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