@columenlabs/lumen-ui 0.1.69 → 0.1.71

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.
@@ -15,7 +15,7 @@ export function DrawerSection({ icon: Icon, title, count, hint, summary, actions
15
15
  const isOpen = open ?? own;
16
16
  const trigger = (_jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm",
17
17
  // No background, grey only on hover, open or not.
18
- className: "w-full justify-start px-1 aria-expanded:bg-transparent aria-expanded:hover:bg-muted", children: [_jsx(ChevronRightIcon, { className: "text-muted-foreground transition-transform group-data-[state=open]/section:rotate-90" }), Icon && _jsx(Icon, { className: "text-muted-foreground" }), _jsx("span", { className: "truncate", children: title }), count != null && (_jsx(Badge, { variant: "secondary", className: "num", children: count })), hint && _jsx("span", { className: "ml-auto font-normal text-muted-foreground text-xs", children: hint })] }) }));
18
+ className: "w-full justify-start px-1 focus-visible:border-transparent focus-visible:ring-2 focus-visible:ring-ring/25 aria-expanded:bg-transparent aria-expanded:hover:bg-muted", children: [_jsx(ChevronRightIcon, { className: "text-muted-foreground transition-transform group-data-[state=open]/section:rotate-90" }), Icon && _jsx(Icon, { className: "text-muted-foreground" }), _jsx("span", { className: "truncate", children: title }), count != null && (_jsx(Badge, { variant: "secondary", className: "num", children: count })), hint && _jsx("span", { className: "ml-auto font-normal text-muted-foreground text-xs", children: hint })] }) }));
19
19
  return (_jsxs(Collapsible, { open: isOpen, onOpenChange: (o) => {
20
20
  setOwn(o);
21
21
  onOpenChange?.(o);
@@ -102,6 +102,8 @@ export function axisStyle(t) {
102
102
  export function LumenEChart({ option, height = 260, on, className, label, }) {
103
103
  const box = useRef(null);
104
104
  const chart = useRef(null);
105
+ /** The option last drawn, serialized: an equal one isn't drawn again. */
106
+ const drawn = useRef(null);
105
107
  const [ready, setReady] = useState(false);
106
108
  const handlers = useRef(on);
107
109
  handlers.current = on;
@@ -122,15 +124,25 @@ export function LumenEChart({ option, height = 260, on, className, label, }) {
122
124
  ro?.disconnect();
123
125
  chart.current?.dispose();
124
126
  chart.current = null;
127
+ drawn.current = null;
125
128
  };
126
129
  }, []);
127
130
  // Canvas can't read CSS variables: `var(--chart-1)` in an option would draw black. Each one is
128
131
  // swapped for its value, again whenever the theme flips.
129
132
  const tokens = useChartTokens();
133
+ // An app re-rendering hands a new but equal option (a hover, a refetch): drawing it again
134
+ // replays the line's entry animation, so the chart blanks under the tooltip. Only a change redraws.
130
135
  // biome-ignore lint/correctness/useExhaustiveDependencies: tokens change when the theme flips.
131
136
  useEffect(() => {
132
- if (ready)
133
- chart.current?.setOption(resolveVars(option), { notMerge: true });
137
+ const c = chart.current;
138
+ if (!ready || !c)
139
+ return;
140
+ const next = resolveVars(option);
141
+ const key = JSON.stringify(next);
142
+ if (key === drawn.current)
143
+ return;
144
+ drawn.current = key;
145
+ c.setOption(next, { notMerge: true });
134
146
  }, [ready, option, tokens]);
135
147
  const names = Object.keys(on ?? {}).join();
136
148
  useEffect(() => {
@@ -1,7 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Invite people: many emails at once, a role, access per scope, how long the link works and a note.
3
3
  // Each result says whether the email went; when it did not, the link is there to copy.
4
- import { emailsIn, levelsOf, } from '@columenlabs/lumen-ui-types/people';
4
+ import { emailsIn, inviteGrants, levelsOf, } from '@columenlabs/lumen-ui-types/people';
5
5
  import { CheckIcon, CopyIcon, MailIcon, TriangleAlertIcon, UserPlusIcon } from 'lucide-react';
6
6
  import { useId, useMemo, useState } from 'react';
7
7
  import { DrawerSection } from '../drawer-section.js';
@@ -22,7 +22,7 @@ export function InviteDrawer({ adapter, view, open, onClose, onSetUpMail, }) {
22
22
  const ids = useId();
23
23
  const [text, setText] = useState('');
24
24
  const [role, setRole] = useState('member');
25
- const [grants, setGrants] = useState([]);
25
+ const [grants, setGrants] = useState(() => inviteGrants(view.scopes));
26
26
  const [days, setDays] = useState(view.inviteDays);
27
27
  const [note, setNote] = useState('');
28
28
  const [busy, setBusy] = useState(false);
@@ -47,7 +47,7 @@ export function InviteDrawer({ adapter, view, open, onClose, onSetUpMail, }) {
47
47
  const reset = () => {
48
48
  setText('');
49
49
  setRole('member');
50
- setGrants([]);
50
+ setGrants(inviteGrants(view.scopes));
51
51
  setDays(view.inviteDays);
52
52
  setNote('');
53
53
  setResults(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ui",
3
- "version": "0.1.69",
3
+ "version": "0.1.71",
4
4
  "description": "Lumen: shared React components (frame, views, widgets, charts, drawers).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  "@codemirror/lang-javascript": "6.2.5",
46
46
  "@codemirror/lang-json": "6.0.2",
47
47
  "@codemirror/lang-sql": "6.10.0",
48
- "@columenlabs/lumen-ui-types": "0.1.69",
48
+ "@columenlabs/lumen-ui-types": "0.1.71",
49
49
  "@dnd-kit/core": "6.3.1",
50
50
  "@dnd-kit/sortable": "10.0.0",
51
51
  "@dnd-kit/utilities": "3.2.2",