@hashicorp/design-system-components 1.6.1 → 1.7.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 (283) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/addon/components/hds/alert/description.hbs +4 -0
  3. package/addon/components/hds/alert/index.hbs +4 -0
  4. package/addon/components/hds/alert/index.js +5 -0
  5. package/addon/components/hds/alert/title.hbs +4 -0
  6. package/addon/components/hds/avatar/index.hbs +4 -0
  7. package/addon/components/hds/badge/index.hbs +4 -0
  8. package/addon/components/hds/badge/index.js +5 -0
  9. package/addon/components/hds/badge-count/index.hbs +4 -0
  10. package/addon/components/hds/badge-count/index.js +5 -0
  11. package/addon/components/hds/breadcrumb/index.hbs +4 -0
  12. package/addon/components/hds/breadcrumb/index.js +5 -0
  13. package/addon/components/hds/breadcrumb/item.hbs +4 -0
  14. package/addon/components/hds/breadcrumb/item.js +5 -0
  15. package/addon/components/hds/breadcrumb/truncation.hbs +4 -0
  16. package/addon/components/hds/button/index.hbs +4 -0
  17. package/addon/components/hds/button/index.js +5 -0
  18. package/addon/components/hds/button-set/index.hbs +4 -0
  19. package/addon/components/hds/card/container.hbs +4 -0
  20. package/addon/components/hds/card/container.js +5 -0
  21. package/addon/components/hds/disclosure/index.hbs +4 -0
  22. package/addon/components/hds/disclosure/index.js +5 -0
  23. package/addon/components/hds/dismiss-button/index.hbs +4 -0
  24. package/addon/components/hds/dropdown/index.hbs +4 -0
  25. package/addon/components/hds/dropdown/index.js +5 -0
  26. package/addon/components/hds/dropdown/list-item/copy-item.hbs +4 -0
  27. package/addon/components/hds/dropdown/list-item/copy-item.js +5 -0
  28. package/addon/components/hds/dropdown/list-item/description.hbs +4 -0
  29. package/addon/components/hds/dropdown/list-item/description.js +5 -0
  30. package/addon/components/hds/dropdown/list-item/generic.hbs +4 -0
  31. package/addon/components/hds/dropdown/list-item/interactive.hbs +4 -0
  32. package/addon/components/hds/dropdown/list-item/interactive.js +5 -0
  33. package/addon/components/hds/dropdown/list-item/separator.hbs +4 -0
  34. package/addon/components/hds/dropdown/list-item/title.hbs +4 -0
  35. package/addon/components/hds/dropdown/list-item/title.js +5 -0
  36. package/addon/components/hds/dropdown/toggle/button.hbs +4 -0
  37. package/addon/components/hds/dropdown/toggle/button.js +5 -0
  38. package/addon/components/hds/dropdown/toggle/icon.hbs +4 -0
  39. package/addon/components/hds/dropdown/toggle/icon.js +5 -0
  40. package/addon/components/hds/empty-state/body.hbs +4 -0
  41. package/addon/components/hds/empty-state/footer.hbs +4 -0
  42. package/addon/components/hds/empty-state/header.hbs +4 -0
  43. package/addon/components/hds/empty-state/index.hbs +4 -0
  44. package/addon/components/hds/flyout/body.hbs +4 -0
  45. package/addon/components/hds/flyout/description.hbs +4 -0
  46. package/addon/components/hds/flyout/header.hbs +4 -0
  47. package/addon/components/hds/flyout/index.hbs +4 -0
  48. package/addon/components/hds/flyout/index.js +5 -0
  49. package/addon/components/hds/form/checkbox/base.hbs +4 -0
  50. package/addon/components/hds/form/checkbox/field.hbs +4 -0
  51. package/addon/components/hds/form/checkbox/group.hbs +4 -0
  52. package/addon/components/hds/form/error/index.hbs +4 -0
  53. package/addon/components/hds/form/error/index.js +5 -0
  54. package/addon/components/hds/form/error/message.hbs +4 -0
  55. package/addon/components/hds/form/field/index.hbs +4 -0
  56. package/addon/components/hds/form/field/index.js +5 -0
  57. package/addon/components/hds/form/fieldset/index.hbs +4 -0
  58. package/addon/components/hds/form/fieldset/index.js +5 -0
  59. package/addon/components/hds/form/helper-text/index.hbs +4 -0
  60. package/addon/components/hds/form/helper-text/index.js +5 -0
  61. package/addon/components/hds/form/indicator/index.hbs +4 -0
  62. package/addon/components/hds/form/indicator/index.js +5 -0
  63. package/addon/components/hds/form/label/index.hbs +4 -0
  64. package/addon/components/hds/form/label/index.js +5 -0
  65. package/addon/components/hds/form/legend/index.hbs +4 -0
  66. package/addon/components/hds/form/legend/index.js +5 -0
  67. package/addon/components/hds/form/radio/base.hbs +4 -0
  68. package/addon/components/hds/form/radio/field.hbs +4 -0
  69. package/addon/components/hds/form/radio/group.hbs +4 -0
  70. package/addon/components/hds/form/radio-card/description.hbs +4 -0
  71. package/addon/components/hds/form/radio-card/group.hbs +4 -0
  72. package/addon/components/hds/form/radio-card/index.hbs +4 -0
  73. package/addon/components/hds/form/radio-card/index.js +5 -0
  74. package/addon/components/hds/form/radio-card/label.hbs +4 -0
  75. package/addon/components/hds/form/select/base.hbs +4 -0
  76. package/addon/components/hds/form/select/base.js +5 -0
  77. package/addon/components/hds/form/select/field.hbs +4 -0
  78. package/addon/components/hds/form/text-input/base.hbs +4 -0
  79. package/addon/components/hds/form/text-input/base.js +5 -0
  80. package/addon/components/hds/form/text-input/field.hbs +4 -0
  81. package/addon/components/hds/form/textarea/base.hbs +4 -0
  82. package/addon/components/hds/form/textarea/base.js +5 -0
  83. package/addon/components/hds/form/textarea/field.hbs +4 -0
  84. package/addon/components/hds/form/toggle/base.hbs +4 -0
  85. package/addon/components/hds/form/toggle/base.js +5 -0
  86. package/addon/components/hds/form/toggle/field.hbs +4 -0
  87. package/addon/components/hds/form/toggle/group.hbs +4 -0
  88. package/addon/components/hds/form/utils/getElementId.js +5 -0
  89. package/addon/components/hds/form/utils/setAriaDescribedBy.js +5 -0
  90. package/addon/components/hds/icon-tile/index.hbs +4 -0
  91. package/addon/components/hds/icon-tile/index.js +5 -0
  92. package/addon/components/hds/interactive/index.js +5 -0
  93. package/addon/components/hds/link/inline.js +5 -0
  94. package/addon/components/hds/link/standalone.js +5 -0
  95. package/addon/components/hds/modal/body.hbs +4 -0
  96. package/addon/components/hds/modal/footer.hbs +4 -0
  97. package/addon/components/hds/modal/header.hbs +4 -0
  98. package/addon/components/hds/modal/index.hbs +4 -0
  99. package/addon/components/hds/modal/index.js +5 -0
  100. package/addon/components/hds/pagination/compact/index.hbs +4 -0
  101. package/addon/components/hds/pagination/compact/index.js +5 -0
  102. package/addon/components/hds/pagination/info/index.hbs +4 -0
  103. package/addon/components/hds/pagination/info/index.js +5 -0
  104. package/addon/components/hds/pagination/nav/arrow.hbs +4 -0
  105. package/addon/components/hds/pagination/nav/arrow.js +5 -0
  106. package/addon/components/hds/pagination/nav/ellipsis.hbs +4 -0
  107. package/addon/components/hds/pagination/nav/number.hbs +4 -0
  108. package/addon/components/hds/pagination/nav/number.js +5 -0
  109. package/addon/components/hds/pagination/numbered/index.hbs +5 -0
  110. package/addon/components/hds/pagination/numbered/index.js +5 -0
  111. package/addon/components/hds/pagination/size-selector/index.hbs +7 -1
  112. package/addon/components/hds/pagination/size-selector/index.js +17 -0
  113. package/addon/components/hds/stepper/step/indicator.hbs +4 -0
  114. package/addon/components/hds/stepper/step/indicator.js +5 -0
  115. package/addon/components/hds/stepper/task/indicator.hbs +4 -0
  116. package/addon/components/hds/stepper/task/indicator.js +5 -0
  117. package/addon/components/hds/table/index.hbs +12 -4
  118. package/addon/components/hds/table/index.js +60 -5
  119. package/addon/components/hds/table/td.hbs +4 -0
  120. package/addon/components/hds/table/td.js +5 -0
  121. package/addon/components/hds/table/th-sort.hbs +4 -0
  122. package/addon/components/hds/table/th-sort.js +22 -9
  123. package/addon/components/hds/table/th.hbs +4 -0
  124. package/addon/components/hds/table/th.js +5 -0
  125. package/addon/components/hds/table/tr.hbs +4 -0
  126. package/addon/components/hds/tabs/index.hbs +4 -0
  127. package/addon/components/hds/tabs/index.js +5 -0
  128. package/addon/components/hds/tabs/panel.hbs +4 -0
  129. package/addon/components/hds/tabs/panel.js +5 -0
  130. package/addon/components/hds/tabs/tab.hbs +4 -0
  131. package/addon/components/hds/tabs/tab.js +5 -0
  132. package/addon/components/hds/tag/index.hbs +4 -0
  133. package/addon/components/hds/tag/index.js +5 -0
  134. package/addon/components/hds/toast/index.hbs +4 -0
  135. package/addon/components/hds/yield/index.hbs +4 -0
  136. package/addon/helpers/hds-link-to-models.js +5 -0
  137. package/addon/helpers/hds-link-to-query.js +5 -0
  138. package/app/components/hds/alert/description.js +5 -0
  139. package/app/components/hds/alert/index.js +5 -0
  140. package/app/components/hds/alert/title.js +5 -0
  141. package/app/components/hds/avatar/index.js +5 -0
  142. package/app/components/hds/badge/index.js +5 -0
  143. package/app/components/hds/badge-count/index.js +5 -0
  144. package/app/components/hds/breadcrumb/index.js +5 -0
  145. package/app/components/hds/breadcrumb/item.js +5 -0
  146. package/app/components/hds/breadcrumb/truncation.js +5 -0
  147. package/app/components/hds/button/index.js +5 -0
  148. package/app/components/hds/button-set/index.js +5 -0
  149. package/app/components/hds/card/container.js +5 -0
  150. package/app/components/hds/disclosure/index.js +5 -0
  151. package/app/components/hds/dismiss-button/index.js +5 -0
  152. package/app/components/hds/dropdown/index.js +5 -0
  153. package/app/components/hds/dropdown/list-item/copy-item.js +5 -0
  154. package/app/components/hds/dropdown/list-item/description.js +5 -0
  155. package/app/components/hds/dropdown/list-item/generic.js +5 -0
  156. package/app/components/hds/dropdown/list-item/interactive.js +5 -0
  157. package/app/components/hds/dropdown/list-item/separator.js +5 -0
  158. package/app/components/hds/dropdown/list-item/title.js +5 -0
  159. package/app/components/hds/dropdown/toggle/button.js +5 -0
  160. package/app/components/hds/dropdown/toggle/icon.js +5 -0
  161. package/app/components/hds/empty-state/body.js +5 -0
  162. package/app/components/hds/empty-state/footer.js +5 -0
  163. package/app/components/hds/empty-state/header.js +5 -0
  164. package/app/components/hds/empty-state/index.js +5 -0
  165. package/app/components/hds/flyout/body.js +5 -0
  166. package/app/components/hds/flyout/description.js +5 -0
  167. package/app/components/hds/flyout/header.js +5 -0
  168. package/app/components/hds/flyout/index.js +5 -0
  169. package/app/components/hds/form/checkbox/base.js +5 -0
  170. package/app/components/hds/form/checkbox/field.js +5 -0
  171. package/app/components/hds/form/checkbox/group.js +5 -0
  172. package/app/components/hds/form/error/index.js +5 -0
  173. package/app/components/hds/form/error/message.js +5 -0
  174. package/app/components/hds/form/field/index.js +5 -0
  175. package/app/components/hds/form/fieldset/index.js +5 -0
  176. package/app/components/hds/form/helper-text/index.js +5 -0
  177. package/app/components/hds/form/indicator/index.js +5 -0
  178. package/app/components/hds/form/label/index.js +5 -0
  179. package/app/components/hds/form/legend/index.js +5 -0
  180. package/app/components/hds/form/radio/base.js +5 -0
  181. package/app/components/hds/form/radio/field.js +5 -0
  182. package/app/components/hds/form/radio/group.js +5 -0
  183. package/app/components/hds/form/radio-card/description.js +5 -0
  184. package/app/components/hds/form/radio-card/group.js +5 -0
  185. package/app/components/hds/form/radio-card/index.js +5 -0
  186. package/app/components/hds/form/radio-card/label.js +5 -0
  187. package/app/components/hds/form/select/base.js +5 -0
  188. package/app/components/hds/form/select/field.js +5 -0
  189. package/app/components/hds/form/text-input/base.js +5 -0
  190. package/app/components/hds/form/text-input/field.js +5 -0
  191. package/app/components/hds/form/textarea/base.js +5 -0
  192. package/app/components/hds/form/textarea/field.js +5 -0
  193. package/app/components/hds/form/toggle/base.js +5 -0
  194. package/app/components/hds/form/toggle/field.js +5 -0
  195. package/app/components/hds/form/toggle/group.js +5 -0
  196. package/app/components/hds/icon-tile/index.js +5 -0
  197. package/app/components/hds/interactive/index.js +5 -0
  198. package/app/components/hds/link/inline.js +5 -0
  199. package/app/components/hds/link/standalone.js +5 -0
  200. package/app/components/hds/modal/body.js +5 -0
  201. package/app/components/hds/modal/footer.js +5 -0
  202. package/app/components/hds/modal/header.js +5 -0
  203. package/app/components/hds/modal/index.js +5 -0
  204. package/app/components/hds/pagination/compact/index.js +5 -0
  205. package/app/components/hds/pagination/info.js +5 -0
  206. package/app/components/hds/pagination/nav/arrow.js +5 -0
  207. package/app/components/hds/pagination/nav/ellipsis.js +5 -0
  208. package/app/components/hds/pagination/nav/number.js +5 -0
  209. package/app/components/hds/pagination/numbered/index.js +5 -0
  210. package/app/components/hds/pagination/size-selector.js +5 -0
  211. package/app/components/hds/stepper/step/indicator.js +5 -0
  212. package/app/components/hds/stepper/task/indicator.js +5 -0
  213. package/app/components/hds/table/index.js +5 -0
  214. package/app/components/hds/table/td.js +5 -0
  215. package/app/components/hds/table/th-sort.js +5 -0
  216. package/app/components/hds/table/th.js +5 -0
  217. package/app/components/hds/table/tr.js +5 -0
  218. package/app/components/hds/tabs/index.js +5 -0
  219. package/app/components/hds/tabs/panel.js +5 -0
  220. package/app/components/hds/tabs/tab.js +5 -0
  221. package/app/components/hds/tag/index.js +5 -0
  222. package/app/components/hds/toast/index.js +5 -0
  223. package/app/components/hds/yield/index.js +5 -0
  224. package/app/helpers/hds-link-to-models.js +5 -0
  225. package/app/helpers/hds-link-to-query.js +5 -0
  226. package/app/styles/@hashicorp/design-system-components.scss +5 -0
  227. package/app/styles/@hashicorp/design-system-power-select-overrides.scss +5 -0
  228. package/app/styles/components/alert.scss +5 -0
  229. package/app/styles/components/avatar.scss +5 -0
  230. package/app/styles/components/badge-count.scss +5 -0
  231. package/app/styles/components/badge.scss +5 -0
  232. package/app/styles/components/breadcrumb.scss +5 -0
  233. package/app/styles/components/button-set.scss +5 -0
  234. package/app/styles/components/button.scss +5 -0
  235. package/app/styles/components/card/container.scss +5 -0
  236. package/app/styles/components/card/index.scss +5 -0
  237. package/app/styles/components/disclosure.scss +5 -0
  238. package/app/styles/components/dismiss-button.scss +5 -0
  239. package/app/styles/components/dropdown.scss +5 -0
  240. package/app/styles/components/empty-state.scss +5 -0
  241. package/app/styles/components/flyout.scss +5 -0
  242. package/app/styles/components/form/checkbox.scss +5 -0
  243. package/app/styles/components/form/error.scss +5 -0
  244. package/app/styles/components/form/field.scss +5 -0
  245. package/app/styles/components/form/group.scss +5 -0
  246. package/app/styles/components/form/helper-text.scss +5 -0
  247. package/app/styles/components/form/index.scss +5 -0
  248. package/app/styles/components/form/indicator.scss +5 -0
  249. package/app/styles/components/form/label.scss +5 -0
  250. package/app/styles/components/form/legend.scss +5 -0
  251. package/app/styles/components/form/radio-card.scss +5 -0
  252. package/app/styles/components/form/radio.scss +5 -0
  253. package/app/styles/components/form/select.scss +5 -0
  254. package/app/styles/components/form/text-input.scss +5 -0
  255. package/app/styles/components/form/textarea.scss +5 -0
  256. package/app/styles/components/form/toggle.scss +5 -0
  257. package/app/styles/components/icon-tile.scss +5 -0
  258. package/app/styles/components/link/index.scss +5 -0
  259. package/app/styles/components/link/inline.scss +5 -0
  260. package/app/styles/components/link/standalone.scss +5 -0
  261. package/app/styles/components/modal.scss +5 -0
  262. package/app/styles/components/pagination.scss +39 -26
  263. package/app/styles/components/stepper/index.scss +5 -0
  264. package/app/styles/components/stepper/step-indicator.scss +5 -0
  265. package/app/styles/components/stepper/task-indicator.scss +5 -0
  266. package/app/styles/components/table.scss +36 -15
  267. package/app/styles/components/tabs.scss +10 -0
  268. package/app/styles/components/tag.scss +5 -0
  269. package/app/styles/components/toast.scss +5 -0
  270. package/app/styles/mixins/_focus-ring.scss +5 -0
  271. package/blueprints/hds-component/files/addon/components/hds/__name__/index.hbs +4 -0
  272. package/blueprints/hds-component/files/addon/components/hds/__name__/index.js +5 -0
  273. package/blueprints/hds-component/files/app/components/hds/__name__/index.js +5 -0
  274. package/blueprints/hds-component/files/app/styles/components/__name__.scss +5 -0
  275. package/blueprints/hds-component/index.js +5 -0
  276. package/blueprints/hds-component-test/files/tests/dummy/app/routes/components/__name__.js +5 -0
  277. package/blueprints/hds-component-test/files/tests/dummy/app/styles/pages/__dummyCSSFileName__.scss +5 -0
  278. package/blueprints/hds-component-test/files/tests/dummy/app/templates/components/__name__.hbs +6 -2
  279. package/blueprints/hds-component-test/files/tests/integration/components/hds/__name__/index-test.js +5 -0
  280. package/blueprints/hds-component-test/index.js +6 -1
  281. package/config/environment.js +5 -0
  282. package/index.js +5 -0
  283. package/package.json +28 -28
