@vonage/vivid 4.24.0 → 4.26.0

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