@scattered-light/loomiere-base-ui 0.17.0 → 0.19.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 (85) hide show
  1. package/README.md +9 -1
  2. package/dist/{chunk-DBNGJCTF.js → chunk-2BFNETZZ.js} +4 -3
  3. package/dist/chunk-2BFNETZZ.js.map +1 -0
  4. package/dist/custom/collection/index.d.ts +19 -1
  5. package/dist/custom/collection/index.js +20 -1
  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/CollectionCards/README.md +26 -0
  10. package/dist/design-system/components/CollectionCards/preview.html +19 -0
  11. package/dist/design-system/components/SideNav/README.md +7 -1
  12. package/dist/design-system/components/SideNav/preview.html +1 -1
  13. package/dist/design-system/components/bundle.js +6 -6
  14. package/dist/design-system/components/index.d.ts +1 -1
  15. package/dist/design-system/components/styles.css +96 -62
  16. package/dist/{index-C-lxJXk8.d.ts → index-ywBkS0AA.d.ts} +2 -0
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/styles/components/Accordion.css +1 -1
  20. package/dist/styles/components/AlertDialog.css +1 -1
  21. package/dist/styles/components/Autocomplete.css +1 -1
  22. package/dist/styles/components/Avatar.css +1 -1
  23. package/dist/styles/components/Button.css +1 -1
  24. package/dist/styles/components/Checkbox.css +1 -1
  25. package/dist/styles/components/CheckboxGroup.css +1 -1
  26. package/dist/styles/components/Collapsible.css +1 -1
  27. package/dist/styles/components/Combobox.css +1 -1
  28. package/dist/styles/components/ContextMenu.css +1 -1
  29. package/dist/styles/components/Dialog.css +1 -1
  30. package/dist/styles/components/Drawer.css +1 -1
  31. package/dist/styles/components/Field.css +1 -1
  32. package/dist/styles/components/Fieldset.css +1 -1
  33. package/dist/styles/components/Form.css +1 -1
  34. package/dist/styles/components/Input.css +1 -1
  35. package/dist/styles/components/Menu.css +1 -1
  36. package/dist/styles/components/Menubar.css +1 -1
  37. package/dist/styles/components/Meter.css +1 -1
  38. package/dist/styles/components/NavigationMenu.css +1 -1
  39. package/dist/styles/components/NumberField.css +1 -1
  40. package/dist/styles/components/OTPField.css +1 -1
  41. package/dist/styles/components/Popover.css +1 -1
  42. package/dist/styles/components/PreviewCard.css +1 -1
  43. package/dist/styles/components/Progress.css +1 -1
  44. package/dist/styles/components/Radio.css +1 -1
  45. package/dist/styles/components/ScrollArea.css +1 -1
  46. package/dist/styles/components/Select.css +1 -1
  47. package/dist/styles/components/Separator.css +1 -1
  48. package/dist/styles/components/Slider.css +1 -1
  49. package/dist/styles/components/Switch.css +1 -1
  50. package/dist/styles/components/Tabs.css +1 -1
  51. package/dist/styles/components/Toast.css +1 -1
  52. package/dist/styles/components/Toggle.css +1 -1
  53. package/dist/styles/components/ToggleGroup.css +1 -1
  54. package/dist/styles/components/Toolbar.css +1 -1
  55. package/dist/styles/components/Tooltip.css +1 -1
  56. package/dist/styles/custom/AppBar.css +1 -1
  57. package/dist/styles/custom/Badge.css +1 -1
  58. package/dist/styles/custom/Collection.css +2 -1
  59. package/dist/styles/custom/CollectionCards.css +24 -0
  60. package/dist/styles/custom/CollectionPagination.css +1 -1
  61. package/dist/styles/custom/CollectionToolbar.css +1 -1
  62. package/dist/styles/custom/DataList.css +1 -1
  63. package/dist/styles/custom/DataTable.css +1 -1
  64. package/dist/styles/custom/DatePicker.css +1 -1
  65. package/dist/styles/custom/DescriptionList.css +1 -1
  66. package/dist/styles/custom/EditableList.css +1 -1
  67. package/dist/styles/custom/EmptyState.css +1 -1
  68. package/dist/styles/custom/ListDetail.css +1 -1
  69. package/dist/styles/custom/MoneyField.css +1 -1
  70. package/dist/styles/custom/PickerButton.css +1 -1
  71. package/dist/styles/custom/PickerSplit.css +1 -1
  72. package/dist/styles/custom/Sheet.css +1 -1
  73. package/dist/styles/custom/SideNav.css +10 -1
  74. package/dist/styles/custom/Splitter.css +1 -1
  75. package/dist/styles/custom/StatCard.css +1 -1
  76. package/dist/styles/custom/StatFigure.css +1 -1
  77. package/dist/styles/custom/Table.css +1 -1
  78. package/dist/styles/index.css +1 -1
  79. package/dist/styles/reset/accessibility.css +1 -1
  80. package/dist/styles/reset/reset-accessibility.css +1 -1
  81. package/dist/styles/reset/reset-tailwind.css +1 -1
  82. package/dist/styles/reset/reset.css +1 -1
  83. package/dist/styles/tailwind.css +1 -1
  84. package/package.json +2 -2
  85. package/dist/chunk-DBNGJCTF.js.map +0 -1
