@hashicorp/design-system-components 4.15.0 → 4.16.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 (230) hide show
  1. package/declarations/components/hds/advanced-table/expandable-tr-group.d.ts +44 -0
  2. package/declarations/components/hds/advanced-table/expandable-tr-group.d.ts.map +1 -0
  3. package/declarations/components/hds/advanced-table/helpers.d.ts +11 -0
  4. package/declarations/components/hds/advanced-table/helpers.d.ts.map +1 -0
  5. package/declarations/components/hds/advanced-table/index.d.ts +84 -0
  6. package/declarations/components/hds/advanced-table/index.d.ts.map +1 -0
  7. package/declarations/components/hds/advanced-table/td.d.ts +36 -0
  8. package/declarations/components/hds/advanced-table/td.d.ts.map +1 -0
  9. package/declarations/components/hds/advanced-table/th-button-expand.d.ts +22 -0
  10. package/declarations/components/hds/advanced-table/th-button-expand.d.ts.map +1 -0
  11. package/declarations/components/hds/advanced-table/th-button-sort.d.ts +23 -0
  12. package/declarations/components/hds/advanced-table/th-button-sort.d.ts.map +1 -0
  13. package/declarations/components/hds/advanced-table/th-button-tooltip.d.ts +18 -0
  14. package/declarations/components/hds/advanced-table/th-button-tooltip.d.ts.map +1 -0
  15. package/declarations/components/hds/advanced-table/th-selectable.d.ts +36 -0
  16. package/declarations/components/hds/advanced-table/th-selectable.d.ts.map +1 -0
  17. package/declarations/components/hds/advanced-table/th-sort.d.ts +40 -0
  18. package/declarations/components/hds/advanced-table/th-sort.d.ts.map +1 -0
  19. package/declarations/components/hds/advanced-table/th.d.ts +49 -0
  20. package/declarations/components/hds/advanced-table/th.d.ts.map +1 -0
  21. package/declarations/components/hds/advanced-table/tr.d.ts +44 -0
  22. package/declarations/components/hds/advanced-table/tr.d.ts.map +1 -0
  23. package/declarations/components/hds/advanced-table/types.d.ts +85 -0
  24. package/declarations/components/hds/advanced-table/types.d.ts.map +1 -0
  25. package/declarations/components/hds/code-editor/description.d.ts +22 -0
  26. package/declarations/components/hds/code-editor/description.d.ts.map +1 -0
  27. package/declarations/components/hds/code-editor/full-screen-button.d.ts +18 -0
  28. package/declarations/components/hds/code-editor/full-screen-button.d.ts.map +1 -0
  29. package/declarations/components/hds/code-editor/generic.d.ts +13 -0
  30. package/declarations/components/hds/code-editor/generic.d.ts.map +1 -0
  31. package/declarations/components/hds/code-editor/index.d.ts +50 -0
  32. package/declarations/components/hds/code-editor/index.d.ts.map +1 -0
  33. package/declarations/components/hds/code-editor/title.d.ts +24 -0
  34. package/declarations/components/hds/code-editor/title.d.ts.map +1 -0
  35. package/declarations/components/hds/popover-primitive/index.d.ts.map +1 -1
  36. package/declarations/components/hds/rich-tooltip/toggle.d.ts.map +1 -1
  37. package/declarations/components/hds/stepper/task/indicator.d.ts +1 -1
  38. package/declarations/components/hds/stepper/task/indicator.d.ts.map +1 -1
  39. package/declarations/components/hds/table/th-selectable.d.ts.map +1 -1
  40. package/declarations/components/hds/tabs/tab.d.ts +7 -1
  41. package/declarations/components/hds/tabs/tab.d.ts.map +1 -1
  42. package/declarations/components.d.ts +15 -0
  43. package/declarations/components.d.ts.map +1 -1
  44. package/declarations/modifiers/hds-code-editor/highlight-styles/hds-dark-highlight-style.d.ts +8 -0
  45. package/declarations/modifiers/hds-code-editor/highlight-styles/hds-dark-highlight-style.d.ts.map +1 -0
  46. package/declarations/modifiers/hds-code-editor/languages/sentinel.d.ts +44 -0
  47. package/declarations/modifiers/hds-code-editor/languages/sentinel.d.ts.map +1 -0
  48. package/declarations/modifiers/hds-code-editor/palettes/hds-dark-palette.d.ts +21 -0
  49. package/declarations/modifiers/hds-code-editor/palettes/hds-dark-palette.d.ts.map +1 -0
  50. package/declarations/modifiers/hds-code-editor/themes/hds-dark-theme.d.ts +7 -0
  51. package/declarations/modifiers/hds-code-editor/themes/hds-dark-theme.d.ts.map +1 -0
  52. package/declarations/modifiers/hds-code-editor/types.d.ts +16 -0
  53. package/declarations/modifiers/hds-code-editor/types.d.ts.map +1 -0
  54. package/declarations/modifiers/hds-code-editor.d.ts +43 -0
  55. package/declarations/modifiers/hds-code-editor.d.ts.map +1 -0
  56. package/declarations/services/hds-time.d.ts +4 -0
  57. package/declarations/services/hds-time.d.ts.map +1 -1
  58. package/declarations/template-registry.d.ts +47 -0
  59. package/declarations/template-registry.d.ts.map +1 -1
  60. package/dist/_app_/components/hds/advanced-table/expandable-tr-group.js +1 -0
  61. package/dist/_app_/components/hds/advanced-table/helpers.js +1 -0
  62. package/dist/_app_/components/hds/advanced-table/index.js +1 -0
  63. package/dist/_app_/components/hds/advanced-table/td.js +1 -0
  64. package/dist/_app_/components/hds/advanced-table/th-button-expand.js +1 -0
  65. package/dist/_app_/components/hds/advanced-table/th-button-sort.js +1 -0
  66. package/dist/_app_/components/hds/advanced-table/th-button-tooltip.js +1 -0
  67. package/dist/_app_/components/hds/advanced-table/th-selectable.js +1 -0
  68. package/dist/_app_/components/hds/advanced-table/th-sort.js +1 -0
  69. package/dist/_app_/components/hds/advanced-table/th.js +1 -0
  70. package/dist/_app_/components/hds/advanced-table/tr.js +1 -0
  71. package/dist/_app_/components/hds/code-editor/description.js +1 -0
  72. package/dist/_app_/components/hds/code-editor/full-screen-button.js +1 -0
  73. package/dist/_app_/components/hds/code-editor/generic.js +1 -0
  74. package/dist/_app_/components/hds/code-editor/index.js +1 -0
  75. package/dist/_app_/components/hds/code-editor/title.js +1 -0
  76. package/dist/_app_/modifiers/hds-code-editor/highlight-styles/hds-dark-highlight-style.js +1 -0
  77. package/dist/_app_/modifiers/hds-code-editor/languages/sentinel.js +1 -0
  78. package/dist/_app_/modifiers/hds-code-editor/palettes/hds-dark-palette.js +1 -0
  79. package/dist/_app_/modifiers/hds-code-editor/themes/hds-dark-theme.js +1 -0
  80. package/dist/_app_/modifiers/hds-code-editor/types.js +1 -0
  81. package/dist/_app_/modifiers/hds-code-editor.js +1 -0
  82. package/dist/{_rollupPluginBabelHelpers-81503waH.js → _rollupPluginBabelHelpers-C_TsMG3M.js} +8 -8
  83. package/dist/_rollupPluginBabelHelpers-C_TsMG3M.js.map +1 -0
  84. package/dist/components/hds/accordion/item/button.js +1 -1
  85. package/dist/components/hds/accordion/item/index.js +1 -1
  86. package/dist/components/hds/advanced-table/expandable-tr-group.js +70 -0
  87. package/dist/components/hds/advanced-table/expandable-tr-group.js.map +1 -0
  88. package/dist/components/hds/advanced-table/helpers.js +144 -0
  89. package/dist/components/hds/advanced-table/helpers.js.map +1 -0
  90. package/dist/components/hds/advanced-table/index.js +312 -0
  91. package/dist/components/hds/advanced-table/index.js.map +1 -0
  92. package/dist/components/hds/advanced-table/td.js +95 -0
  93. package/dist/components/hds/advanced-table/td.js.map +1 -0
  94. package/dist/components/hds/advanced-table/th-button-expand.js +49 -0
  95. package/dist/components/hds/advanced-table/th-button-expand.js.map +1 -0
  96. package/dist/components/hds/advanced-table/th-button-sort.js +57 -0
  97. package/dist/components/hds/advanced-table/th-button-sort.js.map +1 -0
  98. package/dist/components/hds/advanced-table/th-button-tooltip.js +28 -0
  99. package/dist/components/hds/advanced-table/th-button-tooltip.js.map +1 -0
  100. package/dist/components/hds/advanced-table/th-selectable.js +92 -0
  101. package/dist/components/hds/advanced-table/th-selectable.js.map +1 -0
  102. package/dist/components/hds/advanced-table/th-sort.js +95 -0
  103. package/dist/components/hds/advanced-table/th-sort.js.map +1 -0
  104. package/dist/components/hds/advanced-table/th.js +112 -0
  105. package/dist/components/hds/advanced-table/th.js.map +1 -0
  106. package/dist/components/hds/advanced-table/tr.js +39 -0
  107. package/dist/components/hds/advanced-table/tr.js.map +1 -0
  108. package/dist/components/hds/advanced-table/types.js +54 -0
  109. package/dist/components/hds/advanced-table/types.js.map +1 -0
  110. package/dist/components/hds/alert/index.js +1 -1
  111. package/dist/components/hds/app-header/index.js +2 -2
  112. package/dist/components/hds/app-header/index.js.map +1 -1
  113. package/dist/components/hds/app-header/menu-button.js +1 -1
  114. package/dist/components/hds/app-side-nav/index.js +4 -4
  115. package/dist/components/hds/app-side-nav/index.js.map +1 -1
  116. package/dist/components/hds/app-side-nav/list/index.js +1 -1
  117. package/dist/components/hds/app-side-nav/list/title.js +1 -1
  118. package/dist/components/hds/app-side-nav/portal/target.js +1 -1
  119. package/dist/components/hds/code-block/index.js +1 -1
  120. package/dist/components/hds/code-editor/description.js +17 -0
  121. package/dist/components/hds/code-editor/description.js.map +1 -0
  122. package/dist/components/hds/code-editor/full-screen-button.js +26 -0
  123. package/dist/components/hds/code-editor/full-screen-button.js.map +1 -0
  124. package/dist/components/hds/code-editor/generic.js +16 -0
  125. package/dist/components/hds/code-editor/generic.js.map +1 -0
  126. package/dist/components/hds/code-editor/index.js +120 -0
  127. package/dist/components/hds/code-editor/index.js.map +1 -0
  128. package/dist/components/hds/code-editor/title.js +20 -0
  129. package/dist/components/hds/code-editor/title.js.map +1 -0
  130. package/dist/components/hds/copy/button/index.js +1 -1
  131. package/dist/components/hds/copy/snippet/index.js +1 -1
  132. package/dist/components/hds/disclosure-primitive/index.js +1 -1
  133. package/dist/components/hds/dropdown/index.js +1 -1
  134. package/dist/components/hds/dropdown/toggle/button.js +1 -1
  135. package/dist/components/hds/dropdown/toggle/icon.js +1 -1
  136. package/dist/components/hds/flyout/index.js +3 -3
  137. package/dist/components/hds/flyout/index.js.map +1 -1
  138. package/dist/components/hds/form/field/index.js +1 -1
  139. package/dist/components/hds/form/fieldset/index.js +1 -1
  140. package/dist/components/hds/form/masked-input/base.js +1 -1
  141. package/dist/components/hds/form/super-select/multiple/base.js +2 -2
  142. package/dist/components/hds/form/super-select/multiple/base.js.map +1 -1
  143. package/dist/components/hds/form/super-select/multiple/field.js +1 -1
  144. package/dist/components/hds/form/super-select/multiple/field.js.map +1 -1
  145. package/dist/components/hds/form/super-select/option-group.js +1 -1
  146. package/dist/components/hds/form/super-select/single/base.js +2 -2
  147. package/dist/components/hds/form/super-select/single/base.js.map +1 -1
  148. package/dist/components/hds/form/super-select/single/field.js +1 -1
  149. package/dist/components/hds/form/super-select/single/field.js.map +1 -1
  150. package/dist/components/hds/form/text-input/field.js +1 -1
  151. package/dist/components/hds/icon/index.js +1 -1
  152. package/dist/components/hds/interactive/index.js +1 -1
  153. package/dist/components/hds/menu-primitive/index.js +1 -1
  154. package/dist/components/hds/modal/index.js +3 -3
  155. package/dist/components/hds/modal/index.js.map +1 -1
  156. package/dist/components/hds/pagination/compact/index.js +1 -1
  157. package/dist/components/hds/pagination/nav/arrow.js +1 -1
  158. package/dist/components/hds/pagination/nav/number.js +1 -1
  159. package/dist/components/hds/pagination/numbered/index.js +1 -1
  160. package/dist/components/hds/pagination/numbered/index.js.map +1 -1
  161. package/dist/components/hds/pagination/size-selector/index.js +1 -1
  162. package/dist/components/hds/popover-primitive/index.js +15 -11
  163. package/dist/components/hds/popover-primitive/index.js.map +1 -1
  164. package/dist/components/hds/reveal/index.js +1 -1
  165. package/dist/components/hds/rich-tooltip/index.js +1 -1
  166. package/dist/components/hds/rich-tooltip/toggle.js +1 -1
  167. package/dist/components/hds/rich-tooltip/toggle.js.map +1 -1
  168. package/dist/components/hds/side-nav/index.js +3 -3
  169. package/dist/components/hds/side-nav/index.js.map +1 -1
  170. package/dist/components/hds/side-nav/list/index.js +1 -1
  171. package/dist/components/hds/side-nav/list/title.js +1 -1
  172. package/dist/components/hds/side-nav/portal/target.js +1 -1
  173. package/dist/components/hds/table/index.js +1 -1
  174. package/dist/components/hds/table/th-button-sort.js +1 -1
  175. package/dist/components/hds/table/th-button-tooltip.js +1 -1
  176. package/dist/components/hds/table/th-selectable.js +3 -8
  177. package/dist/components/hds/table/th-selectable.js.map +1 -1
  178. package/dist/components/hds/table/th-sort.js +1 -1
  179. package/dist/components/hds/table/th.js +1 -1
  180. package/dist/components/hds/tabs/index.js +2 -2
  181. package/dist/components/hds/tabs/index.js.map +1 -1
  182. package/dist/components/hds/tabs/panel.js +2 -2
  183. package/dist/components/hds/tabs/panel.js.map +1 -1
  184. package/dist/components/hds/tabs/tab.js +10 -2
  185. package/dist/components/hds/tabs/tab.js.map +1 -1
  186. package/dist/components/hds/time/index.js +1 -1
  187. package/dist/components/hds/time/range.js +1 -1
  188. package/dist/components.js +15 -0
  189. package/dist/components.js.map +1 -1
  190. package/dist/modifiers/hds-code-editor/highlight-styles/hds-dark-highlight-style.js +80 -0
  191. package/dist/modifiers/hds-code-editor/highlight-styles/hds-dark-highlight-style.js.map +1 -0
  192. package/dist/modifiers/hds-code-editor/languages/sentinel.js +143 -0
  193. package/dist/modifiers/hds-code-editor/languages/sentinel.js.map +1 -0
  194. package/dist/modifiers/hds-code-editor/palettes/hds-dark-palette.js +24 -0
  195. package/dist/modifiers/hds-code-editor/palettes/hds-dark-palette.js.map +1 -0
  196. package/dist/modifiers/hds-code-editor/themes/hds-dark-theme.js +62 -0
  197. package/dist/modifiers/hds-code-editor/themes/hds-dark-theme.js.map +1 -0
  198. package/dist/modifiers/hds-code-editor/types.js +19 -0
  199. package/dist/modifiers/hds-code-editor/types.js.map +1 -0
  200. package/dist/modifiers/hds-code-editor.js +266 -0
  201. package/dist/modifiers/hds-code-editor.js.map +1 -0
  202. package/dist/modifiers/hds-tooltip.js +1 -1
  203. package/dist/services/hds-time.js +1 -1
  204. package/dist/services/hds-time.js.map +1 -1
  205. package/dist/styles/@hashicorp/design-system-components.css +466 -62
  206. package/dist/styles/@hashicorp/design-system-components.scss +2 -0
  207. package/dist/styles/@hashicorp/design-system-power-select-overrides.scss +3 -3
  208. package/dist/styles/components/accordion.scss +1 -1
  209. package/dist/styles/components/advanced-table.scss +349 -0
  210. package/dist/styles/components/alert.scss +2 -2
  211. package/dist/styles/components/app-header.scss +1 -1
  212. package/dist/styles/components/badge.scss +1 -1
  213. package/dist/styles/components/breadcrumb.scss +2 -2
  214. package/dist/styles/components/card/container.scss +1 -1
  215. package/dist/styles/components/code-block/index.scss +1 -1
  216. package/dist/styles/components/code-editor/index.scss +113 -0
  217. package/dist/styles/components/code-editor/theme.scss +20 -0
  218. package/dist/styles/components/copy/snippet.scss +1 -1
  219. package/dist/styles/components/dropdown.scss +4 -3
  220. package/dist/styles/components/form/select.scss +1 -1
  221. package/dist/styles/components/icon-tile.scss +1 -1
  222. package/dist/styles/components/link/standalone.scss +1 -1
  223. package/dist/styles/components/modal.scss +1 -1
  224. package/dist/styles/components/rich-tooltip.scss +1 -1
  225. package/dist/styles/components/side-nav/a11y-refocus.scss +1 -1
  226. package/dist/styles/components/table.scss +10 -33
  227. package/dist/styles/mixins/_button.scss +3 -3
  228. package/dist/utils/hds-aria-described-by.js +1 -1
  229. package/package.json +80 -48
  230. package/dist/_rollupPluginBabelHelpers-81503waH.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sources":["../../../../../../src/components/hds/form/super-select/multiple/base.hbs","../../../../../../src/components/hds/form/super-select/multiple/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{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\\n <PowerSelectMultiple\\n @afterOptionsComponent={{if\\n this.showAfterOptions\\n (or\\n @afterOptionsComponent\\n (component\\n \\\"hds/form/super-select/after-options\\\"\\n content=@afterOptionsContent\\n resultCountMessage=this.resultCountMessage\\n showNoSelectedMessage=this._showNoSelectedMessage\\n showOnlySelected=this._showOnlySelected\\n showSelected=this.showSelected\\n showAll=this.showAll\\n clearSelected=this.clearSelected\\n selectedCount=this.selectedCount\\n )\\n )\\n }}\\n @ariaDescribedBy={{@ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{@ariaLabelledBy}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\\n @closeOnSelect={{false}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @extra={{@extra}}\\n @groupComponent={{component \\\"hds/form/super-select/option-group\\\"}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{this.setPowerSelectAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{this.searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{@triggerId}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n ...attributes\\n as |option select|\\n >\\n {{! even if technically what is yielded here are _a list_ of options, we\\'ve decided to keep the `option` name for consistency with the existing `PowerSelect` API }}\\n {{yield option select}}\\n </PowerSelectMultiple>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport anchoredPositionModifier from '../../../../../modifiers/hds-anchored-position.ts';\n\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\nimport {\n HdsFormSuperSelectHorizontalPositionValues,\n HdsFormSuperSelectHorizontalPositionToPlacementValues,\n} from '../types.ts';\n\nimport type { PowerSelectSignature } from 'ember-power-select/components/power-select';\nimport type { Select as PowerSelect } from 'ember-power-select/components/power-select';\nimport type { CalculatePositionResult } from 'ember-basic-dropdown/utils/calculate-position';\nimport type { HdsFormSuperSelectHorizontalPositions } from '../types.ts';\n\nexport const DEFAULT_HORIZONTAL_POSITION: string =\n HdsFormSuperSelectHorizontalPositionValues.Left;\nexport const HORIZONTAL_POSITION_MAPPING =\n HdsFormSuperSelectHorizontalPositionToPlacementValues;\n\nexport interface HdsFormSuperSelectMultipleBaseSignature {\n Args: PowerSelectSignature['Args'] & {\n showAfterOptions?: boolean;\n afterOptionsContent?: string;\n resultCountMessage?: string;\n dropdownMaxWidth?: string;\n matchTriggerWidth?: boolean;\n isInvalid?: boolean;\n };\n Blocks: PowerSelectSignature['Blocks'];\n Element: PowerSelectSignature['Element'];\n}\n\nexport default class HdsFormSuperSelectMultipleBase extends Component<HdsFormSuperSelectMultipleBaseSignature> {\n @tracked private _powerSelectAPI?: PowerSelect;\n @tracked private _showOnlySelected = false;\n @tracked private _showNoSelectedMessage = false;\n\n get horizontalPosition(): HdsFormSuperSelectHorizontalPositions {\n const { horizontalPosition = DEFAULT_HORIZONTAL_POSITION } = this.args;\n return horizontalPosition as HdsFormSuperSelectHorizontalPositions;\n }\n\n get selectedCount(): string {\n return this._powerSelectAPI?.selected?.length || '0';\n }\n\n get optionsCount(): string {\n return this._powerSelectAPI?.resultsCount.toString() || '0';\n }\n\n get resultCountMessage(): string {\n return (\n this.args.resultCountMessage ||\n `${this.selectedCount} selected of ${this.optionsCount} total`\n );\n }\n\n @action calculatePosition(\n trigger: Element,\n content: HTMLElement\n ): CalculatePositionResult {\n // use `hds-anchored-position` to calculate and set position\n // @ts-expect-error: known issue with type of invocation\n anchoredPositionModifier(content, [trigger], {\n placement: HORIZONTAL_POSITION_MAPPING[this.horizontalPosition],\n offsetOptions: 4,\n enableCollisionDetection: true,\n });\n // prevent PowerSelect from setting position\n return {\n horizontalPosition: 'auto',\n verticalPosition: 'auto',\n style: {},\n };\n }\n\n /**\n * This action sets the powerSelectAPI property and optionally calls a registerAPI function.\n *\n * @param {Object} powerSelectAPI - The API object for the PowerSelect component.\n *\n * If a `registerAPI` function is passed in through the component's arguments,\n * this function will be called with the `powerSelectAPI` as its argument.\n * This allows parent components or controllers to have access to the PowerSelect API.\n *\n * The `powerSelectAPI` is also stored on the component instance and used in `clearSelected`\n */\n @action\n setPowerSelectAPI(powerSelectAPI: PowerSelect): void {\n if (typeof this.args.registerAPI === 'function') {\n this.args.registerAPI(powerSelectAPI);\n }\n this._powerSelectAPI = powerSelectAPI;\n }\n\n @action showSelected(): void {\n this._showNoSelectedMessage = this.selectedCount === '0';\n this._showOnlySelected = true;\n }\n\n @action showAll(): void {\n this._showNoSelectedMessage = false;\n this._showOnlySelected = false;\n }\n\n @action clearSelected(): void {\n this._powerSelectAPI?.actions.select(null);\n // show all options after clearing all selection\n this._showNoSelectedMessage = false;\n this._showOnlySelected = false;\n }\n\n /**\n * Determine if `@afterOptionsComponent` gets displayed\n * @param showAfterOptions\n * @type {boolean}\n * @default true\n */\n get showAfterOptions(): boolean {\n return this.args.showAfterOptions ?? true;\n }\n\n // NOTE: The searchPlaceholder doesn't currently work for the multiple select\n /**\n * Get the search placeholder text\n * @param searchPlaceholder\n * @type {string}\n * @default 'Search'\n */\n get searchPlaceholder(): string {\n return this.args.searchPlaceholder ?? 'Search';\n }\n\n /**\n * Get the maxWidth to apply to the dropdown\n * @param dropdownMaxWidth\n * @type {string}\n * @default 'none'\n */\n get dropdownMaxWidthStyle(): Record<string, string> {\n const maxWidthStyle: { [key: string]: string } = {};\n if (this.args.dropdownMaxWidth) {\n maxWidthStyle['--hds-form-super-select-dropdown-max-width'] =\n this.args.dropdownMaxWidth;\n }\n return maxWidthStyle;\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-form-super-select', 'hds-form-super-select-multiple'];\n\n // add a class based on the @matchTriggerWidth argument or whether dropdownMaxWidth is set\n if (this.args.matchTriggerWidth === false || this.args.dropdownMaxWidth) {\n classes.push('hds-form-super-select--dropdown-content-auto-width');\n }\n\n // add a class based on the @isInvalid argument\n if (this.args.isInvalid) {\n classes.push(`hds-form-super-select--is-invalid`);\n }\n\n // add a class based on the showOnlySelected\n if (this._showOnlySelected) {\n classes.push(`hds-form-super-select--show-only-selected`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_HORIZONTAL_POSITION","HdsFormSuperSelectHorizontalPositionValues","Left","HORIZONTAL_POSITION_MAPPING","HdsFormSuperSelectHorizontalPositionToPlacementValues","HdsFormSuperSelectMultipleBase","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","horizontalPosition","selectedCount","_powerSelectAPI","selected","length","optionsCount","resultsCount","toString","resultCountMessage","calculatePosition","trigger","content","anchoredPositionModifier","placement","offsetOptions","enableCollisionDetection","verticalPosition","style","setPowerSelectAPI","powerSelectAPI","registerAPI","showSelected","_showNoSelectedMessage","_showOnlySelected","showAll","clearSelected","actions","select","showAfterOptions","searchPlaceholder","dropdownMaxWidthStyle","maxWidthStyle","dropdownMaxWidth","classNames","classes","matchTriggerWidth","push","isInvalid","join","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,k+FAAk+F;;;ACmBv/FA,MAAAA,2BAAmC,GAC9CC,0CAA0C,CAACC;AACtC,MAAMC,2BAA2B,GACtCC;AAemBC,IAAAA,8BAA8B,IAAAC,MAAA,GAApC,MAAMD,8BAA8B,SAASE,SAAS,CAA0C;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAA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,yBAAA,CAAA/C,MAAA,CAAAgD,SAAA,EAsB9CM,mBAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAxD,MAAA,CAAAgD,SAAA,EAAAhD,mBAAAA,CAAAA,EAAAA,MAAA,CAAAgD,SAAA,CAAA,EAAAD,yBAAA,CAAA/C,MAAA,CAAAgD,SAAA,EA8BNM,mBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAxD,MAAA,CAAAgD,SAAA,EAAAhD,mBAAAA,CAAAA,EAAAA,MAAA,CAAAgD,SAAA,CAAA,EAAAD,yBAAA,CAAA/C,MAAA,CAAAgD,SAAA,EAAA,cAAA,EAAA,CAQNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAxD,MAAA,CAAAgD,SAAA,EAAA,cAAA,CAAA,EAAAhD,MAAA,CAAAgD,SAAA,CAAAD,EAAAA,yBAAA,CAAA/C,MAAA,CAAAgD,SAAA,EAAA,SAAA,EAAA,CAKNM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAxD,MAAA,CAAAgD,SAAA,EAAA,SAAA,CAAA,EAAAhD,MAAA,CAAAgD,SAAA,GAAAD,yBAAA,CAAA/C,MAAA,CAAAgD,SAAA,EAKNM,eAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAxD,MAAA,CAAAgD,SAAA,oBAAAhD,MAAA,CAAAgD,SAAA,CAAA,EAAAhD,MAAA;AAzE0CyD,oBAAA,CAAAC,QAAA,EAA9B3D,8BAA8B,CAAA;;;;"}
1
+ {"version":3,"file":"base.js","sources":["../../../../../../src/components/hds/form/super-select/multiple/base.hbs","../../../../../../src/components/hds/form/super-select/multiple/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{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\\n <PowerSelectMultiple\\n @afterOptionsComponent={{if\\n this.showAfterOptions\\n (or\\n @afterOptionsComponent\\n (component\\n \\\"hds/form/super-select/after-options\\\"\\n content=@afterOptionsContent\\n resultCountMessage=this.resultCountMessage\\n showNoSelectedMessage=this._showNoSelectedMessage\\n showOnlySelected=this._showOnlySelected\\n showSelected=this.showSelected\\n showAll=this.showAll\\n clearSelected=this.clearSelected\\n selectedCount=this.selectedCount\\n )\\n )\\n }}\\n @ariaDescribedBy={{@ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{@ariaLabelledBy}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\\n @closeOnSelect={{false}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @extra={{@extra}}\\n @groupComponent={{component \\\"hds/form/super-select/option-group\\\"}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{this.setPowerSelectAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchFieldPosition=\\\"before-options\\\"\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{this.searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{@triggerId}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n ...attributes\\n as |option select|\\n >\\n {{! even if technically what is yielded here are _a list_ of options, we\\'ve decided to keep the `option` name for consistency with the existing `PowerSelect` API }}\\n {{yield option select}}\\n </PowerSelectMultiple>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport anchoredPositionModifier from '../../../../../modifiers/hds-anchored-position.ts';\n\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\nimport {\n HdsFormSuperSelectHorizontalPositionValues,\n HdsFormSuperSelectHorizontalPositionToPlacementValues,\n} from '../types.ts';\n\nimport type { PowerSelectSignature } from 'ember-power-select/components/power-select';\nimport type { Select as PowerSelect } from 'ember-power-select/components/power-select';\nimport type { CalculatePositionResult } from 'ember-basic-dropdown/utils/calculate-position';\nimport type { HdsFormSuperSelectHorizontalPositions } from '../types.ts';\n\nexport const DEFAULT_HORIZONTAL_POSITION: string =\n HdsFormSuperSelectHorizontalPositionValues.Left;\nexport const HORIZONTAL_POSITION_MAPPING =\n HdsFormSuperSelectHorizontalPositionToPlacementValues;\n\nexport interface HdsFormSuperSelectMultipleBaseSignature {\n Args: PowerSelectSignature['Args'] & {\n showAfterOptions?: boolean;\n afterOptionsContent?: string;\n resultCountMessage?: string;\n dropdownMaxWidth?: string;\n matchTriggerWidth?: boolean;\n isInvalid?: boolean;\n };\n Blocks: PowerSelectSignature['Blocks'];\n Element: PowerSelectSignature['Element'];\n}\n\nexport default class HdsFormSuperSelectMultipleBase extends Component<HdsFormSuperSelectMultipleBaseSignature> {\n @tracked private _powerSelectAPI?: PowerSelect;\n @tracked private _showOnlySelected = false;\n @tracked private _showNoSelectedMessage = false;\n\n get horizontalPosition(): HdsFormSuperSelectHorizontalPositions {\n const { horizontalPosition = DEFAULT_HORIZONTAL_POSITION } = this.args;\n return horizontalPosition as HdsFormSuperSelectHorizontalPositions;\n }\n\n get selectedCount(): string {\n return this._powerSelectAPI?.selected?.length || '0';\n }\n\n get optionsCount(): string {\n return this._powerSelectAPI?.resultsCount.toString() || '0';\n }\n\n get resultCountMessage(): string {\n return (\n this.args.resultCountMessage ||\n `${this.selectedCount} selected of ${this.optionsCount} total`\n );\n }\n\n @action calculatePosition(\n trigger: Element,\n content: HTMLElement\n ): CalculatePositionResult {\n // use `hds-anchored-position` to calculate and set position\n // @ts-expect-error: known issue with type of invocation\n anchoredPositionModifier(content, [trigger], {\n placement: HORIZONTAL_POSITION_MAPPING[this.horizontalPosition],\n offsetOptions: 4,\n enableCollisionDetection: true,\n });\n // prevent PowerSelect from setting position\n return {\n horizontalPosition: 'auto',\n verticalPosition: 'auto',\n style: {},\n };\n }\n\n /**\n * This action sets the powerSelectAPI property and optionally calls a registerAPI function.\n *\n * @param {Object} powerSelectAPI - The API object for the PowerSelect component.\n *\n * If a `registerAPI` function is passed in through the component's arguments,\n * this function will be called with the `powerSelectAPI` as its argument.\n * This allows parent components or controllers to have access to the PowerSelect API.\n *\n * The `powerSelectAPI` is also stored on the component instance and used in `clearSelected`\n */\n @action\n setPowerSelectAPI(powerSelectAPI: PowerSelect): void {\n if (typeof this.args.registerAPI === 'function') {\n this.args.registerAPI(powerSelectAPI);\n }\n this._powerSelectAPI = powerSelectAPI;\n }\n\n @action showSelected(): void {\n this._showNoSelectedMessage = this.selectedCount === '0';\n this._showOnlySelected = true;\n }\n\n @action showAll(): void {\n this._showNoSelectedMessage = false;\n this._showOnlySelected = false;\n }\n\n @action clearSelected(): void {\n this._powerSelectAPI?.actions.select(null);\n // show all options after clearing all selection\n this._showNoSelectedMessage = false;\n this._showOnlySelected = false;\n }\n\n /**\n * Determine if `@afterOptionsComponent` gets displayed\n * @param showAfterOptions\n * @type {boolean}\n * @default true\n */\n get showAfterOptions(): boolean {\n return this.args.showAfterOptions ?? true;\n }\n\n // NOTE: The searchPlaceholder doesn't currently work for the multiple select\n /**\n * Get the search placeholder text\n * @param searchPlaceholder\n * @type {string}\n * @default 'Search'\n */\n get searchPlaceholder(): string {\n return this.args.searchPlaceholder ?? 'Search';\n }\n\n /**\n * Get the maxWidth to apply to the dropdown\n * @param dropdownMaxWidth\n * @type {string}\n * @default 'none'\n */\n get dropdownMaxWidthStyle(): Record<string, string> {\n const maxWidthStyle: { [key: string]: string } = {};\n if (this.args.dropdownMaxWidth) {\n maxWidthStyle['--hds-form-super-select-dropdown-max-width'] =\n this.args.dropdownMaxWidth;\n }\n return maxWidthStyle;\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-form-super-select', 'hds-form-super-select-multiple'];\n\n // add a class based on the @matchTriggerWidth argument or whether dropdownMaxWidth is set\n if (this.args.matchTriggerWidth === false || this.args.dropdownMaxWidth) {\n classes.push('hds-form-super-select--dropdown-content-auto-width');\n }\n\n // add a class based on the @isInvalid argument\n if (this.args.isInvalid) {\n classes.push(`hds-form-super-select--is-invalid`);\n }\n\n // add a class based on the showOnlySelected\n if (this._showOnlySelected) {\n classes.push(`hds-form-super-select--show-only-selected`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_HORIZONTAL_POSITION","HdsFormSuperSelectHorizontalPositionValues","Left","HORIZONTAL_POSITION_MAPPING","HdsFormSuperSelectHorizontalPositionToPlacementValues","HdsFormSuperSelectMultipleBase","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","horizontalPosition","selectedCount","_powerSelectAPI","selected","length","optionsCount","resultsCount","toString","resultCountMessage","calculatePosition","trigger","content","anchoredPositionModifier","placement","offsetOptions","enableCollisionDetection","verticalPosition","style","setPowerSelectAPI","powerSelectAPI","registerAPI","showSelected","_showNoSelectedMessage","_showOnlySelected","showAll","clearSelected","actions","select","showAfterOptions","searchPlaceholder","dropdownMaxWidthStyle","maxWidthStyle","dropdownMaxWidth","classNames","classes","matchTriggerWidth","push","isInvalid","join","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,+gGAA+gG;;;ACmBpiGA,MAAAA,2BAAmC,GAC9CC,0CAA0C,CAACC;AACtC,MAAMC,2BAA2B,GACtCC;AAemBC,IAAAA,8BAA8B,IAAAC,MAAA,GAApC,MAAMD,8BAA8B,SAASE,SAAS,CAA0C;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;AAAAC,IAAAA,0BAAA,0BAAAC,WAAA,EAAA,IAAA,CAAA;AAAAD,IAAAA,0BAAA,4BAAAE,YAAA,EAAA,IAAA,CAAA;AAAAF,IAAAA,0BAAA,iCAAAG,YAAA,EAAA,IAAA,CAAA;AAAA;EAK7G,IAAIC,kBAAkBA,GAA0C;IAC9D,MAAM;AAAEA,MAAAA,kBAAkB,GAAGd;KAA6B,GAAG,IAAI,CAACS,IAAI;AACtE,IAAA,OAAOK,kBAAkB;AAC3B;EAEA,IAAIC,aAAaA,GAAW;IAC1B,OAAO,IAAI,CAACC,eAAe,EAAEC,QAAQ,EAAEC,MAAM,IAAI,GAAG;AACtD;EAEA,IAAIC,YAAYA,GAAW;IACzB,OAAO,IAAI,CAACH,eAAe,EAAEI,YAAY,CAACC,QAAQ,EAAE,IAAI,GAAG;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,SAAA,EAAA,cAAA,CAAA,EAAAhD,MAAA,CAAAgD,SAAA,CAAAD,EAAAA,yBAAA,CAAA/C,MAAA,CAAAgD,SAAA,EAAA,SAAA,EAAA,CAKNM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAxD,MAAA,CAAAgD,SAAA,EAAA,SAAA,CAAA,EAAAhD,MAAA,CAAAgD,SAAA,GAAAD,yBAAA,CAAA/C,MAAA,CAAAgD,SAAA,EAKNM,eAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAxD,MAAA,CAAAgD,SAAA,oBAAAhD,MAAA,CAAAgD,SAAA,CAAA,EAAAhD,MAAA;AAzE0CyD,oBAAA,CAAAC,QAAA,EAA9B3D,8BAA8B,CAAA;;;;"}
@@ -3,7 +3,7 @@ import { ID_PREFIX } from '../../label/index.js';
3
3
  import { precompileTemplate } from '@ember/template-compilation';
4
4
  import { setComponentTemplate } from '@ember/component';
5
5
 
6
- var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Form::Field\n @layout=\"vertical\"\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\n @isRequired={{@isRequired}}\n @isOptional={{@isOptional}}\n @id={{@id}}\n as |F|\n>\n {{! Notice: the order of the elements is not relevant here, because is controlled at \"Hds::Form::Field\" component level }}\n {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}\n <F.Control>\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\n <Hds::Form::SuperSelect::Multiple::Base\n @afterOptionsComponent={{@afterOptionsComponent}}\n @afterOptionsContent={{@afterOptionsContent}}\n @ariaDescribedBy={{F.ariaDescribedBy}}\n @ariaInvalid={{@ariaInvalid}}\n @ariaLabel={{@ariaLabel}}\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @disabled={{@disabled}}\n @dropdownClass={{@dropdownClass}}\n @dropdownMaxWidth={{@dropdownMaxWidth}}\n @extra={{@extra}}\n @groupComponent={{@groupComponent}}\n @horizontalPosition={{@horizontalPosition}}\n @initiallyOpened={{@initiallyOpened}}\n @labelText={{@labelText}}\n @loadingMessage={{@loadingMessage}}\n @matcher={{@matcher}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @noMatchesMessage={{@noMatchesMessage}}\n @onBlur={{@onBlur}}\n @onChange={{@onChange}}\n @onClose={{@onClose}}\n @onFocus={{@onFocus}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @onOpen={{@onOpen}}\n @options={{@options}}\n @optionsComponent={{@optionsComponent}}\n @placeholder={{@placeholder}}\n @placeholderComponent={{@placeholderComponent}}\n @preventScroll={{@preventScroll}}\n @registerAPI={{@registerAPI}}\n @renderInPlace={{true}}\n @resultCountMessage={{@resultCountMessage}}\n @scrollTo={{@scrollTo}}\n @search={{@search}}\n @searchEnabled={{@searchEnabled}}\n @searchField={{@searchField}}\n @searchMessage={{@searchMessage}}\n @searchPlaceholder={{@searchPlaceholder}}\n @selected={{@selected}}\n @selectedItemComponent={{@selectedItemComponent}}\n @showAfterOptions={{@showAfterOptions}}\n @tabindex={{@tabindex}}\n @triggerClass={{@triggerClass}}\n @triggerComponent={{@triggerComponent}}\n @triggerId={{F.id}}\n @triggerRole={{@triggerRole}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @verticalPosition={{@verticalPosition}}\n @isInvalid={{@isInvalid}}\n ...attributes\n as |options select|\n >\n {{yield (hash options=options select=select Options=(component \"hds/yield\" options=options select=select))}}\n </Hds::Form::SuperSelect::Multiple::Base>\n </F.Control>\n</Hds::Form::Field>");
6
+ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Form::Field\n @layout=\"vertical\"\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\n @isRequired={{@isRequired}}\n @isOptional={{@isOptional}}\n @id={{@id}}\n as |F|\n>\n {{! Notice: the order of the elements is not relevant here, because is controlled at \"Hds::Form::Field\" component level }}\n {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}\n <F.Control>\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\n <Hds::Form::SuperSelect::Multiple::Base\n @afterOptionsComponent={{@afterOptionsComponent}}\n @afterOptionsContent={{@afterOptionsContent}}\n @ariaDescribedBy={{F.ariaDescribedBy}}\n @ariaInvalid={{@ariaInvalid}}\n @ariaLabel={{@ariaLabel}}\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @disabled={{@disabled}}\n @dropdownClass={{@dropdownClass}}\n @dropdownMaxWidth={{@dropdownMaxWidth}}\n @extra={{@extra}}\n @groupComponent={{@groupComponent}}\n @horizontalPosition={{@horizontalPosition}}\n @initiallyOpened={{@initiallyOpened}}\n @labelText={{@labelText}}\n @loadingMessage={{@loadingMessage}}\n @matcher={{@matcher}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @noMatchesMessage={{@noMatchesMessage}}\n @onBlur={{@onBlur}}\n @onChange={{@onChange}}\n @onClose={{@onClose}}\n @onFocus={{@onFocus}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @onOpen={{@onOpen}}\n @options={{@options}}\n @optionsComponent={{@optionsComponent}}\n @placeholder={{@placeholder}}\n @placeholderComponent={{@placeholderComponent}}\n @preventScroll={{@preventScroll}}\n @registerAPI={{@registerAPI}}\n @renderInPlace={{true}}\n @resultCountMessage={{@resultCountMessage}}\n @scrollTo={{@scrollTo}}\n @search={{@search}}\n @searchEnabled={{@searchEnabled}}\n @searchField={{@searchField}}\n @searchFieldPosition=\"before-options\"\n @searchMessage={{@searchMessage}}\n @searchPlaceholder={{@searchPlaceholder}}\n @selected={{@selected}}\n @selectedItemComponent={{@selectedItemComponent}}\n @showAfterOptions={{@showAfterOptions}}\n @tabindex={{@tabindex}}\n @triggerClass={{@triggerClass}}\n @triggerComponent={{@triggerComponent}}\n @triggerId={{F.id}}\n @triggerRole={{@triggerRole}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @verticalPosition={{@verticalPosition}}\n @isInvalid={{@isInvalid}}\n ...attributes\n as |options select|\n >\n {{yield (hash options=options select=select Options=(component \"hds/yield\" options=options select=select))}}\n </Hds::Form::SuperSelect::Multiple::Base>\n </F.Control>\n</Hds::Form::Field>");
7
7
 
8
8
  /**
9
9
  * Copyright (c) HashiCorp, Inc.
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","sources":["../../../../../../src/components/hds/form/super-select/multiple/field.hbs","../../../../../../src/components/hds/form/super-select/multiple/field.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}\\n <F.Control>\\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\\n <Hds::Form::SuperSelect::Multiple::Base\\n @afterOptionsComponent={{@afterOptionsComponent}}\\n @afterOptionsContent={{@afterOptionsContent}}\\n @ariaDescribedBy={{F.ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @dropdownMaxWidth={{@dropdownMaxWidth}}\\n @extra={{@extra}}\\n @groupComponent={{@groupComponent}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{@matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{@searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @showAfterOptions={{@showAfterOptions}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{F.id}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n @isInvalid={{@isInvalid}}\\n ...attributes\\n as |options select|\\n >\\n {{yield (hash options=options select=select Options=(component \\\"hds/yield\\\" options=options select=select))}}\\n </Hds::Form::SuperSelect::Multiple::Base>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { ID_PREFIX } from '../../label/index.ts';\n\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsFormErrorSignature } from '../../error/index.ts';\nimport type { HdsFormFieldSignature } from '../../field/index.ts';\nimport type { HdsFormHelperTextSignature } from '../../helper-text/index.ts';\nimport type { HdsFormLabelSignature } from '../../label';\nimport type { HdsFormSuperSelectMultipleBaseSignature } from './base.ts';\nimport type { Select as PowerSelect } from 'ember-power-select/components/power-select';\nimport type { HdsYieldSignature } from '../../../yield/index.ts';\n\nexport interface HdsFormSuperSelectMultipleFieldSignature {\n Args: HdsFormSuperSelectMultipleBaseSignature['Args'] &\n HdsFormFieldSignature['Args'];\n Blocks: {\n default: [\n {\n Label?: ComponentLike<HdsFormLabelSignature>;\n HelperText?: ComponentLike<HdsFormHelperTextSignature>;\n Error?: ComponentLike<HdsFormErrorSignature>;\n Options?: ComponentLike<HdsYieldSignature>;\n options?: unknown;\n select?: PowerSelect;\n },\n ];\n };\n Element: HdsFormFieldSignature['Element'];\n}\n\nexport default class HdsFormSuperSelectMultipleField extends Component<HdsFormSuperSelectMultipleFieldSignature> {\n get idPrefix(): string {\n return ID_PREFIX;\n }\n}\n"],"names":["HdsFormSuperSelectMultipleField","Component","idPrefix","ID_PREFIX","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,k2FAAk2F;;ACDp4F;AACA;AACA;AACA;;AAgCe,MAAMA,+BAA+B,SAASC,SAAS,CAA2C;EAC/G,IAAIC,QAAQA,GAAW;AACrB,IAAA,OAAOC,SAAS;AAClB;AACF;AAACC,oBAAA,CAAAC,QAAA,EAJoBL,+BAA+B,CAAA;;;;"}
1
+ {"version":3,"file":"field.js","sources":["../../../../../../src/components/hds/form/super-select/multiple/field.hbs","../../../../../../src/components/hds/form/super-select/multiple/field.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}\\n <F.Control>\\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\\n <Hds::Form::SuperSelect::Multiple::Base\\n @afterOptionsComponent={{@afterOptionsComponent}}\\n @afterOptionsContent={{@afterOptionsContent}}\\n @ariaDescribedBy={{F.ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @dropdownMaxWidth={{@dropdownMaxWidth}}\\n @extra={{@extra}}\\n @groupComponent={{@groupComponent}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{@matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchFieldPosition=\\\"before-options\\\"\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{@searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @showAfterOptions={{@showAfterOptions}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{F.id}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n @isInvalid={{@isInvalid}}\\n ...attributes\\n as |options select|\\n >\\n {{yield (hash options=options select=select Options=(component \\\"hds/yield\\\" options=options select=select))}}\\n </Hds::Form::SuperSelect::Multiple::Base>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { ID_PREFIX } from '../../label/index.ts';\n\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsFormErrorSignature } from '../../error/index.ts';\nimport type { HdsFormFieldSignature } from '../../field/index.ts';\nimport type { HdsFormHelperTextSignature } from '../../helper-text/index.ts';\nimport type { HdsFormLabelSignature } from '../../label';\nimport type { HdsFormSuperSelectMultipleBaseSignature } from './base.ts';\nimport type { Select as PowerSelect } from 'ember-power-select/components/power-select';\nimport type { HdsYieldSignature } from '../../../yield/index.ts';\n\nexport interface HdsFormSuperSelectMultipleFieldSignature {\n Args: HdsFormSuperSelectMultipleBaseSignature['Args'] &\n HdsFormFieldSignature['Args'];\n Blocks: {\n default: [\n {\n Label?: ComponentLike<HdsFormLabelSignature>;\n HelperText?: ComponentLike<HdsFormHelperTextSignature>;\n Error?: ComponentLike<HdsFormErrorSignature>;\n Options?: ComponentLike<HdsYieldSignature>;\n options?: unknown;\n select?: PowerSelect;\n },\n ];\n };\n Element: HdsFormFieldSignature['Element'];\n}\n\nexport default class HdsFormSuperSelectMultipleField extends Component<HdsFormSuperSelectMultipleFieldSignature> {\n get idPrefix(): string {\n return ID_PREFIX;\n }\n}\n"],"names":["HdsFormSuperSelectMultipleField","Component","idPrefix","ID_PREFIX","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,i5FAAi5F;;ACDn7F;AACA;AACA;AACA;;AAgCe,MAAMA,+BAA+B,SAASC,SAAS,CAA2C;EAC/G,IAAIC,QAAQA,GAAW;AACrB,IAAA,OAAOC,SAAS;AAClB;AACF;AAACC,oBAAA,CAAAC,QAAA,EAJoBL,+BAA+B,CAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import { a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { guidFor } from '@ember/object/internals';
4
4
  import { precompileTemplate } from '@ember/template-compilation';
@@ -1,4 +1,4 @@
1
- import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import anchoredPositionModifier from '../../../../../modifiers/hds-anchored-position.js';
4
4
  import { action } from '@ember/object';
@@ -7,7 +7,7 @@ import { HdsFormSuperSelectHorizontalPositionValues, HdsFormSuperSelectHorizonta
7
7
  import { precompileTemplate } from '@ember/template-compilation';
8
8
  import { setComponentTemplate } from '@ember/component';
9
9
 
10
- var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\n <PowerSelect\n @afterOptionsComponent={{if\n this.showAfterOptions\n (or\n @afterOptionsComponent\n (component\n \"hds/form/super-select/after-options\" content=@afterOptionsContent resultCountMessage=this.resultCountMessage\n )\n )\n }}\n @ariaDescribedBy={{@ariaDescribedBy}}\n @ariaInvalid={{@ariaInvalid}}\n @ariaLabel={{@ariaLabel}}\n @ariaLabelledBy={{@ariaLabelledBy}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\n @closeOnSelect={{@closeOnSelect}}\n @disabled={{@disabled}}\n @dropdownClass={{@dropdownClass}}\n @extra={{@extra}}\n @groupComponent={{component \"hds/form/super-select/option-group\"}}\n @horizontalPosition={{@horizontalPosition}}\n @initiallyOpened={{@initiallyOpened}}\n @labelText={{@labelText}}\n @loadingMessage={{@loadingMessage}}\n @matcher={{@matcher}}\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\n @noMatchesMessage={{@noMatchesMessage}}\n @onBlur={{@onBlur}}\n @onChange={{@onChange}}\n @onClose={{@onClose}}\n @onFocus={{@onFocus}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @onOpen={{@onOpen}}\n @options={{@options}}\n @optionsComponent={{@optionsComponent}}\n @placeholder={{@placeholder}}\n @placeholderComponent={{component \"hds/form/super-select/placeholder\"}}\n @preventScroll={{@preventScroll}}\n @registerAPI={{this.setPowerSelectAPI}}\n @renderInPlace={{true}}\n @resultCountMessage={{@resultCountMessage}}\n @scrollTo={{@scrollTo}}\n @search={{@search}}\n @searchEnabled={{@searchEnabled}}\n @searchField={{@searchField}}\n @searchMessage={{@searchMessage}}\n @searchPlaceholder={{this.searchPlaceholder}}\n @selected={{@selected}}\n @selectedItemComponent={{@selectedItemComponent}}\n @tabindex={{@tabindex}}\n @triggerClass={{@triggerClass}}\n @triggerComponent={{@triggerComponent}}\n @triggerId={{@triggerId}}\n @triggerRole={{@triggerRole}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @verticalPosition={{@verticalPosition}}\n ...attributes\n as |option select|\n >\n <Hds::Text::Body>{{yield option select}}</Hds::Text::Body>\n </PowerSelect>\n</div>");
10
+ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\n <PowerSelect\n @afterOptionsComponent={{if\n this.showAfterOptions\n (or\n @afterOptionsComponent\n (component\n \"hds/form/super-select/after-options\" content=@afterOptionsContent resultCountMessage=this.resultCountMessage\n )\n )\n }}\n @ariaDescribedBy={{@ariaDescribedBy}}\n @ariaInvalid={{@ariaInvalid}}\n @ariaLabel={{@ariaLabel}}\n @ariaLabelledBy={{@ariaLabelledBy}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\n @closeOnSelect={{@closeOnSelect}}\n @disabled={{@disabled}}\n @dropdownClass={{@dropdownClass}}\n @extra={{@extra}}\n @groupComponent={{component \"hds/form/super-select/option-group\"}}\n @horizontalPosition={{@horizontalPosition}}\n @initiallyOpened={{@initiallyOpened}}\n @labelText={{@labelText}}\n @loadingMessage={{@loadingMessage}}\n @matcher={{@matcher}}\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\n @noMatchesMessage={{@noMatchesMessage}}\n @onBlur={{@onBlur}}\n @onChange={{@onChange}}\n @onClose={{@onClose}}\n @onFocus={{@onFocus}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @onOpen={{@onOpen}}\n @options={{@options}}\n @optionsComponent={{@optionsComponent}}\n @placeholder={{@placeholder}}\n @placeholderComponent={{component \"hds/form/super-select/placeholder\"}}\n @preventScroll={{@preventScroll}}\n @registerAPI={{this.setPowerSelectAPI}}\n @renderInPlace={{true}}\n @resultCountMessage={{@resultCountMessage}}\n @scrollTo={{@scrollTo}}\n @search={{@search}}\n @searchEnabled={{@searchEnabled}}\n @searchField={{@searchField}}\n @searchFieldPosition=\"before-options\"\n @searchMessage={{@searchMessage}}\n @searchPlaceholder={{this.searchPlaceholder}}\n @selected={{@selected}}\n @selectedItemComponent={{@selectedItemComponent}}\n @tabindex={{@tabindex}}\n @triggerClass={{@triggerClass}}\n @triggerComponent={{@triggerComponent}}\n @triggerId={{@triggerId}}\n @triggerRole={{@triggerRole}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @verticalPosition={{@verticalPosition}}\n ...attributes\n as |option select|\n >\n <Hds::Text::Body>{{yield option select}}</Hds::Text::Body>\n </PowerSelect>\n</div>");
11
11
 
12
12
  var _class, _descriptor;
13
13
  const DEFAULT_HORIZONTAL_POSITION = HdsFormSuperSelectHorizontalPositionValues.Left;
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sources":["../../../../../../src/components/hds/form/super-select/single/base.hbs","../../../../../../src/components/hds/form/super-select/single/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{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\\n <PowerSelect\\n @afterOptionsComponent={{if\\n this.showAfterOptions\\n (or\\n @afterOptionsComponent\\n (component\\n \\\"hds/form/super-select/after-options\\\" content=@afterOptionsContent resultCountMessage=this.resultCountMessage\\n )\\n )\\n }}\\n @ariaDescribedBy={{@ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{@ariaLabelledBy}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\\n @closeOnSelect={{@closeOnSelect}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @extra={{@extra}}\\n @groupComponent={{component \\\"hds/form/super-select/option-group\\\"}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{component \\\"hds/form/super-select/placeholder\\\"}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{this.setPowerSelectAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{this.searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{@triggerId}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n ...attributes\\n as |option select|\\n >\\n <Hds::Text::Body>{{yield option select}}</Hds::Text::Body>\\n </PowerSelect>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport anchoredPositionModifier from '../../../../../modifiers/hds-anchored-position.ts';\n\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\nimport {\n HdsFormSuperSelectHorizontalPositionValues,\n HdsFormSuperSelectHorizontalPositionToPlacementValues,\n} from '../types.ts';\n\nimport type { PowerSelectSignature } from 'ember-power-select/components/power-select';\nimport type { Select as PowerSelect } from 'ember-power-select/components/power-select';\nimport type { CalculatePositionResult } from 'ember-basic-dropdown/utils/calculate-position';\nimport type { HdsFormSuperSelectHorizontalPositions } from '../types.ts';\n\nexport const DEFAULT_HORIZONTAL_POSITION: string =\n HdsFormSuperSelectHorizontalPositionValues.Left;\nexport const HORIZONTAL_POSITION_MAPPING =\n HdsFormSuperSelectHorizontalPositionToPlacementValues;\n\nexport interface HdsFormSuperSelectSingleBaseSignature {\n Args: PowerSelectSignature['Args'] & {\n showAfterOptions?: boolean;\n afterOptionsContent?: string;\n resultCountMessage?: string;\n dropdownMaxWidth?: string;\n matchTriggerWidth?: boolean;\n isInvalid?: boolean;\n };\n Blocks: PowerSelectSignature['Blocks'];\n Element: PowerSelectSignature['Element'];\n}\n\nexport default class HdsFormSuperSelectSingleBase extends Component<HdsFormSuperSelectSingleBaseSignature> {\n @tracked powerSelectAPI?: PowerSelect;\n\n get horizontalPosition(): HdsFormSuperSelectHorizontalPositions {\n const { horizontalPosition = DEFAULT_HORIZONTAL_POSITION } = this.args;\n return horizontalPosition as HdsFormSuperSelectHorizontalPositions;\n }\n\n get resultCountMessage(): string {\n return `${this.powerSelectAPI?.resultsCount || 0} total`;\n }\n\n /**\n * This action sets the powerSelectAPI property and optionally calls a registerAPI function.\n *\n * @param {Object} powerSelectAPI - The API object for the PowerSelect component.\n *\n * If a `registerAPI` function is passed in through the component's arguments,\n * this function will be called with the `powerSelectAPI` as its argument.\n * This allows parent components or controllers to have access to the PowerSelect API.\n *\n * The `powerSelectAPI` is also stored on the component instance and used in `clearSelected`\n */\n @action\n setPowerSelectAPI(powerSelectAPI: PowerSelect): void {\n if (typeof this.args.registerAPI === 'function') {\n this.args.registerAPI(powerSelectAPI);\n }\n this.powerSelectAPI = powerSelectAPI;\n }\n\n @action calculatePosition(\n trigger: Element,\n content: HTMLElement\n ): CalculatePositionResult {\n // use `hds-anchored-position` to calculate and set position\n // @ts-expect-error: known issue with type of invocation\n anchoredPositionModifier(content, [trigger], {\n placement: HORIZONTAL_POSITION_MAPPING[this.horizontalPosition],\n offsetOptions: 4,\n enableCollisionDetection: true,\n });\n // prevent PowerSelect from setting position\n return {\n horizontalPosition: 'auto',\n verticalPosition: 'auto',\n style: {},\n };\n }\n\n /**\n * Determine if `@afterOptionsComponent` gets displayed\n * @param showAfterOptions\n * @type {boolean}\n * @default false\n */\n get showAfterOptions(): boolean | string {\n return this.args.showAfterOptions ?? this.args.afterOptionsContent ?? false;\n }\n\n /**\n * Get the search placeholder text\n * @param searchPlaceholder\n * @type {string}\n * @default 'Search'\n */\n get searchPlaceholder(): string {\n return this.args.searchPlaceholder ?? 'Search';\n }\n\n /**\n * Get the maxWidth to apply to the dropdown\n * @param dropdownMaxWidth\n * @type {string}\n * @default 'none'\n */\n get dropdownMaxWidthStyle(): Record<string, string> {\n const maxWidthStyle: { [key: string]: string } = {};\n if (this.args.dropdownMaxWidth) {\n maxWidthStyle['--hds-form-super-select-dropdown-max-width'] =\n this.args.dropdownMaxWidth;\n }\n return maxWidthStyle;\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-form-super-select', 'hds-form-super-select-single'];\n\n // add a class based on the @matchTriggerWidth argument or whether dropdownMaxWidth is set\n if (this.args.matchTriggerWidth === false || this.args.dropdownMaxWidth) {\n classes.push('hds-form-super-select--dropdown-content-auto-width');\n }\n\n // add a class based on the @isInvalid argument\n if (this.args.isInvalid) {\n classes.push(`hds-form-super-select--is-invalid`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_HORIZONTAL_POSITION","HdsFormSuperSelectHorizontalPositionValues","Left","HORIZONTAL_POSITION_MAPPING","HdsFormSuperSelectHorizontalPositionToPlacementValues","HdsFormSuperSelectSingleBase","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","horizontalPosition","resultCountMessage","powerSelectAPI","resultsCount","setPowerSelectAPI","registerAPI","calculatePosition","trigger","content","anchoredPositionModifier","placement","offsetOptions","enableCollisionDetection","verticalPosition","style","showAfterOptions","afterOptionsContent","searchPlaceholder","dropdownMaxWidthStyle","maxWidthStyle","dropdownMaxWidth","classNames","classes","matchTriggerWidth","push","isInvalid","join","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,qkFAAqkF;;;ACmB1lFA,MAAAA,2BAAmC,GAC9CC,0CAA0C,CAACC;AACtC,MAAMC,2BAA2B,GACtCC;AAemBC,IAAAA,4BAA4B,IAAAC,MAAA,GAAlC,MAAMD,4BAA4B,SAASE,SAAS,CAAwC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;AAAAC,IAAAA,0BAAA,yBAAAC,WAAA,EAAA,IAAA,CAAA;AAAA;EAGzG,IAAIC,kBAAkBA,GAA0C;IAC9D,MAAM;AAAEA,MAAAA,kBAAkB,GAAGZ;KAA6B,GAAG,IAAI,CAACS,IAAI;AACtE,IAAA,OAAOG,kBAAkB;AAC3B;EAEA,IAAIC,kBAAkBA,GAAW;IAC/B,OAAO,CAAA,EAAG,IAAI,CAACC,cAAc,EAAEC,YAAY,IAAI,CAAC,CAAQ,MAAA,CAAA;AAC1D;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,iBAAiBA,CAACF,cAA2B,EAAQ;IACnD,IAAI,OAAO,IAAI,CAACL,IAAI,CAACQ,WAAW,KAAK,UAAU,EAAE;AAC/C,MAAA,IAAI,CAACR,IAAI,CAACQ,WAAW,CAACH,cAAc,CAAC;AACvC;IACA,IAAI,CAACA,cAAc,GAAGA,cAAc;AACtC;AAEQI,EAAAA,iBAAiBA,CACvBC,OAAgB,EAChBC,OAAoB,EACK;AACzB;AACA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I,IAAI,CAAC3B,IAAI,CAAC4B,SAAS,EAAE;AACvBH,MAAAA,OAAO,CAACE,IAAI,CAAC,CAAA,iCAAA,CAAmC,CAAC;AACnD;AAEA,IAAA,OAAOF,OAAO,CAACI,IAAI,CAAC,GAAG,CAAC;AAC1B;AACF,CAAC,EAAA3B,WAAA,GAAA4B,yBAAA,CAAAjC,MAAA,CAAAkC,SAAA,EAAA,gBAAA,EAAA,CAxGEC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,EAAAN,yBAAA,CAAAjC,MAAA,CAAAkC,SAAA,EAAA,mBAAA,EAAA,CAsBPM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAA1C,MAAA,CAAAkC,SAAA,EAAAlC,mBAAAA,CAAAA,EAAAA,MAAA,CAAAkC,SAAA,CAAA,EAAAD,yBAAA,CAAAjC,MAAA,CAAAkC,SAAA,wBAQNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAA1C,MAAA,CAAAkC,SAAA,EAAA,mBAAA,CAAA,EAAAlC,MAAA,CAAAkC,SAAA,GAAAlC,MAAA;AA/BwC2C,oBAAA,CAAAC,QAAA,EAA5B7C,4BAA4B,CAAA;;;;"}
1
+ {"version":3,"file":"base.js","sources":["../../../../../../src/components/hds/form/super-select/single/base.hbs","../../../../../../src/components/hds/form/super-select/single/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{{! Important: if an argument is added in base.hbs, it must also be added/processed in the Base component used in field.hbs }}\\n<div class={{this.classNames}} {{style this.dropdownMaxWidthStyle}}>\\n <PowerSelect\\n @afterOptionsComponent={{if\\n this.showAfterOptions\\n (or\\n @afterOptionsComponent\\n (component\\n \\\"hds/form/super-select/after-options\\\" content=@afterOptionsContent resultCountMessage=this.resultCountMessage\\n )\\n )\\n }}\\n @ariaDescribedBy={{@ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{@ariaLabelledBy}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @calculatePosition={{if @verticalPosition undefined this.calculatePosition}}\\n @closeOnSelect={{@closeOnSelect}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @extra={{@extra}}\\n @groupComponent={{component \\\"hds/form/super-select/option-group\\\"}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{if @dropdownMaxWidth false @matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{component \\\"hds/form/super-select/placeholder\\\"}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{this.setPowerSelectAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchFieldPosition=\\\"before-options\\\"\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{this.searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{@triggerId}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n ...attributes\\n as |option select|\\n >\\n <Hds::Text::Body>{{yield option select}}</Hds::Text::Body>\\n </PowerSelect>\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport anchoredPositionModifier from '../../../../../modifiers/hds-anchored-position.ts';\n\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\nimport {\n HdsFormSuperSelectHorizontalPositionValues,\n HdsFormSuperSelectHorizontalPositionToPlacementValues,\n} from '../types.ts';\n\nimport type { PowerSelectSignature } from 'ember-power-select/components/power-select';\nimport type { Select as PowerSelect } from 'ember-power-select/components/power-select';\nimport type { CalculatePositionResult } from 'ember-basic-dropdown/utils/calculate-position';\nimport type { HdsFormSuperSelectHorizontalPositions } from '../types.ts';\n\nexport const DEFAULT_HORIZONTAL_POSITION: string =\n HdsFormSuperSelectHorizontalPositionValues.Left;\nexport const HORIZONTAL_POSITION_MAPPING =\n HdsFormSuperSelectHorizontalPositionToPlacementValues;\n\nexport interface HdsFormSuperSelectSingleBaseSignature {\n Args: PowerSelectSignature['Args'] & {\n showAfterOptions?: boolean;\n afterOptionsContent?: string;\n resultCountMessage?: string;\n dropdownMaxWidth?: string;\n matchTriggerWidth?: boolean;\n isInvalid?: boolean;\n };\n Blocks: PowerSelectSignature['Blocks'];\n Element: PowerSelectSignature['Element'];\n}\n\nexport default class HdsFormSuperSelectSingleBase extends Component<HdsFormSuperSelectSingleBaseSignature> {\n @tracked powerSelectAPI?: PowerSelect;\n\n get horizontalPosition(): HdsFormSuperSelectHorizontalPositions {\n const { horizontalPosition = DEFAULT_HORIZONTAL_POSITION } = this.args;\n return horizontalPosition as HdsFormSuperSelectHorizontalPositions;\n }\n\n get resultCountMessage(): string {\n return `${this.powerSelectAPI?.resultsCount || 0} total`;\n }\n\n /**\n * This action sets the powerSelectAPI property and optionally calls a registerAPI function.\n *\n * @param {Object} powerSelectAPI - The API object for the PowerSelect component.\n *\n * If a `registerAPI` function is passed in through the component's arguments,\n * this function will be called with the `powerSelectAPI` as its argument.\n * This allows parent components or controllers to have access to the PowerSelect API.\n *\n * The `powerSelectAPI` is also stored on the component instance and used in `clearSelected`\n */\n @action\n setPowerSelectAPI(powerSelectAPI: PowerSelect): void {\n if (typeof this.args.registerAPI === 'function') {\n this.args.registerAPI(powerSelectAPI);\n }\n this.powerSelectAPI = powerSelectAPI;\n }\n\n @action calculatePosition(\n trigger: Element,\n content: HTMLElement\n ): CalculatePositionResult {\n // use `hds-anchored-position` to calculate and set position\n // @ts-expect-error: known issue with type of invocation\n anchoredPositionModifier(content, [trigger], {\n placement: HORIZONTAL_POSITION_MAPPING[this.horizontalPosition],\n offsetOptions: 4,\n enableCollisionDetection: true,\n });\n // prevent PowerSelect from setting position\n return {\n horizontalPosition: 'auto',\n verticalPosition: 'auto',\n style: {},\n };\n }\n\n /**\n * Determine if `@afterOptionsComponent` gets displayed\n * @param showAfterOptions\n * @type {boolean}\n * @default false\n */\n get showAfterOptions(): boolean | string {\n return this.args.showAfterOptions ?? this.args.afterOptionsContent ?? false;\n }\n\n /**\n * Get the search placeholder text\n * @param searchPlaceholder\n * @type {string}\n * @default 'Search'\n */\n get searchPlaceholder(): string {\n return this.args.searchPlaceholder ?? 'Search';\n }\n\n /**\n * Get the maxWidth to apply to the dropdown\n * @param dropdownMaxWidth\n * @type {string}\n * @default 'none'\n */\n get dropdownMaxWidthStyle(): Record<string, string> {\n const maxWidthStyle: { [key: string]: string } = {};\n if (this.args.dropdownMaxWidth) {\n maxWidthStyle['--hds-form-super-select-dropdown-max-width'] =\n this.args.dropdownMaxWidth;\n }\n return maxWidthStyle;\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-form-super-select', 'hds-form-super-select-single'];\n\n // add a class based on the @matchTriggerWidth argument or whether dropdownMaxWidth is set\n if (this.args.matchTriggerWidth === false || this.args.dropdownMaxWidth) {\n classes.push('hds-form-super-select--dropdown-content-auto-width');\n }\n\n // add a class based on the @isInvalid argument\n if (this.args.isInvalid) {\n classes.push(`hds-form-super-select--is-invalid`);\n }\n\n return classes.join(' ');\n }\n}\n"],"names":["DEFAULT_HORIZONTAL_POSITION","HdsFormSuperSelectHorizontalPositionValues","Left","HORIZONTAL_POSITION_MAPPING","HdsFormSuperSelectHorizontalPositionToPlacementValues","HdsFormSuperSelectSingleBase","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","horizontalPosition","resultCountMessage","powerSelectAPI","resultsCount","setPowerSelectAPI","registerAPI","calculatePosition","trigger","content","anchoredPositionModifier","placement","offsetOptions","enableCollisionDetection","verticalPosition","style","showAfterOptions","afterOptionsContent","searchPlaceholder","dropdownMaxWidthStyle","maxWidthStyle","dropdownMaxWidth","classNames","classes","matchTriggerWidth","push","isInvalid","join","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,knFAAknF;;;ACmBvoFA,MAAAA,2BAAmC,GAC9CC,0CAA0C,CAACC;AACtC,MAAMC,2BAA2B,GACtCC;AAemBC,IAAAA,4BAA4B,IAAAC,MAAA,GAAlC,MAAMD,4BAA4B,SAASE,SAAS,CAAwC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;AAAAC,IAAAA,0BAAA,yBAAAC,WAAA,EAAA,IAAA,CAAA;AAAA;EAGzG,IAAIC,kBAAkBA,GAA0C;IAC9D,MAAM;AAAEA,MAAAA,kBAAkB,GAAGZ;KAA6B,GAAG,IAAI,CAACS,IAAI;AACtE,IAAA,OAAOG,kBAAkB;AAC3B;EAEA,IAAIC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AAA;AA/BwC2C,oBAAA,CAAAC,QAAA,EAA5B7C,4BAA4B,CAAA;;;;"}
@@ -3,7 +3,7 @@ import { ID_PREFIX } from '../../label/index.js';
3
3
  import { precompileTemplate } from '@ember/template-compilation';
4
4
  import { setComponentTemplate } from '@ember/component';
5
5
 
6
- var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Form::Field\n @layout=\"vertical\"\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\n @isRequired={{@isRequired}}\n @isOptional={{@isOptional}}\n @id={{@id}}\n as |F|\n>\n {{! Notice: the order of the elements is not relevant here, because is controlled at \"Hds::Form::Field\" component level }}\n {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}\n <F.Control>\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\n <Hds::Form::SuperSelect::Single::Base\n @afterOptionsComponent={{@afterOptionsComponent}}\n @afterOptionsContent={{@afterOptionsContent}}\n @ariaDescribedBy={{F.ariaDescribedBy}}\n @ariaInvalid={{@ariaInvalid}}\n @ariaLabel={{@ariaLabel}}\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @closeOnSelect={{@closeOnSelect}}\n @disabled={{@disabled}}\n @dropdownClass={{@dropdownClass}}\n @dropdownMaxWidth={{@dropdownMaxWidth}}\n @extra={{@extra}}\n @groupComponent={{@groupComponent}}\n @horizontalPosition={{@horizontalPosition}}\n @initiallyOpened={{@initiallyOpened}}\n @labelText={{@labelText}}\n @loadingMessage={{@loadingMessage}}\n @matcher={{@matcher}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @noMatchesMessage={{@noMatchesMessage}}\n @onBlur={{@onBlur}}\n @onChange={{@onChange}}\n @onClose={{@onClose}}\n @onFocus={{@onFocus}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @onOpen={{@onOpen}}\n @options={{@options}}\n @optionsComponent={{@optionsComponent}}\n @placeholder={{@placeholder}}\n @placeholderComponent={{@placeholderComponent}}\n @preventScroll={{@preventScroll}}\n @registerAPI={{@registerAPI}}\n @renderInPlace={{true}}\n @resultCountMessage={{@resultCountMessage}}\n @scrollTo={{@scrollTo}}\n @search={{@search}}\n @searchEnabled={{@searchEnabled}}\n @searchField={{@searchField}}\n @searchMessage={{@searchMessage}}\n @searchPlaceholder={{@searchPlaceholder}}\n @selected={{@selected}}\n @selectedItemComponent={{@selectedItemComponent}}\n @showAfterOptions={{@showAfterOptions}}\n @tabindex={{@tabindex}}\n @triggerClass={{@triggerClass}}\n @triggerComponent={{@triggerComponent}}\n @triggerId={{F.id}}\n @triggerRole={{@triggerRole}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @verticalPosition={{@verticalPosition}}\n @isInvalid={{@isInvalid}}\n ...attributes\n as |options select|\n >\n {{yield (hash options=options select=select Options=(component \"hds/yield\" options=options select=select))}}\n </Hds::Form::SuperSelect::Single::Base>\n </F.Control>\n</Hds::Form::Field>");
6
+ var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::Form::Field\n @layout=\"vertical\"\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\n @isRequired={{@isRequired}}\n @isOptional={{@isOptional}}\n @id={{@id}}\n as |F|\n>\n {{! Notice: the order of the elements is not relevant here, because is controlled at \"Hds::Form::Field\" component level }}\n {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}\n <F.Control>\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\n <Hds::Form::SuperSelect::Single::Base\n @afterOptionsComponent={{@afterOptionsComponent}}\n @afterOptionsContent={{@afterOptionsContent}}\n @ariaDescribedBy={{F.ariaDescribedBy}}\n @ariaInvalid={{@ariaInvalid}}\n @ariaLabel={{@ariaLabel}}\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @closeOnSelect={{@closeOnSelect}}\n @disabled={{@disabled}}\n @dropdownClass={{@dropdownClass}}\n @dropdownMaxWidth={{@dropdownMaxWidth}}\n @extra={{@extra}}\n @groupComponent={{@groupComponent}}\n @horizontalPosition={{@horizontalPosition}}\n @initiallyOpened={{@initiallyOpened}}\n @labelText={{@labelText}}\n @loadingMessage={{@loadingMessage}}\n @matcher={{@matcher}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @noMatchesMessage={{@noMatchesMessage}}\n @onBlur={{@onBlur}}\n @onChange={{@onChange}}\n @onClose={{@onClose}}\n @onFocus={{@onFocus}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @onOpen={{@onOpen}}\n @options={{@options}}\n @optionsComponent={{@optionsComponent}}\n @placeholder={{@placeholder}}\n @placeholderComponent={{@placeholderComponent}}\n @preventScroll={{@preventScroll}}\n @registerAPI={{@registerAPI}}\n @renderInPlace={{true}}\n @resultCountMessage={{@resultCountMessage}}\n @scrollTo={{@scrollTo}}\n @search={{@search}}\n @searchEnabled={{@searchEnabled}}\n @searchField={{@searchField}}\n @searchFieldPosition=\"before-options\"\n @searchMessage={{@searchMessage}}\n @searchPlaceholder={{@searchPlaceholder}}\n @selected={{@selected}}\n @selectedItemComponent={{@selectedItemComponent}}\n @showAfterOptions={{@showAfterOptions}}\n @tabindex={{@tabindex}}\n @triggerClass={{@triggerClass}}\n @triggerComponent={{@triggerComponent}}\n @triggerId={{F.id}}\n @triggerRole={{@triggerRole}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @verticalPosition={{@verticalPosition}}\n @isInvalid={{@isInvalid}}\n ...attributes\n as |options select|\n >\n {{yield (hash options=options select=select Options=(component \"hds/yield\" options=options select=select))}}\n </Hds::Form::SuperSelect::Single::Base>\n </F.Control>\n</Hds::Form::Field>");
7
7
 
8
8
  /**
9
9
  * Copyright (c) HashiCorp, Inc.
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","sources":["../../../../../../src/components/hds/form/super-select/single/field.hbs","../../../../../../src/components/hds/form/super-select/single/field.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}\\n <F.Control>\\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\\n <Hds::Form::SuperSelect::Single::Base\\n @afterOptionsComponent={{@afterOptionsComponent}}\\n @afterOptionsContent={{@afterOptionsContent}}\\n @ariaDescribedBy={{F.ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @closeOnSelect={{@closeOnSelect}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @dropdownMaxWidth={{@dropdownMaxWidth}}\\n @extra={{@extra}}\\n @groupComponent={{@groupComponent}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{@matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{@searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @showAfterOptions={{@showAfterOptions}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{F.id}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n @isInvalid={{@isInvalid}}\\n ...attributes\\n as |options select|\\n >\\n {{yield (hash options=options select=select Options=(component \\\"hds/yield\\\" options=options select=select))}}\\n </Hds::Form::SuperSelect::Single::Base>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { ID_PREFIX } from '../../label/index.ts';\n\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsFormErrorSignature } from '../../error/index.ts';\nimport type { HdsFormFieldSignature } from '../../field/index.ts';\nimport type { HdsFormHelperTextSignature } from '../../helper-text/index.ts';\nimport type { HdsFormLabelSignature } from '../../label';\nimport type { HdsFormSuperSelectSingleBaseSignature } from './base.ts';\nimport type { Select as PowerSelect } from 'ember-power-select/components/power-select';\nimport type { HdsYieldSignature } from '../../../yield/index.ts';\n\nexport interface HdsFormSuperSelectSingleFieldSignature {\n Args: HdsFormSuperSelectSingleBaseSignature['Args'] &\n HdsFormFieldSignature['Args'];\n Blocks: {\n default: [\n {\n Label?: ComponentLike<HdsFormLabelSignature>;\n HelperText?: ComponentLike<HdsFormHelperTextSignature>;\n Error?: ComponentLike<HdsFormErrorSignature>;\n Options?: ComponentLike<HdsYieldSignature>;\n options?: unknown;\n select?: PowerSelect;\n },\n ];\n };\n Element: HdsFormFieldSignature['Element'];\n}\n\nexport default class HdsFormSuperSelectSingleField extends Component<HdsFormSuperSelectSingleFieldSignature> {\n get idPrefix(): string {\n return ID_PREFIX;\n }\n}\n"],"names":["HdsFormSuperSelectSingleField","Component","idPrefix","ID_PREFIX","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,u4FAAu4F;;ACDz6F;AACA;AACA;AACA;;AAgCe,MAAMA,6BAA6B,SAASC,SAAS,CAAyC;EAC3G,IAAIC,QAAQA,GAAW;AACrB,IAAA,OAAOC,SAAS;AAClB;AACF;AAACC,oBAAA,CAAAC,QAAA,EAJoBL,6BAA6B,CAAA;;;;"}
1
+ {"version":3,"file":"field.js","sources":["../../../../../../src/components/hds/form/super-select/single/field.hbs","../../../../../../src/components/hds/form/super-select/single/field.ts"],"sourcesContent":["import { precompileTemplate } from \"@ember/template-compilation\";\nexport default precompileTemplate(\"{{!\\n Copyright (c) HashiCorp, Inc.\\n SPDX-License-Identifier: MPL-2.0\\n}}\\n<Hds::Form::Field\\n @layout=\\\"vertical\\\"\\n @extraAriaDescribedBy={{@extraAriaDescribedBy}}\\n @isRequired={{@isRequired}}\\n @isOptional={{@isOptional}}\\n @id={{@id}}\\n as |F|\\n>\\n {{! Notice: the order of the elements is not relevant here, because is controlled at \\\"Hds::Form::Field\\\" component level }}\\n {{yield (hash Label=F.Label HelperText=F.HelperText Error=F.Error)}}\\n <F.Control>\\n {{! Important: if an argument is added in base.hbs, it must also be added/processed here }}\\n <Hds::Form::SuperSelect::Single::Base\\n @afterOptionsComponent={{@afterOptionsComponent}}\\n @afterOptionsContent={{@afterOptionsContent}}\\n @ariaDescribedBy={{F.ariaDescribedBy}}\\n @ariaInvalid={{@ariaInvalid}}\\n @ariaLabel={{@ariaLabel}}\\n @ariaLabelledBy={{(concat this.idPrefix F.id)}}\\n @beforeOptionsComponent={{@beforeOptionsComponent}}\\n @closeOnSelect={{@closeOnSelect}}\\n @disabled={{@disabled}}\\n @dropdownClass={{@dropdownClass}}\\n @dropdownMaxWidth={{@dropdownMaxWidth}}\\n @extra={{@extra}}\\n @groupComponent={{@groupComponent}}\\n @horizontalPosition={{@horizontalPosition}}\\n @initiallyOpened={{@initiallyOpened}}\\n @labelText={{@labelText}}\\n @loadingMessage={{@loadingMessage}}\\n @matcher={{@matcher}}\\n @matchTriggerWidth={{@matchTriggerWidth}}\\n @noMatchesMessage={{@noMatchesMessage}}\\n @onBlur={{@onBlur}}\\n @onChange={{@onChange}}\\n @onClose={{@onClose}}\\n @onFocus={{@onFocus}}\\n @onInput={{@onInput}}\\n @onKeydown={{@onKeydown}}\\n @onOpen={{@onOpen}}\\n @options={{@options}}\\n @optionsComponent={{@optionsComponent}}\\n @placeholder={{@placeholder}}\\n @placeholderComponent={{@placeholderComponent}}\\n @preventScroll={{@preventScroll}}\\n @registerAPI={{@registerAPI}}\\n @renderInPlace={{true}}\\n @resultCountMessage={{@resultCountMessage}}\\n @scrollTo={{@scrollTo}}\\n @search={{@search}}\\n @searchEnabled={{@searchEnabled}}\\n @searchField={{@searchField}}\\n @searchFieldPosition=\\\"before-options\\\"\\n @searchMessage={{@searchMessage}}\\n @searchPlaceholder={{@searchPlaceholder}}\\n @selected={{@selected}}\\n @selectedItemComponent={{@selectedItemComponent}}\\n @showAfterOptions={{@showAfterOptions}}\\n @tabindex={{@tabindex}}\\n @triggerClass={{@triggerClass}}\\n @triggerComponent={{@triggerComponent}}\\n @triggerId={{F.id}}\\n @triggerRole={{@triggerRole}}\\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\\n @verticalPosition={{@verticalPosition}}\\n @isInvalid={{@isInvalid}}\\n ...attributes\\n as |options select|\\n >\\n {{yield (hash options=options select=select Options=(component \\\"hds/yield\\\" options=options select=select))}}\\n </Hds::Form::SuperSelect::Single::Base>\\n </F.Control>\\n</Hds::Form::Field>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { ID_PREFIX } from '../../label/index.ts';\n\nimport type { ComponentLike } from '@glint/template';\nimport type { HdsFormErrorSignature } from '../../error/index.ts';\nimport type { HdsFormFieldSignature } from '../../field/index.ts';\nimport type { HdsFormHelperTextSignature } from '../../helper-text/index.ts';\nimport type { HdsFormLabelSignature } from '../../label';\nimport type { HdsFormSuperSelectSingleBaseSignature } from './base.ts';\nimport type { Select as PowerSelect } from 'ember-power-select/components/power-select';\nimport type { HdsYieldSignature } from '../../../yield/index.ts';\n\nexport interface HdsFormSuperSelectSingleFieldSignature {\n Args: HdsFormSuperSelectSingleBaseSignature['Args'] &\n HdsFormFieldSignature['Args'];\n Blocks: {\n default: [\n {\n Label?: ComponentLike<HdsFormLabelSignature>;\n HelperText?: ComponentLike<HdsFormHelperTextSignature>;\n Error?: ComponentLike<HdsFormErrorSignature>;\n Options?: ComponentLike<HdsYieldSignature>;\n options?: unknown;\n select?: PowerSelect;\n },\n ];\n };\n Element: HdsFormFieldSignature['Element'];\n}\n\nexport default class HdsFormSuperSelectSingleField extends Component<HdsFormSuperSelectSingleFieldSignature> {\n get idPrefix(): string {\n return ID_PREFIX;\n }\n}\n"],"names":["HdsFormSuperSelectSingleField","Component","idPrefix","ID_PREFIX","setComponentTemplate","TEMPLATE"],"mappings":";;;;;AACA,eAAe,kBAAkB,CAAC,s7FAAs7F;;ACDx9F;AACA;AACA;AACA;;AAgCe,MAAMA,6BAA6B,SAASC,SAAS,CAAyC;EAC3G,IAAIC,QAAQA,GAAW;AACrB,IAAA,OAAOC,SAAS;AAClB;AACF;AAACC,oBAAA,CAAAC,QAAA,EAJoBL,6BAA6B,CAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { tracked } from '@glimmer/tracking';
4
4
  import { action } from '@ember/object';
@@ -1,4 +1,4 @@
1
- import { a as _defineProperty } from '../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { a as _defineProperty } from '../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { guidFor } from '@ember/object/internals';
4
4
  import { assert } from '@ember/debug';
@@ -1,4 +1,4 @@
1
- import { _ as _applyDecoratedDescriptor } from '../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { _ as _applyDecoratedDescriptor } from '../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { action } from '@ember/object';
4
4
  import { precompileTemplate } from '@ember/template-compilation';
@@ -1,4 +1,4 @@
1
- import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { deprecate } from '@ember/debug';
4
4
  import { tracked } from '@glimmer/tracking';
@@ -1,4 +1,4 @@
1
- import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { tracked } from '@glimmer/tracking';
4
4
  import { action } from '@ember/object';
@@ -24,8 +24,8 @@ let HdsModal = (_class = class HdsModal extends Component {
24
24
  constructor(...args) {
25
25
  super(...args);
26
26
  _initializerDefineProperty(this, "_isOpen", _descriptor, this);
27
- _defineProperty(this, "_element", void 0);
28
- _defineProperty(this, "_body", void 0);
27
+ _defineProperty(this, "_element", undefined);
28
+ _defineProperty(this, "_body", undefined);
29
29
  _defineProperty(this, "_bodyInitialOverflowValue", '');
30
30
  }
31
31
  get isDismissDisabled() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/hds/modal/index.hbs","../../../../src/components/hds/modal/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\\\"\\n id=this.id\\n onDismiss=this.onDismiss\\n contextualClassPrefix=\\\"hds-modal\\\"\\n titleTag=\\\"h1\\\"\\n )\\n )\\n }}\\n </:header>\\n <:body>\\n {{yield (hash Body=(component \\\"hds/dialog-primitive/body\\\" contextualClass=\\\"hds-modal__body\\\"))}}\\n </:body>\\n <:footer>\\n {{yield\\n (hash\\n Footer=(component \\\"hds/dialog-primitive/footer\\\" onDismiss=this.onDismiss contextualClass=\\\"hds-modal__footer\\\")\\n )\\n }}\\n </:footer>\\n</Hds::DialogPrimitive::Wrapper>\\n\\n{{#if this._isOpen}}\\n <Hds::DialogPrimitive::Overlay @contextualClass=\\\"hds-modal__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';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { HdsModalSizes, HdsModalColors } from './types.ts';\n\nimport HdsDialogPrimitiveHeaderComponent from '../dialog-primitive/header.ts';\nimport HdsDialogPrimitiveBodyComponent from '../dialog-primitive/body.ts';\nimport HdsDialogPrimitiveFooterComponent from '../dialog-primitive/footer.ts';\nimport { HdsModalSizeValues, HdsModalColorValues } from './types.ts';\n\nconst waiter = buildWaiter('@hashicorp/design-system-components:modal');\n\nexport const DEFAULT_SIZE = HdsModalSizeValues.Medium;\nexport const DEFAULT_COLOR = HdsModalColorValues.Neutral;\n\nexport const SIZES: string[] = Object.values(HdsModalSizeValues);\nexport const COLORS: string[] = Object.values(HdsModalColorValues);\n\nexport interface HdsModalSignature {\n Args: {\n isDismissDisabled?: boolean;\n size?: HdsModalSizes;\n color?: HdsModalColors;\n returnFocusTo?: string;\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 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 HdsModal extends Component<HdsModalSignature> {\n @tracked private _isOpen = false;\n private _element!: HTMLDialogElement;\n private _body!: HTMLElement;\n private _bodyInitialOverflowValue = '';\n\n get isDismissDisabled(): boolean {\n return this.args.isDismissDisabled ?? false;\n }\n\n get size(): HdsModalSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Modal\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n get color(): HdsModalColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Modal\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n get id(): string {\n return getElementId(this);\n }\n\n get classNames(): string {\n const classes = ['hds-modal'];\n\n // add a class based on the @size argument\n classes.push(`hds-modal--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-modal--color-${this.color}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback(event: Event): void {\n if (\n !this.isDismissDisabled &&\n this.args.onClose &&\n typeof this.args.onClose === 'function'\n ) {\n this.args.onClose(event);\n }\n\n // If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed\n if (this.isDismissDisabled) {\n // If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail\n // so we add this safeguard condition that checks for the `<dialog>` to have a parent\n if (this._element.parentElement) {\n // As there is no way to `preventDefault` on `close` events, we call the `showModal` function\n // preserving the state of the modal dialog\n this._element.showModal();\n }\n } else {\n this._isOpen = false;\n }\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 modal 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 modal 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 modal 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(\n 'overflow',\n this._bodyInitialOverflowValue\n );\n }\n }\n\n // Return focus to a specific element (if provided)\n if (this.args.returnFocusTo) {\n const initiator = document.getElementById(this.args.returnFocusTo);\n if (initiator) {\n initiator.focus();\n }\n }\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","HdsModalSizeValues","Medium","DEFAULT_COLOR","HdsModalColorValues","Neutral","SIZES","Object","values","COLORS","HdsModal","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_defineProperty","isDismissDisabled","size","assert","join","includes","color","id","getElementId","classNames","classes","push","registerOnCloseCallback","event","onClose","_element","parentElement","showModal","_isOpen","didInsert","element","_body","document","body","_bodyInitialOverflowValue","style","getPropertyValue","addEventListener","open","willDestroyNode","removeEventListener","setProperty","onOpen","onDismiss","token","beginAsync","listener","endAsync","close","removeProperty","length","removeAttribute","returnFocusTo","initiator","getElementById","focus","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,wsCAAwsC;;;AC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SAAA,CAAA,EAAAD,yBAAA,CAAApD,MAAA,CAAAqD,SAAA,EAuBNM,WAAAA,EAAAA,CAAAA,MAAM,GAAA/D,MAAA,CAAAgE,wBAAA,CAAA5D,MAAA,CAAAqD,SAAA,EAAArD,WAAAA,CAAAA,EAAAA,MAAA,CAAAqD,SAAA,CAAA,EAAAD,yBAAA,CAAApD,MAAA,CAAAqD,SAAA,EAAA,iBAAA,EAAA,CAqBNM,MAAM,CAAA,EAAA/D,MAAA,CAAAgE,wBAAA,CAAA5D,MAAA,CAAAqD,SAAA,EAAA,iBAAA,CAAA,EAAArD,MAAA,CAAAqD,SAAA,CAAAD,EAAAA,yBAAA,CAAApD,MAAA,CAAAqD,SAAA,EAAA,MAAA,EAAA,CAWNM,MAAM,CAAA/D,EAAAA,MAAA,CAAAgE,wBAAA,CAAA5D,MAAA,CAAAqD,SAAA,EAAA,MAAA,CAAA,EAAArD,MAAA,CAAAqD,SAAA,GAAAD,yBAAA,CAAApD,MAAA,CAAAqD,SAAA,EAeNM,WAAAA,EAAAA,CAAAA,MAAM,CAAA/D,EAAAA,MAAA,CAAAgE,wBAAA,CAAA5D,MAAA,CAAAqD,SAAA,gBAAArD,MAAA,CAAAqD,SAAA,CAAA,EAAArD,MAAA;AA1HoB6D,oBAAA,CAAAC,QAAA,EAAR/D,QAAQ,CAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/hds/modal/index.hbs","../../../../src/components/hds/modal/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\\\"\\n id=this.id\\n onDismiss=this.onDismiss\\n contextualClassPrefix=\\\"hds-modal\\\"\\n titleTag=\\\"h1\\\"\\n )\\n )\\n }}\\n </:header>\\n <:body>\\n {{yield (hash Body=(component \\\"hds/dialog-primitive/body\\\" contextualClass=\\\"hds-modal__body\\\"))}}\\n </:body>\\n <:footer>\\n {{yield\\n (hash\\n Footer=(component \\\"hds/dialog-primitive/footer\\\" onDismiss=this.onDismiss contextualClass=\\\"hds-modal__footer\\\")\\n )\\n }}\\n </:footer>\\n</Hds::DialogPrimitive::Wrapper>\\n\\n{{#if this._isOpen}}\\n <Hds::DialogPrimitive::Overlay @contextualClass=\\\"hds-modal__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';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { HdsModalSizes, HdsModalColors } from './types.ts';\n\nimport HdsDialogPrimitiveHeaderComponent from '../dialog-primitive/header.ts';\nimport HdsDialogPrimitiveBodyComponent from '../dialog-primitive/body.ts';\nimport HdsDialogPrimitiveFooterComponent from '../dialog-primitive/footer.ts';\nimport { HdsModalSizeValues, HdsModalColorValues } from './types.ts';\n\nconst waiter = buildWaiter('@hashicorp/design-system-components:modal');\n\nexport const DEFAULT_SIZE = HdsModalSizeValues.Medium;\nexport const DEFAULT_COLOR = HdsModalColorValues.Neutral;\n\nexport const SIZES: string[] = Object.values(HdsModalSizeValues);\nexport const COLORS: string[] = Object.values(HdsModalColorValues);\n\nexport interface HdsModalSignature {\n Args: {\n isDismissDisabled?: boolean;\n size?: HdsModalSizes;\n color?: HdsModalColors;\n returnFocusTo?: string;\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 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 HdsModal extends Component<HdsModalSignature> {\n @tracked private _isOpen = false;\n private _element!: HTMLDialogElement;\n private _body!: HTMLElement;\n private _bodyInitialOverflowValue = '';\n\n get isDismissDisabled(): boolean {\n return this.args.isDismissDisabled ?? false;\n }\n\n get size(): HdsModalSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Modal\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n get color(): HdsModalColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Modal\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n get id(): string {\n return getElementId(this);\n }\n\n get classNames(): string {\n const classes = ['hds-modal'];\n\n // add a class based on the @size argument\n classes.push(`hds-modal--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-modal--color-${this.color}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback(event: Event): void {\n if (\n !this.isDismissDisabled &&\n this.args.onClose &&\n typeof this.args.onClose === 'function'\n ) {\n this.args.onClose(event);\n }\n\n // If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed\n if (this.isDismissDisabled) {\n // If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail\n // so we add this safeguard condition that checks for the `<dialog>` to have a parent\n if (this._element.parentElement) {\n // As there is no way to `preventDefault` on `close` events, we call the `showModal` function\n // preserving the state of the modal dialog\n this._element.showModal();\n }\n } else {\n this._isOpen = false;\n }\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 modal 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 modal 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 modal 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(\n 'overflow',\n this._bodyInitialOverflowValue\n );\n }\n }\n\n // Return focus to a specific element (if provided)\n if (this.args.returnFocusTo) {\n const initiator = document.getElementById(this.args.returnFocusTo);\n if (initiator) {\n initiator.focus();\n }\n }\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","HdsModalSizeValues","Medium","DEFAULT_COLOR","HdsModalColorValues","Neutral","SIZES","Object","values","COLORS","HdsModal","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","_defineProperty","isDismissDisabled","size","assert","join","includes","color","id","getElementId","classNames","classes","push","registerOnCloseCallback","event","onClose","_element","parentElement","showModal","_isOpen","didInsert","element","_body","document","body","_bodyInitialOverflowValue","style","getPropertyValue","addEventListener","open","willDestroyNode","removeEventListener","setProperty","onOpen","onDismiss","token","beginAsync","listener","endAsync","close","removeProperty","length","removeAttribute","returnFocusTo","initiator","getElementById","focus","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;;;;;AACA,eAAe,kBAAkB,CAAC,wsCAAwsC;;;ACmB1uC,MAAMA,MAAM,GAAGC,WAAW,CAAC,2CAA2C,CAAC;AAE1DC,MAAAA,YAAY,GAAGC,kBAAkB,CAACC;AAClCC,MAAAA,aAAa,GAAGC,mBAAmB,CAACC;AAE1C,MAAMC,KAAe,GAAGC,MAAM,CAACC,MAAM,CAACP,kBAAkB;AACxD,MAAMQ,MAAgB,GAAGF,MAAM,CAACC,MAAM,CAACJ,mBAAmB;AAgC5CM,IAAAA,QAAQ,IAAAC,MAAA,GAAd,MAAMD,QAAQ,SAASE,SAAS,CAAoB;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;AAAAC,IAAAA,0BAAA,kBAAAC,WAAA,EAAA,IAAA,CAAA;IAAAC,eAAA,CAAA,IAAA,EAAA,UAAA,EAAA,SAAA,CAAA;IAAAA,eAAA,CAAA,IAAA,EAAA,OAAA,EAAA,SAAA,CAAA;AAAAA,I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AAqD,SAAA,EAeNM,WAAAA,EAAAA,CAAAA,MAAM,CAAA/D,EAAAA,MAAA,CAAAgE,wBAAA,CAAA5D,MAAA,CAAAqD,SAAA,gBAAArD,MAAA,CAAAqD,SAAA,CAAA,EAAArD,MAAA;AA1HoB6D,oBAAA,CAAAC,QAAA,EAAR/D,QAAQ,CAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { tracked } from '@glimmer/tracking';
4
4
  import { action } from '@ember/object';
@@ -1,4 +1,4 @@
1
- import { _ as _applyDecoratedDescriptor } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { _ as _applyDecoratedDescriptor } from '../../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { action } from '@ember/object';
4
4
  import { assert } from '@ember/debug';
@@ -1,4 +1,4 @@
1
- import { _ as _applyDecoratedDescriptor } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { _ as _applyDecoratedDescriptor } from '../../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { action } from '@ember/object';
4
4
  import { assert } from '@ember/debug';
@@ -1,4 +1,4 @@
1
- import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-81503waH.js';
1
+ import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty, a as _defineProperty } from '../../../../_rollupPluginBabelHelpers-C_TsMG3M.js';
2
2
  import Component from '@glimmer/component';
3
3
  import { tracked } from '@glimmer/tracking';
4
4
  import { action } from '@ember/object';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/numbered/index.hbs","../../../../../src/components/hds/pagination/numbered/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=\\\"hds-pagination\\\" ...attributes>\\n {{#if this.showInfo}}\\n <Hds::Pagination::Info\\n @itemsRangeStart={{this.itemsRangeStart}}\\n @itemsRangeEnd={{this.itemsRangeEnd}}\\n @totalItems={{@totalItems}}\\n @showTotalItems={{@showTotalItems}}\\n />\\n {{/if}}\\n\\n <nav class=\\\"hds-pagination-nav\\\" aria-label={{this.ariaLabel}}>\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"prev\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryPrev}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{this.isDisabledPrev}}\\n />\\n {{#if this.showPageNumbers}}\\n <ul class=\\\"hds-pagination-nav__page-list\\\">\\n {{#each this.pages as |page|}}\\n <li class=\\\"hds-pagination-nav__page-item\\\">\\n {{#if (eq page \\\"…\\\")}}\\n <Hds::Pagination::Nav::Ellipsis />\\n {{else}}\\n <Hds::Pagination::Nav::Number\\n @page={{this.elliptizedPageArrayItemAsNumber page}}\\n @route={{this.routing.route}}\\n @query={{get this.routing.queryPages page}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @isSelected={{if (eq page this.currentPage) true false}}\\n />\\n {{/if}}\\n </li>\\n {{/each}}\\n </ul>\\n {{/if}}\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"next\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryNext}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{this.isDisabledNext}}\\n />\\n </nav>\\n\\n {{#if this.showSizeSelector}}\\n <Hds::Pagination::SizeSelector\\n @pageSizes={{this.pageSizes}}\\n @label={{@sizeSelectorLabel}}\\n @selectedSize={{this.currentPageSize}}\\n @onChange={{this.onPageSizeChange}}\\n />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { HdsPaginationDirectionValues } from '../types.ts';\n\nimport type {\n HdsPaginationPage,\n HdsPaginationRoutingProps,\n HdsPaginationElliptizedPageArray,\n HdsPaginationElliptizedPageArrayItem,\n} from '../types';\nimport type { HdsInteractiveSignature } from '../../interactive/index.ts';\ninterface ElliptizeProps {\n pages: number[];\n current: number;\n limit?: number;\n}\n\ntype HdsInteractiveQuery = HdsInteractiveSignature['Args']['query'];\n\ntype HdsPaginationNumberedRoutingQueryProps = HdsPaginationRoutingProps & {\n queryNext?: HdsInteractiveQuery;\n queryPrev?: HdsInteractiveQuery;\n queryPages?: Record<\n HdsPaginationElliptizedPageArrayItem,\n HdsInteractiveQuery\n >;\n};\n\ntype HdsPaginationQueryFunction = (\n page: number,\n pageSize: number\n) => HdsInteractiveQuery;\n\ninterface HdsPaginationNumberedArgs extends HdsPaginationRoutingProps {\n ariaLabel?: string;\n totalItems: number;\n showLabels?: boolean;\n isTruncated?: boolean;\n currentPage?: number;\n showInfo?: boolean;\n showPageNumbers?: boolean;\n showTotalItems?: boolean;\n showSizeSelector?: boolean;\n sizeSelectorLabel?: string;\n pageSizes?: number[];\n currentPageSize?: number;\n queryFunction?: HdsPaginationQueryFunction;\n onPageChange?: (page: number, pageSize: number) => unknown;\n onPageSizeChange?: (pageSize: number) => unknown;\n}\n\ninterface HdsPaginationNumberedArgsControlledBase\n extends HdsPaginationNumberedArgs {\n currentPage: number;\n currentPageSize: number;\n queryFunction: HdsPaginationQueryFunction;\n}\n\ninterface HdsPaginationNumberedArgsControlledWithModel\n extends HdsPaginationNumberedArgsControlledBase {\n model: string | number;\n}\n\ninterface HdsPaginationNumberedArgsControlledWithModels\n extends HdsPaginationNumberedArgsControlledBase {\n models: Array<string | number>;\n}\ninterface HdsPaginationNumberedArgsControlledWithRoute\n extends HdsPaginationNumberedArgsControlledBase {\n route: string;\n}\n\ntype HdsPaginationNumberedArgsControlled =\n | HdsPaginationNumberedArgsControlledWithModel\n | HdsPaginationNumberedArgsControlledWithModels\n | HdsPaginationNumberedArgsControlledWithRoute;\n\ninterface HdsPaginationNumberedArgsUncontrolled\n extends HdsPaginationNumberedArgs {\n queryFunction?: undefined;\n}\n\nexport interface HdsPaginationNumberedSignature {\n Args:\n | HdsPaginationNumberedArgsControlled\n | HdsPaginationNumberedArgsUncontrolled;\n Element: HTMLDivElement;\n}\n\nconst ELLIPSIS = '…';\n\n// for context about the decision to use these values, see:\n// https://hashicorp.slack.com/archives/C03A0N1QK8S/p1673546329082759\nexport const DEFAULT_PAGE_SIZES = [10, 30, 50];\n\nexport const elliptize = ({\n pages,\n current,\n limit = 7,\n}: ElliptizeProps): HdsPaginationElliptizedPageArray => {\n const length = pages.length;\n\n let result = [];\n let start;\n let end;\n\n if (length <= limit) {\n return pages;\n }\n\n if (current <= length / 2) {\n start = Math.ceil(limit / 2);\n end = limit - start;\n } else {\n end = Math.ceil(limit / 2);\n start = limit - end;\n }\n\n const sliceStart: HdsPaginationElliptizedPageArray = pages.slice(0, start);\n const sliceEnd: HdsPaginationElliptizedPageArray = pages.slice(-end);\n\n if (sliceStart.includes(current) && sliceStart.includes(current + 1)) {\n // \"current\" (and its next sibling) is contained within the \"sliceStart\" block\n sliceEnd.splice(0, 1, ELLIPSIS);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart,\n sliceEnd\n );\n } else if (sliceEnd.includes(current - 1) && sliceEnd.includes(current)) {\n // \"current\" (and its prev sibling) is contained within the \"sliceEnd\" block\n sliceStart.splice(-1, 1, ELLIPSIS);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart,\n sliceEnd\n );\n } else {\n // this is a bit more tricky :)\n // we need to calculate how many items there are before/after the current item\n // since both the initial and ending blocks are always 2 items long (number + ellipsis)\n // and there is always the \"current\" item, we can just subtract 5 from the limit\n const delta = (limit - 5) / 2; // this is why the limit needs to be an odd number\n // we slice the array starting at the \"current\" index, minus the delta, minus one because it's an array (zero-based)\n const sliceCurr = pages.slice(current - delta - 1, current + delta);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart.shift() as number,\n ELLIPSIS,\n sliceCurr,\n ELLIPSIS,\n sliceEnd.pop() as number\n );\n }\n\n return result;\n};\nexport default class HdsPaginationNumbered extends Component<HdsPaginationNumberedSignature> {\n // These two private variables are used to differentiate between\n // \"uncontrolled\" component (where the state is handled internally) and\n // \"controlled\" component (where the state is handled externally, by the consumer's code).\n // In the first case, these variables store the internal state of the component at any moment,\n // and their value is updated internally according to the user's interaction with the component.\n // In the second case, these variables store *only* the initial state of the component (coming from the arguments)\n // at rendering time, but from that moment on they're not updated anymore, no matter what interaction the user\n // has with the component (the state is controlled externally, eg. via query parameters)\n @tracked private _currentPage;\n @tracked private _currentPageSize;\n @tracked private _isControlled;\n\n showInfo = this.args.showInfo ?? true; // if the \"info\" block is visible\n showLabels = this.args.showLabels ?? false; // if the labels for the \"prev/next\" controls are visible\n showSizeSelector = this.args.showSizeSelector ?? true; // if the \"size selector\" block is visible\n showPageNumbers = this.args.showPageNumbers ?? true; // if the \"page numbers\" block is visible\n isTruncated = this.args.isTruncated ?? true; // if the list of \"page numbers\" is truncated\n\n constructor(owner: unknown, args: HdsPaginationNumberedSignature['Args']) {\n super(owner, args);\n\n const { queryFunction } = this.args;\n\n // This component works in two different ways, depending if we need to support\n // routing through links (`LinkTo`) for the \"navigation controls\", or not.\n // If there's no routing then the component behaves as \"uncontrolled\"\n // (the state updates - eg to the \"currentPage\" and \"currentPageSize\"\n // are handled by its internal logic).\n // If instead the component needs to update the routing (and we infer this via the \"query\" arguments)\n // then the component behaves as \"controlled\", where the state is\n // initialized and updated using the arguments passed to it.\n\n if (queryFunction === undefined) {\n this._isControlled = false;\n } else {\n assert(\n '@model, @models, or @route for \"Hds::Pagination::Numbered\" must be provided when using the @queryFunction argument',\n this.args.model !== undefined ||\n this.args.models !== undefined ||\n this.args.route !== undefined\n );\n assert(\n '@queryFunction for \"Hds::Pagination::Numbered\" must be a function',\n typeof queryFunction === 'function'\n );\n assert(\n '@currentPage and @currentPageSize for \"Hds::Pagination::Numbered\" must be provided as numeric arguments when the pagination controls the routing',\n typeof this.args.currentPageSize === 'number' &&\n typeof this.args.currentPage === 'number'\n );\n this._isControlled = true;\n }\n\n assert(\n '@totalItems for \"Hds::Pagination::Numbered\" must be defined as an integer number',\n typeof this.args.totalItems === 'number'\n );\n\n this._currentPage = this.args.currentPage ?? 1;\n // we assert that `this.pageSizes` will always be an array with at least one item\n this._currentPageSize = this.args.currentPageSize ?? this.pageSizes[0];\n }\n\n get ariaLabel(): string {\n return this.args.ariaLabel ?? 'Pagination';\n }\n\n // This very specific `get/set` pattern is used to handle the two different use cases of the component\n // being \"controlled\" (when it has routing, meaning it needs to support pagination controls as links/`LinkTo`)\n // vs being \"uncontrolled\" (see comments above for details).\n //\n // If it has routing (and so it's \"controlled\"), than the value (\"state\") of the `currentPage/currentPageSize` variables\n // is *always* determined by the controller via arguments (most of the times, connected to query parameters in the URL).\n // For this reason the \"get\" method always returns the value from the `args`,\n // while the \"set\" method never updates the private internal state (_variable).\n //\n // If instead it doesn't have routing (and so it's \"uncontrolled\") than the value (\"state\") of the `currentPage/currentPageSize` variables\n // is *always* determined by the component's internal logic (and updated according to the user interaction with it).\n // For this reason the \"get\" and \"set\" methods always read from or write to the private internal state (_variable).\n\n get currentPage(): number {\n if (this._isControlled) {\n // if the component is controlled, `@currentPage` is asserted to be a number\n return this.args.currentPage as number;\n } else {\n return this._currentPage;\n }\n }\n set currentPage(value) {\n if (this._isControlled) {\n // noop\n } else {\n // if `this._isControlled` is `false`\n this._currentPage = value as number;\n }\n }\n\n get currentPageSize(): number {\n if (this._isControlled) {\n // if the component is controlled, `@currentPageSize` is asserted to be a number\n return this.args.currentPageSize as number;\n } else {\n return this._currentPageSize as number;\n }\n }\n set currentPageSize(value) {\n if (this._isControlled) {\n // noop\n } else {\n this._currentPageSize = value;\n }\n }\n\n get pageSizes(): number[] {\n const { pageSizes = DEFAULT_PAGE_SIZES } = this.args;\n\n assert(\n // TODO: Add test for this\n `pageSizes argument must be an array with at least one item. Received: ${pageSizes}`,\n Array.isArray(pageSizes) === true && pageSizes.length > 0\n );\n\n return pageSizes;\n }\n\n get itemsRangeStart(): number {\n // Calculate the starting range of items displayed on current page\n // if currentPage = 1st page and # of items per page is 10:\n // ( (1 - 1 = 0) * 10 = 0 ) + 1 = 1\n // if current page = 2nd page:\n // ( (2 - 1 = 1) * 10 = 10 ) + 1 = 11\n return (this.currentPage - 1) * this.currentPageSize + 1;\n }\n\n get itemsRangeEnd(): number {\n // Calculate ending range of items displayed on current page\n // 2 cases: 1) full page of items or 2) last page of items\n if (this.currentPage * this.currentPageSize < this.args.totalItems) {\n // 1) full page of items (pages 1 to page before last):\n return this.itemsRangeStart + this.currentPageSize - 1;\n } else {\n // 2) last page of items:\n return this.args.totalItems;\n }\n }\n\n get pages(): HdsPaginationElliptizedPageArray {\n const pages = [];\n\n for (let i = 1; i <= this.totalPages; i++) {\n pages.push(i);\n }\n\n if (this.isTruncated) {\n return elliptize({ pages, current: this.currentPage });\n } else {\n return pages;\n }\n }\n\n get totalPages() {\n return Math.max(Math.ceil(this.args.totalItems / this.currentPageSize), 1);\n }\n\n buildQueryParamsObject(\n page: HdsPaginationElliptizedPageArrayItem,\n pageSize: number\n ): HdsInteractiveQuery {\n // `page` may also be ellipsis\n if (this._isControlled && typeof page === 'number') {\n // if the component is controlled, `@queryFunction` is asserted to be a function\n return this.args.queryFunction!(page, pageSize);\n } else {\n return {};\n }\n }\n\n get routing(): HdsPaginationNumberedRoutingQueryProps {\n const routing: HdsPaginationNumberedRoutingQueryProps = {\n route: this.args.route ?? undefined,\n model: this.args.model ?? undefined,\n models: this.args.models ?? undefined,\n replace: this.args.replace ?? undefined,\n };\n\n // the \"query\" is dynamic and needs to be calculated\n if (this._isControlled) {\n routing.queryPrev = this.buildQueryParamsObject(\n this.currentPage - 1,\n this.currentPageSize\n );\n routing.queryNext = this.buildQueryParamsObject(\n this.currentPage + 1,\n this.currentPageSize\n );\n // IMPORTANT: here we need to use an object and not an array\n // otherwise the {{get object page}} will be shifted by one\n // (the pages are 1-based while the array would be zero-based)\n routing.queryPages = {};\n this.pages.forEach(\n (page) =>\n (routing.queryPages![page] = this.buildQueryParamsObject(\n page,\n this.currentPageSize\n ))\n );\n } else {\n routing.queryPrev = undefined;\n routing.queryNext = undefined;\n }\n\n return routing;\n }\n\n get isDisabledPrev() {\n return this.currentPage === 1;\n }\n\n get isDisabledNext() {\n return this.currentPage === this.totalPages;\n }\n\n @action\n onPageChange(page: HdsPaginationPage) {\n let gotoPageNumber;\n if (page === HdsPaginationDirectionValues.Prev && this.currentPage > 1) {\n gotoPageNumber = this.currentPage - 1;\n } else if (\n page === HdsPaginationDirectionValues.Next &&\n this.currentPage < this.totalPages\n ) {\n gotoPageNumber = this.currentPage + 1;\n } else {\n gotoPageNumber = page;\n }\n\n // we want to invoke the `onPageChange` callback only on actual page change\n if (gotoPageNumber !== this.currentPage) {\n // we have already determined that `gotoPageNumber` is not `prev` or `next`\n this.currentPage = gotoPageNumber as number;\n\n const { onPageChange } = this.args;\n\n if (typeof onPageChange === 'function') {\n onPageChange(this.currentPage, this.currentPageSize);\n }\n }\n }\n\n @action\n onPageSizeChange(newPageSize: number) {\n const { onPageSizeChange } = this.args;\n\n if (!this._isControlled) {\n // notice: we agreed to reset the pagination to the first element (any alternative would result in an unpredictable UX)\n this.currentPage = 1;\n this.currentPageSize = newPageSize;\n }\n\n // invoke the callback function\n if (typeof onPageSizeChange === 'function') {\n onPageSizeChange(newPageSize);\n }\n }\n\n elliptizedPageArrayItemAsNumber = (\n item: HdsPaginationElliptizedPageArrayItem\n ): number => {\n if (typeof item === 'number') {\n return item;\n } else {\n throw new Error('Expected a number, but got an ellipsis');\n }\n };\n\n getPageNumberQuery(page: HdsPaginationElliptizedPageArrayItem) {\n return this.routing.queryPages![this.elliptizedPageArrayItemAsNumber(page)];\n }\n}\n"],"names":["ELLIPSIS","DEFAULT_PAGE_SIZES","elliptize","pages","current","limit","length","result","start","end","Math","ceil","sliceStart","slice","sliceEnd","includes","splice","concat","delta","sliceCurr","shift","pop","HdsPaginationNumbered","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","_defineProperty","showInfo","showLabels","showSizeSelector","showPageNumbers","isTruncated","item","Error","queryFunction","undefined","_isControlled","assert","model","models","route","currentPageSize","currentPage","totalItems","_currentPage","_currentPageSize","pageSizes","ariaLabel","value","Array","isArray","itemsRangeStart","itemsRangeEnd","i","totalPages","push","max","buildQueryParamsObject","page","pageSize","routing","replace","queryPrev","queryNext","queryPages","forEach","isDisabledPrev","isDisabledNext","onPageChange","gotoPageNumber","HdsPaginationDirectionValues","Prev","Next","onPageSizeChange","newPageSize","getPageNumberQuery","elliptizedPageArrayItemAsNumber","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,kzEAAkzE;;;AC8Fp1E,MAAMA,QAAQ,GAAG,GAAG;;AAEpB;AACA;AACO,MAAMC,kBAAkB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;AAEtC,MAAMC,SAAS,GAAGA,CAAC;EACxBC,KAAK;EACLC,OAAO;AACPC,EAAAA,KAAK,GAAG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WAAA,EAAA;AAAA,CAAA3D,CAAAA,EAAAA,YAAA,GAAAqD,yBAAA,CAAA5D,MAAA,CAAA6D,SAAA,uBACPC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA;AAAA,CAAA1D,CAAAA,EAAAA,YAAA,GAAAoD,yBAAA,CAAA5D,MAAA,CAAA6D,SAAA,oBACPC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,EAAAN,yBAAA,CAAA5D,MAAA,CAAA6D,SAAA,EAAA,cAAA,EAAA,CAoNPM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAArE,MAAA,CAAA6D,SAAA,EAAA7D,cAAAA,CAAAA,EAAAA,MAAA,CAAA6D,SAAA,CAAA,EAAAD,yBAAA,CAAA5D,MAAA,CAAA6D,SAAA,uBA2BNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAArE,MAAA,CAAA6D,SAAA,EAAA,kBAAA,CAAA,EAAA7D,MAAA,CAAA6D,SAAA,GAAA7D,MAAA;AA1PiCsE,oBAAA,CAAAC,QAAA,EAArBxE,qBAAqB,CAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/hds/pagination/numbered/index.hbs","../../../../../src/components/hds/pagination/numbered/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=\\\"hds-pagination\\\" ...attributes>\\n {{#if this.showInfo}}\\n <Hds::Pagination::Info\\n @itemsRangeStart={{this.itemsRangeStart}}\\n @itemsRangeEnd={{this.itemsRangeEnd}}\\n @totalItems={{@totalItems}}\\n @showTotalItems={{@showTotalItems}}\\n />\\n {{/if}}\\n\\n <nav class=\\\"hds-pagination-nav\\\" aria-label={{this.ariaLabel}}>\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"prev\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryPrev}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{this.isDisabledPrev}}\\n />\\n {{#if this.showPageNumbers}}\\n <ul class=\\\"hds-pagination-nav__page-list\\\">\\n {{#each this.pages as |page|}}\\n <li class=\\\"hds-pagination-nav__page-item\\\">\\n {{#if (eq page \\\"…\\\")}}\\n <Hds::Pagination::Nav::Ellipsis />\\n {{else}}\\n <Hds::Pagination::Nav::Number\\n @page={{this.elliptizedPageArrayItemAsNumber page}}\\n @route={{this.routing.route}}\\n @query={{get this.routing.queryPages page}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @isSelected={{if (eq page this.currentPage) true false}}\\n />\\n {{/if}}\\n </li>\\n {{/each}}\\n </ul>\\n {{/if}}\\n <Hds::Pagination::Nav::Arrow\\n @direction=\\\"next\\\"\\n @showLabel={{this.showLabels}}\\n @route={{this.routing.route}}\\n @query={{this.routing.queryNext}}\\n @model={{this.routing.model}}\\n @models={{this.routing.models}}\\n @replace={{this.routing.replace}}\\n @onClick={{this.onPageChange}}\\n @disabled={{this.isDisabledNext}}\\n />\\n </nav>\\n\\n {{#if this.showSizeSelector}}\\n <Hds::Pagination::SizeSelector\\n @pageSizes={{this.pageSizes}}\\n @label={{@sizeSelectorLabel}}\\n @selectedSize={{this.currentPageSize}}\\n @onChange={{this.onPageSizeChange}}\\n />\\n {{/if}}\\n</div>\")","/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { HdsPaginationDirectionValues } from '../types.ts';\n\nimport type {\n HdsPaginationPage,\n HdsPaginationRoutingProps,\n HdsPaginationElliptizedPageArray,\n HdsPaginationElliptizedPageArrayItem,\n} from '../types';\nimport type { HdsInteractiveSignature } from '../../interactive/index.ts';\ninterface ElliptizeProps {\n pages: number[];\n current: number;\n limit?: number;\n}\n\ntype HdsInteractiveQuery = HdsInteractiveSignature['Args']['query'];\n\ntype HdsPaginationNumberedRoutingQueryProps = HdsPaginationRoutingProps & {\n queryNext?: HdsInteractiveQuery;\n queryPrev?: HdsInteractiveQuery;\n queryPages?: Record<\n HdsPaginationElliptizedPageArrayItem,\n HdsInteractiveQuery\n >;\n};\n\ntype HdsPaginationQueryFunction = (\n page: number,\n pageSize: number\n) => HdsInteractiveQuery;\n\ninterface HdsPaginationNumberedArgs extends HdsPaginationRoutingProps {\n ariaLabel?: string;\n totalItems: number;\n showLabels?: boolean;\n isTruncated?: boolean;\n currentPage?: number;\n showInfo?: boolean;\n showPageNumbers?: boolean;\n showTotalItems?: boolean;\n showSizeSelector?: boolean;\n sizeSelectorLabel?: string;\n pageSizes?: number[];\n currentPageSize?: number;\n queryFunction?: HdsPaginationQueryFunction;\n onPageChange?: (page: number, pageSize: number) => unknown;\n onPageSizeChange?: (pageSize: number) => unknown;\n}\n\ninterface HdsPaginationNumberedArgsControlledBase\n extends HdsPaginationNumberedArgs {\n currentPage: number;\n currentPageSize: number;\n queryFunction: HdsPaginationQueryFunction;\n}\n\ninterface HdsPaginationNumberedArgsControlledWithModel\n extends HdsPaginationNumberedArgsControlledBase {\n model: string | number;\n}\n\ninterface HdsPaginationNumberedArgsControlledWithModels\n extends HdsPaginationNumberedArgsControlledBase {\n models: Array<string | number>;\n}\ninterface HdsPaginationNumberedArgsControlledWithRoute\n extends HdsPaginationNumberedArgsControlledBase {\n route: string;\n}\n\ntype HdsPaginationNumberedArgsControlled =\n | HdsPaginationNumberedArgsControlledWithModel\n | HdsPaginationNumberedArgsControlledWithModels\n | HdsPaginationNumberedArgsControlledWithRoute;\n\ninterface HdsPaginationNumberedArgsUncontrolled\n extends HdsPaginationNumberedArgs {\n queryFunction?: undefined;\n}\n\nexport interface HdsPaginationNumberedSignature {\n Args:\n | HdsPaginationNumberedArgsControlled\n | HdsPaginationNumberedArgsUncontrolled;\n Element: HTMLDivElement;\n}\n\nconst ELLIPSIS = '…';\n\n// for context about the decision to use these values, see:\n// https://hashicorp.slack.com/archives/C03A0N1QK8S/p1673546329082759\nexport const DEFAULT_PAGE_SIZES = [10, 30, 50];\n\nexport const elliptize = ({\n pages,\n current,\n limit = 7,\n}: ElliptizeProps): HdsPaginationElliptizedPageArray => {\n const length = pages.length;\n\n let result = [];\n let start;\n let end;\n\n if (length <= limit) {\n return pages;\n }\n\n if (current <= length / 2) {\n start = Math.ceil(limit / 2);\n end = limit - start;\n } else {\n end = Math.ceil(limit / 2);\n start = limit - end;\n }\n\n const sliceStart: HdsPaginationElliptizedPageArray = pages.slice(0, start);\n const sliceEnd: HdsPaginationElliptizedPageArray = pages.slice(-end);\n\n if (sliceStart.includes(current) && sliceStart.includes(current + 1)) {\n // \"current\" (and its next sibling) is contained within the \"sliceStart\" block\n sliceEnd.splice(0, 1, ELLIPSIS);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart,\n sliceEnd\n );\n } else if (sliceEnd.includes(current - 1) && sliceEnd.includes(current)) {\n // \"current\" (and its prev sibling) is contained within the \"sliceEnd\" block\n sliceStart.splice(-1, 1, ELLIPSIS);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart,\n sliceEnd\n );\n } else {\n // this is a bit more tricky :)\n // we need to calculate how many items there are before/after the current item\n // since both the initial and ending blocks are always 2 items long (number + ellipsis)\n // and there is always the \"current\" item, we can just subtract 5 from the limit\n const delta = (limit - 5) / 2; // this is why the limit needs to be an odd number\n // we slice the array starting at the \"current\" index, minus the delta, minus one because it's an array (zero-based)\n const sliceCurr = pages.slice(current - delta - 1, current + delta);\n result = ([] as HdsPaginationElliptizedPageArray).concat(\n sliceStart.shift() as number,\n ELLIPSIS,\n sliceCurr,\n ELLIPSIS,\n sliceEnd.pop() as number\n );\n }\n\n return result;\n};\nexport default class HdsPaginationNumbered extends Component<HdsPaginationNumberedSignature> {\n // These two private variables are used to differentiate between\n // \"uncontrolled\" component (where the state is handled internally) and\n // \"controlled\" component (where the state is handled externally, by the consumer's code).\n // In the first case, these variables store the internal state of the component at any moment,\n // and their value is updated internally according to the user's interaction with the component.\n // In the second case, these variables store *only* the initial state of the component (coming from the arguments)\n // at rendering time, but from that moment on they're not updated anymore, no matter what interaction the user\n // has with the component (the state is controlled externally, eg. via query parameters)\n @tracked private _currentPage;\n @tracked private _currentPageSize;\n @tracked private _isControlled;\n\n showInfo = this.args.showInfo ?? true; // if the \"info\" block is visible\n showLabels = this.args.showLabels ?? false; // if the labels for the \"prev/next\" controls are visible\n showSizeSelector = this.args.showSizeSelector ?? true; // if the \"size selector\" block is visible\n showPageNumbers = this.args.showPageNumbers ?? true; // if the \"page numbers\" block is visible\n isTruncated = this.args.isTruncated ?? true; // if the list of \"page numbers\" is truncated\n\n constructor(owner: unknown, args: HdsPaginationNumberedSignature['Args']) {\n super(owner, args);\n\n const { queryFunction } = this.args;\n\n // This component works in two different ways, depending if we need to support\n // routing through links (`LinkTo`) for the \"navigation controls\", or not.\n // If there's no routing then the component behaves as \"uncontrolled\"\n // (the state updates - eg to the \"currentPage\" and \"currentPageSize\"\n // are handled by its internal logic).\n // If instead the component needs to update the routing (and we infer this via the \"query\" arguments)\n // then the component behaves as \"controlled\", where the state is\n // initialized and updated using the arguments passed to it.\n\n if (queryFunction === undefined) {\n this._isControlled = false;\n } else {\n assert(\n '@model, @models, or @route for \"Hds::Pagination::Numbered\" must be provided when using the @queryFunction argument',\n this.args.model !== undefined ||\n this.args.models !== undefined ||\n this.args.route !== undefined\n );\n assert(\n '@queryFunction for \"Hds::Pagination::Numbered\" must be a function',\n typeof queryFunction === 'function'\n );\n assert(\n '@currentPage and @currentPageSize for \"Hds::Pagination::Numbered\" must be provided as numeric arguments when the pagination controls the routing',\n typeof this.args.currentPageSize === 'number' &&\n typeof this.args.currentPage === 'number'\n );\n this._isControlled = true;\n }\n\n assert(\n '@totalItems for \"Hds::Pagination::Numbered\" must be defined as an integer number',\n typeof this.args.totalItems === 'number'\n );\n\n this._currentPage = this.args.currentPage ?? 1;\n // we assert that `this.pageSizes` will always be an array with at least one item\n this._currentPageSize = this.args.currentPageSize ?? this.pageSizes[0];\n }\n\n get ariaLabel(): string {\n return this.args.ariaLabel ?? 'Pagination';\n }\n\n // This very specific `get/set` pattern is used to handle the two different use cases of the component\n // being \"controlled\" (when it has routing, meaning it needs to support pagination controls as links/`LinkTo`)\n // vs being \"uncontrolled\" (see comments above for details).\n //\n // If it has routing (and so it's \"controlled\"), than the value (\"state\") of the `currentPage/currentPageSize` variables\n // is *always* determined by the controller via arguments (most of the times, connected to query parameters in the URL).\n // For this reason the \"get\" method always returns the value from the `args`,\n // while the \"set\" method never updates the private internal state (_variable).\n //\n // If instead it doesn't have routing (and so it's \"uncontrolled\") than the value (\"state\") of the `currentPage/currentPageSize` variables\n // is *always* determined by the component's internal logic (and updated according to the user interaction with it).\n // For this reason the \"get\" and \"set\" methods always read from or write to the private internal state (_variable).\n\n get currentPage(): number {\n if (this._isControlled) {\n // if the component is controlled, `@currentPage` is asserted to be a number\n return this.args.currentPage as number;\n } else {\n return this._currentPage;\n }\n }\n set currentPage(value) {\n if (this._isControlled) {\n // noop\n } else {\n // if `this._isControlled` is `false`\n this._currentPage = value as number;\n }\n }\n\n get currentPageSize(): number {\n if (this._isControlled) {\n // if the component is controlled, `@currentPageSize` is asserted to be a number\n return this.args.currentPageSize as number;\n } else {\n return this._currentPageSize as number;\n }\n }\n set currentPageSize(value) {\n if (this._isControlled) {\n // noop\n } else {\n this._currentPageSize = value;\n }\n }\n\n get pageSizes(): number[] {\n const { pageSizes = DEFAULT_PAGE_SIZES } = this.args;\n\n assert(\n // TODO: Add test for this\n `pageSizes argument must be an array with at least one item. Received: ${pageSizes}`,\n Array.isArray(pageSizes) === true && pageSizes.length > 0\n );\n\n return pageSizes;\n }\n\n get itemsRangeStart(): number {\n // Calculate the starting range of items displayed on current page\n // if currentPage = 1st page and # of items per page is 10:\n // ( (1 - 1 = 0) * 10 = 0 ) + 1 = 1\n // if current page = 2nd page:\n // ( (2 - 1 = 1) * 10 = 10 ) + 1 = 11\n return (this.currentPage - 1) * this.currentPageSize + 1;\n }\n\n get itemsRangeEnd(): number {\n // Calculate ending range of items displayed on current page\n // 2 cases: 1) full page of items or 2) last page of items\n if (this.currentPage * this.currentPageSize < this.args.totalItems) {\n // 1) full page of items (pages 1 to page before last):\n return this.itemsRangeStart + this.currentPageSize - 1;\n } else {\n // 2) last page of items:\n return this.args.totalItems;\n }\n }\n\n get pages(): HdsPaginationElliptizedPageArray {\n const pages = [];\n\n for (let i = 1; i <= this.totalPages; i++) {\n pages.push(i);\n }\n\n if (this.isTruncated) {\n return elliptize({ pages, current: this.currentPage });\n } else {\n return pages;\n }\n }\n\n get totalPages() {\n return Math.max(Math.ceil(this.args.totalItems / this.currentPageSize), 1);\n }\n\n buildQueryParamsObject(\n page: HdsPaginationElliptizedPageArrayItem,\n pageSize: number\n ): HdsInteractiveQuery {\n // `page` may also be ellipsis\n if (this._isControlled && typeof page === 'number') {\n // if the component is controlled, `@queryFunction` is asserted to be a function\n return this.args.queryFunction!(page, pageSize);\n } else {\n return {};\n }\n }\n\n get routing(): HdsPaginationNumberedRoutingQueryProps {\n const routing: HdsPaginationNumberedRoutingQueryProps = {\n route: this.args.route ?? undefined,\n model: this.args.model ?? undefined,\n models: this.args.models ?? undefined,\n replace: this.args.replace ?? undefined,\n };\n\n // the \"query\" is dynamic and needs to be calculated\n if (this._isControlled) {\n routing.queryPrev = this.buildQueryParamsObject(\n this.currentPage - 1,\n this.currentPageSize\n );\n routing.queryNext = this.buildQueryParamsObject(\n this.currentPage + 1,\n this.currentPageSize\n );\n // IMPORTANT: here we need to use an object and not an array\n // otherwise the {{get object page}} will be shifted by one\n // (the pages are 1-based while the array would be zero-based)\n routing.queryPages = {};\n this.pages.forEach(\n (page) =>\n (routing.queryPages![page] = this.buildQueryParamsObject(\n page,\n this.currentPageSize\n ))\n );\n } else {\n routing.queryPrev = undefined;\n routing.queryNext = undefined;\n }\n\n return routing;\n }\n\n get isDisabledPrev() {\n return this.currentPage === 1;\n }\n\n get isDisabledNext() {\n return this.currentPage === this.totalPages;\n }\n\n @action\n onPageChange(page: HdsPaginationPage) {\n let gotoPageNumber;\n if (page === HdsPaginationDirectionValues.Prev && this.currentPage > 1) {\n gotoPageNumber = this.currentPage - 1;\n } else if (\n page === HdsPaginationDirectionValues.Next &&\n this.currentPage < this.totalPages\n ) {\n gotoPageNumber = this.currentPage + 1;\n } else {\n gotoPageNumber = page;\n }\n\n // we want to invoke the `onPageChange` callback only on actual page change\n if (gotoPageNumber !== this.currentPage) {\n // we have already determined that `gotoPageNumber` is not `prev` or `next`\n this.currentPage = gotoPageNumber as number;\n\n const { onPageChange } = this.args;\n\n if (typeof onPageChange === 'function') {\n onPageChange(this.currentPage, this.currentPageSize);\n }\n }\n }\n\n @action\n onPageSizeChange(newPageSize: number) {\n const { onPageSizeChange } = this.args;\n\n if (!this._isControlled) {\n // notice: we agreed to reset the pagination to the first element (any alternative would result in an unpredictable UX)\n this.currentPage = 1;\n this.currentPageSize = newPageSize;\n }\n\n // invoke the callback function\n if (typeof onPageSizeChange === 'function') {\n onPageSizeChange(newPageSize);\n }\n }\n\n elliptizedPageArrayItemAsNumber = (\n item: HdsPaginationElliptizedPageArrayItem\n ): number => {\n if (typeof item === 'number') {\n return item;\n } else {\n throw new Error('Expected a number, but got an ellipsis');\n }\n };\n\n getPageNumberQuery(page: HdsPaginationElliptizedPageArrayItem) {\n return this.routing.queryPages![this.elliptizedPageArrayItemAsNumber(page)];\n }\n}\n"],"names":["ELLIPSIS","DEFAULT_PAGE_SIZES","elliptize","pages","current","limit","length","result","start","end","Math","ceil","sliceStart","slice","sliceEnd","includes","splice","concat","delta","sliceCurr","shift","pop","HdsPaginationNumbered","_class","Component","constructor","owner","args","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","_defineProperty","showInfo","showLabels","showSizeSelector","showPageNumbers","isTruncated","item","Error","queryFunction","undefined","_isControlled","assert","model","models","route","currentPageSize","currentPage","totalItems","_currentPage","_currentPageSize","pageSizes","ariaLabel","value","Array","isArray","itemsRangeStart","itemsRangeEnd","i","totalPages","push","max","buildQueryParamsObject","page","pageSize","routing","replace","queryPrev","queryNext","queryPages","forEach","isDisabledPrev","isDisabledNext","onPageChange","gotoPageNumber","HdsPaginationDirectionValues","Prev","Next","onPageSizeChange","newPageSize","getPageNumberQuery","elliptizedPageArrayItemAsNumber","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;AACA,eAAe,kBAAkB,CAAC,kzEAAkzE;;;AC8Fp1E,MAAMA,QAAQ,GAAG,GAAG;;AAEpB;AACA;AACO,MAAMC,kBAAkB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;AAEtC,MAAMC,SAAS,GAAGA,CAAC;EACxBC,KAAK;EACLC,OAAO;AACPC,EAAAA,KAAK,GAAG;AACM,CAAC,KAAuC;AACtD,EAAA,MAAMC,MAAM,GAAGH,KAAK,CAACG,MAAM;EAE3B,IAAIC,MAAM,GAAG,EAAE;AACf,EAAA,IAAIC,KAAK;AACT,EAAA,IAAIC,GAAG;EAEP,IAAIH,MAAM,IAAID,KAAK,EAAE;AACnB,IAAA,OAAOF,KAAK;AACd;AAEA,EAAA,IAAIC,OAAO,IAAIE,MAAM,GAAG,CAAC,EAAE;IACzBE,KAAK,GAAGE,IAAI,CAACC,IAAI,CAACN,KAAK,GAAG,CAAC,CAAC;IAC5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