@hashicorp/design-system-components 4.1.2 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/dist/_app_/components/hds/form/super-select/after-options.js +1 -0
  2. package/dist/_app_/components/hds/form/super-select/multiple/base.js +1 -0
  3. package/dist/_app_/components/hds/form/super-select/multiple/field.js +1 -0
  4. package/dist/_app_/components/hds/form/super-select/option-group.js +1 -0
  5. package/dist/_app_/components/hds/form/super-select/placeholder.js +1 -0
  6. package/dist/_app_/components/hds/form/super-select/single/base.js +1 -0
  7. package/dist/_app_/components/hds/form/super-select/single/field.js +1 -0
  8. package/dist/_app_/components/hds/popover-primitive/index.js +1 -0
  9. package/dist/_app_/components/hds/rich-tooltip/bubble.js +1 -0
  10. package/dist/_app_/components/hds/rich-tooltip/index.js +1 -0
  11. package/dist/_app_/components/hds/rich-tooltip/toggle.js +1 -0
  12. package/dist/_app_/modifiers/hds-anchored-position.js +1 -0
  13. package/dist/_app_/modifiers/hds-register-event.js +1 -0
  14. package/dist/{_rollupPluginBabelHelpers-lqPQKyNs.js → _rollupPluginBabelHelpers-NoJJJNhk.js} +7 -9
  15. package/dist/{_rollupPluginBabelHelpers-lqPQKyNs.js.map → _rollupPluginBabelHelpers-NoJJJNhk.js.map} +1 -1
  16. package/dist/components/hds/accordion/index.js +8 -2
  17. package/dist/components/hds/accordion/index.js.map +1 -1
  18. package/dist/components/hds/accordion/item/button.js +12 -8
  19. package/dist/components/hds/accordion/item/button.js.map +1 -1
  20. package/dist/components/hds/accordion/item/index.js +6 -6
  21. package/dist/components/hds/accordion/item/index.js.map +1 -1
  22. package/dist/components/hds/alert/description.js +8 -2
  23. package/dist/components/hds/alert/description.js.map +1 -1
  24. package/dist/components/hds/alert/index.js +23 -22
  25. package/dist/components/hds/alert/index.js.map +1 -1
  26. package/dist/components/hds/alert/title.js +8 -2
  27. package/dist/components/hds/alert/title.js.map +1 -1
  28. package/dist/components/hds/alert/types.js +22 -0
  29. package/dist/components/hds/alert/types.js.map +1 -0
  30. package/dist/components/hds/app-footer/copyright.js +1 -1
  31. package/dist/components/hds/app-footer/copyright.js.map +1 -1
  32. package/dist/components/hds/app-footer/index.js +6 -6
  33. package/dist/components/hds/app-footer/index.js.map +1 -1
  34. package/dist/components/hds/app-footer/item.js +10 -4
  35. package/dist/components/hds/app-footer/item.js.map +1 -1
  36. package/dist/components/hds/app-footer/legal-links.js +1 -1
  37. package/dist/components/hds/app-footer/legal-links.js.map +1 -1
  38. package/dist/components/hds/app-footer/link.js +10 -4
  39. package/dist/components/hds/app-footer/link.js.map +1 -1
  40. package/dist/components/hds/app-footer/status-link.js +12 -27
  41. package/dist/components/hds/app-footer/status-link.js.map +1 -1
  42. package/dist/components/hds/app-footer/types.js +38 -0
  43. package/dist/components/hds/app-footer/types.js.map +1 -0
  44. package/dist/components/hds/app-frame/index.js +4 -4
  45. package/dist/components/hds/app-frame/index.js.map +1 -1
  46. package/dist/components/hds/app-frame/parts/footer.js +10 -4
  47. package/dist/components/hds/app-frame/parts/footer.js.map +1 -1
  48. package/dist/components/hds/app-frame/parts/header.js +10 -4
  49. package/dist/components/hds/app-frame/parts/header.js.map +1 -1
  50. package/dist/components/hds/app-frame/parts/main.js +10 -4
  51. package/dist/components/hds/app-frame/parts/main.js.map +1 -1
  52. package/dist/components/hds/app-frame/parts/modals.js +10 -4
  53. package/dist/components/hds/app-frame/parts/modals.js.map +1 -1
  54. package/dist/components/hds/app-frame/parts/sidebar.js +10 -4
  55. package/dist/components/hds/app-frame/parts/sidebar.js.map +1 -1
  56. package/dist/components/hds/badge/index.js +19 -18
  57. package/dist/components/hds/badge/index.js.map +1 -1
  58. package/dist/components/hds/badge/types.js +29 -0
  59. package/dist/components/hds/badge/types.js.map +1 -0
  60. package/dist/components/hds/badge-count/index.js +15 -14
  61. package/dist/components/hds/badge-count/index.js.map +1 -1
  62. package/dist/components/hds/badge-count/types.js +25 -0
  63. package/dist/components/hds/badge-count/types.js.map +1 -0
  64. package/dist/components/hds/button/index.js +9 -9
  65. package/dist/components/hds/button/index.js.map +1 -1
  66. package/dist/components/hds/button-set/index.js +8 -2
  67. package/dist/components/hds/button-set/index.js.map +1 -1
  68. package/dist/components/hds/card/container.js +25 -24
  69. package/dist/components/hds/card/container.js.map +1 -1
  70. package/dist/components/hds/card/types.js +24 -0
  71. package/dist/components/hds/card/types.js.map +1 -0
  72. package/dist/components/hds/code-block/index.js +1 -1
  73. package/dist/components/hds/code-block/index.js.map +1 -1
  74. package/dist/components/hds/copy/button/index.js +1 -1
  75. package/dist/components/hds/copy/button/index.js.map +1 -1
  76. package/dist/components/hds/copy/snippet/index.js +2 -2
  77. package/dist/components/hds/copy/snippet/index.js.map +1 -1
  78. package/dist/components/hds/disclosure-primitive/index.js +2 -2
  79. package/dist/components/hds/disclosure-primitive/index.js.map +1 -1
  80. package/dist/components/hds/dismiss-button/index.js +3 -3
  81. package/dist/components/hds/dismiss-button/index.js.map +1 -1
  82. package/dist/components/hds/dropdown/index.js +1 -1
  83. package/dist/components/hds/dropdown/index.js.map +1 -1
  84. package/dist/components/hds/dropdown/list-item/checkmark.js +1 -1
  85. package/dist/components/hds/dropdown/list-item/checkmark.js.map +1 -1
  86. package/dist/components/hds/dropdown/list-item/interactive.js +1 -1
  87. package/dist/components/hds/dropdown/list-item/interactive.js.map +1 -1
  88. package/dist/components/hds/dropdown/toggle/button.js +1 -1
  89. package/dist/components/hds/dropdown/toggle/icon.js +1 -1
  90. package/dist/components/hds/dropdown/toggle/icon.js.map +1 -1
  91. package/dist/components/hds/flyout/index.js +3 -9
  92. package/dist/components/hds/flyout/index.js.map +1 -1
  93. package/dist/components/hds/form/field/index.js +1 -1
  94. package/dist/components/hds/form/field/index.js.map +1 -1
  95. package/dist/components/hds/form/fieldset/index.js +1 -1
  96. package/dist/components/hds/form/fieldset/index.js.map +1 -1
  97. package/dist/components/hds/form/label/index.js +18 -2
  98. package/dist/components/hds/form/label/index.js.map +1 -1
  99. package/dist/components/hds/form/masked-input/base.js +1 -1
  100. package/dist/components/hds/form/masked-input/base.js.map +1 -1
  101. package/dist/components/hds/form/radio-card/index.js +1 -1
  102. package/dist/components/hds/form/radio-card/index.js.map +1 -1
  103. package/dist/components/hds/form/super-select/after-options.js +10 -0
  104. package/dist/components/hds/form/super-select/after-options.js.map +1 -0
  105. package/dist/components/hds/form/super-select/multiple/base.js +159 -0
  106. package/dist/components/hds/form/super-select/multiple/base.js.map +1 -0
  107. package/dist/components/hds/form/super-select/multiple/field.js +21 -0
  108. package/dist/components/hds/form/super-select/multiple/field.js.map +1 -0
  109. package/dist/components/hds/form/super-select/option-group.js +22 -0
  110. package/dist/components/hds/form/super-select/option-group.js.map +1 -0
  111. package/dist/components/hds/form/super-select/placeholder.js +10 -0
  112. package/dist/components/hds/form/super-select/placeholder.js.map +1 -0
  113. package/dist/components/hds/form/super-select/single/base.js +86 -0
  114. package/dist/components/hds/form/super-select/single/base.js.map +1 -0
  115. package/dist/components/hds/form/super-select/single/field.js +21 -0
  116. package/dist/components/hds/form/super-select/single/field.js.map +1 -0
  117. package/dist/components/hds/form/text-input/field.js +1 -1
  118. package/dist/components/hds/form/text-input/field.js.map +1 -1
  119. package/dist/components/hds/icon-tile/index.js +15 -11
  120. package/dist/components/hds/icon-tile/index.js.map +1 -1
  121. package/dist/components/hds/icon-tile/types.js +32 -0
  122. package/dist/components/hds/icon-tile/types.js.map +1 -0
  123. package/dist/components/hds/interactive/index.js +4 -4
  124. package/dist/components/hds/interactive/index.js.map +1 -1
  125. package/dist/components/hds/link/inline.js +11 -10
  126. package/dist/components/hds/link/inline.js.map +1 -1
  127. package/dist/components/hds/link/standalone.js +16 -15
  128. package/dist/components/hds/link/standalone.js.map +1 -1
  129. package/dist/components/hds/link/types.js +24 -0
  130. package/dist/components/hds/link/types.js.map +1 -0
  131. package/dist/components/hds/menu-primitive/index.js +1 -1
  132. package/dist/components/hds/menu-primitive/index.js.map +1 -1
  133. package/dist/components/hds/modal/index.js +3 -9
  134. package/dist/components/hds/modal/index.js.map +1 -1
  135. package/dist/components/hds/pagination/compact/index.js +1 -1
  136. package/dist/components/hds/pagination/compact/index.js.map +1 -1
  137. package/dist/components/hds/pagination/nav/arrow.js +1 -1
  138. package/dist/components/hds/pagination/nav/arrow.js.map +1 -1
  139. package/dist/components/hds/pagination/nav/number.js +1 -1
  140. package/dist/components/hds/pagination/nav/number.js.map +1 -1
  141. package/dist/components/hds/pagination/numbered/index.js +1 -1
  142. package/dist/components/hds/pagination/numbered/index.js.map +1 -1
  143. package/dist/components/hds/pagination/size-selector/index.js +1 -1
  144. package/dist/components/hds/pagination/size-selector/index.js.map +1 -1
  145. package/dist/components/hds/popover-primitive/index.js +238 -0
  146. package/dist/components/hds/popover-primitive/index.js.map +1 -0
  147. package/dist/components/hds/reveal/index.js +21 -17
  148. package/dist/components/hds/reveal/index.js.map +1 -1
  149. package/dist/components/hds/reveal/toggle/button.js +5 -5
  150. package/dist/components/hds/reveal/toggle/button.js.map +1 -1
  151. package/dist/components/hds/rich-tooltip/bubble.js +60 -0
  152. package/dist/components/hds/rich-tooltip/bubble.js.map +1 -0
  153. package/dist/components/hds/rich-tooltip/index.js +26 -0
  154. package/dist/components/hds/rich-tooltip/index.js.map +1 -0
  155. package/dist/components/hds/rich-tooltip/toggle.js +85 -0
  156. package/dist/components/hds/rich-tooltip/toggle.js.map +1 -0
  157. package/dist/components/hds/separator/index.js +9 -8
  158. package/dist/components/hds/separator/index.js.map +1 -1
  159. package/dist/components/hds/separator/types.js +13 -0
  160. package/dist/components/hds/separator/types.js.map +1 -0
  161. package/dist/components/hds/side-nav/index.js +1 -1
  162. package/dist/components/hds/side-nav/index.js.map +1 -1
  163. package/dist/components/hds/side-nav/portal/target.js +1 -1
  164. package/dist/components/hds/side-nav/portal/target.js.map +1 -1
  165. package/dist/components/hds/stepper/step/indicator.js +9 -8
  166. package/dist/components/hds/stepper/step/indicator.js.map +1 -1
  167. package/dist/components/hds/stepper/task/indicator.js +10 -14
  168. package/dist/components/hds/stepper/task/indicator.js.map +1 -1
  169. package/dist/components/hds/stepper/types.js +21 -0
  170. package/dist/components/hds/stepper/types.js.map +1 -0
  171. package/dist/components/hds/table/index.js +1 -1
  172. package/dist/components/hds/table/index.js.map +1 -1
  173. package/dist/components/hds/table/th-button-sort.js +1 -1
  174. package/dist/components/hds/table/th-button-tooltip.js +1 -1
  175. package/dist/components/hds/table/th-selectable.js +1 -1
  176. package/dist/components/hds/table/th-selectable.js.map +1 -1
  177. package/dist/components/hds/table/th-sort.js +1 -1
  178. package/dist/components/hds/table/th.js +1 -1
  179. package/dist/components/hds/tabs/index.js +1 -1
  180. package/dist/components/hds/tabs/index.js.map +1 -1
  181. package/dist/components/hds/tabs/panel.js +1 -1
  182. package/dist/components/hds/tabs/panel.js.map +1 -1
  183. package/dist/components/hds/tabs/tab.js +1 -1
  184. package/dist/components/hds/tabs/tab.js.map +1 -1
  185. package/dist/components/hds/tag/index.js +11 -10
  186. package/dist/components/hds/tag/index.js.map +1 -1
  187. package/dist/components/hds/tag/types.js +13 -0
  188. package/dist/components/hds/tag/types.js.map +1 -0
  189. package/dist/components/hds/text/body.js +8 -7
  190. package/dist/components/hds/text/body.js.map +1 -1
  191. package/dist/components/hds/text/code.js +8 -7
  192. package/dist/components/hds/text/code.js.map +1 -1
  193. package/dist/components/hds/text/display.js +19 -12
  194. package/dist/components/hds/text/display.js.map +1 -1
  195. package/dist/components/hds/text/index.js +17 -13
  196. package/dist/components/hds/text/index.js.map +1 -1
  197. package/dist/components/hds/text/types.js +58 -0
  198. package/dist/components/hds/text/types.js.map +1 -0
  199. package/dist/components/hds/toast/index.js +8 -2
  200. package/dist/components/hds/toast/index.js.map +1 -1
  201. package/dist/components/hds/yield/index.js +8 -2
  202. package/dist/components/hds/yield/index.js.map +1 -1
  203. package/dist/helpers/hds-link-to-models.js.map +1 -1
  204. package/dist/modifiers/hds-anchored-position.js +175 -0
  205. package/dist/modifiers/hds-anchored-position.js.map +1 -0
  206. package/dist/modifiers/hds-register-event.js +40 -0
  207. package/dist/modifiers/hds-register-event.js.map +1 -0
  208. package/dist/modifiers/hds-tooltip.js +10 -14
  209. package/dist/modifiers/hds-tooltip.js.map +1 -1
  210. package/dist/styles/@hashicorp/design-system-components.css +565 -3
  211. package/dist/styles/@hashicorp/design-system-components.scss +1 -0
  212. package/dist/styles/@hashicorp/design-system-power-select-overrides.scss +0 -1
  213. package/dist/styles/components/code-block/theme.scss +1 -1
  214. package/dist/styles/components/dropdown.scss +7 -0
  215. package/dist/styles/components/form/index.scss +1 -0
  216. package/dist/styles/components/form/select.scss +0 -1
  217. package/dist/styles/components/form/super-select.scss +515 -0
  218. package/dist/styles/components/form/text-input.scss +0 -1
  219. package/dist/styles/components/form/textarea.scss +0 -1
  220. package/dist/styles/components/page-header.scss +1 -0
  221. package/dist/styles/components/rich-tooltip.scss +247 -0
  222. package/dist/styles/components/tabs.scss +2 -1
  223. package/dist/styles/components/tooltip.scss +1 -1
  224. package/package.json +58 -23
