@vonage/vivid 4.25.0 → 4.27.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 (196) hide show
  1. package/custom-elements.json +3371 -1999
  2. package/lib/accordion-item/accordion-item.d.ts +2 -2
  3. package/lib/action-group/action-group.d.ts +1 -1
  4. package/lib/alert/alert.d.ts +5 -5
  5. package/lib/audio-player/audio-player.d.ts +3 -3
  6. package/lib/avatar/avatar.d.ts +393 -1
  7. package/lib/avatar/avatar.template.d.ts +2 -2
  8. package/lib/badge/badge.d.ts +2 -2
  9. package/lib/banner/banner.d.ts +6 -6
  10. package/lib/breadcrumb/breadcrumb.d.ts +1 -1
  11. package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  12. package/lib/button/button.d.ts +6 -6
  13. package/lib/calendar/calendar.d.ts +2 -0
  14. package/lib/calendar-event/calendar-event.d.ts +1 -1
  15. package/lib/card/card.d.ts +1 -1
  16. package/lib/checkbox/checkbox.d.ts +10 -10
  17. package/lib/combobox/combobox.d.ts +11 -11
  18. package/lib/data-grid/data-grid-cell.d.ts +6 -4
  19. package/lib/data-grid/data-grid-row.d.ts +1 -0
  20. package/lib/data-grid/data-grid.d.ts +1 -1
  21. package/lib/date-picker/date-picker.d.ts +75 -75
  22. package/lib/date-picker/date-picker.template.d.ts +1 -1
  23. package/lib/date-range-picker/date-range-picker.d.ts +44 -44
  24. package/lib/date-range-picker/date-range-picker.template.d.ts +1 -1
  25. package/lib/date-time-picker/date-time-picker.d.ts +64 -64
  26. package/lib/date-time-picker/date-time-picker.template.d.ts +1 -1
  27. package/lib/dial-pad/dial-pad.d.ts +3 -3
  28. package/lib/dialog/dialog.d.ts +5 -4
  29. package/lib/divider/divider.d.ts +1 -1
  30. package/lib/fab/fab.d.ts +2 -2
  31. package/lib/file-picker/file-picker.d.ts +10 -10
  32. package/lib/header/header.d.ts +1 -1
  33. package/lib/menu/menu.d.ts +2 -2
  34. package/lib/menu-item/menu-item.d.ts +3 -3
  35. package/lib/nav/nav.d.ts +1 -1
  36. package/lib/nav-disclosure/nav-disclosure.d.ts +3 -3
  37. package/lib/nav-item/nav-item.d.ts +3 -3
  38. package/lib/note/note.d.ts +2 -2
  39. package/lib/number-field/locale.d.ts +3 -2
  40. package/lib/number-field/number-field.d.ts +15 -15
  41. package/lib/option/option.d.ts +3 -3
  42. package/lib/pagination/locale.d.ts +5 -0
  43. package/lib/pagination/pagination.d.ts +341 -2
  44. package/lib/popup/popup.d.ts +1 -0
  45. package/lib/progress/progress.d.ts +1 -1
  46. package/lib/progress-ring/progress-ring.d.ts +1 -1
  47. package/lib/radio/radio.d.ts +3 -3
  48. package/lib/radio-group/radio-group.d.ts +4 -4
  49. package/lib/range-slider/range-slider.d.ts +5 -5
  50. package/lib/rich-text-editor/menubar/menubar.d.ts +3 -3
  51. package/lib/rich-text-editor/rich-text-editor.d.ts +3 -3
  52. package/lib/searchable-select/locale.d.ts +1 -1
  53. package/lib/searchable-select/option-tag.d.ts +3 -3
  54. package/lib/searchable-select/searchable-select.d.ts +15 -15
  55. package/lib/select/select.d.ts +12 -12
  56. package/lib/selectable-box/selectable-box.d.ts +1 -1
  57. package/lib/slider/slider.d.ts +5 -5
  58. package/lib/split-button/split-button.d.ts +6 -6
  59. package/lib/switch/switch.d.ts +2 -2
  60. package/lib/tab/tab.d.ts +6 -6
  61. package/lib/tab-panel/tab-panel.d.ts +1 -1
  62. package/lib/tag/locale.d.ts +3 -0
  63. package/lib/tag/tag.d.ts +343 -6
  64. package/lib/tag-group/tag-group.d.ts +1 -1
  65. package/lib/text-area/text-area.d.ts +14 -14
  66. package/lib/text-field/text-field.d.ts +16 -16
  67. package/lib/time-picker/time-picker.d.ts +21 -21
  68. package/lib/toggletip/toggletip.d.ts +1 -1
  69. package/lib/tooltip/tooltip.d.ts +1 -1
  70. package/lib/tree-item/tree-item.d.ts +3 -3
  71. package/lib/tree-view/tree-view.d.ts +1 -1
  72. package/lib/video-player/video-player.d.ts +3 -3
  73. package/locales/de-DE.cjs +40 -5
  74. package/locales/de-DE.js +40 -5
  75. package/locales/en-GB.cjs +40 -5
  76. package/locales/en-GB.js +40 -5
  77. package/locales/en-US.cjs +40 -5
  78. package/locales/en-US.js +40 -5
  79. package/locales/ja-JP.cjs +40 -5
  80. package/locales/ja-JP.js +40 -5
  81. package/locales/zh-CN.cjs +40 -5
  82. package/locales/zh-CN.js +40 -5
  83. package/package.json +73 -45
  84. package/shared/aria/delegates-aria.d.ts +1 -1
  85. package/shared/aria/host-semantics.d.ts +1 -1
  86. package/shared/calendar-picker.template.cjs +40 -13
  87. package/shared/calendar-picker.template.js +40 -13
  88. package/shared/definition.cjs +19 -3
  89. package/shared/definition.js +20 -4
  90. package/shared/definition11.cjs +1 -1
  91. package/shared/definition11.js +1 -1
  92. package/shared/definition13.cjs +25 -0
  93. package/shared/definition13.js +26 -1
  94. package/shared/definition15.cjs +1 -1
  95. package/shared/definition15.js +1 -1
  96. package/shared/definition16.cjs +1 -1
  97. package/shared/definition16.js +1 -1
  98. package/shared/definition17.cjs +602 -522
  99. package/shared/definition17.js +600 -520
  100. package/shared/definition18.cjs +8 -1
  101. package/shared/definition18.js +8 -1
  102. package/shared/definition19.cjs +9 -2
  103. package/shared/definition19.js +9 -2
  104. package/shared/definition2.cjs +1 -1
  105. package/shared/definition2.js +1 -1
  106. package/shared/definition20.cjs +3 -1
  107. package/shared/definition20.js +3 -1
  108. package/shared/definition21.cjs +2 -2
  109. package/shared/definition21.js +2 -2
  110. package/shared/definition22.cjs +9 -3
  111. package/shared/definition22.js +9 -3
  112. package/shared/definition28.cjs +2 -2
  113. package/shared/definition28.js +2 -2
  114. package/shared/definition3.cjs +1 -1
  115. package/shared/definition3.js +1 -1
  116. package/shared/definition30.cjs +1 -1
  117. package/shared/definition30.js +1 -1
  118. package/shared/definition31.cjs +1 -1
  119. package/shared/definition31.js +1 -1
  120. package/shared/definition32.cjs +1 -1
  121. package/shared/definition32.js +1 -1
  122. package/shared/definition36.cjs +41 -30
  123. package/shared/definition36.js +34 -23
  124. package/shared/definition38.cjs +30 -23
  125. package/shared/definition38.js +30 -23
  126. package/shared/definition4.cjs +1 -1
  127. package/shared/definition4.js +1 -1
  128. package/shared/definition41.cjs +1 -1
  129. package/shared/definition41.js +1 -1
  130. package/shared/definition42.cjs +2 -2
  131. package/shared/definition42.js +2 -2
  132. package/shared/definition44.cjs +129 -117
  133. package/shared/definition44.js +130 -118
  134. package/shared/definition45.cjs +17 -7
  135. package/shared/definition45.js +17 -7
  136. package/shared/definition46.cjs +1 -1
  137. package/shared/definition46.js +1 -1
  138. package/shared/definition49.cjs +6 -6
  139. package/shared/definition49.js +6 -6
  140. package/shared/definition54.cjs +2 -2
  141. package/shared/definition54.js +2 -2
  142. package/shared/definition56.cjs +5 -4
  143. package/shared/definition56.js +5 -4
  144. package/shared/definition57.cjs +1 -1
  145. package/shared/definition57.js +1 -1
  146. package/shared/definition58.cjs +1 -1
  147. package/shared/definition58.js +1 -1
  148. package/shared/definition59.cjs +3 -1
  149. package/shared/definition59.js +3 -1
  150. package/shared/definition6.cjs +45 -12
  151. package/shared/definition6.js +45 -12
  152. package/shared/definition63.cjs +2 -2
  153. package/shared/definition63.js +2 -2
  154. package/shared/definition64.cjs +136 -38
  155. package/shared/definition64.js +136 -38
  156. package/shared/definition67.cjs +36 -15
  157. package/shared/definition67.js +37 -16
  158. package/shared/feedback/feedback-message.d.ts +1 -1
  159. package/shared/feedback/mixins.d.ts +2 -2
  160. package/shared/form-associated.cjs +4 -0
  161. package/shared/form-associated.js +4 -0
  162. package/shared/foundation/button/button.d.ts +1 -1
  163. package/shared/foundation/vivid-element/vivid-element.d.ts +2 -0
  164. package/shared/key-codes.js +1 -1
  165. package/shared/localization/Locale.d.ts +4 -0
  166. package/shared/mixins.cjs +4 -1
  167. package/shared/mixins.js +4 -1
  168. package/shared/patterns/affix.d.ts +2 -2
  169. package/shared/patterns/char-count/char-count.d.ts +1 -1
  170. package/shared/patterns/form-elements/with-success-text.d.ts +1 -1
  171. package/shared/patterns/linkable.d.ts +1 -1
  172. package/shared/patterns/localized.d.ts +1 -1
  173. package/shared/patterns/trapped-focus.d.ts +1 -1
  174. package/shared/picker-field/mixins/calendar-picker.d.ts +2 -2
  175. package/shared/picker-field/mixins/calendar-picker.locale.d.ts +5 -0
  176. package/shared/picker-field/mixins/calendar-picker.template.d.ts +2 -2
  177. package/shared/picker-field/mixins/calendar-segments/segment.d.ts +1 -0
  178. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +1 -1
  179. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +4 -4
  180. package/shared/picker-field/mixins/single-date-picker.d.ts +4 -4
  181. package/shared/picker-field/mixins/single-value-picker.d.ts +1 -1
  182. package/shared/picker-field/mixins/time-selection-picker.d.ts +2 -2
  183. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +2 -2
  184. package/shared/picker-field/picker-field.d.ts +3 -3
  185. package/shared/picker-field.template.cjs +13 -13
  186. package/shared/picker-field.template.js +13 -13
  187. package/shared/vivid-element.cjs +11 -1
  188. package/shared/vivid-element.js +11 -1
  189. package/styles/core/all.css +5 -5
  190. package/styles/core/theme.css +2 -2
  191. package/styles/core/typography.css +4 -4
  192. package/styles/fonts/spezia-variable.css +15 -15
  193. package/styles/tokens/theme-dark.css +4 -4
  194. package/styles/tokens/theme-light.css +4 -4
  195. package/styles/tokens/vivid-2-compat.css +1 -1
  196. package/vivid.api.json +395 -277
