@scattered-light/loomiere-base-ui 0.12.0 → 0.13.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 (71) hide show
  1. package/README.md +2 -0
  2. package/dist/custom/collection/index.d.ts +9 -1
  3. package/dist/custom/collection/index.js +5 -2
  4. package/dist/custom/collection/index.js.map +1 -1
  5. package/dist/design-system/components/CollectionToolbar/README.md +3 -1
  6. package/dist/design-system/components/DataTable/preview.html +129 -129
  7. package/dist/design-system/components/bundle.js +2 -2
  8. package/dist/design-system/components/styles.css +111 -62
  9. package/dist/styles/components/Accordion.css +1 -1
  10. package/dist/styles/components/AlertDialog.css +1 -1
  11. package/dist/styles/components/Autocomplete.css +1 -1
  12. package/dist/styles/components/Avatar.css +1 -1
  13. package/dist/styles/components/Button.css +1 -1
  14. package/dist/styles/components/Checkbox.css +1 -1
  15. package/dist/styles/components/CheckboxGroup.css +1 -1
  16. package/dist/styles/components/Collapsible.css +1 -1
  17. package/dist/styles/components/Combobox.css +1 -1
  18. package/dist/styles/components/ContextMenu.css +1 -1
  19. package/dist/styles/components/Dialog.css +1 -1
  20. package/dist/styles/components/Drawer.css +1 -1
  21. package/dist/styles/components/Field.css +1 -1
  22. package/dist/styles/components/Fieldset.css +1 -1
  23. package/dist/styles/components/Form.css +1 -1
  24. package/dist/styles/components/Input.css +1 -1
  25. package/dist/styles/components/Menu.css +1 -1
  26. package/dist/styles/components/Menubar.css +1 -1
  27. package/dist/styles/components/Meter.css +1 -1
  28. package/dist/styles/components/NavigationMenu.css +1 -1
  29. package/dist/styles/components/NumberField.css +1 -1
  30. package/dist/styles/components/OTPField.css +1 -1
  31. package/dist/styles/components/Popover.css +1 -1
  32. package/dist/styles/components/PreviewCard.css +1 -1
  33. package/dist/styles/components/Progress.css +1 -1
  34. package/dist/styles/components/Radio.css +1 -1
  35. package/dist/styles/components/ScrollArea.css +1 -1
  36. package/dist/styles/components/Select.css +1 -1
  37. package/dist/styles/components/Separator.css +1 -1
  38. package/dist/styles/components/Slider.css +1 -1
  39. package/dist/styles/components/Switch.css +1 -1
  40. package/dist/styles/components/Tabs.css +1 -1
  41. package/dist/styles/components/Toast.css +1 -1
  42. package/dist/styles/components/Toggle.css +1 -1
  43. package/dist/styles/components/ToggleGroup.css +1 -1
  44. package/dist/styles/components/Toolbar.css +1 -1
  45. package/dist/styles/components/Tooltip.css +1 -1
  46. package/dist/styles/custom/AppBar.css +1 -1
  47. package/dist/styles/custom/Badge.css +1 -1
  48. package/dist/styles/custom/Collection.css +1 -1
  49. package/dist/styles/custom/CollectionPagination.css +1 -1
  50. package/dist/styles/custom/CollectionToolbar.css +26 -1
  51. package/dist/styles/custom/DataList.css +1 -1
  52. package/dist/styles/custom/DataTable.css +26 -2
  53. package/dist/styles/custom/DatePicker.css +1 -1
  54. package/dist/styles/custom/DescriptionList.css +1 -1
  55. package/dist/styles/custom/EditableList.css +1 -1
  56. package/dist/styles/custom/EmptyState.css +1 -1
  57. package/dist/styles/custom/ListDetail.css +1 -1
  58. package/dist/styles/custom/MoneyField.css +1 -1
  59. package/dist/styles/custom/PickerButton.css +1 -1
  60. package/dist/styles/custom/Sheet.css +1 -1
  61. package/dist/styles/custom/SideNav.css +1 -1
  62. package/dist/styles/custom/Splitter.css +1 -1
  63. package/dist/styles/custom/StatFigure.css +1 -1
  64. package/dist/styles/custom/Table.css +2 -2
  65. package/dist/styles/index.css +1 -1
  66. package/dist/styles/reset/accessibility.css +1 -1
  67. package/dist/styles/reset/reset-accessibility.css +1 -1
  68. package/dist/styles/reset/reset-tailwind.css +1 -1
  69. package/dist/styles/reset/reset.css +1 -1
  70. package/dist/styles/tailwind.css +1 -1
  71. package/package.json +2 -2
