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