@@ -3,11 +3,12 @@
3
3
  const definition$1 = require('./definition28.cjs');
4
4
  const vividElement = require('./vivid-element.cjs');
5
5
  const definition = require('./definition66.cjs');
6
- const repeat = require('./repeat.cjs');
7
6
  const keyCodes = require('./key-codes.cjs');
7
+ const repeat = require('./repeat.cjs');
8
8
  const children = require('./children.cjs');
9
9
  const slotted = require('./slotted.cjs');
10
10
  const localized = require('./localized.cjs');
11
+ const classNames = require('./class-names.cjs');
11
12
  const when = require('./when.cjs');
12
13
 
13
14
  /**
@@ -21,9 +22,9 @@ const eventKeyDown = "keydown";
21
22
 
22
23
  const dataGridStyles = ":host{display:block}:host([generate-header=sticky]){max-block-size:400px}.base{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.base{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.base ::-webkit-scrollbar{width:4px}.base ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.base ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.base{position:relative;overflow:auto;block-size:inherit;inline-size:100%;max-block-size:inherit}";
23
24
 
24
- const dataGridRowStyles = ".base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-row-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-row-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-row-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-data-grid-row-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-data-grid-row-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-data-grid-row-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-row-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-row-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-row-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-row-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-data-grid-row-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-data-grid-row-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-data-grid-row-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-row-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:grid;width:100%;box-sizing:border-box;color:var(--vvd-color-canvas-text)}:host([row-type=sticky-header]) .base{position:sticky;z-index:9;top:0;background:var(--data-grid-row-background, var(--vvd-color-canvas))}:host([row-type=hidden-header]) .base{display:none}:host(:is([aria-selected]):not([row-type*=header])) .base{background-color:var(--_appearance-color-fill)}";
25
+ const dataGridRowStyles = ".base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-row-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-row-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-row-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-data-grid-row-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-data-grid-row-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-data-grid-row-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-row-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-row-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-row-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-row-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-data-grid-row-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-data-grid-row-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-data-grid-row-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-row-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:grid;width:100%;box-sizing:border-box;color:var(--vvd-color-canvas-text)}:host([row-type=sticky-header]) .base{position:sticky;z-index:9;top:0;background:var(--data-grid-row-background, var(--vvd-color-canvas))}:host([row-type=hidden-header]) .base{display:none}:host(:is([selected]):not([row-type*=header])) .base{background-color:var(--_appearance-color-fill)}";
25
26
 
26
- const dataGridCellStyles = ":host{block-size:100%;min-inline-size:80px}:host(:focus-visible){outline:none}.base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-cell-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-cell-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-cell-cta-firm, var(--vvd-color-cta-600));--_connotation-color-soft: var(--vvd-data-grid-cell-cta-soft, var(--vvd-color-cta-100));--_connotation-color-faint: var(--vvd-data-grid-cell-cta-faint, var(--vvd-color-cta-50));--_connotation-color-pale: var(--vvd-data-grid-cell-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-cell-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-cell-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-cell-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-cell-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-soft: var(--vvd-data-grid-cell-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-faint: var(--vvd-data-grid-cell-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-pale: var(--vvd-data-grid-cell-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-cell-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:flex;box-sizing:border-box;align-items:center;border-bottom:1px solid var(--vvd-color-neutral-300);block-size:var(--data-grid-cell-block-size, var(--_data-grid-cell-default-block-size));color:var(--_appearance-color-text);font:var(--vvd-typography-base);min-block-size:calc(1px*(48 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-block:13px 14px;padding-inline:12px}:host(:focus-visible) .base{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}:host([cell-type=columnheader]) .base{border-color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);--_data-grid-cell-default-block-size: calc(1px*(48 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_data-grid-cell-default-white-space: nowrap}:host(:not([cell-type=columnheader])) .base{--_data-grid-cell-default-block-size: 100%;--_data-grid-cell-default-white-space: normal}:host(:is([aria-selected]):not([cell-type=columnheader])) .base{background-color:var(--_appearance-color-fill)}slot{display:block;overflow:hidden;text-overflow:ellipsis;white-space:var(--data-grid-cell-white-space, var(--_data-grid-cell-default-white-space))}:host(:not([cell-type=columnheader][aria-sort])) slot{inline-size:100%}.header-icon{margin-inline-start:16px}";
27
+ const dataGridCellStyles = ":host{block-size:100%;min-inline-size:80px}:host(:focus-visible){outline:none}.base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-cell-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-cell-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-cell-cta-firm, var(--vvd-color-cta-600));--_connotation-color-soft: var(--vvd-data-grid-cell-cta-soft, var(--vvd-color-cta-100));--_connotation-color-faint: var(--vvd-data-grid-cell-cta-faint, var(--vvd-color-cta-50));--_connotation-color-pale: var(--vvd-data-grid-cell-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-cell-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-cell-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-cell-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-cell-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-soft: var(--vvd-data-grid-cell-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-faint: var(--vvd-data-grid-cell-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-pale: var(--vvd-data-grid-cell-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-cell-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:flex;box-sizing:border-box;align-items:center;border-bottom:1px solid var(--vvd-color-neutral-300);block-size:var(--data-grid-cell-block-size, var(--_data-grid-cell-default-block-size));color:var(--_appearance-color-text);font:var(--vvd-typography-base);min-block-size:calc(1px*(48 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-block:13px 14px;padding-inline:12px}:host(:focus-visible) .base{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}:host([cell-type=columnheader]) .base{border-color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);--_data-grid-cell-default-block-size: calc(1px*(48 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_data-grid-cell-default-white-space: nowrap}:host(:not([cell-type=columnheader])) .base{--_data-grid-cell-default-block-size: 100%;--_data-grid-cell-default-white-space: normal}:host(:is([selected]):not([cell-type=columnheader])) .base{background-color:var(--_appearance-color-fill)}slot{display:block;overflow:hidden;text-overflow:ellipsis;white-space:var(--data-grid-cell-white-space, var(--_data-grid-cell-default-white-space))}:host(:not([cell-type=columnheader][aria-sort])) slot{inline-size:100%}.header-icon{margin-inline-start:16px}";
27
28
 
28
29
  const DataGridCellSortStates = {
29
30
  none: "none",
@@ -52,13 +53,528 @@ const DataGridCellRole = {
52
53
  default: "gridcell"
53
54
  };
54
55
 
55
- var __defProp$2 = Object.defineProperty;
56
- var __decorateClass$2 = (decorators, target, key, kind) => {
56
+ var __defProp$2 = Object.defineProperty;
57
+ var __decorateClass$2 = (decorators, target, key, kind) => {
58
+ var result = void 0 ;
59
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
60
+ if (decorator = decorators[i])
61
+ result = (decorator(target, key, result) ) || result;
62
+ if (result) __defProp$2(target, key, result);
63
+ return result;
64
+ };
65
+ const defaultCellContentsTemplate = vividElement.html`
66
+ <template>
67
+ ${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
68
+ </template>
69
+ `;
70
+ const defaultHeaderCellContentsTemplate = vividElement.html`
71
+ <template>
72
+ ${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
73
+ </template>
74
+ `;
75
+ class DataGridCell extends localized.Localized(vividElement.VividElement) {
76
+ constructor() {
77
+ super(...arguments);
78
+ // eslint-disable-next-line @repo/repo/no-attribute-default-value
79
+ this.cellType = DataGridCellTypes.default;
80
+ this.rowData = null;
81
+ this.columnDefinition = null;
82
+ this.isActiveCell = false;
83
+ this.customCellView = null;
84
+ this.updateCellStyle = () => {
85
+ if (this.gridColumn && !this.gridColumn.includes("undefined")) {
86
+ this.style.gridColumn = this.gridColumn;
87
+ } else {
88
+ this.style.removeProperty("grid-column");
89
+ }
90
+ };
91
+ this._selectable = false;
92
+ this.selected = false;
93
+ this.ariaSelected = null;
94
+ this.ariaSort = null;
95
+ }
96
+ /**
97
+ * @internal
98
+ */
99
+ cellTypeChanged() {
100
+ if (this.$fastController.isConnected) {
101
+ this.updateCellView();
102
+ }
103
+ }
104
+ /**
105
+ * @internal
106
+ */
107
+ gridColumnChanged() {
108
+ if (this.$fastController.isConnected) {
109
+ this.updateCellStyle();
110
+ }
111
+ }
112
+ /**
113
+ * @internal
114
+ */
115
+ columnDefinitionChanged(_oldValue, _newValue) {
116
+ if (this.$fastController.isConnected) {
117
+ this.updateCellView();
118
+ }
119
+ }
120
+ /**
121
+ * @internal
122
+ */
123
+ connectedCallback() {
124
+ super.connectedCallback();
125
+ this.addEventListener(eventFocusIn, this.handleFocusin);
126
+ this.addEventListener(eventFocusOut, this.handleFocusout);
127
+ this.addEventListener(eventKeyDown, this.handleKeydown);
128
+ this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
129
+ this.updateCellView();
130
+ this.updateCellStyle();
131
+ }
132
+ /**
133
+ * @internal
134
+ */
135
+ disconnectedCallback() {
136
+ super.disconnectedCallback();
137
+ this.removeEventListener(eventFocusIn, this.handleFocusin);
138
+ this.removeEventListener(
139
+ eventFocusOut,
140
+ this.handleFocusout
141
+ );
142
+ this.removeEventListener(eventKeyDown, this.handleKeydown);
143
+ this.disconnectCellView();
144
+ }
145
+ handleFocusin(_) {
146
+ this.shadowRoot.querySelector(".base").classList.add("active");
147
+ if (this.isActiveCell) {
148
+ return;
149
+ }
150
+ this.isActiveCell = true;
151
+ switch (this.cellType) {
152
+ case DataGridCellTypes.columnHeader:
153
+ if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
154
+ const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
155
+ if (focusTarget !== null) {
156
+ focusTarget.focus();
157
+ }
158
+ }
159
+ break;
160
+ default:
161
+ if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
162
+ const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
163
+ if (focusTarget !== null) {
164
+ focusTarget.focus();
165
+ }
166
+ }
167
+ break;
168
+ }
169
+ this.$emit("cell-focused", this);
170
+ }
171
+ handleFocusout(_) {
172
+ this.shadowRoot.querySelector(".base").classList.remove("active");
173
+ if (this !== document.activeElement && !this.contains(document.activeElement)) {
174
+ this.isActiveCell = false;
175
+ }
176
+ }
177
+ handleKeydown(e) {
178
+ if (e.defaultPrevented || this.columnDefinition === null || this.cellType === DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) {
179
+ return;
180
+ }
181
+ switch (e.key) {
182
+ case keyCodes.keyEnter:
183
+ case keyCodes.keyFunction2:
184
+ if (this.contains(document.activeElement) && document.activeElement !== this) {
185
+ return;
186
+ }
187
+ switch (this.cellType) {
188
+ case DataGridCellTypes.columnHeader:
189
+ if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
190
+ const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
191
+ if (focusTarget !== null) {
192
+ focusTarget.focus();
193
+ }
194
+ e.preventDefault();
195
+ }
196
+ break;
197
+ default:
198
+ if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
199
+ const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
200
+ if (focusTarget !== null) {
201
+ focusTarget.focus();
202
+ }
203
+ e.preventDefault();
204
+ }
205
+ break;
206
+ }
207
+ break;
208
+ case keyCodes.keyEscape:
209
+ if (this.contains(document.activeElement) && document.activeElement !== this) {
210
+ this.focus();
211
+ e.preventDefault();
212
+ }
213
+ break;
214
+ }
215
+ }
216
+ updateCellView() {
217
+ this.disconnectCellView();
218
+ if (this.columnDefinition === null) {
219
+ return;
220
+ }
221
+ switch (this.cellType) {
222
+ case DataGridCellTypes.columnHeader:
223
+ if (this.columnDefinition.headerCellTemplate !== void 0) {
224
+ this.customCellView = this.columnDefinition.headerCellTemplate.render(
225
+ this,
226
+ this
227
+ );
228
+ } else {
229
+ this.customCellView = defaultHeaderCellContentsTemplate.render(
230
+ this,
231
+ this
232
+ );
233
+ }
234
+ break;
235
+ case DataGridCellTypes.rowHeader:
236
+ case DataGridCellTypes.default:
237
+ if (this.columnDefinition.cellTemplate !== void 0) {
238
+ this.customCellView = this.columnDefinition.cellTemplate.render(
239
+ this,
240
+ this
241
+ );
242
+ } else {
243
+ this.customCellView = defaultCellContentsTemplate.render(this, this);
244
+ }
245
+ break;
246
+ }
247
+ if (!this.columnDefinition?.sortable) {
248
+ this.sortDirection = void 0;
249
+ } else if (this.columnDefinition.sortDirection) {
250
+ this.sortDirection = this.columnDefinition.sortDirection;
251
+ } else {
252
+ this.sortDirection = DataGridCellSortStates.none;
253
+ }
254
+ }
255
+ disconnectCellView() {
256
+ if (this.customCellView !== null) {
257
+ this.customCellView.dispose();
258
+ this.customCellView = null;
259
+ }
260
+ }
261
+ /**
262
+ *
263
+ * @private
264
+ */
265
+ calculateAriaSelectedValue() {
266
+ if (this._selectable && this.selected) return "true";
267
+ if (this._selectable && !this.selected) return "false";
268
+ return null;
269
+ }
270
+ /**
271
+ * @internal
272
+ */
273
+ _selectableChanged() {
274
+ this.ariaSelected = this.calculateAriaSelectedValue();
275
+ }
276
+ /**
277
+ * @internal
278
+ */
279
+ selectedChanged() {
280
+ this.ariaSelected = this.calculateAriaSelectedValue();
281
+ }
282
+ /**
283
+ * @internal
284
+ */
285
+ ariaSelectedChanged(_, newValue) {
286
+ this._selectable = newValue !== null;
287
+ this.selected = newValue === "true";
288
+ }
289
+ /**
290
+ * @internal
291
+ */
292
+ ariaSortChanged(_oldValue, newValue) {
293
+ if (newValue === null) {
294
+ this.sortDirection = void 0;
295
+ return;
296
+ }
297
+ this.sortDirection = newValue;
298
+ }
299
+ /**
300
+ * @internal
301
+ */
302
+ sortDirectionChanged(_oldValue, newValue) {
303
+ if (newValue === void 0) {
304
+ this.ariaSort = null;
305
+ return;
306
+ }
307
+ this.ariaSort = newValue;
308
+ }
309
+ #getColumnDataKey() {
310
+ return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
311
+ }
312
+ /**
313
+ * @internal
314
+ */
315
+ _handleInteraction() {
316
+ const isHeaderCell = this.cellType === "columnheader";
317
+ const isSortable = isHeaderCell && this.sortDirection !== void 0;
318
+ if (isSortable) {
319
+ this.$emit("sort", {
320
+ columnDataKey: this.#getColumnDataKey(),
321
+ sortDirection: this.sortDirection
322
+ });
323
+ }
324
+ const hasInternalFocusQueue = isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue;
325
+ if (!hasInternalFocusQueue) {
326
+ this.$emit("cell-click", {
327
+ cell: this,
328
+ row: this.parentElement,
329
+ isHeaderCell,
330
+ columnDataKey: this.#getColumnDataKey()
331
+ });
332
+ }
333
+ return true;
334
+ }
335
+ }
336
+ __decorateClass$2([
337
+ vividElement.attr({ attribute: "cell-type" })
338
+ ], DataGridCell.prototype, "cellType");
339
+ __decorateClass$2([
340
+ vividElement.attr({ attribute: "grid-column" })
341
+ ], DataGridCell.prototype, "gridColumn");
342
+ __decorateClass$2([
343
+ vividElement.observable
344
+ ], DataGridCell.prototype, "rowData");
345
+ __decorateClass$2([
346
+ vividElement.observable
347
+ ], DataGridCell.prototype, "columnDefinition");
348
+ __decorateClass$2([
349
+ vividElement.observable
350
+ ], DataGridCell.prototype, "_selectable");
351
+ __decorateClass$2([
352
+ vividElement.attr({ mode: "boolean" })
353
+ ], DataGridCell.prototype, "selected");
354
+ __decorateClass$2([
355
+ vividElement.attr({ attribute: "aria-selected", mode: "fromView" })
356
+ ], DataGridCell.prototype, "ariaSelected");
357
+ __decorateClass$2([
358
+ vividElement.attr({ attribute: "aria-sort" })
359
+ ], DataGridCell.prototype, "ariaSort");
360
+ __decorateClass$2([
361
+ vividElement.attr({ attribute: "sort-direction" })
362
+ ], DataGridCell.prototype, "sortDirection");
363
+
364
+ var __defProp$1 = Object.defineProperty;
365
+ var __decorateClass$1 = (decorators, target, key, kind) => {
366
+ var result = void 0 ;
367
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
368
+ if (decorator = decorators[i])
369
+ result = (decorator(target, key, result) ) || result;
370
+ if (result) __defProp$1(target, key, result);
371
+ return result;
372
+ };
373
+ class DataGridRow extends vividElement.VividElement {
374
+ constructor() {
375
+ super(...arguments);
376
+ // eslint-disable-next-line @repo/repo/no-attribute-default-value
377
+ this.rowType = DataGridRowTypes.default;
378
+ this.rowData = null;
379
+ this.columnDefinitions = null;
380
+ this.cellsRepeatBehavior = null;
381
+ this.cellsPlaceholder = null;
382
+ /**
383
+ * @internal
384
+ */
385
+ this.focusColumnIndex = 0;
386
+ this.updateRowStyle = () => {
387
+ this.style.gridTemplateColumns = this.gridTemplateColumns;
388
+ };
389
+ this.ariaSelected = null;
390
+ this._selectable = false;
391
+ this.selected = false;
392
+ }
393
+ /**
394
+ * @internal
395
+ */
396
+ gridTemplateColumnsChanged() {
397
+ if (this.$fastController.isConnected) {
398
+ this.updateRowStyle();
399
+ }
400
+ }
401
+ /**
402
+ * @internal
403
+ */
404
+ rowTypeChanged() {
405
+ if (this.$fastController.isConnected) {
406
+ this.updateItemTemplate();
407
+ }
408
+ }
409
+ /**
410
+ * @internal
411
+ */
412
+ cellItemTemplateChanged() {
413
+ this.updateItemTemplate();
414
+ }
415
+ /**
416
+ * @internal
417
+ */
418
+ headerCellItemTemplateChanged() {
419
+ this.updateItemTemplate();
420
+ }
421
+ /**
422
+ * @internal
423
+ */
424
+ connectedCallback() {
425
+ super.connectedCallback();
426
+ if (this.cellsRepeatBehavior === null) {
427
+ this.cellsPlaceholder = document.createComment("");
428
+ this.appendChild(this.cellsPlaceholder);
429
+ this.updateItemTemplate();
430
+ this.cellsRepeatBehavior = new repeat.RepeatDirective(
431
+ (x) => x.columnDefinitions,
432
+ (x) => x.activeCellItemTemplate,
433
+ { positioning: true }
434
+ ).createBehavior(this.cellsPlaceholder);
435
+ this.$fastController.addBehaviors([this.cellsRepeatBehavior]);
436
+ }
437
+ this.addEventListener("cell-focused", this.handleCellFocus);
438
+ this.addEventListener(eventFocusOut, this.handleFocusout);
439
+ this.addEventListener(eventKeyDown, this.handleKeydown);
440
+ this.updateRowStyle();
441
+ }
442
+ /**
443
+ * @internal
444
+ */
445
+ disconnectedCallback() {
446
+ super.disconnectedCallback();
447
+ this.removeEventListener("cell-focused", this.handleCellFocus);
448
+ this.removeEventListener(
449
+ eventFocusOut,
450
+ this.handleFocusout
451
+ );
452
+ this.removeEventListener(eventKeyDown, this.handleKeydown);
453
+ }
454
+ handleFocusout(_) {
455
+ if (!this.contains(document.activeElement)) {
456
+ this.focusColumnIndex = 0;
457
+ }
458
+ }
459
+ handleCellFocus(e) {
460
+ this.focusColumnIndex = this.cellElements.indexOf(e.target);
461
+ this.$emit("row-focused", this);
462
+ }
463
+ handleKeydown(e) {
464
+ if (e.defaultPrevented) {
465
+ return;
466
+ }
467
+ let newFocusColumnIndex = 0;
468
+ switch (e.key) {
469
+ case keyCodes.keyArrowLeft:
470
+ newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
471
+ this.cellElements[newFocusColumnIndex].focus();
472
+ e.preventDefault();
473
+ break;
474
+ case keyCodes.keyArrowRight:
475
+ newFocusColumnIndex = Math.min(
476
+ this.cellElements.length - 1,
477
+ this.focusColumnIndex + 1
478
+ );
479
+ this.cellElements[newFocusColumnIndex].focus();
480
+ e.preventDefault();
481
+ break;
482
+ case keyCodes.keyHome:
483
+ if (!e.ctrlKey) {
484
+ this.cellElements[0].focus();
485
+ e.preventDefault();
486
+ }
487
+ break;
488
+ case keyCodes.keyEnd:
489
+ if (!e.ctrlKey) {
490
+ this.cellElements[this.cellElements.length - 1].focus();
491
+ e.preventDefault();
492
+ }
493
+ break;
494
+ }
495
+ }
496
+ updateItemTemplate() {
497
+ this.activeCellItemTemplate = this.rowType === DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
498
+ }
499
+ /**
500
+ * @internal
501
+ */
502
+ ariaSelectedChanged(_oldValue, newValue) {
503
+ this._selectable = newValue !== null;
504
+ this.selected = newValue === "true";
505
+ }
506
+ /**
507
+ * @internal
508
+ */
509
+ _calculateAriaSelectedValue() {
510
+ if (this._selectable && this.selected) return "true";
511
+ if (this._selectable && !this.selected) return "false";
512
+ return null;
513
+ }
514
+ /**
515
+ * @internal
516
+ */
517
+ _selectableChanged() {
518
+ this.ariaSelected = this._calculateAriaSelectedValue();
519
+ }
520
+ /**
521
+ * @internal
522
+ */
523
+ selectedChanged() {
524
+ this.ariaSelected = this._calculateAriaSelectedValue();
525
+ }
526
+ }
527
+ // @ts-expect-error Type is incorrectly non-optional
528
+ __decorateClass$1([
529
+ vividElement.attr({ attribute: "grid-template-columns" })
530
+ ], DataGridRow.prototype, "gridTemplateColumns");
531
+ __decorateClass$1([
532
+ vividElement.attr({ attribute: "row-type" })
533
+ ], DataGridRow.prototype, "rowType");
534
+ __decorateClass$1([
535
+ vividElement.observable
536
+ ], DataGridRow.prototype, "rowData");
537
+ __decorateClass$1([
538
+ vividElement.observable
539
+ ], DataGridRow.prototype, "columnDefinitions");
540
+ __decorateClass$1([
541
+ vividElement.observable
542
+ ], DataGridRow.prototype, "cellItemTemplate");
543
+ __decorateClass$1([
544
+ vividElement.observable
545
+ ], DataGridRow.prototype, "headerCellItemTemplate");
546
+ __decorateClass$1([
547
+ vividElement.observable
548
+ ], DataGridRow.prototype, "rowIndex");
549
+ __decorateClass$1([
550
+ vividElement.observable
551
+ ], DataGridRow.prototype, "activeCellItemTemplate");
552
+ __decorateClass$1([
553
+ vividElement.observable
554
+ ], DataGridRow.prototype, "defaultCellItemTemplate");
555
+ __decorateClass$1([
556
+ vividElement.observable
557
+ ], DataGridRow.prototype, "defaultHeaderCellItemTemplate");
558
+ __decorateClass$1([
559
+ vividElement.observable
560
+ ], DataGridRow.prototype, "cellElements");
561
+ __decorateClass$1([
562
+ vividElement.attr({ attribute: "aria-selected" })
563
+ ], DataGridRow.prototype, "ariaSelected");
564
+ __decorateClass$1([
565
+ vividElement.observable
566
+ ], DataGridRow.prototype, "_selectable");
567
+ __decorateClass$1([
568
+ vividElement.attr({ mode: "boolean" })
569
+ ], DataGridRow.prototype, "selected");
570
+
571
+ var __defProp = Object.defineProperty;
572
+ var __decorateClass = (decorators, target, key, kind) => {
57
573
  var result = void 0 ;
58
574
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
59
575
  if (decorator = decorators[i])
60
576
  result = (decorator(target, key, result) ) || result;
61
- if (result) __defProp$2(target, key, result);
577
+ if (result) __defProp(target, key, result);
62
578
  return result;
63
579
  };
