@bk2k/ui 0.6.7 → 0.6.8

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 (226) hide show
  1. package/BUILDING.md +32 -0
  2. package/CHANGELOG.md +57 -0
  3. package/USAGE.md +14 -8
  4. package/custom-elements.json +1 -1
  5. package/dist/charts/frame.d.ts +2 -0
  6. package/dist/charts/frame.js +2 -1
  7. package/dist/components/bk-button.d.ts +18 -3
  8. package/dist/components/bk-button.js +19 -8
  9. package/dist/components/bk-chart-bar.d.ts +46 -9
  10. package/dist/components/bk-chart-bar.js +127 -37
  11. package/dist/components/bk-combobox.d.ts +29 -5
  12. package/dist/components/bk-combobox.js +61 -19
  13. package/dist/components/bk-dialog.d.ts +4 -1
  14. package/dist/components/bk-dialog.js +6 -2
  15. package/dist/components/bk-facts-item.js +8 -6
  16. package/dist/components/bk-facts.d.ts +6 -4
  17. package/dist/components/bk-facts.js +19 -8
  18. package/dist/components/bk-input-time-zone.d.ts +3 -0
  19. package/dist/components/bk-model-viewer.d.ts +12 -1
  20. package/dist/components/bk-model-viewer.js +15 -2
  21. package/dist/components/bk-period-nav.d.ts +102 -0
  22. package/dist/components/bk-period-nav.js +69 -0
  23. package/dist/components/bk-select.js +2 -1
  24. package/dist/components/bk-shell-app.d.ts +3 -2
  25. package/dist/components/bk-shell-app.js +16 -3
  26. package/dist/components/bk-sortable.d.ts +3 -0
  27. package/dist/components/bk-sortable.js +3 -0
  28. package/dist/components/bk-split.d.ts +3 -0
  29. package/dist/components/bk-split.js +3 -0
  30. package/dist/components/bk-table.d.ts +16 -12
  31. package/dist/components/bk-table.js +96 -14
  32. package/dist/i18n/de.js +7 -0
  33. package/dist/i18n.d.ts +7 -0
  34. package/dist/i18n.js +7 -0
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +1 -0
  37. package/dist/internal/cloak.d.ts +3 -0
  38. package/dist/internal/cloak.js +4 -0
  39. package/dist/internal/handle-menu.d.ts +2 -3
  40. package/dist/internal/handle-menu.js +14 -3
  41. package/dist/internal/late.d.ts +15 -0
  42. package/dist/internal/late.js +30 -0
  43. package/dist/jsx.d.ts +36 -5
  44. package/dist/standalone/all.js +119 -118
  45. package/dist/standalone/bk-action-bar.js +1 -1
  46. package/dist/standalone/bk-alert-offline.js +1 -1
  47. package/dist/standalone/bk-alert.js +1 -1
  48. package/dist/standalone/bk-attachment.js +1 -1
  49. package/dist/standalone/bk-avatar-group.js +1 -1
  50. package/dist/standalone/bk-avatar.js +1 -1
  51. package/dist/standalone/bk-breadcrumbs.js +1 -1
  52. package/dist/standalone/bk-button-copy.js +2 -2
  53. package/dist/standalone/bk-button-group.js +2 -2
  54. package/dist/standalone/bk-button-share.js +2 -2
  55. package/dist/standalone/bk-button-top.js +1 -1
  56. package/dist/standalone/bk-button.js +15 -7
  57. package/dist/standalone/bk-calendar-week.js +1 -1
  58. package/dist/standalone/bk-calendar.js +1 -1
  59. package/dist/standalone/bk-card.js +1 -1
  60. package/dist/standalone/bk-carousel-controls.js +2 -2
  61. package/dist/standalone/bk-carousel.js +1 -1
  62. package/dist/standalone/bk-chart-bar-list.js +3 -3
  63. package/dist/standalone/bk-chart-bar.js +164 -105
  64. package/dist/standalone/bk-chart-bridge.js +4 -4
  65. package/dist/standalone/bk-chart-bullet.js +3 -3
  66. package/dist/standalone/bk-chart-calendar.js +4 -4
  67. package/dist/standalone/bk-chart-heatmap.js +4 -4
  68. package/dist/standalone/bk-chart-histogram.js +2 -2
  69. package/dist/standalone/bk-chart-legend.js +3 -3
  70. package/dist/standalone/bk-chart-line.js +5 -5
  71. package/dist/standalone/bk-chart-scatter.js +3 -3
  72. package/dist/standalone/bk-chart-sparkline.js +3 -3
  73. package/dist/standalone/bk-chart-stacked-bar.js +4 -4
  74. package/dist/standalone/bk-chart-tracker.js +3 -3
  75. package/dist/standalone/bk-chart-waterfall.js +2 -2
  76. package/dist/standalone/bk-checkbox-group.js +2 -2
  77. package/dist/standalone/bk-checkbox.js +1 -1
  78. package/dist/standalone/bk-chip-group.js +2 -2
  79. package/dist/standalone/bk-chip.js +2 -2
  80. package/dist/standalone/bk-code-diff.js +1 -1
  81. package/dist/standalone/bk-code-stack.js +2 -2
  82. package/dist/standalone/bk-code.js +2 -2
  83. package/dist/standalone/bk-color-panel.js +2 -2
  84. package/dist/standalone/bk-columns.js +1 -1
  85. package/dist/standalone/bk-combobox.js +49 -30
  86. package/dist/standalone/bk-command-menu.js +2 -2
  87. package/dist/standalone/bk-command-palette.js +3 -3
  88. package/dist/standalone/bk-composer.js +2 -2
  89. package/dist/standalone/bk-delta.js +1 -1
  90. package/dist/standalone/bk-diagram.js +1 -1
  91. package/dist/standalone/bk-dialog.js +1 -1
  92. package/dist/standalone/bk-drawer.js +2 -2
  93. package/dist/standalone/bk-error-summary.js +1 -1
  94. package/dist/standalone/bk-facts-item.js +8 -6
  95. package/dist/standalone/bk-facts.js +19 -8
  96. package/dist/standalone/bk-fieldset.js +1 -1
  97. package/dist/standalone/bk-filter-bar.js +1 -1
  98. package/dist/standalone/bk-folder-browser.js +1 -1
  99. package/dist/standalone/bk-form-guard.js +1 -1
  100. package/dist/standalone/bk-form-steps.js +1 -1
  101. package/dist/standalone/bk-image-compare.js +1 -1
  102. package/dist/standalone/bk-image-crop.js +2 -2
  103. package/dist/standalone/bk-image-editor.js +2 -1
  104. package/dist/standalone/bk-image-viewer.js +1 -1
  105. package/dist/standalone/bk-input-code.js +2 -2
  106. package/dist/standalone/bk-input-color.js +1 -1
  107. package/dist/standalone/bk-input-date-range.js +2 -2
  108. package/dist/standalone/bk-input-date.js +1 -1
  109. package/dist/standalone/bk-input-file.js +2 -2
  110. package/dist/standalone/bk-input-group.js +2 -2
  111. package/dist/standalone/bk-input-inline.js +2 -2
  112. package/dist/standalone/bk-input-number.js +2 -2
  113. package/dist/standalone/bk-input-rating.js +2 -2
  114. package/dist/standalone/bk-input-rich.js +1 -1
  115. package/dist/standalone/bk-input-search.js +1 -1
  116. package/dist/standalone/bk-input-slider-range.js +2 -2
  117. package/dist/standalone/bk-input-slider.js +2 -2
  118. package/dist/standalone/bk-input-text.js +1 -1
  119. package/dist/standalone/bk-input-time.js +3 -3
  120. package/dist/standalone/bk-item.js +1 -1
  121. package/dist/standalone/bk-kbd-shortcuts.js +1 -1
  122. package/dist/standalone/bk-kbd.js +1 -1
  123. package/dist/standalone/bk-lightbox.js +2 -2
  124. package/dist/standalone/bk-listbox-columns.js +2 -2
  125. package/dist/standalone/bk-listbox-search.js +3 -3
  126. package/dist/standalone/bk-listbox-transfer.js +3 -3
  127. package/dist/standalone/bk-listbox.js +2 -2
  128. package/dist/standalone/bk-logo.js +1 -1
  129. package/dist/standalone/bk-menu-bar.js +1 -1
  130. package/dist/standalone/bk-menu-item.js +1 -1
  131. package/dist/standalone/bk-menu-list.js +1 -1
  132. package/dist/standalone/bk-menu.js +2 -2
  133. package/dist/standalone/bk-message-approval.js +1 -1
  134. package/dist/standalone/bk-message-branches.js +1 -1
  135. package/dist/standalone/bk-message-citation.js +1 -1
  136. package/dist/standalone/bk-message-feedback.js +1 -1
  137. package/dist/standalone/bk-message-list.js +1 -1
  138. package/dist/standalone/bk-message-reasoning.js +1 -1
  139. package/dist/standalone/bk-message-source.js +1 -1
  140. package/dist/standalone/bk-message-tool-group.js +1 -1
  141. package/dist/standalone/bk-message-tool.js +1 -1
  142. package/dist/standalone/bk-message.js +1 -1
  143. package/dist/standalone/bk-meter.js +1 -1
  144. package/dist/standalone/bk-model-viewer.js +1 -1
  145. package/dist/standalone/bk-nav-group.js +1 -1
  146. package/dist/standalone/bk-nav-item.js +1 -1
  147. package/dist/standalone/bk-nav-toc.js +1 -1
  148. package/dist/standalone/bk-nav.js +1 -1
  149. package/dist/standalone/bk-overflow.js +1 -1
  150. package/dist/standalone/bk-page-footer.js +1 -1
  151. package/dist/standalone/bk-page-pager.js +1 -1
  152. package/dist/standalone/bk-pagination.js +1 -1
  153. package/dist/standalone/bk-pane.js +1 -1
  154. package/dist/standalone/bk-panel.js +1 -1
  155. package/dist/standalone/bk-period-nav.js +69 -0
  156. package/dist/standalone/bk-picture.js +1 -1
  157. package/dist/standalone/bk-popover-help.js +1 -1
  158. package/dist/standalone/bk-popover.js +1 -1
  159. package/dist/standalone/bk-preview.js +1 -1
  160. package/dist/standalone/bk-progress.js +1 -1
  161. package/dist/standalone/bk-qr-code.js +1 -1
  162. package/dist/standalone/bk-radio-group.js +2 -2
  163. package/dist/standalone/bk-radio.js +1 -1
  164. package/dist/standalone/bk-rating.js +1 -1
  165. package/dist/standalone/bk-scroll.js +1 -1
  166. package/dist/standalone/bk-segmented.js +2 -2
  167. package/dist/standalone/bk-select-cascade.js +1 -1
  168. package/dist/standalone/bk-select-tree.js +1 -1
  169. package/dist/standalone/bk-select.js +3 -2
  170. package/dist/standalone/bk-shell-app.js +42 -38
  171. package/dist/standalone/bk-shell-sites.js +1 -1
  172. package/dist/standalone/bk-sortable.js +7 -4
  173. package/dist/standalone/bk-split-grid.js +1 -1
  174. package/dist/standalone/bk-split.js +7 -4
  175. package/dist/standalone/bk-stat.js +2 -2
  176. package/dist/standalone/bk-steps-item.js +1 -1
  177. package/dist/standalone/bk-swatch-group.js +2 -2
  178. package/dist/standalone/bk-switch.js +2 -2
  179. package/dist/standalone/bk-table.js +130 -80
  180. package/dist/standalone/bk-tabs-item.js +1 -1
  181. package/dist/standalone/bk-tabs.js +1 -1
  182. package/dist/standalone/bk-tasks-item.js +1 -1
  183. package/dist/standalone/bk-text.js +1 -1
  184. package/dist/standalone/bk-time-countdown.js +1 -1
  185. package/dist/standalone/bk-time-relative.js +1 -1
  186. package/dist/standalone/bk-timeline-item.js +1 -1
  187. package/dist/standalone/bk-toast-group.js +1 -1
  188. package/dist/standalone/bk-toast.js +1 -1
  189. package/dist/standalone/bk-tooltip.js +1 -1
  190. package/dist/standalone/bk-tree-item.js +2 -2
  191. package/dist/standalone/bk-video.js +1 -1
  192. package/dist/standalone/bk-zoom.js +3 -3
  193. package/dist/standalone/chunks/{bk-alert-offline-BoMEYxnE.js → bk-alert-offline-B1bQxOZp.js} +1 -1
  194. package/dist/standalone/chunks/{bk-carousel-B7-9OanA.js → bk-carousel-BCwIQhG5.js} +1 -1
  195. package/dist/standalone/chunks/{bk-diagram-CpOpicmo.js → bk-diagram-DWK8CvRZ.js} +2 -2
  196. package/dist/standalone/chunks/{bk-dialog-a2BtUBf2.js → bk-dialog-DX0cPJ1o.js} +7 -3
  197. package/dist/standalone/chunks/{bk-image-editor-z_Uj83fy.js → bk-image-editor-DXEj9gCu.js} +1 -1
  198. package/dist/standalone/chunks/{bk-input-date-range-BQkbPlSJ.js → bk-input-date-range-Cbx_lpf0.js} +1 -1
  199. package/dist/standalone/chunks/{bk-input-rich-Dte_b4Ev.js → bk-input-rich-ZB68vziu.js} +3 -3
  200. package/dist/standalone/chunks/{bk-input-text-CUNQG1ah.js → bk-input-text-DD32uWNO.js} +1 -1
  201. package/dist/standalone/chunks/{bk-kbd-B7bz8hmV.js → bk-kbd-B_TlKzWj.js} +1 -1
  202. package/dist/standalone/chunks/{bk-model-viewer-D1XJPgAG.js → bk-model-viewer-Dr81ahVv.js} +19 -5
  203. package/dist/standalone/chunks/{bk-qr-code-CbI9rdOK.js → bk-qr-code-QaYvZwOR.js} +1 -1
  204. package/dist/standalone/chunks/{bk-toast-group-Cix-Urgi.js → bk-toast-group-BSeO_rPs.js} +1 -1
  205. package/dist/standalone/chunks/{choice-field-BnuK9mp_.js → choice-field-CGvE4tyb.js} +1 -1
  206. package/dist/standalone/chunks/{clipboard-DBGdJ-1S.js → clipboard-BKlrP5rj.js} +1 -28
  207. package/dist/standalone/chunks/clipboard-Crzt1Sh9.js +29 -0
  208. package/dist/standalone/chunks/{date-field-BQ5k-DDL.js → date-field-BlI6grfT.js} +2 -2
  209. package/dist/standalone/chunks/{form-control-D7dqSP9M.js → form-control-CyXQIJ2x.js} +1 -1
  210. package/dist/standalone/chunks/{frame-BW1nKuoM.js → frame-abXBnl8a.js} +3 -1
  211. package/dist/standalone/chunks/handle-menu-ZVR_msk2.js +49 -0
  212. package/dist/standalone/chunks/{i18n-CNsBRNPu.js → i18n-B6Al9xCK.js} +7 -0
  213. package/dist/standalone/chunks/{i18n-CrZgrRu9.js → i18n-BI16HQmm.js} +1 -1
  214. package/dist/standalone/chunks/{marks-CdqbbJpM.js → marks-0kbeB4n8.js} +2 -2
  215. package/dist/standalone/chunks/{popover-base-oDhxsYMr.js → popover-base-ac49G87f.js} +1 -1
  216. package/dist/standalone/chunks/{ramp-EclrETaQ.js → ramp-ggoyjMvC.js} +1 -1
  217. package/dist/standalone/chunks/{summary-BwL-Gp8w.js → summary-BK-B4m5A.js} +1 -1
  218. package/dist/standalone/chunks/{text-field-CTp2b-Ai.js → text-field-4IUUpRHE.js} +2 -2
  219. package/dist/standalone/chunks/{toggle-control-DXkgmz7R.js → toggle-control-ioV2jhNY.js} +1 -1
  220. package/dist/standalone/confirm.js +3 -3
  221. package/dist/standalone/i18n-de.js +8 -1
  222. package/dist/standalone/toast.js +1 -1
  223. package/dist/standalone/tokens.css +4 -1
  224. package/dist/tokens.css +4 -1
  225. package/package.json +1 -1
  226. package/dist/standalone/chunks/handle-menu-DsxWvv4D.js +0 -22