package/README.md CHANGED
@@ -171,6 +171,8 @@ A tree in a DataTable (`getSubRows`) has options for a register of parents and c
171
171
  - `useCollection({ pageBy: 'top-level', pageSize: 5 })` pages by parents, so a page holds whole parents with their children. The pager counts parents: pass `collection.pageTotal` as `total`. `collection.pageRows` is the leaf rows of the page, children of collapsed parents included.
172
172
  - `totalRows={[{ scope: 'page', label }, { scope: 'all', label }]}` writes several footer rows. A `page` row totals the current page and is ruled as a subtotal; an `all` row totals every filtered row and is ruled as the grand total. `label` is text or a function of the collection, such as `(c) => \`Page ${c.page} of ${c.pageCount} subtotal\``.
173
173
  - A `rowHeader` column's `cell` now draws the row's name: put a second line or a count beside it. The row's link or button keeps the plain name as its accessible name.
174
+ - `treeLines` also gives parent, child and total rows their own heights, from `collection.tree-row-height-parent`, `tree-row-height-child`, `total-row-height-subtotal` and `total-row-height-grand` (all the dense row until a brand sets them), and starts the elbow `collection.tree-line-offset` in. With `disclosure="small"` the chevron takes `collection.disclosure-color`. A row with `onRowActivate` or `getRowHref` shows a pointer. `table.row-hover-color` is the text color on the hovered row.
175
+ - `CollectionToolbar` takes `searchWidth="fixed"` (the search keeps `collection.search-fixed-width`), `meta` and `metaEnd` (quiet text beside the search and at the far end of the row) and `framed` (padding and a rule under it, inside a Sheet).
174
176
  - `treeLines` draws an elbow from each child's name back up to its parent. `disclosure="small"` shrinks the expand button so a parent is as tall as its children. `getRowKind={(row) => 'link'}` marks a row (`data-kind="link"`) whose name reads as a link, for a row such as "3 more Entities".
175
177
 
176
178
 
@@ -510,13 +510,21 @@ interface CollectionToolbarProps<T> {
510
510
  }>;
511
511
  actions?: React.ReactNode;
512
512
  bulkActions?: React.ReactNode;
513
+ /** 'fill' (the default) lets the search grow. 'fixed' gives it collection.search-fixed-width, so the meta beside it has room. */
514
+ searchWidth?: 'fill' | 'fixed';
515
+ /** Quiet text beside the search, such as "12 clients". */
516
+ meta?: React.ReactNode;
517
+ /** Quiet text at the far end of the row, such as "Sorted by most open". */
518
+ metaEnd?: React.ReactNode;
519
+ /** Pads the toolbar and rules it from the table below, for a toolbar inside a Sheet above an edge-to-edge table. */
520
+ framed?: boolean;
513
521
  className?: string;
514
522
  }
515
523
  /**
516
524
  * Tabs and search stay put while rows are selected. The trailing controls swap for the
517
525
  * selection bar, so the bar takes their place and the row does not grow.
518
526
  */