64
580
  const DataGridSelectionMode = {
@@ -72,7 +588,7 @@ const _DataGrid = class _DataGrid extends vividElement.VividElement {
72
588
  constructor() {
73
589
  super();
74
590
  this.noTabbing = false;
75
- // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
591
+ // eslint-disable-next-line @repo/repo/no-attribute-default-value
76
592
  this.generateHeader = GenerateHeaderOptions.default;
77
593
  this.rowsData = [];
78
594
  this.columnDefinitions = null;
@@ -98,7 +614,7 @@ const _DataGrid = class _DataGrid extends vividElement.VividElement {
98
614
  );
99
615
  const focusRow = this.rowElements[focusRowIndex];
100
616
  const cells = focusRow.querySelectorAll(
101
- '[role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"]'
617
+ '[role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"], [cell-type]'
102
618
  );
103
619
  const focusColumnIndex = Math.max(
104
620
  0,
@@ -173,11 +689,11 @@ const _DataGrid = class _DataGrid extends vividElement.VividElement {
173
689
  }) => {
174
690
  const cell = target;
175
691
  if (this.selectionMode === DataGridSelectionMode.multiCell && (ctrlKey || shiftKey || metaKey)) {
176
- this.#setSelectedState(cell, !this.#selectedCells.includes(cell));
692
+ cell.selected = !this.#selectedCells.includes(cell);
177
693
  } else {
178
- const cacheTargetSelection = cell.getAttribute("aria-selected") === "true";
179
- this.#resetSelection();
180
- this.#setSelectedState(cell, !cacheTargetSelection);
694
+ const cacheTargetSelection = cell.selected;
695
+ this._resetSelection(true);
696
+ cell.selected = !cacheTargetSelection;
181
697
  }
182
698
  };
183
699
  this.#handleRowSelection = ({
@@ -188,11 +704,11 @@ const _DataGrid = class _DataGrid extends vividElement.VividElement {
188
704
  }) => {
189
705
  const row = target.parentNode;
190
706
  if (this.selectionMode === DataGridSelectionMode.multiRow && (ctrlKey || shiftKey || metaKey)) {
191
- this.#setSelectedState(row, !this.#selectedRows.includes(row));
707
+ row.selected = !this.#selectedRows.includes(row);
192
708
  } else {
193
- const cacheTargetSelection = row.getAttribute("aria-selected") === "true";
194
- this.#resetSelection();
195
- this.#setSelectedState(row, !cacheTargetSelection);
709
+ const cacheTargetSelection = row.selected;
710
+ this._resetSelection(true);
711
+ row.selected = !cacheTargetSelection;
196
712
  }
197
713
  };
198
714
  this.#changeHandler = {
@@ -204,59 +720,41 @@ const _DataGrid = class _DataGrid extends vividElement.VividElement {
204
720
  }
205
721
  }
206
722
  };