@@ -477,6 +477,24 @@ interface DataTableTotalRow<T = unknown> {
477
477
  */
478
478
  declare function DataTable<T>({ collection, label, caption, onRowActivate, getRowHref, activeRowId, rowActions, empty, loading, stickyHeader, stickyRowHeader, narrow, size, totalStyle, totalRows, treeLines, headerStyle, figures, disclosure, getRowKind, rowNavigation, className, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
479
479
 
480
+ interface CollectionCardsProps<T> {
481
+ collection: CollectionApi<T>;
482
+ /** Names the list for screen readers: "Entities". */
483
+ label: string;
484
+ /** One card for a row, such as a StatCard. */
485
+ renderCard: (row: T) => React.ReactNode;
486
+ /** Shown when the data itself is empty. A search with no matches uses the built-in no-results state. */
487
+ empty?: React.ReactNode;
488
+ loading?: boolean;
489
+ className?: string;
490
+ }
491
+ /**
492
+ * The rows of a collection as a grid of cards, for a page that lists things such as Entities or
493
+ * accounts. Search, filter, sort and paging come from the same collection the table and list use,
494
+ * so CollectionToolbar and CollectionPagination work with it unchanged. It shows the current page.
495
+ */
496
+ declare function CollectionCards<T>({ collection, label, renderCard, empty, loading, className }: CollectionCardsProps<T>): react_jsx_runtime.JSX.Element;
497
+
480
498
  interface CollectionPaginationProps {
481
499
  /** 1-based. */
482
500
  page: number;
@@ -586,4 +604,4 @@ declare const CollectionToolbar: typeof CollectionToolbarImpl & {
586
604
  */
587
605
  declare function totalText<T>(column: CollectionColumn<T>, rows: readonly T[], locale: string): string;
588
606
 
589
- export { type CellContext, type CollectionAlign, type CollectionApi, type CollectionColumn, type CollectionFilter, type CollectionKind, CollectionPagination, type CollectionPaginationProps, type CollectionSort, CollectionToolbar, type CollectionToolbarProps, DataList, type DataListProps, DataTable, type DataTableProps, type DataTableTotalRow, type FilterKind, type FilterOption, type ListSlot, type UseCollectionOptions, balanceOf, collectionTableOptions, compareDecimal, countFacets, defineColumns, formatDate, formatMoney, headerLabel, hiddenSelectedCount, nextSort, pageBounds, pageFlat, searchMatches, selectableIds, sortRows, sumMoney, toMinor, totalText, treeVisibleIds, useCollection };
607
+ export { type CellContext, type CollectionAlign, type CollectionApi, CollectionCards, type CollectionCardsProps, type CollectionColumn, type CollectionFilter, type CollectionKind, CollectionPagination, type CollectionPaginationProps, type CollectionSort, CollectionToolbar, type CollectionToolbarProps, DataList, type DataListProps, DataTable, type DataTableProps, type DataTableTotalRow, type FilterKind, type FilterOption, type ListSlot, type UseCollectionOptions, balanceOf, collectionTableOptions, compareDecimal, countFacets, defineColumns, formatDate, formatMoney, headerLabel, hiddenSelectedCount, nextSort, pageBounds, pageFlat, searchMatches, selectableIds, sortRows, sumMoney, toMinor, totalText, treeVisibleIds, useCollection };
@@ -771,6 +771,25 @@ function widthStyle(width) {
771
771
  if (!width || width === "auto" || width === "min") return void 0;
772
772
  return { width: `var(--sl-${width.replace(/\./g, "-")})` };
773
773
  }
774
+ function CollectionCards({ collection, label, renderCard, empty, loading, className }) {
775
+ const rows = collection.pageRows;
776
+ if (loading && collection.totalCount === 0) {
777
+ return /* @__PURE__ */ jsx(LoadingNote, { text: collection.messages.loading });
778
+ }
779
+ if (!rows.length) {
780
+ return collection.totalCount > 0 || collection.isFiltered ? /* @__PURE__ */ jsx(
781
+ EmptyState,
782
+ {
783
+ size: "compact",
784
+ kind: "no-results",
785
+ title: collection.messages.noResults,
786
+ description: collection.messages.noResultsDescription,
787
+ actions: /* @__PURE__ */ jsx(Button, { emphasis: "standard", onClick: collection.clearFilters, children: collection.messages.clearFilters })
788
+ }
789
+ ) : /* @__PURE__ */ jsx(Fragment, { children: empty ?? /* @__PURE__ */ jsx(EmptyState, { size: "compact", kind: "start", title: collection.messages.nothingHere }) });
790
+ }
791
+ return /* @__PURE__ */ jsx("ul", { className: cn("CollectionCards", className), "aria-label": label, children: rows.map((row) => /* @__PURE__ */ jsx("li", { children: renderCard(row) }, collection.getRowId(row))) });
792
+ }
774
793
  function CollectionPagination({
775
794
  page,
776
795
  pageCount,
@@ -1543,6 +1562,6 @@ function leafRows(row) {
1543
1562
  return children.flatMap(leafRows);
1544
1563
  }
1545
1564
 
1546
- export { CollectionPagination, CollectionToolbar, DataList, DataTable, collectionTableOptions, defineColumns, headerLabel, totalText, useCollection };
1565
+ export { CollectionCards, CollectionPagination, CollectionToolbar, DataList, DataTable, collectionTableOptions, defineColumns, headerLabel, totalText, useCollection };
1547
1566
  //# sourceMappingURL=index.js.map
1548
1567
  //# sourceMappingURL=index.js.map