@vonage/vivid 4.13.0 → 4.14.1

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 (512) hide show
  1. package/custom-elements.json +3088 -1610
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +70 -136
  5. package/index.d.ts +0 -1
  6. package/index.js +60 -62
  7. package/lib/accordion/accordion.d.ts +2 -2
  8. package/lib/accordion/accordion.template.d.ts +1 -2
  9. package/lib/accordion/definition.d.ts +1 -1
  10. package/lib/accordion-item/accordion-item.d.ts +2 -2
  11. package/lib/accordion-item/accordion-item.template.d.ts +2 -3
  12. package/lib/accordion-item/definition.d.ts +1 -1
  13. package/lib/action-group/action-group.d.ts +2 -2
  14. package/lib/action-group/action-group.template.d.ts +1 -3
  15. package/lib/action-group/definition.d.ts +1 -1
  16. package/lib/alert/alert.d.ts +2 -2
  17. package/lib/alert/alert.template.d.ts +2 -3
  18. package/lib/alert/definition.d.ts +1 -1
  19. package/lib/audio-player/audio-player.d.ts +2 -2
  20. package/lib/audio-player/audio-player.template.d.ts +2 -3
  21. package/lib/audio-player/definition.d.ts +1 -3
  22. package/lib/avatar/avatar.d.ts +2 -2
  23. package/lib/avatar/avatar.template.d.ts +2 -3
  24. package/lib/avatar/definition.d.ts +1 -1
  25. package/lib/badge/badge.d.ts +2 -2
  26. package/lib/badge/badge.template.d.ts +2 -3
  27. package/lib/badge/definition.d.ts +1 -3
  28. package/lib/banner/banner.d.ts +2 -2
  29. package/lib/banner/banner.template.d.ts +2 -3
  30. package/lib/banner/definition.d.ts +1 -1
  31. package/lib/breadcrumb/breadcrumb.d.ts +2 -2
  32. package/lib/breadcrumb/breadcrumb.template.d.ts +3 -4
  33. package/lib/breadcrumb/definition.d.ts +1 -1
  34. package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
  35. package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +2 -3
  36. package/lib/breadcrumb-item/definition.d.ts +1 -1
  37. package/lib/button/button.d.ts +2 -2
  38. package/lib/button/button.template.d.ts +2 -4
  39. package/lib/button/definition.d.ts +1 -1
  40. package/lib/calendar/calendar.d.ts +2 -2
  41. package/lib/calendar/calendar.template.d.ts +1 -3
  42. package/lib/calendar/definition.d.ts +1 -1
  43. package/lib/calendar-event/calendar-event.d.ts +2 -2
  44. package/lib/calendar-event/calendar-event.template.d.ts +1 -3
  45. package/lib/calendar-event/definition.d.ts +1 -1
  46. package/lib/card/card.d.ts +2 -2
  47. package/lib/card/card.template.d.ts +2 -3
  48. package/lib/card/definition.d.ts +1 -1
  49. package/lib/checkbox/checkbox.form-associated.d.ts +3 -2
  50. package/lib/checkbox/checkbox.template.d.ts +2 -3
  51. package/lib/checkbox/definition.d.ts +1 -1
  52. package/lib/combobox/combobox.d.ts +17 -2
  53. package/lib/combobox/combobox.options.d.ts +7 -0
  54. package/lib/combobox/combobox.template.d.ts +2 -3
  55. package/lib/combobox/definition.d.ts +1 -2
  56. package/lib/data-grid/data-grid-cell.d.ts +16 -13
  57. package/lib/data-grid/data-grid-cell.template.d.ts +2 -3
  58. package/lib/data-grid/data-grid-row.d.ts +19 -2
  59. package/lib/data-grid/data-grid-row.template.d.ts +2 -2
  60. package/lib/data-grid/data-grid.d.ts +45 -4
  61. package/lib/data-grid/data-grid.template.d.ts +2 -2
  62. package/lib/data-grid/definition.d.ts +1 -6
  63. package/lib/date-picker/definition.d.ts +1 -3
  64. package/lib/date-range-picker/definition.d.ts +1 -3
  65. package/lib/dial-pad/definition.d.ts +1 -3
  66. package/lib/dial-pad/dial-pad.d.ts +2 -2
  67. package/lib/dial-pad/dial-pad.template.d.ts +2 -3
  68. package/lib/dialog/definition.d.ts +1 -1
  69. package/lib/dialog/dialog.d.ts +2 -2
  70. package/lib/dialog/dialog.template.d.ts +2 -3
  71. package/lib/divider/definition.d.ts +1 -1
  72. package/lib/divider/divider.d.ts +2 -2
  73. package/lib/divider/divider.template.d.ts +1 -3
  74. package/lib/elevation/definition.d.ts +1 -1
  75. package/lib/elevation/elevation.d.ts +3 -2
  76. package/lib/elevation/elevation.template.d.ts +1 -3
  77. package/lib/empty-state/definition.d.ts +1 -3
  78. package/lib/empty-state/empty-state.d.ts +2 -2
  79. package/lib/empty-state/empty-state.template.d.ts +2 -3
  80. package/lib/fab/definition.d.ts +1 -3
  81. package/lib/fab/fab.template.d.ts +2 -3
  82. package/lib/file-picker/definition.d.ts +1 -3
  83. package/lib/file-picker/file-picker.form-associated.d.ts +3 -2
  84. package/lib/file-picker/file-picker.template.d.ts +2 -3
  85. package/lib/header/definition.d.ts +1 -3
  86. package/lib/header/header.d.ts +2 -2
  87. package/lib/header/header.template.d.ts +2 -3
  88. package/lib/icon/definition.d.ts +1 -3
  89. package/lib/icon/icon.d.ts +2 -2
  90. package/lib/icon/icon.template.d.ts +1 -3
  91. package/lib/layout/definition.d.ts +1 -3
  92. package/lib/layout/layout.d.ts +2 -2
  93. package/lib/layout/layout.template.d.ts +1 -3
  94. package/lib/listbox/definition.d.ts +1 -3
  95. package/lib/listbox/listbox.template.d.ts +1 -3
  96. package/lib/menu/definition.d.ts +1 -11
  97. package/lib/menu/menu.d.ts +2 -2
  98. package/lib/menu/menu.template.d.ts +3 -3
  99. package/lib/menu-item/definition.d.ts +1 -3
  100. package/lib/menu-item/menu-item.d.ts +2 -2
  101. package/lib/menu-item/menu-item.template.d.ts +2 -3
  102. package/lib/nav/definition.d.ts +1 -3
  103. package/lib/nav/nav.d.ts +2 -2
  104. package/lib/nav/nav.template.d.ts +1 -3
  105. package/lib/nav-disclosure/definition.d.ts +1 -3
  106. package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
  107. package/lib/nav-disclosure/nav-disclosure.template.d.ts +2 -3
  108. package/lib/nav-item/definition.d.ts +1 -3
  109. package/lib/nav-item/nav-item.template.d.ts +2 -3
  110. package/lib/note/definition.d.ts +1 -3
  111. package/lib/note/note.d.ts +2 -2
  112. package/lib/note/note.template.d.ts +2 -3
  113. package/lib/number-field/definition.d.ts +1 -4
  114. package/lib/number-field/number-field.form-associated.d.ts +3 -2
  115. package/lib/number-field/number-field.template.d.ts +2 -3
  116. package/lib/option/definition.d.ts +1 -3
  117. package/lib/option/option.d.ts +3 -2
  118. package/lib/option/option.template.d.ts +2 -3
  119. package/lib/pagination/definition.d.ts +1 -3
  120. package/lib/pagination/pagination.d.ts +2 -2
  121. package/lib/pagination/pagination.template.d.ts +2 -3
  122. package/lib/popup/definition.d.ts +1 -3
  123. package/lib/popup/popup.template.d.ts +2 -3
  124. package/lib/progress/definition.d.ts +1 -3
  125. package/lib/progress/progress.d.ts +1 -1
  126. package/lib/progress/progress.template.d.ts +1 -4
  127. package/lib/progress-ring/definition.d.ts +1 -3
  128. package/lib/progress-ring/progress-ring.d.ts +1 -1
  129. package/lib/progress-ring/progress-ring.template.d.ts +1 -3
  130. package/lib/radio/definition.d.ts +1 -3
  131. package/lib/radio/radio.form-associated.d.ts +5 -2
  132. package/lib/radio/radio.template.d.ts +1 -3
  133. package/lib/radio-group/definition.d.ts +1 -11
  134. package/lib/radio-group/radio-group.d.ts +2 -2
  135. package/lib/radio-group/radio-group.template.d.ts +2 -3
  136. package/lib/range-slider/definition.d.ts +1 -3
  137. package/lib/range-slider/range-slider.form-associated.d.ts +3 -2
  138. package/lib/range-slider/range-slider.template.d.ts +2 -3
  139. package/lib/searchable-select/definition.d.ts +1 -4
  140. package/lib/searchable-select/option-tag.template.d.ts +2 -3
  141. package/lib/searchable-select/searchable-select.form-associated.d.ts +3 -2
  142. package/lib/searchable-select/searchable-select.template.d.ts +2 -3
  143. package/lib/select/definition.d.ts +1 -3
  144. package/lib/select/select.d.ts +14 -4
  145. package/lib/select/select.form-associated.d.ts +11 -0
  146. package/lib/select/select.template.d.ts +2 -3
  147. package/lib/selectable-box/definition.d.ts +1 -3
  148. package/lib/selectable-box/selectable-box.d.ts +2 -2
  149. package/lib/selectable-box/selectable-box.template.d.ts +2 -3
  150. package/lib/side-drawer/definition.d.ts +1 -3
  151. package/lib/side-drawer/side-drawer.d.ts +2 -2
  152. package/lib/side-drawer/side-drawer.template.d.ts +1 -3
  153. package/lib/slider/definition.d.ts +1 -3
  154. package/lib/slider/slider.form-associated.d.ts +3 -2
  155. package/lib/slider/slider.template.d.ts +3 -4
  156. package/lib/split-button/definition.d.ts +1 -1
  157. package/lib/split-button/split-button.d.ts +2 -2
  158. package/lib/split-button/split-button.template.d.ts +2 -3
  159. package/lib/switch/definition.d.ts +1 -3
  160. package/lib/switch/switch.form-associated.d.ts +3 -2
  161. package/lib/switch/switch.template.d.ts +1 -3
  162. package/lib/tab/definition.d.ts +1 -3
  163. package/lib/tab/tab.d.ts +2 -2
  164. package/lib/tab/tab.template.d.ts +2 -2
  165. package/lib/tab-panel/definition.d.ts +1 -3
  166. package/lib/tab-panel/tab-panel.d.ts +2 -2
  167. package/lib/tab-panel/tab-panel.template.d.ts +1 -1
  168. package/lib/tabs/definition.d.ts +1 -3
  169. package/lib/tabs/tabs.d.ts +3 -7
  170. package/lib/tabs/tabs.template.d.ts +1 -1
  171. package/lib/tag/definition.d.ts +1 -4
  172. package/lib/tag/tag.d.ts +2 -2
  173. package/lib/tag/tag.template.d.ts +2 -3
  174. package/lib/tag-group/definition.d.ts +1 -3
  175. package/lib/tag-group/tag-group.d.ts +2 -2
  176. package/lib/tag-group/tag-group.template.d.ts +1 -3
  177. package/lib/text-anchor/definition.d.ts +1 -3
  178. package/lib/text-anchor/text-anchor.d.ts +4 -3
  179. package/lib/text-anchor/text-anchor.template.d.ts +2 -3
  180. package/lib/text-area/definition.d.ts +1 -3
  181. package/lib/text-area/text-area.d.ts +1 -1
  182. package/lib/text-area/{text-field.form-associated.d.ts → text-area.form-associated.d.ts} +3 -2
  183. package/lib/text-area/text-area.template.d.ts +2 -3
  184. package/lib/text-field/definition.d.ts +1 -3
  185. package/lib/text-field/text-field.form-associated.d.ts +3 -2
  186. package/lib/text-field/text-field.template.d.ts +2 -3
  187. package/lib/time-picker/definition.d.ts +1 -3
  188. package/lib/time-picker/time-picker.form-associated.d.ts +3 -2
  189. package/lib/time-picker/time-picker.template.d.ts +2 -2
  190. package/lib/toggletip/definition.d.ts +1 -3
  191. package/lib/toggletip/toggletip.d.ts +2 -2
  192. package/lib/toggletip/toggletip.template.d.ts +2 -3
  193. package/lib/tooltip/definition.d.ts +1 -3
  194. package/lib/tooltip/tooltip.d.ts +2 -2
  195. package/lib/tooltip/tooltip.template.d.ts +2 -3
  196. package/lib/tree-item/definition.d.ts +1 -3
  197. package/lib/tree-item/tree-item.d.ts +11 -2
  198. package/lib/tree-item/tree-item.template.d.ts +3 -3
  199. package/lib/tree-view/definition.d.ts +1 -3
  200. package/lib/tree-view/tree-view.d.ts +16 -2
  201. package/lib/tree-view/tree-view.template.d.ts +1 -1
  202. package/lib/video-player/definition.d.ts +1 -3
  203. package/lib/video-player/video-player.d.ts +2 -2
  204. package/lib/video-player/video-player.template.d.ts +1 -3
  205. package/listbox/index.cjs +37 -39
  206. package/listbox/index.js +37 -39
  207. package/menu/index.cjs +1 -1
  208. package/menu/index.js +1 -1
  209. package/nav/index.cjs +1 -1
  210. package/nav/index.js +1 -1
  211. package/nav-disclosure/index.cjs +1 -1
  212. package/nav-disclosure/index.js +1 -1
  213. package/nav-item/index.cjs +1 -1
  214. package/nav-item/index.js +1 -1
  215. package/note/index.cjs +1 -1
  216. package/note/index.js +1 -1
  217. package/number-field/index.cjs +1 -1
  218. package/number-field/index.js +1 -1
  219. package/option/index.cjs +1 -1
  220. package/option/index.js +1 -1
  221. package/package.json +1 -1
  222. package/pagination/index.cjs +1 -1
  223. package/pagination/index.js +1 -1
  224. package/popup/index.cjs +1 -1
  225. package/popup/index.js +1 -1
  226. package/progress/index.cjs +1 -1
  227. package/progress/index.js +1 -1
  228. package/progress-ring/index.cjs +1 -1
  229. package/progress-ring/index.js +1 -1
  230. package/radio/index.cjs +1 -1
  231. package/radio/index.js +1 -1
  232. package/radio-group/index.cjs +1 -1
  233. package/radio-group/index.js +1 -1
  234. package/range-slider/index.cjs +1 -1
  235. package/range-slider/index.js +1 -1
  236. package/searchable-select/index.cjs +1 -1
  237. package/searchable-select/index.js +1 -1
  238. package/select/index.cjs +1 -1
  239. package/select/index.js +1 -1
  240. package/selectable-box/index.cjs +1 -1
  241. package/selectable-box/index.js +1 -1
  242. package/shared/affix.cjs +10 -10
  243. package/shared/affix.js +2 -2
  244. package/shared/anchor.cjs +59 -0
  245. package/shared/anchor.js +57 -0
  246. package/shared/anchored.cjs +6 -6
  247. package/shared/anchored.js +2 -2
  248. package/shared/apply-mixins.cjs +15 -17
  249. package/shared/apply-mixins.js +15 -17
  250. package/shared/apply-mixins2.cjs +25 -0
  251. package/shared/apply-mixins2.js +23 -0
  252. package/shared/applyMixinsWithObservables.cjs +4 -4
  253. package/shared/applyMixinsWithObservables.js +2 -2
  254. package/shared/aria-global.cjs +86 -67
  255. package/shared/aria-global.js +86 -67
  256. package/shared/aria-global2.cjs +68 -86
  257. package/shared/aria-global2.js +68 -86
  258. package/shared/base-progress.cjs +69 -63
  259. package/shared/base-progress.js +69 -63
  260. package/shared/breadcrumb-item.cjs +6 -58
  261. package/shared/breadcrumb-item.js +3 -55
  262. package/shared/button.cjs +177 -0
  263. package/shared/button.js +175 -0
  264. package/shared/calendar-event.cjs +9 -9
  265. package/shared/calendar-event.js +2 -2
  266. package/shared/children.cjs +2 -2
  267. package/shared/children.js +1 -1
  268. package/shared/date-picker/date-picker-base.form-associated.d.ts +3 -2
  269. package/shared/date-picker/date-picker-base.template.d.ts +2 -3
  270. package/shared/definition.cjs +25 -24
  271. package/shared/definition.js +16 -14
  272. package/shared/definition10.cjs +14 -12
  273. package/shared/definition10.js +14 -11
  274. package/shared/definition11.cjs +52 -248
  275. package/shared/definition11.js +24 -218
  276. package/shared/definition12.cjs +18 -14
  277. package/shared/definition12.js +17 -12
  278. package/shared/definition13.cjs +19 -19
  279. package/shared/definition13.js +10 -9
  280. package/shared/definition14.cjs +35 -38
  281. package/shared/definition14.js +15 -17
  282. package/shared/definition15.cjs +27 -26
  283. package/shared/definition15.js +16 -14
  284. package/shared/definition16.cjs +480 -612
  285. package/shared/definition16.js +473 -604
  286. package/shared/definition17.cjs +933 -1113
  287. package/shared/definition17.js +911 -1090
  288. package/shared/definition18.cjs +16 -20
  289. package/shared/definition18.js +19 -22
  290. package/shared/definition19.cjs +26 -30
  291. package/shared/definition19.js +21 -24
  292. package/shared/definition2.cjs +19 -22
  293. package/shared/definition2.js +20 -22
  294. package/shared/definition20.cjs +50 -52
  295. package/shared/definition20.js +34 -35
  296. package/shared/definition21.cjs +43 -47
  297. package/shared/definition21.js +19 -22
  298. package/shared/definition22.cjs +15 -13
  299. package/shared/definition22.js +14 -11
  300. package/shared/definition23.cjs +21 -20
  301. package/shared/definition23.js +14 -12
  302. package/shared/definition24.cjs +21 -173
  303. package/shared/definition24.js +18 -169
  304. package/shared/definition25.cjs +26 -28
  305. package/shared/definition25.js +18 -19
  306. package/shared/definition26.cjs +16 -14
  307. package/shared/definition26.js +14 -11
  308. package/shared/definition27.cjs +264 -12
  309. package/shared/definition27.js +261 -10
  310. package/shared/definition28.cjs +19 -17
  311. package/shared/definition28.js +15 -12
  312. package/shared/definition29.cjs +142 -68
  313. package/shared/definition29.js +101 -29
  314. package/shared/definition3.cjs +20 -16
  315. package/shared/definition3.js +16 -11
  316. package/shared/definition30.cjs +98 -76
  317. package/shared/definition30.js +97 -74
  318. package/shared/definition31.cjs +24 -97
  319. package/shared/definition31.js +25 -97
  320. package/shared/definition32.cjs +9 -25
  321. package/shared/definition32.js +8 -23
  322. package/shared/definition33.cjs +52 -14
  323. package/shared/definition33.js +51 -12
  324. package/shared/definition34.cjs +639 -34
  325. package/shared/definition34.js +636 -30
  326. package/shared/definition35.cjs +203 -596
  327. package/shared/definition35.js +197 -591
  328. package/shared/definition36.cjs +197 -233
  329. package/shared/definition36.js +192 -226
  330. package/shared/definition37.cjs +79 -206
  331. package/shared/definition37.js +75 -202
  332. package/shared/definition38.cjs +50 -56
  333. package/shared/definition38.js +48 -52
  334. package/shared/definition39.cjs +259 -56
  335. package/shared/definition39.js +258 -54
  336. package/shared/definition4.cjs +32 -35
  337. package/shared/definition4.js +19 -21
  338. package/shared/definition40.cjs +156 -225
  339. package/shared/definition40.js +152 -221
  340. package/shared/definition41.cjs +626 -36
  341. package/shared/definition41.js +625 -34
  342. package/shared/definition42.cjs +974 -487
  343. package/shared/definition42.js +971 -482
  344. package/shared/definition43.cjs +725 -932
  345. package/shared/definition43.js +713 -918
  346. package/shared/definition44.cjs +115 -734
  347. package/shared/definition44.js +113 -731
  348. package/shared/definition45.cjs +92 -116
  349. package/shared/definition45.js +92 -115
  350. package/shared/definition46.cjs +468 -89
  351. package/shared/definition46.js +465 -86
  352. package/shared/definition47.cjs +118 -470
  353. package/shared/definition47.js +115 -465
  354. package/shared/definition48.cjs +113 -120
  355. package/shared/definition48.js +111 -117
  356. package/shared/definition49.cjs +16 -134
  357. package/shared/definition49.js +15 -132
  358. package/shared/definition5.cjs +47 -49
  359. package/shared/definition5.js +18 -19
  360. package/shared/definition50.cjs +111 -15
  361. package/shared/definition50.js +109 -12
  362. package/shared/definition51.cjs +862 -84
  363. package/shared/definition51.js +858 -79
  364. package/shared/definition52.cjs +30 -873
  365. package/shared/definition52.js +28 -870
  366. package/shared/definition53.cjs +125 -28
  367. package/shared/definition53.js +123 -25
  368. package/shared/definition54.cjs +267 -107
  369. package/shared/definition54.js +261 -100
  370. package/shared/definition55.cjs +63 -278
  371. package/shared/definition55.js +61 -275
  372. package/shared/definition56.cjs +867 -76
  373. package/shared/definition56.js +866 -74
  374. package/shared/definition57.cjs +107 -826
  375. package/shared/definition57.js +105 -823
  376. package/shared/definition58.cjs +73 -100
  377. package/shared/definition58.js +69 -95
  378. package/shared/definition59.cjs +180 -106
  379. package/shared/definition59.js +174 -101
  380. package/shared/definition6.cjs +22 -21
  381. package/shared/definition6.js +14 -12
  382. package/shared/definition60.cjs +272 -70
  383. package/shared/definition60.js +272 -69
  384. package/shared/definition61.cjs +66154 -271
  385. package/shared/definition61.js +66153 -269
  386. package/shared/definition62.cjs +38 -66173
  387. package/shared/definition62.js +35 -66170
  388. package/shared/definition63.cjs +2153 -27
  389. package/shared/definition63.js +2150 -25
  390. package/shared/definition7.cjs +18 -15
  391. package/shared/definition7.js +13 -10
  392. package/shared/definition8.cjs +25 -27
  393. package/shared/definition8.js +16 -17
  394. package/shared/definition9.cjs +21 -21
  395. package/shared/definition9.js +18 -17
  396. package/shared/design-system/createRegisterFunction.d.ts +2 -0
  397. package/shared/design-system/defineVividComponent.d.ts +15 -0
  398. package/shared/{localization.js → direction.js} +11 -11
  399. package/shared/dom.cjs +0 -13
  400. package/shared/dom.js +1 -13
  401. package/shared/form-associated.cjs +422 -457
  402. package/shared/form-associated.js +422 -457
  403. package/shared/form-associated2.cjs +383 -0
  404. package/shared/form-associated2.js +381 -0
  405. package/shared/form-elements.cjs +15 -42
  406. package/shared/form-elements.js +2 -29
  407. package/shared/foundation/anchor/anchor.d.ts +1 -0
  408. package/shared/foundation/button/button.d.ts +3 -2
  409. package/shared/foundation/button/button.template.d.ts +2 -4
  410. package/shared/foundation/form-associated/form-associated.d.ts +51 -0
  411. package/shared/foundation/listbox/listbox.d.ts +22 -0
  412. package/shared/foundation/progress/base-progress.d.ts +9 -0
  413. package/shared/foundation/utilities/apply-mixins.d.ts +1 -0
  414. package/shared/foundation/vivid-element/vivid-element.d.ts +3 -0
  415. package/shared/index.cjs +7 -5097
  416. package/shared/index.js +7 -5079
  417. package/shared/key-codes.cjs +10 -0
  418. package/shared/key-codes.js +6 -1
  419. package/shared/key-codes2.cjs +1463 -6
  420. package/shared/key-codes2.js +1461 -4
  421. package/shared/listbox.cjs +427 -1195
  422. package/shared/listbox.js +411 -1176
  423. package/shared/listbox2.cjs +1267 -0
  424. package/shared/listbox2.js +1264 -0
  425. package/shared/localized.cjs +2 -2
  426. package/shared/localized.js +1 -1
  427. package/shared/numbers.cjs +12 -0
  428. package/shared/numbers.js +12 -1
  429. package/shared/patterns/affix.d.ts +2 -2
  430. package/shared/patterns/chevron.d.ts +2 -2
  431. package/shared/patterns/form-elements/form-elements.d.ts +2 -2
  432. package/shared/presentationDate.cjs +49 -49
  433. package/shared/presentationDate.js +6 -6
  434. package/shared/ref.cjs +2 -2
  435. package/shared/ref.js +1 -1
  436. package/shared/repeat.cjs +22 -22
  437. package/shared/repeat.js +1 -1
  438. package/shared/slider.template.cjs +5 -5
  439. package/shared/slider.template.js +2 -2
  440. package/shared/slotted.cjs +4 -4
  441. package/shared/slotted.js +1 -1
  442. package/shared/strings.cjs +0 -26
  443. package/shared/strings.js +1 -25
  444. package/shared/strings2.cjs +37 -0
  445. package/shared/strings2.js +33 -0
  446. package/shared/text-anchor.cjs +7 -89
  447. package/shared/text-anchor.js +4 -86
  448. package/shared/text-anchor.template.cjs +2 -2
  449. package/shared/text-anchor.template.js +1 -1
  450. package/shared/text-field2.cjs +28 -28
  451. package/shared/text-field2.js +5 -5
  452. package/shared/vivid-element.cjs +2616 -0
  453. package/shared/vivid-element.js +2595 -0
  454. package/side-drawer/index.cjs +1 -1
  455. package/side-drawer/index.js +1 -1
  456. package/slider/index.cjs +1 -1
  457. package/slider/index.js +1 -1
  458. package/split-button/index.cjs +1 -1
  459. package/split-button/index.js +1 -1
  460. package/styles/core/all.css +40 -1
  461. package/styles/core/theme.css +40 -1
  462. package/styles/core/typography.css +1 -1
  463. package/styles/tokens/theme-dark.css +25 -4
  464. package/styles/tokens/theme-light.css +25 -4
  465. package/styles/tokens/vivid-2-compat.css +1 -1
  466. package/switch/index.cjs +1 -1
  467. package/switch/index.js +1 -1
  468. package/tab/index.cjs +1 -1
  469. package/tab/index.js +1 -1
  470. package/tab-panel/index.cjs +1 -1
  471. package/tab-panel/index.js +1 -1
  472. package/tabs/index.cjs +1 -1
  473. package/tabs/index.js +1 -1
  474. package/tag/index.cjs +1 -1
  475. package/tag/index.js +1 -1
  476. package/tag-group/index.cjs +1 -1
  477. package/tag-group/index.js +1 -1
  478. package/text-anchor/index.cjs +10 -7
  479. package/text-anchor/index.js +10 -7
  480. package/text-area/index.cjs +1 -1
  481. package/text-area/index.js +1 -1
  482. package/text-field/index.cjs +1 -1
  483. package/text-field/index.js +1 -1
  484. package/time-picker/index.cjs +1 -1
  485. package/time-picker/index.js +1 -1
  486. package/toggletip/index.cjs +1 -1
  487. package/toggletip/index.js +1 -1
  488. package/tooltip/index.cjs +1 -1
  489. package/tooltip/index.js +1 -1
  490. package/tree-item/index.cjs +1 -1
  491. package/tree-item/index.js +1 -1
  492. package/tree-view/index.cjs +1 -1
  493. package/tree-view/index.js +1 -1
  494. package/video-player/index.cjs +1 -1
  495. package/video-player/index.js +1 -1
  496. package/vivid.api.json +2846 -7860
  497. package/shared/definition64.cjs +0 -2175
  498. package/shared/definition64.js +0 -2170
  499. package/shared/design-system/index.d.ts +0 -3
  500. package/shared/icon.cjs +0 -261
  501. package/shared/icon.js +0 -258
  502. package/shared/index2.cjs +0 -11
  503. package/shared/index2.js +0 -9
  504. package/shared/radio.cjs +0 -126
  505. package/shared/radio.js +0 -124
  506. package/shared/select.options.cjs +0 -12
  507. package/shared/select.options.js +0 -10
  508. package/shared/start-end.cjs +0 -52
  509. package/shared/start-end.js +0 -50
  510. package/shared/tree-item.cjs +0 -154
  511. package/shared/tree-item.js +0 -151
  512. package/shared/{localization.cjs → direction.cjs} +9 -9