207
- this.#setSelectedState = (cell, selectedState) => {
208
- cell.setAttribute("aria-selected", selectedState.toString());
209
- };
210
- this.#resetSelection = () => {
211
- if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
212
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
213
- (cell) => this.#setSelectedState(cell, false)
214
- );
215
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
216
- (row) => row.removeAttribute("aria-selected")
217
- );
218
- }
219
- if (this.selectionMode === DataGridSelectionMode.none) {
220
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
221
- (cell) => cell.removeAttribute("aria-selected")
222
- );
223
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
224
- (row) => row.removeAttribute("aria-selected")
225
- );
226
- }
227
- if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
228
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
229
- (cell) => cell.removeAttribute("aria-selected")
230
- );
231
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
232
- (row) => row.setAttribute("aria-selected", "false")
233
- );
234
- }
235
- };
236
- this.#initSelections = () => {
723
+ /**
724
+ * @internal
725
+ */
726
+ this._resetSelection = (clear = false) => {
727
+ const cells = Array.from(
728
+ this.querySelectorAll('[role="gridcell"], [cell-type]')
729
+ );
730
+ const rows = Array.from(
731
+ this.querySelectorAll('[role="row"], [row-type]')
732
+ );
237
733
  if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
238
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
239
- (cell) => !cell.hasAttribute("aria-selected") && this.#setSelectedState(cell, false)
240
- );
241
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
242
- (row) => row.removeAttribute("aria-selected")
243
- );
734
+ for (const cell of cells) {
735
+ cell._selectable = true;
736
+ cell.selected = clear ? false : cell.selected || false;
737
+ }
738
+ for (const row of rows) {
739
+ row._selectable = false;
740
+ row.selected = false;
741
+ }
244
742
  }