@@ -1,5 +1,6 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { assert } from '@ember/debug';
3
+ import { HdsTextColorValues, HdsTextAlignValues } from './types.js';
3
4
  import { precompileTemplate } from '@ember/template-compilation';
4
5
  import { setComponentTemplate } from '@ember/component';
5
6
 
@@ -10,9 +11,12 @@ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-
10
11
  * SPDX-License-Identifier: MPL-2.0
11
12
  */
12
13
 
13
- const AVAILABLE_ALIGNS = ['left', 'center', 'right'];
14
- const AVAILABLE_COLORS = ['primary', 'strong', 'faint', 'disabled', 'high-contrast', 'action', 'action-hover', 'action-active', 'highlight', 'highlight-on-surface', 'highlight-high-contrast', 'success', 'success-on-surface', 'success-high-contrast', 'warning', 'warning-on-surface', 'warning-high-contrast', 'critical', 'critical-on-surface', 'critical-high-contrast'];
15
- class HdsTextIndexComponent extends Component {
14
+ const AVAILABLE_COLORS = Object.values(HdsTextColorValues);
15
+ const AVAILABLE_ALIGNS = Object.values(HdsTextAlignValues);
16
+
17
+ // A union of all types in the HTMLElementTagNameMap interface
18
+
19
+ class HdsTextComponent extends Component {
16
20
  /**
17
21
  * Get a tag to render based on the `@tag` argument passed or the value of `this.size` (via mapping)
18
22
  *
@@ -20,7 +24,7 @@ class HdsTextIndexComponent extends Component {
20
24
  * @return {string} The html tag to use in the dynamic render of the component
21
25
  */
22
26
  get componentTag() {
23
- let {
27
+ const {
24
28
  tag = 'span'
25
29
  } = this.args;
26
30
  return tag;
@@ -35,7 +39,7 @@ class HdsTextIndexComponent extends Component {
35
39
  * @param variant
36
40
  */
37
41
  get variant() {
38
- let {
42
+ const {
39
43
  group,
40
44
  size
41
45
  } = this.args;
@@ -53,7 +57,7 @@ class HdsTextIndexComponent extends Component {
53
57
  * @type {string}
54
58
  */
55
59
  get align() {
56
- let {
60
+ const {
57
61
  align
58
62
  } = this.args;
59
63
  if (align) {
@@ -70,10 +74,10 @@ class HdsTextIndexComponent extends Component {
70
74
  * @type {string}
71
75
  */
72
76
  get predefinedColor() {
73
- let {
77
+ const {
74
78
  color
75
79
  } = this.args;
76
- if (AVAILABLE_COLORS.includes(color)) {
80
+ if (color && AVAILABLE_COLORS.includes(color)) {
77
81
  return color;
78
82
  } else {
79
83
  return undefined;
@@ -87,10 +91,10 @@ class HdsTextIndexComponent extends Component {
87
91
  * @type {string}
88
92
  */
89
93
  get customColor() {
90
- let {
94
+ const {
91
95
  color
92
96
  } = this.args;
93
- if (!AVAILABLE_COLORS.includes(color)) {
97
+ if (color && !AVAILABLE_COLORS.includes(color)) {
94
98
  return color;
95
99
  } else {
96
100
  return undefined;
@@ -103,7 +107,7 @@ class HdsTextIndexComponent extends Component {
103
107
  * @return {string} The "class" attribute to apply to the component.
104
108
  */
105
109
  get classNames() {
106
- let classes = ['hds-text'];
110
+ const classes = ['hds-text'];
107
111
 
108
112
  // add a (helper) class based on the "group + size" variant
109
113
  classes.push(`hds-typography-${this.variant}`);
@@ -125,7 +129,7 @@ class HdsTextIndexComponent extends Component {
125
129
  return classes.join(' ');
126
130
  }
127
131
  }
128
- setComponentTemplate(TEMPLATE, HdsTextIndexComponent);
132
+ setComponentTemplate(TEMPLATE, HdsTextComponent);
129
133
 
130
- export { AVAILABLE_ALIGNS, AVAILABLE_COLORS, HdsTextIndexComponent as default };
134
+ export { AVAILABLE_ALIGNS, AVAILABLE_COLORS, HdsTextComponent as default };
131
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.js"],"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';\n\nexport const AVAILABLE_ALIGNS = ['left', 'center', 'right'];\n\nexport const AVAILABLE_COLORS = [\n 'primary',\n 'strong',\n 'faint',\n 'disabled',\n 'high-contrast',\n 'action',\n 'action-hover',\n 'action-active',\n 'highlight',\n 'highlight-on-surface',\n 'highlight-high-contrast',\n 'success',\n 'success-on-surface',\n 'success-high-contrast',\n 'warning',\n 'warning-on-surface',\n 'warning-high-contrast',\n 'critical',\n 'critical-on-surface',\n 'critical-high-contrast',\n];\n\nexport default class HdsTextIndexComponent extends Component {\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() {\n let { 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 let { 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 let { 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 let { color } = this.args;\n\n if (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 let { color } = this.args;\n\n if (!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 let 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_ALIGNS","AVAILABLE_COLORS","HdsTextIndexComponent","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;;AAKO,MAAMA,gBAAgB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAC;MAE9CC,gBAAgB,GAAG,CAC9B,SAAS,EACT,QAAQ,EACR,OAAO,EACP,UAAU,EACV,eAAe,EACf,QAAQ,EACR,cAAc,EACd,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,yBAAyB,EACzB,SAAS,EACT,oBAAoB,EACpB,uBAAuB,EACvB,SAAS,EACT,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,qBAAqB,EACrB,wBAAwB,EACzB;AAEc,MAAMC,qBAAqB,SAASC,SAAS,CAAC;AAC3D;AACF;AACA;AACA;AACA;AACA;EACE,IAAIC,YAAYA,GAAG;IACjB,IAAI;AAAEC,MAAAA,GAAG,GAAG,MAAA;KAAQ,GAAG,IAAI,CAACC,IAAI,CAAA;AAEhC,IAAA,OAAOD,GAAG,CAAA;AACZ,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIE,OAAOA,GAAG;IACZ,IAAI;MAAEC,KAAK;AAAEC,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACH,IAAI,CAAA;;AAE/B;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,IAAI;AAAEA,MAAAA,KAAAA;KAAO,GAAG,IAAI,CAACJ,IAAI,CAAA;AAEzB,IAAA,IAAII,KAAK,EAAE;AACTC,MAAAA,MAAM,CACH,CAAuDX,qDAAAA,EAAAA,gBAAgB,CAACY,IAAI,CAC3E,IACF,CAAE,CAAA,Y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C,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,qBAAqB,CAAA;;;;"}
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,CAACY,IAAI,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AE,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;;;;"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ let HdsTextColorValues = /*#__PURE__*/function (HdsTextColorValues) {
7
+ HdsTextColorValues["Primary"] = "primary";
8
+ HdsTextColorValues["Strong"] = "strong";
9
+ HdsTextColorValues["Faint"] = "faint";
10
+ HdsTextColorValues["Disabled"] = "disabled";
11
+ HdsTextColorValues["HighContrast"] = "high-contrast";
12
+ HdsTextColorValues["Action"] = "action";
13
+ HdsTextColorValues["ActionHover"] = "action-hover";
14
+ HdsTextColorValues["ActionActive"] = "action-active";
15
+ HdsTextColorValues["Highlight"] = "highlight";
16
+ HdsTextColorValues["HighlightOnSurface"] = "highlight-on-surface";
17
+ HdsTextColorValues["HighlightHighContrast"] = "highlight-high-contrast";
18
+ HdsTextColorValues["Success"] = "success";
19
+ HdsTextColorValues["SuccessOnSurface"] = "success-on-surface";
20
+ HdsTextColorValues["SuccessHighContrast"] = "success-high-contrast";
21
+ HdsTextColorValues["Warning"] = "warning";
22
+ HdsTextColorValues["WarningOnSurface"] = "warning-on-surface";
23
+ HdsTextColorValues["WarningHighContrast"] = "warning-high-contrast";
24
+ HdsTextColorValues["Critical"] = "critical";
25
+ HdsTextColorValues["CriticalOnSurface"] = "critical-on-surface";
26
+ HdsTextColorValues["CriticalHighContrast"] = "critical-high-contrast";
27
+ return HdsTextColorValues;
28
+ }({});
29
+ let HdsTextAlignValues = /*#__PURE__*/function (HdsTextAlignValues) {
30
+ HdsTextAlignValues["Left"] = "left";
31
+ HdsTextAlignValues["Center"] = "center";
32
+ HdsTextAlignValues["Right"] = "right";
33
+ return HdsTextAlignValues;
34
+ }({});
35
+ let HdsTextWeightValues = /*#__PURE__*/function (HdsTextWeightValues) {
36
+ HdsTextWeightValues["Regular"] = "regular";
37
+ HdsTextWeightValues["Medium"] = "medium";
38
+ HdsTextWeightValues["Semibold"] = "semibold";
39
+ HdsTextWeightValues["Bold"] = "bold";
40
+ return HdsTextWeightValues;
41
+ }({});
42
+ let HdsTextSizeValues = /*#__PURE__*/function (HdsTextSizeValues) {
43
+ HdsTextSizeValues[HdsTextSizeValues["FiveHundred"] = 500] = "FiveHundred";
44
+ HdsTextSizeValues[HdsTextSizeValues["FourHundred"] = 400] = "FourHundred";
45
+ HdsTextSizeValues[HdsTextSizeValues["ThreeHundred"] = 300] = "ThreeHundred";
46
+ HdsTextSizeValues[HdsTextSizeValues["TwoHundred"] = 200] = "TwoHundred";
47
+ HdsTextSizeValues[HdsTextSizeValues["OneHundred"] = 100] = "OneHundred";
48
+ return HdsTextSizeValues;
49
+ }({});
50
+ let HdsTextGroupValues = /*#__PURE__*/function (HdsTextGroupValues) {
51
+ HdsTextGroupValues["Code"] = "code";
52
+ HdsTextGroupValues["Display"] = "display";
53
+ HdsTextGroupValues["Body"] = "body";
54
+ return HdsTextGroupValues;
55
+ }({});
56
+
57
+ export { HdsTextAlignValues, HdsTextColorValues, HdsTextGroupValues, HdsTextSizeValues, HdsTextWeightValues };
58
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../../src/components/hds/text/types.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport type HdsTextTags = keyof HTMLElementTagNameMap;\n\nexport enum HdsTextColorValues {\n Primary = 'primary',\n Strong = 'strong',\n Faint = 'faint',\n Disabled = 'disabled',\n HighContrast = 'high-contrast',\n Action = 'action',\n ActionHover = 'action-hover',\n ActionActive = 'action-active',\n Highlight = 'highlight',\n HighlightOnSurface = 'highlight-on-surface',\n HighlightHighContrast = 'highlight-high-contrast',\n Success = 'success',\n SuccessOnSurface = 'success-on-surface',\n SuccessHighContrast = 'success-high-contrast',\n Warning = 'warning',\n WarningOnSurface = 'warning-on-surface',\n WarningHighContrast = 'warning-high-contrast',\n Critical = 'critical',\n CriticalOnSurface = 'critical-on-surface',\n CriticalHighContrast = 'critical-high-contrast',\n}\nexport type HdsTextColors = `${HdsTextColorValues}`;\n\nexport enum HdsTextAlignValues {\n Left = 'left',\n Center = 'center',\n Right = 'right',\n}\nexport type HdsTextAligns = `${HdsTextAlignValues}`;\n\nexport enum HdsTextWeightValues {\n Regular = 'regular',\n Medium = 'medium',\n Semibold = 'semibold',\n Bold = 'bold',\n}\nexport type HdsTextWeights = `${HdsTextWeightValues}`;\n\nexport enum HdsTextSizeValues {\n FiveHundred = 500,\n FourHundred = 400,\n ThreeHundred = 300,\n TwoHundred = 200,\n OneHundred = 100,\n}\ntype HdsTextSizesString = `${HdsTextSizeValues}`;\ntype HdsTextSizesNumber =\n `${HdsTextSizeValues}` extends `${infer T extends number}` ? T : never;\nexport type HdsTextSizes = HdsTextSizesString | HdsTextSizesNumber;\n\nexport enum HdsTextGroupValues {\n Code = 'code',\n Display = 'display',\n Body = 'body',\n}\nexport type HdsTextGroups = `${HdsTextGroupValues}`;\n"],"names":["HdsTextColorValues","HdsTextAlignValues","HdsTextWeightValues","HdsTextSizeValues","HdsTextGroupValues"],"mappings":"AAAA;AACA;AACA;AACA;;AAIYA,IAAAA,kBAAkB,0BAAlBA,kBAAkB,EAAA;EAAlBA,kBAAkB,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;EAAlBA,kBAAkB,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAAlBA,kBAAk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AAA,EAAA;;;;"}
@@ -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("{{! @glint-nocheck: not typesafe yet }}\n{{!\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>");
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
- var index = setComponentTemplate(TEMPLATE, templateOnly());
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.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::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>\")","import templateOnly from '@ember/component/template-only';\nexport default templateOnly();\n"],"names":["setComponentTemplate","TEMPLATE","templateOnly"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,waAAwa;;ACA1c,YAAAA,oBAAA,CAAAC,QAAA,EAAeC,YAAY,EAAE,CAAA;;;;"}
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;;;;"}
@@ -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("{{! @glint-nocheck: not typesafe yet }}\n{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n{{! template-lint-disable no-yield-only }}\n{{yield}}");
5
+ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n{{! template-lint-disable no-yield-only }}\n{{yield}}");
6
6
 
7
- var index = setComponentTemplate(TEMPLATE, templateOnly());
7
+ /**
8
+ * Copyright (c) HashiCorp, Inc.
9
+ * SPDX-License-Identifier: MPL-2.0
10
+ */
11
+
12
+ const HdsYieldComponent = templateOnly();
13
+ var index = setComponentTemplate(TEMPLATE, HdsYieldComponent);
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/yield/index.hbs","../../../../src/components/hds/yield/index.js"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{! @glint-nocheck: not typesafe yet }}\\n{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n{{! template-lint-disable no-yield-only }}\\n{{yield}}\")","import templateOnly from '@ember/component/template-only';\nexport default templateOnly();\n"],"names":["setComponentTemplate","TEMPLATE","templateOnly"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,8KAA8K;;ACAhN,YAAAA,oBAAA,CAAAC,QAAA,EAAeC,YAAY,EAAE,CAAA;;;;"}
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;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hds-link-to-models.js","sources":["../../src/helpers/hds-link-to-models.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport { helper } from '@ember/component/helper';\nimport { assert } from '@ember/debug';\n\n/*\n * This helper can be used to support both @model and @models arguments when wrapping\n * the `<LinkTo>` component without it triggering assertions or having to use the component helper.\n *\n * The result of this helper should be passed into the `@models` argument of the `<LinkTo>` component:\n *\n * ```hbs\n * <LinkTo @models={{hds-link-to-models @model @models}} />\n * ```\n */\n\nexport function hdsLinkToModels<T>([model, models]: [T | undefined, T[] | undefined]) {\n assert(\n 'You cannot provide both the `@model` and `@models` arguments to the component.',\n !model || !models\n );\n\n if (model) {\n return [model];\n } else if (models) {\n return models;\n } else {\n return [];\n }\n}\n\nconst hdsLinkToModelsHelper = helper(hdsLinkToModels);\nexport default hdsLinkToModelsHelper;\n"],"names":["hdsLinkToModels","model","models","assert","hdsLinkToModelsHelper","helper"],"mappings":";;;AAAA;AACA;AACA;AACA;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAASA,eAAeA,CAAI,CAACC,KAAK,EAAEC,MAAM,CAAmC,EAAE;EACpFC,MAAM,CACJ,gFAAgF,EAChF,CAACF,KAAK,IAAI,CAACC,MACb,CAAC,CAAA;AAED,EAAA,IAAID,KAAK,EAAE;IACT,OAAO,CAACA,KAAK,CAAC,CAAA;GACf,MAAM,IAAIC,MAAM,EAAE;AACjB,IAAA,OAAOA,MAAM,CAAA;AACf,GAAC,MAAM;AACL,IAAA,OAAO,EAAE,CAAA;AACX,GAAA;AACF,CAAA;AAEA,MAAME,qBAAqB,GAAGC,MAAM,CAACL,eAAe;;;;"}
1
+ {"version":3,"file":"hds-link-to-models.js","sources":["../../src/helpers/hds-link-to-models.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport { helper } from '@ember/component/helper';\nimport { assert } from '@ember/debug';\n\n/*\n * This helper can be used to support both @model and @models arguments when wrapping\n * the `<LinkTo>` component without it triggering assertions or having to use the component helper.\n *\n * The result of this helper should be passed into the `@models` argument of the `<LinkTo>` component:\n *\n * ```hbs\n * <LinkTo @models={{hds-link-to-models @model @models}} />\n * ```\n */\n\nexport function hdsLinkToModels<T>([model, models]: [\n T | undefined,\n T[] | undefined\n]) {\n assert(\n 'You cannot provide both the `@model` and `@models` arguments to the component.',\n !model || !models\n );\n\n if (model) {\n return [model];\n } else if (models) {\n return models;\n } else {\n return [];\n }\n}\n\nconst hdsLinkToModelsHelper = helper(hdsLinkToModels);\nexport default hdsLinkToModelsHelper;\n"],"names":["hdsLinkToModels","model","models","assert","hdsLinkToModelsHelper","helper"],"mappings":";;;AAAA;AACA;AACA;AACA;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAASA,eAAeA,CAAI,CAACC,KAAK,EAAEC,MAAM,CAGhD,EAAE;EACDC,MAAM,CACJ,gFAAgF,EAChF,CAACF,KAAK,IAAI,CAACC,MACb,CAAC,CAAA;AAED,EAAA,IAAID,KAAK,EAAE;IACT,OAAO,CAACA,KAAK,CAAC,CAAA;GACf,MAAM,IAAIC,MAAM,EAAE;AACjB,IAAA,OAAOA,MAAM,CAAA;AACf,GAAC,MAAM;AACL,IAAA,OAAO,EAAE,CAAA;AACX,GAAA;AACF,CAAA;AAEA,MAAME,qBAAqB,GAAGC,MAAM,CAACL,eAAe;;;;"}
@@ -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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**
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, _ as _defineProperty, d as _classPrivateMethodGet } from '../_rollupPluginBabelHelpers-lqPQKyNs.js';
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 _setup = /*#__PURE__*/new WeakSet();
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, _getTooltipProps);
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
- _classPrivateMethodGet(this, _setup, _setup2).call(this, element, positional, named);
69
+ _assertClassBrand(_HdsTooltipModifier_brand, this, _setup).call(this, element, positional, named);
74
70
  this.didSetup = true;
75
71
  }
76
- _classPrivateMethodGet(this, _update, _update2).call(this, element, positional, named);
72
+ _assertClassBrand(_HdsTooltipModifier_brand, this, _update).call(this, element, positional, named);
77
73
  }
78
74
  }
79
- function _setup2(element, positional, named) {
80
- const tooltipProps = _classPrivateMethodGet(this, _getTooltipProps, _getTooltipProps2).call(this, element, positional, named);
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 _update2(element, positional, named) {
84
- const tooltipProps = _classPrivateMethodGet(this, _getTooltipProps, _getTooltipProps2).call(this, element, positional, named);
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 _getTooltipProps2(element, positional, named) {
83
+ function _getTooltipProps(element, positional, named) {
88
84
  const {
89
85
  options = {}
90
86
  } = named;