@scattered-light/loomiere-base-ui 0.7.1 → 0.8.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 (91) hide show
  1. package/README.md +27 -2
  2. package/dist/{chunk-JUUPOOQQ.js → chunk-LJQ3RZDJ.js} +51 -3
  3. package/dist/chunk-LJQ3RZDJ.js.map +1 -0
  4. package/dist/custom/collection/index.d.ts +6 -1
  5. package/dist/custom/collection/index.js +18 -12
  6. package/dist/custom/collection/index.js.map +1 -1
  7. package/dist/custom/index.d.ts +1 -1
  8. package/dist/custom/index.js +1 -1
  9. package/dist/design-system/components/ContextMenu/README.md +1 -1
  10. package/dist/design-system/components/ContextMenu/preview.html +1 -1
  11. package/dist/design-system/components/DataList/README.md +1 -1
  12. package/dist/design-system/components/DataList/preview.html +1 -1
  13. package/dist/design-system/components/DataTable/README.md +1 -1
  14. package/dist/design-system/components/DataTable/preview.html +38 -38
  15. package/dist/design-system/components/DescriptionList/README.md +41 -0
  16. package/dist/design-system/components/DescriptionList/preview.html +19 -0
  17. package/dist/design-system/components/Drawer/README.md +1 -1
  18. package/dist/design-system/components/ScrollArea/preview.html +2 -2
  19. package/dist/design-system/components/Sheet/README.md +46 -0
  20. package/dist/design-system/components/Sheet/preview.html +19 -0
  21. package/dist/design-system/components/StatFigure/README.md +38 -0
  22. package/dist/design-system/components/StatFigure/preview.html +19 -0
  23. package/dist/design-system/components/Table/README.md +2 -2
  24. package/dist/design-system/components/Table/preview.html +2 -2
  25. package/dist/design-system/components/bundle.js +7 -7
  26. package/dist/design-system/components/index.d.ts +1 -1
  27. package/dist/design-system/components/styles.css +370 -56
  28. package/dist/{index-ChJXlxzq.d.ts → index-CBAo353T.d.ts} +55 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/styles/components/Accordion.css +1 -1
  32. package/dist/styles/components/AlertDialog.css +1 -1
  33. package/dist/styles/components/Autocomplete.css +1 -1
  34. package/dist/styles/components/Avatar.css +1 -1
  35. package/dist/styles/components/Button.css +1 -1
  36. package/dist/styles/components/Checkbox.css +1 -1
  37. package/dist/styles/components/CheckboxGroup.css +1 -1
  38. package/dist/styles/components/Collapsible.css +1 -1
  39. package/dist/styles/components/Combobox.css +1 -1
  40. package/dist/styles/components/ContextMenu.css +1 -1
  41. package/dist/styles/components/Dialog.css +1 -1
  42. package/dist/styles/components/Drawer.css +8 -2
  43. package/dist/styles/components/Field.css +1 -1
  44. package/dist/styles/components/Fieldset.css +1 -1
  45. package/dist/styles/components/Form.css +1 -1
  46. package/dist/styles/components/Input.css +1 -1
  47. package/dist/styles/components/Menu.css +1 -1
  48. package/dist/styles/components/Menubar.css +1 -1
  49. package/dist/styles/components/Meter.css +1 -1
  50. package/dist/styles/components/NavigationMenu.css +1 -1
  51. package/dist/styles/components/NumberField.css +1 -1
  52. package/dist/styles/components/OTPField.css +1 -1
  53. package/dist/styles/components/Popover.css +1 -1
  54. package/dist/styles/components/PreviewCard.css +1 -1
  55. package/dist/styles/components/Progress.css +1 -1
  56. package/dist/styles/components/Radio.css +1 -1
  57. package/dist/styles/components/ScrollArea.css +1 -1
  58. package/dist/styles/components/Select.css +1 -1
  59. package/dist/styles/components/Separator.css +1 -1
  60. package/dist/styles/components/Slider.css +1 -1
  61. package/dist/styles/components/Switch.css +1 -1
  62. package/dist/styles/components/Tabs.css +1 -1
  63. package/dist/styles/components/Toast.css +1 -1
  64. package/dist/styles/components/Toggle.css +1 -1
  65. package/dist/styles/components/ToggleGroup.css +1 -1
  66. package/dist/styles/components/Toolbar.css +1 -1
  67. package/dist/styles/components/Tooltip.css +1 -1
  68. package/dist/styles/custom/Badge.css +1 -1
  69. package/dist/styles/custom/Collection.css +1 -1
  70. package/dist/styles/custom/CollectionPagination.css +1 -1
  71. package/dist/styles/custom/CollectionToolbar.css +1 -1
  72. package/dist/styles/custom/DataList.css +19 -1
  73. package/dist/styles/custom/DataTable.css +1 -1
  74. package/dist/styles/custom/DatePicker.css +1 -1
  75. package/dist/styles/custom/DescriptionList.css +75 -0
  76. package/dist/styles/custom/EditableList.css +1 -1
  77. package/dist/styles/custom/EmptyState.css +1 -1
  78. package/dist/styles/custom/ListDetail.css +1 -1
  79. package/dist/styles/custom/MoneyField.css +1 -1
  80. package/dist/styles/custom/Sheet.css +90 -0
  81. package/dist/styles/custom/Splitter.css +1 -1
  82. package/dist/styles/custom/StatFigure.css +60 -0
  83. package/dist/styles/custom/Table.css +63 -1
  84. package/dist/styles/index.css +4 -1
  85. package/dist/styles/reset/accessibility.css +1 -1
  86. package/dist/styles/reset/reset-accessibility.css +1 -1
  87. package/dist/styles/reset/reset-tailwind.css +2 -2
  88. package/dist/styles/reset/reset.css +2 -2
  89. package/dist/styles/tailwind.css +4 -1
  90. package/package.json +2 -2
  91. package/dist/chunk-JUUPOOQQ.js.map +0 -1