245
743
  if (this.selectionMode === DataGridSelectionMode.none) {
246
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
247
- (cell) => cell.removeAttribute("aria-selected")
248
- );
249
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
250
- (row) => row.removeAttribute("aria-selected")
251
- );
744
+ for (const element of [...cells, ...rows]) {
745
+ element._selectable = false;
746
+ element.selected = false;
747
+ }
252
748
  }
253
749
  if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
254
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
255
- (cell) => cell.removeAttribute("aria-selected")
256
- );
257
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
258
- (row) => !row.hasAttribute("aria-selected") && row.setAttribute("aria-selected", "false")
259
- );
750
+ for (const cell of cells) {
751
+ cell._selectable = false;
752
+ cell.selected = false;
753
+ }
754
+ for (const row of rows) {
755
+ row._selectable = true;
756
+ row.selected = clear ? false : row.selected || false;
757
+ }
260
758
  }
261
759
  };
262
760
  this.addEventListener("click", this.#handleClick);
@@ -550,37 +1048,32 @@ const _DataGrid = class _DataGrid extends vividElement.VividElement {
550
1048
  * @internal
551
1049
  */
552
1050
  slottedRowElementsChanged(_oldValue, _newValue) {
553
- this.#initSelections();
1051
+ this._resetSelection();
554
1052
  }
555
1053
  get #selectedRows() {
556
- return this.rowElements.filter(
557
- (row) => row.getAttribute("aria-selected") === "true"
558
- );
1054
+ return this.rowElements.filter((row) => row.selected);
559
1055
  }
560
1056
  get #selectedCells() {
561
1057
  return this.rowElements.reduce((acc, row) => {
562
1058
  const rowChildren = Array.from(row.children);
563
1059
  const selectedCells = rowChildren.filter(
564
- (cell) => cell.getAttribute("aria-selected") === "true"
1060
+ (cell) => cell.selected
565
1061
  );
566
1062
  return acc.concat(selectedCells);
567
1063
  }, []);
568
1064
  }
