@hashicorp/design-system-components 4.7.0 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/declarations/components/hds/alert/index.d.ts +1 -1
  2. package/declarations/components/hds/alert/index.d.ts.map +1 -1
  3. package/declarations/components/hds/app-header/home-link.d.ts +19 -0
  4. package/declarations/components/hds/app-header/home-link.d.ts.map +1 -0
  5. package/declarations/components/hds/app-header/index.d.ts +32 -0
  6. package/declarations/components/hds/app-header/index.d.ts.map +1 -0
  7. package/declarations/components/hds/app-header/menu-button.d.ts +19 -0
  8. package/declarations/components/hds/app-header/menu-button.d.ts.map +1 -0
  9. package/declarations/components/hds/application-state/footer.d.ts +7 -17
  10. package/declarations/components/hds/application-state/footer.d.ts.map +1 -1
  11. package/declarations/components/hds/application-state/header.d.ts +6 -3
  12. package/declarations/components/hds/application-state/header.d.ts.map +1 -1
  13. package/declarations/components/hds/application-state/index.d.ts +12 -3
  14. package/declarations/components/hds/application-state/index.d.ts.map +1 -1
  15. package/declarations/components/hds/application-state/media.d.ts +14 -0
  16. package/declarations/components/hds/application-state/media.d.ts.map +1 -0
  17. package/declarations/components/hds/application-state/types.d.ts +6 -0
  18. package/declarations/components/hds/application-state/types.d.ts.map +1 -0
  19. package/declarations/components/hds/badge-count/index.d.ts +1 -2
  20. package/declarations/components/hds/badge-count/index.d.ts.map +1 -1
  21. package/declarations/components/hds/breadcrumb/index.d.ts +18 -4
  22. package/declarations/components/hds/breadcrumb/index.d.ts.map +1 -1
  23. package/declarations/components/hds/breadcrumb/item.d.ts +26 -5
  24. package/declarations/components/hds/breadcrumb/item.d.ts.map +1 -1
  25. package/declarations/components/hds/breadcrumb/truncation.d.ts +15 -3
  26. package/declarations/components/hds/breadcrumb/truncation.d.ts.map +1 -1
  27. package/declarations/components/hds/copy/snippet/index.d.ts +1 -2
  28. package/declarations/components/hds/copy/snippet/index.d.ts.map +1 -1
  29. package/declarations/components/hds/dropdown/footer.d.ts +16 -1
  30. package/declarations/components/hds/dropdown/footer.d.ts.map +1 -1
  31. package/declarations/components/hds/dropdown/header.d.ts +16 -1
  32. package/declarations/components/hds/dropdown/header.d.ts.map +1 -1
  33. package/declarations/components/hds/dropdown/index.d.ts +56 -7
  34. package/declarations/components/hds/dropdown/index.d.ts.map +1 -1
  35. package/declarations/components/hds/dropdown/list-item/checkbox.d.ts +18 -3
  36. package/declarations/components/hds/dropdown/list-item/checkbox.d.ts.map +1 -1
  37. package/declarations/components/hds/dropdown/list-item/checkmark.d.ts +19 -3
  38. package/declarations/components/hds/dropdown/list-item/checkmark.d.ts.map +1 -1
  39. package/declarations/components/hds/dropdown/list-item/copy-item.d.ts +17 -5
  40. package/declarations/components/hds/dropdown/list-item/copy-item.d.ts.map +1 -1
  41. package/declarations/components/hds/dropdown/list-item/description.d.ts +13 -3
  42. package/declarations/components/hds/dropdown/list-item/description.d.ts.map +1 -1
  43. package/declarations/components/hds/dropdown/list-item/generic.d.ts +13 -1
  44. package/declarations/components/hds/dropdown/list-item/generic.d.ts.map +1 -1
  45. package/declarations/components/hds/dropdown/list-item/interactive.d.ts +23 -6
  46. package/declarations/components/hds/dropdown/list-item/interactive.d.ts.map +1 -1
  47. package/declarations/components/hds/dropdown/list-item/radio.d.ts +18 -3
  48. package/declarations/components/hds/dropdown/list-item/radio.d.ts.map +1 -1
  49. package/declarations/components/hds/dropdown/list-item/separator.d.ts +10 -1
  50. package/declarations/components/hds/dropdown/list-item/separator.d.ts.map +1 -1
  51. package/declarations/components/hds/dropdown/list-item/title.d.ts +13 -3
  52. package/declarations/components/hds/dropdown/list-item/title.d.ts.map +1 -1
  53. package/declarations/components/hds/dropdown/list-item/types.d.ts +10 -0
  54. package/declarations/components/hds/dropdown/list-item/types.d.ts.map +1 -0
  55. package/declarations/components/hds/dropdown/toggle/button.d.ts +34 -11
  56. package/declarations/components/hds/dropdown/toggle/button.d.ts.map +1 -1
  57. package/declarations/components/hds/dropdown/toggle/chevron.d.ts +9 -1
  58. package/declarations/components/hds/dropdown/toggle/chevron.d.ts.map +1 -1
  59. package/declarations/components/hds/dropdown/toggle/icon.d.ts +27 -8
  60. package/declarations/components/hds/dropdown/toggle/icon.d.ts.map +1 -1
  61. package/declarations/components/hds/dropdown/toggle/types.d.ts +20 -0
  62. package/declarations/components/hds/dropdown/toggle/types.d.ts.map +1 -0
  63. package/declarations/components/hds/dropdown/types.d.ts +12 -0
  64. package/declarations/components/hds/dropdown/types.d.ts.map +1 -0
  65. package/declarations/components/hds/flyout/index.d.ts.map +1 -1
  66. package/declarations/components/hds/flyout/types.d.ts +4 -0
  67. package/declarations/components/hds/flyout/types.d.ts.map +1 -1
  68. package/declarations/components/hds/form/checkbox/base.d.ts +1 -1
  69. package/declarations/components/hds/form/checkbox/base.d.ts.map +1 -1
  70. package/declarations/components/hds/icon-tile/index.d.ts +1 -1
  71. package/declarations/components/hds/icon-tile/index.d.ts.map +1 -1
  72. package/declarations/components/hds/link/standalone.d.ts +1 -1
  73. package/declarations/components/hds/link/standalone.d.ts.map +1 -1
  74. package/declarations/components/hds/menu-primitive/index.d.ts +32 -9
  75. package/declarations/components/hds/menu-primitive/index.d.ts.map +1 -1
  76. package/declarations/components/hds/modal/index.d.ts.map +1 -1
  77. package/declarations/components/hds/popover-primitive/index.d.ts.map +1 -1
  78. package/declarations/components/hds/segmented-group/index.d.ts +27 -1
  79. package/declarations/components/hds/segmented-group/index.d.ts.map +1 -1
  80. package/declarations/components/hds/side-nav/index.d.ts +1 -0
  81. package/declarations/components/hds/side-nav/index.d.ts.map +1 -1
  82. package/declarations/components.d.ts +11 -1
  83. package/declarations/components.d.ts.map +1 -1
  84. package/declarations/modifiers/hds-tooltip.d.ts +24 -8
  85. package/declarations/modifiers/hds-tooltip.d.ts.map +1 -1
  86. package/declarations/template-registry.d.ts +74 -0
  87. package/declarations/template-registry.d.ts.map +1 -1
  88. package/dist/_app_/components/hds/app-header/home-link.js +1 -0
  89. package/dist/_app_/components/hds/app-header/index.js +1 -0
  90. package/dist/_app_/components/hds/app-header/menu-button.js +1 -0
  91. package/dist/_app_/components/hds/application-state/media.js +1 -0
  92. package/dist/components/hds/alert/index.js.map +1 -1
  93. package/dist/components/hds/app-header/home-link.js +25 -0
  94. package/dist/components/hds/app-header/home-link.js.map +1 -0
  95. package/dist/components/hds/app-header/index.js +88 -0
  96. package/dist/components/hds/app-header/index.js.map +1 -0
  97. package/dist/components/hds/app-header/menu-button.js +26 -0
  98. package/dist/components/hds/app-header/menu-button.js.map +1 -0
  99. package/dist/components/hds/application-state/footer.js +5 -31
  100. package/dist/components/hds/application-state/footer.js.map +1 -1
  101. package/dist/components/hds/application-state/header.js +9 -5
  102. package/dist/components/hds/application-state/header.js.map +1 -1
  103. package/dist/components/hds/application-state/index.js +21 -5
  104. package/dist/components/hds/application-state/index.js.map +1 -1
  105. package/dist/components/hds/application-state/media.js +16 -0
  106. package/dist/components/hds/application-state/media.js.map +1 -0
  107. package/dist/components/hds/application-state/types.js +8 -0
  108. package/dist/components/hds/application-state/types.js.map +1 -0
  109. package/dist/components/hds/badge-count/index.js.map +1 -1
  110. package/dist/components/hds/breadcrumb/index.js +3 -3
  111. package/dist/components/hds/breadcrumb/index.js.map +1 -1
  112. package/dist/components/hds/breadcrumb/item.js +3 -3
  113. package/dist/components/hds/breadcrumb/item.js.map +1 -1
  114. package/dist/components/hds/breadcrumb/truncation.js +1 -1
  115. package/dist/components/hds/breadcrumb/truncation.js.map +1 -1
  116. package/dist/components/hds/copy/snippet/index.js.map +1 -1
  117. package/dist/components/hds/dialog-primitive/header.js.map +1 -1
  118. package/dist/components/hds/dropdown/footer.js +8 -2
  119. package/dist/components/hds/dropdown/footer.js.map +1 -1
  120. package/dist/components/hds/dropdown/header.js +8 -2
  121. package/dist/components/hds/dropdown/header.js.map +1 -1
  122. package/dist/components/hds/dropdown/index.js +13 -10
  123. package/dist/components/hds/dropdown/index.js.map +1 -1
  124. package/dist/components/hds/dropdown/list-item/checkbox.js +1 -1
  125. package/dist/components/hds/dropdown/list-item/checkbox.js.map +1 -1
  126. package/dist/components/hds/dropdown/list-item/checkmark.js +2 -2
  127. package/dist/components/hds/dropdown/list-item/checkmark.js.map +1 -1
  128. package/dist/components/hds/dropdown/list-item/copy-item.js +4 -4
  129. package/dist/components/hds/dropdown/list-item/copy-item.js.map +1 -1
  130. package/dist/components/hds/dropdown/list-item/description.js +2 -2
  131. package/dist/components/hds/dropdown/list-item/description.js.map +1 -1
  132. package/dist/components/hds/dropdown/list-item/generic.js +8 -2
  133. package/dist/components/hds/dropdown/list-item/generic.js.map +1 -1
  134. package/dist/components/hds/dropdown/list-item/interactive.js +7 -6
  135. package/dist/components/hds/dropdown/list-item/interactive.js.map +1 -1
  136. package/dist/components/hds/dropdown/list-item/radio.js +1 -1
  137. package/dist/components/hds/dropdown/list-item/radio.js.map +1 -1
  138. package/dist/components/hds/dropdown/list-item/separator.js +8 -2
  139. package/dist/components/hds/dropdown/list-item/separator.js.map +1 -1
  140. package/dist/components/hds/dropdown/list-item/title.js +2 -2
  141. package/dist/components/hds/dropdown/list-item/title.js.map +1 -1
  142. package/dist/components/hds/dropdown/list-item/types.js +13 -0
  143. package/dist/components/hds/dropdown/list-item/types.js.map +1 -0
  144. package/dist/components/hds/dropdown/toggle/button.js +11 -10
  145. package/dist/components/hds/dropdown/toggle/button.js.map +1 -1
  146. package/dist/components/hds/dropdown/toggle/chevron.js +8 -2
  147. package/dist/components/hds/dropdown/toggle/chevron.js.map +1 -1
  148. package/dist/components/hds/dropdown/toggle/icon.js +10 -9
  149. package/dist/components/hds/dropdown/toggle/icon.js.map +1 -1
  150. package/dist/components/hds/dropdown/toggle/types.js +23 -0
  151. package/dist/components/hds/dropdown/toggle/types.js.map +1 -0
  152. package/dist/components/hds/dropdown/types.js +15 -0
  153. package/dist/components/hds/dropdown/types.js.map +1 -0
  154. package/dist/components/hds/flyout/index.js.map +1 -1
  155. package/dist/components/hds/flyout/types.js +5 -0
  156. package/dist/components/hds/flyout/types.js.map +1 -1
  157. package/dist/components/hds/form/checkbox/base.js.map +1 -1
  158. package/dist/components/hds/icon-tile/index.js.map +1 -1
  159. package/dist/components/hds/link/standalone.js.map +1 -1
  160. package/dist/components/hds/menu-primitive/index.js +13 -7
  161. package/dist/components/hds/menu-primitive/index.js.map +1 -1
  162. package/dist/components/hds/modal/index.js.map +1 -1
  163. package/dist/components/hds/popover-primitive/index.js.map +1 -1
  164. package/dist/components/hds/segmented-group/index.js +8 -2
  165. package/dist/components/hds/segmented-group/index.js.map +1 -1
  166. package/dist/components/hds/side-nav/base.js +1 -1
  167. package/dist/components/hds/side-nav/base.js.map +1 -1
  168. package/dist/components/hds/side-nav/header/index.js +1 -1
  169. package/dist/components/hds/side-nav/header/index.js.map +1 -1
  170. package/dist/components/hds/side-nav/index.js +6 -1
  171. package/dist/components/hds/side-nav/index.js.map +1 -1
  172. package/dist/components.js +10 -0
  173. package/dist/components.js.map +1 -1
  174. package/dist/modifiers/hds-tooltip.js +42 -27
  175. package/dist/modifiers/hds-tooltip.js.map +1 -1
  176. package/dist/styles/@hashicorp/design-system-components.css +674 -58
  177. package/dist/styles/@hashicorp/design-system-components.scss +1 -0
  178. package/dist/styles/components/app-frame.scss +13 -0
  179. package/dist/styles/components/app-header.scss +106 -0
  180. package/dist/styles/components/application-state.scss +56 -15
  181. package/dist/styles/components/side-nav/header.scss +13 -41
  182. package/dist/styles/components/side-nav/main.scss +29 -1
  183. package/dist/styles/components/side-nav/toggle-button.scss +6 -1
  184. package/dist/styles/mixins/_interactive-dark-theme.scss +106 -0
  185. package/package.json +7 -2