@@ -432,12 +432,17 @@ interface DataTableProps<T> extends CollectionViewProps<T> {
432
432
  /** 'scroll' keeps the table. 'list' swaps in DataList when the table is narrower than collection.narrow-width. */
433
433
  narrow?: 'scroll' | 'list';
434
434
  size?: 'sm' | 'md';
435
+ /**
436
+ * How the footer's totals row looks. 'band' (the default) is the header tray. 'subtotal' rules
437
+ * a single line above it; 'grand' adds a double rule under it, as on a working paper.
438
+ */
439
+ totalStyle?: 'band' | 'subtotal' | 'grand';
435
440
  }
436
441
  /**
437
442
  * A data table, the APG pattern: one tab stop for the rows, headers announce sort, and it is
438
443
  * not a grid. A grid would say this is a spreadsheet, and it is not. AG Grid is that tool.
439
444
  */
440
- declare function DataTable<T>({ collection, label, caption, onRowActivate, getRowHref, activeRowId, rowActions, empty, loading, stickyHeader, stickyRowHeader, narrow, size, rowNavigation, className, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
445
+ declare function DataTable<T>({ collection, label, caption, onRowActivate, getRowHref, activeRowId, rowActions, empty, loading, stickyHeader, stickyRowHeader, narrow, size, totalStyle, rowNavigation, className, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
441
446
 
442
447
  interface CollectionPaginationProps {
443
448
  /** 1-based. */
@@ -443,6 +443,7 @@ function DataTable({
443
443
  stickyRowHeader = false,
444
444
  narrow = "scroll",
445
445
  size = "sm",
446
+ totalStyle = "band",
446
447
  rowNavigation,
447
448
  className
448
449
  }) {
@@ -487,6 +488,7 @@ function DataTable({
487
488
  stickyHeader,
488
489
  stickyRowHeader,
489
490
  size,
491
+ totalStyle,
490
492
  className,
491
493
  onRowActivate,
492
494
  getRowHref,
@@ -496,7 +498,7 @@ function DataTable({
496
498
  );
497
499
  return /* @__PURE__ */ jsx("div", { ref: narrowWidth.ref, className: cn("CollectionView", asList ? className : void 0), "data-narrow": narrowWidth.under ? "" : void 0, children: view });
498
500
  }
499
- function TableView({ collection, columns, label, caption, colSpan, leaves, navigate, allSelected, someSelected, loading, empty, stickyHeader, stickyRowHeader, size, className, onRowActivate, getRowHref, activeRowId, rowActions }) {
501
+ function TableView({ collection, columns, label, caption, colSpan, leaves, navigate, allSelected, someSelected, loading, empty, stickyHeader, stickyRowHeader, size, totalStyle, className, onRowActivate, getRowHref, activeRowId, rowActions }) {
500
502
  const roving = useRovingRows(leaves.length, navigate);
501
503
  const scrollerRef = React4.useRef(null);
502
504
  const [overflows, setOverflows] = React4.useState(false);
@@ -524,6 +526,7 @@ function TableView({ collection, columns, label, caption, colSpan, leaves, navig
524
526
  }, [stickyHeader, leaves.length, columns.length]);
525
527
  const filteredEmpty = collection.totalCount > 0 && collection.filteredCount === 0;
526
528
  const text = collection.messages;
529
+ const ruled = totalStyle !== "band";
527
530
  return /* @__PURE__ */ jsxs(
528
531
  "div",
529
532
  {
@@ -570,17 +573,20 @@ function TableView({ collection, columns, label, caption, colSpan, leaves, navig
570
573
  rowActions ? /* @__PURE__ */ jsx("th", { scope: "col", "data-width": "min", children: /* @__PURE__ */ jsx("span", { className: "visually-hidden", children: "Actions" }) }) : null
571
574
  ] }) }),
572
575
  collection.pageEntries.some((entry) => entry.kind === "group") ? groupedBodies({ collection, columns, leaves, roving, navigate, onRowActivate, getRowHref, activeRowId, rowActions, colSpan, filteredEmpty, empty, loading }) : /* @__PURE__ */ jsx("tbody", { children: bodyRows({ collection, columns, leaves, roving, navigate, onRowActivate, getRowHref, activeRowId, rowActions, colSpan, filteredEmpty, empty, loading }) }),
573
- Object.keys(collection.totals).length ? /* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", { children: [
574
- collection.canSelect ? /* @__PURE__ */ jsx("td", {}) : null,
575
- columns.map((column, index) => /* @__PURE__ */ jsxs("td", { "data-align": alignOf(column), children: [
576
- index === 0 ? text.total : typeof column.total === "function" ? column.total(collection.filteredRows) : collection.totals[column.id] ?? "",
577
- index === 0 && collection.isFiltered ? /* @__PURE__ */ jsxs("span", { className: "visually-hidden", children: [
578
- " of ",
579
- collection.filteredCount,
580
- " filtered rows"
581
- ] }) : null
582
- ] }, column.id)),
583
- rowActions ? /* @__PURE__ */ jsx("td", {}) : null
576
+ Object.keys(collection.totals).length ? /* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", { "data-total": ruled ? totalStyle : void 0, children: [
577
+ collection.canSelect ? /* @__PURE__ */ jsx("td", { "data-rule": ruled ? "none" : void 0 }) : null,
578
+ columns.map((column, index) => (
579
+ // Ruled totals draw their lines under the figures only, not the label or blank cells.
580
+ /* @__PURE__ */ jsxs("td", { "data-align": alignOf(column), "data-rule": ruled && (index === 0 || !column.total) ? "none" : void 0, children: [
581
+ index === 0 ? text.total : typeof column.total === "function" ? column.total(collection.filteredRows) : collection.totals[column.id] ?? "",
582
+ index === 0 && collection.isFiltered ? /* @__PURE__ */ jsxs("span", { className: "visually-hidden", children: [
583
+ " of ",
584
+ collection.filteredCount,
585
+ " filtered rows"
586
+ ] }) : null
587
+ ] }, column.id)
588
+ )),
589
+ rowActions ? /* @__PURE__ */ jsx("td", { "data-rule": ruled ? "none" : void 0 }) : null
584
590
  ] }) }) : null
585
591
  ]
586
592
  }