@bk2k/ui 0.6.7 → 0.7.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 (487) hide show
  1. package/BUILDING.md +88 -2
  2. package/CHANGELOG.md +193 -0
  3. package/USAGE.md +102 -33
  4. package/custom-elements.json +1 -1
  5. package/dist/charts/chart-tokens.js +1 -1
  6. package/dist/charts/fields.d.ts +20 -0
  7. package/dist/charts/fields.js +27 -0
  8. package/dist/charts/frame.d.ts +2 -0
  9. package/dist/charts/frame.js +4 -2
  10. package/dist/clipboard.js +1 -0
  11. package/dist/components/bk-alert.js +2 -1
  12. package/dist/components/bk-avatar-group.js +4 -6
  13. package/dist/components/bk-avatar.d.ts +10 -0
  14. package/dist/components/bk-avatar.js +17 -0
  15. package/dist/components/bk-bar.js +2 -0
  16. package/dist/components/bk-button-group.js +1 -1
  17. package/dist/components/bk-button-top.js +2 -1
  18. package/dist/components/bk-button.d.ts +55 -17
  19. package/dist/components/bk-button.js +71 -24
  20. package/dist/components/bk-card.d.ts +4 -0
  21. package/dist/components/bk-card.js +15 -2
  22. package/dist/components/bk-carousel-controls.d.ts +2 -0
  23. package/dist/components/bk-carousel-controls.js +4 -2
  24. package/dist/components/bk-chart-area.d.ts +6 -0
  25. package/dist/components/bk-chart-bar.d.ts +63 -9
  26. package/dist/components/bk-chart-bar.js +152 -41
  27. package/dist/components/bk-chart-line.d.ts +13 -0
  28. package/dist/components/bk-chart-line.js +11 -1
  29. package/dist/components/bk-chip-group.d.ts +2 -2
  30. package/dist/components/bk-chip-group.js +4 -0
  31. package/dist/components/bk-chip.d.ts +53 -8
  32. package/dist/components/bk-chip.js +43 -7
  33. package/dist/components/bk-code.js +6 -2
  34. package/dist/components/bk-columns.d.ts +11 -0
  35. package/dist/components/bk-columns.js +8 -1
  36. package/dist/components/bk-combobox.d.ts +30 -6
  37. package/dist/components/bk-combobox.js +63 -20
  38. package/dist/components/bk-delta.d.ts +10 -0
  39. package/dist/components/bk-delta.js +8 -6
  40. package/dist/components/bk-dialog.d.ts +16 -6
  41. package/dist/components/bk-dialog.js +20 -8
  42. package/dist/components/bk-disclosure.js +4 -2
  43. package/dist/components/bk-drop-target.d.ts +7 -1
  44. package/dist/components/bk-drop-target.js +20 -4
  45. package/dist/components/bk-error-summary.d.ts +5 -0
  46. package/dist/components/bk-error-summary.js +13 -4
  47. package/dist/components/bk-facts-item.js +8 -6
  48. package/dist/components/bk-facts.d.ts +6 -4
  49. package/dist/components/bk-facts.js +22 -10
  50. package/dist/components/bk-footnote.d.ts +73 -0
  51. package/dist/components/bk-footnote.js +97 -0
  52. package/dist/components/bk-footnotes-item.d.ts +92 -0
  53. package/dist/components/bk-footnotes-item.js +139 -0
  54. package/dist/components/bk-footnotes.d.ts +51 -0
  55. package/dist/components/bk-footnotes.js +43 -0
  56. package/dist/components/bk-icon.js +2 -2
  57. package/dist/components/bk-image-compare.d.ts +33 -5
  58. package/dist/components/bk-image-compare.js +72 -24
  59. package/dist/components/bk-image-crop.d.ts +3 -3
  60. package/dist/components/bk-image-editor.d.ts +1 -1
  61. package/dist/components/bk-image-viewer.d.ts +107 -11
  62. package/dist/components/bk-image-viewer.js +205 -34
  63. package/dist/components/bk-input-inline.d.ts +15 -6
  64. package/dist/components/bk-input-inline.js +22 -6
  65. package/dist/components/bk-input-number.js +2 -1
  66. package/dist/components/bk-input-search.d.ts +1 -1
  67. package/dist/components/bk-input-search.js +2 -1
  68. package/dist/components/bk-input-text.d.ts +11 -0
  69. package/dist/components/bk-input-text.js +17 -3
  70. package/dist/components/bk-input-time-zone.d.ts +3 -0
  71. package/dist/components/bk-input-time.js +2 -1
  72. package/dist/components/bk-item.js +2 -1
  73. package/dist/components/bk-lightbox.d.ts +12 -3
  74. package/dist/components/bk-lightbox.js +6 -3
  75. package/dist/components/bk-link.d.ts +9 -1
  76. package/dist/components/bk-link.js +14 -4
  77. package/dist/components/bk-menu-item.d.ts +40 -0
  78. package/dist/components/bk-menu-item.js +57 -9
  79. package/dist/components/bk-menu-label.js +2 -1
  80. package/dist/components/bk-menu-list.d.ts +1 -0
  81. package/dist/components/bk-menu-list.js +10 -0
  82. package/dist/components/bk-menu.d.ts +8 -1
  83. package/dist/components/bk-menu.js +16 -5
  84. package/dist/components/bk-message-feedback.d.ts +4 -3
  85. package/dist/components/bk-message-feedback.js +7 -5
  86. package/dist/components/bk-message-list.js +2 -1
  87. package/dist/components/bk-message-source.d.ts +1 -2
  88. package/dist/components/bk-message-source.js +3 -11
  89. package/dist/components/bk-message.js +2 -0
  90. package/dist/components/bk-model-viewer.d.ts +12 -1
  91. package/dist/components/bk-model-viewer.js +15 -2
  92. package/dist/components/bk-nav-group.js +1 -1
  93. package/dist/components/bk-nav-item.d.ts +18 -0
  94. package/dist/components/bk-nav-item.js +18 -5
  95. package/dist/components/bk-nav.d.ts +1 -1
  96. package/dist/components/bk-page-cta.js +2 -0
  97. package/dist/components/bk-page-section.d.ts +1 -1
  98. package/dist/components/bk-page-section.js +3 -9
  99. package/dist/components/bk-pane.d.ts +1 -0
  100. package/dist/components/bk-pane.js +7 -5
  101. package/dist/components/bk-panel.d.ts +1 -1
  102. package/dist/components/bk-panel.js +6 -5
  103. package/dist/components/bk-period-nav.d.ts +102 -0
  104. package/dist/components/bk-period-nav.js +69 -0
  105. package/dist/components/bk-picture.d.ts +17 -4
  106. package/dist/components/bk-picture.js +8 -1
  107. package/dist/components/bk-segmented-item.d.ts +24 -4
  108. package/dist/components/bk-segmented-item.js +37 -5
  109. package/dist/components/bk-segmented.js +2 -13
  110. package/dist/components/bk-select-cascade.d.ts +1 -1
  111. package/dist/components/bk-select-tree.d.ts +1 -1
  112. package/dist/components/bk-select.d.ts +1 -1
  113. package/dist/components/bk-select.js +2 -1
  114. package/dist/components/bk-shell-app.d.ts +13 -6
  115. package/dist/components/bk-shell-app.js +47 -11
  116. package/dist/components/bk-shell-sites.d.ts +2 -1
  117. package/dist/components/bk-shell-sites.js +3 -5
  118. package/dist/components/bk-sortable.d.ts +3 -0
  119. package/dist/components/bk-sortable.js +10 -17
  120. package/dist/components/bk-split-grid.d.ts +104 -3
  121. package/dist/components/bk-split-grid.js +425 -2
  122. package/dist/components/bk-split.d.ts +3 -0
  123. package/dist/components/bk-split.js +3 -0
  124. package/dist/components/bk-stat-group.js +2 -1
  125. package/dist/components/bk-stat.d.ts +17 -0
  126. package/dist/components/bk-stat.js +7 -3
  127. package/dist/components/bk-steps.js +2 -1
  128. package/dist/components/bk-surface.d.ts +2 -0
  129. package/dist/components/bk-surface.js +6 -3
  130. package/dist/components/bk-table.d.ts +17 -13
  131. package/dist/components/bk-table.js +94 -15
  132. package/dist/components/bk-tabs-item.d.ts +45 -7
  133. package/dist/components/bk-tabs-item.js +51 -20
  134. package/dist/components/bk-tabs-panel.d.ts +6 -3
  135. package/dist/components/bk-tabs-panel.js +6 -0
  136. package/dist/components/bk-tabs.d.ts +50 -7
  137. package/dist/components/bk-tabs.js +168 -96
  138. package/dist/components/bk-text.js +2 -1
  139. package/dist/components/bk-toast-group.d.ts +3 -1
  140. package/dist/components/bk-toast-group.js +11 -1
  141. package/dist/components/bk-tooltip.d.ts +3 -1
  142. package/dist/components/bk-tooltip.js +2 -1
  143. package/dist/components/bk-video.js +2 -2
  144. package/dist/components/bk-zoom.d.ts +3 -1
  145. package/dist/components/confirm.d.ts +15 -0
  146. package/dist/components/confirm.js +27 -4
  147. package/dist/i18n/de.js +19 -1
  148. package/dist/i18n/en.d.ts +2 -0
  149. package/dist/i18n/en.js +3 -0
  150. package/dist/i18n.d.ts +23 -2
  151. package/dist/i18n.js +35 -4
  152. package/dist/icons/brands-static.d.ts +3 -0
  153. package/dist/icons/brands-static.js +5 -0
  154. package/dist/icons/core.d.ts +1 -0
  155. package/dist/icons/core.js +2 -0
  156. package/dist/icons/load-static.d.ts +3 -0
  157. package/dist/icons/load-static.js +5 -0
  158. package/dist/icons/load.js +1 -0
  159. package/dist/icons/registry.js +1 -1
  160. package/dist/icons/set/save-as.d.ts +3 -0
  161. package/dist/icons/set/save-as.js +7 -0
  162. package/dist/index.d.ts +4 -0
  163. package/dist/index.js +4 -0
  164. package/dist/internal/announcer.d.ts +8 -1
  165. package/dist/internal/announcer.js +26 -10
  166. package/dist/internal/backdrop.d.ts +19 -0
  167. package/dist/internal/backdrop.js +29 -0
  168. package/dist/internal/busy.d.ts +3 -2
  169. package/dist/internal/busy.js +4 -5
  170. package/dist/internal/choice-field.js +1 -1
  171. package/dist/internal/choice-item.d.ts +17 -6
  172. package/dist/internal/choice-item.js +20 -9
  173. package/dist/internal/cloak.d.ts +3 -0
  174. package/dist/internal/cloak.js +7 -0
  175. package/dist/internal/crop-frame.d.ts +1 -1
  176. package/dist/internal/crop-frame.js +2 -7
  177. package/dist/internal/date-field.js +2 -1
  178. package/dist/internal/drag.d.ts +11 -0
  179. package/dist/internal/drag.js +23 -0
  180. package/dist/internal/english-static.d.ts +3 -0
  181. package/dist/internal/english-static.js +5 -0
  182. package/dist/internal/english.d.ts +8 -0
  183. package/dist/internal/english.js +6 -0
  184. package/dist/internal/footnotes.d.ts +56 -0
  185. package/dist/internal/footnotes.js +143 -0
  186. package/dist/internal/handle-menu.d.ts +2 -3
  187. package/dist/internal/handle-menu.js +11 -3
  188. package/dist/internal/late/bk-shell-app.d.ts +4 -0
  189. package/dist/internal/late/bk-shell-app.js +7 -0
  190. package/dist/internal/late/bk-table.d.ts +4 -0
  191. package/dist/internal/late/bk-table.js +17 -0
  192. package/dist/internal/late/handle-menu.d.ts +4 -0
  193. package/dist/internal/late/handle-menu.js +9 -0
  194. package/dist/internal/late/static.d.ts +7 -0
  195. package/dist/internal/late/static.js +5 -0
  196. package/dist/internal/late.d.ts +20 -0
  197. package/dist/internal/late.js +45 -0
  198. package/dist/internal/link.d.ts +2 -0
  199. package/dist/internal/link.js +11 -1
  200. package/dist/internal/own-text.d.ts +8 -0
  201. package/dist/internal/own-text.js +7 -0
  202. package/dist/internal/scope.js +1 -1
  203. package/dist/internal/scroll-lock.d.ts +4 -1
  204. package/dist/internal/scroll-lock.js +17 -4
  205. package/dist/internal/slider.js +2 -1
  206. package/dist/internal/styles.js +3 -0
  207. package/dist/internal/submit.d.ts +23 -0
  208. package/dist/internal/submit.js +57 -0
  209. package/dist/jsx.d.ts +176 -56
  210. package/dist/reset.css +10 -0
  211. package/dist/standalone/all.js +226 -221
  212. package/dist/standalone/appearance.js +1 -1
  213. package/dist/standalone/bk-accordion-item.js +4 -4
  214. package/dist/standalone/bk-accordion.js +2 -2
  215. package/dist/standalone/bk-action-bar.js +3 -3
  216. package/dist/standalone/bk-alert-offline.js +1 -2
  217. package/dist/standalone/bk-alert.js +13 -12
  218. package/dist/standalone/bk-app-state.js +1 -1
  219. package/dist/standalone/bk-attachment.js +4 -4
  220. package/dist/standalone/bk-avatar-group.js +12 -10
  221. package/dist/standalone/bk-avatar.js +14 -4
  222. package/dist/standalone/bk-badge.js +2 -2
  223. package/dist/standalone/bk-bar.js +3 -1
  224. package/dist/standalone/bk-brand.js +3 -3
  225. package/dist/standalone/bk-breadcrumbs.js +5 -5
  226. package/dist/standalone/bk-button-copy.js +5 -5
  227. package/dist/standalone/bk-button-group.js +5 -5
  228. package/dist/standalone/bk-button-share.js +5 -5
  229. package/dist/standalone/bk-button-top.js +9 -8
  230. package/dist/standalone/bk-button.js +74 -34
  231. package/dist/standalone/bk-calendar-event.js +1 -1
  232. package/dist/standalone/bk-calendar-week.js +3 -3
  233. package/dist/standalone/bk-calendar.js +4 -4
  234. package/dist/standalone/bk-card.js +20 -7
  235. package/dist/standalone/bk-carousel-controls.js +7 -6
  236. package/dist/standalone/bk-carousel-item.js +2 -2
  237. package/dist/standalone/bk-carousel.js +1 -1
  238. package/dist/standalone/bk-chart-area.js +1 -1
  239. package/dist/standalone/bk-chart-bar-list.js +8 -8
  240. package/dist/standalone/bk-chart-bar.js +253 -166
  241. package/dist/standalone/bk-chart-bridge.js +7 -7
  242. package/dist/standalone/bk-chart-bullet.js +6 -6
  243. package/dist/standalone/bk-chart-calendar.js +7 -7
  244. package/dist/standalone/bk-chart-heatmap.js +7 -7
  245. package/dist/standalone/bk-chart-histogram.js +5 -5
  246. package/dist/standalone/bk-chart-legend.js +6 -6
  247. package/dist/standalone/bk-chart-line.js +116 -103
  248. package/dist/standalone/bk-chart-mark.js +1 -1
  249. package/dist/standalone/bk-chart-scatter.js +6 -6
  250. package/dist/standalone/bk-chart-sparkline.js +6 -6
  251. package/dist/standalone/bk-chart-stacked-bar.js +7 -7
  252. package/dist/standalone/bk-chart-tracker.js +6 -6
  253. package/dist/standalone/bk-chart-waterfall.js +6 -6
  254. package/dist/standalone/bk-checkbox-group.js +4 -4
  255. package/dist/standalone/bk-checkbox.js +4 -4
  256. package/dist/standalone/bk-chip-group.js +9 -5
  257. package/dist/standalone/bk-chip.js +56 -17
  258. package/dist/standalone/bk-cluster.js +1 -1
  259. package/dist/standalone/bk-code-diff.js +4 -4
  260. package/dist/standalone/bk-code-stack.js +4 -4
  261. package/dist/standalone/bk-code.js +10 -6
  262. package/dist/standalone/bk-color-panel.js +5 -5
  263. package/dist/standalone/bk-columns.js +13 -5
  264. package/dist/standalone/bk-combobox.js +53 -33
  265. package/dist/standalone/bk-command-menu.js +6 -6
  266. package/dist/standalone/bk-command-palette.js +6 -5
  267. package/dist/standalone/bk-composer.js +6 -6
  268. package/dist/standalone/bk-delta.js +11 -10
  269. package/dist/standalone/bk-diagram.js +1 -1
  270. package/dist/standalone/bk-dialog.js +1 -1
  271. package/dist/standalone/bk-disclosure.js +7 -5
  272. package/dist/standalone/bk-divider.js +2 -2
  273. package/dist/standalone/bk-drawer.js +3 -3
  274. package/dist/standalone/bk-drop-target.js +12 -6
  275. package/dist/standalone/bk-empty-state.js +3 -3
  276. package/dist/standalone/bk-error-summary.js +9 -6
  277. package/dist/standalone/bk-facts-item.js +10 -8
  278. package/dist/standalone/bk-facts.js +28 -16
  279. package/dist/standalone/bk-feature.js +3 -3
  280. package/dist/standalone/bk-fieldset.js +3 -3
  281. package/dist/standalone/bk-filter-bar.js +4 -4
  282. package/dist/standalone/bk-folder-browser.js +4 -4
  283. package/dist/standalone/bk-footnote.js +82 -0
  284. package/dist/standalone/bk-footnotes-item.js +122 -0
  285. package/dist/standalone/bk-footnotes.js +37 -0
  286. package/dist/standalone/bk-form-guard.js +2 -2
  287. package/dist/standalone/bk-form-steps.js +3 -3
  288. package/dist/standalone/bk-grid.js +1 -1
  289. package/dist/standalone/bk-icon-tile.js +3 -3
  290. package/dist/standalone/bk-icon.js +1 -1
  291. package/dist/standalone/bk-image-compare.js +88 -47
  292. package/dist/standalone/bk-image-crop.js +6 -6
  293. package/dist/standalone/bk-image-editor.js +2 -1
  294. package/dist/standalone/bk-image-viewer.js +180 -59
  295. package/dist/standalone/bk-input-code.js +4 -4
  296. package/dist/standalone/bk-input-color.js +4 -4
  297. package/dist/standalone/bk-input-date-range.js +2 -2
  298. package/dist/standalone/bk-input-date.js +2 -2
  299. package/dist/standalone/bk-input-file.js +5 -5
  300. package/dist/standalone/bk-input-group.js +4 -4
  301. package/dist/standalone/bk-input-inline.js +17 -10
  302. package/dist/standalone/bk-input-number.js +9 -8
  303. package/dist/standalone/bk-input-rating.js +6 -6
  304. package/dist/standalone/bk-input-rich.js +1 -1
  305. package/dist/standalone/bk-input-search.js +23 -22
  306. package/dist/standalone/bk-input-slider-range.js +5 -5
  307. package/dist/standalone/bk-input-slider.js +5 -5
  308. package/dist/standalone/bk-input-text.js +1 -1
  309. package/dist/standalone/bk-input-time-zone.js +1 -1
  310. package/dist/standalone/bk-input-time.js +29 -28
  311. package/dist/standalone/bk-item-group.js +3 -3
  312. package/dist/standalone/bk-item.js +12 -11
  313. package/dist/standalone/bk-kbd-shortcuts.js +4 -3
  314. package/dist/standalone/bk-kbd.js +68 -1
  315. package/dist/standalone/bk-lightbox.js +11 -7
  316. package/dist/standalone/bk-lines.js +1 -1
  317. package/dist/standalone/bk-link.js +33 -19
  318. package/dist/standalone/bk-listbox-columns.js +6 -6
  319. package/dist/standalone/bk-listbox-item.js +1 -1
  320. package/dist/standalone/bk-listbox-search.js +7 -7
  321. package/dist/standalone/bk-listbox-transfer.js +6 -6
  322. package/dist/standalone/bk-listbox.js +7 -7
  323. package/dist/standalone/bk-logo-wall.js +2 -2
  324. package/dist/standalone/bk-logo.js +3 -3
  325. package/dist/standalone/bk-menu-bar.js +3 -3
  326. package/dist/standalone/bk-menu-context.js +1 -1
  327. package/dist/standalone/bk-menu-divider.js +2 -2
  328. package/dist/standalone/bk-menu-item.js +73 -29
  329. package/dist/standalone/bk-menu-label.js +7 -6
  330. package/dist/standalone/bk-menu-list.js +10 -4
  331. package/dist/standalone/bk-menu.js +19 -10
  332. package/dist/standalone/bk-message-approval.js +4 -4
  333. package/dist/standalone/bk-message-branches.js +3 -3
  334. package/dist/standalone/bk-message-citation.js +10 -10
  335. package/dist/standalone/bk-message-feedback.js +10 -6
  336. package/dist/standalone/bk-message-list.js +6 -5
  337. package/dist/standalone/bk-message-reasoning.js +5 -5
  338. package/dist/standalone/bk-message-source.js +13 -21
  339. package/dist/standalone/bk-message-tool-group.js +5 -5
  340. package/dist/standalone/bk-message-tool.js +5 -5
  341. package/dist/standalone/bk-message.js +6 -4
  342. package/dist/standalone/bk-meter.js +3 -3
  343. package/dist/standalone/bk-model-viewer.js +1 -1
  344. package/dist/standalone/bk-nav-divider.js +2 -2
  345. package/dist/standalone/bk-nav-group.js +6 -6
  346. package/dist/standalone/bk-nav-item.js +31 -23
  347. package/dist/standalone/bk-nav-toc.js +3 -3
  348. package/dist/standalone/bk-nav.js +3 -3
  349. package/dist/standalone/bk-overflow.js +3 -3
  350. package/dist/standalone/bk-page-cta.js +5 -3
  351. package/dist/standalone/bk-page-footer-column.js +2 -2
  352. package/dist/standalone/bk-page-footer.js +3 -3
  353. package/dist/standalone/bk-page-header.js +3 -3
  354. package/dist/standalone/bk-page-hero.js +3 -3
  355. package/dist/standalone/bk-page-pager.js +5 -5
  356. package/dist/standalone/bk-page-section.js +6 -6
  357. package/dist/standalone/bk-pagination.js +6 -6
  358. package/dist/standalone/bk-pane.js +10 -9
  359. package/dist/standalone/bk-panel.js +9 -10
  360. package/dist/standalone/bk-period-nav.js +69 -0
  361. package/dist/standalone/bk-picture.js +24 -15
  362. package/dist/standalone/bk-popover-help.js +3 -3
  363. package/dist/standalone/bk-popover.js +2 -2
  364. package/dist/standalone/bk-presence-cursor.js +2 -2
  365. package/dist/standalone/bk-preview.js +4 -4
  366. package/dist/standalone/bk-progress.js +3 -3
  367. package/dist/standalone/bk-prose.js +3 -3
  368. package/dist/standalone/bk-qr-code.js +1 -1
  369. package/dist/standalone/bk-radio-group.js +4 -4
  370. package/dist/standalone/bk-radio.js +3 -3
  371. package/dist/standalone/bk-rating.js +5 -5
  372. package/dist/standalone/bk-scroll.js +3 -3
  373. package/dist/standalone/bk-segmented-item.js +40 -16
  374. package/dist/standalone/bk-segmented.js +15 -13
  375. package/dist/standalone/bk-select-cascade.js +3 -3
  376. package/dist/standalone/bk-select-tree.js +4 -4
  377. package/dist/standalone/bk-select.js +7 -6
  378. package/dist/standalone/bk-shell-app.js +1 -1217
  379. package/dist/standalone/bk-shell-centered.js +2 -2
  380. package/dist/standalone/bk-shell-sites.js +5 -7
  381. package/dist/standalone/bk-skeleton.js +2 -2
  382. package/dist/standalone/bk-sortable.js +58 -60
  383. package/dist/standalone/bk-spinner.js +2 -2
  384. package/dist/standalone/bk-split-grid.js +318 -41
  385. package/dist/standalone/bk-split.js +9 -6
  386. package/dist/standalone/bk-stack.js +1 -1
  387. package/dist/standalone/bk-stat-group.js +8 -7
  388. package/dist/standalone/bk-stat.js +11 -8
  389. package/dist/standalone/bk-status-dot.js +3 -3
  390. package/dist/standalone/bk-steps-item.js +5 -5
  391. package/dist/standalone/bk-steps.js +8 -7
  392. package/dist/standalone/bk-surface.js +1 -1
  393. package/dist/standalone/bk-swatch-group.js +4 -4
  394. package/dist/standalone/bk-swatch-palette.js +1 -1
  395. package/dist/standalone/bk-swatch.js +2 -2
  396. package/dist/standalone/bk-switch.js +4 -4
  397. package/dist/standalone/bk-table.js +1 -1887
  398. package/dist/standalone/bk-tabs-item.js +58 -35
  399. package/dist/standalone/bk-tabs-panel.js +7 -3
  400. package/dist/standalone/bk-tabs.js +160 -98
  401. package/dist/standalone/bk-tasks-item.js +4 -4
  402. package/dist/standalone/bk-tasks.js +2 -2
  403. package/dist/standalone/bk-testimonial.js +3 -3
  404. package/dist/standalone/bk-text.js +19 -18
  405. package/dist/standalone/bk-time-countdown.js +4 -4
  406. package/dist/standalone/bk-time-relative.js +3 -3
  407. package/dist/standalone/bk-timeline-item.js +4 -4
  408. package/dist/standalone/bk-timeline.js +2 -2
  409. package/dist/standalone/bk-toast-group.js +1 -1
  410. package/dist/standalone/bk-toast.js +4 -4
  411. package/dist/standalone/bk-toolbar.js +2 -2
  412. package/dist/standalone/bk-tooltip.js +8 -7
  413. package/dist/standalone/bk-tree-item.js +6 -6
  414. package/dist/standalone/bk-tree.js +3 -3
  415. package/dist/standalone/bk-video.js +6 -6
  416. package/dist/standalone/bk-visually-hidden.js +2 -2
  417. package/dist/standalone/bk-zoom.js +5 -5
  418. package/dist/standalone/chunks/announcer-D1zrRWwO.js +36 -0
  419. package/dist/standalone/chunks/{appearance-waHnV0kk.js → appearance-CBOJXbmC.js} +1 -1
  420. package/dist/standalone/chunks/{bk-alert-offline-BoMEYxnE.js → bk-alert-offline-Clw0ZSsH.js} +3 -3
  421. package/dist/standalone/chunks/{bk-carousel-B7-9OanA.js → bk-carousel-Biz7t8sL.js} +4 -4
  422. package/dist/standalone/chunks/{bk-diagram-CpOpicmo.js → bk-diagram-D_fQf6SF.js} +5 -5
  423. package/dist/standalone/chunks/{bk-dialog-a2BtUBf2.js → bk-dialog-DwZyUUHh.js} +65 -27
  424. package/dist/standalone/chunks/{bk-icon-DssFsNuB.js → bk-icon-Bp_flKdv.js} +4 -3
  425. package/dist/standalone/chunks/{bk-image-editor-z_Uj83fy.js → bk-image-editor-BADsoLRL.js} +5 -5
  426. package/dist/standalone/chunks/{bk-input-date-range-BQkbPlSJ.js → bk-input-date-range-DHcJ8-5g.js} +2 -2
  427. package/dist/standalone/chunks/{bk-input-rich-Dte_b4Ev.js → bk-input-rich-CFhW6vRa.js} +6 -6
  428. package/dist/standalone/chunks/{bk-input-text-CUNQG1ah.js → bk-input-text-DviyLBqj.js} +63 -54
  429. package/dist/standalone/chunks/{bk-model-viewer-D1XJPgAG.js → bk-model-viewer-w_Ah4Tvs.js} +22 -8
  430. package/dist/standalone/chunks/{bk-qr-code-CbI9rdOK.js → bk-qr-code-CYMovNVl.js} +3 -3
  431. package/dist/standalone/chunks/bk-shell-app-B2lxHit8.js +1235 -0
  432. package/dist/standalone/chunks/{bk-surface-DkIhrWMt.js → bk-surface-D7e0tErs.js} +9 -7
  433. package/dist/standalone/chunks/{bk-swatch-palette-BNNXTP3w.js → bk-swatch-palette-x13JgJQi.js} +6 -6
  434. package/dist/standalone/chunks/bk-table-CP8n_jy7.js +1944 -0
  435. package/dist/standalone/chunks/{bk-toast-group-Cix-Urgi.js → bk-toast-group-CoL6W7uk.js} +27 -24
  436. package/dist/standalone/chunks/{brush-Bn3lPdHN.js → brush-DALmXSru.js} +18 -2
  437. package/dist/standalone/chunks/{busy-B7Mxemwm.js → busy-BUB22mGY.js} +5 -4
  438. package/dist/standalone/chunks/{chart-tokens-D1Exf7BW.js → chart-tokens-DQ4hVSmn.js} +2 -2
  439. package/dist/standalone/chunks/{choice-field-BnuK9mp_.js → choice-field-poOTerh1.js} +6 -6
  440. package/dist/standalone/chunks/{choice-item-B6-9ZRlf.js → choice-item-Cx-nm1js.js} +17 -8
  441. package/dist/standalone/chunks/clipboard-RqIeP9Uz.js +29 -0
  442. package/dist/standalone/chunks/clipboard-UVLSkL4C.js +34 -0
  443. package/dist/standalone/chunks/{crop-frame-poLCGrBG.js → crop-frame-Z9N0QML4.js} +1 -11
  444. package/dist/standalone/chunks/{date-field-BQ5k-DDL.js → date-field-B-fCXa2D.js} +48 -47
  445. package/dist/standalone/chunks/{define-CzVPD4Zi.js → define-DkVeu7e9.js} +1 -1
  446. package/dist/standalone/chunks/drag-DT4__0t9.js +12 -0
  447. package/dist/standalone/chunks/footnotes-BeisMxLk.js +94 -0
  448. package/dist/standalone/chunks/{form-control-D7dqSP9M.js → form-control-CHpfKAKa.js} +2 -2
  449. package/dist/standalone/chunks/{frame-BW1nKuoM.js → frame-xIMVEUCi.js} +7 -4
  450. package/dist/standalone/chunks/handle-menu-BgYUbGO2.js +56 -0
  451. package/dist/standalone/chunks/{heading-text-CV5gBf7k.js → heading-text-CgnCa_q2.js} +1 -1
  452. package/dist/standalone/chunks/{i18n-CNsBRNPu.js → i18n-DFfGgd3d.js} +56 -34
  453. package/dist/standalone/chunks/{i18n-CrZgrRu9.js → i18n-DQAcbHkY.js} +1 -1
  454. package/dist/standalone/chunks/link--YWr8exL.js +69 -0
  455. package/dist/standalone/chunks/{marks-CdqbbJpM.js → marks-pOUDNUf1.js} +2 -2
  456. package/dist/standalone/chunks/{options-DMEc8rQt.js → options-BdC8-KKM.js} +2 -2
  457. package/dist/standalone/chunks/own-text-mpZVnMyX.js +5 -0
  458. package/dist/standalone/chunks/{palettes-CKLHSIPx.js → palettes-J4bQ21ks.js} +2 -2
  459. package/dist/standalone/chunks/{popover-base-oDhxsYMr.js → popover-base-hxo-Vh6E.js} +2 -2
  460. package/dist/standalone/chunks/{prose-BG4oQH-i.js → prose-BiuJgiah.js} +1 -1
  461. package/dist/standalone/chunks/{ramp-EclrETaQ.js → ramp-CGDOcqBZ.js} +1 -1
  462. package/dist/standalone/chunks/save-as-DBGZjczB.js +6 -0
  463. package/dist/standalone/chunks/shortcuts-DPxCSO4M.js +210 -0
  464. package/dist/standalone/chunks/{slider-BWT8Fmwz.js → slider-jp3d-Ld-.js} +15 -14
  465. package/dist/standalone/chunks/{stars-BN9M_9Q1.js → stars-BgKEjDQx.js} +1 -1
  466. package/dist/standalone/chunks/{styles-DwSR-9a3.js → styles-CaeyhYDA.js} +3 -0
  467. package/dist/standalone/chunks/submit-BjBGB8OW.js +42 -0
  468. package/dist/standalone/chunks/{summary-BwL-Gp8w.js → summary-W5s0TFqV.js} +1 -1
  469. package/dist/standalone/chunks/{text-field-CTp2b-Ai.js → text-field-CqhJSAwZ.js} +4 -4
  470. package/dist/standalone/chunks/{toggle-control-DXkgmz7R.js → toggle-control-lvZbQtGW.js} +2 -2
  471. package/dist/standalone/chunks/{tokens-BuahF1lF.js → tokens-C_ul7pL9.js} +4 -3
  472. package/dist/standalone/chunks/{virtual-B-1oN14Y.js → virtual-C_h6sHnm.js} +1 -1
  473. package/dist/standalone/confirm.js +27 -14
  474. package/dist/standalone/i18n-de.js +20 -2
  475. package/dist/standalone/icons.js +100 -98
  476. package/dist/standalone/links.js +1 -1
  477. package/dist/standalone/reset.css +10 -0
  478. package/dist/standalone/toast.js +1 -1
  479. package/dist/standalone/tokens.css +9 -5
  480. package/dist/tokens.css +9 -5
  481. package/dist/tokens.js +4 -3
  482. package/package.json +25 -2
  483. package/dist/standalone/chunks/announcer-haFcvqbe.js +0 -25
  484. package/dist/standalone/chunks/bk-kbd-B7bz8hmV.js +0 -275
  485. package/dist/standalone/chunks/clipboard-DBGdJ-1S.js +0 -61
  486. package/dist/standalone/chunks/handle-menu-DsxWvv4D.js +0 -22
  487. package/dist/standalone/chunks/link-CWSMsx04.js +0 -60