@@ -1,14 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const definition = require('./definition27.cjs');
4
- const index = require('./index.cjs');
5
- const keyCodes = require('./key-codes2.cjs');
4
+ const vividElement = require('./vivid-element.cjs');
5
+ const keyCodes = require('./key-codes.cjs');
6
6
  const repeat = require('./repeat.cjs');
7
7
  const slotted = require('./slotted.cjs');
8
8
  const children = require('./children.cjs');
9
- const icon = require('./icon.cjs');
10
9
  const when = require('./when.cjs');
11
- const keyCodes$1 = require('./key-codes.cjs');
12
10
 
13
11
  /**
14
12
  * This set of exported strings reference https://developer.mozilla.org/en-US/docs/Web/Events
@@ -19,941 +17,532 @@ const eventFocusIn = "focusin";
19
17
  const eventFocusOut = "focusout";
20
18
  const eventKeyDown = "keydown";
21
19
 
22
- /**
23
- * Enumerates the data grid auto generated header options
24
- * default option generates a non-sticky header row
25
- *
26
- * @public
27
- */
28
- const GenerateHeaderOptions$1 = {
29
- none: "none",
30
- default: "default",
31
- sticky: "sticky",
20
+ 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-thumb-color)}.base{position:relative;overflow:auto;block-size:inherit;inline-size:100%;max-block-size:inherit}";
21
+
22
+ 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
+
24
+ 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:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - 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
+
26
+ const DataGridCellSortStates = {
27
+ none: "none",
28
+ ascending: "ascending",
29
+ descending: "descending",
30
+ other: "other"
31
+ };
32
+ const GenerateHeaderOptions = {
33
+ none: "none",
34
+ default: "default",
35
+ sticky: "sticky"
32
36
  };