@@ -1 +1,5 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <input type="radio" class="hds-form-radio" ...attributes value={{@value}} />
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <Hds::Form::Field
2
6
  @layout="flag"
3
7
  @contextualClass={{@contextualClass}}
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <Hds::Form::Fieldset
2
6
  @layout={{@layout}}
3
7
  @name={{@name}}
@@ -1 +1,5 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <span class="hds-form-radio-card__description hds-typography-body-100" ...attributes>{{yield}}</span>
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <Hds::Form::Fieldset
2
6
  class="hds-form-group--radio-cards"
3
7
  @layout="horizontal"
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <label class={{this.classNames}} {{did-insert this.setAriaDescribedBy}} {{style maxWidth=@maxWidth}}>
2
6
  <span class="hds-form-radio-card__content">
3
7
  {{yield (hash Icon=(component "flight-icon" size="24" isInlineBlock=false))}}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { tracked } from '@glimmer/tracking';
3
8
  import { action } from '@ember/object';
@@ -1 +1,5 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <span class="hds-form-radio-card__label hds-typography-display-300 hds-font-weight-bold" ...attributes>{{yield}}</span>
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <select class={{this.classNames}} {{style width=@width}} ...attributes>
2
6
  {{yield (hash Options=(component "hds/yield"))}}