@@ -38,8 +38,11 @@ type Row = ComboboxOption & {
38
38
  * `usage: "search"`: "zurich" finds "Zürich", but in Swedish "a" does not find "å"). It needs every typed word. `filter` replaces it.
39
39
  * - **Async**: set `search` to `async (query, signal) => options`. It runs debounced (`debounce`
40
40
  * ms) when the query changes and when the list opens. Its result replaces the options. The combobox aborts outdated
41
- * calls, and a spinner row shows while it runs. Apps that load options themselves
42
- * set `loading` and `options`.
41
+ * calls. The list is busy (`aria-busy`) from the keystroke until the search for the newest query ends, and it shows
42
+ * the empty row only for a query that a search answered. The spinner row waits for `--bk-loading-delay` and stays at
43
+ * least `--bk-loading-min`. In search mode, `options` and `<option>` children give the labels of the current value
44
+ * (for example a value from the server), but the list shows only the results. Apps that load options themselves set
45
+ * `loading` and `options`.
43
46
  * - **Custom rows**: `renderOption` draws the label part of each row, `(option, label) => html\`…\``, as in
44
47
  * `<bk-listbox>`. `label` is the label with the matched text marked. The row keeps its role, id, marks and keys.
45
48
  * The filter matches the `label` text, and the field shows the label text. The "Add" row of `allow-custom` keeps its text.