@@ -0,0 +1,1944 @@
1
+ import { a as e, d as t, n, r, t as i, u as a } from "./lit-D8x-qXgH.js";
2
+ import { t as o } from "./style-map-BMvn17E7.js";
3
+ import { i as s, n as c, r as l, t as u } from "./define-DkVeu7e9.js";
4
+ import { t as d } from "./announcer-D1zrRWwO.js";
5
+ import { i as f, n as p, o as m, t as h } from "./link--YWr8exL.js";
6
+ import { i as g, n as _ } from "./events-DQ4e9cPN.js";
7
+ import { t as v } from "./state-XYmTmnOw.js";
8
+ import { t as ee } from "./light-styles-CFbyUU7I.js";
9
+ import { t as y } from "./slots-BHTtBbPo.js";
10
+ import { n as b, t as x } from "./busy-BUB22mGY.js";
11
+ import { n as S, t as C } from "./virtual-C_h6sHnm.js";
12
+ import { a as w, i as T, n as E, o as D, t as O } from "./handle-menu-BgYUbGO2.js";
13
+ import { c as k, i as A, n as j } from "./anchor-CNX3nt2F.js";
14
+ import { t as te } from "./clipboard-UVLSkL4C.js";
15
+ import { t as ne } from "./i18n-DFfGgd3d.js";
16
+ import { S as M, f as N, t as P } from "./styles-CaeyhYDA.js";
17
+ import "../bk-button.js";
18
+ import "./bk-icon-Bp_flKdv.js";
19
+ import "./add-CUFUzxGc.js";
20
+ import "./arrow-back-DJBwVPZy.js";
21
+ import "./arrow-down-yAm1AGV7.js";
22
+ import "./arrow-forward-vijvTQ6r.js";
23
+ import "./arrow-up-BfHTuP3c.js";
24
+ import "./check-BkWcIJJJ.js";
25
+ import "./chevron-right-CxqvZ6TS.js";
26
+ import "./drag-indicator--UOafVoi.js";
27
+ import "./filter-CCC4hLkS.js";
28
+ import "./grid-BV0_DQ5v.js";
29
+ import "./keyboard-Cq9klEyN.js";
30
+ import "./more-vert-u8TDwpwH.js";
31
+ import "./refresh-BeOCgDeL.js";
32
+ import "./remove-3A4Fpn3J.js";
33
+ import "./unfold-more-CcOFYpUE.js";
34
+ import "./visibility-off-urFZQ4oB.js";
35
+ // dist/internal/late/bk-table.js
36
+ var F = {
37
+ "bk-checkbox": () => import("../bk-checkbox.js"),
38
+ "bk-filter-bar": () => import("../bk-filter-bar.js"),
39
+ "bk-popover": () => import("../bk-popover.js"),
40
+ "bk-menu-context": () => import("../bk-menu-context.js"),
41
+ "bk-menu-item": () => import("../bk-menu-item.js"),
42
+ "bk-menu-divider": () => import("../bk-menu-divider.js"),
43
+ "bk-menu-label": () => import("../bk-menu-label.js"),
44
+ "bk-input-number": () => import("../bk-input-number.js"),
45
+ "bk-input-text": () => import("../bk-input-text.js"),
46
+ "bk-skeleton": () => import("../bk-skeleton.js"),
47
+ "bk-select": () => import("../bk-select.js")
48
+ }, I = new w(F, "bk-checkbox"), L = new w(F, "bk-filter-bar", "bk-popover"), R = new w(F, "bk-menu-context", "bk-menu-item", "bk-menu-divider", "bk-menu-label"), z = new w(F, "bk-input-number", "bk-input-text"), B = new w(F, "bk-skeleton"), V = new w(F, "bk-select"), H = 48, U = 16, W = 64, G = 3, K = 10, q = "[data-bk-select], [data-bk-handle]", J = "button, a[href], input, select, textarea, bk-checkbox, bk-button, bk-switch, bk-link, bk-select, .bk-table-resize, [tabindex]:not(td, th, tr)", Y = "button, a[href], input, select, textarea, label, summary, [contenteditable], [role='button'], [tabindex]:not(td, th, tr), [data-row-action], bk-button, bk-button-copy, bk-button-share, bk-checkbox, bk-switch, bk-link, bk-select, bk-menu, bk-input-inline, bk-input-rating", X = ":scope > table > :is(thead, tbody:not([data-bk-state]), tfoot) > tr:not([data-bk-spacer])", Z = (e) => (e ?? "").replace(/\s+/g, " ").trim(), re = /* @__PURE__ */ new Set(["true", "yes"]), ie = /* @__PURE__ */ new Set([
49
+ "false",
50
+ "no",
51
+ ""
52
+ ]), Q = (e) => e == null || e === "" || e === !1 || Array.isArray(e) && e.length === 0, ae = (e, t) => e.includes(t) || /["\r\n]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e, oe = a`
53
+ @layer bk.components {
54
+ bk-table > table {
55
+ inline-size: 100%; border-collapse: separate; border-spacing: 0;
56
+ font-family: var(--bk-font); font-size: var(--bk-table-font-size, var(--bk-type-small));
57
+ line-height: var(--bk-line-height-body); color: var(--bk-table-fg, var(--bk-text));
58
+ }
59
+ bk-table > table > caption {
60
+ caption-side: top; text-align: start; padding-block-end: var(--bk-table-caption-gap, var(--bk-space-2));
61
+ color: var(--bk-table-caption-fg, var(--bk-text-muted)); font-size: var(--bk-table-caption-size, var(--bk-type-small));
62
+ }
63
+ bk-table > table > * > tr > :is(th, td) {
64
+ padding: var(--_bk-table-pad) var(--bk-table-cell-pad-inline, var(--bk-space-3));
65
+ text-align: start; vertical-align: middle; box-sizing: border-box;
66
+ border-block-end: var(--bk-border-width) solid var(--bk-table-border, var(--bk-line));
67
+ }
68
+ bk-table > table > * > tr > :is(th, td):first-child { padding-inline-start: var(--bk-table-edge, var(--bk-table-cell-pad-inline, var(--bk-space-3))); }
69
+ bk-table > table > * > tr > :is(th, td):last-child { padding-inline-end: var(--bk-table-edge, var(--bk-table-cell-pad-inline, var(--bk-space-3))); }
70
+ bk-table[flush] { --bk-table-edge: 0px; }
71
+ bk-table > table > thead > tr > th {
72
+ font-weight: var(--bk-table-head-weight, var(--bk-group-label-weight, var(--bk-label-weight, var(--bk-weight-medium)))); color: var(--bk-table-head-fg, var(--bk-group-label-color, var(--bk-text-muted)));
73
+ font-size: var(--bk-table-head-size, var(--bk-group-label-size, 1em));
74
+ line-height: var(--bk-table-head-leading, var(--bk-line-height-heading));
75
+ text-transform: var(--bk-group-label-transform, var(--bk-label-transform, none)); letter-spacing: var(--bk-group-label-tracking, var(--bk-label-tracking, normal)); font-family: var(--bk-font-label, inherit);
76
+ background: var(--bk-table-head-bg, transparent); white-space: nowrap;
77
+ }
78
+ bk-table > table > tbody > tr > th { font-weight: var(--bk-table-row-head-weight, var(--bk-weight-medium)); }
79
+ bk-table > table > tbody:last-child > tr:last-child > :is(th, td) { border-block-end: 0; }
80
+ bk-table > table > tfoot > tr > :is(th, td) {
81
+ font-weight: var(--bk-table-foot-weight, var(--bk-weight-medium)); border-block-start: var(--bk-border-width) solid var(--bk-table-border-strong, var(--bk-line-strong)); border-block-end: 0;
82
+ background: var(--bk-table-foot-bg, transparent);
83
+ }
84
+ bk-table > table > * > tr > [data-type="number"] { text-align: end; font-variant-numeric: tabular-nums; }
85
+ /* Yes/no cells: a mark in place of the value, centred in the column. A text value of the column ("Unlimited") centres too. */
86
+ bk-table > table > * > tr > :is([data-bk-check], [data-bk-check-column], th[data-type="check"]) { text-align: center; }
87
+ bk-table > table > * > tr > [data-bk-check] > .bk-table-check {
88
+ display: inline-flex; align-items: center; justify-content: center; vertical-align: top;
89
+ block-size: var(--bk-line-height-body); color: var(--bk-table-check-yes-fg, var(--bk-success-text));
90
+ }
91
+ bk-table > table > * > tr > [data-bk-check="no"] > .bk-table-check { color: var(--bk-table-check-no-fg, var(--bk-text-faint)); }
92
+ bk-table > table > * > tr > [data-bk-check] > .bk-table-check > bk-icon { --bk-icon-size: var(--bk-table-check-size, var(--bk-icon-sm)); }
93
+ /* The highlighted column: a tint and a frame from the header to the last row. Inset shadows, so the layout stays. */
94
+ bk-table > table > * > tr > [data-bk-highlight] {
95
+ --_bk-table-hl-w: var(--bk-table-highlight-border-width, var(--bk-border-width));
96
+ --_bk-table-hl-c: var(--bk-table-highlight-border, var(--bk-accent-solid));
97
+ background-color: var(--bk-table-highlight-bg, var(--bk-accent-soft));
98
+ box-shadow: inset var(--_bk-table-hl-w) 0 0 0 var(--_bk-table-hl-c), inset calc(-1 * var(--_bk-table-hl-w)) 0 0 0 var(--_bk-table-hl-c);
99
+ }
100
+ bk-table > table > * > tr > [data-bk-highlight="first"] {
101
+ box-shadow: inset var(--_bk-table-hl-w) 0 0 0 var(--_bk-table-hl-c), inset calc(-1 * var(--_bk-table-hl-w)) 0 0 0 var(--_bk-table-hl-c), inset 0 var(--_bk-table-hl-w) 0 0 var(--_bk-table-hl-c);
102
+ }
103
+ bk-table > table > * > tr > [data-bk-highlight="last"] {
104
+ box-shadow: inset var(--_bk-table-hl-w) 0 0 0 var(--_bk-table-hl-c), inset calc(-1 * var(--_bk-table-hl-w)) 0 0 0 var(--_bk-table-hl-c), inset 0 calc(-1 * var(--_bk-table-hl-w)) 0 0 var(--_bk-table-hl-c);
105
+ }
106
+ bk-table > table > thead > tr > th[data-bk-highlight] { color: var(--bk-table-highlight-head-fg, var(--bk-accent-text)); }
107
+ bk-table[variant="striped"] > table > tbody > tr:nth-child(even) > :is(th, td) { background: var(--bk-table-stripe, var(--bk-hover)); }
108
+ /* Stripes are the divider: no hairline runs into the edge of a tinted row. */
109
+ bk-table[variant="striped"] > table > tbody > tr > :is(th, td) { border-block-end-color: transparent; }
110
+ bk-table[variant="grid"] > table > * > tr > :is(th, td):not(:last-child) { border-inline-end: var(--bk-border-width) solid var(--bk-table-border, var(--bk-line)); }
111
+ bk-table > table > tbody > tr:is([data-selected], [aria-selected="true"]) > :is(th, td) { background: var(--bk-table-selected, var(--bk-selected)); }
112
+ /* A tinted row has a surface: no divider line runs into its edges (above, below). */
113
+ bk-table:not([variant="striped"]) > table > tbody > tr:is([data-selected], [aria-selected="true"], [data-group]) > :is(th, td),
114
+ bk-table:not([variant="striped"]) > table > tbody > tr:has(+ tr:is([data-selected], [aria-selected="true"], [data-group])) > :is(th, td) {
115
+ border-block-end-color: transparent;
116
+ }
117
+ /* Row links: the hit area of the link covers the row; the controls of the row stay on top of it. The row is a
118
+ stacking context, so its controls never paint over a sticky header. */
119
+ bk-table > table > tbody > tr:has(a[data-row-link][href]) { position: relative; z-index: 0; cursor: pointer; }
120
+ bk-table > table > tbody > tr > * a[data-row-link][href] { color: var(--bk-table-row-link-fg, inherit); font-weight: var(--bk-table-row-link-weight, inherit); text-decoration: none; }
121
+ bk-table > table > tbody > tr > * a[data-row-link][href]::after { content: ""; position: absolute; inset: 0; }
122
+ bk-table > table > tbody > tr:has(a[data-row-link][href]) :is(${t(Y)}):not([data-row-link]) { position: relative; z-index: 1; }
123
+ bk-table > table > tbody > tr > * a[data-row-link][href]:focus { outline: none; }
124
+ bk-table > table > tbody > tr > * a[data-row-link][href]:focus-visible::after { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
125
+ @media (hover: hover) {
126
+ bk-table > table > tbody > tr:hover > * a[data-row-link][href] { text-decoration: underline; }
127
+ /* An overlay, so the hover shows on stripes and selected rows too. */
128
+ bk-table[hover-rows] > table > tbody > tr:hover > :is(th, td) {
129
+ background-image: linear-gradient(var(--bk-table-row-hover, var(--bk-hover)), var(--bk-table-row-hover, var(--bk-hover)));
130
+ }
131
+ }
132
+ /* The sort button fills the header cell beside its tools: a click anywhere in the cell sorts. */
133
+ bk-table > table > thead > tr > th > .bk-table-sort {
134
+ display: inline-flex; align-items: center; gap: var(--bk-table-sort-gap, var(--bk-space-1)); box-sizing: border-box;
135
+ inline-size: calc(100% + 2 * var(--bk-table-sort-pad, var(--bk-space-1)) - var(--_bk-table-sort-tools, 0px));
136
+ position: relative; min-block-size: var(--bk-space-6); margin: 0 calc(-1 * var(--bk-table-sort-pad, var(--bk-space-1)));
137
+ padding: 0 var(--bk-table-sort-pad, var(--bk-space-1)); border: 0; border-radius: var(--bk-table-sort-radius, var(--bk-radius-xs));
138
+ background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: inherit;
139
+ cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color var(--bk-duration-fast), color var(--bk-duration-fast);
140
+ }
141
+ bk-table > table > thead > tr > th > .bk-table-sort::before { content: ""; position: absolute; inset-inline: 0; inset-block: min(0px, calc((100% - var(--bk-target-min)) / 2)); }
142
+ @media (hover: hover) {
143
+ bk-table > table > thead > tr > th > .bk-table-sort:hover { background: var(--bk-table-sort-hover, var(--bk-hover)); color: var(--bk-table-sort-active-fg, var(--bk-text)); }
144
+ }
145
+ bk-table > table > thead > tr > th > .bk-table-sort:active { background: var(--bk-pressed); }
146
+ bk-table > table > thead > tr > th > .bk-table-sort:focus { outline: none; }
147
+ bk-table > table > thead > tr > th > .bk-table-sort:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
148
+ bk-table > table > thead > tr > th[aria-sort] > .bk-table-sort { color: var(--bk-table-sort-active-fg, var(--bk-text)); }
149
+ bk-table > table > thead > tr > th:has(> .bk-table-tool) > .bk-table-sort {
150
+ --_bk-table-sort-tools: calc(var(--bk-table-tool-size, var(--bk-space-6)) + var(--bk-table-tool-gap, var(--bk-space-1)));
151
+ }
152
+ bk-table > table > thead > tr > th:has(> .bk-table-tool ~ .bk-table-tool) > .bk-table-sort {
153
+ --_bk-table-sort-tools: calc(2 * (var(--bk-table-tool-size, var(--bk-space-6)) + var(--bk-table-tool-gap, var(--bk-space-1))));
154
+ }
155
+ /* Numbers align to the end: the icon goes first, so the labels line up with the figures. In the reversed row the
156
+ start of the content is the end of the cell. */
157
+ bk-table > table > thead > tr > th[data-type="number"] > .bk-table-sort { flex-direction: row-reverse; }
158
+ bk-table > table > thead > tr > th > .bk-table-sort > .bk-table-sort-icon {
159
+ --bk-icon-size: var(--bk-table-sort-icon-size, var(--bk-icon-sm)); color: var(--bk-table-sort-icon-fg, var(--bk-text-faint));
160
+ }
161
+ bk-table > table > thead > tr > th[aria-sort] > .bk-table-sort > .bk-table-sort-icon { color: inherit; }
162
+ bk-table[sticky-header] > table > thead > tr > th {
163
+ position: sticky; inset-block-start: 0; z-index: 1;
164
+ background: var(--bk-table-head-bg, var(--bk-layer-sticky-bg));
165
+ }
166
+ bk-table[sticky-footer] > table > tfoot > tr > :is(th, td) {
167
+ position: sticky; inset-block-end: 0; z-index: 1;
168
+ background: var(--bk-table-foot-bg, var(--bk-layer-sticky-bg));
169
+ }
170
+ bk-table > table > * > tr > * > .bk-table-sr, bk-table > table > * > tr > * > .bk-table-check > .bk-table-sr { ${M} }
171
+ /* Header tools: the filter button and the column menu button, ghost icon buttons after the label. */
172
+ bk-table > table > thead > tr > th > .bk-table-tool,
173
+ bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle {
174
+ display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; position: relative;
175
+ inline-size: var(--bk-table-tool-size, var(--bk-space-6)); block-size: var(--bk-table-tool-size, var(--bk-space-6));
176
+ margin-block: calc(-1 * var(--bk-space-1)); padding: 0; border: 0;
177
+ border-radius: var(--bk-table-tool-radius, var(--bk-radius-xs)); background: none;
178
+ color: var(--bk-table-tool-fg, var(--bk-text-muted)); cursor: pointer; -webkit-tap-highlight-color: transparent;
179
+ }
180
+ bk-table > table > thead > tr > th > .bk-table-tool { margin-inline-start: var(--bk-table-tool-gap, var(--bk-space-1)); }
181
+ bk-table > table > thead > tr > th > .bk-table-tool::before,
182
+ bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle::before { content: ""; position: absolute; inset: min(0px, calc((100% - var(--bk-target-min)) / 2)); }
183
+ bk-table > table > thead > tr > th > .bk-table-tool > bk-icon,
184
+ bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle > bk-icon { --bk-icon-size: var(--bk-table-tool-icon-size, var(--bk-icon-sm)); }
185
+ @media (hover: hover) {
186
+ bk-table > table > thead > tr > th > .bk-table-tool:hover,
187
+ bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle:hover { background: var(--bk-table-tool-hover, var(--bk-hover)); color: var(--bk-text); }
188
+ /* The menu button shows where the pointer or the focus is; on touch it always shows. */
189
+ bk-table > table > thead > tr > th > .bk-table-menu { opacity: 0; }
190
+ bk-table > table > thead > tr > th:is(:hover, :focus-within) > .bk-table-menu,
191
+ bk-table > table > thead > tr > th > .bk-table-menu[aria-expanded="true"] { opacity: 1; }
192
+ }
193
+ bk-table > table > thead > tr > th > .bk-table-tool:active,
194
+ bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle:active { background: var(--bk-pressed); }
195
+ bk-table > table > thead > tr > th > .bk-table-tool:focus,
196
+ bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle:focus { outline: none; }
197
+ bk-table > table > thead > tr > th > .bk-table-tool:focus-visible,
198
+ bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
199
+ bk-table > table > thead > tr > th > .bk-table-filter[data-active] { color: var(--bk-table-filter-active-fg, var(--bk-accent-text)); }
200
+ /* Selection and handle columns: narrow. */
201
+ bk-table > table > * > tr > :is([data-bk-select], [data-bk-handle]) { inline-size: 1px; white-space: nowrap; }
202
+ bk-table > table > * > tr > [data-bk-handle] { padding-inline-end: 0; }
203
+ bk-table > table > tbody > tr > [data-bk-handle] > .bk-table-handle { cursor: grab; touch-action: none; }
204
+ bk-table > table > tbody > tr[data-bk-lifted] > :is(th, td) { background: var(--bk-table-lifted-bg, var(--bk-layer-raised-bg)); }
205
+ bk-table > table > tbody > tr[data-bk-lifted] > [data-bk-handle] > .bk-table-handle { cursor: grabbing; color: var(--bk-text); }
206
+ bk-table > table > tbody > tr[data-bk-drop="before"] > :is(th, td) { box-shadow: inset 0 calc(var(--bk-border-width) * 2) 0 0 var(--bk-table-drop-line, var(--bk-accent-solid)); }
207
+ bk-table > table > tbody > tr[data-bk-drop="after"] > :is(th, td) { box-shadow: inset 0 calc(var(--bk-border-width) * -2) 0 0 var(--bk-table-drop-line, var(--bk-accent-solid)); }
208
+ /* Expandable rows: a disclosure button in the first cell. */
209
+ bk-table > table > tbody > tr > * > .bk-table-disclosure {
210
+ display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
211
+ position: relative; inline-size: var(--bk-space-6); block-size: var(--bk-space-6); margin: calc(-1 * var(--bk-space-1)) var(--bk-space-1) calc(-1 * var(--bk-space-1)) calc(-1 * var(--bk-space-1));
212
+ padding: 0; border: 0; border-radius: var(--bk-table-disclosure-radius, var(--bk-radius-xs));
213
+ background: none; color: var(--bk-table-disclosure-fg, var(--bk-text-muted)); cursor: pointer; -webkit-tap-highlight-color: transparent;
214
+ }
215
+ bk-table > table > tbody > tr > * > .bk-table-disclosure::before { content: ""; position: absolute; inset-inline: 0; inset-block: min(0px, calc((100% - var(--bk-target-min)) / 2)); }
216
+ bk-table > table > tbody > tr > * > .bk-table-disclosure > bk-icon {
217
+ --bk-icon-size: var(--bk-table-disclosure-icon-size, var(--bk-icon-sm));
218
+ transition: rotate var(--bk-duration-fast);
219
+ }
220
+ bk-table > table > tbody > tr > * > .bk-table-disclosure[aria-expanded="true"] > bk-icon,
221
+ bk-table > table > tbody > tr[aria-expanded="true"] > * > .bk-table-disclosure > bk-icon { rotate: 90deg; }
222
+ bk-table > table > tbody > tr > * > .bk-table-disclosure:dir(rtl) > bk-icon { scale: -1 1; }
223
+ @media (hover: hover) {
224
+ bk-table > table > tbody > tr > * > .bk-table-disclosure:hover { background: var(--bk-table-disclosure-hover, var(--bk-hover)); color: var(--bk-text); }
225
+ }
226
+ bk-table > table > tbody > tr > * > .bk-table-disclosure:active { background: var(--bk-pressed); }
227
+ bk-table > table > tbody > tr > * > .bk-table-disclosure:focus { outline: none; }
228
+ bk-table > table > tbody > tr > * > .bk-table-disclosure:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
229
+ bk-table > table > tbody > tr[data-detail] > td { background: var(--bk-table-detail-bg, transparent); }
230
+ /* Tree rows: the first cell moves in by the level; a leaf keeps the place of the disclosure button. */
231
+ bk-table > table > tbody > tr[data-bk-tree] > [data-bk-indent] {
232
+ padding-inline-start: calc(var(--bk-table-edge, var(--bk-table-cell-pad-inline, var(--bk-space-3))) + var(--_bk-table-level, 0) * var(--bk-table-indent, var(--bk-space-4)));
233
+ }
234
+ bk-table > table > tbody > tr[data-bk-tree]:not([data-bk-parent]) > [data-bk-indent] {
235
+ padding-inline-start: calc(var(--bk-table-edge, var(--bk-table-cell-pad-inline, var(--bk-space-3))) + var(--_bk-table-level, 0) * var(--bk-table-indent, var(--bk-space-4)) + var(--bk-space-6));
236
+ }
237
+ bk-table > table > tbody > tr[data-group] > :is(th, td) {
238
+ background: var(--bk-table-group-bg, var(--bk-layer-sunken-bg)); font-weight: var(--bk-table-group-weight, var(--bk-weight-medium));
239
+ }
240
+ bk-table > table > tbody > tr[data-bk-tree]:focus { outline: none; }
241
+ bk-table > table > tbody > tr[data-bk-tree]:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
242
+ /* Cell navigation: one cell (or the one control in it) has the focus. */
243
+ bk-table[navigation="cell"] > table > * > tr > :is(th, td):focus { outline: none; }
244
+ bk-table[navigation="cell"] > table > * > tr > :is(th, td):focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
245
+ bk-table > table > * > tr > td[data-bk-editing] { position: relative; }
246
+ bk-table > table > * > tr > td > .bk-table-editor {
247
+ position: absolute; inset: 0; z-index: 2; display: grid; align-content: center;
248
+ padding-inline: var(--bk-table-edit-pad, var(--bk-space-1)); background: var(--bk-table-edit-bg, var(--bk-layer-base-bg));
249
+ text-align: start; font-weight: var(--bk-weight-regular, normal);
250
+ }
251
+ /* Resizable columns: a separator handle on the end edge of the header cell. */
252
+ :where(bk-table > table > thead > tr > th[data-resizable]) { position: relative; }
253
+ bk-table > table > thead > tr > th > .bk-table-resize {
254
+ position: absolute; inset-block: 0; inset-inline-end: calc(var(--bk-target-min) / -2); z-index: 3;
255
+ inline-size: var(--bk-target-min); cursor: col-resize; touch-action: none; -webkit-tap-highlight-color: transparent;
256
+ --_bk-grip-color: var(--bk-table-resize-active-fg, var(--bk-accent-solid));
257
+ }
258
+ ${N}
259
+ bk-table > table > thead > tr > th > .bk-table-resize::after {
260
+ content: ""; position: absolute; inset-block: var(--bk-space-1); inset-inline-start: calc(50% - var(--bk-border-width) / 2);
261
+ inline-size: var(--bk-border-width); background: var(--bk-table-resize-fg, var(--bk-line-strong));
262
+ }
263
+ @media (hover: hover) {
264
+ bk-table > table > thead > tr > th > .bk-table-resize:hover::after { background: var(--bk-table-resize-active-fg, var(--bk-accent-solid)); inline-size: var(--bk-table-resize-active-size, calc(var(--bk-border-width) * 2)); }
265
+ }
266
+ bk-table > table > thead > tr > th > .bk-table-resize:focus { outline: none; }
267
+ bk-table > table > thead > tr > th > .bk-table-resize:focus-visible::after,
268
+ bk-table > table > thead > tr > th > .bk-table-resize[data-dragging]::after { background: var(--bk-table-resize-active-fg, var(--bk-accent-solid)); }
269
+ /* Pinned columns stay at the inline start or end; opaque, so the scrolled cells pass beneath. */
270
+ bk-table > table > * > tr > :is(th, td)[data-pin] { white-space: nowrap; }
271
+ bk-table > table > * > tr > :is(th, td)[data-pin="start"] {
272
+ position: sticky; inset-inline-start: var(--_bk-table-pin, 0); z-index: 1;
273
+ background: var(--bk-table-pin-bg, var(--bk-layer-base-bg));
274
+ }
275
+ bk-table > table > * > tr > :is(th, td)[data-pin="end"] {
276
+ position: sticky; inset-inline-end: var(--_bk-table-pin, 0); z-index: 1;
277
+ background: var(--bk-table-pin-bg, var(--bk-layer-base-bg));
278
+ }
279
+ bk-table > table > thead > tr > th[data-pin] { z-index: 2; background: var(--bk-table-pin-bg, var(--bk-layer-sticky-bg)); }
280
+ bk-table[sticky-footer] > table > tfoot > tr > [data-pin] { z-index: 2; background: var(--bk-table-pin-bg, var(--bk-layer-sticky-bg)); }
281
+ bk-table > table > tbody > tr:is([data-selected], [aria-selected="true"]) > :is(th, td)[data-pin] {
282
+ background: linear-gradient(var(--bk-table-selected, var(--bk-selected)), var(--bk-table-selected, var(--bk-selected))), var(--bk-table-pin-bg, var(--bk-layer-base-bg));
283
+ }
284
+ bk-table > table > * > tr > :is(th, td)[data-pin="start"][data-pin-edge] { border-inline-end: var(--bk-border-width) solid var(--bk-table-pin-border, var(--bk-line-strong)); }
285
+ bk-table > table > * > tr > :is(th, td)[data-pin="end"][data-pin-edge] { border-inline-start: var(--bk-border-width) solid var(--bk-table-pin-border, var(--bk-line-strong)); }
286
+ /* Hidden columns (column menu). */
287
+ bk-table > table > * > tr > [data-bk-hidden] { display: none; }
288
+ /* Loading: the old rows fade under the veil; the first load shows skeleton rows. */
289
+ bk-table[busy] > table > tbody:not([data-bk-state]) > tr > :is(th, td) { opacity: var(--bk-table-busy-opacity, 1); }
290
+ bk-table > table > tbody[data-bk-state] > tr > td { border-block-end: var(--bk-border-width) solid var(--bk-table-border, var(--bk-line)); }
291
+ bk-table > table > tbody[data-bk-state] > tr > td > bk-skeleton { --bk-skeleton-width: var(--bk-table-skeleton-width, 70%); }
292
+ /* An error replaces the rows: they are out of date. */
293
+ bk-table:has(> [slot="error"]) > table > tbody { display: none; }
294
+ /* Virtual rows: one fixed height, so the table can compute the window. */
295
+ bk-table[virtual] > table > tbody > tr:not([data-bk-spacer]) { block-size: var(--bk-table-row-height, var(--bk-control-lg)); }
296
+ bk-table[virtual] > table > tbody > tr:not([data-bk-spacer]) > :is(th, td) { white-space: nowrap; padding-block: 0; }
297
+ bk-table > table > tbody > tr[data-bk-spacer] > td { padding: 0; border: 0; }
298
+ /* Cards on a narrow screen: every row is a card of label and value pairs; the header row keeps its controls. */
299
+ bk-table:state(cards) > table,
300
+ bk-table:state(cards) > table > :is(thead, tbody, tfoot),
301
+ bk-table:state(cards) > table > * > tr { display: block; }
302
+ bk-table:state(cards) > table > caption { display: block; }
303
+ bk-table:state(cards) > table > thead > tr {
304
+ display: flex; flex-wrap: wrap; align-items: center; gap: var(--bk-table-card-gap, var(--bk-space-2));
305
+ padding-block-end: var(--bk-table-card-gap, var(--bk-space-2));
306
+ }
307
+ bk-table:state(cards) > table > thead > tr > th { display: block; position: static; padding: 0; border: 0; background: none; inline-size: auto; }
308
+ bk-table:state(cards) > table > thead > tr > th:not(:has(> .bk-table-tool, > bk-checkbox)) { ${M} }
309
+ /* The select above the table sorts the cards: the sort buttons of the header cells do not show. */
310
+ bk-table:state(cards) > table > thead > tr > th > .bk-table-sort { ${M} }
311
+ bk-table:state(cards) > table > thead > tr:not(:has(> th > :is(.bk-table-tool, bk-checkbox))) { padding-block-end: 0; }
312
+ bk-table:state(cards) > table > thead > tr > th > .bk-table-resize { display: none; }
313
+ /*
314
+ * The card is the surface of the row: a selected row and the row under the pointer tint the whole card, not the
315
+ * cells inside its padding. The cells have no background of their own in card mode (no stripes, no pin surface).
316
+ */
317
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr:not([data-bk-spacer]) > :is(th, td):not([data-bk-handle]) { background: none; }
318
+ bk-table:state(cards) > table > tbody > tr:is([data-selected], [aria-selected="true"]) {
319
+ background-image: linear-gradient(var(--bk-table-selected, var(--bk-selected)), var(--bk-table-selected, var(--bk-selected)));
320
+ }
321
+ @media (hover: hover) {
322
+ bk-table:state(cards)[hover-rows] > table > tbody > tr:hover {
323
+ background-image: linear-gradient(var(--bk-table-row-hover, var(--bk-hover)), var(--bk-table-row-hover, var(--bk-hover)));
324
+ }
325
+ bk-table:state(cards)[hover-rows] > table > tbody > tr:is([data-selected], [aria-selected="true"]):hover {
326
+ background-image: linear-gradient(var(--bk-table-row-hover, var(--bk-hover)), var(--bk-table-row-hover, var(--bk-hover))),
327
+ linear-gradient(var(--bk-table-selected, var(--bk-selected)), var(--bk-table-selected, var(--bk-selected)));
328
+ }
329
+ }
330
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr {
331
+ margin-block-end: var(--bk-table-card-gap, var(--bk-space-2)); padding: var(--bk-table-card-padding, var(--bk-space-3));
332
+ border: var(--bk-border-width) solid var(--bk-table-card-border, var(--bk-layer-raised-border));
333
+ border-radius: var(--bk-table-card-radius, var(--bk-radius-container, var(--bk-radius-md)));
334
+ background: var(--bk-table-card-bg, var(--bk-layer-raised-bg));
335
+ }
336
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr > :is(th, td) {
337
+ display: flex; justify-content: space-between; align-items: baseline; gap: var(--bk-table-card-label-gap, var(--bk-space-3));
338
+ position: static; padding: var(--bk-table-card-row-pad, var(--bk-space-1)) 0; border: 0; text-align: end; inline-size: auto;
339
+ }
340
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-label]::before {
341
+ content: attr(data-bk-label) / ""; text-align: start; color: var(--bk-table-head-fg, var(--bk-text-muted));
342
+ font-weight: var(--bk-table-head-weight, var(--bk-weight-medium));
343
+ }
344
+ /*
345
+ * A text value stands at the end beside its label while it fits on the line. A longer value wraps as a whole under
346
+ * the label: it starts at the start edge and takes the full width. A number stays at the end beside its label.
347
+ */
348
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-label]:not([data-bk-number], [data-type="number"], [data-bk-check]) {
349
+ flex-wrap: wrap; row-gap: var(--bk-table-card-block-gap, var(--bk-space-1)); text-align: start;
350
+ }
351
+ /* th[data-card="block"]: the value always stands under its label. */
352
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-card="block"] { display: block; text-align: start; }
353
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-card="block"][data-bk-label]::before {
354
+ display: block; margin-block-end: var(--bk-table-card-block-gap, var(--bk-space-1));
355
+ }
356
+ /* A row header in the body is the title of the card, unless its column gives it another place (data-card). */
357
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-card="title"],
358
+ bk-table:state(cards) > table > tbody > tr > th:not([data-bk-card], ${t(q)}) {
359
+ justify-content: start; text-align: start; font-size: var(--bk-table-card-title-size, var(--bk-type-body, 1em));
360
+ font-weight: var(--bk-table-card-title-weight, var(--bk-weight-semibold, var(--bk-weight-medium)));
361
+ }
362
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr > :is([data-bk-card="hidden"], [data-bk-handle]) { display: none; }
363
+ /*
364
+ * th[data-card="meta"]: a short value without its label (a position, a change) is in the head of the card,
365
+ * in the order of the row, next to the title and the checkbox. The other cells follow in full rows.
366
+ */
367
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr:has(> [data-bk-card="meta"]) {
368
+ display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--bk-table-card-meta-gap, var(--bk-space-2));
369
+ }
370
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr:has(> [data-bk-card="meta"]) > * { flex: 1 0 100%; order: 1; }
371
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr:has(> [data-bk-card="meta"]) > :is([data-bk-card="meta"], [data-bk-select]) {
372
+ flex: none; order: 0;
373
+ }
374
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr:has(> [data-bk-card="meta"]) > :is([data-bk-card="title"], th:not([data-bk-card], ${t(q)})) {
375
+ /* The title keeps the width of its longest word (at most the card): a meta value that does not fit then wraps under it. */
376
+ flex: 1 1 0; min-inline-size: min(min-content, 100%); order: 0;
377
+ }
378
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-card="meta"] {
379
+ justify-content: start; align-items: center; gap: var(--bk-table-card-meta-gap, var(--bk-space-2)); max-inline-size: 100%;
380
+ text-align: start; color: var(--bk-table-card-meta-fg, var(--bk-text-muted));
381
+ }
382
+ /* An open row and its detail form one card. The text of the detail starts at the start edge. */
383
+ bk-table:state(cards) > table > tbody > tr:has(+ tr[data-detail]:not([hidden])) {
384
+ margin-block-end: 0; border-end-start-radius: 0; border-end-end-radius: 0;
385
+ }
386
+ bk-table:state(cards) > table > tbody > tr[data-detail] {
387
+ border-block-start-style: dashed; border-start-start-radius: 0; border-start-end-radius: 0;
388
+ }
389
+ bk-table:state(cards) > table > tbody > tr[data-detail] > td { display: block; text-align: start; }
390
+ /* A closed detail row and the hidden rows of a closed tree stay hidden in card mode too. */
391
+ bk-table:state(cards) > table > :is(thead, tbody, tfoot) > tr[hidden] { display: none; }
392
+ bk-table:state(cards) > table > :is(tbody, tfoot) > tr > [data-bk-select] { justify-content: start; }
393
+ @media (forced-colors: active) {
394
+ bk-table > table > * > tr > [data-bk-highlight] { --_bk-table-hl-c: Highlight; forced-color-adjust: none; background-color: Canvas; color: CanvasText; }
395
+ bk-table > table > * > tr > [data-bk-check] > .bk-table-check { color: CanvasText; }
396
+ bk-table > table > tbody > tr[data-bk-drop] { outline: calc(var(--bk-border-width) * 2) solid Highlight; }
397
+ bk-table > table > thead > tr > th > .bk-table-filter[data-active] { color: Highlight; }
398
+ }
399
+ @media (prefers-reduced-motion: reduce) {
400
+ bk-table > table > tbody > tr > * > .bk-table-disclosure > bk-icon { transition: none; }
401
+ }
402
+ }
403
+ `, $ = class extends i {
404
+ static properties = {
405
+ variant: {
406
+ reflect: !0,
407
+ useDefault: !0
408
+ },
409
+ stickyHeader: {
410
+ type: Boolean,
411
+ reflect: !0,
412
+ useDefault: !0,
413
+ attribute: "sticky-header"
414
+ },
415
+ stickyFooter: {
416
+ type: Boolean,
417
+ reflect: !0,
418
+ useDefault: !0,
419
+ attribute: "sticky-footer"
420
+ },
421
+ hoverRows: {
422
+ type: Boolean,
423
+ reflect: !0,
424
+ useDefault: !0,
425
+ attribute: "hover-rows"
426
+ },
427
+ surface: {
428
+ type: Boolean,
429
+ reflect: !0,
430
+ useDefault: !0
431
+ },
432
+ flush: {
433
+ type: Boolean,
434
+ reflect: !0,
435
+ useDefault: !0
436
+ },
437
+ sortable: {
438
+ type: Boolean,
439
+ reflect: !0,
440
+ useDefault: !0
441
+ },
442
+ sortKey: {
443
+ reflect: !0,
444
+ attribute: "sort-key"
445
+ },
446
+ sortDir: {
447
+ reflect: !0,
448
+ useDefault: !0,
449
+ attribute: "sort-dir"
450
+ },
451
+ selection: { reflect: !0 },
452
+ navigation: { reflect: !0 },
453
+ columnMenu: {
454
+ type: Boolean,
455
+ reflect: !0,
456
+ useDefault: !0,
457
+ attribute: "column-menu"
458
+ },
459
+ reorderable: {
460
+ type: Boolean,
461
+ reflect: !0,
462
+ useDefault: !0
463
+ },
464
+ responsive: { reflect: !0 },
465
+ busy: {
466
+ type: Boolean,
467
+ reflect: !0,
468
+ useDefault: !0
469
+ },
470
+ busyLabel: { attribute: "busy-label" },
471
+ skeletonRows: {
472
+ type: Number,
473
+ attribute: "skeleton-rows"
474
+ },
475
+ virtual: {
476
+ type: Boolean,
477
+ reflect: !0,
478
+ useDefault: !0
479
+ },
480
+ rows: { attribute: !1 },
481
+ renderRow: { attribute: !1 },
482
+ rowKey: { attribute: !1 },
483
+ filters: { attribute: !1 },
484
+ hiddenColumns: { attribute: !1 },
485
+ persistKey: { attribute: "persist-key" },
486
+ label: {},
487
+ scrolling: { state: !0 },
488
+ resizable: { state: !0 },
489
+ empty: { state: !0 },
490
+ filterKey: { state: !0 }
491
+ };
492
+ menuColumn = null;
493
+ menuKind = "resize";
494
+ i18n = new ne(this);
495
+ internals = this.attachInternals();
496
+ busyState = new x(this, this.i18n, this.internals);
497
+ slots = new y(this);
498
+ keys = /* @__PURE__ */ new Set();
499
+ anchor;
500
+ shift = !1;
501
+ shiftDown = !1;
502
+ widths = new v(this, () => this.persistKey && `table:${this.persistKey}:widths`);
503
+ columnState = new v(this, () => this.persistKey && `table:${this.persistKey}:columns`);
504
+ openRows = new v(this, () => this.persistKey && `table:${this.persistKey}:expanded`);
505
+ sizes = s(() => this.measure());
506
+ observedTable = null;
507
+ heads = l(() => this.syncAll());
508
+ rowLinks = l(() => this.resolveRowLinks());
509
+ vc = new S(this, {
510
+ scroller: () => this.scroller,
511
+ track: () => this.virtual ? this.body : null,
512
+ rowHeight: "var(--bk-table-row-height, var(--bk-control-lg))"
513
+ });
514
+ loadMore = new C(this, {
515
+ sentinel: () => this.virtual ? this.renderRoot.querySelector(".sentinel") : null,
516
+ root: () => this.scroller,
517
+ loading: () => this.busy,
518
+ count: () => this.rows?.length ?? 0
519
+ });
520
+ tree = !1;
521
+ stop = null;
522
+ lift = null;
523
+ handleRow = null;
524
+ editing = null;
525
+ filterButton = null;
526
+ filterable = !1;
527
+ syncing = !1;
528
+ constructor() {
529
+ super(), new h(this), this.variant = "line", this.stickyHeader = !1, this.stickyFooter = !1, this.hoverRows = !1, this.surface = !1, this.flush = !1, this.sortable = !1, this.sortDir = "asc", this.columnMenu = !1, this.reorderable = !1, this.busy = !1, this.skeletonRows = 5, this.virtual = !1, this.filters = {}, this.hiddenColumns = [], this.scrolling = !1, this.resizable = !1, this.empty = !1, this.addEventListener("click", this.onClick), this.addEventListener("click", this.onRowLink), this.addEventListener("auxclick", this.onRowLink), this.addEventListener("click", this.onRowLinkNavigate), this.addEventListener("dblclick", this.onDoubleClick), this.addEventListener("click", (e) => {
530
+ this.shift = e.shiftKey || this.shiftDown, setTimeout(() => this.shift = !1);
531
+ }, !0), this.addEventListener("keydown", (e) => this.shiftDown = e.shiftKey, !0), this.addEventListener("keyup", (e) => this.shiftDown = e.shiftKey, !0), this.addEventListener("focusout", this.onFocusOut), this.addEventListener("focusin", this.onFocusIn), this.addEventListener("change", this.onChange), this.addEventListener("keydown", this.onKeydown), this.addEventListener("pointerdown", this.onPointerDown);
532
+ }
533
+ get selectedKeys() {
534
+ return [...this.keys];
535
+ }
536
+ set selectedKeys(e) {
537
+ this.keys = new Set(e ?? []), this.requestUpdate("selectedKeys");
538
+ }
539
+ get columnOrder() {
540
+ let e = this.headRow, t = e ? this.appCells(e).map((e) => this.columnKey(e)) : [], n = this.columnState.value?.order;
541
+ return n?.length ? [...n, ...t.filter((e) => !n.includes(e))] : t;
542
+ }
543
+ static styles = [
544
+ P,
545
+ b,
546
+ E,
547
+ a`
548
+ :host {
549
+ display: block; min-inline-size: 0;
550
+ --_bk-table-pad: var(--bk-table-cell-pad-block, var(--bk-row-pad));
551
+ }
552
+ .frame { position: relative; max-block-size: inherit; block-size: inherit; display: flex; flex-direction: column; }
553
+ :host([surface]:not(:state(cards))) .frame {
554
+ background: var(--bk-table-surface-bg, var(--bk-layer-raised-bg));
555
+ border: var(--bk-border-width) solid var(--bk-table-surface-border, var(--bk-layer-raised-border));
556
+ border-radius: var(--bk-table-surface-radius, var(--bk-radius-container, var(--bk-radius-md)));
557
+ box-shadow: var(--bk-table-surface-shadow, var(--bk-layer-raised-shadow));
558
+ overflow: hidden;
559
+ }
560
+ .scroller { overflow: auto; flex: 1 1 auto; min-block-size: 0; max-block-size: inherit; overscroll-behavior-inline: contain; }
561
+ .scroller:focus-visible { outline: var(--bk-focus-ring); outline-offset: var(--bk-focus-offset-inset); }
562
+ .filter-bar { margin-block-end: var(--bk-table-filter-bar-gap, var(--bk-space-2)); }
563
+ /* Card mode: the sort of the cards is one select and a button for the direction, above the table. */
564
+ .card-sort { display: flex; align-items: end; gap: var(--bk-table-card-gap, var(--bk-space-2)); margin-block-end: var(--bk-table-card-gap, var(--bk-space-2)); }
565
+ .card-sort bk-select { flex: 1 1 auto; min-inline-size: 0; --bk-field-label-width: max-content; }
566
+ .state { padding: var(--bk-table-state-padding, var(--bk-space-4)); }
567
+ .sentinel { block-size: var(--bk-border-width); }
568
+ .probe { position: absolute; visibility: hidden; pointer-events: none; inline-size: 0; block-size: 0; margin-inline-start: var(--bk-table-cards-below, calc(var(--bk-width-panel) * 1.5)); }
569
+ .filter-anchor { position: absolute; left: 0; top: 0; inline-size: 0; block-size: 0; }
570
+ .filter-anchor > bk-popover { position: absolute; left: 0; top: 0; }
571
+ .filter-body { display: flex; flex-direction: column; gap: var(--bk-table-filter-gap, var(--bk-space-3)); }
572
+ .filter-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--bk-space-cluster); }
573
+ `
574
+ ];
575
+ connectedCallback() {
576
+ super.connectedCallback(), ee(this, oe), this.hasUpdated && this.observe();
577
+ }
578
+ disconnectedCallback() {
579
+ super.disconnectedCallback(), this.sizes.disconnect(), this.heads.disconnect(), this.rowLinks.disconnect(), this.observedTable = null;
580
+ }
581
+ scheduleUpdate() {
582
+ let e = this.lateParts();
583
+ return e ? e.then(() => super.scheduleUpdate()) : super.scheduleUpdate();
584
+ }
585
+ lateParts() {
586
+ this.busy && B.start(), this.navigation === "cell" && z.start();
587
+ let e = L.loaded && R.loaded ? null : this.headRow, t = this.filterable || Object.keys(this.filters ?? {}).length > 0 || !!e?.querySelector(":scope > [data-filter]"), n = this.columnMenu || this.resizable || this.reorderable || !!e?.querySelector(":scope > [data-resizable]");
588
+ return D(this.selection && I.start(), t && L.start(), n && R.start());
589
+ }
590
+ willUpdate(e) {
591
+ if (super.willUpdate(e), this.virtual && this.renderRow ? this.vc.setCount(this.rows?.length ?? 0) : this.vc.count && this.vc.setCount(0), c(this)) {
592
+ this.empty = this.isEmpty;
593
+ let e = this.headRow;
594
+ this.resizable = this.columnMenu || !!e && this.appCells(e).some((e) => e.hasAttribute("data-resizable"));
595
+ }
596
+ }
597
+ get isEmpty() {
598
+ return this.virtual && this.renderRow ? !this.rows?.length : this.dataRows.length === 0;
599
+ }
600
+ updated(e) {
601
+ super.updated(e), this.virtual && this.renderRow ? this.renderWindow() : e.has("virtual") && e.get("virtual") && this.clearWindow(), this.isConnected && !this.observedTable && this.observe(), this.resolveRowLinks(), [
602
+ "sortable",
603
+ "sortKey",
604
+ "sortDir",
605
+ "selection",
606
+ "selectedKeys",
607
+ "persistKey",
608
+ "navigation",
609
+ "columnMenu",
610
+ "reorderable",
611
+ "responsive",
612
+ "busy",
613
+ "skeletonRows",
614
+ "virtual",
615
+ "rows",
616
+ "renderRow",
617
+ "filters",
618
+ "hiddenColumns"
619
+ ].some((t) => e.has(t)) ? this.syncAll() : (this.persistKey && this.syncColumns(), this.table && (this.syncMarks(), this.heads.takeRecords())), (e.has("stickyHeader") || e.has("stickyFooter") || e.has("responsive")) && this.measure();
620
+ }
621
+ resolveRowLinks() {
622
+ if (!this.table) return;
623
+ let e = [...this.table.querySelectorAll("a[data-row-link]")].filter((e) => e.closest("bk-table") === this);
624
+ m(e), this.rowLinks.takeRecords();
625
+ }
626
+ observe() {
627
+ let e = this.scroller, t = this.table;
628
+ e && t !== this.observedTable && (this.sizes.disconnect(), this.heads.disconnect(), this.rowLinks.disconnect(), this.sizes.observe(e), t && (this.sizes.observe(t), this.heads.observe(t, {
629
+ childList: !0,
630
+ subtree: !0
631
+ }), this.rowLinks.observe(t, {
632
+ childList: !0,
633
+ subtree: !0,
634
+ attributes: !0,
635
+ attributeFilter: ["href"]
636
+ })), this.observedTable = t, this.syncAll());
637
+ }
638
+ syncAll() {
639
+ if (!this.syncing && this.table) {
640
+ this.syncing = !0;
641
+ try {
642
+ this.syncHandles(), this.syncSelection(), this.syncExpand(), this.syncTree(), this.syncSort(), this.syncTools(), this.syncColumns(), this.syncCards(), this.syncMarks(), this.syncRoles(), this.syncFocus(), this.syncState();
643
+ } finally {
644
+ this.syncing = !1, this.heads.takeRecords();
645
+ }
646
+ }
647
+ }
648
+ get scroller() {
649
+ return this.renderRoot?.querySelector(".scroller") ?? null;
650
+ }
651
+ get table() {
652
+ return c(this)?.querySelector(":scope > table") ?? null;
653
+ }
654
+ get body() {
655
+ return c(this)?.querySelector(":scope > table > tbody:not([data-bk-state])") ?? null;
656
+ }
657
+ get headRow() {
658
+ return c(this)?.querySelector(":scope > table > thead > tr") ?? null;
659
+ }
660
+ get headRows() {
661
+ return [...c(this)?.querySelectorAll(":scope > table > thead > tr") ?? []];
662
+ }
663
+ get footRows() {
664
+ return [...c(this)?.querySelectorAll(":scope > table > tfoot > tr") ?? []];
665
+ }
666
+ get bodyRows() {
667
+ return [...this.querySelectorAll(":scope > table > tbody:not([data-bk-state]) > tr:not([data-bk-spacer])")];
668
+ }
669
+ get dataRows() {
670
+ return this.bodyRows.filter((e) => !e.hasAttribute("data-detail"));
671
+ }
672
+ get keyedRows() {
673
+ return this.dataRows.filter((e) => e.dataset.key !== void 0);
674
+ }
675
+ get columnRows() {
676
+ return [...c(this)?.querySelectorAll(X) ?? []].filter((e) => !e.hasAttribute("data-detail"));
677
+ }
678
+ appCells(e) {
679
+ return [...e.cells].filter((e) => !e.matches(q));
680
+ }
681
+ get number() {
682
+ return new Intl.NumberFormat(this.i18n.locale);
683
+ }
684
+ text(e) {
685
+ let t = e.querySelector(":scope > .bk-table-check");
686
+ if (t) return Z(t.textContent);
687
+ let n = e.querySelector(":scope > .bk-table-sort");
688
+ if (n) return Z(n.textContent);
689
+ let r = e.querySelector(":scope > [data-bk-note]")?.textContent ?? "", i = e.textContent ?? "";
690
+ return Z(r && i.endsWith(r) ? i.slice(0, -r.length) : i);
691
+ }
692
+ rowName(e) {
693
+ let t = this.appCells(e).find((e) => e.textContent?.trim());
694
+ return t ? this.text(t) : e.dataset.key ?? "";
695
+ }
696
+ columnKey(e) {
697
+ return e.dataset.key ?? e.dataset.sort ?? e.dataset.filter ?? String(this.appCells(e.parentElement).indexOf(e));
698
+ }
699
+ headOf(e) {
700
+ return this.headRow?.cells[e.cellIndex] ?? null;
701
+ }
702
+ leadCell(e, t, n) {
703
+ let r = e.querySelector(`:scope > [data-bk-${t}]`);
704
+ if (r) return r;
705
+ r = document.createElement(n), r.setAttribute(`data-bk-${t}`, ""), n === "th" && e.parentElement?.localName === "thead" && r.setAttribute("scope", "col");
706
+ let i = t === "select" ? e.querySelector(":scope > [data-bk-handle]") : null;
707
+ return i ? i.after(r) : e.prepend(r), r;
708
+ }
709
+ srText(e, t) {
710
+ let n = e.querySelector(":scope > .bk-table-sr");
711
+ return n || (n = document.createElement("span"), n.className = "bk-table-sr", e.append(n)), n.textContent !== t && (n.textContent = t), n;
712
+ }
713
+ get sortHeaders() {
714
+ return [...c(this)?.querySelectorAll(":scope > table > thead > tr > th[data-sort]") ?? []];
715
+ }
716
+ syncSort() {
717
+ for (let e of this.sortHeaders) {
718
+ let t = e.querySelector(":scope > button:not(.bk-table-tool)");
719
+ if (!this.sortable) {
720
+ if (!t?.classList.contains("bk-table-sort")) continue;
721
+ e.removeAttribute("aria-sort"), t.querySelector(":scope > .bk-table-sort-icon")?.remove(), t.classList.remove("bk-table-sort"), t.hasAttribute("data-bk-sort") && t.replaceWith(...t.childNodes);
722
+ continue;
723
+ }
724
+ t || (t = document.createElement("button"), t.type = "button", t.setAttribute("data-bk-sort", ""), t.append(...[...e.childNodes].filter((e) => !(e instanceof Element && e.matches(".bk-table-tool, .bk-table-resize, .bk-table-sr")))), e.prepend(t)), t.classList.add("bk-table-sort");
725
+ let n = t.querySelector(":scope > .bk-table-sort-icon");
726
+ n || (n = document.createElement("bk-icon"), n.className = "bk-table-sort-icon", t.append(n)), this.cards ? t.getAttribute("tabindex") !== "-1" && t.setAttribute("tabindex", "-1") : t.getAttribute("tabindex") === "-1" && t.removeAttribute("tabindex");
727
+ let r = e.dataset.sort === this.sortKey, i = r ? this.sortDir === "desc" ? "arrow-down" : "arrow-up" : "unfold-more";
728
+ n.getAttribute("name") !== i && n.setAttribute("name", i);
729
+ let a = r ? this.sortDir === "desc" ? "descending" : "ascending" : null;
730
+ a === null ? e.removeAttribute("aria-sort") : e.getAttribute("aria-sort") !== a && e.setAttribute("aria-sort", a);
731
+ }
732
+ }
733
+ onCardSort = (e) => {
734
+ e.stopPropagation();
735
+ let t = e.target.value, n = this.headRow && this.appCells(this.headRow).find((e) => e.dataset.sort === t);
736
+ n && t !== this.sortKey && this.requestSort(n);
737
+ };
738
+ onCardSortDir = () => {
739
+ let e = this.headRow && this.appCells(this.headRow).find((e) => e.dataset.sort === this.sortKey);
740
+ e && this.requestSort(e, this.sortDir === "desc" ? "asc" : "desc");
741
+ };
742
+ requestSort(e, t) {
743
+ let n = e.dataset.sort, r = t ?? (n === this.sortKey ? this.sortDir === "desc" ? "asc" : "desc" : e.dataset.sortDir === "desc" ? "desc" : "asc");
744
+ _(this, "sort", {
745
+ key: n,
746
+ dir: r
747
+ }, !0) && (this.sortKey = n, this.sortDir = r, d(this.i18n.t(r === "desc" ? "tableSortedDescending" : "tableSortedAscending", { column: this.text(e) || n })));
748
+ }
749
+ onRowLink = (e) => {
750
+ if (e.defaultPrevented || e.type === "auxclick" && e.button !== 1) return;
751
+ let t = e.composedPath(), n = t.find((e) => e instanceof HTMLTableRowElement);
752
+ if (!n || n.parentElement?.localName !== "tbody" || n.closest("bk-table") !== this) return;
753
+ let r = n.querySelector("a[data-row-link][href]");
754
+ if (r && r.closest("tr") === n) {
755
+ for (let e of t) {
756
+ if (e === n) break;
757
+ if (e === r || e instanceof Element && e.matches(Y)) return;
758
+ }
759
+ getSelection()?.toString() || r.dispatchEvent(new MouseEvent(e.type, {
760
+ bubbles: !0,
761
+ cancelable: !0,
762
+ composed: !0,
763
+ view: window,
764
+ detail: e.detail,
765
+ button: e.button,
766
+ buttons: e.buttons,
767
+ clientX: e.clientX,
768
+ clientY: e.clientY,
769
+ ctrlKey: e.ctrlKey,
770
+ metaKey: e.metaKey,
771
+ shiftKey: e.shiftKey,
772
+ altKey: e.altKey
773
+ }));
774
+ }
775
+ };
776
+ onRowLinkNavigate = (e) => {
777
+ let t = p(e);
778
+ t?.hasAttribute("data-row-link") && t.closest("bk-table") === this && f(t, e);
779
+ };
780
+ onClick = (e) => {
781
+ let t = e.target;
782
+ if (!t?.closest) return;
783
+ let n = (e) => !!e && e.closest("bk-table") === this, r = t.closest(".bk-table-disclosure");
784
+ if (r && n(r)) return this.onDisclosure(r);
785
+ let i = t.closest("button.bk-table-tool");
786
+ if (i && n(i)) {
787
+ let e = i.parentElement;
788
+ i.classList.contains("bk-table-filter") ? this.openFilter(e, i) : this.openColumnMenu(e, "column", i);
789
+ return;
790
+ }
791
+ if (!this.sortable) return;
792
+ let a = t.closest("button.bk-table-sort")?.parentElement;
793
+ a && this.sortHeaders.includes(a) && this.requestSort(a);
794
+ };
795
+ box(e) {
796
+ let t = e.querySelector(":scope > bk-checkbox");
797
+ return t || (t = document.createElement("bk-checkbox"), t.setAttribute("data-bk-select", ""), e.append(t)), t;
798
+ }
799
+ get allKeys() {
800
+ return this.virtual && this.rowKey && this.rows ? this.rows.map((e, t) => this.rowKey(e, t)) : this.keyedRows.map((e) => e.dataset.key);
801
+ }
802
+ syncSelection() {
803
+ let e = this.selection === "single" || this.selection === "multiple", t = this.headRows, n = this.bodyRows, r = this.footRows;
804
+ if (!e) {
805
+ for (let e of [
806
+ ...t,
807
+ ...n,
808
+ ...r
809
+ ]) e.querySelector(":scope > [data-bk-select]")?.remove(), e.hasAttribute("data-bk-selectable") && (e.removeAttribute("data-selected"), e.removeAttribute("data-bk-selectable"));
810
+ return;
811
+ }
812
+ let i = this.allKeys, a = i.filter((e) => this.keys.has(e)).length;
813
+ t.forEach((e, t) => {
814
+ let n = this.leadCell(e, "select", "th");
815
+ if (t > 0 || this.selection !== "multiple") {
816
+ n.querySelector("bk-checkbox")?.remove(), t === 0 && this.srText(n, this.i18n.t("tableSelection"));
817
+ return;
818
+ }
819
+ n.querySelector(".bk-table-sr")?.remove();
820
+ let r = this.box(n);
821
+ r.setAttribute("aria-label", this.i18n.t("tableSelectAll")), r.setAttribute("data-bk-all", ""), r.checked = i.length > 0 && a === i.length, r.indeterminate = a > 0 && a < i.length;
822
+ });
823
+ for (let e of r) this.leadCell(e, "select", "td");
824
+ for (let e of n) {
825
+ if (e.hasAttribute("data-detail")) continue;
826
+ let t = this.leadCell(e, "select", "td"), n = e.dataset.key;
827
+ if (n === void 0) continue;
828
+ let r = this.keys.has(n);
829
+ e.setAttribute("data-bk-selectable", ""), e.toggleAttribute("data-selected", r);
830
+ let i = this.box(t), a = this.i18n.t("tableSelectRow", { row: this.rowName(e) });
831
+ i.getAttribute("aria-label") !== a && i.setAttribute("aria-label", a), i.checked !== r && (i.checked = r);
832
+ }
833
+ }
834
+ choose(e) {
835
+ let t = [...e];
836
+ _(this, "select", { keys: t }, !0) ? (this.keys = e, this.syncSelection(), d(this.i18n.t("selectedCount", { count: this.number.format(this.keys.size) }))) : this.syncSelection();
837
+ }
838
+ toggleRow(e, t, n) {
839
+ let r = new Set(this.selection === "single" ? [] : this.keys), i = this.allKeys, a = n && this.anchor !== void 0 && i.includes(this.anchor) && this.selection === "multiple" ? i.slice(Math.min(i.indexOf(this.anchor), i.indexOf(e)), Math.max(i.indexOf(this.anchor), i.indexOf(e)) + 1) : [e];
840
+ for (let e of a) t ? r.add(e) : r.delete(e);
841
+ this.anchor = e, this.choose(r);
842
+ }
843
+ onChange = (e) => {
844
+ let t = e.target;
845
+ if (!t?.hasAttribute?.("data-bk-select") || t.parentElement?.closest("bk-table") !== this) return;
846
+ if (e.stopPropagation(), t.hasAttribute("data-bk-all")) {
847
+ let e = new Set(this.keys);
848
+ for (let n of this.allKeys) t.checked ? e.add(n) : e.delete(n);
849
+ this.choose(e);
850
+ return;
851
+ }
852
+ let n = t.closest("tr");
853
+ n?.dataset.key !== void 0 && this.toggleRow(n.dataset.key, t.checked, this.shift);
854
+ };
855
+ serialize(e, t, n) {
856
+ let r = this.headRow, i = /* @__PURE__ */ new Set(), a = r ? this.appCells(r) : [];
857
+ a.forEach((e, t) => e.hasAttribute("data-bk-hidden") && i.add(t));
858
+ let o = (e) => e.dataset.value ?? this.text(e), s = (e) => e.filter((e, t) => !i.has(t)).map((e) => ae(o(e), t)).join(t), c = e.map((e) => s(this.appCells(e)));
859
+ return n && a.length && c.unshift(s(a)), c.join("\r\n");
860
+ }
861
+ exportRows(t) {
862
+ if (this.virtual && this.renderRow && this.rows) {
863
+ let n = document.createElement("tbody"), i = this.rows.map((e, t) => ({
864
+ r: e,
865
+ i: t
866
+ })).filter(({ r: e, i: n }) => !t || (this.rowKey ? this.keys.has(this.rowKey(e, n)) : !1));
867
+ r(e`${i.map(({ r: e, i: t }) => this.renderRow(e, t))}`, n);
868
+ let a = [...n.rows];
869
+ return t && !this.rowKey ? a.filter((e) => e.dataset.key !== void 0 && this.keys.has(e.dataset.key)) : a;
870
+ }
871
+ let n = this.dataRows;
872
+ return t ? n.filter((e) => e.dataset.key !== void 0 && this.keys.has(e.dataset.key)) : n;
873
+ }
874
+ toCSV(e = {}) {
875
+ return this.serialize(this.exportRows(!!e.selectedOnly), e.delimiter ?? ",", e.header ?? !0);
876
+ }
877
+ async copySelection() {
878
+ let e = this.selection ? this.exportRows(!0) : [], t = "", n = "";
879
+ if (e.length) t = this.serialize(e, " ", !1), n = this.i18n.t("tableCopiedRows", { count: e.length });
880
+ else {
881
+ let e = A()?.closest?.("td, th");
882
+ if (!e || e.closest("bk-table") !== this || this.navigation !== "cell") return !1;
883
+ t = e.dataset.value ?? this.text(e), n = this.i18n.t("copied");
884
+ }
885
+ let r = await te(t);
886
+ return r && d(n), r;
887
+ }
888
+ restoreOpen(e) {
889
+ let t = this.openRows.value;
890
+ t && e.dataset.key !== void 0 && e.toggleAttribute("data-expanded", t.includes(e.dataset.key));
891
+ }
892
+ saveOpen(e) {
893
+ if (!this.persistKey || e.dataset.key === void 0) return;
894
+ let t = new Set(this.openRows.value ?? []);
895
+ e.hasAttribute("data-expanded") ? t.add(e.dataset.key) : t.delete(e.dataset.key), this.openRows.set([...t]);
896
+ }
897
+ syncExpand() {
898
+ let e = 0;
899
+ for (let t of this.querySelectorAll(":scope > table > tbody > tr[data-expandable]")) {
900
+ let n = t.nextElementSibling instanceof HTMLTableRowElement && t.nextElementSibling.hasAttribute("data-detail") ? t.nextElementSibling : null, r = this.appCells(t)[0];
901
+ if (!r || !n) continue;
902
+ this.restoreOpen(t);
903
+ let i = r.querySelector(":scope > button.bk-table-disclosure");
904
+ if (!i) {
905
+ i = document.createElement("button"), i.type = "button", i.className = "bk-table-disclosure";
906
+ let e = document.createElement("bk-icon");
907
+ e.setAttribute("name", "chevron-right"), i.append(e), r.prepend(i);
908
+ }
909
+ n.id ||= `bk-table-detail-${++e}-${Math.random().toString(36).slice(2, 7)}`;
910
+ let a = t.hasAttribute("data-expanded");
911
+ i.setAttribute("aria-controls", n.id), i.setAttribute("aria-expanded", String(a)), i.setAttribute("aria-label", this.i18n.t(a ? "tableCollapseRow" : "tableExpandRow")), n.hidden = !a;
912
+ }
913
+ }
914
+ level(e) {
915
+ return Math.max(0, Number(e.dataset.level) || 0);
916
+ }
917
+ syncTree() {
918
+ let e = this.dataRows;
919
+ if (!e.some((e) => e.hasAttribute("data-level") || e.hasAttribute("data-group"))) {
920
+ if (this.tree) for (let e of this.querySelectorAll(":scope > table > tbody > tr[data-bk-tree]")) {
921
+ for (let t of [
922
+ "data-bk-tree",
923
+ "data-bk-parent",
924
+ "aria-level",
925
+ "aria-setsize",
926
+ "aria-posinset",
927
+ "aria-expanded"
928
+ ]) e.removeAttribute(t);
929
+ e.hidden = !1, e.querySelector(":scope > * > span.bk-table-disclosure")?.remove(), e.querySelector(":scope > [data-bk-indent]")?.removeAttribute("data-bk-indent");
930
+ }
931
+ this.tree = !1;
932
+ return;
933
+ }
934
+ this.tree = !0;
935
+ let t = e.map((e) => this.level(e)), n = [], r = /* @__PURE__ */ new Map(), i = [];
936
+ e.forEach((e, a) => {
937
+ for (; n.length && t[n.at(-1)] >= t[a];) n.pop();
938
+ let o = n.at(-1) ?? -1;
939
+ i[a] = o, r.has(o) || r.set(o, []), r.get(o).push(a), n.push(a);
940
+ });
941
+ let a = 1e400;
942
+ e.forEach((n, o) => {
943
+ let s = t[o], c = o + 1 < e.length && t[o + 1] > s;
944
+ s <= a && (a = 1e400), n.hidden = s > a, n.setAttribute("data-bk-tree", ""), n.toggleAttribute("data-bk-parent", c), n.setAttribute("aria-level", String(s + 1));
945
+ let l = r.get(i[o]);
946
+ n.setAttribute("aria-setsize", String(l.length)), n.setAttribute("aria-posinset", String(l.indexOf(o) + 1)), n.style.setProperty("--_bk-table-level", String(s));
947
+ let u = this.appCells(n)[0];
948
+ u && !u.hasAttribute("data-bk-indent") && u.setAttribute("data-bk-indent", "");
949
+ let d = u?.querySelector(":scope > span.bk-table-disclosure") ?? null;
950
+ if (c) {
951
+ this.restoreOpen(n);
952
+ let e = n.hasAttribute("data-expanded");
953
+ if (n.setAttribute("aria-expanded", String(e)), !e && a === 1e400 && (a = s), !d && u) {
954
+ d = document.createElement("span"), d.className = "bk-table-disclosure", d.setAttribute("aria-hidden", "true");
955
+ let e = document.createElement("bk-icon");
956
+ e.setAttribute("name", "chevron-right"), d.append(e), u.prepend(d);
957
+ }
958
+ } else n.removeAttribute("aria-expanded"), d?.remove();
959
+ });
960
+ }
961
+ toggleOpen(e, t = !e.hasAttribute("data-expanded")) {
962
+ t !== e.hasAttribute("data-expanded") && (e.toggleAttribute("data-expanded", t), this.saveOpen(e), this.syncAll(), g(e, t));
963
+ }
964
+ onDisclosure(e) {
965
+ let t = e.closest("tr");
966
+ t && this.toggleOpen(t);
967
+ }
968
+ tool(e, t, n) {
969
+ let r = e.querySelector(`:scope > .bk-table-${t}`);
970
+ if (!n) return r?.remove(), null;
971
+ if (!r) {
972
+ r = document.createElement("button"), r.type = "button", r.className = `bk-table-tool bk-table-${t}`;
973
+ let n = document.createElement("bk-icon");
974
+ n.setAttribute("name", t === "filter" ? "filter" : "more-vert"), r.append(n);
975
+ let i = e.querySelector(t === "filter" ? ":scope > .bk-table-menu, :scope > .bk-table-resize" : ":scope > .bk-table-resize");
976
+ i ? i.before(r) : e.append(r);
977
+ }
978
+ return r;
979
+ }
980
+ syncTools() {
981
+ let e = this.headRow, t = !!e?.querySelector(":scope > th[data-filter]");
982
+ if (t !== this.filterable && (this.filterable = t, this.requestUpdate()), e) for (let t of this.appCells(e)) {
983
+ let e = this.text(t), n = this.tool(t, "filter", t.hasAttribute("data-filter"));
984
+ if (n) {
985
+ let r = !Q(this.filters?.[t.dataset.filter]);
986
+ n.toggleAttribute("data-active", r);
987
+ let i = this.i18n.t(r ? "tableFilterColumnActive" : "tableFilterColumn", { column: e });
988
+ n.getAttribute("aria-label") !== i && n.setAttribute("aria-label", i), k(n, {
989
+ haspopup: "dialog",
990
+ expanded: this.filterKey === t.dataset.filter && n === this.filterButton
991
+ });
992
+ }
993
+ let r = this.tool(t, "menu", this.columnMenu);
994
+ if (r) {
995
+ let t = this.i18n.t("tableColumnMenu", { column: e });
996
+ r.getAttribute("aria-label") !== t && r.setAttribute("aria-label", t), r.hasAttribute("aria-haspopup") || k(r, {
997
+ haspopup: "menu",
998
+ expanded: !1
999
+ });
1000
+ }
1001
+ }
1002
+ }
1003
+ filterField(e) {
1004
+ let t = [...this.children].find((t) => t.getAttribute("slot") === `filter-${e}`);
1005
+ if (!t) return null;
1006
+ let n = (e) => "value" in e && ("checkValidity" in e || e instanceof HTMLInputElement || e instanceof HTMLSelectElement);
1007
+ return n(t) ? t : [...t.querySelectorAll("*")].find(n) ?? null;
1008
+ }
1009
+ readField(e) {
1010
+ return Array.isArray(e.values) && (e.multiple || e.hasAttribute("multiple") || e.getAttribute("selection") === "multiple") ? [...e.values] : e.value;
1011
+ }
1012
+ clearField(e) {
1013
+ let t = this.filterField(e);
1014
+ t && (Array.isArray(t.values) && (t.values = []), t.value = "");
1015
+ }
1016
+ filterText(e, t) {
1017
+ let n = this.filterField(e), r = (e) => {
1018
+ let t = String(e);
1019
+ return Z(n?.querySelector(`[value="${CSS.escape(t)}"]`)?.textContent) || t;
1020
+ };
1021
+ return Array.isArray(t) ? t.map(r).join(", ") : r(t);
1022
+ }
1023
+ get filterItems() {
1024
+ let e = this.headRow;
1025
+ return e ? this.appCells(e).filter((e) => e.dataset.filter && !Q(this.filters?.[e.dataset.filter])).map((e) => ({
1026
+ key: e.dataset.filter,
1027
+ label: `${this.text(e)}: ${this.filterText(e.dataset.filter, this.filters[e.dataset.filter])}`
1028
+ })) : [];
1029
+ }
1030
+ applyFilters(e) {
1031
+ for (let [t, n] of Object.entries(e)) Q(n) && delete e[t];
1032
+ return _(this, "filter", { filters: e }, !0) ? (this.filters = e, d(this.i18n.t("filtersActive", { count: Object.keys(e).length })), !0) : !1;
1033
+ }
1034
+ get filterPopover() {
1035
+ return this.renderRoot.querySelector(".filter-popover");
1036
+ }
1037
+ async openFilter(e, t) {
1038
+ let n = e.dataset.filter, r = this.filterPopover;
1039
+ if (r?.open && this.filterKey === n) {
1040
+ r.hide();
1041
+ return;
1042
+ }
1043
+ this.filterKey = n, this.filterButton = t, await this.updateComplete;
1044
+ let i = this.renderRoot.querySelector(".filter-anchor"), a = this.filterPopover;
1045
+ if (!i || !a) return;
1046
+ i.style.left = i.style.top = "0px";
1047
+ let o = i.getBoundingClientRect(), s = e.getBoundingClientRect(), c = this.matches(":dir(rtl)");
1048
+ i.style.left = `${(c ? s.right : s.left) - o.left}px`, i.style.top = `${s.bottom - o.top}px`, a.show(), k(t, {
1049
+ haspopup: "dialog",
1050
+ expanded: !0
1051
+ });
1052
+ }
1053
+ onFilterClose = () => {
1054
+ let e = this.filterButton;
1055
+ e && k(e, {
1056
+ haspopup: "dialog",
1057
+ expanded: !1
1058
+ });
1059
+ let t = A(), n = [...this.children].find((e) => e.getAttribute("slot") === `filter-${this.filterKey}`);
1060
+ e?.isConnected && (!t || t === document.body || j(n, t) || j(this.renderRoot, t)) && e.focus(), this.filterKey = void 0;
1061
+ };
1062
+ onFilterApply = (e) => {
1063
+ let t = this.filterKey;
1064
+ if (!t) return;
1065
+ let n = this.filterField(t);
1066
+ e && this.clearField(t);
1067
+ let r = e || !n ? void 0 : this.readField(n);
1068
+ this.applyFilters({
1069
+ ...this.filters,
1070
+ [t]: r
1071
+ }) && this.filterPopover?.hide();
1072
+ };
1073
+ onFilterRemove = (e) => {
1074
+ e.stopPropagation();
1075
+ let t = { ...this.filters };
1076
+ delete t[e.detail.key], this.applyFilters(t) ? this.clearField(e.detail.key) : e.preventDefault();
1077
+ };
1078
+ onFilterClear = (e) => {
1079
+ e.stopPropagation();
1080
+ let t = Object.keys(this.filters);
1081
+ this.applyFilters({}) && (t.forEach((e) => this.clearField(e)), this.updateComplete.then(() => c(this)?.querySelector(":scope > table > thead > tr > th > .bk-table-filter")?.focus()));
1082
+ };
1083
+ get hiddenSet() {
1084
+ return new Set(this.columnState.value?.hidden ?? this.hiddenColumns ?? []);
1085
+ }
1086
+ get pinned() {
1087
+ let e = this.headRow, t = {};
1088
+ if (e) for (let n of this.appCells(e)) {
1089
+ let e = n.getAttribute("data-pin");
1090
+ (e === "start" || e === "end") && (t[this.columnKey(n)] = e);
1091
+ }
1092
+ return t;
1093
+ }
1094
+ changeColumns(e, t, n) {
1095
+ let r = this.headRow;
1096
+ if (!r) return !1;
1097
+ let i = this.pinned;
1098
+ for (let [e, n] of Object.entries(t)) n === "none" ? delete i[e] : i[e] = n;
1099
+ if (!_(this, "columns", {
1100
+ hidden: e,
1101
+ pinned: i,
1102
+ widths: this.columnWidths()
1103
+ }, !0)) return !1;
1104
+ if (this.hiddenColumns = e, this.persistKey) {
1105
+ let n = this.columnState.value ?? {};
1106
+ this.columnState.set({
1107
+ ...n,
1108
+ hidden: e,
1109
+ pinned: {
1110
+ ...n.pinned,
1111
+ ...t
1112
+ }
1113
+ });
1114
+ }
1115
+ for (let e of this.appCells(r)) {
1116
+ let n = t[this.columnKey(e)];
1117
+ n && this.setPin(e, n);
1118
+ }
1119
+ return this.syncColumns(), d(n), !0;
1120
+ }
1121
+ setPin(e, t) {
1122
+ e.hasAttribute("data-bk-pin-default") || e.setAttribute("data-bk-pin-default", e.getAttribute("data-pin") ?? "none"), t === "none" ? e.removeAttribute("data-pin") : e.setAttribute("data-pin", t);
1123
+ }
1124
+ toggleColumn(e, t) {
1125
+ let n = this.columnKey(e), r = new Set(this.hiddenSet);
1126
+ return t ? r.delete(n) : r.add(n), this.changeColumns([...r], {}, this.i18n.t(t ? "tableColumnShown" : "tableColumnHidden", { column: this.text(e) }));
1127
+ }
1128
+ resetColumns() {
1129
+ let e = this.headRow;
1130
+ if (!e) return;
1131
+ let t = {};
1132
+ for (let n of this.appCells(e)) {
1133
+ let e = n.getAttribute("data-bk-pin-default");
1134
+ e && (t[this.columnKey(n)] = e);
1135
+ }
1136
+ if (this.changeColumns([], t, this.i18n.t("tableColumnsReset"))) {
1137
+ this.persistKey && this.columnState.set(void 0);
1138
+ for (let t of this.appCells(e)) t.removeAttribute("data-bk-pin-default");
1139
+ }
1140
+ }
1141
+ moveColumn(e, t) {
1142
+ let n = this.headRow;
1143
+ if (!n) return;
1144
+ let r = this.appCells(n), i = r.indexOf(e), a = i + t;
1145
+ if (!this.canMove(r, i, a)) return;
1146
+ let o = r.map((e) => this.columnKey(e)), [s] = o.splice(i, 1);
1147
+ o.splice(a, 0, s), _(this, "reorder", {
1148
+ type: "column",
1149
+ key: s,
1150
+ from: i,
1151
+ to: a,
1152
+ order: o
1153
+ }, !0) && (this.persistKey && this.columnState.set({
1154
+ ...this.columnState.value,
1155
+ order: o
1156
+ }), d(this.i18n.t("sortableMoved", {
1157
+ item: this.text(e),
1158
+ position: a + 1,
1159
+ total: r.length
1160
+ })));
1161
+ }
1162
+ canMove(e, t, n) {
1163
+ if (n < 0 || n >= e.length || n === t) return !1;
1164
+ let r = (e) => e.getAttribute("data-pin") ?? "";
1165
+ return r(e[n]) === r(e[t]);
1166
+ }
1167
+ maxWidth() {
1168
+ return Math.max(96, this.clientWidth);
1169
+ }
1170
+ clampWidth(e, t = this.maxWidth()) {
1171
+ return Math.round(Math.min(t, Math.max(H, e)));
1172
+ }
1173
+ setValue(e, t, n = this.maxWidth()) {
1174
+ let r = e.querySelector(":scope > .bk-table-resize");
1175
+ if (!r) return;
1176
+ let i = Math.round(t);
1177
+ r.setAttribute("aria-valuenow", String(i)), r.setAttribute("aria-valuemin", String(H)), r.setAttribute("aria-valuemax", String(Math.max(i, Math.round(n)))), r.setAttribute("aria-valuetext", this.i18n.t("tableColumnWidth", { width: this.number.format(i) }));
1178
+ }
1179
+ setWidth(e, t, n) {
1180
+ e.style.inlineSize = e.style.minInlineSize = `${t}px`, this.setValue(e, t, n);
1181
+ }
1182
+ columnWidths() {
1183
+ let e = {}, t = this.headRow;
1184
+ if (t) for (let n of this.appCells(t)) {
1185
+ let t = n.style.inlineSize.endsWith("px") ? parseFloat(n.style.inlineSize) : NaN;
1186
+ Number.isFinite(t) && (e[this.columnKey(n)] = Math.round(t));
1187
+ }
1188
+ return e;
1189
+ }
1190
+ emitColumns() {
1191
+ _(this, "columns", {
1192
+ hidden: [...this.hiddenSet],
1193
+ pinned: this.pinned,
1194
+ widths: this.columnWidths()
1195
+ });
1196
+ }
1197
+ saveWidth(e, t) {
1198
+ this.emitColumns(), this.persistKey && this.widths.set({
1199
+ ...this.widths.value,
1200
+ [this.columnKey(e)]: Math.round(t)
1201
+ });
1202
+ }
1203
+ resizeTo(e, t) {
1204
+ let n = this.clampWidth(t);
1205
+ this.setWidth(e, n), this.saveWidth(e, n), this.syncPins(e.parentElement);
1206
+ }
1207
+ resetWidth(e) {
1208
+ if (e.style.removeProperty("inline-size"), e.style.removeProperty("min-inline-size"), this.persistKey && this.widths.value && this.columnKey(e) in this.widths.value) {
1209
+ let { [this.columnKey(e)]: t, ...n } = this.widths.value;
1210
+ this.widths.set(n);
1211
+ }
1212
+ this.setValue(e, e.offsetWidth), this.syncPins(e.parentElement), this.emitColumns();
1213
+ }
1214
+ syncColumns() {
1215
+ let e = this.headRow;
1216
+ if (!e) return;
1217
+ let t = this.widths.value, n = this.columnState.value?.pinned, r = this.hiddenSet, i = this.columnMenu, a = /* @__PURE__ */ new Set();
1218
+ for (let o of this.appCells(e)) {
1219
+ let e = this.columnKey(o);
1220
+ n?.[e] && (o.hasAttribute("data-bk-pin-default") ? (o.getAttribute("data-pin") ?? "none") !== n[e] && this.setPin(o, n[e]) : this.setPin(o, n[e])), r.has(e) && a.add(o.cellIndex);
1221
+ let s = o.querySelector(":scope > .bk-table-resize");
1222
+ if (!o.hasAttribute("data-resizable")) {
1223
+ s?.remove();
1224
+ continue;
1225
+ }
1226
+ i = !0;
1227
+ let c = t?.[e];
1228
+ s || (s = document.createElement("span"), s.className = "bk-table-resize", s.setAttribute("role", "separator"), s.setAttribute("aria-orientation", "vertical"), s.tabIndex = 0, s.innerHTML = "<span class=\"bk-grip\" aria-hidden=\"true\"></span>", s.addEventListener("pointerdown", (e) => this.onHandleDown(e, o, s)), o.append(s), c || this.setValue(o, o.offsetWidth)), c && o.style.inlineSize !== `${c}px` && this.setWidth(o, c), o.id ||= `bk-table-col-${Math.random().toString(36).slice(2, 9)}`, s.setAttribute("aria-controls", o.id);
1229
+ let l = this.i18n.t("tableResizeColumn", { column: this.text(o) });
1230
+ s.getAttribute("aria-label") !== l && s.setAttribute("aria-label", l);
1231
+ }
1232
+ for (let e of this.columnRows) for (let t of e.cells) {
1233
+ let e = a.has(t.cellIndex) && !t.matches(q);
1234
+ t.hasAttribute("data-bk-hidden") !== e && t.toggleAttribute("data-bk-hidden", e);
1235
+ }
1236
+ i !== this.resizable && (this.resizable = i), this.syncPins(e);
1237
+ }
1238
+ syncPins(e) {
1239
+ let t = [...e.cells], n = (e) => !e.hasAttribute("data-bk-hidden"), r = t.filter((e) => e.getAttribute("data-pin") === "start" && n(e)), i = t.filter((e) => e.getAttribute("data-pin") === "end" && n(e)).reverse(), a = this.columnRows;
1240
+ for (let t of a) if (t !== e) for (let n of t.cells) {
1241
+ let t = e.cells[n.cellIndex]?.getAttribute("data-pin");
1242
+ n.hasAttribute("data-pin") && t !== n.getAttribute("data-pin") && (n.removeAttribute("data-pin"), n.removeAttribute("data-pin-edge"), n.style.removeProperty("--_bk-table-pin"));
1243
+ }
1244
+ for (let e of t) !e.hasAttribute("data-pin") && e.hasAttribute("data-pin-edge") && (e.removeAttribute("data-pin-edge"), e.style.removeProperty("--_bk-table-pin"));
1245
+ for (let [e, t] of [[r, "start"], [i, "end"]]) {
1246
+ let n = 0;
1247
+ e.forEach((r, i) => {
1248
+ let o = r.cellIndex;
1249
+ for (let r of a) {
1250
+ if (r.cells.length <= o) continue;
1251
+ let a = r.cells[o];
1252
+ a.getAttribute("data-pin") !== t && a.setAttribute("data-pin", t), a.toggleAttribute("data-pin-edge", i === e.length - 1), a.style.setProperty("--_bk-table-pin", `${n}px`);
1253
+ }
1254
+ n += r.offsetWidth;
1255
+ });
1256
+ }
1257
+ }
1258
+ onHandleDown(e, t, n) {
1259
+ if (e.button !== 0) return;
1260
+ e.preventDefault(), n.focus(), n.setPointerCapture(e.pointerId);
1261
+ let r = t.offsetWidth, i = e.clientX, a = this.maxWidth(), o = this.matches(":dir(rtl)") ? -1 : 1, s = !1, c = (e) => {
1262
+ !s && Math.abs(e.clientX - i) < G || (s || n.setAttribute("data-dragging", ""), s = !0, this.setWidth(t, this.clampWidth(r + o * (e.clientX - i), a), a), this.syncPins(t.parentElement));
1263
+ }, l = (e) => {
1264
+ n.removeEventListener("pointermove", c), n.removeEventListener("pointerup", l), n.removeEventListener("pointercancel", l), n.removeAttribute("data-dragging"), s ? this.saveWidth(t, t.offsetWidth) : e.type === "pointerup" && this.openColumnMenu(t, "resize", null, e.clientX, e.clientY);
1265
+ };
1266
+ n.addEventListener("pointermove", c), n.addEventListener("pointerup", l), n.addEventListener("pointercancel", l);
1267
+ }
1268
+ onHandleKey(e, t) {
1269
+ let n = t.parentElement;
1270
+ if (!n) return;
1271
+ if (e.key === "Home") {
1272
+ e.preventDefault(), this.resetWidth(n);
1273
+ return;
1274
+ }
1275
+ if (!["ArrowLeft", "ArrowRight"].includes(e.key)) return;
1276
+ e.preventDefault(), e.stopPropagation();
1277
+ let r = e.key === "ArrowRight" !== this.matches(":dir(rtl)"), i = e.shiftKey ? W : U;
1278
+ this.resizeTo(n, n.offsetWidth + (r ? i : -i));
1279
+ }
1280
+ get columnMenuEl() {
1281
+ return this.renderRoot.querySelector(".column-menu");
1282
+ }
1283
+ async openColumnMenu(e, t, n, r, i) {
1284
+ if (this.menuColumn = e, this.menuKind = t, this.requestUpdate(), await this.updateComplete, n) {
1285
+ let e = n.getBoundingClientRect();
1286
+ r = this.matches(":dir(rtl)") ? e.right : e.left, i = e.bottom, k(n, {
1287
+ haspopup: "menu",
1288
+ expanded: !0
1289
+ });
1290
+ }
1291
+ setTimeout(() => this.columnMenuEl?.showAt(r ?? 0, i ?? 0, n ?? e));
1292
+ }
1293
+ onColumnMenuClose = () => {
1294
+ let e = this.menuColumn?.querySelector(":scope > .bk-table-menu");
1295
+ e && k(e, {
1296
+ haspopup: "menu",
1297
+ expanded: !1
1298
+ });
1299
+ };
1300
+ onColumnMenu(e) {
1301
+ e.stopPropagation();
1302
+ let t = this.menuColumn;
1303
+ if (!t?.isConnected) return;
1304
+ let n = e.detail.value, r = this.headRow, i = this.matches(":dir(rtl)");
1305
+ if (n === "reset") return this.resetWidth(t);
1306
+ if (n === "wider" || n === "narrower") e.preventDefault(), this.resizeTo(t, t.offsetWidth + (n === "wider" ? U : -16));
1307
+ else {
1308
+ if (n === "sort-asc" || n === "sort-desc") return this.requestSort(t, n === "sort-asc" ? "asc" : "desc");
1309
+ if (n === "pin-start" || n === "pin-end" || n === "unpin") {
1310
+ let e = n === "unpin" ? "none" : n === "pin-start" ? "start" : "end";
1311
+ this.changeColumns([...this.hiddenSet], { [this.columnKey(t)]: e }, this.i18n.t(e === "none" ? "tableColumnUnpinned" : "tableColumnPinned", { column: this.text(t) }));
1312
+ } else {
1313
+ if (n === "move-left" || n === "move-right") return this.moveColumn(t, n === "move-right" === i ? -1 : 1);
1314
+ if (n === "hide") return void this.toggleColumn(t, !1);
1315
+ if (n === "reset-columns") return this.resetColumns();
1316
+ if (n.startsWith("col:")) {
1317
+ e.preventDefault();
1318
+ let t = this.appCells(r).find((e) => this.columnKey(e) === n.slice(4));
1319
+ t && this.toggleColumn(t, t.hasAttribute("data-bk-hidden")), this.requestUpdate();
1320
+ }
1321
+ }
1322
+ }
1323
+ }
1324
+ columnItems(t) {
1325
+ let r = this.i18n.t.bind(this.i18n), i = this.headRow, a = this.appCells(i), o = a.indexOf(t), s = a.filter((e) => !e.hasAttribute("data-bk-hidden")), c = a.filter((e) => e.hasAttribute("data-hideable")), l = t.getAttribute("data-pin"), u = this.matches(":dir(rtl)"), d = [];
1326
+ return this.sortable && t.dataset.sort && d.push([e`<bk-menu-item value="sort-asc" icon="arrow-up">${r("tableSortAscending")}</bk-menu-item>`, e`<bk-menu-item value="sort-desc" icon="arrow-down">${r("tableSortDescending")}</bk-menu-item>`]), d.push([
1327
+ ...l === "start" ? [] : [e`<bk-menu-item value="pin-start">${r("tablePinStart")}</bk-menu-item>`],
1328
+ ...l === "end" ? [] : [e`<bk-menu-item value="pin-end">${r("tablePinEnd")}</bk-menu-item>`],
1329
+ ...l ? [e`<bk-menu-item value="unpin">${r("tableUnpin")}</bk-menu-item>`] : []
1330
+ ]), t.hasAttribute("data-reorderable") && d.push([e`<bk-menu-item value="move-left" icon="arrow-back" ?disabled=${!this.canMove(a, o, o + (u ? 1 : -1))}>${r("tableMoveLeft")}</bk-menu-item>`, e`<bk-menu-item value="move-right" icon="arrow-forward" ?disabled=${!this.canMove(a, o, o + (u ? -1 : 1))}>${r("tableMoveRight")}</bk-menu-item>`]), t.hasAttribute("data-hideable") && d.push([e`<bk-menu-item value="hide" icon="visibility-off" ?disabled=${s.length <= 1}>${r("tableHideColumn")}</bk-menu-item>`]), c.length && d.push([
1331
+ e`<bk-menu-label>${r("tableColumns")}</bk-menu-label>`,
1332
+ ...c.map((t) => {
1333
+ let n = !t.hasAttribute("data-bk-hidden");
1334
+ return e`<bk-menu-item type="checkbox" value=${`col:${this.columnKey(t)}`} ?checked=${n} ?disabled=${n && s.length <= 1}>${this.text(t)}</bk-menu-item>`;
1335
+ }),
1336
+ e`<bk-menu-item value="reset-columns" icon="refresh">${r("tableResetColumns")}</bk-menu-item>`
1337
+ ]), t.hasAttribute("data-resizable") && d.push(this.resizeItems()), d.filter((e) => e.length).map((t, r) => e`${r ? e`<bk-menu-divider></bk-menu-divider>` : n}${t}`);
1338
+ }
1339
+ resizeItems() {
1340
+ return [
1341
+ e`<bk-menu-item value="wider" icon="add">${this.i18n.t("tableColumnWider")}</bk-menu-item>`,
1342
+ e`<bk-menu-item value="narrower" icon="remove">${this.i18n.t("tableColumnNarrower")}</bk-menu-item>`,
1343
+ e`<bk-menu-item value="reset" icon="refresh">${this.i18n.t("tableColumnReset")}</bk-menu-item>`
1344
+ ];
1345
+ }
1346
+ syncHandles() {
1347
+ let e = [
1348
+ ...this.headRows,
1349
+ ...this.bodyRows,
1350
+ ...this.footRows
1351
+ ];
1352
+ if (!this.reorderable) {
1353
+ for (let t of e) t.querySelector(":scope > [data-bk-handle]")?.remove();
1354
+ return;
1355
+ }
1356
+ this.headRows.forEach((e, t) => {
1357
+ let n = this.leadCell(e, "handle", "th");
1358
+ if (t === 0) {
1359
+ let e = this.srText(n, this.i18n.t("tableOrder"));
1360
+ e.id ||= `bk-table-order-${Math.random().toString(36).slice(2, 9)}`;
1361
+ }
1362
+ });
1363
+ for (let e of this.footRows) this.leadCell(e, "handle", "td");
1364
+ let t = this.instructions();
1365
+ for (let e of this.bodyRows) {
1366
+ if (e.hasAttribute("data-detail")) continue;
1367
+ let n = this.leadCell(e, "handle", "td"), r = n.querySelector(":scope > .bk-table-handle");
1368
+ if (!r) {
1369
+ r = document.createElement("button"), r.type = "button", r.className = "bk-table-handle";
1370
+ let e = document.createElement("bk-icon");
1371
+ e.setAttribute("name", "drag-indicator"), r.append(e), n.append(r);
1372
+ }
1373
+ let i = this.i18n.t("sortableHandle", { item: this.rowName(e) });
1374
+ r.getAttribute("aria-label") !== i && r.setAttribute("aria-label", i), t && r.getAttribute("aria-describedby") !== t.id && r.setAttribute("aria-describedby", t.id);
1375
+ }
1376
+ }
1377
+ instructions() {
1378
+ let e = this.headRow?.querySelector(":scope > [data-bk-handle]");
1379
+ if (!e) return null;
1380
+ let t = e.querySelector(":scope > .bk-table-help");
1381
+ t || (t = document.createElement("span"), t.className = "bk-table-sr bk-table-help", t.hidden = !0, t.id = `bk-table-help-${Math.random().toString(36).slice(2, 9)}`, e.append(t));
1382
+ let n = this.i18n.t("sortableInstructions");
1383
+ return t.textContent !== n && (t.textContent = n), t;
1384
+ }
1385
+ get movableRows() {
1386
+ return this.dataRows.filter((e) => !e.hidden);
1387
+ }
1388
+ startLift(e, t) {
1389
+ let n = this.movableRows, r = n.indexOf(e);
1390
+ return r < 0 ? null : (this.lift = {
1391
+ row: e,
1392
+ rows: n,
1393
+ from: r,
1394
+ to: r,
1395
+ mode: t
1396
+ }, e.setAttribute("data-bk-lifted", ""), t === "keyboard" && d(this.i18n.t("sortablePickedUp", {
1397
+ item: this.rowName(e),
1398
+ position: r + 1,
1399
+ total: n.length
1400
+ })), this.lift);
1401
+ }
1402
+ moveLift(e) {
1403
+ let t = this.lift;
1404
+ if (t) {
1405
+ t.to = Math.max(0, Math.min(t.rows.length - 1, e));
1406
+ for (let e of t.rows) e.removeAttribute("data-bk-drop");
1407
+ t.to !== t.from && t.rows[t.to].setAttribute("data-bk-drop", t.to < t.from ? "before" : "after"), t.mode === "keyboard" && d(this.i18n.t("sortableMoved", {
1408
+ item: this.rowName(t.row),
1409
+ position: t.to + 1,
1410
+ total: t.rows.length
1411
+ }));
1412
+ }
1413
+ }
1414
+ endLift(e) {
1415
+ let t = this.lift;
1416
+ if (!t) return;
1417
+ this.lift = null, t.row.removeAttribute("data-bk-lifted");
1418
+ for (let e of t.rows) e.removeAttribute("data-bk-drop");
1419
+ let n = this.rowName(t.row);
1420
+ !e || t.to === t.from ? t.mode === "keyboard" && d(this.i18n.t("sortableCancelled", {
1421
+ item: n,
1422
+ position: t.from + 1,
1423
+ total: t.rows.length
1424
+ })) : this.requestMove(t.row, t.from, t.to, t.rows.length);
1425
+ }
1426
+ requestMove(e, t, n, r) {
1427
+ let i = e.dataset.key;
1428
+ _(this, "reorder", {
1429
+ type: "row",
1430
+ key: i,
1431
+ from: t,
1432
+ to: n
1433
+ }, !0) && (d(this.i18n.t("sortableDropped", {
1434
+ item: this.rowName(e),
1435
+ position: n + 1,
1436
+ total: r
1437
+ })), i !== void 0 && requestAnimationFrame(() => {
1438
+ let e = this.keyedRows.find((e) => e.dataset.key === i)?.querySelector(":scope > [data-bk-handle] > .bk-table-handle");
1439
+ e && !e.matches(":focus") && e.focus();
1440
+ }));
1441
+ }
1442
+ onLiftKey(e, t) {
1443
+ let n = this.lift;
1444
+ if (!n) return e.key !== " " && e.key !== "Enter" ? !1 : (e.preventDefault(), this.startLift(t, "keyboard"), !0);
1445
+ let r = {
1446
+ ArrowUp: n.to - 1,
1447
+ ArrowDown: n.to + 1,
1448
+ Home: 0,
1449
+ End: n.rows.length - 1
1450
+ };
1451
+ return e.key in r ? (e.preventDefault(), this.moveLift(r[e.key])) : e.key === " " || e.key === "Enter" ? (e.preventDefault(), this.endLift(!0)) : e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), this.endLift(!1)) : e.key !== "Tab" && e.key !== "Shift" && e.preventDefault(), !0;
1452
+ }
1453
+ onPointerDown = (e) => {
1454
+ let t = e.target?.closest?.(".bk-table-handle");
1455
+ if (!t || t.closest("bk-table") !== this || e.button !== 0 || this.lift) return;
1456
+ let n = t.closest("tr");
1457
+ e.preventDefault(), t.focus(), t.setPointerCapture(e.pointerId);
1458
+ let r = e.clientY, i = !1, a = [], o = (e) => {
1459
+ if (!i) {
1460
+ if (Math.abs(e.clientY - r) < G) return;
1461
+ let t = this.startLift(n, "pointer");
1462
+ if (!t) return;
1463
+ i = !0, a = t.rows.map((e) => {
1464
+ let t = e.getBoundingClientRect();
1465
+ return t.top + t.height / 2;
1466
+ });
1467
+ }
1468
+ let t = this.lift, o = a.findIndex((t) => e.clientY < t);
1469
+ o < 0 ? o = a.length - 1 : o > t.from && --o, this.moveLift(o);
1470
+ }, s = (e) => {
1471
+ t.removeEventListener("pointermove", o), t.removeEventListener("pointerup", s), t.removeEventListener("pointercancel", s), i ? this.endLift(e.type === "pointerup") : e.type === "pointerup" && this.openRowMenu(n, t);
1472
+ };
1473
+ t.addEventListener("pointermove", o), t.addEventListener("pointerup", s), t.addEventListener("pointercancel", s);
1474
+ };
1475
+ openRowMenu(e, t) {
1476
+ this.handleRow = e, this.requestUpdate(), T(this, t);
1477
+ }
1478
+ get rowActions() {
1479
+ let e = this.handleRow;
1480
+ if (!e?.isConnected) return [];
1481
+ let t = this.movableRows, n = t.indexOf(e), r = (r) => () => this.requestMove(e, n, r, t.length), i = this.i18n.t.bind(this.i18n);
1482
+ return [
1483
+ {
1484
+ key: "up",
1485
+ label: i("sortableMoveUp"),
1486
+ disabled: n <= 0,
1487
+ run: r(n - 1)
1488
+ },
1489
+ {
1490
+ key: "down",
1491
+ label: i("sortableMoveDown"),
1492
+ disabled: n >= t.length - 1,
1493
+ run: r(n + 1)
1494
+ },
1495
+ {
1496
+ key: "top",
1497
+ label: i("sortableMoveTop"),
1498
+ disabled: n <= 0,
1499
+ divider: !0,
1500
+ run: r(0)
1501
+ },
1502
+ {
1503
+ key: "bottom",
1504
+ label: i("sortableMoveBottom"),
1505
+ disabled: n >= t.length - 1,
1506
+ run: r(t.length - 1)
1507
+ }
1508
+ ];
1509
+ }
1510
+ get cards() {
1511
+ return this.internals.states.has("cards");
1512
+ }
1513
+ setRole(e, t) {
1514
+ let n = e.hasAttribute("data-bk-role");
1515
+ t ? (n || !e.hasAttribute("role")) && (e.getAttribute("role") !== t && e.setAttribute("role", t), n || e.setAttribute("data-bk-role", "")) : n && (e.removeAttribute("role"), e.removeAttribute("data-bk-role"));
1516
+ }
1517
+ syncRoles() {
1518
+ let e = this.table, t = this.navigation === "cell", n = this.cards;
1519
+ this.setRole(e, this.tree ? "treegrid" : t ? "grid" : n ? "table" : null);
1520
+ for (let t of e.querySelectorAll(":scope > :is(thead, tbody, tfoot)")) this.setRole(t, n ? "rowgroup" : null);
1521
+ for (let e of this.querySelectorAll(X)) {
1522
+ this.setRole(e, n ? "row" : null);
1523
+ let r = e.parentElement?.localName === "thead";
1524
+ for (let i of e.cells) i.localName === "td" ? this.setRole(i, t || this.tree ? "gridcell" : n ? "cell" : null) : this.setRole(i, n ? r || i.getAttribute("scope") === "col" ? "columnheader" : "rowheader" : null);
1525
+ }
1526
+ if (this.virtual && this.renderRow) {
1527
+ let t = this.headRows.length;
1528
+ e.setAttribute("aria-rowcount", String(t + (this.rows?.length ?? 0) + this.footRows.length)), this.headRows.forEach((e, t) => e.setAttribute("aria-rowindex", String(t + 1))), this.footRows.forEach((e, n) => e.setAttribute("aria-rowindex", String(t + (this.rows?.length ?? 0) + n + 1)));
1529
+ } else e.hasAttribute("aria-rowcount") && e.removeAttribute("aria-rowcount");
1530
+ }
1531
+ setTab(e, t) {
1532
+ if (t === null) {
1533
+ if (!e.hasAttribute("data-bk-tabindex")) return;
1534
+ let t = e.getAttribute("data-bk-tabindex");
1535
+ t ? e.setAttribute("tabindex", t) : e.removeAttribute("tabindex"), e.removeAttribute("data-bk-tabindex");
1536
+ } else e.hasAttribute("data-bk-tabindex") || e.setAttribute("data-bk-tabindex", e.getAttribute("tabindex") ?? ""), e.getAttribute("tabindex") !== String(t) && e.setAttribute("tabindex", String(t));
1537
+ }
1538
+ widgets(e) {
1539
+ return [...e.querySelectorAll(J)].filter((t) => !t.closest(".bk-table-editor") && !t.closest(".bk-table-sr") && t.closest("td, th") === e);
1540
+ }
1541
+ target(e) {
1542
+ let t = this.widgets(e);
1543
+ return t.length === 1 ? t[0] : e;
1544
+ }
1545
+ get gridRows() {
1546
+ return [
1547
+ ...this.headRows,
1548
+ ...this.bodyRows.filter((e) => !e.hidden),
1549
+ ...this.footRows
1550
+ ];
1551
+ }
1552
+ visibleCells(e) {
1553
+ return [...e.cells].filter((e) => !e.hasAttribute("data-bk-hidden"));
1554
+ }
1555
+ syncFocus() {
1556
+ let e = this.table, t = this.navigation === "cell", n = [...e.querySelectorAll("[data-bk-tabindex]")].filter((e) => e.closest("bk-table") === this);
1557
+ if (!t && !this.tree) {
1558
+ for (let e of n) this.setTab(e, null);
1559
+ this.stop = null;
1560
+ return;
1561
+ }
1562
+ let r = this.gridRows, i = [];
1563
+ if (this.tree && i.push(...this.dataRows), t) for (let e of r) for (let t of e.cells) i.push(t, ...this.widgets(t));
1564
+ let a = new Set(i);
1565
+ for (let e of n) a.has(e) || this.setTab(e, null);
1566
+ if (!((e) => !!e && e.isConnected && a.has(e) && !e.closest("[hidden], [data-bk-hidden]"))(this.stop)) {
1567
+ let e = this.tree ? this.dataRows.find((e) => !e.hidden) : r[0] && this.visibleCells(r[0])[0];
1568
+ this.stop = e ? this.tree ? e : this.target(e) : null;
1569
+ }
1570
+ for (let e of i) this.setTab(e, e === this.stop ? 0 : -1);
1571
+ }
1572
+ focusStop(e) {
1573
+ e && (this.stop && this.stop !== e && this.stop.isConnected && this.setTab(this.stop, -1), this.stop = e, this.setTab(e, 0), e.focus());
1574
+ }
1575
+ onFocusIn = (e) => {
1576
+ let t = e.target;
1577
+ if (t.closest?.("bk-table") !== this || t.closest(".bk-table-editor") || this.navigation !== "cell" && !this.tree) return;
1578
+ let n = t.closest("td, th"), r = this.navigation === "cell" && n ? t : this.tree ? t.closest("tr") : null;
1579
+ r && r !== this.stop && r.hasAttribute("data-bk-tabindex") && (this.stop?.isConnected && this.setTab(this.stop, -1), this.stop = r, this.setTab(this.stop, 0));
1580
+ };
1581
+ onFocusOut = (e) => {
1582
+ this.shiftDown = !1;
1583
+ let t = e.target;
1584
+ this.lift?.mode === "keyboard" && t.classList?.contains("bk-table-handle") && this.endLift(!1), this.editing && t.closest?.(".bk-table-editor") && !this.editing.field.contains(e.relatedTarget) && setTimeout(() => this.editing && !this.editing.field.matches(":focus-within") && this.commitEdit(!1, !1));
1585
+ };
1586
+ async rowAt(e) {
1587
+ let t = this.headRows;
1588
+ if (e < t.length) return t[e] ?? null;
1589
+ if (this.virtual && this.renderRow) {
1590
+ let n = this.rows?.length ?? 0;
1591
+ if (e < t.length + n) {
1592
+ let n = e - t.length;
1593
+ return this.vc.reveal(n), this.requestUpdate(), await this.updateComplete, c(this)?.querySelector(`:scope > table > tbody > tr[data-bk-index="${n}"]`) ?? null;
1594
+ }
1595
+ return this.footRows[e - t.length - n] ?? null;
1596
+ }
1597
+ return this.gridRows[e] ?? null;
1598
+ }
1599
+ rowIndex(e) {
1600
+ let t = this.headRows;
1601
+ if (this.virtual && this.renderRow) {
1602
+ let n = this.rows?.length ?? 0, r = t.length + n + this.footRows.length;
1603
+ return t.includes(e) ? [t.indexOf(e), r] : e.dataset.bkIndex === void 0 ? [t.length + n + this.footRows.indexOf(e), r] : [t.length + Number(e.dataset.bkIndex), r];
1604
+ }
1605
+ let n = this.gridRows;
1606
+ return [n.indexOf(e), n.length];
1607
+ }
1608
+ pageRows() {
1609
+ let e = this.scroller, t = this.dataRows[0];
1610
+ return !e || !t || e.scrollHeight <= e.clientHeight ? K : Math.max(1, Math.floor(e.clientHeight / Math.max(1, t.offsetHeight)) - 1);
1611
+ }
1612
+ async onGridKey(e, t) {
1613
+ let n = t.parentElement, r = this.matches(":dir(rtl)"), i = e.ctrlKey || e.metaKey, a = this.visibleCells(n).indexOf(t), [o, s] = this.rowIndex(n), c = o, l = a;
1614
+ switch (e.key) {
1615
+ case "ArrowRight":
1616
+ l = a + (r ? -1 : 1);
1617
+ break;
1618
+ case "ArrowLeft":
1619
+ if (this.tree && a === 0 && n.hasAttribute("data-bk-tree")) {
1620
+ e.preventDefault(), this.focusStop(n);
1621
+ return;
1622
+ }
1623
+ l = a + (r ? 1 : -1);
1624
+ break;
1625
+ case "ArrowDown":
1626
+ c = o + 1;
1627
+ break;
1628
+ case "ArrowUp":
1629
+ c = o - 1;
1630
+ break;
1631
+ case "Home":
1632
+ l = 0, i && (c = 0);
1633
+ break;
1634
+ case "End":
1635
+ l = 1e400, i && (c = s - 1);
1636
+ break;
1637
+ case "PageDown":
1638
+ c = o + this.pageRows();
1639
+ break;
1640
+ case "PageUp":
1641
+ c = o - this.pageRows();
1642
+ break;
1643
+ default: return;
1644
+ }
1645
+ e.preventDefault(), c = Math.max(0, Math.min(s - 1, c));
1646
+ let u = c === o ? n : await this.rowAt(c);
1647
+ if (!u) return;
1648
+ let d = this.visibleCells(u), f = d[Math.max(0, Math.min(d.length - 1, l))];
1649
+ f && this.focusStop(this.target(f));
1650
+ }
1651
+ onTreeKey(e, t) {
1652
+ let n = this.dataRows.filter((e) => !e.hidden), r = n.indexOf(t), i = t.hasAttribute("data-bk-parent"), a = t.hasAttribute("data-expanded"), o = this.matches(":dir(rtl)");
1653
+ switch (o && e.key === "ArrowRight" ? "ArrowLeft" : o && e.key === "ArrowLeft" ? "ArrowRight" : e.key) {
1654
+ case "ArrowDown":
1655
+ this.focusStop(n[r + 1]);
1656
+ break;
1657
+ case "ArrowUp":
1658
+ this.focusStop(n[r - 1]);
1659
+ break;
1660
+ case "Home":
1661
+ this.focusStop(n[0]);
1662
+ break;
1663
+ case "End":
1664
+ this.focusStop(n.at(-1));
1665
+ break;
1666
+ case "ArrowRight":
1667
+ i && !a ? this.toggleOpen(t, !0) : this.navigation === "cell" && this.focusStop(this.target(this.visibleCells(t)[0]));
1668
+ break;
1669
+ case "ArrowLeft":
1670
+ if (i && a) this.toggleOpen(t, !1);
1671
+ else {
1672
+ let e = this.level(t);
1673
+ this.focusStop(n.slice(0, r).reverse().find((t) => this.level(t) < e));
1674
+ }
1675
+ break;
1676
+ case "Enter":
1677
+ if (!i) return;
1678
+ this.toggleOpen(t);
1679
+ break;
1680
+ case " ": {
1681
+ let e = t.querySelector(":scope > [data-bk-select] > bk-checkbox");
1682
+ if (!e) return;
1683
+ e.click();
1684
+ break;
1685
+ }
1686
+ default: return;
1687
+ }
1688
+ e.preventDefault();
1689
+ }
1690
+ async startEdit(e) {
1691
+ if (this.editing || !e.hasAttribute("data-editable") || this.navigation !== "cell") return;
1692
+ let t = z.start();
1693
+ if (t && (await t, this.editing)) return;
1694
+ let n = this.headOf(e), r = e.dataset.value ?? this.text(e), i = document.createElement(e.dataset.field === "number" ? "bk-input-number" : "bk-input-text");
1695
+ i.className = "bk-table-editor", i.setAttribute("size", "sm"), i.setAttribute("aria-label", n ? this.text(n) : ""), i.value = r, e.setAttribute("data-bk-editing", ""), e.append(i), this.editing = {
1696
+ cell: e,
1697
+ field: i,
1698
+ old: r
1699
+ }, await i.updateComplete, i.focus(), (i.shadowRoot?.querySelector("input"))?.select?.();
1700
+ }
1701
+ commitEdit(e, t = !0) {
1702
+ let n = this.editing;
1703
+ if (!n) return;
1704
+ let { cell: r, field: i, old: a } = n, o = String(i.value ?? "");
1705
+ if (!e && i.checkValidity && !i.checkValidity()) {
1706
+ i.reportValidity?.();
1707
+ return;
1708
+ }
1709
+ if (this.editing = null, i.remove(), r.removeAttribute("data-bk-editing"), t && this.focusStop(r), e || o === a) return;
1710
+ let s = this.headOf(r), c = r.parentElement;
1711
+ _(this, "edit", {
1712
+ key: c.dataset.key,
1713
+ column: s ? this.columnKey(s) : String(r.cellIndex),
1714
+ value: o,
1715
+ oldValue: a
1716
+ }, !0) && d(this.i18n.t("tableCellChanged", {
1717
+ column: s ? this.text(s) : "",
1718
+ value: o
1719
+ }));
1720
+ }
1721
+ onDoubleClick = (e) => {
1722
+ let t = e.target?.closest?.("td[data-editable]");
1723
+ t && t.closest("bk-table") === this && this.startEdit(t);
1724
+ };
1725
+ onKeydown = (e) => {
1726
+ let t = e.target;
1727
+ if (e.defaultPrevented || !t?.closest || t.closest("bk-table") !== this) return;
1728
+ if (this.editing && t.closest(".bk-table-editor")) {
1729
+ e.key === "Enter" ? (e.preventDefault(), this.commitEdit(!1)) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.commitEdit(!0));
1730
+ return;
1731
+ }
1732
+ if (!this.table?.contains(t)) return;
1733
+ if ((e.ctrlKey || e.metaKey) && !e.altKey && e.key.toLowerCase() === "c") {
1734
+ if (t.closest("input, textarea, [contenteditable]") || !document.getSelection()?.isCollapsed) return;
1735
+ (this.selection && this.keys.size || this.navigation === "cell") && (e.preventDefault(), this.copySelection());
1736
+ return;
1737
+ }
1738
+ if (e.altKey) return;
1739
+ let n = t.closest(".bk-table-resize");
1740
+ if (n && !e.ctrlKey && !e.metaKey && [
1741
+ "ArrowLeft",
1742
+ "ArrowRight",
1743
+ "Home"
1744
+ ].includes(e.key)) return this.onHandleKey(e, n);
1745
+ let r = t.closest(".bk-table-handle");
1746
+ if (r && this.onLiftKey(e, r.closest("tr"))) return;
1747
+ let i = t.closest("td, th");
1748
+ if (this.tree && t.localName === "tr" && t.hasAttribute("data-bk-tree")) return this.onTreeKey(e, t);
1749
+ if (this.navigation === "cell" && i) {
1750
+ if (t === i && (e.key === "Enter" || e.key === "F2")) {
1751
+ if (i.hasAttribute("data-editable")) {
1752
+ e.preventDefault(), this.startEdit(i);
1753
+ return;
1754
+ }
1755
+ let t = this.widgets(i);
1756
+ if (t.length > 1) {
1757
+ e.preventDefault(), t[0].focus();
1758
+ return;
1759
+ }
1760
+ }
1761
+ if (t !== i && e.key === "Escape" && this.widgets(i).length > 1) {
1762
+ e.preventDefault(), this.focusStop(i);
1763
+ return;
1764
+ }
1765
+ if ([
1766
+ "ArrowRight",
1767
+ "ArrowLeft",
1768
+ "ArrowDown",
1769
+ "ArrowUp",
1770
+ "Home",
1771
+ "End",
1772
+ "PageDown",
1773
+ "PageUp"
1774
+ ].includes(e.key)) {
1775
+ if (t !== i && t.closest("input, textarea, select, [contenteditable]")) return;
1776
+ this.onGridKey(e, i);
1777
+ }
1778
+ return;
1779
+ }
1780
+ if (e.ctrlKey || e.metaKey || this.selection !== "single" && this.selection !== "multiple") return;
1781
+ let a = t.closest("tr[data-bk-selectable]");
1782
+ if (!a) return;
1783
+ let o = a.querySelector(":scope > [data-bk-select] > bk-checkbox");
1784
+ (e.key === "ArrowDown" || e.key === "ArrowUp") && t === o && (e.preventDefault(), this.moveSelectionFocus(a, e.key === "ArrowDown" ? 1 : -1));
1785
+ };
1786
+ async moveSelectionFocus(e, t) {
1787
+ let n;
1788
+ if (this.virtual && this.renderRow && e.dataset.bkIndex !== void 0) {
1789
+ let r = Number(e.dataset.bkIndex) + t;
1790
+ if (r < 0 || r >= (this.rows?.length ?? 0)) return;
1791
+ n = await this.rowAt(this.headRows.length + r);
1792
+ } else {
1793
+ let r = this.keyedRows.filter((e) => !e.hidden);
1794
+ n = r[r.indexOf(e) + t];
1795
+ }
1796
+ n?.querySelector(":scope > [data-bk-select] > bk-checkbox")?.focus();
1797
+ }
1798
+ syncCards() {
1799
+ let e = this.headRow, t = this.cards;
1800
+ for (let n of this.querySelectorAll(":scope > table > :is(tbody, tfoot) > tr")) if (!(n.hasAttribute("data-bk-spacer") || n.hasAttribute("data-detail"))) for (let r of this.appCells(n)) {
1801
+ let i = t && e ? e.cells[r.cellIndex] : null, a = i?.dataset.card, o = a === "title" || !a && r.localName === "th" && n.parentElement?.localName === "tbody", s = i && !o && a !== "meta" ? this.text(i) : null;
1802
+ s ? r.getAttribute("data-bk-label") !== s && r.setAttribute("data-bk-label", s) : r.removeAttribute("data-bk-label"), a ? r.getAttribute("data-bk-card") !== a && r.setAttribute("data-bk-card", a) : r.removeAttribute("data-bk-card");
1803
+ let c = t && r.dataset.type !== "number" && i?.dataset.type === "number";
1804
+ r.hasAttribute("data-bk-number") !== c && r.toggleAttribute("data-bk-number", c);
1805
+ }
1806
+ }
1807
+ syncMarks() {
1808
+ let e = this.headRow, t = this.columnRows.filter((e) => !e.hasAttribute("data-bk-spacer")), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
1809
+ if (e) for (let t of this.appCells(e)) {
1810
+ let e = t.hasAttribute("data-highlight");
1811
+ e && n.add(t.cellIndex), t.dataset.type === "check" && r.add(t.cellIndex);
1812
+ let i = t.querySelector(":scope > [data-bk-note]");
1813
+ if (!e) {
1814
+ i?.remove();
1815
+ continue;
1816
+ }
1817
+ i || (i = document.createElement("span"), i.className = "bk-table-sr", i.setAttribute("data-bk-note", ""), t.append(i));
1818
+ let a = ` ${t.getAttribute("data-highlight")?.trim() || this.i18n.t("tableRecommended")}`;
1819
+ i.textContent !== a && (i.textContent = a);
1820
+ }
1821
+ t.forEach((e, i) => {
1822
+ let a = e.parentElement?.localName === "thead";
1823
+ for (let o of this.appCells(e)) {
1824
+ let e = i === 0 ? "first" : i === t.length - 1 ? "last" : "";
1825
+ n.has(o.cellIndex) ? o.getAttribute("data-bk-highlight") !== e && o.setAttribute("data-bk-highlight", e) : o.removeAttribute("data-bk-highlight");
1826
+ let s = !a && (o.dataset.type ?? (r.has(o.cellIndex) ? "check" : "")) === "check";
1827
+ o.hasAttribute("data-bk-check-column") !== s && o.toggleAttribute("data-bk-check-column", s), this.syncCheck(o, s);
1828
+ }
1829
+ });
1830
+ }
1831
+ syncCheck(e, t) {
1832
+ let n = e.querySelector(":scope > .bk-table-check"), r = e.querySelector(":scope > [data-bk-check-value]"), i = (t ? e.dataset.value ?? [...e.childNodes].filter((e) => e !== n && e.nodeType !== Node.COMMENT_NODE).map((e) => e.textContent).join("") : "").trim().toLowerCase(), a = [this.i18n.t("tableYes"), this.i18n.t("tableNo")].map((e) => e.toLowerCase()), o = re.has(i) || i === a[0];
1833
+ if (!(t && (o || ie.has(i) || i === a[1]))) {
1834
+ if (!n) return;
1835
+ n.remove(), r?.replaceWith(...r.childNodes), e.removeAttribute("data-bk-check");
1836
+ return;
1837
+ }
1838
+ r || (r = document.createElement("span"), r.setAttribute("data-bk-check-value", ""), r.hidden = !0, e.append(r));
1839
+ let s = [...e.childNodes].filter((e) => e !== n && e !== r);
1840
+ s.length && r.append(...s);
1841
+ let c = o ? "yes" : "no";
1842
+ n || (n = document.createElement("span"), n.className = "bk-table-check", n.append(document.createElement("bk-icon"), Object.assign(document.createElement("span"), { className: "bk-table-sr" })), e.prepend(n));
1843
+ let l = n.querySelector("bk-icon"), u = o ? "check" : "remove";
1844
+ l.getAttribute("name") !== u && l.setAttribute("name", u);
1845
+ let d = this.i18n.t(o ? "tableYes" : "tableNo"), f = n.querySelector(".bk-table-sr");
1846
+ f.textContent !== d && (f.textContent = d), e.getAttribute("data-bk-check") !== c && e.setAttribute("data-bk-check", c);
1847
+ }
1848
+ get columnCount() {
1849
+ let e = this.headRow;
1850
+ return e ? this.visibleCells(e).length : 1;
1851
+ }
1852
+ syncState() {
1853
+ let e = this.table, t = this.isEmpty;
1854
+ t !== this.empty && (this.empty = t);
1855
+ let n = e.querySelector(":scope > tbody[data-bk-state]"), r = this.busy && t ? Math.max(1, this.skeletonRows || 0) : 0;
1856
+ if (!r) {
1857
+ n?.remove();
1858
+ return;
1859
+ }
1860
+ n || (n = document.createElement("tbody"), n.setAttribute("data-bk-state", ""), n.setAttribute("aria-hidden", "true"), e.append(n));
1861
+ let i = this.columnCount;
1862
+ (n.rows.length !== r || n.rows[0]?.cells.length !== i) && n.replaceChildren(...Array.from({ length: r }, () => {
1863
+ let e = document.createElement("tr");
1864
+ e.setAttribute("data-bk-skeleton", "");
1865
+ for (let t = 0; t < i; t++) e.append(Object.assign(document.createElement("td"), { innerHTML: "<bk-skeleton></bk-skeleton>" }));
1866
+ return e;
1867
+ }));
1868
+ }
1869
+ renderWindow() {
1870
+ let t = this.body;
1871
+ if (!t || !this.renderRow) return;
1872
+ let i = this.rows ?? [], a = this.vc, s = a.count ? a.total / a.count : 0, c = a.offset, l = Math.max(0, a.total - a.offset - (a.end - a.start) * s), u = this.columnCount, d = (t) => e`<tr data-bk-spacer aria-hidden="true"><td colspan=${u} style=${o({ blockSize: `${t}px` })}></td></tr>`;
1873
+ r(e`${c > 0 ? d(c) : n}${i.slice(a.start, a.end).map((e, t) => this.renderRow(e, a.start + t))}${l > 0 ? d(l) : n}`, t);
1874
+ let f = this.headRows.length, p = a.start;
1875
+ for (let e of t.rows) e.hasAttribute("data-bk-spacer") || (e.setAttribute("data-bk-index", String(p)), e.setAttribute("aria-rowindex", String(f + p + 1)), p++);
1876
+ this.syncAll();
1877
+ }
1878
+ clearWindow() {
1879
+ let e = this.body;
1880
+ e && r(n, e);
1881
+ }
1882
+ measure() {
1883
+ let e = this.scroller, t = !!e && (e.scrollWidth > e.clientWidth + 1 || e.scrollHeight > e.clientHeight + 1);
1884
+ t !== this.scrolling && (this.scrolling = t);
1885
+ let n = c(this)?.querySelector(":scope > table > thead"), r = c(this)?.querySelector(":scope > table > tfoot"), i = this.stickyHeader && n ? `${n.offsetHeight}px` : "", a = this.stickyFooter && r ? `${r.offsetHeight}px` : "";
1886
+ e && e.style.scrollPaddingBlockStart !== i && (e.style.scrollPaddingBlockStart = i), e && e.style.scrollPaddingBlockEnd !== a && (e.style.scrollPaddingBlockEnd = a);
1887
+ let o = this.renderRoot.querySelector(".probe"), s = this.responsive === "cards" && !!o && this.clientWidth > 0 && this.clientWidth < parseFloat(getComputedStyle(o).marginInlineStart);
1888
+ s !== this.cards && (s ? this.internals.states.add("cards") : this.internals.states.delete("cards"), this.syncAll(), this.requestUpdate(), s && this.sortable && V.start());
1889
+ let l = this.headRow;
1890
+ l && l.querySelector("[data-pin]") && this.syncPins(l);
1891
+ }
1892
+ get regionName() {
1893
+ let e = c(this)?.querySelector(":scope > table > caption")?.textContent?.replace(/\s+/g, " ").trim();
1894
+ return this.label || e || this.i18n.t("table");
1895
+ }
1896
+ render() {
1897
+ let t = this.menuColumn ? this.text(this.menuColumn) : "", r = this.filterItems, i = this.slots.has("error"), a = this.empty && !this.busy && !i && this.slots.has("empty"), o = this.filterKey ? this.headRow && this.appCells(this.headRow).find((e) => e.dataset.filter === this.filterKey) : null, s = this.i18n.t("tableFilterColumn", { column: o ? this.text(o) : "" }), c = this.sortable && this.cards && this.headRow ? this.appCells(this.headRow).filter((e) => e.dataset.sort).map((e) => ({
1898
+ key: e.dataset.sort,
1899
+ text: this.text(e) || e.dataset.sort
1900
+ })) : [], l = this.sortDir === "desc";
1901
+ return e`${c.length ? e`<div class="card-sort" part="card-sort">
1902
+ <bk-select size="sm" label-position="start" label=${this.i18n.t("tableSortBy")} placeholder=${this.sortKey ? n : this.i18n.t("tableSortBy")}
1903
+ .value=${this.sortKey ?? ""} @input=${(e) => e.stopPropagation()} @change=${this.onCardSort}>
1904
+ ${c.map((t) => e`<option value=${t.key}>${t.text}</option>`)}
1905
+ </bk-select>
1906
+ <bk-button size="sm" variant="outline" icon=${l ? "arrow-down" : "arrow-up"} ?disabled=${!this.sortKey}
1907
+ label=${this.i18n.t(l ? "tableSortAscending" : "tableSortDescending")} @click=${this.onCardSortDir}></bk-button>
1908
+ </div>` : n}
1909
+ ${r.length ? e`<bk-filter-bar class="filter-bar" part="filter-bar" .items=${r}
1910
+ @remove=${this.onFilterRemove} @clear=${this.onFilterClear}></bk-filter-bar>` : n}
1911
+ <div class="frame">
1912
+ <div class="scroller" part="scroller" tabindex=${this.scrolling ? "0" : n} ?inert=${this.busyState.inert && !this.empty}
1913
+ role=${this.scrolling ? "region" : n} aria-label=${this.scrolling ? this.regionName : n}>
1914
+ <slot @slotchange=${() => {
1915
+ this.observedTable = null, this.observe();
1916
+ }}></slot>
1917
+ <div class="state" part="state" ?hidden=${!i && !a}>
1918
+ <div role="alert" ?hidden=${!i}><slot name="error"></slot></div>
1919
+ <div ?hidden=${!a}><slot name="empty"></slot></div>
1920
+ </div>
1921
+ ${this.virtual ? e`<div class="sentinel"></div>` : n}
1922
+ </div>
1923
+ ${this.empty ? n : this.busyState.veil()}
1924
+ </div>
1925
+ ${this.responsive === "cards" ? e`<div class="probe" aria-hidden="true"></div>` : n}
1926
+ ${this.resizable ? e`<bk-menu-context class="column-menu" exportparts="menu: column-menu"
1927
+ label=${this.i18n.t(this.menuKind === "resize" ? "tableResizeColumn" : "tableColumnMenu", { column: t })}
1928
+ @select=${this.onColumnMenu} @close=${this.onColumnMenuClose}>
1929
+ ${this.menuColumn ? this.menuKind === "resize" ? this.resizeItems() : this.columnItems(this.menuColumn) : this.resizeItems()}
1930
+ </bk-menu-context>` : n}
1931
+ ${this.filterable ? e`<div class="filter-anchor"><bk-popover class="filter-popover" part="filter-popover" label=${s} @close=${this.onFilterClose}>
1932
+ <div class="filter-body">
1933
+ ${this.filterKey ? e`<slot name=${`filter-${this.filterKey}`}></slot>` : n}
1934
+ <div class="filter-actions">
1935
+ <bk-button variant="ghost" size="sm" @click=${() => this.onFilterApply(!0)}>${this.i18n.t("tableFilterClear")}</bk-button>
1936
+ <bk-button variant="solid" size="sm" @click=${() => this.onFilterApply(!1)}>${this.i18n.t("tableFilterApply")}</bk-button>
1937
+ </div>
1938
+ </div>
1939
+ </bk-popover></div>` : n}
1940
+ ${this.reorderable ? O(this.handleRow ? this.i18n.t("sortableHandle", { item: this.rowName(this.handleRow) }) : "", this.rowActions) : n}`;
1941
+ }
1942
+ };
1943
+ u("bk-table", $);
1944
+ export { $ as t };