@@ -2,9 +2,15 @@ import templateOnlyComponent from '@ember/component/template-only';
2
2
  import { precompileTemplate } from '@ember/template-compilation';
3
3
  import { setComponentTemplate } from '@ember/component';
4
4
 
5
- var TEMPLATE = precompileTemplate("{{! @glint-nocheck: not typesafe yet }}\n{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<li\n class=\"hds-dropdown-list-item hds-dropdown-list-item--variant-separator\"\n aria-hidden=\"true\"\n role=\"separator\"\n ...attributes\n></li>");
5
+ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<li\n class=\"hds-dropdown-list-item hds-dropdown-list-item--variant-separator\"\n aria-hidden=\"true\"\n role=\"separator\"\n ...attributes\n></li>");
6
6
 
7
- var separator = setComponentTemplate(TEMPLATE, templateOnlyComponent());
7
+ /**
8
+ * Copyright (c) HashiCorp, Inc.
9
+ * SPDX-License-Identifier: MPL-2.0
10
+ */
11
+
12
+ const HdsDropdownListItemSeparatorComponent = templateOnlyComponent();
13
+ var separator = setComponentTemplate(TEMPLATE, HdsDropdownListItemSeparatorComponent);
8
14
 
9
15
  export { separator as default };
10
16
  //# sourceMappingURL=separator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"separator.js","sources":["../../../../../src/components/hds/dropdown/list-item/separator.hbs","../../../../../src/components/hds/dropdown/list-item/separator.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<li\\n class=\\\"hds-dropdown-list-item hds-dropdown-list-item--variant-separator\\\"\\n aria-hidden=\\\"true\\\"\\n role=\\\"separator\\\"\\n ...attributes\\n></li>\")","import templateOnly from '@ember/component/template-only';\nexport default templateOnly();\n"],"names":["setComponentTemplate","TEMPLATE","templateOnly"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,iRAAiR;;ACAnT,gBAAAA,oBAAA,CAAAC,QAAA,EAAeC,qBAAY,EAAE,CAAA;;;;"}
1
+ {"version":3,"file":"separator.js","sources":["../../../../../src/components/hds/dropdown/list-item/separator.hbs","../../../../../src/components/hds/dropdown/list-item/separator.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<li\\n class=\\\"hds-dropdown-list-item hds-dropdown-list-item--variant-separator\\\"\\n aria-hidden=\\\"true\\\"\\n role=\\\"separator\\\"\\n ...attributes\\n></li>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport templateOnlyComponent from '@ember/component/template-only';\n\nexport interface HdsDropdownListItemSeparatorSignature {\n Element: HTMLLIElement;\n}\n\nconst HdsDropdownListItemSeparatorComponent =\n templateOnlyComponent<HdsDropdownListItemSeparatorSignature>();\n\nexport default HdsDropdownListItemSeparatorComponent;\n"],"names":["HdsDropdownListItemSeparatorComponent","templateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,wOAAwO;;ACD1Q;AACA;AACA;AACA;;AAQA,MAAMA,qCAAqC,GACzCC,qBAAqB,EAAyC,CAAA;AAEhE,gBAAAC,oBAAA,CAAAC,QAAA,EAAeH,qCAAqC,CAAA;;;;"}
@@ -3,7 +3,7 @@ import { assert } from '@ember/debug';
3
3
  import { precompileTemplate } from '@ember/template-compilation';
4
4
  import { setComponentTemplate } from '@ember/component';
5
5
 
6
- var TEMPLATE = precompileTemplate("{{! @glint-nocheck: not typesafe yet }}\n{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Text::Body\n class=\"hds-dropdown-list-item hds-dropdown-list-item--variant-title\"\n @tag=\"li\"\n @size=\"100\"\n @weight=\"semibold\"\n @color=\"strong\"\n ...attributes\n>\n {{this.text}}\n</Hds::Text::Body>");
6
+ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Text::Body\n class=\"hds-dropdown-list-item hds-dropdown-list-item--variant-title\"\n @tag=\"li\"\n @size=\"100\"\n @weight=\"semibold\"\n @color=\"strong\"\n ...attributes\n>\n {{this.text}}\n</Hds::Text::Body>");
7
7
 
8
8
  /**
9
9
  * Copyright (c) HashiCorp, Inc.
@@ -17,7 +17,7 @@ class HdsDropdownListItemTitleComponent extends Component {
17
17
  * @description The text of the item. If no text value is defined an error will be thrown
18
18
  */