3
7
  </select>
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
 
3
8
  export default class HdsFormSelectBaseComponent extends Component {
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <Hds::Form::Field
2
6
  @layout="vertical"
3
7
  @extraAriaDescribedBy={{@extraAriaDescribedBy}}
@@ -1 +1,5 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <input class={{this.classNames}} {{style width=@width}} ...attributes value={{@value}} type={{this.type}} />
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { assert } from '@ember/debug';
3
8
 
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <Hds::Form::Field
2
6
  @layout="vertical"
3
7
  @extraAriaDescribedBy={{@extraAriaDescribedBy}}
@@ -1,2 +1,6 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  {{! Notice: this is not the native HTML <textarea> but the Ember component <Textarea> }}
2
6
  <Textarea class={{this.classNames}} {{style width=@width height=@height}} rows="4" ...attributes @value={{@value}} />
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
 
3
8
  export default class HdsFormTextareaBaseComponent extends Component {
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <Hds::Form::Field
2
6
  @layout="vertical"
3
7
  @extraAriaDescribedBy={{@extraAriaDescribedBy}}
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class={{this.classNames}}>
2
6
  <input class="hds-form-toggle__control" type="checkbox" ...attributes value={{@value}} role="switch" />
3
7
  <div class="hds-form-toggle__facade"></div>
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
 
3
8
  export default class HdsFormToggleBaseComponent extends Component {
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <Hds::Form::Field
2
6
  @layout="flag"
3
7
  @contextualClass={{@contextualClass}}
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <Hds::Form::Fieldset @layout={{@layout}} @isRequired={{@isRequired}} @isOptional={{@isOptional}} ...attributes as |F|>
2
6
  {{! Notice: the order of the elements is not relevant here, because it's controlled at "Hds::Form::Fieldset" component level }}
3
7
  {{yield (hash Legend=F.Legend isRequired=F.isRequired isOptional=F.isOptional)}}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import { guidFor } from '@ember/object/internals';
2
7
 
3
8
  export function getElementId(element) {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  export function setAriaDescribedBy(element) {
2
7
  // append @extraAriaDescribedBy arg, if provided
3
8
  if (element.args.extraAriaDescribedBy) {
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class={{this.classNames}} aria-hidden="true" ...attributes>
2
6
  {{#if @icon}}
3
7
  <div class="hds-icon-tile__icon">
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { assert } from '@ember/debug';
3
8
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { action } from '@ember/object';
3
8
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { assert } from '@ember/debug';
3
8
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { assert } from '@ember/debug';
3
8
 
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class="hds-modal__body" ...attributes>
2
6
  {{yield}}
3
7
  </div>
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class="hds-modal__footer" ...attributes>
2
6
  {{yield (hash close=@onDismiss)}}
3
7
  </div>
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class="hds-modal__header" ...attributes>
2
6
  {{#if @icon}}
3
7
  <FlightIcon class="hds-modal__icon" @name={{@icon}} @size="24" @isInlineBlock={{false}} />
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <dialog
2
6
  class={{this.classNames}}
3
7
  ...attributes
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { action } from '@ember/object';
3
8
  import { assert } from '@ember/debug';
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class="hds-pagination" ...attributes>
2
6
  <nav class="hds-pagination-nav" aria-label="Pagination navigation">
3
7
  <Hds::Pagination::Nav::Arrow
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { action } from '@ember/object';
3
8
  import { assert } from '@ember/debug';
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class="hds-pagination-info hds-typography-body-100 hds-font-weight-medium" ...attributes>
2
6
  {{@itemsRangeStart}}–{{@itemsRangeEnd}}
3
7
  {{#if this.showTotalItems}}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
 
3
8
  export default class HdsPaginationInfoComponent extends Component {
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  {{#if @disabled}}
2
6
  <Hds::Interactive class={{this.classNames}} aria-label={{this.content.ariaLabel}} disabled={{true}} ...attributes>
3
7
  <FlightIcon @name={{this.content.icon}} />
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { action } from '@ember/object';
3
8
  import { assert } from '@ember/debug';
@@ -1 +1,5 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class="hds-pagination-nav__ellipsis" ...attributes>...</div>
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <Hds::Interactive
2
6
  class={{this.classNames}}
3
7
  @route={{@route}}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { action } from '@ember/object';
3
8
  import { assert } from '@ember/debug';
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class="hds-pagination" ...attributes>
2
6
  {{#if this.showInfo}}
3
7
  <Hds::Pagination::Info
@@ -58,6 +62,7 @@
58
62
  {{#if this.showSizeSelector}}
59
63
  <Hds::Pagination::SizeSelector
60
64
  @pageSizes={{this.pageSizes}}
65
+ @label={{@sizeSelectorLabel}}
61
66
  @selectedSize={{this.currentPageSize}}
62
67
  @onChange={{this.onPageSizeChange}}
63
68
  />
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { action } from '@ember/object';
3
8
  import { tracked } from '@glimmer/tracking';
@@ -1,5 +1,11 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class="hds-pagination-size-selector" ...attributes>
2
- <label class="hds-typography-body-100 hds-font-weight-medium" for={{this.SizeSelectorId}}>Items per page</label>
6
+ <label class="hds-typography-body-100 hds-font-weight-medium" for={{this.SizeSelectorId}}>
7
+ {{this.label}}
8
+ </label>
3
9
  <Hds::Form::Select::Base id={{this.SizeSelectorId}} {{on "change" this.onChange}} as |S|>
4
10
  <S.Options>
5
11
  {{#each this.pageSizes as |size|}}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { assert } from '@ember/debug';
3
8
  import { guidFor } from '@ember/object/internals';
@@ -45,6 +50,18 @@ export default class HdsPaginationSizeSelectorComponent extends Component {
45
50
  return selectedSize;
46
51
  }
47
52
 
53
+ /**
54
+ * @param label
55
+ * @type string
56
+ * @default "Items per page"
57
+ * @description The label text for the select
58
+ */
59
+ get label() {
60
+ let { label = 'Items per page' } = this.args;
61
+
62
+ return label;
63
+ }
64
+
48
65
  @action
49
66
  onChange(e) {
50
67
  let { onChange } = this.args;
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class={{this.classNames}} ...attributes aria-label={{@status}}>
2
6
  <div class="hds-stepper-indicator-step__svg-hexagon">
3
7
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { assert } from '@ember/debug';
3
8
 
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <div class={{this.classNames}} ...attributes aria-label={{@status}}>
2
6
  <FlightIcon class="hds-stepper-indicator-task__icon" @name={{this.iconName}} @size="16" />
3
7
  </div>
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { assert } from '@ember/debug';
3
8
 
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <table class={{this.classNames}} ...attributes>
2
6
  {{#if @columns}}
3
7
  <caption class="sr-only" aria-live="polite">{{@caption}} {{this.sortedMessageText}}</caption>
@@ -10,8 +14,7 @@
10
14
  {{#each @columns as |column|}}
11
15
  {{#if column.isSortable}}
12
16
  <Hds::Table::ThSort
13
- @isSorted={{eq column.key this.sortBy}}
14
- @sortOrder={{this.sortOrder}}
17
+ @sortOrder={{if (eq column.key this.sortBy) this.sortOrder}}
15
18
  @onClick={{fn this.setSortBy column.key}}
16
19
  @align={{column.align}}
17
20
  @width={{column.width}}
@@ -32,13 +35,18 @@
32
35
  </thead>
33
36
  <tbody class="hds-table__tbody">
34
37
  {{#if @columns}}
35
- {{#each (sort-by this.getSortCriteria @model) as |data|}}
38
+ {{! ----------------------------------------------------------------------------------------
39
+ IMPORTANT: we loop on the `model` array and for each record
40
+ we yield the Tr/Td/Th elements _and_ the record itself as `data`
41
+ this means the consumer will *have to* use the `data` key to access it in their template
42
+ -------------------------------------------------------------------------------------------- }}
43
+ {{#each (sort-by this.getSortCriteria @model) key=this.identityKey as |record|}}
36
44
  {{yield
37
45
  (hash
38
46
  Tr=(component "hds/table/tr")
39
47
  Th=(component "hds/table/th" scope="row")
40
48
  Td=(component "hds/table/td" align=@align)
41
- data=data
49
+ data=record
42
50
  )
43
51
  to="body"
44
52
  }}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { action } from '@ember/object';
3
8
  import { tracked } from '@glimmer/tracking';
@@ -11,10 +16,61 @@ const DEFAULT_VALIGN = 'top';
11
16
  export default class HdsTableIndexComponent extends Component {
12
17
  @tracked sortBy = this.args.sortBy;
13
18
  @tracked sortOrder = this.args.sortOrder || 'asc';
14
- @tracked sortedMessageText = '';
15
19
 
20
+ /**
21
+ * @param getSortCriteria
22
+ * @type {string | function}
23
+ * @default sortBy:sortOrder
24
+ * @description Returns the sort criteria
25
+ */
16
26
  get getSortCriteria() {
17
- return `${this.sortBy}:${this.sortOrder}`;
27
+ // get the current column
28
+ const currentColumn = this.args?.columns?.find(
29
+ (column) => column.key === this.sortBy
30
+ );
31
+ if (
32
+ // check if there is a custom sorting function associated with the current `sortBy` column (we assume the column has `isSortable`)
33
+ currentColumn?.sortingFunction &&
34
+ typeof currentColumn.sortingFunction === 'function'
35
+ ) {
36
+ return currentColumn.sortingFunction;
37
+ } else {
38
+ // otherwise fallback to the default format "sortBy:sortOrder"
39
+ return `${this.sortBy}:${this.sortOrder}`;
40
+ }
41
+ }
42
+
43
+ /**
44
+ * @param identityKey
45
+ * @type {string}
46
+ * @default '@identity'
47
+ * @description Returns the key to use for the table rows to provide more granular control. If no identityKey is defined, Ember's default `@identity` is used. See https://api.emberjs.com/ember/release/classes/Ember.Templates.helpers/methods/each?anchor=each
48
+ * this would be relevant for any table that would have data that could update or change, i.e., polling.
49
+ */
50
+ get identityKey() {
51
+ // we have to provide a way for the consumer to pass undefined because Ember tries to interpret undefined as missing an arg and therefore falls back to the default
52
+ if (this.args.identityKey === 'none') {
53
+ return undefined;
54
+ } else {
55
+ return this.args.identityKey ?? '@identity';
56
+ }
57
+ }
58
+
59
+ /**
60
+ * @param sortedMessageText
61
+ * @type {string}
62
+ * @default ''
63
+ * @description Returns the text to display in the sorted message. If no text is defined, the default text is used.
64
+ */
65
+ get sortedMessageText() {
66
+ if (this.args.sortedMessageText) {
67
+ return this.args.sortedMessageText;
68
+ } else if (this.sortBy && this.sortOrder) {
69
+ // we should allow the user to define a custom value here (e.g., for i18n) - tracked with HDS-965
70
+ return `Sorted by ${this.sortBy} ${this.sortOrder}ending`;
71
+ } else {
72
+ return '';
73
+ }
18
74
  }
19
75
 
20
76
  /**
@@ -109,14 +165,13 @@ export default class HdsTableIndexComponent extends Component {
109
165
  @action
110
166
  setSortBy(column) {
111
167
  if (this.sortBy === column) {
112
- //invert the sort order
168
+ // check to see if the column is already sorted and invert the sort order if so
113
169
  this.sortOrder = this.sortOrder === 'asc' ? 'desc' : 'asc';
114
170
  } else {
171
+ // otherwise, set the sort order to ascending
115
172
  this.sortBy = column;
116
173
  this.sortOrder = 'asc';
117
174
  }
118
- // we should allow the user to define a custom value here (e.g., for i18n) - tracked with HDS-965
119
- this.sortedMessageText = `Sorted by ${this.sortBy} ${this.sortOrder}ending`;
120
175
 
121
176
  let { onSort } = this.args;
122
177
 
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <td class={{this.classNames}} ...attributes>
2
6
  {{yield}}
3
7
  </td>
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Copyright (c) HashiCorp, Inc.
3
+ * SPDX-License-Identifier: MPL-2.0
4
+ */
5
+
1
6
  import Component from '@glimmer/component';
2
7
  import { assert } from '@ember/debug';
3
8
 
@@ -1,3 +1,7 @@
1
+ {{!
2
+ Copyright (c) HashiCorp, Inc.
3
+ SPDX-License-Identifier: MPL-2.0
4
+ }}
1
5
  <th class={{this.classNames}} aria-sort={{this.ariaSort}} {{style width=@width}} ...attributes scope="col">
2
6
  <button type="button" {{on "click" this.onClick}}>
3
7
  <div class="hds-table__th-sort--button-content">