569
1065
  selectionModeChanged(oldValue) {
570
1066
  if (oldValue === void 0) {
571
- vividElement.DOM.queueUpdate(this.#initSelections);
1067
+ vividElement.DOM.queueUpdate(this._resetSelection);
572
1068
  return;
573
1069
  }
574
- this.#resetSelection();
1070
+ this._resetSelection(true);
575
1071
  }
576
1072
  #handleKeypress;
577
1073
  #handleClick;
578
1074
  #handleCellSelection;
579
1075
  #handleRowSelection;
580
1076
  #changeHandler;
581
- #setSelectedState;
582
- #resetSelection;
583
- #initSelections;
584
1077
  static generateColumns(rowData) {
585
1078
  return Object.keys(rowData).map((property, index) => {
586
1079
  return {
@@ -590,225 +1083,53 @@ const _DataGrid = class _DataGrid extends vividElement.VividElement {
590
1083
  });
591
1084
  }
592
1085
  };
593
- __decorateClass$2([
1086
+ __decorateClass([
594
1087
  vividElement.attr({ attribute: "no-tabbing", mode: "boolean" })
595
1088
  ], _DataGrid.prototype, "noTabbing");
596
- __decorateClass$2([
1089
+ __decorateClass([
597
1090
  vividElement.attr({ attribute: "generate-header" })
598
1091
  ], _DataGrid.prototype, "generateHeader");
599
1092
  // @ts-expect-error Type is incorrectly non-optional
600
- __decorateClass$2([
1093
+ __decorateClass([
601
1094
  vividElement.attr({ attribute: "grid-template-columns" })
602
1095
  ], _DataGrid.prototype, "gridTemplateColumns");
603
- __decorateClass$2([
1096
+ __decorateClass([
604
1097
  vividElement.observable
605
1098
  ], _DataGrid.prototype, "rowsData");
606
- __decorateClass$2([
1099
+ __decorateClass([
607
1100
  vividElement.observable
608
1101
  ], _DataGrid.prototype, "columnDefinitions");
609
- __decorateClass$2([
1102
+ __decorateClass([
610
1103
  vividElement.observable
611
1104
  ], _DataGrid.prototype, "rowItemTemplate");
612
- __decorateClass$2([
1105
+ __decorateClass([
613
1106
  vividElement.observable
614
1107
  ], _DataGrid.prototype, "cellItemTemplate");
615
- __decorateClass$2([
1108
+ __decorateClass([
616
1109
  vividElement.observable
617
1110
  ], _DataGrid.prototype, "headerCellItemTemplate");
618
- __decorateClass$2([
1111
+ __decorateClass([
619
1112
  vividElement.observable
620
1113
  ], _DataGrid.prototype, "focusRowIndex");
621
- __decorateClass$2([
1114
+ __decorateClass([
622
1115
  vividElement.observable
623
1116
  ], _DataGrid.prototype, "focusColumnIndex");
624
- __decorateClass$2([
1117
+ __decorateClass([
625
1118
  vividElement.observable
626
1119
  ], _DataGrid.prototype, "defaultRowItemTemplate");
627
- __decorateClass$2([
1120
+ __decorateClass([
628
1121
  vividElement.observable
629
1122
  ], _DataGrid.prototype, "rowElementTag");
630
- __decorateClass$2([
1123
+ __decorateClass([
631
1124
  vividElement.observable
632
1125
  ], _DataGrid.prototype, "rowElements");
633
- __decorateClass$2([
634
- vividElement.observable
635
- ], _DataGrid.prototype, "slottedRowElements");
636
- __decorateClass$2([
637
- vividElement.attr({ attribute: "selection-mode" })
638
- ], _DataGrid.prototype, "selectionMode");
639
- let DataGrid = _DataGrid;
640
-
641
- var __defProp$1 = Object.defineProperty;
642
- var __decorateClass$1 = (decorators, target, key, kind) => {
643
- var result = void 0 ;
644
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
645
- if (decorator = decorators[i])
646
- result = (decorator(target, key, result) ) || result;
647
- if (result) __defProp$1(target, key, result);
648
- return result;
649
- };
650
- class DataGridRow extends vividElement.VividElement {
651
- constructor() {
652
- super(...arguments);
653
- // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
654
- this.rowType = DataGridRowTypes.default;
655
- this.rowData = null;
656
- this.columnDefinitions = null;
657
- this.cellsRepeatBehavior = null;
658
- this.cellsPlaceholder = null;
659
- /**
660
- * @internal
661
- */
662
- this.focusColumnIndex = 0;
663
- this.updateRowStyle = () => {
664
- this.style.gridTemplateColumns = this.gridTemplateColumns;
665
- };
666
- this.ariaSelected = null;
667
- }
668
- /**
669
- * @internal
670
- */
671
- gridTemplateColumnsChanged() {
672
- if (this.$fastController.isConnected) {
673
- this.updateRowStyle();
674
- }
675
- }
676
- /**
677
- * @internal
678
- */
679
- rowTypeChanged() {
680
- if (this.$fastController.isConnected) {
681
- this.updateItemTemplate();
682
- }
683
- }
684
- /**
685
- * @internal
686
- */
687
- cellItemTemplateChanged() {
688
- this.updateItemTemplate();
689
- }
690
- /**
691
- * @internal
692
- */
693
- headerCellItemTemplateChanged() {
694
- this.updateItemTemplate();
695
- }
696
- /**
697
- * @internal
698
- */
699
- connectedCallback() {
700
- super.connectedCallback();
701
- if (this.cellsRepeatBehavior === null) {
702
- this.cellsPlaceholder = document.createComment("");
703
- this.appendChild(this.cellsPlaceholder);
704
- this.updateItemTemplate();
705
- this.cellsRepeatBehavior = new repeat.RepeatDirective(
706
- (x) => x.columnDefinitions,
707
- (x) => x.activeCellItemTemplate,
708
- { positioning: true }
709
- ).createBehavior(this.cellsPlaceholder);
710
- this.$fastController.addBehaviors([this.cellsRepeatBehavior]);
711
- }
712
- this.addEventListener("cell-focused", this.handleCellFocus);
713
- this.addEventListener(eventFocusOut, this.handleFocusout);
714
- this.addEventListener(eventKeyDown, this.handleKeydown);
715
- this.updateRowStyle();
716
- }
717
- /**
718
- * @internal
719
- */
720
- disconnectedCallback() {
721
- super.disconnectedCallback();
722
- this.removeEventListener("cell-focused", this.handleCellFocus);
723
- this.removeEventListener(
724
- eventFocusOut,
725
- this.handleFocusout
726
- );
727
- this.removeEventListener(eventKeyDown, this.handleKeydown);
728
- }
729
- handleFocusout(_) {
730
- if (!this.contains(document.activeElement)) {
731
- this.focusColumnIndex = 0;
732
- }
733
- }
734
- handleCellFocus(e) {
735
- this.focusColumnIndex = this.cellElements.indexOf(e.target);
736
- this.$emit("row-focused", this);
737
- }
738
- handleKeydown(e) {
739
- if (e.defaultPrevented) {
740
- return;
741
- }
742
- let newFocusColumnIndex = 0;
743
- switch (e.key) {
744
- case keyCodes.keyArrowLeft:
745
- newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
746
- this.cellElements[newFocusColumnIndex].focus();
747
- e.preventDefault();
748
- break;
749
- case keyCodes.keyArrowRight:
750
- newFocusColumnIndex = Math.min(
751
- this.cellElements.length - 1,
752
- this.focusColumnIndex + 1
753
- );
754
- this.cellElements[newFocusColumnIndex].focus();
755
- e.preventDefault();
756
- break;
757
- case keyCodes.keyHome:
758
- if (!e.ctrlKey) {
759
- this.cellElements[0].focus();
760
- e.preventDefault();
761
- }
762
- break;
763
- case keyCodes.keyEnd:
764
- if (!e.ctrlKey) {
765
- this.cellElements[this.cellElements.length - 1].focus();
766
- e.preventDefault();
767
- }
768
- break;
769
- }
770
- }
771
- updateItemTemplate() {
772
- this.activeCellItemTemplate = this.rowType === DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
773
- }
774
- }
775
- // @ts-expect-error Type is incorrectly non-optional
776
- __decorateClass$1([
777
- vividElement.attr({ attribute: "grid-template-columns" })
778
- ], DataGridRow.prototype, "gridTemplateColumns");
779
- __decorateClass$1([
780
- vividElement.attr({ attribute: "row-type" })
781
- ], DataGridRow.prototype, "rowType");
782
- __decorateClass$1([
783
- vividElement.observable
784
- ], DataGridRow.prototype, "rowData");
785
- __decorateClass$1([
786
- vividElement.observable
787
- ], DataGridRow.prototype, "columnDefinitions");
788
- __decorateClass$1([
789
- vividElement.observable
790
- ], DataGridRow.prototype, "cellItemTemplate");
791
- __decorateClass$1([
792
- vividElement.observable
793
- ], DataGridRow.prototype, "headerCellItemTemplate");
794
- __decorateClass$1([
795
- vividElement.observable
796
- ], DataGridRow.prototype, "rowIndex");
797
- __decorateClass$1([
798
- vividElement.observable
799
- ], DataGridRow.prototype, "activeCellItemTemplate");
800
- __decorateClass$1([
801
- vividElement.observable
802
- ], DataGridRow.prototype, "defaultCellItemTemplate");
803
- __decorateClass$1([
804
- vividElement.observable
805
- ], DataGridRow.prototype, "defaultHeaderCellItemTemplate");
806
- __decorateClass$1([
1126
+ __decorateClass([
807
1127
  vividElement.observable
808
- ], DataGridRow.prototype, "cellElements");
809
- __decorateClass$1([
810
- vividElement.attr({ attribute: "aria-selected" })
811
- ], DataGridRow.prototype, "ariaSelected");
1128
+ ], _DataGrid.prototype, "slottedRowElements");
1129
+ __decorateClass([
1130
+ vividElement.attr({ attribute: "selection-mode" })
1131
+ ], _DataGrid.prototype, "selectionMode");
1132
+ let DataGrid = _DataGrid;
812
1133
 
813
1134
  function createRowItemTemplate(context) {
814
1135
  const rowTag = context.tagFor(DataGridRow);
@@ -828,6 +1149,9 @@ function setHeaderRow(x) {
828
1149
  const headerRow = x.querySelector(
829
1150
  '[cell-type="columnheader"]'
830
1151
  )?.parentElement;
1152
+ if (x.generateHeader === GenerateHeaderOptions.default && (headerRow?.getAttribute("row-type") === DataGridRowTypes.header || headerRow?.getAttribute("row-type") === DataGridRowTypes.stickyHeader)) {
1153
+ return;
1154
+ }
831
1155
  if (headerRow) {
832
1156
  const rowType = x.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : DataGridRowTypes.header;
833
1157
  headerRow.setAttribute("row-type", rowType);
@@ -861,255 +1185,6 @@ const DataGridTemplate = (context) => {
861
1185
  `;
862
1186
  };
863
1187
 
864
- var __defProp = Object.defineProperty;
865
- var __decorateClass = (decorators, target, key, kind) => {
866
- var result = void 0 ;
867
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
868
- if (decorator = decorators[i])
869
- result = (decorator(target, key, result) ) || result;
870
- if (result) __defProp(target, key, result);
871
- return result;
872
- };
873
- const defaultCellContentsTemplate = vividElement.html`
874
- <template>
875
- ${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
876
- </template>
877
- `;
878
- const defaultHeaderCellContentsTemplate = vividElement.html`
879
- <template>
880
- ${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
881
- </template>
882
- `;
883
- class DataGridCell extends localized.Localized(vividElement.VividElement) {
884
- constructor() {
885
- super(...arguments);
886
- // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
887
- this.cellType = DataGridCellTypes.default;
888
- this.rowData = null;
889
- this.columnDefinition = null;
890
- this.isActiveCell = false;
891
- this.customCellView = null;
892
- this.updateCellStyle = () => {
893
- if (this.gridColumn && !this.gridColumn.includes("undefined")) {
894
- this.style.gridColumn = this.gridColumn;
895
- } else {
896
- this.style.removeProperty("grid-column");
897
- }
898
- };
899
- this.ariaSelected = null;
900
- this.ariaSort = null;
901
- }
902
- /**
903
- * @internal
904
- */
905
- cellTypeChanged() {
906
- if (this.$fastController.isConnected) {
907
- this.updateCellView();
908
- }
909
- }
910
- /**
911
- * @internal
912
- */
913
- gridColumnChanged() {
914
- if (this.$fastController.isConnected) {
915
- this.updateCellStyle();
916
- }
917
- }
918
- /**
919
- * @internal
920
- */
921
- columnDefinitionChanged(_oldValue, _newValue) {
922
- if (this.$fastController.isConnected) {
923
- this.updateCellView();
924
- }
925
- }
926
- /**
927
- * @internal
928
- */
929
- connectedCallback() {
930
- super.connectedCallback();
931
- this.addEventListener(eventFocusIn, this.handleFocusin);
932
- this.addEventListener(eventFocusOut, this.handleFocusout);
933
- this.addEventListener(eventKeyDown, this.handleKeydown);
934
- this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
935
- this.updateCellView();
936
- this.updateCellStyle();
937
- this.ariaSelectedChanged(null, this.ariaSelected);
938
- }
939
- /**
940
- * @internal
941
- */
942
- disconnectedCallback() {
943
- super.disconnectedCallback();
944
- this.removeEventListener(eventFocusIn, this.handleFocusin);
945
- this.removeEventListener(
946
- eventFocusOut,
947
- this.handleFocusout
948
- );
949
- this.removeEventListener(eventKeyDown, this.handleKeydown);
950
- this.disconnectCellView();
951
- }
952
- handleFocusin(_) {
953
- this.shadowRoot.querySelector(".base").classList.add("active");
954
- if (this.isActiveCell) {
955
- return;
956
- }
957
- this.isActiveCell = true;
958
- switch (this.cellType) {
959
- case DataGridCellTypes.columnHeader:
960
- if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
961
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
962
- if (focusTarget !== null) {
963
- focusTarget.focus();
964
- }
965
- }
966
- break;
967
- default:
968
- if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
969
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
970
- if (focusTarget !== null) {
971
- focusTarget.focus();
972
- }
973
- }
974
- break;
975
- }
976
- this.$emit("cell-focused", this);
977
- }
978
- handleFocusout(_) {
979
- this.shadowRoot.querySelector(".base").classList.remove("active");
980
- if (this !== document.activeElement && !this.contains(document.activeElement)) {
981
- this.isActiveCell = false;
982
- }
983
- }
984
- handleKeydown(e) {
985
- if (e.defaultPrevented || this.columnDefinition === null || this.cellType === DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) {
986
- return;
987
- }
988
- switch (e.key) {
989
- case keyCodes.keyEnter:
990
- case keyCodes.keyFunction2:
991
- if (this.contains(document.activeElement) && document.activeElement !== this) {
992
- return;
993
- }
994
- switch (this.cellType) {
995
- case DataGridCellTypes.columnHeader:
996
- if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
997
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
998
- if (focusTarget !== null) {
999
- focusTarget.focus();
1000
- }
1001
- e.preventDefault();
1002
- }
1003
- break;
1004
- default:
1005
- if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
1006
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1007
- if (focusTarget !== null) {
1008
- focusTarget.focus();
1009
- }
1010
- e.preventDefault();
1011
- }
1012
- break;
1013
- }
1014
- break;
1015
- case keyCodes.keyEscape:
1016
- if (this.contains(document.activeElement) && document.activeElement !== this) {
1017
- this.focus();
1018
- e.preventDefault();
1019
- }
1020
- break;
1021
- }
1022
- }
1023
- updateCellView() {
1024
- this.disconnectCellView();
1025
- if (this.columnDefinition === null) {
1026
- return;
1027
- }
1028
- switch (this.cellType) {
1029
- case DataGridCellTypes.columnHeader:
1030
- if (this.columnDefinition.headerCellTemplate !== void 0) {
1031
- this.customCellView = this.columnDefinition.headerCellTemplate.render(
1032
- this,
1033
- this
1034
- );
1035
- } else {
1036
- this.customCellView = defaultHeaderCellContentsTemplate.render(
1037
- this,
1038
- this
1039
- );
1040
- }
1041
- break;
1042
- case DataGridCellTypes.rowHeader:
1043
- case DataGridCellTypes.default:
1044
- if (this.columnDefinition.cellTemplate !== void 0) {
1045
- this.customCellView = this.columnDefinition.cellTemplate.render(
1046
- this,
1047
- this
1048
- );
1049
- } else {
1050
- this.customCellView = defaultCellContentsTemplate.render(this, this);
1051
- }
1052
- break;
1053
- }
1054
- }
1055
- disconnectCellView() {
1056
- if (this.customCellView !== null) {
1057
- this.customCellView.dispose();
1058
- this.customCellView = null;
1059
- }
1060
- }
1061
- ariaSelectedChanged(_, selectedState) {
1062
- this.shadowRoot.querySelector(".base")?.classList.toggle(
1063
- "selected",
1064
- selectedState === "true"
1065
- );
1066
- }
1067
- #getColumnDataKey() {
1068
- return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
1069
- }
1070
- /**
1071
- * @internal
1072
- */
1073
- _handleInteraction() {
1074
- const isHeaderCell = this.cellType === "columnheader";
1075
- const isSortable = isHeaderCell && this.ariaSort !== null;
1076
- if (isSortable) {
1077
- this.$emit("sort", {
1078
- columnDataKey: this.#getColumnDataKey(),
1079
- sortDirection: this.ariaSort
1080
- });
1081
- }
1082
- const hasInternalFocusQueue = isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue;
1083
- if (!hasInternalFocusQueue) {
1084
- this.$emit("cell-click", {
1085
- cell: this,
1086
- row: this.parentElement,
1087
- isHeaderCell,
1088
- columnDataKey: this.#getColumnDataKey()
1089
- });
1090
- }
1091
- return true;
1092
- }
1093
- }
1094
- __decorateClass([
1095
- vividElement.attr({ attribute: "cell-type" })
1096
- ], DataGridCell.prototype, "cellType");
1097
- __decorateClass([
1098
- vividElement.attr({ attribute: "grid-column" })
1099
- ], DataGridCell.prototype, "gridColumn");
1100
- __decorateClass([
1101
- vividElement.observable
1102
- ], DataGridCell.prototype, "rowData");
1103
- __decorateClass([
1104
- vividElement.observable
1105
- ], DataGridCell.prototype, "columnDefinition");
1106
- __decorateClass([
1107
- vividElement.attr({ attribute: "aria-selected", mode: "fromView" })
1108
- ], DataGridCell.prototype, "ariaSelected");
1109
- __decorateClass([
1110
- vividElement.attr({ attribute: "aria-sort" })
1111
- ], DataGridCell.prototype, "ariaSort");
1112
-
1113
1188
  function createCellItemTemplate(context) {
1114
1189
  const cellTag = context.tagFor(DataGridCell);
1115
1190
  return vividElement.html`
@@ -1135,6 +1210,7 @@ function createHeaderCellItemTemplate(context) {
1135
1210
  const DataGridRowTemplate = (context) => {
1136
1211
  const cellItemTemplate = createCellItemTemplate(context);
1137
1212
  const headerCellItemTemplate = createHeaderCellItemTemplate(context);
1213
+ const getBaseClasses = (x) => classNames.classNames("base", ["selected", !!x.selected]);
1138
1214
  return vividElement.html`
1139
1215
  <template
1140
1216
  role="row"
@@ -1144,12 +1220,12 @@ const DataGridRowTemplate = (context) => {
1144
1220
  ${children.children({
1145
1221
  property: "cellElements",
1146
1222
  filter: slotted.elements(
1147
- '[role="cell"],[role="gridcell"],[role="columnheader"],[role="rowheader"]'
1223
+ '[role="cell"],[role="gridcell"],[role="columnheader"],[role="rowheader"],[cell-type]'
1148
1224
  )
1149
1225
  })}
1150
1226
  >
1151
1227
  <div
1152
- class="base ${(x) => x.ariaSelected === "true" ? "selected" : ""}"
1228
+ class="${getBaseClasses}"
1153
1229
  style="grid-template-columns: ${(x) => x.gridTemplateColumns};"
1154
1230
  >
1155
1231
  <slot ${slotted.slotted("slottedCellElements")}></slot>
@@ -1159,13 +1235,16 @@ const DataGridRowTemplate = (context) => {
1159
1235
  };
1160
1236
 
1161
1237
  function shouldShowSortIcons(x) {
1162
- if (x.columnDefinition) {
1163
- x.ariaSort = !x.columnDefinition.sortable ? null : x.columnDefinition.sortDirection ? x.columnDefinition.sortDirection : DataGridCellSortStates.none;
1164
- }
1165
- return x.cellType === "columnheader" && x.ariaSort !== null && x.ariaSort !== DataGridCellSortStates.other;
1238
+ return x.cellType === "columnheader" && x.sortDirection !== void 0 && x.sortDirection !== DataGridCellSortStates.other;
1166
1239
  }
1167
1240
  function getSortIcon(x) {
1168
- return x.ariaSort === DataGridCellSortStates.ascending ? "sort-asc-solid" : x.ariaSort === DataGridCellSortStates.descending ? "sort-desc-solid" : "sort-solid";
1241
+ if (x.sortDirection === DataGridCellSortStates.ascending) {
1242
+ return "sort-asc-solid";
1243
+ }
1244
+ if (x.sortDirection === DataGridCellSortStates.descending) {
1245
+ return "sort-desc-solid";
1246
+ }
1247
+ return "sort-solid";
1169
1248
  }
1170
1249
  function renderSortIcons(c) {
1171
1250
  const iconTag = c.tagFor(definition$1.Icon);
@@ -1186,6 +1265,7 @@ function handleKeyDown(x, e) {
1186
1265
  }
1187
1266
  const DataGridCellTemplate = (context) => {
1188
1267
  const visuallyHiddenTagName = context.tagFor(definition.VisuallyHidden);
1268
+ const getBaseClasses = (x) => classNames.classNames("base", ["selected", !!x.selected]);
1189
1269
  return vividElement.html`
1190
1270
  <template
1191
1271
  tabindex="-1"
@@ -1194,7 +1274,7 @@ const DataGridCellTemplate = (context) => {
1194
1274
  @keydown="${(x, c) => handleKeyDown(x, c.event)}"
1195
1275
  >
1196
1276
  <div
1197
- class="base"
1277
+ class="${getBaseClasses}"
1198
1278
  role="${(x) => shouldShowSortIcons(x) ? "button" : void 0}"
1199
1279
  >
1200
1280
  ${(x) => x.ariaSelected === "true" ? vividElement.html`<${visuallyHiddenTagName}>${(x2) => x2.locale.dataGrid.cell.selected}</${visuallyHiddenTagName}>` : null}