19
19
  get text() {
20
- let {
20
+ const {
21
21
  text
22
22
  } = this.args;
23
23
  assert('@text for "Hds::Dropdown::ListItem::Title" must have a valid value', text !== undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"title.js","sources":["../../../../../src/components/hds/dropdown/list-item/title.hbs","../../../../../src/components/hds/dropdown/list-item/title.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::Text::Body\\n class=\\\"hds-dropdown-list-item hds-dropdown-list-item--variant-title\\\"\\n @tag=\\\"li\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"semibold\\\"\\n @color=\\\"strong\\\"\\n ...attributes\\n>\\n {{this.text}}\\n</Hds::Text::Body>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\n\nexport default class HdsDropdownListItemTitleComponent extends Component {\n /**\n * @param text\n * @type {string}\n * @description The text of the item. If no text value is defined an error will be thrown\n */\n get text() {\n let { text } = this.args;\n\n assert(\n '@text for \"Hds::Dropdown::ListItem::Title\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n}\n"],"names":["HdsDropdownListItemTitleComponent","Component","text","args","assert","undefined","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,yVAAyV;;ACD3X;AACA;AACA;AACA;;AAKe,MAAMA,iCAAiC,SAASC,SAAS,CAAC;AACvE;AACF;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAG;IACT,IAAI;AAAEA,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACC,IAAI,CAAA;AAExBC,IAAAA,MAAM,CACJ,oEAAoE,EACpEF,IAAI,KAAKG,SACX,CAAC,CAAA;AAED,IAAA,OAAOH,IAAI,CAAA;AACb,GAAA;AACF,CAAA;AAACI,oBAAA,CAAAC,QAAA,EAhBoBP,iCAAiC,CAAA;;;;"}
1
+ {"version":3,"file":"title.js","sources":["../../../../../src/components/hds/dropdown/list-item/title.hbs","../../../../../src/components/hds/dropdown/list-item/title.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Text::Body\\n class=\\\"hds-dropdown-list-item hds-dropdown-list-item--variant-title\\\"\\n @tag=\\\"li\\\"\\n @size=\\\"100\\\"\\n @weight=\\\"semibold\\\"\\n @color=\\\"strong\\\"\\n ...attributes\\n>\\n {{this.text}}\\n</Hds::Text::Body>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport type { HdsTextBodySignature } from '../../text/body';\n\nexport interface HdsDropdownListItemTitleSignature {\n Args: {\n text: string;\n };\n Element: HdsTextBodySignature['Element'];\n}\n\nexport default class HdsDropdownListItemTitleComponent extends Component<HdsDropdownListItemTitleSignature> {\n /**\n * @param text\n * @type {string}\n * @description The text of the item. If no text value is defined an error will be thrown\n */\n get text(): string {\n const { text } = this.args;\n\n assert(\n '@text for \"Hds::Dropdown::ListItem::Title\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n}\n"],"names":["HdsDropdownListItemTitleComponent","Component","text","args","assert","undefined","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,gTAAgT;;ACDlV;AACA;AACA;AACA;;AAae,MAAMA,iCAAiC,SAASC,SAAS,CAAoC;AAC1G;AACF;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAW;IACjB,MAAM;AAAEA,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACC,IAAI,CAAA;AAE1BC,IAAAA,MAAM,CACJ,oEAAoE,EACpEF,IAAI,KAAKG,SACX,CAAC,CAAA;AAED,IAAA,OAAOH,IAAI,CAAA;AACb,GAAA;AACF,CAAA;AAACI,oBAAA,CAAAC,QAAA,EAhBoBP,iCAAiC,CAAA;;;;"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ let HdsDropdownListItemInteractiveColorValues = /*#__PURE__*/function (HdsDropdownListItemInteractiveColorValues) {
7
+ HdsDropdownListItemInteractiveColorValues["Action"] = "action";
8
+ HdsDropdownListItemInteractiveColorValues["Critical"] = "critical";
9
+ return HdsDropdownListItemInteractiveColorValues;
10
+ }({});
11
+
12
+ export { HdsDropdownListItemInteractiveColorValues };
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../../../src/components/hds/dropdown/list-item/types.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsDropdownListItemInteractiveColorValues {\n Action = 'action',\n Critical = 'critical',\n}\nexport type HdsDropdownListItemInteractiveColors =\n `${HdsDropdownListItemInteractiveColorValues}`;\n"],"names":["HdsDropdownListItemInteractiveColorValues"],"mappings":"AAAA;AACA;AACA;AACA;;AAEYA,IAAAA,yCAAyC,0BAAzCA,yCAAyC,EAAA;EAAzCA,yCAAyC,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAAzCA,yCAAyC,CAAA,UAAA,CAAA,GAAA,UAAA,CAAA;AAAA,EAAA,OAAzCA,yCAAyC,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
@@ -2,15 +2,16 @@ import { a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-KIi_
2
2
  import Component from '@glimmer/component';
3
3
  import { assert } from '@ember/debug';
4
4
  import { guidFor } from '@ember/object/internals';
5
+ import { HdsDropdownToggleButtonSizeValues, HdsDropdownToggleButtonColorValues } from './types.js';
5
6
  import { precompileTemplate } from '@ember/template-compilation';
6
7
  import { setComponentTemplate } from '@ember/component';
7
8
 
8
- var TEMPLATE = precompileTemplate("{{! @glint-nocheck: not typesafe yet }}\n{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<button\n class={{this.classNames}}\n id={{this.toggleButtonId}}\n ...attributes\n type=\"button\"\n aria-expanded={{if @isOpen \"true\" \"false\"}}\n {{on \"click\" this.onClick}}\n>\n {{#if @icon}}\n <div class=\"hds-dropdown-toggle-button__icon\">\n <FlightIcon @name={{@icon}} @stretched={{true}} />\n </div>\n {{/if}}\n <div class=\"hds-dropdown-toggle-button__text\">\n {{this.text}}\n </div>\n {{#if @count}}\n <Hds::BadgeCount\n @text={{@count}}\n @size=\"small\"\n @type={{this.badgeType}}\n class=\"hds-dropdown-toggle-button__count\"\n />\n {{/if}}\n {{#if @badge}}\n <Hds::Badge\n @text={{@badge}}\n @icon={{@badgeIcon}}\n @size=\"small\"\n @type={{this.badgeType}}\n class=\"hds-dropdown-toggle-button__badge\"\n />\n {{/if}}\n <Hds::Dropdown::Toggle::Chevron />\n</button>");
9
+ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<button\n class={{this.classNames}}\n id={{this.toggleButtonId}}\n ...attributes\n type=\"button\"\n aria-expanded={{if @isOpen \"true\" \"false\"}}\n {{on \"click\" this.onClick}}\n>\n {{#if @icon}}\n <div class=\"hds-dropdown-toggle-button__icon\">\n <FlightIcon @name={{@icon}} @stretched={{true}} />\n </div>\n {{/if}}\n <div class=\"hds-dropdown-toggle-button__text\">\n {{this.text}}\n </div>\n {{#if @count}}\n <Hds::BadgeCount\n @text={{@count}}\n @size=\"small\"\n @type={{this.badgeType}}\n class=\"hds-dropdown-toggle-button__count\"\n />\n {{/if}}\n {{#if @badge}}\n <Hds::Badge\n @text={{@badge}}\n @icon={{@badgeIcon}}\n @size=\"small\"\n @type={{this.badgeType}}\n class=\"hds-dropdown-toggle-button__badge\"\n />\n {{/if}}\n <Hds::Dropdown::Toggle::Chevron />\n</button>");
9
10
 
10
- const DEFAULT_SIZE = 'medium';
11
- const DEFAULT_COLOR = 'primary';
12
- const SIZES = ['small', 'medium'];
13
- const COLORS = ['primary', 'secondary'];
11
+ const DEFAULT_SIZE = HdsDropdownToggleButtonSizeValues.Medium;
12
+ const DEFAULT_COLOR = HdsDropdownToggleButtonColorValues.Primary;
13
+ const SIZES = Object.values(HdsDropdownToggleButtonSizeValues);
14
+ const COLORS = Object.values(HdsDropdownToggleButtonColorValues);
14
15
  const NOOP = () => {};
15
16
  class HdsDropdownToggleButtonComponent extends Component {
16
17
  constructor(...args) {
@@ -28,7 +29,7 @@ class HdsDropdownToggleButtonComponent extends Component {
28
29
  * @description The text of the button. If no text value is defined an error will be thrown.
29
30
  */
30
31
  get text() {
31
- let {
32
+ const {
32
33
  text
33
34
  } = this.args;
34
35
  assert('@text for "Hds::Dropdown::Toggle::Button" must have a valid value', text !== undefined);
@@ -42,7 +43,7 @@ class HdsDropdownToggleButtonComponent extends Component {
42
43
  * @description The size of the button; acceptable values are `small` and `medium`
43
44
  */
44
45
  get size() {
45
- let {
46
+ const {
46
47
  size = DEFAULT_SIZE
47
48
  } = this.args;
48
49
  assert(`@size for "Hds::Dropdown::Toggle::Button" must be one of the following: ${SIZES.join(', ')}; received: ${size}`, SIZES.includes(size));
@@ -56,7 +57,7 @@ class HdsDropdownToggleButtonComponent extends Component {
56
57
  * @description Determines the color of button to be used; acceptable values are `primary` and `secondary`
57
58
  */
58
59
  get color() {
59
- let {
60
+ const {
60
61
  color = DEFAULT_COLOR
61
62
  } = this.args;
62
63
  assert(`@color for "Hds::Dropdown::Toggle::Button" must be one of the following: ${COLORS.join(', ')}; received: ${color}`, COLORS.includes(color));
@@ -79,7 +80,7 @@ class HdsDropdownToggleButtonComponent extends Component {
79
80
  * @default () => {}
80
81
  */
81
82
  get onClick() {
82
- let {
83
+ const {
83
84
  onClick
84
85
  } = this.args;
85
86
 
@@ -108,7 +109,7 @@ class HdsDropdownToggleButtonComponent extends Component {
108
109
  * @return {string} The "class" attribute to apply to the component.
109
110
  */
110
111
  get classNames() {
111
- let classes = ['hds-dropdown-toggle-button'];
112
+ const classes = ['hds-dropdown-toggle-button'];
112
113
 
113
114
  // add a class based on the @size argument
114
115
  classes.push(`hds-dropdown-toggle-button--size-${this.size}`);
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sources":["../../../../../src/components/hds/dropdown/toggle/button.hbs","../../../../../src/components/hds/dropdown/toggle/button.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<button\\n class={{this.classNames}}\\n id={{this.toggleButtonId}}\\n ...attributes\\n type=\\\"button\\\"\\n aria-expanded={{if @isOpen \\\"true\\\" \\\"false\\\"}}\\n {{on \\\"click\\\" this.onClick}}\\n>\\n {{#if @icon}}\\n <div class=\\\"hds-dropdown-toggle-button__icon\\\">\\n <FlightIcon @name={{@icon}} @stretched={{true}} />\\n </div>\\n {{/if}}\\n <div class=\\\"hds-dropdown-toggle-button__text\\\">\\n {{this.text}}\\n </div>\\n {{#if @count}}\\n <Hds::BadgeCount\\n @text={{@count}}\\n @size=\\\"small\\\"\\n @type={{this.badgeType}}\\n class=\\\"hds-dropdown-toggle-button__count\\\"\\n />\\n {{/if}}\\n {{#if @badge}}\\n <Hds::Badge\\n @text={{@badge}}\\n @icon={{@badgeIcon}}\\n @size=\\\"small\\\"\\n @type={{this.badgeType}}\\n class=\\\"hds-dropdown-toggle-button__badge\\\"\\n />\\n {{/if}}\\n <Hds::Dropdown::Toggle::Chevron />\\n</button>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { guidFor } from '@ember/object/internals';\n\nexport const DEFAULT_SIZE = 'medium';\nexport const DEFAULT_COLOR = 'primary';\nexport const SIZES = ['small', 'medium'];\nexport const COLORS = ['primary', 'secondary'];\n\nconst NOOP = () => {};\n\nexport default class HdsDropdownToggleButtonComponent extends Component {\n /**\n * Generates a unique ID for the button\n *\n * @param toggleButtonId\n */\n toggleButtonId = 'toggle-button-' + guidFor(this);\n\n /**\n * @param text\n * @type {string}\n * @description The text of the button. If no text value is defined an error will be thrown.\n */\n get text() {\n let { text } = this.args;\n\n assert(\n '@text for \"Hds::Dropdown::Toggle::Button\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * @param size\n * @type {string}\n * @default medium\n * @description The size of the button; acceptable values are `small` and `medium`\n */\n get size() {\n let { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Dropdown::Toggle::Button\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * @param color\n * @type {string}\n * @default primary\n * @description Determines the color of button to be used; acceptable values are `primary` and `secondary`\n */\n get color() {\n let { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Dropdown::Toggle::Button\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * @param isFullWidth\n * @type {boolean}\n * @default false\n * @description Indicates that a button should take up the full width of the parent container. The default is false.\n */\n get isFullWidth() {\n return this.args.isFullWidth ?? false;\n }\n\n /**\n * @param onClick\n * @type {function}\n * @default () => {}\n */\n get onClick() {\n let { onClick } = this.args;\n\n // notice: this is a guard used in case the toggle is used as standalone element (eg. in the showcase)\n // in reality it's always used inside the Dropdown main component as yielded component, so the onClick handler is always defined\n if (typeof onClick === 'function') {\n return onClick;\n } else {\n return NOOP;\n }\n }\n\n /**\n * @param badgeType\n * @type {string}\n * @default 'filled'\n * @description ensures that the correct Badge/BadgeCount type is used to meet contrast requirements\n */\n get badgeType() {\n return this.color !== 'primary' ? 'inverted' : 'filled';\n }\n\n /**\n * Get the class names to apply to the component.\n * @method ToggleButton#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n let classes = ['hds-dropdown-toggle-button'];\n\n // add a class based on the @size argument\n classes.push(`hds-dropdown-toggle-button--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-dropdown-toggle-button--color-${this.color}`);\n\n // add a class based on the @isFullWidth argument\n if (this.isFullWidth) {\n classes.push('hds-dropdown-toggle-button--width-full');\n }\n\n // add a class based on the @isOpen argument\n if (this.args.isOpen) {\n classes.push('hds-dropdown-toggle-button--is-open');\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_SIZE","DEFAULT_COLOR","SIZES","COLORS","NOOP","HdsDropdownToggleButtonComponent","Component","constructor","args","_defineProperty","guidFor","text","assert","undefined","size","join","includes","color","isFullWidth","onClick","badgeType","classNames","classes","push","isOpen","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;AACA,eAAe,kBAAkB,CAAC,i+BAAi+B;;ACQ5/B,MAAMA,YAAY,GAAG,SAAQ;AAC7B,MAAMC,aAAa,GAAG,UAAS;MACzBC,KAAK,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAC;MAC3BC,MAAM,GAAG,CAAC,SAAS,EAAE,WAAW,EAAC;AAE9C,MAAMC,IAAI,GAAGA,MAAM,EAAE,CAAA;AAEN,MAAMC,gCAAgC,SAASC,SAAS,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AA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AAK,CAAA;AACvC,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIC,OAAOA,GAAG;IACZ,IAAI;AAAEA,MAAAA,OAAAA;KAAS,GAAG,IAAI,CAACX,IAAI,CAAA;;AAE3B;AACA;AACA,IAAA,IAAI,OAAOW,OAAO,KAAK,UAAU,EAAE;AACjC,MAAA,OAAOA,OAAO,CAAA;AAChB,KAAC,MAAM;AACL,MAAA,OAAOf,IAAI,CAAA;AACb,KAAA;AACF,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,IAAIgB,SAASA,GAAG;IACd,OAAO,IAAI,CAACH,KAAK,KAAK,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAA;AACzD,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAII,UAAUA,GAAG;AACf,IAAA,IAAIC,OAAO,GAAG,CAAC,4BAA4B,CAAC,CAAA;;AAE5C;IACAA,OAAO,CAACC,IAAI,CAAC,CAAA,iCAAA,EAAoC,IAAI,CAACT,IAAI,EAAE,CAAC,CAAA;;AAE7D;IACAQ,OAAO,CAACC,IAAI,CAAC,CAAA,kCAAA,EAAqC,IAAI,CAACN,KAAK,EAAE,CAAC,CAAA;;AAE/D;IACA,IAAI,IAAI,CAACC,WAAW,EAAE;AACpBI,MAAAA,OAAO,CAACC,IAAI,CAAC,wCAAwC,CAAC,CAAA;AACxD,KAAA;;AAEA;AACA,IAAA,IAAI,IAAI,CAACf,IAAI,CAACgB,MAAM,EAAE;AACpBF,MAAAA,OAAO,CAACC,IAAI,CAAC,qCAAqC,CAAC,CAAA;AACrD,KAAA;AAEA,IAAA,OAAOD,OAAO,CAACP,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACU,oBAAA,CAAAC,QAAA,EA7HoBrB,gCAAgC,CAAA;;;;"}
1
+ {"version":3,"file":"button.js","sources":["../../../../../src/components/hds/dropdown/toggle/button.hbs","../../../../../src/components/hds/dropdown/toggle/button.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<button\\n class={{this.classNames}}\\n id={{this.toggleButtonId}}\\n ...attributes\\n type=\\\"button\\\"\\n aria-expanded={{if @isOpen \\\"true\\\" \\\"false\\\"}}\\n {{on \\\"click\\\" this.onClick}}\\n>\\n {{#if @icon}}\\n <div class=\\\"hds-dropdown-toggle-button__icon\\\">\\n <FlightIcon @name={{@icon}} @stretched={{true}} />\\n </div>\\n {{/if}}\\n <div class=\\\"hds-dropdown-toggle-button__text\\\">\\n {{this.text}}\\n </div>\\n {{#if @count}}\\n <Hds::BadgeCount\\n @text={{@count}}\\n @size=\\\"small\\\"\\n @type={{this.badgeType}}\\n class=\\\"hds-dropdown-toggle-button__count\\\"\\n />\\n {{/if}}\\n {{#if @badge}}\\n <Hds::Badge\\n @text={{@badge}}\\n @icon={{@badgeIcon}}\\n @size=\\\"small\\\"\\n @type={{this.badgeType}}\\n class=\\\"hds-dropdown-toggle-button__badge\\\"\\n />\\n {{/if}}\\n <Hds::Dropdown::Toggle::Chevron />\\n</button>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\nimport { guidFor } from '@ember/object/internals';\nimport {\n HdsDropdownToggleButtonSizeValues,\n HdsDropdownToggleButtonColorValues,\n} from './types.ts';\n\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\nimport type { HdsBadgeSignature } from '../../badge';\nimport type { HdsBadgeCountSignature } from '../../badge-count';\nimport type {\n HdsDropdownToggleButtonSizes,\n HdsDropdownToggleButtonColors,\n} from './types';\n\nexport const DEFAULT_SIZE = HdsDropdownToggleButtonSizeValues.Medium;\nexport const DEFAULT_COLOR = HdsDropdownToggleButtonColorValues.Primary;\nexport const SIZES: string[] = Object.values(HdsDropdownToggleButtonSizeValues);\nexport const COLORS: string[] = Object.values(\n HdsDropdownToggleButtonColorValues\n);\n\nconst NOOP = (): void => {};\n\nexport interface HdsDropdownToggleButtonSignature {\n Args: {\n badge?: HdsBadgeSignature['Args']['text'];\n badgeIcon?: HdsBadgeSignature['Args']['icon'];\n color: HdsDropdownToggleButtonColors;\n count?: HdsBadgeCountSignature['Args']['text'];\n icon?: FlightIconSignature['Args']['name'];\n isFullWidth?: boolean;\n isOpen?: boolean;\n onClick?: (event: MouseEvent) => void;\n size: HdsDropdownToggleButtonSizes;\n text: string;\n };\n Element: HTMLButtonElement;\n}\n\nexport default class HdsDropdownToggleButtonComponent extends Component<HdsDropdownToggleButtonSignature> {\n /**\n * Generates a unique ID for the button\n *\n * @param toggleButtonId\n */\n toggleButtonId = 'toggle-button-' + guidFor(this);\n\n /**\n * @param text\n * @type {string}\n * @description The text of the button. If no text value is defined an error will be thrown.\n */\n get text(): string {\n const { text } = this.args;\n\n assert(\n '@text for \"Hds::Dropdown::Toggle::Button\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * @param size\n * @type {string}\n * @default medium\n * @description The size of the button; acceptable values are `small` and `medium`\n */\n get size(): HdsDropdownToggleButtonSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Dropdown::Toggle::Button\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * @param color\n * @type {string}\n * @default primary\n * @description Determines the color of button to be used; acceptable values are `primary` and `secondary`\n */\n get color(): HdsDropdownToggleButtonColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Dropdown::Toggle::Button\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * @param isFullWidth\n * @type {boolean}\n * @default false\n * @description Indicates that a button should take up the full width of the parent container. The default is false.\n */\n get isFullWidth(): boolean {\n return this.args.isFullWidth ?? false;\n }\n\n /**\n * @param onClick\n * @type {function}\n * @default () => {}\n */\n get onClick(): (event: MouseEvent) => void {\n const { onClick } = this.args;\n\n // notice: this is a guard used in case the toggle is used as standalone element (eg. in the showcase)\n // in reality it's always used inside the Dropdown main component as yielded component, so the onClick handler is always defined\n if (typeof onClick === 'function') {\n return onClick;\n } else {\n return NOOP;\n }\n }\n\n /**\n * @param badgeType\n * @type {string}\n * @default 'filled'\n * @description ensures that the correct Badge/BadgeCount type is used to meet contrast requirements\n */\n get badgeType(): HdsBadgeCountSignature['Args']['type'] {\n return this.color !== 'primary' ? 'inverted' : 'filled';\n }\n\n /**\n * Get the class names to apply to the component.\n * @method ToggleButton#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-dropdown-toggle-button'];\n\n // add a class based on the @size argument\n classes.push(`hds-dropdown-toggle-button--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-dropdown-toggle-button--color-${this.color}`);\n\n // add a class based on the @isFullWidth argument\n if (this.isFullWidth) {\n classes.push('hds-dropdown-toggle-button--width-full');\n }\n\n // add a class based on the @isOpen argument\n if (this.args.isOpen) {\n classes.push('hds-dropdown-toggle-button--is-open');\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_SIZE","HdsDropdownToggleButtonSizeValues","Medium","DEFAULT_COLOR","HdsDropdownToggleButtonColorValues","Primary","SIZES","Object","values","COLORS","NOOP","HdsDropdownToggleButtonComponent","Component","constructor","args","_defineProperty","guidFor","text","assert","undefined","size","join","includes","color","isFullWidth","onClick","badgeType","classNames","classes","push","isOpen","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,w7BAAw7B;;ACoB78BA,MAAAA,YAAY,GAAGC,iCAAiC,CAACC,OAAM;AACvDC,MAAAA,aAAa,GAAGC,kCAAkC,CAACC,QAAO;AAChE,MAAMC,KAAe,GAAGC,MAAM,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ACrD,KAAA;AAEA,IAAA,OAAOD,OAAO,CAACP,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAA;AAACU,oBAAA,CAAAC,QAAA,EA7HoBrB,gCAAgC,CAAA;;;;"}
@@ -2,9 +2,15 @@ import templateOnlyComponent from '@ember/component/template-only';
2
2
  import { precompileTemplate } from '@ember/template-compilation';
3
3
  import { setComponentTemplate } from '@ember/component';
4
4
 
5
- var TEMPLATE = precompileTemplate("{{! @glint-nocheck: not typesafe yet }}\n{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n\n<div class=\"hds-dropdown-toggle-chevron\">\n <FlightIcon @name=\"chevron-down\" @isInlineBlock={{false}} />\n</div>");
5
+ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<div class=\"hds-dropdown-toggle-chevron\">\n <FlightIcon @name=\"chevron-down\" @isInlineBlock={{false}} />\n</div>");
6
6
 
7
- var chevron = setComponentTemplate(TEMPLATE, templateOnlyComponent());
7
+ /**
8
+ * Copyright (c) HashiCorp, Inc.
9
+ * SPDX-License-Identifier: MPL-2.0
10
+ */
11
+
12
+ const HdsDropdownToggleChevronComponent = templateOnlyComponent();
13
+ var chevron = setComponentTemplate(TEMPLATE, HdsDropdownToggleChevronComponent);
8
14
 
9
15
  export { chevron as default };
10
16
  //# sourceMappingURL=chevron.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chevron.js","sources":["../../../../../src/components/hds/dropdown/toggle/chevron.hbs","../../../../../src/components/hds/dropdown/toggle/chevron.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\\n<div class=\\\"hds-dropdown-toggle-chevron\\\">\\n <FlightIcon @name=\\\"chevron-down\\\" @isInlineBlock={{false}} />\\n</div>\")","import templateOnly from '@ember/component/template-only';\nexport default templateOnly();\n"],"names":["setComponentTemplate","TEMPLATE","templateOnly"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,gPAAgP;;ACAlR,cAAAA,oBAAA,CAAAC,QAAA,EAAeC,qBAAY,EAAE,CAAA;;;;"}
1
+ {"version":3,"file":"chevron.js","sources":["../../../../../src/components/hds/dropdown/toggle/chevron.hbs","../../../../../src/components/hds/dropdown/toggle/chevron.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class=\\\"hds-dropdown-toggle-chevron\\\">\\n <FlightIcon @name=\\\"chevron-down\\\" @isInlineBlock={{false}} />\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport templateOnlyComponent from '@ember/component/template-only';\n\ninterface HdsDropdownToggleChevronSignature {}\n\nconst HdsDropdownToggleChevronComponent =\n templateOnlyComponent<HdsDropdownToggleChevronSignature>();\n\nexport default HdsDropdownToggleChevronComponent;\n"],"names":["HdsDropdownToggleChevronComponent","templateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,qMAAqM;;ACDvO;AACA;AACA;AACA;;AAMA,MAAMA,iCAAiC,GACrCC,qBAAqB,EAAqC,CAAA;AAE5D,cAAAC,oBAAA,CAAAC,QAAA,EAAeH,iCAAiC,CAAA;;;;"}
@@ -3,18 +3,19 @@ import Component from '@glimmer/component';
3
3
  import { action } from '@ember/object';
4
4
  import { assert } from '@ember/debug';
5
5
  import { tracked } from '@glimmer/tracking';
6
+ import { HdsDropdownToggleIconSizeValues } from './types.js';
6
7
  import { precompileTemplate } from '@ember/template-compilation';
7
8
  import { setComponentTemplate } from '@ember/component';
8
9
 
9
- var TEMPLATE = precompileTemplate("{{! @glint-nocheck: not typesafe yet }}\n{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<button\n class={{this.classNames}}\n aria-label={{this.text}}\n ...attributes\n aria-expanded={{if @isOpen \"true\" \"false\"}}\n {{on \"click\" this.onClick}}\n {{did-update this.onDidUpdateImageSrc @imageSrc}}\n type=\"button\"\n>\n <div class=\"hds-dropdown-toggle-icon__wrapper\">\n {{#if @imageSrc}}\n {{#if this.hasImage}}\n <img src={{@imageSrc}} alt=\"\" role=\"presentation\" {{on \"error\" this.onImageLoadError}} />\n {{else}}\n <FlightIcon @name=\"user\" @size={{this.iconSize}} />\n {{/if}}\n {{else if @icon}}\n <FlightIcon @name={{@icon}} @size={{this.iconSize}} />\n {{/if}}\n </div>\n {{#if this.hasChevron}}\n <Hds::Dropdown::Toggle::Chevron />\n {{/if}}\n</button>");
10
+ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<button\n class={{this.classNames}}\n aria-label={{this.text}}\n ...attributes\n aria-expanded={{if @isOpen \"true\" \"false\"}}\n {{on \"click\" this.onClick}}\n {{did-update this.onDidUpdateImageSrc @imageSrc}}\n type=\"button\"\n>\n <div class=\"hds-dropdown-toggle-icon__wrapper\">\n {{#if @imageSrc}}\n {{#if this.hasImage}}\n <img src={{@imageSrc}} alt=\"\" role=\"presentation\" {{on \"error\" this.onImageLoadError}} />\n {{else}}\n <FlightIcon @name=\"user\" @size={{this.iconSize}} />\n {{/if}}\n {{else if @icon}}\n <FlightIcon @name={{@icon}} @size={{this.iconSize}} />\n {{/if}}\n </div>\n {{#if this.hasChevron}}\n <Hds::Dropdown::Toggle::Chevron />\n {{/if}}\n</button>");
10
11
 
11
12
  var _class, _descriptor;
12
- const DEFAULT_SIZE = 'medium';
13
- const SIZES = ['small', 'medium'];
13
+ const DEFAULT_SIZE = HdsDropdownToggleIconSizeValues.Medium;
14
+ const SIZES = Object.values(HdsDropdownToggleIconSizeValues);
14
15
  const NOOP = () => {};
15
16
  let HdsDropdownToggleIconComponent = (_class = class HdsDropdownToggleIconComponent extends Component {
16
- constructor() {
17
- super(...arguments);
17
+ constructor(owner, args) {
18
+ super(owner, args);
18
19
  _initializerDefineProperty(this, "hasImage", _descriptor, this);
19
20
  if (!(this.args.icon || this.args.imageSrc)) {
20
21
  assert('@icon or @imageSrc must be defined for "Hds::Dropdown::Toggle::Icon"');
@@ -33,7 +34,7 @@ let HdsDropdownToggleIconComponent = (_class = class HdsDropdownToggleIconCompon
33
34
  * @description The text of the `aria-label` applied to the toggle
34
35
  */
35
36
  get text() {
36
- let {
37
+ const {
37
38
  text
38
39
  } = this.args;
39
40
  assert('@text for "Hds::Dropdown::Toggle::Icon" must have a valid value', text !== undefined);
@@ -47,7 +48,7 @@ let HdsDropdownToggleIconComponent = (_class = class HdsDropdownToggleIconCompon
47
48
  * @description The size of the button; acceptable values are `small` and `medium`
48
49
  */
49
50
  get size() {
50
- let {
51
+ const {
51
52
  size = DEFAULT_SIZE
52
53
  } = this.args;
53
54
  assert(`@size for "Hds::Dropdown::Toggle::Icon" must be one of the following: ${SIZES.join(', ')}; received: ${size}`, SIZES.includes(size));
@@ -87,7 +88,7 @@ let HdsDropdownToggleIconComponent = (_class = class HdsDropdownToggleIconCompon
87
88
  * @default () => {}
88
89
  */
89
90
  get onClick() {
90
- let {
91
+ const {
91
92
  onClick
92
93
  } = this.args;
93
94
 
@@ -106,7 +107,7 @@ let HdsDropdownToggleIconComponent = (_class = class HdsDropdownToggleIconCompon
106
107
  * @return {string} The "class" attribute to apply to the component.
107
108
  */
108
109
  get classNames() {
109
- let classes = ['hds-dropdown-toggle-icon'];
110
+ const classes = ['hds-dropdown-toggle-icon'];
110
111
 
111
112
  // add a class based on the @size argument
112
113
  classes.push(`hds-dropdown-toggle-icon--size-${this.size}`);
@@ -1 +1 @@
1
- {"version":3,"file":"icon.js","sources":["../../../../../src/components/hds/dropdown/toggle/icon.hbs","../../../../../src/components/hds/dropdown/toggle/icon.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<button\\n class={{this.classNames}}\\n aria-label={{this.text}}\\n ...attributes\\n aria-expanded={{if @isOpen \\\"true\\\" \\\"false\\\"}}\\n {{on \\\"click\\\" this.onClick}}\\n {{did-update this.onDidUpdateImageSrc @imageSrc}}\\n type=\\\"button\\\"\\n>\\n <div class=\\\"hds-dropdown-toggle-icon__wrapper\\\">\\n {{#if @imageSrc}}\\n {{#if this.hasImage}}\\n <img src={{@imageSrc}} alt=\\\"\\\" role=\\\"presentation\\\" {{on \\\"error\\\" this.onImageLoadError}} />\\n {{else}}\\n <FlightIcon @name=\\\"user\\\" @size={{this.iconSize}} />\\n {{/if}}\\n {{else if @icon}}\\n <FlightIcon @name={{@icon}} @size={{this.iconSize}} />\\n {{/if}}\\n </div>\\n {{#if this.hasChevron}}\\n <Hds::Dropdown::Toggle::Chevron />\\n {{/if}}\\n</button>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { tracked } from '@glimmer/tracking';\n\nexport const DEFAULT_SIZE = 'medium';\nexport const SIZES = ['small', 'medium'];\n\nconst NOOP = () => {};\n\nexport default class HdsDropdownToggleIconComponent extends Component {\n @tracked hasImage = true;\n\n constructor() {\n super(...arguments);\n if (!(this.args.icon || this.args.imageSrc)) {\n assert(\n '@icon or @imageSrc must be defined for \"Hds::Dropdown::Toggle::Icon\"'\n );\n }\n }\n\n @action\n onDidUpdateImageSrc() {\n this.hasImage = true;\n }\n\n @action\n onImageLoadError() {\n this.hasImage = false;\n }\n\n /**\n * @param text\n * @type {string}\n * @description The text of the `aria-label` applied to the toggle\n */\n get text() {\n let { text } = this.args;\n\n assert(\n '@text for \"Hds::Dropdown::Toggle::Icon\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * @param size\n * @type {string}\n * @default medium\n * @description The size of the button; acceptable values are `small` and `medium`\n */\n get size() {\n let { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Dropdown::Toggle::Icon\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * @param iconSize\n * @type {string}\n * @default 24\n * @description ensures that the correct icon size is used\n */\n get iconSize() {\n if (this.args.size === 'medium' && !this.hasChevron) {\n // in this special case we use a larger SVG\n return '24';\n } else {\n // this is the default size (notice: for the \"small\" variant with chevron, we set the actual size to `12px` via CSS)\n return '16';\n }\n }\n\n /**\n * Indicates if a dropdown chevron icon should be displayed; should be displayed unless the \"more-horizontal\" icon is used.\n *\n * @param hasChevron\n * @type {boolean}\n * @default true\n */\n get hasChevron() {\n return this.args.hasChevron ?? true;\n }\n\n /**\n * @param onClick\n * @type {function}\n * @default () => {}\n */\n get onClick() {\n let { onClick } = this.args;\n\n // notice: this is a guard used in case the toggle is used as standalone element (eg. in the showcase)\n // in reality it's always used inside the Dropdown main component as yielded component, so the onClick handler is always defined\n if (typeof onClick === 'function') {\n return onClick;\n } else {\n return NOOP;\n }\n }\n\n /**\n * Get the class names to apply to the component.\n * @method ToggleIcon#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames() {\n let classes = ['hds-dropdown-toggle-icon'];\n\n // add a class based on the @size argument\n classes.push(`hds-dropdown-toggle-icon--size-${this.size}`);\n\n // add a class based on the @isOpen argument\n if (this.args.isOpen) {\n classes.push('hds-dropdown-toggle-icon--is-open');\n }\n\n // add a class based on the @hasChevron argument\n if (this.hasChevron) {\n classes.push('hds-dropdown-toggle-icon--has-chevron');\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_SIZE","SIZES","NOOP","HdsDropdownToggleIconComponent","_class","Component","constructor","arguments","_initializerDefineProperty","_descriptor","args","icon","imageSrc","assert","onDidUpdateImageSrc","hasImage","onImageLoadError","text","undefined","size","join","includes","iconSize","hasChevron","onClick","classNames","classes","push","isOpen","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;AACA,eAAe,kBAAkB,CAAC,81BAA81B;;;ACSz3B,MAAMA,YAAY,GAAG,SAAQ;MACvBC,KAAK,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAC;AAExC,MAAMC,IAAI,GAAGA,MAAM,EAAE,CAAA;AAEAC,IAAAA,8BAA8B,IAAAC,MAAA,GAApC,MAAMD,8BAA8B,SAASE,SAAS,CAAC;AAGpEC,EAAAA,WAAWA,GAAG;IACZ,KAAK,CAAC,GAAGC,SAAS,CAAC,CAAA;AAACC,IAAAA,0BAAA,mBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AACpB,IAAA,IAAI,EAAE,IAAI,CAACC,IAAI,CAACC,IAAI,IAAI,IAAI,CAACD,IAAI,CAACE,QAAQ,CAAC,EAAE;MAC3CC,MAAM,CACJ,sEACF,CAAC,CAAA;AACH,KAAA;AACF,GAAA;AAGAC,EAAAA,mBAAmBA,GAAG;IACpB,IAAI,CAACC,QAAQ,GAAG,IAAI,CAAA;AACtB,GAAA;AAGAC,EAAAA,gBAAgBA,GAAG;IACjB,IAAI,CAACD,QAAQ,GAAG,KAAK,CAAA;AACvB,GAAA;;AAEA;AACF;AACA;AACA;AACA;EACE,IAAIE,IAAIA,GAAG;IACT,IAAI;AAAEA,MAAAA,IAAAA;KAAM,GAAG,IAAI,CAACP,IAAI,CAAA;AAExBG,IAAAA,MAAM,CACJ,iEAAiE,EACjEI,IAAI,KAAKC,SACX,CAAC,CAAA;AAED,IAAA,OAAOD,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AAC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AAE3D;AACA,IAAA,IAAI,IAAI,CAACT,IAAI,CAACkB,MAAM,EAAE;AACpBF,MAAAA,OAAO,CAACC,IAAI,CAAC,mCAAmC,CAAC,CAAA;AACnD,KAAA;;AAEA;IACA,IAAI,IAAI,CAACJ,UAAU,EAAE;AACnBG,MAAAA,OAAO,CAACC,IAAI,CAAC,uCAAuC,CAAC,CAAA;AACvD,KAAA;AAEA,IAAA,OAAOD,OAAO,CAACN,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,GAAA;AACF,CAAC,GAAAX,WAAA,GAAAoB,yBAAA,CAAAzB,MAAA,CAAA0B,SAAA,EAAA,UAAA,EAAA,CA3HEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OAAY,IAAI,CAAA;AAAA,GAAA;AAAA,CAAA,CAAA,EAAAN,yBAAA,CAAAzB,MAAA,CAAA0B,SAAA,EAAA,qBAAA,EAAA,CAWvBM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAlC,MAAA,CAAA0B,SAAA,EAAA1B,qBAAAA,CAAAA,EAAAA,MAAA,CAAA0B,SAAA,CAAA,EAAAD,yBAAA,CAAAzB,MAAA,CAAA0B,SAAA,uBAKNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAlC,MAAA,CAAA0B,SAAA,EAAA,kBAAA,CAAA,EAAA1B,MAAA,CAAA0B,SAAA,IAAA1B,MAAA,EAAA;AAjB0CmC,oBAAA,CAAAC,QAAA,EAA9BrC,8BAA8B,CAAA;;;;"}
1
+ {"version":3,"file":"icon.js","sources":["../../../../../src/components/hds/dropdown/toggle/icon.hbs","../../../../../src/components/hds/dropdown/toggle/icon.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<button\\n class={{this.classNames}}\\n aria-label={{this.text}}\\n ...attributes\\n aria-expanded={{if @isOpen \\\"true\\\" \\\"false\\\"}}\\n {{on \\\"click\\\" this.onClick}}\\n {{did-update this.onDidUpdateImageSrc @imageSrc}}\\n type=\\\"button\\\"\\n>\\n <div class=\\\"hds-dropdown-toggle-icon__wrapper\\\">\\n {{#if @imageSrc}}\\n {{#if this.hasImage}}\\n <img src={{@imageSrc}} alt=\\\"\\\" role=\\\"presentation\\\" {{on \\\"error\\\" this.onImageLoadError}} />\\n {{else}}\\n <FlightIcon @name=\\\"user\\\" @size={{this.iconSize}} />\\n {{/if}}\\n {{else if @icon}}\\n <FlightIcon @name={{@icon}} @size={{this.iconSize}} />\\n {{/if}}\\n </div>\\n {{#if this.hasChevron}}\\n <Hds::Dropdown::Toggle::Chevron />\\n {{/if}}\\n</button>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { tracked } from '@glimmer/tracking';\nimport { HdsDropdownToggleIconSizeValues } from './types.ts';\n\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\nimport type { HdsDropdownToggleIconSizes } from './types';\n\nexport const DEFAULT_SIZE = HdsDropdownToggleIconSizeValues.Medium;\nexport const SIZES: string[] = Object.values(HdsDropdownToggleIconSizeValues);\n\nconst NOOP = (): void => {};\n\nexport interface HdsDropdownToggleIconSignature {\n Args: {\n hasChevron?: boolean;\n icon: FlightIconSignature['Args']['name'];\n imageSrc: string;\n isOpen?: boolean;\n onClick?: (event: MouseEvent) => void;\n size?: HdsDropdownToggleIconSizes;\n text: string;\n };\n Element: HTMLButtonElement;\n}\n\nexport default class HdsDropdownToggleIconComponent extends Component<HdsDropdownToggleIconSignature> {\n @tracked hasImage = true;\n\n constructor(owner: unknown, args: HdsDropdownToggleIconSignature['Args']) {\n super(owner, args);\n if (!(this.args.icon || this.args.imageSrc)) {\n assert(\n '@icon or @imageSrc must be defined for \"Hds::Dropdown::Toggle::Icon\"'\n );\n }\n }\n\n @action\n onDidUpdateImageSrc(): void {\n this.hasImage = true;\n }\n\n @action\n onImageLoadError(): void {\n this.hasImage = false;\n }\n\n /**\n * @param text\n * @type {string}\n * @description The text of the `aria-label` applied to the toggle\n */\n get text(): string {\n const { text } = this.args;\n\n assert(\n '@text for \"Hds::Dropdown::Toggle::Icon\" must have a valid value',\n text !== undefined\n );\n\n return text;\n }\n\n /**\n * @param size\n * @type {string}\n * @default medium\n * @description The size of the button; acceptable values are `small` and `medium`\n */\n get size(): HdsDropdownToggleIconSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Dropdown::Toggle::Icon\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * @param iconSize\n * @type {string}\n * @default 24\n * @description ensures that the correct icon size is used\n */\n get iconSize(): FlightIconSignature['Args']['size'] {\n if (this.args.size === 'medium' && !this.hasChevron) {\n // in this special case we use a larger SVG\n return '24';\n } else {\n // this is the default size (notice: for the \"small\" variant with chevron, we set the actual size to `12px` via CSS)\n return '16';\n }\n }\n\n /**\n * Indicates if a dropdown chevron icon should be displayed; should be displayed unless the \"more-horizontal\" icon is used.\n *\n * @param hasChevron\n * @type {boolean}\n * @default true\n */\n get hasChevron(): boolean {\n return this.args.hasChevron ?? true;\n }\n\n /**\n * @param onClick\n * @type {function}\n * @default () => {}\n */\n get onClick(): (event: MouseEvent) => void {\n const { onClick } = this.args;\n\n // notice: this is a guard used in case the toggle is used as standalone element (eg. in the showcase)\n // in reality it's always used inside the Dropdown main component as yielded component, so the onClick handler is always defined\n if (typeof onClick === 'function') {\n return onClick;\n } else {\n return NOOP;\n }\n }\n\n /**\n * Get the class names to apply to the component.\n * @method ToggleIcon#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-dropdown-toggle-icon'];\n\n // add a class based on the @size argument\n classes.push(`hds-dropdown-toggle-icon--size-${this.size}`);\n\n // add a class based on the @isOpen argument\n if (this.args.isOpen) {\n classes.push('hds-dropdown-toggle-icon--is-open');\n }\n\n // add a class based on the @hasChevron argument\n if (this.hasChevron) {\n classes.push('hds-dropdown-toggle-icon--has-chevron');\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_SIZE","HdsDropdownToggleIconSizeValues","Medium","SIZES","Object","values","NOOP","HdsDropdownToggleIconComponent","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","icon","imageSrc","assert","onDidUpdateImageSrc","hasImage","onImageLoadError","text","undefined","size","join","includes","iconSize","hasChevron","onClick","classNames","classes","push","isOpen","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,qzBAAqzB;;;ACa10BA,MAAAA,YAAY,GAAGC,+BAA+B,CAACC,OAAM;AAC3D,MAAMC,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACJ,+BAA+B,EAAC;AAE7E,MAAMK,IAAI,GAAGA,MAAY,EAAE,CAAA;AAeNC,IAAAA,8BAA8B,IAAAC,MAAA,GAApC,MAAMD,8BAA8B,SAASE,SAAS,CAAiC;AAGpGC,EAAAA,WAAWA,CAACC,KAAc,EAAEC,IAA4C,EAAE;AACxE,IAAA,KAAK,CAACD,KAAK,EAAEC,IAAI,CAAC,CAAA;AAACC,IAAAA,0BAAA,mBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AACnB,IAAA,IAAI,EAAE,IAAI,CAACF,IAAI,CAACG,IAAI,IAAI,IAAI,CAACH,IAAI,CAACI,QAAQ,CAAC,EAAE;MAC3CC,MAAM,CACJ,sEACF,CAAC,CAAA;AACH,KAAA;AACF,GAAA;AAGAC,EA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D,yBAAA,CAAAzB,MAAA,CAAA0B,SAAA,uBAKNM,MAAM,CAAA,EAAApC,MAAA,CAAAqC,wBAAA,CAAAjC,MAAA,CAAA0B,SAAA,EAAA,kBAAA,CAAA,EAAA1B,MAAA,CAAA0B,SAAA,IAAA1B,MAAA,EAAA;AAjB0CkC,oBAAA,CAAAC,QAAA,EAA9BpC,8BAA8B,CAAA;;;;"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ let HdsDropdownToggleIconSizeValues = /*#__PURE__*/function (HdsDropdownToggleIconSizeValues) {
7
+ HdsDropdownToggleIconSizeValues["Small"] = "small";
8
+ HdsDropdownToggleIconSizeValues["Medium"] = "medium";
9
+ return HdsDropdownToggleIconSizeValues;
10
+ }({});
11
+ let HdsDropdownToggleButtonSizeValues = /*#__PURE__*/function (HdsDropdownToggleButtonSizeValues) {
12
+ HdsDropdownToggleButtonSizeValues["Small"] = "small";
13
+ HdsDropdownToggleButtonSizeValues["Medium"] = "medium";
14
+ return HdsDropdownToggleButtonSizeValues;
15
+ }({});
16
+ let HdsDropdownToggleButtonColorValues = /*#__PURE__*/function (HdsDropdownToggleButtonColorValues) {
17
+ HdsDropdownToggleButtonColorValues["Primary"] = "primary";
18
+ HdsDropdownToggleButtonColorValues["Secondary"] = "secondary";
19
+ return HdsDropdownToggleButtonColorValues;
20
+ }({});
21
+
22
+ export { HdsDropdownToggleButtonColorValues, HdsDropdownToggleButtonSizeValues, HdsDropdownToggleIconSizeValues };
23
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../../../src/components/hds/dropdown/toggle/types.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsDropdownToggleIconSizeValues {\n Small = 'small',\n Medium = 'medium',\n}\nexport type HdsDropdownToggleIconSizes = `${HdsDropdownToggleIconSizeValues}`;\n\nexport enum HdsDropdownToggleButtonSizeValues {\n Small = 'small',\n Medium = 'medium',\n}\nexport type HdsDropdownToggleButtonSizes =\n `${HdsDropdownToggleButtonSizeValues}`;\n\nexport enum HdsDropdownToggleButtonColorValues {\n Primary = 'primary',\n Secondary = 'secondary',\n}\nexport type HdsDropdownToggleButtonColors =\n `${HdsDropdownToggleButtonColorValues}`;\n"],"names":["HdsDropdownToggleIconSizeValues","HdsDropdownToggleButtonSizeValues","HdsDropdownToggleButtonColorValues"],"mappings":"AAAA;AACA;AACA;AACA;;AAEYA,IAAAA,+BAA+B,0BAA/BA,+BAA+B,EAAA;EAA/BA,+BAA+B,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;EAA/BA,+BAA+B,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;AAAA,EAAA,OAA/BA,+BAA+B,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAM/BC,IAAAA,iCAAiC,0BAAjCA,iCAAiC,EAAA;EAAjCA,iCAAiC,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;EAAjCA,iCAAiC,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;AAAA,EAAA,OAAjCA,iCAAiC,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAOjCC,IAAAA,kCAAkC,0BAAlCA,kCAAkC,EAAA;EAAlCA,kCAAkC,CAAA,SAAA,CAAA,GAAA,SAAA,CAAA;EAAlCA,kCAAkC,CAAA,WAAA,CAAA,GAAA,WAAA,CAAA;AAAA,EAAA,OAAlCA,kCAAkC,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
6
+ let HdsDropdownPositionValues = /*#__PURE__*/function (HdsDropdownPositionValues) {
7
+ HdsDropdownPositionValues["BottomLeft"] = "bottom-left";
8
+ HdsDropdownPositionValues["BottomRight"] = "bottom-right";
9
+ HdsDropdownPositionValues["TopLeft"] = "top-left";
10
+ HdsDropdownPositionValues["TopRight"] = "top-right";
11
+ return HdsDropdownPositionValues;
12
+ }({});
13
+
14
+ export { HdsDropdownPositionValues };
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../../src/components/hds/dropdown/types.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsDropdownPositionValues {\n BottomLeft = 'bottom-left',\n BottomRight = 'bottom-right',\n TopLeft = 'top-left',\n TopRight = 'top-right',\n}\nexport type HdsDropdownPositions = `${HdsDropdownPositionValues}`;\n"],"names":["HdsDropdownPositionValues"],"mappings":"AAAA;AACA;AACA;AACA;;AAEYA,IAAAA,yBAAyB,0BAAzBA,yBAAyB,EAAA;EAAzBA,yBAAyB,CAAA,YAAA,CAAA,GAAA,aAAA,CAAA;EAAzBA,yBAAyB,CAAA,aAAA,CAAA,GAAA,cAAA,CAAA;EAAzBA,yBAAyB,CAAA,SAAA,CAAA,GAAA,UAAA,CAAA;EAAzBA,yBAAyB,CAAA,UAAA,CAAA,GAAA,WAAA,CAAA;AAAA,EAAA,OAAzBA,yBAAyB,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/hds/flyout/index.hbs","../../../../src/components/hds/flyout/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::DialogPrimitive::Wrapper\\n class={{this.classNames}}\\n ...attributes\\n aria-labelledby={{this.id}}\\n {{did-insert this.didInsert}}\\n {{will-destroy this.willDestroyNode}}\\n {{! @glint-expect-error - https://github.com/josemarluedke/ember-focus-trap/issues/86 }}\\n {{focus-trap isActive=this.isOpen focusTrapOptions=(hash onDeactivate=this.onDismiss clickOutsideDeactivates=true)}}\\n>\\n <:header>\\n {{yield\\n (hash\\n Header=(component\\n \\\"hds/dialog-primitive/header\\\" id=this.id onDismiss=this.onDismiss contextualClassPrefix=\\\"hds-flyout\\\"\\n )\\n Description=(component \\\"hds/dialog-primitive/description\\\" contextualClass=\\\"hds-flyout__description\\\")\\n )\\n }}\\n </:header>\\n <:body>\\n {{yield (hash Body=(component \\\"hds/dialog-primitive/body\\\" contextualClass=\\\"hds-flyout__body\\\"))}}\\n </:body>\\n <:footer>\\n {{yield\\n (hash\\n Footer=(component \\\"hds/dialog-primitive/footer\\\" onDismiss=this.onDismiss contextualClass=\\\"hds-flyout__footer\\\")\\n )\\n }}\\n </:footer>\\n</Hds::DialogPrimitive::Wrapper>\\n\\n{{#if this.isOpen}}\\n <Hds::DialogPrimitive::Overlay @contextualClass=\\\"hds-flyout__overlay\\\" />\\n{{/if}}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { getElementId } from '../../../utils/hds-get-element-id.ts';\nimport { buildWaiter } from '@ember/test-waiters';\nimport type { WithBoundArgs } from '@glint/template';\n\nimport type { HdsFlyoutSizes } from './types.ts';\n\nimport { HdsFlyoutSizesValues } from './types.ts';\nimport HdsDialogPrimitiveBodyComponent from '../dialog-primitive/body.ts';\nimport HdsDialogPrimitiveDescriptionComponent from '../dialog-primitive/description.ts';\nimport HdsDialogPrimitiveFooterComponent from '../dialog-primitive/footer.ts';\nimport HdsDialogPrimitiveHeaderComponent from '../dialog-primitive/header.ts';\n\nconst waiter = buildWaiter('@hashicorp/design-system-components:flyout');\n\nexport const DEFAULT_SIZE = HdsFlyoutSizesValues.Medium;\nexport const DEFAULT_HAS_OVERLAY = true;\nexport const SIZES: string[] = Object.values(HdsFlyoutSizesValues);\n\nexport interface HdsFlyoutIndexSignature {\n Args: {\n isDismissDisabled?: boolean;\n size?: HdsFlyoutSizes;\n onOpen?: () => void;\n onClose?: (event: Event) => void;\n };\n Blocks: {\n default: [\n {\n Header?: WithBoundArgs<\n typeof HdsDialogPrimitiveHeaderComponent,\n 'id' | 'onDismiss' | 'contextualClassPrefix'\n >;\n Description?: WithBoundArgs<\n typeof HdsDialogPrimitiveDescriptionComponent,\n 'contextualClass'\n >;\n Body?: WithBoundArgs<\n typeof HdsDialogPrimitiveBodyComponent,\n 'contextualClass'\n >;\n Footer?: WithBoundArgs<\n typeof HdsDialogPrimitiveFooterComponent,\n 'onDismiss' | 'contextualClass'\n >;\n },\n ];\n };\n Element: HTMLDialogElement;\n}\n\nexport default class HdsFlyoutIndexComponent extends Component<HdsFlyoutIndexSignature> {\n @tracked isOpen = false;\n element!: HTMLDialogElement;\n body!: HTMLElement;\n bodyInitialOverflowValue = '';\n\n /**\n * Sets the size of the flyout\n * Accepted values: medium, large\n *\n * @param size\n * @type {string}\n * @default 'medium'\n */\n get size(): HdsFlyoutSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Flyout\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Calculates the unique ID to assign to the title\n */\n get id() {\n return getElementId(this);\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-flyout'];\n\n // add a class based on the @size argument\n classes.push(`hds-flyout--size-${this.size}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback(event: Event) {\n if (this.args.onClose && typeof this.args.onClose === 'function') {\n this.args.onClose(event);\n }\n\n this.isOpen = false;\n }\n\n @action\n didInsert(element: HTMLDialogElement) {\n // Store references of `<dialog>` and `<body>` elements\n this.element = element;\n this.body = document.body;\n\n if (this.body) {\n // Store the initial `overflow` value of `<body>` so we can reset to it\n this.bodyInitialOverflowValue =\n this.body.style.getPropertyValue('overflow');\n }\n\n // Register \"onClose\" callback function to be called when a native 'close' event is dispatched\n this.element.addEventListener('close', this.registerOnCloseCallback, true);\n\n // If the flyout dialog is not already open\n if (!this.element.open) {\n this.open();\n }\n }\n\n @action\n willDestroyNode() {\n if (this.element) {\n this.element.removeEventListener(\n 'close',\n this.registerOnCloseCallback,\n true\n );\n }\n }\n\n @action\n open() {\n // Make flyout dialog visible using the native `showModal` method\n this.element.showModal();\n this.isOpen = true;\n\n // Prevent page from scrolling when the dialog is open\n if (this.body) this.body.style.setProperty('overflow', 'hidden');\n\n // Call \"onOpen\" callback function\n if (this.args.onOpen && typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n }\n\n @action\n async onDismiss() {\n // allow ember test helpers to be aware of when the `close` event fires\n // when using `click` or other helpers from '@ember/test-helpers'\n // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)\n if (this.element.open) {\n const token = waiter.beginAsync();\n const listener = () => {\n waiter.endAsync(token);\n this.element.removeEventListener('close', listener);\n };\n this.element.addEventListener('close', listener);\n }\n\n // Make flyout dialog invisible using the native `close` method\n this.element.close();\n\n // Reset page `overflow` property\n if (this.body) {\n this.body.style.removeProperty('overflow');\n if (this.bodyInitialOverflowValue === '') {\n if (this.body.style.length === 0) {\n this.body.removeAttribute('style');\n }\n } else {\n this.body.style.setProperty('overflow', this.bodyInitialOverflowValue);\n }\n }\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","HdsFlyoutSizesValues","Medium","DEFAULT_HAS_OVERLAY","SIZES","Object","values","HdsFlyoutIndexComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_defineProperty","size","assert","join","includes","id","getElementId","classNames","classes","push","registerOnCloseCallback","event","onClose","isOpen","didInsert","element","body","document","bodyInitialOverflowValue","style","getPropertyValue","addEventListener","open","willDestroyNode","removeEventListener","showModal","setProperty","onOpen","onDismiss","token","beginAsync","listener","endAsync","close","removeProperty","length","removeAttribute","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,iwCAAiwC;;;ACoBnyC,MAAMA,MAAM,GAAGC,WAAW,CAAC,4CAA4C,CAAC,CAAA;AAE3DC,MAAAA,YAAY,GAAGC,oBAAoB,CAACC,OAAM;AAChD,MAAMC,mBAAmB,GAAG,KAAI;AAChC,MAAMC,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACL,oBAAoB,EAAC;AAkC7CM,IAAAA,uBAAuB,IAAAC,MAAA,GAA7B,MAAMD,uBAAuB,SAASE,SAAS,CAA0B;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,iBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;IAAAC,eAAA,CAAA,IAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAAAA,IAAAA,eAAA,mCAI3D,EAAE,CAAA,CAAA;AAAA,GAAA;AAE7B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAmB;IACzB,MAAM;AAAEA,MAAAA,IAAI,GAAGf,YAAAA;KAAc,GAAG,IAAI,CAACW,IAAI,CAAA;AAEzCK,IAAAA,MAAM,CACJ,CAAyDZ,sDAAAA,EAAAA,KAAK,CAACa,IAAI,CACjE,IACF,CAAC,CAAA,YAAA,EAAeF,IAAI,CAAA,CAAE,EACtBX,KAAK,CAACc,QAAQ,CAACH,IAAI,CACrB,CAAC,CAAA;AAED,IAAA,OAAOA,IAAI,CAAA;AACb,GAAA;;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D,EAAAA,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAAA,MAAA,EAAA,CAWNM,MAAM,CAAArD,EAAAA,MAAA,CAAAsD,wBAAA,CAAAnD,MAAA,CAAA4C,SAAA,EAAA,MAAA,CAAA,EAAA5C,MAAA,CAAA4C,SAAA,GAAAD,yBAAA,CAAA3C,MAAA,CAAA4C,SAAA,EAeNM,WAAAA,EAAAA,CAAAA,MAAM,CAAArD,EAAAA,MAAA,CAAAsD,wBAAA,CAAAnD,MAAA,CAAA4C,SAAA,gBAAA5C,MAAA,CAAA4C,SAAA,CAAA,GAAA5C,MAAA,EAAA;AAvGmCoD,oBAAA,CAAAC,QAAA,EAAvBtD,uBAAuB,CAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/hds/flyout/index.hbs","../../../../src/components/hds/flyout/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::DialogPrimitive::Wrapper\\n class={{this.classNames}}\\n ...attributes\\n aria-labelledby={{this.id}}\\n {{did-insert this.didInsert}}\\n {{will-destroy this.willDestroyNode}}\\n {{! @glint-expect-error - https://github.com/josemarluedke/ember-focus-trap/issues/86 }}\\n {{focus-trap isActive=this.isOpen focusTrapOptions=(hash onDeactivate=this.onDismiss clickOutsideDeactivates=true)}}\\n>\\n <:header>\\n {{yield\\n (hash\\n Header=(component\\n \\\"hds/dialog-primitive/header\\\" id=this.id onDismiss=this.onDismiss contextualClassPrefix=\\\"hds-flyout\\\"\\n )\\n Description=(component \\\"hds/dialog-primitive/description\\\" contextualClass=\\\"hds-flyout__description\\\")\\n )\\n }}\\n </:header>\\n <:body>\\n {{yield (hash Body=(component \\\"hds/dialog-primitive/body\\\" contextualClass=\\\"hds-flyout__body\\\"))}}\\n </:body>\\n <:footer>\\n {{yield\\n (hash\\n Footer=(component \\\"hds/dialog-primitive/footer\\\" onDismiss=this.onDismiss contextualClass=\\\"hds-flyout__footer\\\")\\n )\\n }}\\n </:footer>\\n</Hds::DialogPrimitive::Wrapper>\\n\\n{{#if this.isOpen}}\\n <Hds::DialogPrimitive::Overlay @contextualClass=\\\"hds-flyout__overlay\\\" />\\n{{/if}}\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { getElementId } from '../../../utils/hds-get-element-id.ts';\nimport { buildWaiter } from '@ember/test-waiters';\nimport type { WithBoundArgs } from '@glint/template';\n\nimport type { HdsFlyoutSizes } from './types.ts';\n\nimport { HdsFlyoutSizesValues } from './types.ts';\nimport HdsDialogPrimitiveBodyComponent from '../dialog-primitive/body.ts';\nimport HdsDialogPrimitiveDescriptionComponent from '../dialog-primitive/description.ts';\nimport HdsDialogPrimitiveFooterComponent from '../dialog-primitive/footer.ts';\nimport HdsDialogPrimitiveHeaderComponent from '../dialog-primitive/header.ts';\n\nconst waiter = buildWaiter('@hashicorp/design-system-components:flyout');\n\nexport const DEFAULT_SIZE = HdsFlyoutSizesValues.Medium;\nexport const DEFAULT_HAS_OVERLAY = true;\nexport const SIZES: string[] = Object.values(HdsFlyoutSizesValues);\n\nexport interface HdsFlyoutIndexSignature {\n Args: {\n isDismissDisabled?: boolean;\n size?: HdsFlyoutSizes;\n onOpen?: () => void;\n onClose?: (event: Event) => void;\n };\n Blocks: {\n default: [\n {\n Header?: WithBoundArgs<\n typeof HdsDialogPrimitiveHeaderComponent,\n 'id' | 'onDismiss' | 'contextualClassPrefix'\n >;\n Description?: WithBoundArgs<\n typeof HdsDialogPrimitiveDescriptionComponent,\n 'contextualClass'\n >;\n Body?: WithBoundArgs<\n typeof HdsDialogPrimitiveBodyComponent,\n 'contextualClass'\n >;\n Footer?: WithBoundArgs<\n typeof HdsDialogPrimitiveFooterComponent,\n 'onDismiss' | 'contextualClass'\n >;\n },\n ];\n };\n Element: HTMLDialogElement;\n}\n\nexport default class HdsFlyoutIndexComponent extends Component<HdsFlyoutIndexSignature> {\n @tracked isOpen = false;\n element!: HTMLDialogElement;\n body!: HTMLElement;\n bodyInitialOverflowValue = '';\n\n /**\n * Sets the size of the flyout\n * Accepted values: medium, large\n *\n * @param size\n * @type {string}\n * @default 'medium'\n */\n get size(): HdsFlyoutSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Flyout\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Calculates the unique ID to assign to the title\n */\n get id(): string {\n return getElementId(this);\n }\n\n /**\n * Get the class names to apply to the component.\n * @method classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-flyout'];\n\n // add a class based on the @size argument\n classes.push(`hds-flyout--size-${this.size}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback(event: Event) {\n if (this.args.onClose && typeof this.args.onClose === 'function') {\n this.args.onClose(event);\n }\n\n this.isOpen = false;\n }\n\n @action\n didInsert(element: HTMLDialogElement): void {\n // Store references of `<dialog>` and `<body>` elements\n this.element = element;\n this.body = document.body;\n\n if (this.body) {\n // Store the initial `overflow` value of `<body>` so we can reset to it\n this.bodyInitialOverflowValue =\n this.body.style.getPropertyValue('overflow');\n }\n\n // Register \"onClose\" callback function to be called when a native 'close' event is dispatched\n this.element.addEventListener('close', this.registerOnCloseCallback, true);\n\n // If the flyout dialog is not already open\n if (!this.element.open) {\n this.open();\n }\n }\n\n @action\n willDestroyNode(): void {\n if (this.element) {\n this.element.removeEventListener(\n 'close',\n this.registerOnCloseCallback,\n true\n );\n }\n }\n\n @action\n open(): void {\n // Make flyout dialog visible using the native `showModal` method\n this.element.showModal();\n this.isOpen = true;\n\n // Prevent page from scrolling when the dialog is open\n if (this.body) this.body.style.setProperty('overflow', 'hidden');\n\n // Call \"onOpen\" callback function\n if (this.args.onOpen && typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n }\n\n @action\n async onDismiss(): Promise<void> {\n // allow ember test helpers to be aware of when the `close` event fires\n // when using `click` or other helpers from '@ember/test-helpers'\n // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)\n if (this.element.open) {\n const token = waiter.beginAsync();\n const listener = () => {\n waiter.endAsync(token);\n this.element.removeEventListener('close', listener);\n };\n this.element.addEventListener('close', listener);\n }\n\n // Make flyout dialog invisible using the native `close` method\n this.element.close();\n\n // Reset page `overflow` property\n if (this.body) {\n this.body.style.removeProperty('overflow');\n if (this.bodyInitialOverflowValue === '') {\n if (this.body.style.length === 0) {\n this.body.removeAttribute('style');\n }\n } else {\n this.body.style.setProperty('overflow', this.bodyInitialOverflowValue);\n }\n }\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","HdsFlyoutSizesValues","Medium","DEFAULT_HAS_OVERLAY","SIZES","Object","values","HdsFlyoutIndexComponent","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_defineProperty","size","assert","join","includes","id","getElementId","classNames","classes","push","registerOnCloseCallback","event","onClose","isOpen","didInsert","element","body","document","bodyInitialOverflowValue","style","getPropertyValue","addEventListener","open","willDestroyNode","removeEventListener","showModal","setProperty","onOpen","onDismiss","token","beginAsync","listener","endAsync","close","removeProperty","length","removeAttribute","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,iwCAAiwC;;;ACoBnyC,MAAMA,MAAM,GAAGC,WAAW,CAAC,4CAA4C,CAAC,CAAA;AAE3DC,MAAAA,YAAY,GAAGC,oBAAoB,CAACC,OAAM;AAChD,MAAMC,mBAAmB,GAAG,KAAI;AAChC,MAAMC,KAAe,GAAGC,MA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AA;AAvGmCoD,oBAAA,CAAAC,QAAA,EAAvBtD,uBAAuB,CAAA;;;;"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  let HdsFlyoutSizesValues = /*#__PURE__*/function (HdsFlyoutSizesValues) {
2
7
  HdsFlyoutSizesValues["Medium"] = "medium";
3
8
  HdsFlyoutSizesValues["Large"] = "large";
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../src/components/hds/flyout/types.ts"],"sourcesContent":["export enum HdsFlyoutSizesValues {\n Medium = 'medium',\n Large = 'large',\n}\n\nexport type HdsFlyoutSizes = `${HdsFlyoutSizesValues}`;\n"],"names":["HdsFlyoutSizesValues"],"mappings":"AAAYA,IAAAA,oBAAoB,0BAApBA,oBAAoB,EAAA;EAApBA,oBAAoB,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAApBA,oBAAoB,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAApBA,oBAAoB,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
1
+ {"version":3,"file":"types.js","sources":["../../../../src/components/hds/flyout/types.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nexport enum HdsFlyoutSizesValues {\n Medium = 'medium',\n Large = 'large',\n}\n\nexport type HdsFlyoutSizes = `${HdsFlyoutSizesValues}`;\n"],"names":["HdsFlyoutSizesValues"],"mappings":"AAAA;AACA;AACA;AACA;;AAEYA,IAAAA,oBAAoB,0BAApBA,oBAAoB,EAAA;EAApBA,oBAAoB,CAAA,QAAA,CAAA,GAAA,QAAA,CAAA;EAApBA,oBAAoB,CAAA,OAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAApBA,oBAAoB,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sources":["../../../../../src/components/hds/form/checkbox/base.hbs","../../../../../src/components/hds/form/checkbox/base.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<input type=\\\"checkbox\\\" class=\\\"hds-form-checkbox\\\" ...attributes value={{@value}} />\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport templateOnlyComponent from '@ember/component/template-only';\n\ninterface HdsFormCheckboxBaseSignature {\n Args: {\n value?: string;\n };\n Element: HTMLInputElement;\n}\n\nconst HdsFormCheckboxBaseComponent =\n templateOnlyComponent<HdsFormCheckboxBaseSignature>();\n\nexport default HdsFormCheckboxBaseComponent;\n"],"names":["HdsFormCheckboxBaseComponent","templateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,sKAAsK;;ACDxM;AACA;AACA;AACA;;AAWA,MAAMA,4BAA4B,GAChCC,qBAAqB,EAAgC,CAAA;AAEvD,WAAAC,oBAAA,CAAAC,QAAA,EAAeH,4BAA4B,CAAA;;;;"}
1
+ {"version":3,"file":"base.js","sources":["../../../../../src/components/hds/form/checkbox/base.hbs","../../../../../src/components/hds/form/checkbox/base.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<input type=\\\"checkbox\\\" class=\\\"hds-form-checkbox\\\" ...attributes value={{@value}} />\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport templateOnlyComponent from '@ember/component/template-only';\n\nexport interface HdsFormCheckboxBaseSignature {\n Args: {\n value?: string;\n };\n Element: HTMLInputElement;\n}\n\nconst HdsFormCheckboxBaseComponent =\n templateOnlyComponent<HdsFormCheckboxBaseSignature>();\n\nexport default HdsFormCheckboxBaseComponent;\n"],"names":["HdsFormCheckboxBaseComponent","templateOnlyComponent","setComponentTemplate","TEMPLATE"],"mappings":";;;;AACA,eAAe,kBAAkB,CAAC,sKAAsK;;ACDxM;AACA;AACA;AACA;;AAWA,MAAMA,4BAA4B,GAChCC,qBAAqB,EAAgC,CAAA;AAEvD,WAAAC,oBAAA,CAAAC,QAAA,EAAeH,4BAA4B,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/hds/icon-tile/index.hbs","../../../../src/components/hds/icon-tile/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class={{this.classNames}} aria-hidden=\\\"true\\\" ...attributes>\\n {{#if @icon}}\\n <div class=\\\"hds-icon-tile__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </div>\\n {{/if}}\\n {{#if @logo}}\\n <div class=\\\"hds-icon-tile__logo\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </div>\\n {{/if}}\\n {{#if this.iconSecondary}}\\n <div class=\\\"hds-icon-tile__extra\\\">\\n <div class=\\\"hds-icon-tile__extra-icon\\\">\\n <FlightIcon @name={{this.iconSecondary}} @size=\\\"16\\\" @stretched={{true}} />\\n </div>\\n </div>\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\n\nimport {\n HdsIconTileColorNeutral,\n HdsIconTileProductValues,\n HdsIconTileSizeValues,\n} from './types.ts';\n\nimport type {\n HdsIconTileColors,\n HdsIconTileProducts,\n HdsIconTileSizes,\n} from './types.ts';\n\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const DEFAULT_SIZE = 'medium';\nexport const DEFAULT_COLOR = 'neutral';\nexport const SIZES: string[] = Object.values(HdsIconTileSizeValues);\nexport const COLORS: string[] = Object.values({\n ...HdsIconTileColorNeutral,\n ...HdsIconTileProductValues,\n});\nexport const PRODUCTS: string[] = Object.values(HdsIconTileProductValues);\n\nexport interface HdsIconTileSignature {\n Args: {\n size?: HdsIconTileSizes;\n color?: HdsIconTileColors;\n logo?: HdsIconTileProducts;\n icon?: FlightIconSignature['Args']['name'];\n iconSecondary?: FlightIconSignature['Args']['name'];\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsIconTileComponent extends Component<HdsIconTileSignature> {\n /**\n * Sets the size for the component\n * Accepted values: small, medium, large\n *\n * @param size\n * @type {string}\n * @default 'medium'\n */\n get size(): HdsIconTileSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::IconTile\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Sets the color scheme for the component\n * Accepted values: see THE COLORS LIST\n *\n * @param color\n * @type {string}\n * @default 'neutral'\n */\n get color(): string {\n let { color = DEFAULT_COLOR } = this.args;\n\n // if it's a \"logo\" then we overwrite any @color parameter passed\n // and just use the product \"brand\" color\n if (this.logo) {\n color = this.logo;\n }\n\n assert(\n `@color for \"Hds::IconTile\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * Sets the icon name (one of the FlightIcons)\n *\n * @param icon\n * @type {string|null}\n * @default null\n */\n get icon(): FlightIconSignature['Args']['name'] | undefined {\n if (this.args.logo) {\n // for the logo version we use the colored versions directly\n return `${this.args.logo}-color`;\n } else if (this.args.icon) {\n return this.args.icon;\n } else {\n return undefined;\n }\n }\n\n /**\n * @param iconSize\n * @type {string}\n * @default 16\n * @description ensures that the correct icon size is used. Automatically calculated.\n */\n get iconSize(): '16' | '24' {\n if (this.args.size === 'small') {\n return '16';\n } else {\n return '24';\n }\n }\n\n /**\n * Sets the logo name if there is one\n *\n * @param logo\n * @type {string|null}\n * @default null\n */\n get logo(): HdsIconTileProducts | null {\n const { logo } = this.args;\n\n if (logo) {\n assert(\n `@logo for \"Hds::IconTile\" must be one of the following: ${PRODUCTS.join(\n ', '\n )}; received: ${logo}`,\n PRODUCTS.includes(logo)\n );\n }\n\n return logo ?? null;\n }\n\n /**\n * We need to differentiate between a logo and an icon\n * @method IconTile#entity\n * @return {string} The kind of entity we're dealing with (\"logo\" or \"icon\")\n */\n get entity(): string | undefined {\n let entity;\n\n assert(\n `you can't pass both @logo and @icon properties to the \"Hds::IconTile\" component`,\n !(this.args.logo && this.args.icon)\n );\n\n assert(\n `you need to pass @logo or @icon to the \"Hds::IconTile\" component`,\n !(this.args.logo === undefined && this.args.icon === undefined)\n );\n\n if (this.args.logo) {\n entity = 'logo';\n }\n if (this.args.icon) {\n entity = 'icon';\n }\n\n return entity;\n }\n\n /**\n * Sets the \"secondary\" icon name (one of the FlightIcons)\n *\n * @param iconSecondary\n * @type {string|null}\n * @default null\n */\n get iconSecondary(): FlightIconSignature['Args']['name'] | null {\n return this.args.iconSecondary ?? null;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method IconTile#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n // hds-icon-tile {{this.entityClass}} {{this.sizeClass}} {{this.colorClass}}\"\n get classNames(): string {\n const classes = ['hds-icon-tile'];\n\n // add a class based on its entity argument\n classes.push(`hds-icon-tile--${this.entity}`);\n\n // add a class based on the @size argument\n classes.push(`hds-icon-tile--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-icon-tile--color-${this.color}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_SIZE","DEFAULT_COLOR","SIZES","Object","values","HdsIconTileSizeValues","COLORS","HdsIconTileColorNeutral","HdsIconTileProductValues","PRODUCTS","HdsIconTileComponent","Component","size","args","assert","join","includes","color","logo","icon","undefined","iconSize","entity","iconSecondary","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,4tBAA4tB;;ACD9vB;AACA;AACA;AACA;;AAmBO,MAAMA,YAAY,GAAG,SAAQ;AAC7B,MAAMC,aAAa,GAAG,UAAS;AAC/B,MAAMC,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACC,qBAAqB,EAAC;MACtDC,MAAgB,GAAGH,MAAM,CAACC,MAAM,CAAC;AAC5C,EAAA,GAAGG,uBAAuB;EAC1B,GAAGC,wBAAAA;AACL,CAAC,EAAC;AACK,MAAMC,QAAkB,GAAGN,MAAM,CAACC,MAAM,CAACI,wBAAwB,EAAC;AAa1D,MAAME,oBAAoB,SAASC,SAAS,CAAuB;AAChF;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,IAAIA,GAAqB;IAC3B,MAAM;AAAEA,MAAAA,IAAI,GAAGZ,YAAAA;KAAc,GAAG,IAAI,CAACa,IAAI,CAAA;AAEzCC,IAAAA,MAAM,CACJ,CAA2DZ,wDAAAA,EAAAA,KAAK,CAACa,IAAI,CACnE,IACF,CAAC,CAAA,YAAA,EAAeH,IAAI,CAAA,CAAE,EACtBV,KAAK,CAACc,QAAQ,CAACJ,IAAI,CACrB,CAAC,CAAA;AAED,IAAA,OAAOA,IAAI,CAAA;AACb,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIK,KAAKA,GAAW;IAClB,IAAI;AAAEA,MAAAA,KAAK,GAAGhB,aAAAA;KAAe,GAAG,IAAI,CAACY,IAAI,CAAA;;AAEzC;AACA;IACA,IAAI,IAAI,CAACK,IAAI,EAAE;MACbD,KAAK,GAAG,IAAI,CAACC,IAAI,CAAA;AACnB,KAAA;AAEAJ,IAAAA,MAAM,CACJ,CAA4DR,yDAAAA,EAAAA,MAAM,CAACS,IAAI,CACrE,IACF,CAAC,CAAA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{"version":3,"file":"index.js","sources":["../../../../src/components/hds/icon-tile/index.hbs","../../../../src/components/hds/icon-tile/index.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<div class={{this.classNames}} aria-hidden=\\\"true\\\" ...attributes>\\n {{#if @icon}}\\n <div class=\\\"hds-icon-tile__icon\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </div>\\n {{/if}}\\n {{#if @logo}}\\n <div class=\\\"hds-icon-tile__logo\\\">\\n <FlightIcon @name={{this.icon}} @size={{this.iconSize}} @stretched={{true}} />\\n </div>\\n {{/if}}\\n {{#if this.iconSecondary}}\\n <div class=\\\"hds-icon-tile__extra\\\">\\n <div class=\\\"hds-icon-tile__extra-icon\\\">\\n <FlightIcon @name={{this.iconSecondary}} @size=\\\"16\\\" @stretched={{true}} />\\n </div>\\n </div>\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { assert } from '@ember/debug';\n\nimport {\n HdsIconTileColorNeutral,\n HdsIconTileProductValues,\n HdsIconTileSizeValues,\n} from './types.ts';\n\nimport type {\n HdsIconTileColors,\n HdsIconTileProducts,\n HdsIconTileSizes,\n} from './types.ts';\n\nimport type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';\n\nexport const DEFAULT_SIZE = 'medium';\nexport const DEFAULT_COLOR = 'neutral';\nexport const SIZES: string[] = Object.values(HdsIconTileSizeValues);\nexport const COLORS: string[] = Object.values({\n ...HdsIconTileColorNeutral,\n ...HdsIconTileProductValues,\n});\nexport const PRODUCTS: string[] = Object.values(HdsIconTileProductValues);\n\nexport interface HdsIconTileSignature {\n Args: {\n size?: HdsIconTileSizes;\n color?: HdsIconTileColors;\n logo?: HdsIconTileProducts;\n icon?: FlightIconSignature['Args']['name'];\n iconSecondary?: FlightIconSignature['Args']['name'];\n };\n Element: HTMLDivElement;\n}\n\nexport default class HdsIconTileComponent extends Component<HdsIconTileSignature> {\n /**\n * Sets the size for the component\n * Accepted values: small, medium, large\n *\n * @param size\n * @type {string}\n * @default 'medium'\n */\n get size(): HdsIconTileSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::IconTile\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Sets the color scheme for the component\n * Accepted values: see THE COLORS LIST\n *\n * @param color\n * @type {string}\n * @default 'neutral'\n */\n get color(): string {\n let { color = DEFAULT_COLOR } = this.args;\n\n // if it's a \"logo\" then we overwrite any @color parameter passed\n // and just use the product \"brand\" color\n if (this.logo) {\n color = this.logo;\n }\n\n assert(\n `@color for \"Hds::IconTile\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n /**\n * Sets the icon name (one of the FlightIcons)\n *\n * @param icon\n * @type {string|null}\n * @default null\n */\n get icon(): FlightIconSignature['Args']['name'] | undefined {\n if (this.args.logo) {\n // for the logo version we use the colored versions directly\n return `${this.args.logo}-color`;\n } else if (this.args.icon) {\n return this.args.icon;\n } else {\n return undefined;\n }\n }\n\n /**\n * @param iconSize\n * @type {string}\n * @default 16\n * @description ensures that the correct icon size is used. Automatically calculated.\n */\n get iconSize(): FlightIconSignature['Args']['size'] {\n if (this.args.size === 'small') {\n return '16';\n } else {\n return '24';\n }\n }\n\n /**\n * Sets the logo name if there is one\n *\n * @param logo\n * @type {string|null}\n * @default null\n */\n get logo(): HdsIconTileProducts | null {\n const { logo } = this.args;\n\n if (logo) {\n assert(\n `@logo for \"Hds::IconTile\" must be one of the following: ${PRODUCTS.join(\n ', '\n )}; received: ${logo}`,\n PRODUCTS.includes(logo)\n );\n }\n\n return logo ?? null;\n }\n\n /**\n * We need to differentiate between a logo and an icon\n * @method IconTile#entity\n * @return {string} The kind of entity we're dealing with (\"logo\" or \"icon\")\n */\n get entity(): string | undefined {\n let entity;\n\n assert(\n `you can't pass both @logo and @icon properties to the \"Hds::IconTile\" component`,\n !(this.args.logo && this.args.icon)\n );\n\n assert(\n `you need to pass @logo or @icon to the \"Hds::IconTile\" component`,\n !(this.args.logo === undefined && this.args.icon === undefined)\n );\n\n if (this.args.logo) {\n entity = 'logo';\n }\n if (this.args.icon) {\n entity = 'icon';\n }\n\n return entity;\n }\n\n /**\n * Sets the \"secondary\" icon name (one of the FlightIcons)\n *\n * @param iconSecondary\n * @type {string|null}\n * @default null\n */\n get iconSecondary(): FlightIconSignature['Args']['name'] | null {\n return this.args.iconSecondary ?? null;\n }\n\n /**\n * Get the class names to apply to the component.\n * @method IconTile#classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n // hds-icon-tile {{this.entityClass}} {{this.sizeClass}} {{this.colorClass}}\"\n get classNames(): string {\n const classes = ['hds-icon-tile'];\n\n // add a class based on its entity argument\n classes.push(`hds-icon-tile--${this.entity}`);\n\n // add a class based on the @size argument\n classes.push(`hds-icon-tile--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-icon-tile--color-${this.color}`);\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_SIZE","DEFAULT_COLOR","SIZES","Object","values","HdsIconTileSizeValues","COLORS","HdsIconTileColorNeutral","HdsIconTileProductValues","PRODUCTS","HdsIconTileComponent","Component","size","args","assert","join","includes","color","logo","icon","undefined","iconSize","entity","iconSecondary","classNames","classes","push","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;AACA,eAAe,kBAAkB,CAAC,4tBAA4tB;;ACD9vB;AACA;AACA;AACA;;AAmBO,MAAMA,YAAY,GAAG,SAAQ;AAC7B,MAAMC,aAAa,GAAG,UAAS;AAC/B,MAAMC,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACC,qBAAqB,EAAC;MAC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