@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
@@ -29,6 +29,8 @@ const DOUBLE_TAP_ZOOM = 2.5;
29
29
  const SWIPE_DISTANCE = 48;
30
30
  const TAP_SLOP = 8;
31
31
  const DOUBLE_TAP_MS = 300;
32
+ const CLICK_STEPS = [2, 4];
33
+ const OWN_KEYS = "input, textarea, select, [contenteditable]:not([contenteditable=false]), [role~=textbox], [role~=searchbox], [role~=combobox], [role~=spinbutton], [role~=slider], [role~=listbox], [role~=menu], [role~=menubar], [role~=radiogroup], [role~=tablist], [role~=tree], [role~=grid], [role~=treegrid]";
32
34
  const clamp = (v, min, max) => Math.min(max, Math.max(min, v));
33
35
  class BkImageViewer extends LitElement {
34
36
  static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
@@ -36,6 +38,8 @@ class BkImageViewer extends LitElement {
36
38
  items: { attribute: false },
37
39
  index: { type: Number },
38
40
  filmstrip: { type: Boolean, reflect: true },
41
+ loop: { type: Boolean, reflect: true },
42
+ immersive: { type: Boolean, reflect: true },
39
43
  label: {},
40
44
  prevLabel: { attribute: "prev-label" },
41
45
  nextLabel: { attribute: "next-label" },
@@ -48,7 +52,8 @@ class BkImageViewer extends LitElement {
48
52
  loading: { state: true },
49
53
  failed: { state: true },
50
54
  zoomed: { state: true },
51
- ratio: { state: true }
55
+ ratio: { state: true },
56
+ thumbRatio: { state: true }
52
57
  };
53
58
  // Zoom and pan live outside Lit's update cycle: gestures write one transform per frame.
54
59
  pz = new PanZoom(this, {
@@ -56,8 +61,17 @@ class BkImageViewer extends LitElement {
56
61
  min: () => Math.min(1, this.actualScale),
57
62
  max: () => Math.max(MAX_SCALE, this.actualScale * MAX_PIXEL_ZOOM),
58
63
  content: () => this.box.w && this.box.h ? { w: this.fit.w / this.box.w, h: this.fit.h / this.box.h } : { w: 1, h: 1 },
59
- onChange: () => void 0
64
+ onChange: () => this.onViewChange()
60
65
  });
66
+ /** While true, a change of the view is not a change of the user: no `viewchange`. */
67
+ quiet = false;
68
+ viewChanged = false;
69
+ /** A view that the app set before the image had its shape. The viewer applies it again when the shape is known. */
70
+ pendingView = null;
71
+ /** The image of the last `load` event (index and URL). */
72
+ loadedKey = "";
73
+ /** The surrounding dialog whose keys the viewer handles (`immersive`). */
74
+ keyScope = null;
61
75
  swipeX = 0;
62
76
  smooth = false;
63
77
  raf = 0;
@@ -85,6 +99,8 @@ class BkImageViewer extends LitElement {
85
99
  this.items = [];
86
100
  this.index = 0;
87
101
  this.filmstrip = false;
102
+ this.loop = false;
103
+ this.immersive = false;
88
104
  this.label = "";
89
105
  this.prevLabel = "";
90
106
  this.nextLabel = "";
@@ -98,10 +114,13 @@ class BkImageViewer extends LitElement {
98
114
  this.failed = false;
99
115
  this.zoomed = false;
100
116
  this.ratio = 0;
117
+ this.thumbRatio = 0;
101
118
  }
102
119
  static styles = [base, srOnly, css`
103
- :host { display: block; height: 100%; min-height: 0; }
120
+ :host { display: block; height: 100%; min-height: 0; max-block-size: var(--bk-image-viewer-max-height, none); }
104
121
  .viewer {
122
+ /* Without a height of the host, the sizer gives the height; a maximum height of the host caps it. */
123
+ max-block-size: inherit;
105
124
  color-scheme: var(--bk-image-viewer-color-scheme, dark);
106
125
  --_bk-image-viewer-pad: var(--bk-image-viewer-padding, var(--bk-space-3));
107
126
  --_bk-image-viewer-control: var(--bk-image-viewer-control-size, var(--bk-control-lg));
@@ -154,7 +173,13 @@ class BkImageViewer extends LitElement {
154
173
  }
155
174
 
156
175
  .main { position: relative; min-height: 0; }
176
+ /* Without a height, the viewer is as high as the image at the width of the frame (the shape of the image, else of the thumbnail). */
177
+ .sizer {
178
+ visibility: hidden; pointer-events: none; aspect-ratio: var(--_bk-image-viewer-ratio, 4 / 3);
179
+ margin-inline: calc(var(--_bk-image-viewer-control) + 2 * var(--_bk-image-viewer-pad)); max-block-size: 100%;
180
+ }
157
181
  .stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
182
+ .stage.steps { cursor: zoom-in; }
158
183
  .stage.zoomed { cursor: grab; }
159
184
  .stage.zoomed:active { cursor: grabbing; }
160
185
  .frame { position: absolute; inset: 0 calc(var(--_bk-image-viewer-control) + 2 * var(--_bk-image-viewer-pad)); transform-origin: 50% 50%; container-type: size; }
@@ -226,6 +251,7 @@ class BkImageViewer extends LitElement {
226
251
 
227
252
  @media (max-width: 640px) {
228
253
  .frame { inset: 0; }
254
+ .sizer { margin-inline: 0; }
229
255
  }
230
256
  @media (max-width: 480px) {
231
257
  .level, .fit, .actual { display: none; }
@@ -252,21 +278,49 @@ class BkImageViewer extends LitElement {
252
278
  else
253
279
  void this.updateComplete.then(() => this.renderRoot.querySelector(".viewer")?.focus(options));
254
280
  }
255
- /** Moves to the previous image (wraps around). */
281
+ /** Moves to the previous image. It wraps around with `loop`, else it stops at the first image. */
256
282
  previous() {
257
283
  this.go(this.index - 1);
258
284
  }
259
- /** Moves to the next image (wraps around). */
285
+ /** Moves to the next image. It wraps around with `loop`, else it stops at the last image. */
260
286
  next() {
261
287
  this.go(this.index + 1);
262
288
  }
263
- /** Returns to the fitted size. */
289
+ /** Returns to the fitted size. It fires no `viewchange`. */
264
290
  resetZoom() {
291
+ this.silently(() => this.zoomFit());
292
+ }
293
+ /**
294
+ * The zoom and the visible part of the image (`ImageViewerView`). Set it to show the same part as another
295
+ * viewer, for example in `viewchange` of that viewer. Setting it fires no `viewchange`. A view that you set
296
+ * before the image has its shape applies again when the shape is known.
297
+ */
298
+ get view() {
299
+ const { zoom, x, y } = this.pz.get();
300
+ const { kx, ky } = this.pictureScale();
301
+ return { zoom, x: 0.5 + (x - 0.5) * kx, y: 0.5 + (y - 0.5) * ky };
302
+ }
303
+ set view(v) {
304
+ this.pendingView = { ...this.view, ...v };
305
+ this.applyPendingView();
306
+ }
307
+ /** The width of the shown image in image pixels, as `naturalWidth` of an `<img>`. It is 0 while unknown. */
308
+ get naturalWidth() {
309
+ return this.failed ? 0 : this.image?.naturalWidth ?? 0;
310
+ }
311
+ /** The height of the shown image in image pixels, as `naturalHeight` of an `<img>`. It is 0 while unknown. */
312
+ get naturalHeight() {
313
+ return this.failed ? 0 : this.image?.naturalHeight ?? 0;
314
+ }
315
+ /** Shows the image at its actual size: one image pixel per screen pixel. It fires no `viewchange`. */
316
+ actualSize() {
317
+ this.silently(() => this.zoomActual());
318
+ }
319
+ zoomFit() {
265
320
  this.pz.set({ zoom: 1, x: 0.5, y: 0.5 });
266
321
  this.apply(true);
267
322
  }
268
- /** Shows the image at its actual size: one image pixel per screen pixel. */
269
- actualSize() {
323
+ zoomActual() {
270
324
  if (!this.box.w)
271
325
  this.measure();
272
326
  this.zoomTo(this.actualScale);
@@ -279,8 +333,14 @@ class BkImageViewer extends LitElement {
279
333
  get actualScale() {
280
334
  return this.natural.w && this.fit.w ? this.natural.w / this.fit.w : 1;
281
335
  }
336
+ connectedCallback() {
337
+ super.connectedCallback();
338
+ if (this.hasUpdated)
339
+ this.bindKeyScope();
340
+ }
282
341
  disconnectedCallback() {
283
342
  super.disconnectedCallback();
343
+ this.unbindKeyScope();
284
344
  this.resizer.disconnect();
285
345
  this.observed = null;
286
346
  this.pointers.clear();
@@ -292,15 +352,19 @@ class BkImageViewer extends LitElement {
292
352
  willUpdate(changed) {
293
353
  const n = this.items.length;
294
354
  this.index = clamp(Math.trunc(this.index) || 0, 0, Math.max(0, n - 1));
355
+ const active = this.hasUpdated && this.renderRoot instanceof ShadowRoot ? this.renderRoot.activeElement : null;
356
+ if (active && !this.loop && (active.matches(".prev") && this.index <= 0 || active.matches(".next") && this.index >= n - 1))
357
+ this.focus();
295
358
  if (changed.has("index") || changed.has("items")) {
296
359
  this.loading = n > 0;
297
360
  this.failed = false;
298
361
  this.swipeX = 0;
299
- this.pz.set({ zoom: 1, x: 0.5, y: 0.5 });
362
+ this.silently(() => this.pz.set({ zoom: 1, x: 0.5, y: 0.5 }));
300
363
  this.zoomed = false;
301
364
  this.natural = { w: 0, h: 0 };
302
365
  const item = this.items[this.index];
303
366
  this.ratio = item?.width && item.height ? item.width / item.height : 0;
367
+ this.thumbRatio = 0;
304
368
  if (item && !isServer) {
305
369
  const probe = new Image();
306
370
  probe.src = item.full || item.src;
@@ -319,6 +383,8 @@ class BkImageViewer extends LitElement {
319
383
  this.resizer.observe(frame);
320
384
  this.observed = frame;
321
385
  }
386
+ if (changed.has("immersive"))
387
+ this.bindKeyScope();
322
388
  if (changed.has("index") || changed.has("items")) {
323
389
  const img = this.image;
324
390
  if (img?.complete && img.naturalWidth) {
@@ -332,8 +398,73 @@ class BkImageViewer extends LitElement {
332
398
  this.watchSize();
333
399
  this.preloadNeighbours();
334
400
  revealInside(this.renderRoot.querySelector('.thumb[aria-current="true"]'), this);
401
+ this.applyPendingView();
402
+ }
403
+ }
404
+ /** Runs `fn` without a `viewchange`: a change that the app or the viewer makes, not the user. */
405
+ silently(fn) {
406
+ const was = this.quiet;
407
+ this.quiet = true;
408
+ try {
409
+ fn();
410
+ } finally {
411
+ this.quiet = was;
412
+ }
413
+ }
414
+ onViewChange() {
415
+ if (this.quiet)
416
+ return;
417
+ this.pendingView = null;
418
+ this.viewChanged = true;
419
+ }
420
+ /** The factors from fractions of the frame to fractions of the fitted image. */
421
+ pictureScale() {
422
+ return { kx: this.fit.w ? this.box.w / this.fit.w : 1, ky: this.fit.h ? this.box.h / this.fit.h : 1 };
423
+ }
424
+ applyPendingView() {
425
+ const v = this.pendingView;
426
+ if (!v || !this.hasUpdated || this.isUpdatePending || !this.frame)
427
+ return;
428
+ this.measure();
429
+ const { kx, ky } = this.pictureScale();
430
+ this.silently(() => this.pz.set({ zoom: v.zoom, x: 0.5 + (v.x - 0.5) / kx, y: 0.5 + (v.y - 0.5) / ky }));
431
+ this.apply(false);
432
+ if (this.ratio)
433
+ this.pendingView = null;
434
+ }
435
+ // ---- the keys of a surrounding dialog (`immersive`) ----
436
+ bindKeyScope() {
437
+ this.unbindKeyScope();
438
+ if (!this.immersive || !this.isConnected)
439
+ return;
440
+ for (let el = this; el; el = el.parentElement ?? (el.getRootNode().host ?? null)) {
441
+ if (el !== this && (el.localName === "dialog" || el.localName === "bk-dialog" || el.getAttribute("role") === "dialog")) {
442
+ this.keyScope = el;
443
+ el.addEventListener("keydown", this.onScopeKey);
444
+ return;
445
+ }
335
446
  }
336
447
  }
448
+ unbindKeyScope() {
449
+ this.keyScope?.removeEventListener("keydown", this.onScopeKey);
450
+ this.keyScope = null;
451
+ }
452
+ /** A key in the dialog outside the viewer. A field or a widget that uses the key itself keeps it. */
453
+ onScopeKey = (event) => {
454
+ const e = event;
455
+ if (e.defaultPrevented)
456
+ return;
457
+ const path = e.composedPath();
458
+ if (path.includes(this))
459
+ return;
460
+ for (const node of path) {
461
+ if (node === this.keyScope)
462
+ break;
463
+ if (node instanceof Element && (node.matches(OWN_KEYS) || node.isContentEditable))
464
+ return;
465
+ }
466
+ this.onKey(e);
467
+ };
337
468
  /**
338
469
  * Reads the size of the full image as soon as the browser knows it (from the file header, long
339
470
  * before the whole image has loaded), so the placeholder can use its shape.
@@ -349,6 +480,7 @@ class BkImageViewer extends LitElement {
349
480
  this.ratio = img.naturalWidth / img.naturalHeight;
350
481
  this.measure();
351
482
  this.apply(false);
483
+ this.applyPendingView();
352
484
  return;
353
485
  }
354
486
  this.sizeWatch = requestAnimationFrame(check);
@@ -360,6 +492,8 @@ class BkImageViewer extends LitElement {
360
492
  if (n < 2)
361
493
  return;
362
494
  for (const i of [this.index + 1, this.index - 1]) {
495
+ if (!this.loop && (i < 0 || i >= n))
496
+ continue;
363
497
  const it = this.items[(i + n) % n];
364
498
  const url = it.full || it.src;
365
499
  if (this.preloaded.has(url))
@@ -371,15 +505,17 @@ class BkImageViewer extends LitElement {
371
505
  }
372
506
  }
373
507
  // ---- navigation ----
508
+ /** Moves to image `i`. It wraps around with `loop`, else it stops at the ends. Returns false when the image stays. */
374
509
  go(i) {
375
510
  const n = this.items.length;
376
511
  if (n < 2)
377
- return;
378
- const next = (i % n + n) % n;
512
+ return false;
513
+ const next = this.loop ? (i % n + n) % n : clamp(i, 0, n - 1);
379
514
  if (next === this.index)
380
- return;
515
+ return false;
381
516
  this.index = next;
382
517
  emitDetail(this, "change", { index: next });
518
+ return true;
383
519
  }
384
520
  /** How far a key or a pan button moves the image, in px. */
385
521
  get panStep() {
@@ -401,8 +537,8 @@ class BkImageViewer extends LitElement {
401
537
  "+": () => this.zoomTo(this.pz.zoom * ZOOM_STEP),
402
538
  "=": () => this.zoomTo(this.pz.zoom * ZOOM_STEP),
403
539
  "-": () => this.zoomTo(this.pz.zoom / ZOOM_STEP),
404
- "0": () => this.resetZoom(),
405
- "1": () => this.actualSize()
540
+ "0": () => this.zoomFit(),
541
+ "1": () => this.zoomActual()
406
542
  });
407
543
  const act = keys[e.key];
408
544
  if (!act)
@@ -415,11 +551,10 @@ class BkImageViewer extends LitElement {
415
551
  const f = this.frame;
416
552
  if (!f)
417
553
  return;
418
- const r = f.getBoundingClientRect();
419
- const z = this.pz.zoom;
420
- const w = r.width / z, h = r.height / z;
421
- const { tx, ty } = this.offset(w, h);
422
- this.box = { x: r.left + r.width / 2 - tx - this.swipeX, y: r.top + r.height / 2 - ty, w, h };
554
+ const r = (f.parentElement ?? f).getBoundingClientRect();
555
+ const inset = parseFloat(getComputedStyle(f).left) || 0;
556
+ const w = Math.max(0, r.width - 2 * inset), h = r.height;
557
+ this.box = { x: r.left + r.width / 2, y: r.top + r.height / 2, w, h };
423
558
  const img = this.image;
424
559
  if (img?.naturalWidth && img.naturalHeight) {
425
560
  const k = Math.min(w / img.naturalWidth, h / img.naturalHeight);
@@ -459,6 +594,10 @@ class BkImageViewer extends LitElement {
459
594
  const level = this.renderRoot.querySelector(".level");
460
595
  if (level)
461
596
  level.textContent = ratio ? this.formatPercent(ratio) : "";
597
+ if (this.viewChanged) {
598
+ this.viewChanged = false;
599
+ emitDetail(this, "viewchange", this.view);
600
+ }
462
601
  });
463
602
  }
464
603
  formatPercent(ratio) {
@@ -470,7 +609,7 @@ class BkImageViewer extends LitElement {
470
609
  }
471
610
  /** Keeps the image in view after a change of the size of the frame or the image. */
472
611
  clampPan() {
473
- this.pz.set({});
612
+ this.silently(() => this.pz.set({}));
474
613
  }
475
614
  /** Zooms to `s`. The image point under (cx, cy) stays in place. The default point is the centre. */
476
615
  zoomTo(s, cx = this.box.x, cy = this.box.y, animate = true) {
@@ -488,6 +627,8 @@ class BkImageViewer extends LitElement {
488
627
  this.apply(true);
489
628
  }
490
629
  onWheel(e) {
630
+ if (!this.immersive && !this.zoomed && !e.ctrlKey && !e.metaKey)
631
+ return;
491
632
  e.preventDefault();
492
633
  const delta = e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY;
493
634
  this.zoomTo(this.pz.zoom * Math.exp(-delta * (e.ctrlKey ? 0.01 : 2e-3)), e.clientX, e.clientY, false);
@@ -552,29 +693,42 @@ class BkImageViewer extends LitElement {
552
693
  const dx = this.swipeX;
553
694
  if (dx) {
554
695
  this.swipeX = 0;
555
- if (e.type !== "pointercancel" && Math.abs(dx) > SWIPE_DISTANCE)
556
- this.go(this.index + (dx < 0 ? 1 : -1));
557
- else
696
+ if (e.type === "pointercancel" || Math.abs(dx) <= SWIPE_DISTANCE || !this.go(this.index + (dx < 0 ? 1 : -1)))
558
697
  this.apply(true);
559
698
  return;
560
699
  }
561
700
  if (!this.drag.moved && e.type === "pointerup")
562
701
  this.onTap(e);
563
702
  }
564
- /** A double tap or double click toggles the zoom. A single tap beside the image closes the viewer. */
703
+ /**
704
+ * A double tap or double click toggles the zoom. A single tap beside the image closes the viewer.
705
+ * In an `immersive` viewer a click (mouse or pen) steps the zoom: 2×, 4×, then the fitted size.
706
+ */
565
707
  onTap(e) {
708
+ const outside = Math.abs(e.clientX - this.box.x) > this.fit.w / 2 || Math.abs(e.clientY - this.box.y) > this.fit.h / 2;
709
+ if (this.immersive && e.pointerType !== "touch") {
710
+ if (!this.zoomed && outside) {
711
+ emit(this, "dismiss");
712
+ return;
713
+ }
714
+ const step = CLICK_STEPS.find((s) => this.pz.zoom < s - 0.01);
715
+ if (step)
716
+ this.zoomTo(step, e.clientX, e.clientY);
717
+ else
718
+ this.zoomFit();
719
+ return;
720
+ }
566
721
  const now = e.timeStamp;
567
722
  const last = this.lastTap;
568
723
  if (now - last.t < DOUBLE_TAP_MS && Math.hypot(e.clientX - last.x, e.clientY - last.y) < 30) {
569
724
  this.lastTap = { t: 0, x: 0, y: 0 };
570
725
  if (this.zoomed)
571
- this.resetZoom();
726
+ this.zoomFit();
572
727
  else
573
728
  this.zoomTo(DOUBLE_TAP_ZOOM, e.clientX, e.clientY);
574
729
  return;
575
730
  }
576
731
  this.lastTap = { t: now, x: e.clientX, y: e.clientY };
577
- const outside = Math.abs(e.clientX - this.box.x) > this.fit.w / 2 || Math.abs(e.clientY - this.box.y) > this.fit.h / 2;
578
732
  if (!this.zoomed && outside)
579
733
  emit(this, "dismiss");
580
734
  }
@@ -589,9 +743,22 @@ class BkImageViewer extends LitElement {
589
743
  }
590
744
  /** Fits the loaded image into the frame. It does not change reactive state. */
591
745
  placeImage() {
592
- this.preloaded.add(this.image?.getAttribute("src") ?? "");
746
+ const src = this.image?.getAttribute("src") ?? "";
747
+ this.preloaded.add(src);
593
748
  this.measure();
594
749
  this.apply(false);
750
+ this.applyPendingView();
751
+ const key = `${this.index}|${src}`;
752
+ if (key !== this.loadedKey) {
753
+ this.loadedKey = key;
754
+ this.dispatchEvent(new Event("load"));
755
+ }
756
+ }
757
+ /** The thumbnail gives the height of the viewer until the shape of the full image is known. */
758
+ onThumbLoad(e) {
759
+ const img = e.target;
760
+ if (img.naturalWidth && img.naturalHeight)
761
+ this.thumbRatio = img.naturalWidth / img.naturalHeight;
595
762
  }
596
763
  onImageError(e) {
597
764
  if (e.target !== this.image)
@@ -608,7 +775,10 @@ class BkImageViewer extends LitElement {
608
775
  const many = n > 1;
609
776
  const full = item.full || item.src;
610
777
  const strip = this.filmstrip && many;
778
+ const atStart = !this.loop && this.index <= 0;
779
+ const atEnd = !this.loop && this.index >= n - 1;
611
780
  return html`<div class="viewer" part="base" role="region" tabindex="0"
781
+ style=${styleMap({ "--_bk-image-viewer-ratio": this.ratio || this.thumbRatio || void 0 })}
612
782
  aria-label=${this.label || this.i18n.t("imageViewer")} @keydown=${this.onKey}>
613
783
  <div class="bar" part="toolbar">
614
784
  <span class="counter" part="counter" aria-live="polite" aria-atomic="true">${many ? html`<span aria-hidden="true">${this.index + 1} / ${n}</span><span class="sr-only">${this.i18n.t("imageCounter", { index: this.index + 1, total: n })}</span>` : ""}</span>
@@ -616,20 +786,21 @@ class BkImageViewer extends LitElement {
616
786
  <bk-button variant="ghost" class="control" size="lg" label=${this.zoomOutLabel || this.i18n.t("zoomOut")} icon="zoom-out" @click=${() => this.zoomTo(this.pz.zoom / ZOOM_STEP)}></bk-button>
617
787
  <output class="level" part="zoom-level" aria-live="off" aria-label=${this.i18n.t("zoomLevel")}></output>
618
788
  <bk-button variant="ghost" class="control" size="lg" label=${this.zoomInLabel || this.i18n.t("zoomIn")} icon="zoom-in" @click=${() => this.zoomTo(this.pz.zoom * ZOOM_STEP)}></bk-button>
619
- <bk-button variant="ghost" class="control fit" size="lg" label=${this.fitLabel || this.i18n.t("zoomFit")} icon="fit-screen" @click=${() => this.resetZoom()}></bk-button>
620
- <bk-button variant="ghost" class="control actual" size="lg" label=${this.actualSizeLabel || this.i18n.t("zoomActual")} icon="actual-size" @click=${() => this.actualSize()}></bk-button>
789
+ <bk-button variant="ghost" class="control fit" size="lg" label=${this.fitLabel || this.i18n.t("zoomFit")} icon="fit-screen" @click=${() => this.zoomFit()}></bk-button>
790
+ <bk-button variant="ghost" class="control actual" size="lg" label=${this.actualSizeLabel || this.i18n.t("zoomActual")} icon="actual-size" @click=${() => this.zoomActual()}></bk-button>
621
791
  </span>
622
792
  <span class="actions"><slot name="actions"></slot></span>
623
793
  </div>
624
794
  <div class="main">
625
- <div class="stage ${this.zoomed ? "zoomed" : ""}" part="stage" @wheel=${this.onWheel}
795
+ <div class="sizer" aria-hidden="true"></div>
796
+ <div class="stage ${this.zoomed ? "zoomed" : ""} ${this.immersive ? "steps" : ""}" part="stage" @wheel=${this.onWheel}
626
797
  @pointerdown=${this.onPointerDown} @pointermove=${this.onPointerMove}
627
798
  @pointerup=${this.onPointerUp} @pointercancel=${this.onPointerUp}>
628
799
  <div class="frame">${keyed(`${this.index}|${full}`, html`
629
800
  <img class="image ${this.loading ? "" : "loaded"} ${this.failed ? "failed" : ""}" part="image" src=${full} alt=${item.alt} decoding="async"
630
801
  draggable="false" @load=${this.onImageLoad} @error=${this.onImageError}>
631
- ${full !== item.src ? html`<img class="placeholder ${this.ratio ? "shaped" : ""}" style=${styleMap({ "--_bk-image-viewer-ratio": this.ratio || void 0 })}
632
- src=${item.src} alt="" aria-hidden="true" decoding="async" draggable="false">` : nothing}`)}
802
+ ${full !== item.src ? html`<img class="placeholder ${this.ratio ? "shaped" : ""}"
803
+ src=${item.src} alt="" aria-hidden="true" decoding="async" draggable="false" @load=${this.onThumbLoad}>` : nothing}`)}
633
804
  </div>
634
805
  ${this.loading ? html`<span class="spinner"><bk-spinner size="lg"></bk-spinner></span>` : nothing}
635
806
  ${this.failed ? html`<p class="error" role="alert"><bk-icon name="error" size="md"></bk-icon>${this.errorLabel || this.i18n.t("imageError")}</p>` : nothing}
@@ -641,8 +812,8 @@ class BkImageViewer extends LitElement {
641
812
  <bk-button variant="ghost" class="control" size="sm" icon="chevron-right" label=${this.i18n.t("panRight")} @click=${() => this.panBy(-this.panStep, 0)}></bk-button>
642
813
  </span>
643
814
  ${many ? html`
644
- <bk-button variant="ghost" class="control nav prev" part="nav" size="lg" icon="chevron-left" label=${this.prevLabel || this.i18n.t("previousImage")} @click=${() => this.go(this.index - 1)}></bk-button>
645
- <bk-button variant="ghost" class="control nav next" part="nav" size="lg" icon="chevron-right" label=${this.nextLabel || this.i18n.t("nextImage")} @click=${() => this.go(this.index + 1)}></bk-button>` : nothing}
815
+ <bk-button variant="ghost" class="control nav prev" part="nav" size="lg" icon="chevron-left" label=${this.prevLabel || this.i18n.t("previousImage")} ?disabled=${atStart} @click=${() => this.go(this.index - 1)}></bk-button>
816
+ <bk-button variant="ghost" class="control nav next" part="nav" size="lg" icon="chevron-right" label=${this.nextLabel || this.i18n.t("nextImage")} ?disabled=${atEnd} @click=${() => this.go(this.index + 1)}></bk-button>` : nothing}
646
817
  </div>
647
818
  <div class="foot" ?hidden=${!item.caption && !strip}>
648
819
  ${item.caption ? html`<p class="caption" part="caption">${item.caption}</p>` : nothing}
@@ -26,9 +26,10 @@ export interface InputInlineSaveDetail {
26
26
  * With a mouse the pencil overlays the row after the text. It needs no room, so content after the
27
27
  * element keeps the normal gap and does not move when the pencil shows. On a touch screen the pencil is in the row.
28
28
  * A field rendered open from the start (`editing` in the markup) waits for the user. On hover the text shows a tint where
29
- * the frame of the open field is. The check button replaces the pencil. Enter or the check saves.
30
- * Esc or a click outside cancels. Tab out keeps the field open. Esc never reaches a surrounding dialog.
31
- * Focus returns to the pencil afterwards.
29
+ * the frame of the open field is. The check button replaces the pencil.
30
+ * Enter, the check, Tab out of the element and a click outside save, as in a cell of a spreadsheet. Only Esc and the
31
+ * cancel button of an `edit` control cancel. Esc never reaches a surrounding dialog. After Enter, the check or Esc, the
32
+ * focus returns to the pencil. The first Tab reaches the check. The next Tab saves and moves the focus on.
32
33
  *
33
34
  * Editing does not change the look of the line. The field uses the font, weight, colour and line
34
35
  * height of the text. The text stays where it is, and the field is as wide as its text. The frame
@@ -40,7 +41,9 @@ export interface InputInlineSaveDetail {
40
41
  * Saving fires `save` with `{ value, done }`. For a server round trip call `preventDefault()`,
41
42
  * then `done()` on success or `done("Name already taken")` to keep the field open with that
42
43
  * error (shown under the field and announced as an alert); the field is busy until then. Without `preventDefault()` the field
43
- * accepts the new value right away. An unchanged value closes the field like cancel.
44
+ * accepts the new value right away. An unchanged value closes the field like cancel. An empty value also fires `save`
45
+ * (without `required`), so the app can put a default name in its place. An error keeps the field open and takes the focus
46
+ * back, also after Tab or a click outside.
44
47
  *
45
48
  * **Any field.** Put a form control in the `edit` slot to edit more than text: a select, a date, a text area, a
46
49
  * combobox. Put the read view in the `display` slot (a badge, a formatted date, a link); without it the view shows
@@ -78,11 +81,12 @@ export interface InputInlineSaveDetail {
78
81
  * @cssprop --bk-input-inline-error-bg - Background of the error under the field (default --bk-layer-overlay-bg).
79
82
  * @cssprop --bk-input-inline-error-shadow - Shadow of the error under the field (default --bk-layer-overlay-shadow).
80
83
  * @fires {CustomEvent<InputInlineSaveDetail>} save - The user confirms a changed value; `event.detail` is `{ value, done }`.
81
- * @fires {Event} cancel - The field closes without saving: Esc or a click outside (does not bubble, so dialogs around it stay open).
84
+ * @fires {Event} cancel - The field closes without saving: Esc, the cancel button or an unchanged value (does not bubble, so dialogs around it stay open).
82
85
  *
83
86
  * @tag bk-input-inline
84
87
  * @keyboard Enter, Space - On the edit button: open the field.
85
88
  * @keyboard Enter - In the field: save. A multiline field and a list in the `edit` slot keep their own Enter.
89
+ * @keyboard Tab, Shift+Tab - Out of the element: save and move the focus on. Inside it, Tab reaches the check first.
86
90
  * @keyboard Escape - Cancel and show the old value. A dialog around the field stays open.
87
91
  * @a11y The read view is text with an edit button that names what it edits. The open field receives the focus and names the Escape key in its description. After save or cancel the focus returns to the edit button. An error is an alert.
88
92
  */
@@ -165,8 +169,13 @@ export declare class BkInputInline extends LitElement {
165
169
  private renderSave;
166
170
  /** A click on the read view opens the field, unless it hits a link or a button of the view. */
167
171
  private onDisplayClick;
168
- /** A press outside the element cancels; a save in progress stays. Tab out keeps the field open. */
172
+ /** A press outside the element saves; a save in progress stays. */
169
173
  private onOutside;
174
+ /**
175
+ * Focus that leaves the element (Tab, Shift+Tab) saves. Focus that moves inside it (the check, the popup of a control)
176
+ * does not. Without a new target (the window loses the focus) the field stays open.
177
+ */
178
+ private onFocusOut;
170
179
  disconnectedCallback(): void;
171
180
  render(): import("lit-html").TemplateResult<1>;
172
181
  }
@@ -41,6 +41,7 @@ class BkInputInline extends LitElement {
41
41
  this.editing = false;
42
42
  this.busy = false;
43
43
  this.error = "";
44
+ this.addEventListener("focusout", this.onFocusOut);
44
45
  }
45
46
  static styles = [base, srOnly, css`
46
47
  :host {
@@ -48,7 +49,11 @@ class BkInputInline extends LitElement {
48
49
  --_bk-inline-px: var(--bk-input-inline-pad-inline, var(--bk-space-1-5));
49
50
  --_bk-inline-py: var(--bk-input-inline-pad-block, var(--bk-space-1));
50
51
  --_bk-inline-bw: var(--bk-field-border-width, var(--bk-border-width));
52
+ --_bk-input-inline-ctl: var(--bk-control-md);
53
+ --_bk-input-inline-pencil-gap: max(var(--bk-input-inline-gap, var(--bk-space-1)), calc(var(--_bk-inline-px) + var(--_bk-inline-bw)));
51
54
  }
55
+ :host([size="sm"]) { --_bk-input-inline-ctl: var(--bk-control-sm); }
56
+ :host([size="lg"]) { --_bk-input-inline-ctl: var(--bk-control-lg); }
52
57
  :host([size="sm"]) :is(.text, input) { font-size: var(--bk-type-small); }
53
58
  :host([size="lg"]) :is(.text, input) { font-size: var(--bk-type-lead); }
54
59
  /* One line, as tall in both: with line-height normal an input and a span measure their line differently. */
@@ -73,11 +78,8 @@ class BkInputInline extends LitElement {
73
78
  reach over the line by the same amount above and below instead of making the line taller, so the text stays. */
74
79
  .pencil {
75
80
  display: inline-flex;
76
- --_bk-input-inline-ctl: var(--bk-control-md);
77
81
  margin-block: min(0px, calc((1lh - var(--_bk-input-inline-ctl)) / 2));
78
82
  }
79
- :host([size="sm"]) .pencil { --_bk-input-inline-ctl: var(--bk-control-sm); }
80
- :host([size="lg"]) .pencil { --_bk-input-inline-ctl: var(--bk-control-lg); }
81
83
  .pencil { opacity: 0; transition: opacity var(--bk-duration-fast); }
82
84
  /* The pencil reaches over the line: its focus ring goes inside it, so it does not touch the text around. */
83
85
  .pencil bk-button { --bk-button-focus-offset: var(--bk-focus-offset-inset); }
@@ -126,8 +128,9 @@ class BkInputInline extends LitElement {
126
128
  pointer. The check of the open field stands in the same place. With a slotted editor the check and the cancel
127
129
  button stay in the row. */
128
130
  @media (hover: hover) and (forced-colors: none) {
131
+ /* The host leaves room for the pencil in its container: a full line does not push the pencil out of it. */
132
+ :host { max-width: calc(100% - var(--_bk-input-inline-pencil-gap) - var(--_bk-input-inline-ctl)); }
129
133
  :is(.text, .display, .edit:not(.slotted)) + .pencil {
130
- --_bk-input-inline-pencil-gap: max(var(--bk-input-inline-gap, var(--bk-space-1)), calc(var(--_bk-inline-px) + var(--_bk-inline-bw)));
131
134
  position: relative; z-index: 1; flex: none;
132
135
  inline-size: calc(var(--_bk-input-inline-pencil-gap) + var(--_bk-input-inline-ctl));
133
136
  margin-inline: calc(-1 * var(--bk-input-inline-gap, var(--bk-space-1))) calc(-1 * (var(--_bk-input-inline-pencil-gap) + var(--_bk-input-inline-ctl)));
@@ -304,11 +307,24 @@ class BkInputInline extends LitElement {
304
307
  return;
305
308
  this.edit();
306
309
  };
307
- /** A press outside the element cancels; a save in progress stays. Tab out keeps the field open. */
310
+ /** A press outside the element saves; a save in progress stays. */
308
311
  onOutside = (e) => {
309
312
  if (this.busy || e.composedPath().includes(this))
310
313
  return;
311
- this.cancel();
314
+ this.save();
315
+ };
316
+ /**
317
+ * Focus that leaves the element (Tab, Shift+Tab) saves. Focus that moves inside it (the check, the popup of a control)
318
+ * does not. Without a new target (the window loses the focus) the field stays open.
319
+ */
320
+ onFocusOut = (e) => {
321
+ if (!this.editing || this.busy)
322
+ return;
323
+ const next = e.relatedTarget;
324
+ if (!next || next === this || this.contains(next) || this.renderRoot?.contains(next))
325
+ return;
326
+ this.save();
327
+ this.restoreFocus = false;
312
328
  };
313
329
  disconnectedCallback() {
314
330
  super.disconnectedCallback();
@@ -6,6 +6,7 @@ import { emit } from "../internal/events.js";
6
6
  import { parseNumber, snapToStep, stepDecimals, stepFormat } from "../internal/number.js";
7
7
  import { TextField } from "../internal/text-field.js";
8
8
  import "./bk-icon.js";
9
+ import { submitImplicitly } from "../internal/submit.js";
9
10
  import "../icons/set/add.js";
10
11
  import "../icons/set/remove.js";
11
12
  class BkInputNumber extends TextField {
@@ -301,7 +302,7 @@ class BkInputNumber extends TextField {
301
302
  case "Enter":
302
303
  this.commitText(true);
303
304
  if (this.internals.form)
304
- setTimeout(() => this.internals.form?.requestSubmit());
305
+ setTimeout(() => submitImplicitly(this.internals.form));
305
306
  return;
306
307
  default:
307
308
  return;
@@ -98,7 +98,7 @@ export declare function clauseText(c: SearchClause): string;
98
98
  * @cssprop --bk-input-search-input-min-width - Narrowest text field next to the tokens before it wraps (default 6ch).
99
99
  * @cssprop --bk-input-search-popup-bg - Popup background (default --bk-layer-overlay-bg).
100
100
  * @cssprop --bk-input-search-popup-border - Popup border colour (default --bk-layer-overlay-border).
101
- * @cssprop --bk-input-search-popup-radius - Popup corner radius (default --bk-radius-md).
101
+ * @cssprop --bk-input-search-popup-radius - Popup corner radius (default --bk-row-radius + the padding + the border: concentric with the rows).
102
102
  * @cssprop --bk-input-search-popup-shadow - Popup shadow (default --bk-layer-overlay-shadow).
103
103
  * @cssprop --bk-input-search-popup-padding - Space between popup edge and rows (default --bk-space-1).
104
104
  * @cssprop --bk-input-search-popup-offset - Gap between box and popup (default --bk-space-1).
@@ -8,6 +8,7 @@ import { edgeOption, matchesText } from "../internal/options.js";
8
8
  import "./bk-chip.js";
9
9
  import "./bk-icon.js";
10
10
  import "./bk-spinner.js";
11
+ import { submitImplicitly } from "../internal/submit.js";
11
12
  import "../icons/set/search.js";
12
13
  function splitWords(text) {
13
14
  return text.match(/(?:[^\s"]|"[^"]*"?)+/g) ?? [];
@@ -299,7 +300,7 @@ class BkInputSearch extends ChoiceField {
299
300
  const go = emitDetail(this, "search", detail, true);
300
301
  const form = this.internals.form;
301
302
  if (go && form)
302
- setTimeout(() => form.requestSubmit());
303
+ setTimeout(() => submitImplicitly(form));
303
304
  }
304
305
  /* ---------- events ---------- */
305
306
  onInput(e) {