519
- declare function CollectionToolbarImpl<T>({ collection, searchLabel, searchLabelVisible, showSort, groupOptions, actions, bulkActions, className }: CollectionToolbarProps<T>): react_jsx_runtime.JSX.Element;
527
+ declare function CollectionToolbarImpl<T>({ collection, searchLabel, searchLabelVisible, showSort, groupOptions, actions, bulkActions, searchWidth, meta, metaEnd, framed, className }: CollectionToolbarProps<T>): react_jsx_runtime.JSX.Element;
520
528
  declare function ToolbarTabs<T>({ collection, column }: {
521
529
  collection: CollectionApi<T>;
522
530
  column: CollectionColumn<T>;
@@ -729,6 +729,7 @@ function DataRow({ entry, index, collection, columns, roving, navigate, onRowAct
729
729
  "aria-current": active ? "true" : void 0,
730
730
  "data-depth": entry.row.depth || void 0,
731
731
  "data-kind": rowKind,
732
+ "data-activates": href || onRowActivate ? "" : void 0,
732
733
  onClick: (event) => {
733
734
  const target = event.target;
734
735
  if (interactiveTarget(target) || selectingText()) return;
@@ -815,7 +816,7 @@ function CollectionPagination({
815
816
  ] });
816
817
  }
817
818
  var COMBOBOX_AT = 12;
818
- function CollectionToolbarImpl({ collection, searchLabel, searchLabelVisible, showSort, groupOptions, actions, bulkActions, className }) {
819
+ function CollectionToolbarImpl({ collection, searchLabel, searchLabelVisible, showSort, groupOptions, actions, bulkActions, searchWidth = "fill", meta, metaEnd, framed, className }) {
819
820
  const tabs = collection.columns.find((column) => column.filter?.kind === "tabs");
820
821
  const selects = collection.columns.filter((column) => column.filter && column.filter.kind !== "tabs");
821
822
  const searchable = collection.columns.some((column) => column.searchable);
@@ -841,7 +842,7 @@ function CollectionToolbarImpl({ collection, searchLabel, searchLabelVisible, sh
841
842
  }, [collection.selection, collection.hiddenSelectedCount, collection.messages]);
842
843
  const selecting = collection.selection.length > 0;
843
844
  const narrow = useUnderWidth("--sl-collection-narrow-width");
844
- return /* @__PURE__ */ jsxs("div", { ref: narrow.ref, className: cn("CollectionToolbar", className), "data-selecting": selecting ? "" : void 0, "data-narrow": narrow.under ? "" : void 0, children: [
845
+ return /* @__PURE__ */ jsxs("div", { ref: narrow.ref, className: cn("CollectionToolbar", className), "data-selecting": selecting ? "" : void 0, "data-narrow": narrow.under ? "" : void 0, "data-search": searchWidth === "fixed" ? "fixed" : void 0, "data-framed": framed ? "" : void 0, children: [
845
846
  tabs ? /* @__PURE__ */ jsx(ToolbarTabs, { collection, column: tabs }) : null,
846
847
  /* @__PURE__ */ jsxs("div", { className: "CollectionToolbarMain", children: [
847
848
  searchable ? /* @__PURE__ */ jsx(
@@ -854,6 +855,8 @@ function CollectionToolbarImpl({ collection, searchLabel, searchLabelVisible, sh
854
855
  clearLabel: collection.messages.clearSearch
855
856
  }
856
857
  ) : null,
858
+ meta ? /* @__PURE__ */ jsx("p", { className: "CollectionToolbarMeta", "aria-live": "polite", children: meta }) : null,
859
+ metaEnd ? /* @__PURE__ */ jsx("p", { className: "CollectionToolbarMeta CollectionToolbarMetaEnd", children: metaEnd }) : null,
857
860
  selecting ? /* @__PURE__ */ jsxs("div", { className: "CollectionSelectionBar", role: "region", "aria-label": "Selection", children: [
858
861
  /* @__PURE__ */ jsxs("p", { className: "CollectionCount", children: [
859
862
  collection.messages.selected(collection.selection.length),