@upbound/monarch-blocks 0.5.0 → 0.6.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.
package/README.md CHANGED
@@ -51,6 +51,23 @@ import { DataTable } from '@upbound/monarch-blocks/data-table';
51
51
  Same caveat as `monarch-core`: the root barrel bundles every component into one file and is a client boundary
52
52
  unconditionally. Import a component's own subpath if you need it in a context where that matters.
53
53
 
54
+ ## Graph needs its own CSS
55
+
56
+ `Graph`/`GraphView` render on [ReactFlow](https://reactflow.dev), which ships its own base stylesheet for
57
+ `Controls`/`MiniMap`/`Background`/handle positioning. This is the one component in the package that ships CSS — import
58
+ it once, alongside `monarch-core`'s theme:
59
+
60
+ ```css
61
+ @import 'tailwindcss';
62
+ @import '@upbound/monarch-core/theme.css';
63
+ @import '@upbound/monarch-blocks/graph.css';
64
+
65
+ @source '../../node_modules/@upbound/monarch-core/dist/*.js';
66
+ @source '../../node_modules/@upbound/monarch-blocks/dist/*.js';
67
+ ```
68
+
69
+ No other component in this package needs a CSS import.
70
+
54
71
  ## Not part of the shadcn registry
55
72
 
56
73
  Unlike `@upbound/monarch-core`, these components are **not** available through `npx shadcn add @monarch/...` — the
@@ -66,6 +66,9 @@ var twMerge = extendTailwindMerge({
66
66
  function cn(...inputs) {
67
67
  return twMerge(clsx(inputs));
68
68
  }
69
+ function sortBy(items, getKey) {
70
+ return [...items].sort((a, b) => getKey(a).localeCompare(getKey(b)));
71
+ }
69
72
 
70
73
  // src/hooks/use-mounted.ts
71
74
  import { useSyncExternalStore } from "react";
@@ -1278,7 +1281,10 @@ function CelAddFilterButton({
1278
1281
  list.push(column);
1279
1282
  groupMap.set(key, list);
1280
1283
  }
1281
- const groups = Array.from(groupMap.entries()).map(([value, items]) => ({ value, items }));
1284
+ const groups = sortBy(
1285
+ Array.from(groupMap.entries()).map(([value, items]) => ({ value, items: sortBy(items, (item) => item.title) })),
1286
+ (group) => group.value
1287
+ );
1282
1288
  return /* @__PURE__ */ jsxs(
1283
1289
  Combobox,
1284
1290
  {
@@ -1506,7 +1512,7 @@ function CelCheckboxComboboxPill({
1506
1512
  container
1507
1513
  }) {
1508
1514
  var _a;
1509
- const options = (_a = columnDef.options) != null ? _a : [];
1515
+ const options = sortBy((_a = columnDef.options) != null ? _a : [], (o) => o.label);
1510
1516
  const value = isCheckboxCelValue(condition.value) ? condition.value : [];
1511
1517
  const selected = options.filter((option) => value.includes(option.value));
1512
1518
  const allowedOperators = getAllowedOperators(columnDef);
@@ -1595,7 +1601,7 @@ function CelRadioComboboxPill({
1595
1601
  container
1596
1602
  }) {
1597
1603
  var _a, _b;
1598
- const options = (_a = columnDef.options) != null ? _a : [];
1604
+ const options = sortBy((_a = columnDef.options) != null ? _a : [], (o) => o.label);
1599
1605
  const value = typeof condition.value === "string" ? condition.value : "";
1600
1606
  const selected = (_b = options.find((option) => option.value === value)) != null ? _b : null;
1601
1607
  const allowedOperators = getAllowedOperators(columnDef);