@eifi1/ui-kit 0.48.0 → 0.48.2

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 (47) hide show
  1. package/README.md +4 -3
  2. package/dist/components/data-table-fit.d.ts +8 -1
  3. package/dist/components/data-table-fit.js +7 -1
  4. package/dist/components/data-table-fit.js.map +1 -1
  5. package/dist/components/data-table-groups.d.ts +3 -1
  6. package/dist/components/data-table-groups.js +11 -5
  7. package/dist/components/data-table-groups.js.map +1 -1
  8. package/dist/components/data-table-head.d.ts +8 -1
  9. package/dist/components/data-table-head.js +11 -3
  10. package/dist/components/data-table-head.js.map +1 -1
  11. package/dist/components/data-table-leading-row.d.ts +3 -1
  12. package/dist/components/data-table-leading-row.js +2 -1
  13. package/dist/components/data-table-leading-row.js.map +1 -1
  14. package/dist/components/data-table-row-actions.js +2 -2
  15. package/dist/components/data-table-row-actions.js.map +1 -1
  16. package/dist/components/data-table-row.d.ts +84 -0
  17. package/dist/components/data-table-row.js +261 -0
  18. package/dist/components/data-table-row.js.map +1 -0
  19. package/dist/components/data-table-selection.d.ts +3 -0
  20. package/dist/components/data-table-selection.js +12 -1
  21. package/dist/components/data-table-selection.js.map +1 -1
  22. package/dist/components/data-table-virtual.d.ts +98 -0
  23. package/dist/components/data-table-virtual.js +369 -0
  24. package/dist/components/data-table-virtual.js.map +1 -0
  25. package/dist/components/data-table.d.ts +58 -2
  26. package/dist/components/data-table.js +227 -230
  27. package/dist/components/data-table.js.map +1 -1
  28. package/dist/data-table.d.ts +1 -0
  29. package/dist/data-table.js.map +1 -1
  30. package/dist/eslint/index.js +1 -1
  31. package/dist/hooks/use-anchored-panel.js +2 -1
  32. package/dist/hooks/use-anchored-panel.js.map +1 -1
  33. package/dist/shell/app-shell.js +7 -1
  34. package/dist/shell/app-shell.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/components/data-table-fit.ts +17 -2
  37. package/src/components/data-table-groups.tsx +15 -4
  38. package/src/components/data-table-head.tsx +25 -2
  39. package/src/components/data-table-leading-row.tsx +4 -1
  40. package/src/components/data-table-row-actions.tsx +3 -2
  41. package/src/components/data-table-row.tsx +483 -0
  42. package/src/components/data-table-selection.ts +17 -1
  43. package/src/components/data-table-virtual.ts +547 -0
  44. package/src/components/data-table.tsx +326 -327
  45. package/src/data-table.ts +2 -0
  46. package/src/hooks/use-anchored-panel.ts +9 -1
  47. package/src/shell/app-shell.tsx +7 -1
package/src/data-table.ts CHANGED
@@ -32,6 +32,8 @@ export type {
32
32
  export { swipePlanRowActions } from "./components/data-table-row-actions";
33
33
  // 0.48 (keksdose dev #605): a `groupBy` level (also `mobileGroupBy`'s) and the `loadMore` footer.
34
34
  export type { DataTableGroupBy, DataTableLoadMore } from "./components/data-table-groups";
35
+ // 0.48.2 (keksdose dev #632): `virtualize`'s options.
36
+ export type { DataTableVirtualize } from "./components/data-table-virtual";
35
37
  export * from "./components/data-table-cells";
36
38
  export { useTableUrlState, readTableUrlState } from "./components/use-table-state";
37
39
  export type {
@@ -76,6 +76,8 @@ export function readKeyboardInset({ minimum = MIN_KEYBOARD_PX }: KeyboardInsetOp
76
76
  return inset >= minimum ? inset : 0;
77
77
  }
78
78
 
79
+ const UNMEASURED_VIEWPORT: ViewportBox = { top: 0, height: 0 };
80
+
79
81
  function readViewport(): ViewportBox {
80
82
  if (typeof window === "undefined") return { top: 0, height: 0 };
81
83
  const vv = window.visualViewport;
@@ -356,7 +358,13 @@ export function useAnchoredPanel<T extends HTMLElement>(
356
358
  options: AnchoredPanelOptions = {},
357
359
  ): AnchoredPanel {
358
360
  const rect = useAnchoredRect(ref, open);
359
- const [viewport, setViewport] = useState<ViewportBox>(readViewport);
361
+ // Not read while rendering (0.48.2, keksdose K-052-2): in Chromium `visualViewport`'s
362
+ // geometry forces a style and layout pass on a dirty DOM, and every anchored panel —
363
+ // closed ones too — paid it on mount (a bulk bar's pickers appearing on the first
364
+ // ticked row of a long table paid a layout of the whole table). Nothing reads this
365
+ // before the layout effect below has filled it: `rect` is null until the panel is open
366
+ // and measured, and that same effect pass measures the viewport.
367
+ const [viewport, setViewport] = useState<ViewportBox>(UNMEASURED_VIEWPORT);
360
368
  // A panel of rows wants room for the same number of rows at every text size; the gap
361
369
  // and the edge margin are not text and stay px.
362
370
  const { scale } = useTextSize();
@@ -564,7 +564,13 @@ export function AppShell({
564
564
  // into the rest from a zero basis, and a window too short for the page's
565
565
  // floor scrolls `<main>`. Every other page lays out as before. Below `md`
566
566
  // the document scrolls and nothing fills.
567
- "md:has-[[data-fill-height]]:flex md:has-[[data-fill-height]]:flex-col md:has-[[data-fill-height]]:*:shrink-0",
567
+ // The children's `shrink-0` carries no `:has`: `flex-shrink` does nothing
568
+ // outside a flex container, and a `:has(…) > *` rule cost a style recalc of
569
+ // the whole page on every DOM insertion under it (17–45 ms per scrolled step
570
+ // of a `virtualize` table, 0.48.2). `[&&>*]` doubles the class, so it stays
571
+ // as specific as FillHeight's `has-[…]:flex-1` (whose `flex: 1` would set
572
+ // shrink 1) and, emitted after it, still wins.
573
+ "md:has-[[data-fill-height]]:flex md:has-[[data-fill-height]]:flex-col md:[&&>*]:shrink-0",
568
574
  // Embedded there is no document scroll to lean on below `md` either.
569
575
  embedded && "min-h-0 overflow-y-auto",
570
576
  )}