33
- /**
34
- * Enumerates possible data grid cell types.
35
- *
36
- * @public
37
- */
38
37
  const DataGridCellTypes = {
39
- default: "default",
40
- columnHeader: "columnheader",
41
- rowHeader: "rowheader",
38
+ default: "default",
39
+ columnHeader: "columnheader",
40
+ rowHeader: "rowheader"
42
41
  };
43
- /**
44
- * Enumerates possible data grid row types
45
- *
46
- * @public
47
- */
48
- const DataGridRowTypes$1 = {
49
- default: "default",
50
- header: "header",
51
- stickyHeader: "sticky-header",
42
+ const DataGridRowTypes = {
43
+ default: "default",
44
+ header: "header",
45
+ stickyHeader: "sticky-header"
52
46
  };
53
-
54
- /**
55
- * A Data Grid Row Custom HTML Element.
56
- *
57
- * @fires row-focused - Fires a custom 'row-focused' event when focus is on an element (usually a cell or its contents) in the row
58
- * @slot - The default slot for custom cell elements
59
- * @public
60
- */
61
- let DataGridRow$1 = class DataGridRow extends index.FoundationElement {
62
- constructor() {
63
- super(...arguments);
64
- /**
65
- * The type of row
66
- *
67
- * @public
68
- * @remarks
69
- * HTML Attribute: row-type
70
- */
71
- this.rowType = DataGridRowTypes$1.default;
72
- /**
73
- * The base data for this row
74
- *
75
- * @public
76
- */
77
- this.rowData = null;
78
- /**
79
- * The column definitions of the row
80
- *
81
- * @public
82
- */
83
- this.columnDefinitions = null;
84
- /**
85
- * Whether focus is on/in a cell within this row.
86
- *
87
- * @internal
88
- */
89
- this.isActiveRow = false;
90
- this.cellsRepeatBehavior = null;
91
- this.cellsPlaceholder = null;
92
- /**
93
- * @internal
94
- */
95
- this.focusColumnIndex = 0;
96
- this.refocusOnLoad = false;
97
- this.updateRowStyle = () => {
98
- this.style.gridTemplateColumns = this.gridTemplateColumns;
99
- };
100
- }
101
- gridTemplateColumnsChanged() {
102
- if (this.$fastController.isConnected) {
103
- this.updateRowStyle();
104
- }
105
- }
106
- rowTypeChanged() {
107
- if (this.$fastController.isConnected) {
108
- this.updateItemTemplate();
109
- }
110
- }
111
- rowDataChanged() {
112
- if (this.rowData !== null && this.isActiveRow) {
113
- this.refocusOnLoad = true;
114
- return;
115
- }
116
- }
117
- cellItemTemplateChanged() {
118
- this.updateItemTemplate();
119
- }
120
- headerCellItemTemplateChanged() {
121
- this.updateItemTemplate();
122
- }
123
- /**
124
- * @internal
125
- */
126
- connectedCallback() {
127
- super.connectedCallback();
128
- // note that row elements can be reused with a different data object
129
- // as the parent grid's repeat behavior reacts to changes in the data set.
130
- if (this.cellsRepeatBehavior === null) {
131
- this.cellsPlaceholder = document.createComment("");
132
- this.appendChild(this.cellsPlaceholder);
133
- this.updateItemTemplate();
134
- this.cellsRepeatBehavior = new repeat.RepeatDirective(x => x.columnDefinitions, x => x.activeCellItemTemplate, { positioning: true }).createBehavior(this.cellsPlaceholder);
135
- /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
136
- this.$fastController.addBehaviors([this.cellsRepeatBehavior]);
137
- }
138
- this.addEventListener("cell-focused", this.handleCellFocus);
139
- this.addEventListener(eventFocusOut, this.handleFocusout);
140
- this.addEventListener(eventKeyDown, this.handleKeydown);
141
- this.updateRowStyle();
142
- if (this.refocusOnLoad) {
143
- // if focus was on the row when data changed try to refocus on same cell
144
- this.refocusOnLoad = false;
145
- if (this.cellElements.length > this.focusColumnIndex) {
146
- this.cellElements[this.focusColumnIndex].focus();
147
- }
148
- }
149
- }
150
- /**
151
- * @internal
152
- */
153
- disconnectedCallback() {
154
- super.disconnectedCallback();
155
- this.removeEventListener("cell-focused", this.handleCellFocus);
156
- this.removeEventListener(eventFocusOut, this.handleFocusout);
157
- this.removeEventListener(eventKeyDown, this.handleKeydown);
158
- }
159
- handleFocusout(e) {
160
- if (!this.contains(e.target)) {
161
- this.isActiveRow = false;
162
- this.focusColumnIndex = 0;
163
- }
164
- }
165
- handleCellFocus(e) {
166
- this.isActiveRow = true;
167
- this.focusColumnIndex = this.cellElements.indexOf(e.target);
168
- this.$emit("row-focused", this);
169
- }
170
- handleKeydown(e) {
171
- if (e.defaultPrevented) {
172
- return;
173
- }
174
- let newFocusColumnIndex = 0;
175
- switch (e.key) {
176
- case keyCodes.keyArrowLeft:
177
- // focus left one cell
178
- newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
179
- this.cellElements[newFocusColumnIndex].focus();
180
- e.preventDefault();
181
- break;
182
- case keyCodes.keyArrowRight:
183
- // focus right one cell
184
- newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
185
- this.cellElements[newFocusColumnIndex].focus();
186
- e.preventDefault();
187
- break;
188
- case keyCodes.keyHome:
189
- if (!e.ctrlKey) {
190
- this.cellElements[0].focus();
191
- e.preventDefault();
192
- }
193
- break;
194
- case keyCodes.keyEnd:
195
- if (!e.ctrlKey) {
196
- // focus last cell of the row
197
- this.cellElements[this.cellElements.length - 1].focus();
198
- e.preventDefault();
199
- }
200
- break;
201
- }
202
- }
203
- updateItemTemplate() {
204
- this.activeCellItemTemplate =
205
- this.rowType === DataGridRowTypes$1.default &&
206
- this.cellItemTemplate !== undefined
207
- ? this.cellItemTemplate
208
- : this.rowType === DataGridRowTypes$1.default &&
209
- this.cellItemTemplate === undefined
210
- ? this.defaultCellItemTemplate
211
- : this.headerCellItemTemplate !== undefined
212
- ? this.headerCellItemTemplate
213
- : this.defaultHeaderCellItemTemplate;
214
- }
47
+ const DataGridCellRole = {
48
+ columnheader: "columnheader",
49
+ rowheader: "rowheader",
50
+ default: "gridcell"
215
51
  };
216
- index.__decorate([
217
- index.attr({ attribute: "grid-template-columns" })
218
- ], DataGridRow$1.prototype, "gridTemplateColumns", void 0);
219
- index.__decorate([
220
- index.attr({ attribute: "row-type" })
221
- ], DataGridRow$1.prototype, "rowType", void 0);
222
- index.__decorate([
223
- index.observable
224
- ], DataGridRow$1.prototype, "rowData", void 0);
225
- index.__decorate([
226
- index.observable
227
- ], DataGridRow$1.prototype, "columnDefinitions", void 0);
228
- index.__decorate([
229
- index.observable
230
- ], DataGridRow$1.prototype, "cellItemTemplate", void 0);
231
- index.__decorate([
232
- index.observable
233
- ], DataGridRow$1.prototype, "headerCellItemTemplate", void 0);
234
- index.__decorate([
235
- index.observable
236
- ], DataGridRow$1.prototype, "rowIndex", void 0);
237
- index.__decorate([
238
- index.observable
239
- ], DataGridRow$1.prototype, "isActiveRow", void 0);
240
- index.__decorate([
241
- index.observable
242
- ], DataGridRow$1.prototype, "activeCellItemTemplate", void 0);
243
- index.__decorate([
244
- index.observable
245
- ], DataGridRow$1.prototype, "defaultCellItemTemplate", void 0);
246
- index.__decorate([
247
- index.observable
248
- ], DataGridRow$1.prototype, "defaultHeaderCellItemTemplate", void 0);
249
- index.__decorate([
250
- index.observable
251
- ], DataGridRow$1.prototype, "cellElements", void 0);
252
52
 
253
- /**
254
- * A Data Grid Custom HTML Element.
255
- *
256
- * @slot - The default slot for custom row elements
257
- * @public
258
- */
259
- let DataGrid$1 = class DataGrid extends index.FoundationElement {
260
- constructor() {
261
- super();
262
- /**
263
- * When true the component will not add itself to the tab queue.
264
- * Default is false.
265
- *
266
- * @public
267
- * @remarks
268
- * HTML Attribute: no-tabbing
269
- */
270
- this.noTabbing = false;
271
- /**
272
- * Whether the grid should automatically generate a header row and its type
273
- *
274
- * @public
275
- * @remarks
276
- * HTML Attribute: generate-header
277
- */
278
- this.generateHeader = GenerateHeaderOptions$1.default;
279
- /**
280
- * The data being displayed in the grid
281
- *
282
- * @public
283
- */
284
- this.rowsData = [];
285
- /**
286
- * The column definitions of the grid
287
- *
288
- * @public
289
- */
290
- this.columnDefinitions = null;
291
- /**
292
- * The index of the row that will receive focus the next time the
293
- * grid is focused. This value changes as focus moves to different
294
- * rows within the grid. Changing this value when focus is already
295
- * within the grid moves focus to the specified row.
296
- *
297
- * @public
298
- */
53
+ var __defProp$2 = Object.defineProperty;
54
+ var __decorateClass$2 = (decorators, target, key, kind) => {
55
+ var result = void 0 ;
56
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
57
+ if (decorator = decorators[i])
58
+ result = (decorator(target, key, result) ) || result;
59
+ if (result) __defProp$2(target, key, result);
60
+ return result;
61
+ };
62
+ const DataGridSelectionMode = {
63
+ none: "none",
64
+ singleRow: "single-row",
65
+ multiRow: "multi-row",
66
+ singleCell: "single-cell",
67
+ multiCell: "multi-cell"
68
+ };
69
+ const _DataGrid = class _DataGrid extends vividElement.VividElement {
70
+ constructor() {
71
+ super();
72
+ this.noTabbing = false;
73
+ // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
74
+ this.generateHeader = GenerateHeaderOptions.default;
75
+ this.rowsData = [];
76
+ this.columnDefinitions = null;
77
+ this.focusRowIndex = 0;
78
+ this.focusColumnIndex = 0;
79
+ this.rowsRepeatBehavior = null;
80
+ this.rowsPlaceholder = null;
81
+ this.generatedHeader = null;
82
+ this.isUpdatingFocus = false;
83
+ this.pendingFocusUpdate = false;
84
+ this.rowindexUpdateQueued = false;
85
+ this.columnDefinitionsStale = true;
86
+ this.generatedGridTemplateColumns = "";
87
+ this.focusOnCell = (rowIndex, columnIndex, scrollIntoView) => {
88
+ if (this.rowElements.length === 0) {
299
89
  this.focusRowIndex = 0;
300
- /**
301
- * The index of the column that will receive focus the next time the
302
- * grid is focused. This value changes as focus moves to different rows
303
- * within the grid. Changing this value when focus is already within
304
- * the grid moves focus to the specified column.
305
- *
306
- * @public
307
- */
308
90
  this.focusColumnIndex = 0;
309
- this.rowsPlaceholder = null;
310
- this.generatedHeader = null;
311
- this.isUpdatingFocus = false;
312
- this.pendingFocusUpdate = false;
313
- this.rowindexUpdateQueued = false;
314
- this.columnDefinitionsStale = true;
315
- this.generatedGridTemplateColumns = "";
316
- this.focusOnCell = (rowIndex, columnIndex, scrollIntoView) => {
317
- if (this.rowElements.length === 0) {
318
- this.focusRowIndex = 0;
319
- this.focusColumnIndex = 0;
320
- return;
321
- }
322
- const focusRowIndex = Math.max(0, Math.min(this.rowElements.length - 1, rowIndex));
323
- const focusRow = this.rowElements[focusRowIndex];
324
- const cells = focusRow.querySelectorAll('[role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"]');
325
- const focusColumnIndex = Math.max(0, Math.min(cells.length - 1, columnIndex));
326
- const focusTarget = cells[focusColumnIndex];
327
- if (scrollIntoView &&
328
- this.scrollHeight !== this.clientHeight &&
329
- ((focusRowIndex < this.focusRowIndex && this.scrollTop > 0) ||
330
- (focusRowIndex > this.focusRowIndex &&
331
- this.scrollTop < this.scrollHeight - this.clientHeight))) {
332
- focusTarget.scrollIntoView({ block: "center", inline: "center" });
333
- }
334
- focusTarget.focus();
335
- };
336
- this.onChildListChange = (mutations,
337
- /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
338
- observer) => {
339
- if (mutations && mutations.length) {
340
- mutations.forEach((mutation) => {
341
- mutation.addedNodes.forEach((newNode) => {
342
- if (newNode.nodeType === 1 &&
343
- newNode.getAttribute("role") === "row") {
344
- newNode.columnDefinitions = this.columnDefinitions;
345
- }
346
- });
347
- });
348
- this.queueRowIndexUpdate();
349
- }
350
- };
351
- this.queueRowIndexUpdate = () => {
352
- if (!this.rowindexUpdateQueued) {
353
- this.rowindexUpdateQueued = true;
354
- index.DOM.queueUpdate(this.updateRowIndexes);
355
- }
356
- };
357
- this.updateRowIndexes = () => {
358
- let newGridTemplateColumns = this.gridTemplateColumns;
359
- if (newGridTemplateColumns === undefined) {
360
- // try to generate columns based on manual rows
361
- if (this.generatedGridTemplateColumns === "" && this.rowElements.length > 0) {
362
- const firstRow = this.rowElements[0];
363
- this.generatedGridTemplateColumns = new Array(firstRow.cellElements.length)
364
- .fill("1fr")
365
- .join(" ");
366
- }
367
- newGridTemplateColumns = this.generatedGridTemplateColumns;
91
+ return;
92
+ }
93
+ const focusRowIndex = Math.max(
94
+ 0,
95
+ Math.min(this.rowElements.length - 1, rowIndex)
96
+ );
97
+ const focusRow = this.rowElements[focusRowIndex];
98
+ const cells = focusRow.querySelectorAll(
99
+ '[role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"]'
100
+ );
101
+ const focusColumnIndex = Math.max(
102
+ 0,
103
+ Math.min(cells.length - 1, columnIndex)
104
+ );
105
+ const focusTarget = cells[focusColumnIndex];
106
+ if (scrollIntoView && this.scrollHeight !== this.clientHeight && (focusRowIndex < this.focusRowIndex && this.scrollTop > 0 || focusRowIndex > this.focusRowIndex && this.scrollTop < this.scrollHeight - this.clientHeight)) {
107
+ focusTarget.scrollIntoView({ block: "center", inline: "center" });
108
+ }
109
+ focusTarget.focus();
110
+ };
111
+ this.onChildListChange = (mutations, _) => {
112
+ if (mutations && mutations.length) {
113
+ mutations.forEach((mutation) => {
114
+ mutation.addedNodes.forEach((newNode) => {
115
+ if (newNode.nodeType === 1 && newNode.getAttribute("role") === "row") {
116
+ newNode.columnDefinitions = this.columnDefinitions;
368
117
  }
369
- this.rowElements.forEach((element, index) => {
370
- const thisRow = element;
371
- thisRow.rowIndex = index;
372
- thisRow.gridTemplateColumns = newGridTemplateColumns;
373
- if (this.columnDefinitionsStale) {
374
- thisRow.columnDefinitions = this.columnDefinitions;
375
- }
376
- });
377
- this.rowindexUpdateQueued = false;
378
- this.columnDefinitionsStale = false;
379
- };
380
- }
381
- /**
382
- * generates a gridTemplateColumns based on columndata array
383
- */
384
- static generateTemplateColumns(columnDefinitions) {
385
- let templateColumns = "";
386
- columnDefinitions.forEach((column) => {
387
- templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}${"1fr"}`;
118
+ });
388
119
  });
389
- return templateColumns;
390
- }
391
- noTabbingChanged() {
392
- if (this.$fastController.isConnected) {
393
- if (this.noTabbing) {
394
- this.setAttribute("tabIndex", "-1");
395
- }
396
- else {
397
- this.setAttribute("tabIndex", this.contains(document.activeElement) ||
398
- this === document.activeElement
399
- ? "-1"
400
- : "0");
401
- }
402
- }
403
- }
404
- generateHeaderChanged() {
405
- if (this.$fastController.isConnected) {
406
- this.toggleGeneratedHeader();
407
- }
408
- }
409
- gridTemplateColumnsChanged() {
410
- if (this.$fastController.isConnected) {
411
- this.updateRowIndexes();
120
+ this.queueRowIndexUpdate();
121
+ }
122
+ };
123
+ this.queueRowIndexUpdate = () => {
124
+ if (!this.rowindexUpdateQueued) {
125
+ this.rowindexUpdateQueued = true;
126
+ vividElement.DOM.queueUpdate(this.updateRowIndexes);
127
+ }
128
+ };
129
+ this.updateRowIndexes = () => {
130
+ let newGridTemplateColumns = this.gridTemplateColumns;
131
+ if (newGridTemplateColumns === void 0) {
132
+ if (this.generatedGridTemplateColumns === "" && this.rowElements.length > 0) {
133
+ const firstRow = this.rowElements[0];
134
+ this.generatedGridTemplateColumns = new Array(
135
+ firstRow.cellElements.length
136
+ ).fill("1fr").join(" ");
412
137
  }
413
- }
414
- rowsDataChanged() {
415
- if (this.columnDefinitions === null && this.rowsData.length > 0) {
416
- this.columnDefinitions = DataGrid.generateColumns(this.rowsData[0]);
138
+ newGridTemplateColumns = this.generatedGridTemplateColumns;
139
+ }
140
+ this.rowElements.forEach((element, index) => {
141
+ const thisRow = element;
142
+ thisRow.rowIndex = index;
143
+ thisRow.gridTemplateColumns = newGridTemplateColumns;
144
+ if (this.columnDefinitionsStale) {
145
+ thisRow.columnDefinitions = this.columnDefinitions;
417
146
  }
418
- if (this.$fastController.isConnected) {
419
- this.toggleGeneratedHeader();
147
+ });
148
+ this.rowindexUpdateQueued = false;
149
+ this.columnDefinitionsStale = false;
150
+ };
151
+ this.#handleKeypress = (e) => {
152
+ if (e.key === "Enter" || e.key === " ") {
153
+ this.#handleClick(e);
154
+ }
155
+ };
156
+ this.#handleClick = ({ target, ctrlKey, shiftKey, metaKey }) => {
157
+ if (target.getAttribute("role") !== "gridcell") return;
158
+ if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
159
+ this.#handleCellSelection({ target, ctrlKey, shiftKey, metaKey });
160
+ return;
161
+ }
162
+ if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
163
+ this.#handleRowSelection({ target, ctrlKey, shiftKey, metaKey });
164
+ }
165
+ };
166
+ this.#handleCellSelection = ({
167
+ target,
168
+ ctrlKey,
169
+ shiftKey,
170
+ metaKey
171
+ }) => {
172
+ const cell = target;
173
+ if (this.selectionMode === DataGridSelectionMode.multiCell && (ctrlKey || shiftKey || metaKey)) {
174
+ this.#setSelectedState(cell, !this.#selectedCells.includes(cell));
175
+ } else {
176
+ const cacheTargetSelection = cell.getAttribute("aria-selected") === "true";
177
+ this.#resetSelection();
178
+ this.#setSelectedState(cell, !cacheTargetSelection);
179
+ }
180
+ };
181
+ this.#handleRowSelection = ({
182
+ target,
183
+ ctrlKey,
184
+ shiftKey,
185
+ metaKey
186
+ }) => {
187
+ const row = target.parentNode;
188
+ if (this.selectionMode === DataGridSelectionMode.multiRow && (ctrlKey || shiftKey || metaKey)) {
189
+ this.#setSelectedState(row, !this.#selectedRows.includes(row));
190
+ } else {
191
+ const cacheTargetSelection = row.getAttribute("aria-selected") === "true";
192
+ this.#resetSelection();
193
+ this.#setSelectedState(row, !cacheTargetSelection);
194
+ }
195
+ };
196
+ this.#changeHandler = {
197
+ handleChange(dataGrid, propertyName) {
198
+ if (propertyName === "columnDefinitions") {
199
+ if (dataGrid.$fastController.isConnected) {
200
+ dataGrid.toggleGeneratedHeader();
201
+ }
420
202
  }
203
+ }
204
+ };
205
+ this.#setSelectedState = (cell, selectedState) => {
206
+ cell.setAttribute("aria-selected", selectedState.toString());
207
+ };
208
+ this.#resetSelection = () => {
209
+ if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
210
+ Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
211
+ (cell) => this.#setSelectedState(cell, false)
212
+ );
213
+ Array.from(this.querySelectorAll('[role="row"]')).forEach(
214
+ (row) => row.removeAttribute("aria-selected")
215
+ );
216
+ }
217
+ if (this.selectionMode === DataGridSelectionMode.none) {
218
+ Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
219
+ (cell) => cell.removeAttribute("aria-selected")
220
+ );
221
+ Array.from(this.querySelectorAll('[role="row"]')).forEach(
222
+ (row) => row.removeAttribute("aria-selected")
223
+ );
224
+ }
225
+ if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
226
+ Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
227
+ (cell) => cell.removeAttribute("aria-selected")
228
+ );
229
+ Array.from(this.querySelectorAll('[role="row"]')).forEach(
230
+ (row) => row.setAttribute("aria-selected", "false")
231
+ );
232
+ }
233
+ };
234
+ this.#initSelections = () => {
235
+ if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
236
+ Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
237
+ (cell) => !cell.hasAttribute("aria-selected") && this.#setSelectedState(cell, false)
238
+ );
239
+ Array.from(this.querySelectorAll('[role="row"]')).forEach(
240
+ (row) => row.removeAttribute("aria-selected")
241
+ );
242
+ }
243
+ if (this.selectionMode === DataGridSelectionMode.none) {
244
+ Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
245
+ (cell) => cell.removeAttribute("aria-selected")
246
+ );
247
+ Array.from(this.querySelectorAll('[role="row"]')).forEach(
248
+ (row) => row.removeAttribute("aria-selected")
249
+ );
250
+ }
251
+ if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
252
+ Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
253
+ (cell) => cell.removeAttribute("aria-selected")
254
+ );
255
+ Array.from(this.querySelectorAll('[role="row"]')).forEach(
256
+ (row) => !row.hasAttribute("aria-selected") && row.setAttribute("aria-selected", "false")
257
+ );
258
+ }
259
+ };
260
+ this.addEventListener("click", this.#handleClick);
261
+ this.addEventListener("keydown", this.#handleKeypress);
262
+ }
263
+ /**
264
+ * generates a gridTemplateColumns based on columndata array
265
+ */
266
+ static generateTemplateColumns(columnDefinitions) {
267
+ let templateColumns = "";
268
+ columnDefinitions.forEach((_) => {
269
+ templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}${"1fr"}`;
270
+ });
271
+ return templateColumns;
272
+ }
273
+ /**
274
+ * @internal
275
+ */
276
+ noTabbingChanged() {
277
+ if (this.noTabbing) {
278
+ this.setAttribute("tabIndex", "-1");
279
+ } else {
280
+ this.setAttribute(
281
+ "tabIndex",
282
+ this.contains(document.activeElement) ? "-1" : "0"
283
+ );
421
284
  }
422
- columnDefinitionsChanged() {
423
- if (this.columnDefinitions === null) {
424
- this.generatedGridTemplateColumns = "";
425
- return;
426
- }
427
- this.generatedGridTemplateColumns = DataGrid.generateTemplateColumns(this.columnDefinitions);
428
- if (this.$fastController.isConnected) {
429
- this.columnDefinitionsStale = true;
430
- this.queueRowIndexUpdate();
431
- }
285
+ }
286
+ /**
287
+ * @internal
288
+ */
289
+ generateHeaderChanged() {
290
+ if (this.$fastController.isConnected) {
291
+ this.toggleGeneratedHeader();
432
292
  }
433
- headerCellItemTemplateChanged() {
434
- if (this.$fastController.isConnected) {
435
- if (this.generatedHeader !== null) {
436
- this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
437
- }
438
- }
293
+ }
294
+ /**
295
+ * @internal
296
+ */
297
+ gridTemplateColumnsChanged() {
298
+ if (this.$fastController.isConnected) {
299
+ this.updateRowIndexes();
439
300
  }
440
- focusRowIndexChanged() {
441
- if (this.$fastController.isConnected) {
442
- this.queueFocusUpdate();
443
- }
301
+ }
302
+ /**
303
+ * @internal
304
+ */
305
+ rowsDataChanged() {
306
+ if (this.columnDefinitions === null && this.rowsData.length > 0) {
307
+ this.columnDefinitions = _DataGrid.generateColumns(this.rowsData[0]);
444
308
  }
445
- focusColumnIndexChanged() {
446
- if (this.$fastController.isConnected) {
447
- this.queueFocusUpdate();
448
- }
309
+ if (this.$fastController.isConnected) {
310
+ this.toggleGeneratedHeader();
449
311
  }
450
- /**
451
- * @internal
452
- */
453
- connectedCallback() {
454
- super.connectedCallback();
455
- if (this.rowItemTemplate === undefined) {
456
- this.rowItemTemplate = this.defaultRowItemTemplate;
457
- }
458
- this.rowsPlaceholder = document.createComment("");
459
- this.appendChild(this.rowsPlaceholder);
460
- this.toggleGeneratedHeader();
461
- this.rowsRepeatBehavior = new repeat.RepeatDirective(x => x.rowsData, x => x.rowItemTemplate, { positioning: true }).createBehavior(this.rowsPlaceholder);
462
- /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
463
- this.$fastController.addBehaviors([this.rowsRepeatBehavior]);
464
- this.addEventListener("row-focused", this.handleRowFocus);
465
- this.addEventListener(eventFocus, this.handleFocus);
466
- this.addEventListener(eventKeyDown, this.handleKeydown);
467
- this.addEventListener(eventFocusOut, this.handleFocusOut);
468
- this.observer = new MutationObserver(this.onChildListChange);
469
- // only observe if nodes are added or removed
470
- this.observer.observe(this, { childList: true });
471
- if (this.noTabbing) {
472
- this.setAttribute("tabindex", "-1");
473
- }
474
- index.DOM.queueUpdate(this.queueRowIndexUpdate);
312
+ }
313
+ /**
314
+ * @internal
315
+ */
316
+ columnDefinitionsChanged() {
317
+ if (this.columnDefinitions === null) {
318
+ this.generatedGridTemplateColumns = "";
319
+ return;
475
320
  }
476
- /**
477
- * @internal
478
- */
479
- disconnectedCallback() {
480
- super.disconnectedCallback();
481
- this.removeEventListener("row-focused", this.handleRowFocus);
482
- this.removeEventListener(eventFocus, this.handleFocus);
483
- this.removeEventListener(eventKeyDown, this.handleKeydown);
484
- this.removeEventListener(eventFocusOut, this.handleFocusOut);
485
- // disconnect observer
486
- this.observer.disconnect();
487
- this.rowsPlaceholder = null;
488
- this.generatedHeader = null;
321
+ this.generatedGridTemplateColumns = _DataGrid.generateTemplateColumns(
322
+ this.columnDefinitions
323
+ );
324
+ if (this.$fastController.isConnected) {
325
+ this.columnDefinitionsStale = true;
326
+ this.queueRowIndexUpdate();
489
327
  }
490
- /**
491
- * @internal
492
- */
493
- handleRowFocus(e) {
494
- this.isUpdatingFocus = true;
495
- const focusRow = e.target;
496
- this.focusRowIndex = this.rowElements.indexOf(focusRow);
497
- this.focusColumnIndex = focusRow.focusColumnIndex;
498
- this.setAttribute("tabIndex", "-1");
499
- this.isUpdatingFocus = false;
328
+ }
329
+ /**
330
+ * @internal
331
+ */
332
+ headerCellItemTemplateChanged() {
333
+ if (this.$fastController.isConnected) {
334
+ if (this.generatedHeader !== null) {
335
+ this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
336
+ }
500
337
  }
501
- /**
502
- * @internal
503
- */
504
- handleFocus(e) {
505
- this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
338
+ }
339
+ /**
340
+ * @internal
341
+ */
342
+ focusRowIndexChanged() {
343
+ if (this.$fastController.isConnected) {
344
+ this.queueFocusUpdate();
506
345
  }
507
- /**
508
- * @internal
509
- */
510
- handleFocusOut(e) {
511
- if (e.relatedTarget === null || !this.contains(e.relatedTarget)) {
512
- this.setAttribute("tabIndex", this.noTabbing ? "-1" : "0");
513
- }
346
+ }
347
+ /**
348
+ * @internal
349
+ */
350
+ focusColumnIndexChanged() {
351
+ if (this.$fastController.isConnected) {
352
+ this.queueFocusUpdate();
514
353
  }
515
- /**
516
- * @internal
517
- */
518
- handleKeydown(e) {
519
- if (e.defaultPrevented) {
520
- return;
521
- }
522
- let newFocusRowIndex;
523
- const maxIndex = this.rowElements.length - 1;
524
- const currentGridBottom = this.offsetHeight + this.scrollTop;
525
- const lastRow = this.rowElements[maxIndex];
526
- switch (e.key) {
527
- case keyCodes.keyArrowUp:
528
- e.preventDefault();
529
- // focus up one row
530
- this.focusOnCell(this.focusRowIndex - 1, this.focusColumnIndex, true);
531
- break;
532
- case keyCodes.keyArrowDown:
533
- e.preventDefault();
534
- // focus down one row
535
- this.focusOnCell(this.focusRowIndex + 1, this.focusColumnIndex, true);
536
- break;
537
- case keyCodes.keyPageUp:
538
- e.preventDefault();
539
- if (this.rowElements.length === 0) {
540
- this.focusOnCell(0, 0, false);
541
- break;
542
- }
543
- if (this.focusRowIndex === 0) {
544
- this.focusOnCell(0, this.focusColumnIndex, false);
545
- return;
546
- }
547
- newFocusRowIndex = this.focusRowIndex - 1;
548
- for (newFocusRowIndex; newFocusRowIndex >= 0; newFocusRowIndex--) {
549
- const thisRow = this.rowElements[newFocusRowIndex];
550
- if (thisRow.offsetTop < this.scrollTop) {
551
- this.scrollTop =
552
- thisRow.offsetTop + thisRow.clientHeight - this.clientHeight;
553
- break;
554
- }
555
- }
556
- this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
557
- break;
558
- case keyCodes.keyPageDown:
559
- e.preventDefault();
560
- if (this.rowElements.length === 0) {
561
- this.focusOnCell(0, 0, false);
562
- break;
563
- }
564
- // focus down one "page"
565
- if (this.focusRowIndex >= maxIndex ||
566
- lastRow.offsetTop + lastRow.offsetHeight <= currentGridBottom) {
567
- this.focusOnCell(maxIndex, this.focusColumnIndex, false);
568
- return;
569
- }
570
- newFocusRowIndex = this.focusRowIndex + 1;
571
- for (newFocusRowIndex; newFocusRowIndex <= maxIndex; newFocusRowIndex++) {
572
- const thisRow = this.rowElements[newFocusRowIndex];
573
- if (thisRow.offsetTop + thisRow.offsetHeight > currentGridBottom) {
574
- let stickyHeaderOffset = 0;
575
- if (this.generateHeader === GenerateHeaderOptions$1.sticky &&
576
- this.generatedHeader !== null) {
577
- stickyHeaderOffset = this.generatedHeader.clientHeight;
578
- }
579
- this.scrollTop = thisRow.offsetTop - stickyHeaderOffset;
580
- break;
581
- }
582
- }
583
- this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
584
- break;
585
- case keyCodes.keyHome:
586
- if (e.ctrlKey) {
587
- e.preventDefault();
588
- // focus first cell of first row
589
- this.focusOnCell(0, 0, true);
590
- }
591
- break;
592
- case keyCodes.keyEnd:
593
- if (e.ctrlKey && this.columnDefinitions !== null) {
594
- e.preventDefault();
595
- // focus last cell of last row
596
- this.focusOnCell(this.rowElements.length - 1, this.columnDefinitions.length - 1, true);
597
- }
598
- break;
599
- }
354
+ }
355
+ /**
356
+ * @internal
357
+ */
358
+ connectedCallback() {
359
+ super.connectedCallback();
360
+ if (this.rowItemTemplate === void 0) {
361
+ this.rowItemTemplate = this.defaultRowItemTemplate;
600
362
  }
601
- queueFocusUpdate() {
602
- if (this.isUpdatingFocus &&
603
- (this.contains(document.activeElement) || this === document.activeElement)) {
604
- return;
605
- }
606
- if (this.pendingFocusUpdate === false) {
607
- this.pendingFocusUpdate = true;
608
- index.DOM.queueUpdate(() => this.updateFocus());
609
- }
363
+ this.rowsPlaceholder = document.createComment("");
364
+ this.appendChild(this.rowsPlaceholder);
365
+ this.toggleGeneratedHeader();
366
+ this.rowsRepeatBehavior = new repeat.RepeatDirective(
367
+ (x) => x.rowsData,
368
+ (x) => x.rowItemTemplate,
369
+ { positioning: true }
370
+ ).createBehavior(this.rowsPlaceholder);
371
+ this.$fastController.addBehaviors([this.rowsRepeatBehavior]);
372
+ this.addEventListener("row-focused", this.handleRowFocus);
373
+ this.addEventListener(eventFocus, this.handleFocus);
374
+ this.addEventListener(eventKeyDown, this.handleKeydown);
375
+ this.addEventListener(eventFocusOut, this.handleFocusOut);
376
+ this.observer = new MutationObserver(this.onChildListChange);
377
+ this.observer.observe(this, { childList: true });
378
+ vividElement.DOM.queueUpdate(this.queueRowIndexUpdate);
379
+ vividElement.Observable.getNotifier(this).subscribe(
380
+ this.#changeHandler,
381
+ "columnDefinitions"
382
+ );
383
+ }
384
+ /**
385
+ * @internal
386
+ */
387
+ disconnectedCallback() {
388
+ super.disconnectedCallback();
389
+ this.removeEventListener("row-focused", this.handleRowFocus);
390
+ this.removeEventListener(eventFocus, this.handleFocus);
391
+ this.removeEventListener(eventKeyDown, this.handleKeydown);
392
+ this.removeEventListener(
393
+ eventFocusOut,
394
+ this.handleFocusOut
395
+ );
396
+ this.observer.disconnect();
397
+ this.rowsPlaceholder = null;
398
+ this.generatedHeader = null;
399
+ vividElement.Observable.getNotifier(this).unsubscribe(
400
+ this.#changeHandler,
401
+ "columnDefinitions"
402
+ );
403
+ }
404
+ /**
405
+ * @internal
406
+ */
407
+ handleRowFocus(e) {
408
+ this.isUpdatingFocus = true;
409
+ const focusRow = e.target;
410
+ this.focusRowIndex = this.rowElements.indexOf(focusRow);
411
+ this.focusColumnIndex = focusRow.focusColumnIndex;
412
+ this.setAttribute("tabIndex", "-1");
413
+ this.isUpdatingFocus = false;
414
+ }
415
+ /**
416
+ * @internal
417
+ */
418
+ handleFocus(_) {
419
+ this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
420
+ }
421
+ /**
422
+ * @internal
423
+ */
424
+ handleFocusOut(e) {
425
+ if (e.relatedTarget === null || !this.contains(e.relatedTarget)) {
426
+ this.setAttribute("tabIndex", this.noTabbing ? "-1" : "0");
610
427
  }
611
- updateFocus() {
612
- this.pendingFocusUpdate = false;
613
- this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
428
+ }
429
+ /**
430
+ * @internal
431
+ */
432
+ handleKeydown(e) {
433
+ if (e.defaultPrevented) {
434
+ return;
614
435
  }
615
- toggleGeneratedHeader() {
616
- if (this.generatedHeader !== null) {
617
- this.removeChild(this.generatedHeader);
618
- this.generatedHeader = null;
436
+ let newFocusRowIndex;
437
+ const maxIndex = this.rowElements.length - 1;
438
+ const currentGridBottom = this.offsetHeight + this.scrollTop;
439
+ const lastRow = this.rowElements[maxIndex];
440
+ switch (e.key) {
441
+ case keyCodes.keyArrowUp:
442
+ e.preventDefault();
443
+ this.focusOnCell(this.focusRowIndex - 1, this.focusColumnIndex, true);
444
+ break;
445
+ case keyCodes.keyArrowDown:
446
+ e.preventDefault();
447
+ this.focusOnCell(this.focusRowIndex + 1, this.focusColumnIndex, true);
448
+ break;
449
+ case keyCodes.keyPageUp:
450
+ e.preventDefault();
451
+ if (this.rowElements.length === 0) {
452
+ this.focusOnCell(0, 0, false);
453
+ break;
619
454
  }
620
- if (this.generateHeader !== GenerateHeaderOptions$1.none &&
621
- this.rowsData.length > 0) {
622
- const generatedHeaderElement = document.createElement(this.rowElementTag);
623
- this.generatedHeader = generatedHeaderElement;
624
- this.generatedHeader.columnDefinitions = this.columnDefinitions;
625
- this.generatedHeader.gridTemplateColumns = this.gridTemplateColumns;
626
- this.generatedHeader.rowType =
627
- this.generateHeader === GenerateHeaderOptions$1.sticky
628
- ? DataGridRowTypes$1.stickyHeader
629
- : DataGridRowTypes$1.header;
630
- if (this.firstChild !== null || this.rowsPlaceholder !== null) {
631
- this.insertBefore(generatedHeaderElement, this.firstChild !== null ? this.firstChild : this.rowsPlaceholder);
632
- }
633
- return;
455
+ if (this.focusRowIndex === 0) {
456
+ this.focusOnCell(0, this.focusColumnIndex, false);
457
+ return;
634
458
  }
635
- }
636
- };
637
- /**
638
- * generates a basic column definition by examining sample row data
639
- */
640
- DataGrid$1.generateColumns = (row) => {
641
- return Object.getOwnPropertyNames(row).map((property, index) => {
642
- return {
643
- columnDataKey: property,
644
- gridColumn: `${index}`,
645
- };
646
- });
647
- };
648
- index.__decorate([
649
- index.attr({ attribute: "no-tabbing", mode: "boolean" })
650
- ], DataGrid$1.prototype, "noTabbing", void 0);
651
- index.__decorate([
652
- index.attr({ attribute: "generate-header" })
653
- ], DataGrid$1.prototype, "generateHeader", void 0);
654
- index.__decorate([
655
- index.attr({ attribute: "grid-template-columns" })
656
- ], DataGrid$1.prototype, "gridTemplateColumns", void 0);
657
- index.__decorate([
658
- index.observable
659
- ], DataGrid$1.prototype, "rowsData", void 0);
660
- index.__decorate([
661
- index.observable
662
- ], DataGrid$1.prototype, "columnDefinitions", void 0);
663
- index.__decorate([
664
- index.observable
665
- ], DataGrid$1.prototype, "rowItemTemplate", void 0);
666
- index.__decorate([
667
- index.observable
668
- ], DataGrid$1.prototype, "cellItemTemplate", void 0);
669
- index.__decorate([
670
- index.observable
671
- ], DataGrid$1.prototype, "headerCellItemTemplate", void 0);
672
- index.__decorate([
673
- index.observable
674
- ], DataGrid$1.prototype, "focusRowIndex", void 0);
675
- index.__decorate([
676
- index.observable
677
- ], DataGrid$1.prototype, "focusColumnIndex", void 0);
678
- index.__decorate([
679
- index.observable
680
- ], DataGrid$1.prototype, "defaultRowItemTemplate", void 0);
681
- index.__decorate([
682
- index.observable
683
- ], DataGrid$1.prototype, "rowElementTag", void 0);
684
- index.__decorate([
685
- index.observable
686
- ], DataGrid$1.prototype, "rowElements", void 0);
687
-
688
- const defaultCellContentsTemplate = index.html `
689
- <template>
690
- ${x => x.rowData === null ||
691
- x.columnDefinition === null ||
692
- x.columnDefinition.columnDataKey === null
693
- ? null
694
- : x.rowData[x.columnDefinition.columnDataKey]}
695
- </template>
696
- `;
697
- const defaultHeaderCellContentsTemplate = index.html `
698
- <template>
699
- ${x => x.columnDefinition === null
700
- ? null
701
- : x.columnDefinition.title === undefined
702
- ? x.columnDefinition.columnDataKey
703
- : x.columnDefinition.title}
704
- </template>
705
- `;
706
- /**
707
- * A Data Grid Cell Custom HTML Element.
708
- *
709
- * @fires cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
710
- * @slot - The default slot for cell contents. The "cell contents template" renders here.
711
- * @public
712
- */
713
- let DataGridCell$1 = class DataGridCell extends index.FoundationElement {
714
- constructor() {
715
- super(...arguments);
716
- /**
717
- * The type of cell
718
- *
719
- * @public
720
- * @remarks
721
- * HTML Attribute: cell-type
722
- */
723
- this.cellType = DataGridCellTypes.default;
724
- /**
725
- * The base data for the parent row
726
- *
727
- * @public
728
- */
729
- this.rowData = null;
730
- /**
731
- * The base data for the column
732
- *
733
- * @public
734
- */
735
- this.columnDefinition = null;
736
- this.isActiveCell = false;
737
- this.customCellView = null;
738
- this.updateCellStyle = () => {
739
- this.style.gridColumn = this.gridColumn;
740
- };
741
- }
742
- cellTypeChanged() {
743
- if (this.$fastController.isConnected) {
744
- this.updateCellView();
459
+ newFocusRowIndex = this.focusRowIndex - 1;
460
+ for (newFocusRowIndex; newFocusRowIndex >= 0; newFocusRowIndex--) {
461
+ const thisRow = this.rowElements[newFocusRowIndex];
462
+ if (thisRow.offsetTop < this.scrollTop) {
463
+ this.scrollTop = thisRow.offsetTop + thisRow.clientHeight - this.clientHeight;
464
+ break;
465
+ }
745
466
  }
746
- }
747
- gridColumnChanged() {
748
- if (this.$fastController.isConnected) {
749
- this.updateCellStyle();
467
+ this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
468
+ break;
469
+ case keyCodes.keyPageDown:
470
+ e.preventDefault();
471
+ if (this.rowElements.length === 0) {
472
+ this.focusOnCell(0, 0, false);
473
+ break;
750
474
  }
751
- }
752
- columnDefinitionChanged(oldValue, newValue) {
753
- if (this.$fastController.isConnected) {
754
- this.updateCellView();
475
+ if (this.focusRowIndex >= maxIndex || lastRow.offsetTop + lastRow.offsetHeight <= currentGridBottom) {
476
+ this.focusOnCell(maxIndex, this.focusColumnIndex, false);
477
+ return;
755
478
  }
756
- }
757
- /**
758
- * @internal
759
- */
760
- connectedCallback() {
761
- var _a;
762
- super.connectedCallback();
763
- this.addEventListener(eventFocusIn, this.handleFocusin);
764
- this.addEventListener(eventFocusOut, this.handleFocusout);
765
- this.addEventListener(eventKeyDown, this.handleKeydown);
766
- this.style.gridColumn = `${((_a = this.columnDefinition) === null || _a === void 0 ? void 0 : _a.gridColumn) === undefined
767
- ? 0
768
- : this.columnDefinition.gridColumn}`;
769
- this.updateCellView();
770
- this.updateCellStyle();
771
- }
772
- /**
773
- * @internal
774
- */
775
- disconnectedCallback() {
776
- super.disconnectedCallback();
777
- this.removeEventListener(eventFocusIn, this.handleFocusin);
778
- this.removeEventListener(eventFocusOut, this.handleFocusout);
779
- this.removeEventListener(eventKeyDown, this.handleKeydown);
780
- this.disconnectCellView();
781
- }
782
- handleFocusin(e) {
783
- if (this.isActiveCell) {
784
- return;
479
+ newFocusRowIndex = this.focusRowIndex + 1;
480
+ for (newFocusRowIndex; newFocusRowIndex <= maxIndex; newFocusRowIndex++) {
481
+ const thisRow = this.rowElements[newFocusRowIndex];
482
+ if (thisRow.offsetTop + thisRow.offsetHeight > currentGridBottom) {
483
+ let stickyHeaderOffset = 0;
484
+ if (this.generateHeader === GenerateHeaderOptions.sticky && this.generatedHeader !== null) {
485
+ stickyHeaderOffset = this.generatedHeader.clientHeight;
486
+ }
487
+ this.scrollTop = thisRow.offsetTop - stickyHeaderOffset;
488
+ break;
489
+ }
785
490
  }
786
- this.isActiveCell = true;
787
- switch (this.cellType) {
788
- case DataGridCellTypes.columnHeader:
789
- if (this.columnDefinition !== null &&
790
- this.columnDefinition.headerCellInternalFocusQueue !== true &&
791
- typeof this.columnDefinition.headerCellFocusTargetCallback ===
792
- "function") {
793
- // move focus to the focus target
794
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
795
- if (focusTarget !== null) {
796
- focusTarget.focus();
797
- }
798
- }
799
- break;
800
- default:
801
- if (this.columnDefinition !== null &&
802
- this.columnDefinition.cellInternalFocusQueue !== true &&
803
- typeof this.columnDefinition.cellFocusTargetCallback === "function") {
804
- // move focus to the focus target
805
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
806
- if (focusTarget !== null) {
807
- focusTarget.focus();
808
- }
809
- }
810
- break;
491
+ this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
492
+ break;
493
+ case keyCodes.keyHome:
494
+ if (e.ctrlKey) {
495
+ e.preventDefault();
496
+ this.focusOnCell(0, 0, true);
811
497
  }
812
- this.$emit("cell-focused", this);
813
- }
814
- handleFocusout(e) {
815
- if (this !== document.activeElement && !this.contains(document.activeElement)) {
816
- this.isActiveCell = false;
498
+ break;
499
+ case keyCodes.keyEnd:
500
+ if (e.ctrlKey && this.columnDefinitions !== null) {
501
+ e.preventDefault();
502
+ this.focusOnCell(
503
+ this.rowElements.length - 1,
504
+ this.columnDefinitions.length - 1,
505
+ true
506
+ );
817
507
  }
508
+ break;
818
509
  }
819
- handleKeydown(e) {
820
- if (e.defaultPrevented ||
821
- this.columnDefinition === null ||
822
- (this.cellType === DataGridCellTypes.default &&
823
- this.columnDefinition.cellInternalFocusQueue !== true) ||
824
- (this.cellType === DataGridCellTypes.columnHeader &&
825
- this.columnDefinition.headerCellInternalFocusQueue !== true)) {
826
- return;
827
- }
828
- switch (e.key) {
829
- case keyCodes.keyEnter:
830
- case keyCodes.keyFunction2:
831
- if (this.contains(document.activeElement) &&
832
- document.activeElement !== this) {
833
- return;
834
- }
835
- switch (this.cellType) {
836
- case DataGridCellTypes.columnHeader:
837
- if (this.columnDefinition.headerCellFocusTargetCallback !==
838
- undefined) {
839
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
840
- if (focusTarget !== null) {
841
- focusTarget.focus();
842
- }
843
- e.preventDefault();
844
- }
845
- break;
846
- default:
847
- if (this.columnDefinition.cellFocusTargetCallback !== undefined) {
848
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
849
- if (focusTarget !== null) {
850
- focusTarget.focus();
851
- }
852
- e.preventDefault();
853
- }
854
- break;
855
- }
856
- break;
857
- case keyCodes.keyEscape:
858
- if (this.contains(document.activeElement) &&
859
- document.activeElement !== this) {
860
- this.focus();
861
- e.preventDefault();
862
- }
863
- break;
864
- }
510
+ }
511
+ queueFocusUpdate() {
512
+ if (this.isUpdatingFocus && this.contains(document.activeElement)) {
513
+ return;
865
514
  }
866
- updateCellView() {
867
- this.disconnectCellView();
868
- if (this.columnDefinition === null) {
869
- return;
870
- }
871
- switch (this.cellType) {
872
- case DataGridCellTypes.columnHeader:
873
- if (this.columnDefinition.headerCellTemplate !== undefined) {
874
- this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
875
- }
876
- else {
877
- this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
878
- }
879
- break;
880
- case undefined:
881
- case DataGridCellTypes.rowHeader:
882
- case DataGridCellTypes.default:
883
- if (this.columnDefinition.cellTemplate !== undefined) {
884
- this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
885
- }
886
- else {
887
- this.customCellView = defaultCellContentsTemplate.render(this, this);
888
- }
889
- break;
890
- }
515
+ if (this.pendingFocusUpdate === false) {
516
+ this.pendingFocusUpdate = true;
517
+ vividElement.DOM.queueUpdate(() => this.updateFocus());
891
518
  }
892
- disconnectCellView() {
893
- if (this.customCellView !== null) {
894
- this.customCellView.dispose();
895
- this.customCellView = null;
896
- }
519
+ }
520
+ updateFocus() {
521
+ this.pendingFocusUpdate = false;
522
+ this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
523
+ }
524
+ toggleGeneratedHeader() {
525
+ if (this.generatedHeader !== null) {
526
+ this.removeChild(this.generatedHeader);
527
+ this.generatedHeader = null;
528
+ }
529
+ if (this.generateHeader !== GenerateHeaderOptions.none && this.columnDefinitions !== null) {
530
+ const generatedHeaderElement = document.createElement(
531
+ this.rowElementTag
532
+ );
533
+ this.generatedHeader = generatedHeaderElement;
534
+ this.generatedHeader.columnDefinitions = this.columnDefinitions;
535
+ this.generatedHeader.gridTemplateColumns = this.gridTemplateColumns;
536
+ this.generatedHeader.rowType = this.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : DataGridRowTypes.header;
537
+ if (this.firstChild !== null || this.rowsPlaceholder !== null) {
538
+ this.insertBefore(
539
+ generatedHeaderElement,
540
+ this.firstChild !== null ? this.firstChild : this.rowsPlaceholder
541
+ );
542
+ }
543
+ return;
897
544
  }
898
- };
899
- index.__decorate([
900
- index.attr({ attribute: "cell-type" })
901
- ], DataGridCell$1.prototype, "cellType", void 0);
902
- index.__decorate([
903
- index.attr({ attribute: "grid-column" })
904
- ], DataGridCell$1.prototype, "gridColumn", void 0);
905
- index.__decorate([
906
- index.observable
907
- ], DataGridCell$1.prototype, "rowData", void 0);
908
- index.__decorate([
909
- index.observable
910
- ], DataGridCell$1.prototype, "columnDefinition", void 0);
911
-
912
- 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-thumb-color)}.base{position:relative;overflow:auto;block-size:inherit;inline-size:100%;max-block-size:inherit}";
913
-
914
- 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)}";
915
-
916
- 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:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - 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}";
917
-
918
- const DataGridCellSortStates = {
919
- none: "none",
920
- ascending: "ascending",
921
- descending: "descending",
922
- other: "other"
923
- };
924
- const GenerateHeaderOptions = {
925
- none: "none",
926
- default: "default",
927
- sticky: "sticky"
928
- };
929
- const DataGridRowTypes = {
930
- default: "default",
931
- header: "header",
932
- stickyHeader: "sticky-header"
933
- };
934
- const DataGridCellRole = {
935
- columnheader: "columnheader",
936
- rowheader: "rowheader",
937
- default: "gridcell"
938
- };
939
-
940
- var __defProp$2 = Object.defineProperty;
941
- var __decorateClass$2 = (decorators, target, key, kind) => {
942
- var result = void 0 ;
943
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
944
- if (decorator = decorators[i])
945
- result = (decorator(target, key, result) ) || result;
946
- if (result) __defProp$2(target, key, result);
947
- return result;
948
- };
949
- const DataGridSelectionMode = {
950
- none: "none",
951
- singleRow: "single-row",
952
- multiRow: "multi-row",
953
- singleCell: "single-cell",
954
- multiCell: "multi-cell"
955
- };
956
- class DataGrid extends DataGrid$1 {
545
+ }
957
546
  /**
958
547
  *
959
548
  *
@@ -978,162 +567,19 @@ class DataGrid extends DataGrid$1 {
978
567
  }
979
568
  selectionModeChanged(oldValue) {
980
569
  if (oldValue === void 0) {
981
- index.DOM.queueUpdate(this.#initSelections);
570
+ vividElement.DOM.queueUpdate(this.#initSelections);
982
571
  return;
983
572
  }
984
573
  this.#resetSelection();
985
574
  }
986
- #handleKeypress = (e) => {
987
- if (e.key === "Enter" || e.key === " ") {
988
- this.#handleClick(e);
989
- }
990
- };
991
- #handleClick = ({ target, ctrlKey, shiftKey, metaKey }) => {
992
- if (target.getAttribute("role") !== "gridcell") return;
993
- if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
994
- this.#handleCellSelection({ target, ctrlKey, shiftKey, metaKey });
995
- return;
996
- }
997
- if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
998
- this.#handleRowSelection({ target, ctrlKey, shiftKey, metaKey });
999
- }
1000
- };
1001
- #handleCellSelection = ({
1002
- target,
1003
- ctrlKey,
1004
- shiftKey,
1005
- metaKey
1006
- }) => {
1007
- const cell = target;
1008
- if (this.selectionMode === DataGridSelectionMode.multiCell && (ctrlKey || shiftKey || metaKey)) {
1009
- this.#setSelectedState(cell, !this.#selectedCells.includes(cell));
1010
- } else {
1011
- const cacheTargetSelection = cell.getAttribute("aria-selected") === "true";
1012
- this.#resetSelection();
1013
- this.#setSelectedState(cell, !cacheTargetSelection);
1014
- }
1015
- };
1016
- #handleRowSelection = ({
1017
- target,
1018
- ctrlKey,
1019
- shiftKey,
1020
- metaKey
1021
- }) => {
1022
- const row = target.parentNode;
1023
- if (this.selectionMode === DataGridSelectionMode.multiRow && (ctrlKey || shiftKey || metaKey)) {
1024
- this.#setSelectedState(row, !this.#selectedRows.includes(row));
1025
- } else {
1026
- const cacheTargetSelection = row.getAttribute("aria-selected") === "true";
1027
- this.#resetSelection();
1028
- this.#setSelectedState(row, !cacheTargetSelection);
1029
- }
1030
- };
1031
- constructor() {
1032
- super();
1033
- this.addEventListener("click", this.#handleClick);
1034
- this.addEventListener("keydown", this.#handleKeypress);
1035
- const privates = this;
1036
- privates.toggleGeneratedHeader = () => {
1037
- if (privates.generatedHeader !== null) {
1038
- this.removeChild(privates.generatedHeader);
1039
- privates.generatedHeader = null;
1040
- }
1041
- if (this.generateHeader !== GenerateHeaderOptions.none && this.columnDefinitions !== null) {
1042
- const generatedHeaderElement = document.createElement(
1043
- this.rowElementTag
1044
- );
1045
- privates.generatedHeader = generatedHeaderElement;
1046
- privates.generatedHeader.columnDefinitions = this.columnDefinitions;
1047
- privates.generatedHeader.gridTemplateColumns = this.gridTemplateColumns;
1048
- privates.generatedHeader.rowType = this.generateHeader === GenerateHeaderOptions.sticky ? DataGridRowTypes.stickyHeader : DataGridRowTypes.header;
1049
- if (this.firstChild !== null || privates.rowsPlaceholder !== null) {
1050
- this.insertBefore(
1051
- generatedHeaderElement,
1052
- this.firstChild !== null ? this.firstChild : privates.rowsPlaceholder
1053
- );
1054
- }
1055
- return;
1056
- }
1057
- };
1058
- }
1059
- #changeHandler = {
1060
- handleChange(dataGrid, propertyName) {
1061
- if (propertyName === "columnDefinitions") {
1062
- if (dataGrid.$fastController.isConnected) {
1063
- dataGrid.toggleGeneratedHeader();
1064
- }
1065
- }
1066
- }
1067
- };
1068
- connectedCallback() {
1069
- super.connectedCallback();
1070
- index.Observable.getNotifier(this).subscribe(
1071
- this.#changeHandler,
1072
- "columnDefinitions"
1073
- );
1074
- }
1075
- disconnectedCallback() {
1076
- super.disconnectedCallback();
1077
- index.Observable.getNotifier(this).unsubscribe(
1078
- this.#changeHandler,
1079
- "columnDefinitions"
1080
- );
1081
- }
1082
- #setSelectedState = (cell, selectedState) => {
1083
- cell.setAttribute("aria-selected", selectedState.toString());
1084
- };
1085
- #resetSelection = () => {
1086
- if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
1087
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
1088
- (cell) => this.#setSelectedState(cell, false)
1089
- );
1090
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
1091
- (row) => row.removeAttribute("aria-selected")
1092
- );
1093
- }
1094
- if (this.selectionMode === DataGridSelectionMode.none) {
1095
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
1096
- (cell) => cell.removeAttribute("aria-selected")
1097
- );
1098
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
1099
- (row) => row.removeAttribute("aria-selected")
1100
- );
1101
- }
1102
- if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
1103
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
1104
- (cell) => cell.removeAttribute("aria-selected")
1105
- );
1106
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
1107
- (row) => row.setAttribute("aria-selected", "false")
1108
- );
1109
- }
1110
- };
1111
- #initSelections = () => {
1112
- if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
1113
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
1114
- (cell) => !cell.hasAttribute("aria-selected") && this.#setSelectedState(cell, false)
1115
- );
1116
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
1117
- (row) => row.removeAttribute("aria-selected")
1118
- );
1119
- }
1120
- if (this.selectionMode === DataGridSelectionMode.none) {
1121
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
1122
- (cell) => cell.removeAttribute("aria-selected")
1123
- );
1124
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
1125
- (row) => row.removeAttribute("aria-selected")
1126
- );
1127
- }
1128
- if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
1129
- Array.from(this.querySelectorAll('[role="gridcell"]')).forEach(
1130
- (cell) => cell.removeAttribute("aria-selected")
1131
- );
1132
- Array.from(this.querySelectorAll('[role="row"]')).forEach(
1133
- (row) => !row.hasAttribute("aria-selected") && row.setAttribute("aria-selected", "false")
1134
- );
1135
- }
1136
- };
575
+ #handleKeypress;
576
+ #handleClick;
577
+ #handleCellSelection;
578
+ #handleRowSelection;
579
+ #changeHandler;
580
+ #setSelectedState;
581
+ #resetSelection;
582
+ #initSelections;
1137
583
  static generateColumns(rowData) {
1138
584
  return Object.keys(rowData).map((property, index) => {
1139
585
  return {
@@ -1142,13 +588,54 @@ class DataGrid extends DataGrid$1 {
1142
588
  };
1143
589
  });
1144
590
  }
1145
- }
591
+ };
592
+ __decorateClass$2([
593
+ vividElement.attr({ attribute: "no-tabbing", mode: "boolean" })
594
+ ], _DataGrid.prototype, "noTabbing");
595
+ __decorateClass$2([
596
+ vividElement.attr({ attribute: "generate-header" })
597
+ ], _DataGrid.prototype, "generateHeader");
598
+ // @ts-expect-error Type is incorrectly non-optional
599
+ __decorateClass$2([
600
+ vividElement.attr({ attribute: "grid-template-columns" })
601
+ ], _DataGrid.prototype, "gridTemplateColumns");
602
+ __decorateClass$2([
603
+ vividElement.observable
604
+ ], _DataGrid.prototype, "rowsData");
605
+ __decorateClass$2([
606
+ vividElement.observable
607
+ ], _DataGrid.prototype, "columnDefinitions");
608
+ __decorateClass$2([
609
+ vividElement.observable
610
+ ], _DataGrid.prototype, "rowItemTemplate");
611
+ __decorateClass$2([
612
+ vividElement.observable
613
+ ], _DataGrid.prototype, "cellItemTemplate");
614
+ __decorateClass$2([
615
+ vividElement.observable
616
+ ], _DataGrid.prototype, "headerCellItemTemplate");
1146
617
  __decorateClass$2([
1147
- index.observable
1148
- ], DataGrid.prototype, "slottedRowElements");
618
+ vividElement.observable
619
+ ], _DataGrid.prototype, "focusRowIndex");
1149
620
  __decorateClass$2([
1150
- index.attr({ attribute: "selection-mode" })
1151
- ], DataGrid.prototype, "selectionMode");
621
+ vividElement.observable
622
+ ], _DataGrid.prototype, "focusColumnIndex");
623
+ __decorateClass$2([
624
+ vividElement.observable
625
+ ], _DataGrid.prototype, "defaultRowItemTemplate");
626
+ __decorateClass$2([
627
+ vividElement.observable
628
+ ], _DataGrid.prototype, "rowElementTag");
629
+ __decorateClass$2([
630
+ vividElement.observable
631
+ ], _DataGrid.prototype, "rowElements");
632
+ __decorateClass$2([
633
+ vividElement.observable
634
+ ], _DataGrid.prototype, "slottedRowElements");
635
+ __decorateClass$2([
636
+ vividElement.attr({ attribute: "selection-mode" })
637
+ ], _DataGrid.prototype, "selectionMode");
638
+ let DataGrid = _DataGrid;
1152
639
 
1153
640
  var __defProp$1 = Object.defineProperty;
1154
641
  var __decorateClass$1 = (decorators, target, key, kind) => {
@@ -1159,19 +646,172 @@ var __decorateClass$1 = (decorators, target, key, kind) => {
1159
646
  if (result) __defProp$1(target, key, result);
1160
647
  return result;
1161
648
  };
1162
- class DataGridRow extends DataGridRow$1 {
649
+ class DataGridRow extends vividElement.VividElement {
1163
650
  constructor() {
1164
651
  super(...arguments);
652
+ // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
653
+ this.rowType = DataGridRowTypes.default;
654
+ this.rowData = null;
655
+ this.columnDefinitions = null;
656
+ this.cellsRepeatBehavior = null;
657
+ this.cellsPlaceholder = null;
658
+ /**
659
+ * @internal
660
+ */
661
+ this.focusColumnIndex = 0;
662
+ this.updateRowStyle = () => {
663
+ this.style.gridTemplateColumns = this.gridTemplateColumns;
664
+ };
1165
665
  this.ariaSelected = null;
1166
666
  }
667
+ /**
668
+ * @internal
669
+ */
670
+ gridTemplateColumnsChanged() {
671
+ if (this.$fastController.isConnected) {
672
+ this.updateRowStyle();
673
+ }
674
+ }
675
+ /**
676
+ * @internal
677
+ */
678
+ rowTypeChanged() {
679
+ if (this.$fastController.isConnected) {
680
+ this.updateItemTemplate();
681
+ }
682
+ }
683
+ /**
684
+ * @internal
685
+ */
686
+ cellItemTemplateChanged() {
687
+ this.updateItemTemplate();
688
+ }
689
+ /**
690
+ * @internal
691
+ */
692
+ headerCellItemTemplateChanged() {
693
+ this.updateItemTemplate();
694
+ }
695
+ /**
696
+ * @internal
697
+ */
698
+ connectedCallback() {
699
+ super.connectedCallback();
700
+ if (this.cellsRepeatBehavior === null) {
701
+ this.cellsPlaceholder = document.createComment("");
702
+ this.appendChild(this.cellsPlaceholder);
703
+ this.updateItemTemplate();
704
+ this.cellsRepeatBehavior = new repeat.RepeatDirective(
705
+ (x) => x.columnDefinitions,
706
+ (x) => x.activeCellItemTemplate,
707
+ { positioning: true }
708
+ ).createBehavior(this.cellsPlaceholder);
709
+ this.$fastController.addBehaviors([this.cellsRepeatBehavior]);
710
+ }
711
+ this.addEventListener("cell-focused", this.handleCellFocus);
712
+ this.addEventListener(eventFocusOut, this.handleFocusout);
713
+ this.addEventListener(eventKeyDown, this.handleKeydown);
714
+ this.updateRowStyle();
715
+ }
716
+ /**
717
+ * @internal
718
+ */
719
+ disconnectedCallback() {
720
+ super.disconnectedCallback();
721
+ this.removeEventListener("cell-focused", this.handleCellFocus);
722
+ this.removeEventListener(
723
+ eventFocusOut,
724
+ this.handleFocusout
725
+ );
726
+ this.removeEventListener(eventKeyDown, this.handleKeydown);
727
+ }
728
+ handleFocusout(_) {
729
+ if (!this.contains(document.activeElement)) {
730
+ this.focusColumnIndex = 0;
731
+ }
732
+ }
733
+ handleCellFocus(e) {
734
+ this.focusColumnIndex = this.cellElements.indexOf(e.target);
735
+ this.$emit("row-focused", this);
736
+ }
737
+ handleKeydown(e) {
738
+ if (e.defaultPrevented) {
739
+ return;
740
+ }
741
+ let newFocusColumnIndex = 0;
742
+ switch (e.key) {
743
+ case keyCodes.keyArrowLeft:
744
+ newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
745
+ this.cellElements[newFocusColumnIndex].focus();
746
+ e.preventDefault();
747
+ break;
748
+ case keyCodes.keyArrowRight:
749
+ newFocusColumnIndex = Math.min(
750
+ this.cellElements.length - 1,
751
+ this.focusColumnIndex + 1
752
+ );
753
+ this.cellElements[newFocusColumnIndex].focus();
754
+ e.preventDefault();
755
+ break;
756
+ case keyCodes.keyHome:
757
+ if (!e.ctrlKey) {
758
+ this.cellElements[0].focus();
759
+ e.preventDefault();
760
+ }
761
+ break;
762
+ case keyCodes.keyEnd:
763
+ if (!e.ctrlKey) {
764
+ this.cellElements[this.cellElements.length - 1].focus();
765
+ e.preventDefault();
766
+ }
767
+ break;
768
+ }
769
+ }
770
+ updateItemTemplate() {
771
+ 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;
772
+ }
1167
773
  }
774
+ // @ts-expect-error Type is incorrectly non-optional
775
+ __decorateClass$1([
776
+ vividElement.attr({ attribute: "grid-template-columns" })
777
+ ], DataGridRow.prototype, "gridTemplateColumns");
778
+ __decorateClass$1([
779
+ vividElement.attr({ attribute: "row-type" })
780
+ ], DataGridRow.prototype, "rowType");
781
+ __decorateClass$1([
782
+ vividElement.observable
783
+ ], DataGridRow.prototype, "rowData");
784
+ __decorateClass$1([
785
+ vividElement.observable
786
+ ], DataGridRow.prototype, "columnDefinitions");
1168
787
  __decorateClass$1([
1169
- index.attr({ attribute: "aria-selected" })
788
+ vividElement.observable
789
+ ], DataGridRow.prototype, "cellItemTemplate");
790
+ __decorateClass$1([
791
+ vividElement.observable
792
+ ], DataGridRow.prototype, "headerCellItemTemplate");
793
+ __decorateClass$1([
794
+ vividElement.observable
795
+ ], DataGridRow.prototype, "rowIndex");
796
+ __decorateClass$1([
797
+ vividElement.observable
798
+ ], DataGridRow.prototype, "activeCellItemTemplate");
799
+ __decorateClass$1([
800
+ vividElement.observable
801
+ ], DataGridRow.prototype, "defaultCellItemTemplate");
802
+ __decorateClass$1([
803
+ vividElement.observable
804
+ ], DataGridRow.prototype, "defaultHeaderCellItemTemplate");
805
+ __decorateClass$1([
806
+ vividElement.observable
807
+ ], DataGridRow.prototype, "cellElements");
808
+ __decorateClass$1([
809
+ vividElement.attr({ attribute: "aria-selected" })
1170
810
  ], DataGridRow.prototype, "ariaSelected");
1171
811
 
1172
812
  function createRowItemTemplate(context) {
1173
813
  const rowTag = context.tagFor(DataGridRow);
1174
- return index.html`
814
+ return vividElement.html`
1175
815
  <${rowTag}
1176
816
  :rowData="${(x) => x}"
1177
817
  :cellItemTemplate="${(_, c) => c.parent.cellItemTemplate}"
@@ -1199,7 +839,7 @@ function handleColumnSort(_, { event }) {
1199
839
  const DataGridTemplate = (context) => {
1200
840
  const rowItemTemplate = createRowItemTemplate(context);
1201
841
  const rowTag = context.tagFor(DataGridRow);
1202
- return index.html`
842
+ return vividElement.html`
1203
843
  <template
1204
844
  aria-multiselectable="${getMultiSelectAriaState}"
1205
845
  role="grid"
@@ -1229,11 +869,25 @@ var __decorateClass = (decorators, target, key, kind) => {
1229
869
  if (result) __defProp(target, key, result);
1230
870
  return result;
1231
871
  };
1232
- class DataGridCell extends DataGridCell$1 {
872
+ const defaultCellContentsTemplate = vividElement.html`
873
+ <template>
874
+ ${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
875
+ </template>
876
+ `;
877
+ const defaultHeaderCellContentsTemplate = vividElement.html`
878
+ <template>
879
+ ${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
880
+ </template>
881
+ `;
882
+ class DataGridCell extends vividElement.VividElement {
1233
883
  constructor() {
1234
- super();
1235
- this.ariaSelected = null;
1236
- this.ariaSort = null;
884
+ super(...arguments);
885
+ // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
886
+ this.cellType = DataGridCellTypes.default;
887
+ this.rowData = null;
888
+ this.columnDefinition = null;
889
+ this.isActiveCell = false;
890
+ this.customCellView = null;
1237
891
  this.updateCellStyle = () => {
1238
892
  if (this.gridColumn && !this.gridColumn.includes("undefined")) {
1239
893
  this.style.gridColumn = this.gridColumn;
@@ -1241,24 +895,173 @@ class DataGridCell extends DataGridCell$1 {
1241
895
  this.style.removeProperty("grid-column");
1242
896
  }
1243
897
  };
898
+ this.ariaSelected = null;
899
+ this.ariaSort = null;
1244
900
  }
1245
- ariaSelectedChanged(_, selectedState) {
1246
- this.shadowRoot.querySelector(".base")?.classList.toggle(
1247
- "selected",
1248
- selectedState === "true"
1249
- );
901
+ /**
902
+ * @internal
903
+ */
904
+ cellTypeChanged() {
905
+ if (this.$fastController.isConnected) {
906
+ this.updateCellView();
907
+ }
1250
908
  }
909
+ /**
910
+ * @internal
911
+ */
912
+ gridColumnChanged() {
913
+ if (this.$fastController.isConnected) {
914
+ this.updateCellStyle();
915
+ }
916
+ }
917
+ /**
918
+ * @internal
919
+ */
920
+ columnDefinitionChanged(_oldValue, _newValue) {
921
+ if (this.$fastController.isConnected) {
922
+ this.updateCellView();
923
+ }
924
+ }
925
+ /**
926
+ * @internal
927
+ */
1251
928
  connectedCallback() {
1252
929
  super.connectedCallback();
930
+ this.addEventListener(eventFocusIn, this.handleFocusin);
931
+ this.addEventListener(eventFocusOut, this.handleFocusout);
932
+ this.addEventListener(eventKeyDown, this.handleKeydown);
933
+ this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
934
+ this.updateCellView();
935
+ this.updateCellStyle();
1253
936
  this.ariaSelectedChanged(null, this.ariaSelected);
1254
937
  }
1255
- handleFocusin(e) {
1256
- super.handleFocusin(e);
938
+ /**
939
+ * @internal
940
+ */
941
+ disconnectedCallback() {
942
+ super.disconnectedCallback();
943
+ this.removeEventListener(eventFocusIn, this.handleFocusin);
944
+ this.removeEventListener(
945
+ eventFocusOut,
946
+ this.handleFocusout
947
+ );
948
+ this.removeEventListener(eventKeyDown, this.handleKeydown);
949
+ this.disconnectCellView();
950
+ }
951
+ handleFocusin(_) {
1257
952
  this.shadowRoot.querySelector(".base").classList.add("active");
953
+ if (this.isActiveCell) {
954
+ return;
955
+ }
956
+ this.isActiveCell = true;
957
+ switch (this.cellType) {
958
+ case DataGridCellTypes.columnHeader:
959
+ if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
960
+ const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
961
+ if (focusTarget !== null) {
962
+ focusTarget.focus();
963
+ }
964
+ }
965
+ break;
966
+ default:
967
+ if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
968
+ const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
969
+ if (focusTarget !== null) {
970
+ focusTarget.focus();
971
+ }
972
+ }
973
+ break;
974
+ }
975
+ this.$emit("cell-focused", this);
1258
976
  }
1259
- handleFocusout(e) {
1260
- super.handleFocusout(e);
977
+ handleFocusout(_) {
1261
978
  this.shadowRoot.querySelector(".base").classList.remove("active");
979
+ if (this !== document.activeElement && !this.contains(document.activeElement)) {
980
+ this.isActiveCell = false;
981
+ }
982
+ }
983
+ handleKeydown(e) {
984
+ if (e.defaultPrevented || this.columnDefinition === null || this.cellType === DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) {
985
+ return;
986
+ }
987
+ switch (e.key) {
988
+ case keyCodes.keyEnter:
989
+ case keyCodes.keyFunction2:
990
+ if (this.contains(document.activeElement) && document.activeElement !== this) {
991
+ return;
992
+ }
993
+ switch (this.cellType) {
994
+ case DataGridCellTypes.columnHeader:
995
+ if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
996
+ const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
997
+ if (focusTarget !== null) {
998
+ focusTarget.focus();
999
+ }
1000
+ e.preventDefault();
1001
+ }
1002
+ break;
1003
+ default:
1004
+ if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
1005
+ const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1006
+ if (focusTarget !== null) {
1007
+ focusTarget.focus();
1008
+ }
1009
+ e.preventDefault();
1010
+ }
1011
+ break;
1012
+ }
1013
+ break;
1014
+ case keyCodes.keyEscape:
1015
+ if (this.contains(document.activeElement) && document.activeElement !== this) {
1016
+ this.focus();
1017
+ e.preventDefault();
1018
+ }
1019
+ break;
1020
+ }
1021
+ }
1022
+ updateCellView() {
1023
+ this.disconnectCellView();
1024
+ if (this.columnDefinition === null) {
1025
+ return;
1026
+ }
1027
+ switch (this.cellType) {
1028
+ case DataGridCellTypes.columnHeader:
1029
+ if (this.columnDefinition.headerCellTemplate !== void 0) {
1030
+ this.customCellView = this.columnDefinition.headerCellTemplate.render(
1031
+ this,
1032
+ this
1033
+ );
1034
+ } else {
1035
+ this.customCellView = defaultHeaderCellContentsTemplate.render(
1036
+ this,
1037
+ this
1038
+ );
1039
+ }
1040
+ break;
1041
+ case DataGridCellTypes.rowHeader:
1042
+ case DataGridCellTypes.default:
1043
+ if (this.columnDefinition.cellTemplate !== void 0) {
1044
+ this.customCellView = this.columnDefinition.cellTemplate.render(
1045
+ this,
1046
+ this
1047
+ );
1048
+ } else {
1049
+ this.customCellView = defaultCellContentsTemplate.render(this, this);
1050
+ }
1051
+ break;
1052
+ }
1053
+ }
1054
+ disconnectCellView() {
1055
+ if (this.customCellView !== null) {
1056
+ this.customCellView.dispose();
1057
+ this.customCellView = null;
1058
+ }
1059
+ }
1060
+ ariaSelectedChanged(_, selectedState) {
1061
+ this.shadowRoot.querySelector(".base")?.classList.toggle(
1062
+ "selected",
1063
+ selectedState === "true"
1064
+ );
1262
1065
  }
1263
1066
  #getColumnDataKey() {
1264
1067
  return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
@@ -1288,15 +1091,27 @@ class DataGridCell extends DataGridCell$1 {
1288
1091
  }
1289
1092
  }
1290
1093
  __decorateClass([
1291
- index.attr({ attribute: "aria-selected", mode: "fromView" })
1094
+ vividElement.attr({ attribute: "cell-type" })
1095
+ ], DataGridCell.prototype, "cellType");
1096
+ __decorateClass([
1097
+ vividElement.attr({ attribute: "grid-column" })
1098
+ ], DataGridCell.prototype, "gridColumn");
1099
+ __decorateClass([
1100
+ vividElement.observable
1101
+ ], DataGridCell.prototype, "rowData");
1102
+ __decorateClass([
1103
+ vividElement.observable
1104
+ ], DataGridCell.prototype, "columnDefinition");
1105
+ __decorateClass([
1106
+ vividElement.attr({ attribute: "aria-selected", mode: "fromView" })
1292
1107
  ], DataGridCell.prototype, "ariaSelected");
1293
1108
  __decorateClass([
1294
- index.attr({ attribute: "aria-sort" })
1109
+ vividElement.attr({ attribute: "aria-sort" })
1295
1110
  ], DataGridCell.prototype, "ariaSort");
1296
1111
 
1297
1112
  function createCellItemTemplate(context) {
1298
1113
  const cellTag = context.tagFor(DataGridCell);
1299
- return index.html`
1114
+ return vividElement.html`
1300
1115
  <${cellTag}
1301
1116
  cell-type="${(x) => x.isRowHeader ? "rowheader" : void 0}"
1302
1117
  grid-column="${(_, c) => c.index + 1}"
@@ -1308,7 +1123,7 @@ function createCellItemTemplate(context) {
1308
1123
  }
1309
1124
  function createHeaderCellItemTemplate(context) {
1310
1125
  const cellTag = context.tagFor(DataGridCell);
1311
- return index.html`
1126
+ return vividElement.html`
1312
1127
  <${cellTag}
1313
1128
  cell-type="columnheader"
1314
1129
  grid-column="${(_, c) => c.index + 1}"
@@ -1319,7 +1134,7 @@ function createHeaderCellItemTemplate(context) {
1319
1134
  const DataGridRowTemplate = (context) => {
1320
1135
  const cellItemTemplate = createCellItemTemplate(context);
1321
1136
  const headerCellItemTemplate = createHeaderCellItemTemplate(context);
1322
- return index.html`
1137
+ return vividElement.html`
1323
1138
  <template
1324
1139
  role="row"
1325
1140
  class="${(x) => x.rowType !== "default" ? x.rowType : ""}"
@@ -1352,24 +1167,24 @@ function getSortIcon(x) {
1352
1167
  return x.ariaSort === DataGridCellSortStates.ascending ? "sort-asc-solid" : x.ariaSort === DataGridCellSortStates.descending ? "sort-desc-solid" : "sort-solid";
1353
1168
  }
1354
1169
  function renderSortIcons(c) {
1355
- const iconTag = c.tagFor(icon.Icon);
1356
- return index.html`
1170
+ const iconTag = c.tagFor(definition.Icon);
1171
+ return vividElement.html`
1357
1172
  ${when.when(
1358
1173
  shouldShowSortIcons,
1359
- index.html`
1174
+ vividElement.html`
1360
1175
  <${iconTag} class="header-icon" name="${getSortIcon}"></${iconTag}>
1361
1176
  `
1362
1177
  )}
1363
1178
  `;
1364
1179
  }
1365
1180
  function handleKeyDown(x, e) {
1366
- if (e.key === keyCodes$1.keyEnter || e.key === keyCodes$1.keySpace) {
1181
+ if (e.key === keyCodes.keyEnter || e.key === keyCodes.keySpace) {
1367
1182
  x._handleInteraction();
1368
1183
  }
1369
1184
  return true;
1370
1185
  }
1371
- function DataGridCellTemplate(context) {
1372
- return index.html`
1186
+ const DataGridCellTemplate = (context) => {
1187
+ return vividElement.html`
1373
1188
  <template
1374
1189
  tabindex="-1"
1375
1190
  role="${(x) => DataGridCellRole[x.cellType] ?? DataGridCellRole.default}"
@@ -1382,33 +1197,38 @@ function DataGridCellTemplate(context) {
1382
1197
  </div>
1383
1198
  </template>
1384
1199
  `;
1385
- }
1200
+ };
1386
1201
 
1387
- const dataGrid = DataGrid.compose({
1388
- baseName: "data-grid",
1389
- template: DataGridTemplate,
1390
- styles: dataGridStyles
1391
- })();
1392
- const dataGridRow = DataGridRow.compose({
1393
- baseName: "data-grid-row",
1394
- template: DataGridRowTemplate,
1395
- styles: dataGridRowStyles
1396
- })();
1397
- const dataGridCell = DataGridCell.compose({
1398
- baseName: "data-grid-cell",
1399
- template: DataGridCellTemplate,
1400
- styles: dataGridCellStyles
1401
- })();
1402
- const dataGridElements = [
1403
- dataGridCell,
1404
- dataGridRow,
1405
- dataGrid,
1406
- ...definition.iconRegistries
1407
- ];
1408
- const registerDataGrid = index.registerFactory(dataGridElements);
1202
+ const dataGridCellDefinition = vividElement.defineVividComponent(
1203
+ "data-grid-cell",
1204
+ DataGridCell,
1205
+ DataGridCellTemplate,
1206
+ [definition.iconDefinition],
1207
+ {
1208
+ styles: dataGridCellStyles
1209
+ }
1210
+ );
1211
+ const dataGridRowDefinition = vividElement.defineVividComponent(
1212
+ "data-grid-row",
1213
+ DataGridRow,
1214
+ DataGridRowTemplate,
1215
+ [dataGridCellDefinition],
1216
+ {
1217
+ styles: dataGridRowStyles
1218
+ }
1219
+ );
1220
+ const dataGridDefinition = vividElement.defineVividComponent(
1221
+ "data-grid",
1222
+ DataGrid,
1223
+ DataGridTemplate,
1224
+ [dataGridRowDefinition],
1225
+ {
1226
+ styles: dataGridStyles
1227
+ }
1228
+ );
1229
+ const registerDataGrid = vividElement.createRegisterFunction(dataGridDefinition);
1409
1230
 
1410
- exports.dataGrid = dataGrid;
1411
- exports.dataGridCell = dataGridCell;
1412
- exports.dataGridElements = dataGridElements;
1413
- exports.dataGridRow = dataGridRow;
1231
+ exports.dataGridCellDefinition = dataGridCellDefinition;
1232
+ exports.dataGridDefinition = dataGridDefinition;
1233
+ exports.dataGridRowDefinition = dataGridRowDefinition;
1414
1234
  exports.registerDataGrid = registerDataGrid;