@columenlabs/lumen-ui 0.1.42 → 0.1.43

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.
@@ -874,7 +874,12 @@ function DetailsSection({ domain, draft, setDraft, shownKeys, }) {
874
874
  });
875
875
  }, children: SHAPES.map((s) => {
876
876
  const Icon = shapeIcon(s.value);
877
- return (_jsxs(ToggleGroupItem, { value: s.value, "aria-label": s.label, children: [_jsx(Icon, {}), s.label] }, s.value));
877
+ const note = s.value === 'table'
878
+ ? null
879
+ : (domain.groupNote ?? (s.value === 'pivot' ? domain.pivotNote : null));
880
+ const off = !!note && draft.shape !== s.value;
881
+ const item = (_jsxs(ToggleGroupItem, { value: s.value, "aria-label": s.label, disabled: off, children: [_jsx(Icon, {}), s.label] }, s.value));
882
+ return off ? (_jsx(WhyOff, { note: note, children: item }, s.value)) : (item);
878
883
  }) }) }), draft.shape === 'group' && (_jsx(Row, { label: "Group by", children: fieldSelect('Default grouping', draft.group.default ?? '', offered, (v) => setDraft({ ...draft, group: { ...draft.group, default: v === NONE ? null : v } }), 'No grouping') })), subgroupsOf(domain).length ? (_jsx(Row, { label: subgroupLabel(domain), children: _jsx(LumenSelector, { label: subgroupLabel(domain), size: "sm", className: "w-full min-w-0", options: [
879
884
  { value: NONE, label: 'None' },
880
885
  ...subgroupsOf(domain).map((sg) => ({
@@ -988,7 +993,8 @@ function ColumnList({ base, domain, draft, setDraft, shownKeys, hiddenKeys, onEd
988
993
  hidden: rowKeys.filter((k) => !shown.has(k)),
989
994
  });
990
995
  };
991
- const groupNote = (f) => f.groupNote ??
996
+ const groupNote = (f) => domain.groupNote ??
997
+ f.groupNote ??
992
998
  (f.format === 'text' ? 'Not offered for grouping.' : 'Numbers can’t be grouped.');
993
999
  if (!rows.length)
994
1000
  return _jsx("p", { className: "text-sm text-muted-foreground", children: "Tick fields on the right to show them." });
@@ -1005,7 +1011,7 @@ function ColumnList({ base, domain, draft, setDraft, shownKeys, hiddenKeys, onEd
1005
1011
  const g = groupInfo(f);
1006
1012
  const shown = shownKeys.includes(f.key);
1007
1013
  const canF = canFilterKeys.includes(f.key);
1008
- const canG = groupKeys.includes(f.key);
1014
+ const canG = !domain.groupNote && groupKeys.includes(f.key);
1009
1015
  return (_jsxs(ColumnRow, { id: f.key, className: grid, children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [_jsx("span", { className: cn('h-4 w-1 shrink-0 rounded-full', !shown && 'opacity-40'), style: { background: g.color }, "aria-hidden": true }), _jsx("span", { className: cn('truncate', !shown && 'text-muted-foreground'), children: f.label }), _jsx("span", { className: "truncate text-xs text-muted-foreground max-md:hidden", children: g.label }), !shown && (_jsx(Badge, { variant: "outline", className: "shrink-0 font-normal text-muted-foreground", children: "Not shown" })), isFormula(f.key) && (_jsx(IconButton, { icon: PencilIcon, size: "icon-xs", className: "text-muted-foreground", label: `Edit formula ${f.label}`, onClick: () => onEditFormula(f.key) }))] }), _jsx("span", { className: "flex justify-center", children: _jsx(Checkbox, { "aria-label": `Show ${f.label}`, checked: shown, onCheckedChange: (v) => setShown(f.key, v === true) }) }), canF ? (_jsx("span", { className: "flex justify-center", children: _jsx(Checkbox, { "aria-label": `Filter by ${f.label}`, checked: filterChoices.includes(f.key), onCheckedChange: (v) => setDraft({
1010
1016
  ...draft,
1011
1017
  filters: {
@@ -161,6 +161,11 @@ export interface ViewDomain<T> {
161
161
  fields: ViewField<T>[];
162
162
  /** Field groups in order; without them every field is one group. */
163
163
  groups?: ViewFieldGroup[];
164
+ /** Why its rows can't group at all (a server pages them, so a group would cover one page):
165
+ * Edit view greys the Group and Pivot shapes and every Group box with it. */
166
+ groupNote?: string;
167
+ /** Why its rows can't pivot (a server pages them): Edit view greys the Pivot shape with it. */
168
+ pivotNote?: string;
164
169
  /**
165
170
  * The keys its rows carry (views from data domains): a reader per key, null
166
171
  * for a row without one (cash). The shell's `useJoins` attaches the registry's join fields for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ui",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
4
4
  "description": "Lumen: shared React components (frame, views, widgets, charts, drawers).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "@codemirror/lang-javascript": "6.2.5",
42
42
  "@codemirror/lang-json": "6.0.2",
43
43
  "@codemirror/lang-sql": "6.10.0",
44
- "@columenlabs/lumen-ui-types": "0.1.42",
44
+ "@columenlabs/lumen-ui-types": "0.1.43",
45
45
  "@dnd-kit/core": "6.3.1",
46
46
  "@dnd-kit/sortable": "10.0.0",
47
47
  "@dnd-kit/utilities": "3.2.2",