@@ -265,6 +268,9 @@ export declare class BkCombobox extends ChoiceField {
265
268
  text: {
266
269
  state: boolean;
267
270
  };
271
+ searching: {
272
+ state: boolean;
273
+ };
268
274
  };
269
275
  /** Shows the value, but the user cannot change it. */
270
276
  readonly: boolean;
@@ -281,7 +287,7 @@ export declare class BkCombobox extends ChoiceField {
281
287
  max: number | undefined;
282
288
  /** Label of the Enter key on a phone keyboard, like the native `enterkeyhint`: `enter`, `done`, `go`, `next`, `previous`, `search`, `send`. */
283
289
  enterKeyHint: string;
284
- /** Shows the loading row in the list. Set by `search` while it runs; apps that load options themselves set it too. */
290
+ /** Shows the loading row in the list. The combobox sets it while `search` runs; apps that load options themselves set it too. */
285
291
  loading: boolean;
286
292
  /** Async option provider, see the class description. */
287
293
  search: ComboboxSearch | undefined;
@@ -298,6 +304,14 @@ export declare class BkCombobox extends ChoiceField {
298
304
  private results;
299
305
  /** Content of the text field. */
300
306
  private text;
307
+ /** A search is scheduled or runs: from the keystroke until the search for the newest query ends. */
308
+ private searching;
309
+ /** The query of the last search that ended (undefined before the first one). */
310
+ private searched?;
311
+ /** The label that the field put in the text. Other text is typed text, and new options do not replace it. */
312
+ private shownLabel;
313
+ /** The spinner row: it waits for `--bk-loading-delay` and stays at least `--bk-loading-min`. */
314
+ private loader;
301
315
  /** Options that pass the filter, in list order (indexes of `activeIndex`). */
302
316
  private visible;
303
317
  /** Labels of values that the user chose earlier, also when the option list has changed since then (async results). */
@@ -311,13 +325,17 @@ export declare class BkCombobox extends ChoiceField {
311
325
  protected get leadIcon(): string | undefined;
312
326
  /** A search combobox always has the clear button. */
313
327
  protected get hasClear(): boolean;
314
- /** All options: the `search` results if a provider is set, else the children, else `options`. */
328
+ /** All options: the `search` results if a provider is set, else the children, else `options`. In search mode, the children and `options` give only labels (`labelOf`). */
315
329
  get allOptions(): ComboboxOption[];
316
330
  protected get rows(): Row[];
317
331
  disconnectedCallback(): void;
332
+ /** The list waits for options: a search is scheduled or runs, or the app set `loading`. */
333
+ private get busy();
318
334
  static styles: import("lit").CSSResultGroup[];
319
335
  protected get control(): HTMLInputElement | null;
320
336
  protected resetValue(): void;
337
+ /** Puts the label of the value in the text field. */
338
+ private showLabel;
321
339
  protected get changeable(): boolean;
322
340
  /** There is typed text or a chosen value: the clear button of `clearable` shows. */
323
341
  protected get filled(): boolean;
@@ -328,6 +346,7 @@ export declare class BkCombobox extends ChoiceField {
328
346
  showPicker(): void;
329
347
  /** Opens the list; `move` 1 highlights the chosen or first option, -1 the last, 0 the chosen one only. */
330
348
  private openList;
349
+ /** The label of value `v`. In search mode, the children and `options` give the label of a value that no result has. */
331
350
  protected labelOf(v: string): string;
332
351
  private remember;
333
352
  private get maxed();
@@ -358,7 +377,12 @@ export declare class BkCombobox extends ChoiceField {
358
377
  private onFocusOut;
359
378
  private onBoxClick;
360
379
  private onTagRemove;
361
- /** Something to show: options, the loading row, or the empty row. */
380
+ /**
381
+ * The empty row shows: no option matches the query, and the answer is complete. With `search`, a search for this
382
+ * query has ended. Before that, the list is busy and shows no empty row.
383
+ */
384
+ private get noResults();
385
+ /** Something to show: options, the spinner row, or the empty row. */
362
386
  private get hasContent();
363
387
  protected get popupShown(): boolean;
364
388
  /** The label with the matched text marked, in the app's `renderOption` when it has one. The "Add" row keeps its text. */
@@ -4,6 +4,7 @@ import { live } from "lit/directives/live.js";
4
4
  import { ChoiceField, choiceFieldStyles } from "../internal/choice-field.js";
5
5
  import { define } from "../internal/define.js";
6
6
  import { emitToggle } from "../internal/events.js";
7
+ import { LoadingController } from "../internal/loading.js";
7
8
  import { edgeOption, matchRanges, sameText } from "../internal/options.js";
8
9
  import "./bk-chip.js";
9
10
  import "./bk-icon.js";
@@ -29,8 +30,15 @@ class BkCombobox extends ChoiceField {
29
30
  open: { type: Boolean, reflect: true },
30
31
  query: { state: true },
31
32
  results: { state: true },
32
- text: { state: true }
33
+ text: { state: true },
34
+ searching: { state: true }
33
35
  };
36
+ /** The query of the last search that ended (undefined before the first one). */
37
+ searched;
38
+ /** The label that the field put in the text. Other text is typed text, and new options do not replace it. */
39
+ shownLabel = "";
40
+ /** The spinner row: it waits for `--bk-loading-delay` and stays at least `--bk-loading-min`. */
41
+ loader = new LoadingController(this);
34
42
  /** Options that pass the filter, in list order (indexes of `activeIndex`). */
35
43
  visible = [];
36
44
  /** Labels of values that the user chose earlier, also when the option list has changed since then (async results). */
@@ -53,6 +61,7 @@ class BkCombobox extends ChoiceField {
53
61
  this.query = "";
54
62
  this.results = [];
55
63
  this.text = "";
64
+ this.searching = false;
56
65
  }
57
66
  /** A search combobox shows a magnifier unless it has its own `icon`; `icon=""` shows none. */
58
67
  get leadIcon() {
@@ -62,7 +71,7 @@ class BkCombobox extends ChoiceField {
62
71
  get hasClear() {
63
72
  return this.clearable || this.type === "search";
64
73
  }
65
- /** All options: the `search` results if a provider is set, else the children, else `options`. */
74
+ /** All options: the `search` results if a provider is set, else the children, else `options`. In search mode, the children and `options` give only labels (`labelOf`). */
66
75
  get allOptions() {
67
76
  return this.search ? this.results : super.allOptions;
68
77
  }
@@ -73,6 +82,14 @@ class BkCombobox extends ChoiceField {
73
82
  super.disconnectedCallback();
74
83
  clearTimeout(this.timer);
75
84
  this.controller?.abort();
85
+ if (this.searching) {
86
+ this.searching = false;
87
+ this.loading = false;
88
+ }
89
+ }
90
+ /** The list waits for options: a search is scheduled or runs, or the app set `loading`. */
91
+ get busy() {
92
+ return this.loading || this.searching;
76
93
  }
77
94
  static styles = [...choiceFieldStyles("combobox"), css`
78
95
  :host { --_bk-text-field-font-size: var(--bk-combobox-font-size); }
@@ -108,7 +125,14 @@ class BkCombobox extends ChoiceField {
108
125
  resetValue() {
109
126
  super.resetValue();
110
127
  this.query = "";
111
- this.text = this.multiple ? "" : this.labelOf(this.value);
128
+ if (this.multiple)
129
+ this.text = "";
130
+ else
131
+ this.showLabel();
132
+ }
133
+ /** Puts the label of the value in the text field. */
134
+ showLabel() {
135
+ this.text = this.shownLabel = this.labelOf(this.value);
112
136
  }
113
137
  get changeable() {
114
138
  return super.changeable && !this.readonly;
@@ -147,8 +171,10 @@ class BkCombobox extends ChoiceField {
147
171
  this.activeIndex = chosen >= 0 && move >= 0 ? chosen : move === 0 ? -1 : edgeOption(this.visible, move);
148
172
  }
149
173
  /* ---------- data ---------- */
174
+ /** The label of value `v`. In search mode, the children and `options` give the label of a value that no result has. */
150
175
  labelOf(v) {
151
- return this.allOptions.find((o) => o.value === v)?.label ?? this.labelCache.get(v) ?? v;
176
+ const find = (list) => list.find((o) => o.value === v)?.label;
177
+ return find(this.allOptions) ?? this.labelCache.get(v) ?? (this.search ? find(super.allOptions) : void 0) ?? v;
152
178
  }
153
179
  remember(o) {
154
180
  this.labelCache.set(o.value, o.label);
@@ -176,7 +202,7 @@ class BkCombobox extends ChoiceField {
176
202
  }
177
203
  if (this.maxed)
178
204
  list = list.map((o) => this.selection.includes(o.value) || o.disabled ? o : { ...o, disabled: true });
179
- if (this.allowCustom && q && !this.maxed && !this.loading && !this.resolve(q) && !this.selection.includes(q)) {
205
+ if (this.allowCustom && q && !this.maxed && !this.busy && !this.resolve(q) && !this.selection.includes(q)) {
180
206
  const label = this.addLabel ? this.addLabel.replaceAll("{query}", q) : this.i18n.t("comboboxAdd", { query: q });
181
207
  list = [...list, { value: q, label, icon: "add", custom: true }];
182
208
  }
@@ -196,14 +222,15 @@ class BkCombobox extends ChoiceField {
196
222
  this.close();
197
223
  }
198
224
  super.willUpdate(changed);
199
- const optionsChanged = changed.has("options") || changed.has("childOptions") || changed.has("results");
225
+ const optionsChanged = changed.has("options") || changed.has("childOptions") || changed.has("results") || changed.has("search");
200
226
  if (optionsChanged) {
201
227
  for (const o of this.allOptions)
202
228
  if (this.selection.includes(o.value))
203
229
  this.remember(o);
204
230
  }
205
- if (!this.multiple && (changed.has("value") || changed.has("values") || optionsChanged && !this.query))
206
- this.text = this.labelOf(this.value);
231
+ if (!this.multiple && (changed.has("value") || changed.has("values") || optionsChanged && this.text === this.shownLabel))
232
+ this.showLabel();
233
+ this.loader.set(this.busy);
207
234
  this.visible = this.computeVisible();
208
235
  if (this.activeIndex >= this.visible.length)
209
236
  this.activeIndex = -1;
@@ -216,8 +243,12 @@ class BkCombobox extends ChoiceField {
216
243
  scheduleSearch() {
217
244
  clearTimeout(this.timer);
218
245
  this.controller?.abort();
219
- if (!this.search)
246
+ if (!this.search) {
247
+ if (this.searching)
248
+ this.searching = this.loading = false;
220
249
  return;
250
+ }
251
+ this.searching = true;
221
252
  this.loading = true;
222
253
  const q = this.query.trim();
223
254
  this.timer = setTimeout(() => this.runSearch(q), Math.max(0, this.debounce));
@@ -234,6 +265,8 @@ class BkCombobox extends ChoiceField {
234
265
  return;
235
266
  this.results = [];
236
267
  }
268
+ this.searched = q;
269
+ this.searching = false;
237
270
  this.loading = false;
238
271
  if (this.expanded && this.query.trim() && !this.allowCustom)
239
272
  this.activeIndex = edgeOption(this.computeVisible(), 1);
@@ -333,7 +366,7 @@ class BkCombobox extends ChoiceField {
333
366
  this.commit([t]);
334
367
  this.text = t;
335
368
  } else
336
- this.text = this.labelOf(this.value);
369
+ this.showLabel();
337
370
  }
338
371
  removeValue(v) {
339
372
  if (this.isDisabled || this.readonly)
@@ -459,9 +492,17 @@ class BkCombobox extends ChoiceField {
459
492
  this.control?.focus();
460
493
  }
461
494
  /* ---------- popup ---------- */
462
- /** Something to show: options, the loading row, or the empty row. */
495
+ /**
496
+ * The empty row shows: no option matches the query, and the answer is complete. With `search`, a search for this
497
+ * query has ended. Before that, the list is busy and shows no empty row.
498
+ */
499
+ get noResults() {
500
+ const q = this.query.trim();
501
+ return !this.busy && !this.visible.length && !!q && !this.allowCustom && (!this.search || this.searched === q);
502
+ }
503
+ /** Something to show: options, the spinner row, or the empty row. */
463
504
  get hasContent() {
464
- return this.loading || this.visible.length > 0 || !!this.query.trim() && !this.allowCustom;
505
+ return this.loader.visible || this.visible.length > 0 || this.noResults;
465
506
  }
466
507
  get popupShown() {
467
508
  return this.expanded && this.hasContent;
@@ -497,15 +538,15 @@ class BkCombobox extends ChoiceField {
497
538
  get announcement() {
498
539
  if (!this.expanded)
499
540
  return "";
500
- if (this.loading)
501
- return this.i18n.t("comboboxLoading");
541
+ if (this.busy)
542
+ return this.loader.visible ? this.i18n.t("comboboxLoading") : "";
502
543
  if (!this.query.trim())
503
544
  return "";
504
545
  const count = this.visible.filter((o) => !o.custom).length;
505
546
  const add = this.visible.find((o) => o.custom);
506
547
  if (!count && add)
507
548
  return add.label;
508
- return count ? this.i18n.t("comboboxResults", { count }) : this.allowCustom ? "" : this.emptyText || this.i18n.t("comboboxNoResults");
549
+ return count ? this.i18n.t("comboboxResults", { count }) : this.noResults ? this.emptyText || this.i18n.t("comboboxNoResults") : "";
509
550
  }
510
551
  render() {
511
552
  const invalid = this.showInvalid;
@@ -515,8 +556,9 @@ class BkCombobox extends ChoiceField {
515
556
  const name = this.label ? void 0 : this.forwardedName;
516
557
  const expanded = this.popupShown;
517
558
  const opts = this.visible;
518
- const empty = !this.loading && !opts.length && !!this.query.trim() && !this.allowCustom;
519
- const more = this.loading && opts.length > 0;
559
+ const busy = this.busy;
560
+ const empty = this.noResults;
561
+ const more = busy && opts.length > 0;
520
562
  return html`<div @focusout=${this.onFocusOut}>
521
563
  ${this.renderField(html`<div class="${this.boxClass}${tags ? " has-tags" : ""}${expanded ? " open" : ""}" part="box" @click=${this.onBoxClick}>
522
564
  ${this.renderStart()}
@@ -538,9 +580,9 @@ class BkCombobox extends ChoiceField {
538
580
  ${this.type === "search" ? nothing : html`<bk-icon class="chevron" part="chevron" name="chevron-down"></bk-icon>`}
539
581
  </div>`)}
540
582
  <div popover="manual" part="popup" @toggle=${this.onPopupToggle} @mousedown=${(e) => e.preventDefault()}>
541
- ${this.loading && !more ? html`<div class="status" part="status"><bk-spinner></bk-spinner>${this.i18n.t("comboboxLoading")}</div>` : nothing}
583
+ ${this.loader.visible && !opts.length && !empty ? html`<div class="status" part="status"><bk-spinner></bk-spinner>${this.i18n.t("comboboxLoading")}</div>` : nothing}
542
584
  <div role="listbox" part="listbox" id=${listId} aria-label=${this.label || name || this.i18n.t("options")}
543
- aria-multiselectable=${this.multiple ? "true" : nothing} aria-busy=${this.loading ? "true" : nothing}>
585
+ aria-multiselectable=${this.multiple ? "true" : nothing} aria-busy=${busy ? "true" : nothing}>
544
586
  ${this.renderRows(this.rowLabel, more)}
545
587
  </div>
546
588
  ${empty ? html`<div class="status" part="status">${this.emptyText || this.i18n.t("comboboxNoResults")}</div>` : nothing}
@@ -68,6 +68,9 @@ export interface DialogCloseDetail {
68
68
  *
69
69
  * i18n keys: `moveWindow`, `resizeWindow` (names of the two handles); `move-label` and `resize-label` override them.
70
70
  *
71
+ * In a dialog with a height (`size="full"` or `--bk-dialog-height`), the body takes the height that the header and the footer
72
+ * leave. Content with `block-size: 100%` fills it, for example `<bk-model-viewer fill>`. Taller content scrolls in the body.
73
+ *
71
74
  * @slot - Body content.
72
75
  * @slot header - Custom header content. It replaces `heading` and `description`.
73
76
  * @slot start - Leading content of the header, before the heading, for example a `<bk-icon-tile>` that shows what the dialog is about.
@@ -83,7 +86,7 @@ export interface DialogCloseDetail {
83
86
  * @csspart body - The body wrapper element.
84
87
  * @csspart footer - The footer row.
85
88
  * @cssprop --bk-dialog-width - Width (default from `size`: --bk-dialog-width-sm|md|lg).
86
- * @cssprop --bk-dialog-height - Height (default fit-content; a `bare` dialog that contains a viewer sets it).
89
+ * @cssprop --bk-dialog-height - Height (default fit-content; `size="full"` fills the viewport; a `bare` dialog that contains a viewer sets it).
87
90
  * @cssprop --bk-dialog-max-width - Maximum width (default the viewport minus --bk-space-4 on each side).
88
91
  * @cssprop --bk-dialog-max-height - Maximum height (default the viewport minus --bk-space-8 on each side).
89
92
  * @cssprop --bk-dialog-margin - Position in the viewport (default auto = centred).
@@ -157,6 +157,8 @@ class BkDialog extends LitElement {
157
157
  --_bk-dialog-row: max(var(--_bk-dialog-start, 0px), var(--_bk-dialog-lh));
158
158
  }
159
159
  .header.single .lead, .header.single .end { display: flex; align-items: center; flex: none; block-size: var(--_bk-dialog-row); }
160
+ /* An empty start slot takes no space and no gap: the heading starts on the edge of the body. */
161
+ .header .lead[hidden] { display: none; }
160
162
  .header.single .titles { padding-block-start: calc((var(--_bk-dialog-row) - var(--_bk-dialog-lh)) / 2); }
161
163
  .header.single .close { margin-block-start: 0; }
162
164
  .heading {
@@ -165,8 +167,10 @@ class BkDialog extends LitElement {
165
167
  }
166
168
  .desc { margin: 0; text-wrap-style: var(--bk-body-wrap); color: var(--bk-text-muted); font-size: var(--bk-type-body); line-height: var(--bk-line-height-body); }
167
169
  .close { margin: calc(-1 * var(--bk-space-1-5)) calc(-1 * var(--bk-space-2)) 0 0; }
170
+ /* The body takes the height that the header and the footer leave. In a dialog with a height (size="full",
171
+ --bk-dialog-height) that height is definite: content with block-size: 100% fills it, taller content scrolls. */
168
172
  .body {
169
- position: relative; flex: 1; overflow: auto; overscroll-behavior: contain; padding: var(--bk-dialog-gap, var(--bk-space-4)) var(--_bk-dialog-pad);
173
+ position: relative; flex: 1; min-block-size: 0; overflow: auto; overscroll-behavior: contain; padding: var(--bk-dialog-gap, var(--bk-space-4)) var(--_bk-dialog-pad);
170
174
  color: var(--bk-text-muted); font-size: var(--bk-type-body); line-height: var(--bk-line-height-body);
171
175
  }
172
176
  .footer {
@@ -552,7 +556,7 @@ class BkDialog extends LitElement {
552
556
  <div class="header ${hasHeader ? "" : "header-empty"} ${this.description || this.slots.has("header") ? "" : "single"}" part="header" @pointerdown=${this.onHeaderDown}>
553
557
  ${this.nonModal && !this.bare ? html`<bk-button variant="ghost" class="move" part="move" icon="drag-indicator" size="sm" label=${this.moveLabel || this.i18n.t("moveWindow")}
554
558
  aria-pressed=${this.placing === "move" ? "true" : "false"} @click=${this.onMoveClick} @keydown=${this.onMoveKey}></bk-button>` : nothing}
555
- <span class="lead"><slot name="start" @slotchange=${this.measureStart}></slot></span>
559
+ <span class="lead" ?hidden=${!this.slots.has("start")}><slot name="start" @slotchange=${this.measureStart}></slot></span>
556
560
  <div class="titles">
557
561
  <slot name="header">
558
562
  ${this.heading ? html`<div class="heading" id="heading" part="heading" role="heading" aria-level=${this.level}>${this.heading}</div>` : nothing}
@@ -15,18 +15,20 @@ class BkFactsItem extends LitElement {
15
15
  }
16
16
  static styles = [base, css`
17
17
  :host {
18
- display: var(--_bk-facts-display, grid); flex-wrap: wrap; align-content: start; min-width: 0;
19
- gap: var(--bk-facts-item-gap, var(--bk-space-1)) var(--_bk-facts-col-gap, 0px);
18
+ display: grid; align-content: start; min-width: 0;
19
+ row-gap: var(--bk-facts-item-gap, var(--bk-space-1)); grid-column: var(--_bk-facts-span, auto);
20
+ grid-template-columns: var(--_bk-facts-subgrid, none);
20
21
  padding-block: var(--_bk-facts-pad, 0px); align-items: baseline;
21
22
  }
22
23
  /* A long word (a German compound) breaks inside the label column: hyphens in the language of the page, else anywhere. */
23
- .label { flex: var(--_bk-facts-label-flex, none); min-inline-size: 0; hyphens: auto; overflow-wrap: anywhere; }
24
- .value { flex: var(--_bk-facts-value-flex, none); }
25
- .actions { flex: none; display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--bk-space-cluster); justify-self: start; }
24
+ .label { grid-area: var(--_bk-facts-label-area, auto); min-inline-size: 0; padding-inline-end: var(--_bk-facts-col-gap, 0px); hyphens: auto; overflow-wrap: anywhere; }
25
+ .actions { grid-area: var(--_bk-facts-actions-area, auto); display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--bk-space-cluster); justify-self: start; }
26
+ .actions:not([hidden]) { margin-inline-start: var(--_bk-facts-col-gap, 0px); }
26
27
  .actions[hidden] { display: none; }
28
+ :host([data-type="number"]) .value { text-align: end; font-variant-numeric: tabular-nums; }
27
29
  :host([wide]) { grid-column: 1 / -1; }
28
30
  .label { font-size: var(--bk-facts-item-label-size, var(--bk-label-size, var(--bk-text-xs))); font-weight: var(--bk-label-weight, inherit); text-transform: var(--bk-label-transform, none); letter-spacing: var(--bk-label-tracking, normal); line-height: var(--bk-line-height-heading); font-family: var(--bk-font-label, inherit); color: var(--bk-facts-item-label-fg, var(--bk-label-color, var(--bk-text-muted))); }
29
- .value { min-width: 0; font-size: var(--bk-facts-item-value-size, var(--bk-type-body)); line-height: var(--bk-line-height-body); color: var(--bk-facts-item-value-fg, var(--bk-text)); overflow-wrap: anywhere; }
31
+ .value { grid-area: var(--_bk-facts-value-area, auto); min-width: 0; font-size: var(--bk-facts-item-value-size, var(--bk-type-body)); line-height: var(--bk-line-height-body); color: var(--bk-facts-item-value-fg, var(--bk-text)); overflow-wrap: break-word; }
30
32
  `];
31
33
  slots = new SlotController(this);
32
34
  render() {
@@ -12,8 +12,10 @@ import { LitElement } from "lit";
12
12
  * ```
13
13
  *
14
14
  * With `layout="rows"` each fact is one line: label, value and the `actions` of the item at the inline end,
15
- * with a hairline between the rows (a summary list, "check your answers"). When a row is narrower than the label plus
16
- * `--bk-facts-rows-min`, the value moves below the label. Name each action with its row ("Change name"). A bare "Change" has no context.
15
+ * with a hairline between the rows (a summary list, "check your answers"). All rows share one label column, as wide as the widest label up to `--bk-facts-label-width`.
16
+ * In a list narrower than 24rem (a container query on the list, fixed because a query cannot read a token) the value moves
17
+ * below its label at full width, and the actions stay at the end of the label line.
18
+ * `data-type="number"` on an item aligns its value to the end with tabular figures. Name each action with its row ("Change name"). A bare "Change" has no context.
17
19
  *
18
20
  * ```html
19
21
  * <bk-facts layout="rows">
@@ -27,8 +29,8 @@ import { LitElement } from "lit";
27
29
  * @cssprop --bk-facts-min - Minimum column width (default 160px). The `min` attribute sets it.
28
30
  * @cssprop --bk-facts-gap-block - Space between rows (default --bk-space-4).
29
31
  * @cssprop --bk-facts-gap-inline - Space between columns (default --bk-space-5).
30
- * @cssprop --bk-facts-label-width - Width of the label column with `layout="rows"` (default 30%).
31
- * @cssprop --bk-facts-rows-min - Minimum width of a value with `layout="rows"`. Below this width the value moves under the label (default --bk-measure-min).
32
+ * @cssprop --bk-facts-label-width - Widest the label column gets with `layout="rows"` (default 60%). The column is as wide as the widest label, up to this width. A longer label wraps.
33
+ * @cssprop --bk-facts-rows-min - Width that the label column leaves for the value with `layout="rows"` (default --bk-measure-min). In a list wider than 24rem the label column shrinks to keep it.
32
34
  * @cssprop --bk-facts-row-gap - Space above and below the content of a row with `layout="rows"` (default --bk-space-3).
33
35
  * @cssprop --bk-facts-row-divider - Hairline between rows with `layout="rows"` (default --bk-line).
34
36
  *
@@ -14,23 +14,34 @@ class BkFacts extends LitElement {
14
14
  gap: var(--bk-facts-gap-block, var(--bk-space-4)) var(--bk-facts-gap-inline, var(--bk-space-5));
15
15
  grid-template-columns: repeat(auto-fit, minmax(min(var(--bk-facts-min, 160px), 100%), 1fr));
16
16
  }
17
- :host([layout="rows"]) { display: block; }
18
- /* Private variables inherit into the items; an item reads them to lay out its row. The value wraps below the label
19
- when the row is narrower than the label plus --bk-facts-rows-min. */
17
+ /* One grid for all rows: the label column is as wide as the widest label, up to --bk-facts-label-width, and never
18
+ leaves less than --bk-facts-rows-min for the value. Each item spans the columns as a subgrid: label, value, actions. */
19
+ :host([layout="rows"]) { display: block; container-type: inline-size; }
20
+ .rows { display: contents; }
21
+ :host([layout="rows"]) .rows {
22
+ display: grid;
23
+ grid-template-columns: fit-content(max(min(var(--bk-facts-label-width, 60%), calc(100% - var(--bk-facts-rows-min, var(--bk-measure-min)))), var(--bk-measure-min) / 2)) minmax(0, 1fr) auto;
24
+ column-gap: 0; row-gap: 0;
25
+ }
26
+ /* Private variables inherit into the items; an item reads them to lay out its row. */
20
27
  :host([layout="rows"]) ::slotted(bk-facts-item) {
21
- --_bk-facts-display: flex;
22
- --_bk-facts-label-flex: 1 0 var(--bk-facts-label-width, 30%);
23
- --_bk-facts-value-flex: 1000 1 var(--bk-facts-rows-min, var(--bk-measure-min));
24
- --_bk-facts-pad: var(--bk-facts-row-gap, var(--bk-space-3));
28
+ --_bk-facts-subgrid: subgrid; --_bk-facts-span: 1 / -1;
25
29
  --_bk-facts-col-gap: var(--bk-facts-gap-inline, var(--bk-space-5));
30
+ --_bk-facts-pad: var(--bk-facts-row-gap, var(--bk-space-3));
26
31
  }
27
32
  :host([layout="rows"]) ::slotted(bk-facts-item:not(:first-child)) { border-block-start: var(--bk-border-width) solid var(--bk-facts-row-divider, var(--bk-line)); }
33
+ /* A narrow list: the label and the actions share the first line, the value takes the line below at full width.
34
+ A container query cannot read a token, so the breakpoint is fixed. */
35
+ @container (inline-size < 24rem) {
36
+ .rows { grid-template-columns: minmax(0, 1fr) auto !important; }
37
+ ::slotted(bk-facts-item) { --_bk-facts-label-area: 1 / 1; --_bk-facts-actions-area: 1 / 2; --_bk-facts-value-area: 2 / 1 / 3 / -1; }
38
+ }
28
39
  `];
29
40
  updated() {
30
41
  this.min ? this.style.setProperty("--bk-facts-min", this.min) : this.style.removeProperty("--bk-facts-min");
31
42
  }
32
43
  render() {
33
- return html`<slot></slot>`;
44
+ return html`<div class="rows"><slot></slot></div>`;
34
45
  }
35
46
  }
36
47
  define("bk-facts", BkFacts);
@@ -162,6 +162,9 @@ export declare class BkInputTimeZone extends BkCombobox {
162
162
  text: {
163
163
  state: boolean;
164
164
  };
165
+ searching: {
166
+ state: boolean;
167
+ };
165
168
  locale: {};
166
169
  };
167
170
  /** Language for the offsets, the times and the long names (default: the page language). */
@@ -59,6 +59,9 @@ export interface ModelViewerChangeDetail {
59
59
  * The status line shows the position and the name: "2 of 9 · Wall bracket".
60
60
  * - The `details` slot is beside the view: the parameters or the description of the model.
61
61
  * Below `--bk-model-viewer-stack-below` (the width of the viewer) it is under the view.
62
+ * - The view has the ratio `--bk-model-viewer-ratio`, or the height `--bk-model-viewer-height`. With `fill`, the viewer
63
+ * takes the height of its container instead, for example the body of a `<bk-dialog size="full">`. The view takes the height
64
+ * that the row under it leaves, and the details scroll when they are taller. The container needs a definite height.
62
65
  * - While a model loads, a quiet spinner shows after `--bk-loading-delay`. A model that cannot load
63
66
  * shows a message and a button that loads it again.
64
67
  * - The viewer draws only when something changes. It frees the renderer, the geometries and the
@@ -81,7 +84,9 @@ export interface ModelViewerChangeDetail {
81
84
  * @cssprop --bk-model-viewer-part-color - Colour of the part when it has no `color` (default --bk-model-part).
82
85
  * @cssprop --bk-model-viewer-radius - Corner radius of the view (default --bk-radius-container, else --bk-radius-lg).
83
86
  * @cssprop --bk-model-viewer-ratio - Aspect ratio of the view (default 4/3).
84
- * @cssprop --bk-model-viewer-height - Height of the view instead of the ratio (default auto).
87
+ * @cssprop --bk-model-viewer-height - Height of the view instead of the ratio (default auto). With `fill`, the view takes the height that the bar leaves.
88
+ * @cssprop --bk-model-viewer-min-height - With `fill`: the minimum height of the view (default 10rem). A lower container scrolls.
89
+ * @cssprop --bk-model-viewer-details-height - With `fill`, when the details are under the view: their maximum height, a length or a percentage of the viewer (default 40%). Taller details scroll.
85
90
  * @cssprop --bk-model-viewer-gap - Space between the view and the details (default --bk-space-components).
86
91
  * @cssprop --bk-model-viewer-bar-gap - Space between the view and the row under it (default --bk-space-2).
87
92
  * @cssprop --bk-model-viewer-tools-gap - Space between the buttons under the view (default --bk-space-1).
@@ -104,6 +109,10 @@ export declare class BkModelViewer extends LitElement {
104
109
  type: {};
105
110
  label: {};
106
111
  color: {};
112
+ fill: {
113
+ type: BooleanConstructor;
114
+ reflect: boolean;
115
+ };
107
116
  items: {
108
117
  attribute: boolean;
109
118
  };
@@ -140,6 +149,8 @@ export declare class BkModelViewer extends LitElement {
140
149
  label: string;
141
150
  /** Colour of the part, any CSS colour (default `--bk-model-viewer-part-color`). It replaces the colours of a 3MF or OBJ file. */
142
151
  color: string | undefined;
152
+ /** The viewer fills the height of its container: the view takes the height that the row under it leaves. The container needs a definite height. */
153
+ fill: boolean;
143
154
  /** Several models; the viewer shows the one at `index`. */
144
155
  items: ModelViewerItem[];
145
156
  /** Index of the shown item. */
@@ -68,6 +68,7 @@ class BkModelViewer extends LitElement {
68
68
  type: {},
69
69
  label: {},
70
70
  color: {},
71
+ fill: { type: Boolean, reflect: true },
71
72
  items: { attribute: false },
72
73
  index: { type: Number },
73
74
  prevLabel: { attribute: "prev-label" },
@@ -102,6 +103,7 @@ class BkModelViewer extends LitElement {
102
103
  super();
103
104
  this.src = "";
104
105
  this.label = "";
106
+ this.fill = false;
105
107
  this.items = [];
106
108
  this.index = 0;
107
109
  this.prevLabel = "";
@@ -118,7 +120,9 @@ class BkModelViewer extends LitElement {
118
120
  .layout.side { grid-template-columns: minmax(0, 1fr) var(--bk-model-viewer-details-width, 20rem); }
119
121
  .main { display: grid; gap: var(--bk-model-viewer-bar-gap, var(--bk-space-2)); min-inline-size: 0; }
120
122
  .stage {
121
- position: relative; overflow: hidden;
123
+ /* The stage fills its column. With a height, the ratio does not apply: a grid item with a ratio and a height
124
+ takes its width from the height, not from the column. */
125
+ position: relative; overflow: hidden; inline-size: 100%;
122
126
  aspect-ratio: var(--bk-model-viewer-ratio, 4/3); block-size: var(--bk-model-viewer-height, auto);
123
127
  border-radius: var(--bk-model-viewer-radius, var(--bk-radius-container, var(--bk-radius-lg)));
124
128
  background: var(--bk-model-viewer-bg, var(--bk-layer-sunken-bg));
@@ -156,6 +160,14 @@ class BkModelViewer extends LitElement {
156
160
  :host(:dir(rtl)) .nav bk-button { scale: -1 1; }
157
161
  .details { min-inline-size: 0; }
158
162
  .details[hidden] { display: none; }
163
+ /* fill: the viewer takes the height of its container. The view stretches over the row that the bar leaves, and
164
+ the details scroll on their own. A minimum height keeps the view usable in a low container: then the container scrolls. */
165
+ :host([fill]) { block-size: 100%; }
166
+ :host([fill]) .layout { block-size: 100%; grid-template-rows: 1fr; align-items: stretch; }
167
+ :host([fill]) .layout.below { grid-template-rows: 1fr fit-content(var(--bk-model-viewer-details-height, 40%)); }
168
+ :host([fill]) .main { grid-template-rows: 1fr auto; }
169
+ :host([fill]) .stage { aspect-ratio: auto; min-block-size: var(--bk-model-viewer-min-height, 10rem); }
170
+ :host([fill]) .details { overflow: auto; overscroll-behavior: contain; }
159
171
  @media (forced-colors: active) { .stage { border: var(--bk-border-width) solid CanvasText; } }
160
172
  `];
161
173
  /** The model to show: the item at `index`, else the attributes of the element. */
@@ -509,7 +521,8 @@ class BkModelViewer extends LitElement {
509
521
  const details = this.slots.has("details");
510
522
  const help = this.many ? `${this.i18n.t("modelViewerHelp")} ${this.i18n.t("modelViewerStepHelp")}` : this.i18n.t("modelViewerHelp");
511
523
  const tool = (icon, label, run) => html`<bk-button variant="ghost" size="sm" icon=${icon} label=${label} ?disabled=${!ready} @click=${run}></bk-button>`;
512
- return html`<div class="layout ${details && !this.stacked ? "side" : ""}" part="base">
524
+ const layout = details ? this.stacked ? "below" : "side" : "";
525
+ return html`<div class="layout ${layout}" part="base">
513
526
  <div class="main">
514
527
  <div class="stage" part="stage">
515
528
  <div class="view ${ready ? "ready" : ""}" part="view" role="application" tabindex=${shows ? "0" : "-1"} ?hidden=${!shows}