@softure-ai/theme-notion 0.19.0 → 0.21.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/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ Newest first. Each version lists what changed for an app that uses the theme. Wh
4
4
  production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
5
5
  "Definition of done").
6
6
 
7
+ ## 0.21.0
8
+
9
+ - `SidePanel footer` (#1312): an optional strip pinned below the scrolling content, with a top border
10
+ (`data-slot="side-panel-footer"`), for an action that belongs to the panel's foot; it is hidden with the panel.
11
+ Without `footer` the markup is unchanged. New optional prop only.
12
+ - Migration: none.
13
+
14
+ ## 0.20.0
15
+
16
+ - `ResizeHandle` (#1311): a vertical handle on a column's right edge that a pointer drags, or the keyboard steps, to set
17
+ the column's width within `min` and `max`; a double click restores `defaultValue`. A focusable `separator`
18
+ (`aria-controls`, `aria-valuenow/min/max`) that takes no width of its own and shows `ring` while hovered, focused or
19
+ dragged; hidden phone-wide. `onChange` on every width, `onCommit` when a drag, key or reset ends. `RESIZE_HANDLE_STEP` is
20
+ exported beside it, and `clampSize` from a plain module, so a Server Component can read a kept width with it.
21
+ - `SidePanel width` (#1311): optional pixel width on a wide screen; phone-wide `beside` and `list` still cover the canvas.
22
+ New optional prop only.
23
+ - Migration: none.
24
+
7
25
  ## 0.19.0
8
26
 
9
27
  - `sft-bridge.css` re-points `@softure-ai/ui`'s `--sft-*` tokens everywhere, not only inside a `PageFrame`: on
package/README.md CHANGED
@@ -138,7 +138,7 @@ sidebar, skeleton, sonner (`Toaster`), spinner, switch, table, tabs, textarea, t
138
138
  word), `PageHeader` (breadcrumb, icon box, title, description, actions), `PropertyList` (fields of one record),
139
139
  `DetailTable` (an item's details as a label and value table), `FoldRow` (a list row folding open to a `DetailTable`
140
140
  and more, a native `<details>`), `PageFrame` (a page outside the app shell, such as a package's sign-in page),
141
- `SidePanel` (a non-modal panel at a side of a canvas, below), `AsidePanelProvider`, `AsidePanelToggle`,
141
+ `SidePanel` (a non-modal panel at a side of a canvas, below), `ResizeHandle` (a drag handle that sets a column's width, below), `AsidePanelProvider`, `AsidePanelToggle`,
142
142
  `AsidePanel` and `AsidePanelSidebarOpener` (a panel slid in from the right of the app shell, beside the content, below), `SheetMenu`, `SheetMenuItem` and `SheetMenuButton`
143
143
  (navigation rows in a side `Sheet`, a phone's drawer, below), `TabBar` (a screen's tabs as links with an optional icon
144
144
  and count, the shown tab in the address; `Tabs` keeps it in client state), `MarkPopover` (a counted tag that opens a
@@ -231,7 +231,9 @@ at once (`Sheet` is modal). It floats on `background` with `shadow-menu`, 24 rem
231
231
  heading and a ghost close button. Layouts: `over` (over the canvas's right side), `left` (over its left side),
232
232
  `beside` (after the canvas, which shrinks to at least 24 rem or half) and `list` (a 24 rem column before the canvas);
233
233
  `beside` and `list` cover the whole canvas on a phone. While closed it is `hidden`. Focus moves into it when it opens;
234
- Escape inside or the close button calls `onClose`, and the caller moves focus back to its opener.
234
+ Escape inside or the close button calls `onClose`, and the caller moves focus back to its opener. An optional
235
+ `footer` is a strip with a top border pinned below the scrolling content (`data-slot="side-panel-footer"`), for an
236
+ action that belongs to the panel's foot; without it the panel has no strip.
235
237
 
236
238
  ```tsx
237
239
  <div className="relative flex h-full">
@@ -243,6 +245,26 @@ Escape inside or the close button calls `onClose`, and the caller moves focus ba
243
245
  </div>
244
246
  ```
245
247
 
248
+ `SidePanel width` (pixels, optional) sets its width on a wide screen; phone-wide `beside` and `list` keep covering the
249
+ canvas.
250
+
251
+ **`ResizeHandle`.** A vertical handle on the right edge of a column (a list, a `SidePanel layout="list"`) that sets the
252
+ column's width: a pointer drags it, the arrow keys step it by `RESIZE_HANDLE_STEP` (16 px, Shift four times that), Home
253
+ and End go to `min` and `max`, a double click restores `defaultValue`. It is a focusable `separator` naming its column
254
+ with `aria-controls` and the width with `aria-valuenow`; it takes no width of its own (it lies over the border between
255
+ the columns) and shows `ring` while hovered, focused or dragged; hidden phone-wide. `onChange` gets every width,
256
+ `onCommit` the width once a drag, key or reset ends (the moment to keep it, e.g. in a cookie). `clampSize(value, min,
257
+ max, fallback)` (a plain module, callable in a Server Component) reads a kept width back within the limits.
258
+
259
+ ```tsx
260
+ <div className="relative flex h-full">
261
+ <SidePanel id="days" heading="Days" layout="list" isOpen onClose={close} width={width}>…</SidePanel>
262
+ <ResizeHandle label={copy.resizeDays} controls="days" value={width} min={240} max={480} defaultValue={384}
263
+ onChange={setWidth} onCommit={keepWidth} />
264
+ <Map className="flex-1" />
265
+ </div>
266
+ ```
267
+
246
268
  **`AsidePanel`.** A column of the app shell that slides in from the right, beside `SidebarInset`: the content
247
269
  narrows next to it and stays usable (`SidePanel` is a panel over a canvas instead). `AsidePanelProvider` replaces
248
270
  `SidebarProvider` (every other prop passes through) and keeps one side panel open at a time: while the panel is open
package/dist/index.d.ts CHANGED
@@ -55,6 +55,8 @@ export { MiniProgress, type MiniProgressProps } from "./notion/MiniProgress.js";
55
55
  export { PageFrame, type PageFrameProps } from "./notion/PageFrame.js";
56
56
  export { PageHeader, type PageCrumb, type PageHeaderProps } from "./notion/PageHeader.js";
57
57
  export { PropertyList, type Property, type PropertyListProps } from "./notion/PropertyList.js";
58
+ export { clampSize, RESIZE_HANDLE_STEP } from "./notion/clamp-size.js";
59
+ export { ResizeHandle, type ResizeHandleProps } from "./notion/ResizeHandle.js";
58
60
  export { RouteLoading, type RouteLoadingProps } from "./notion/RouteLoading.js";
59
61
  export { SheetMenu, SheetMenuButton, SheetMenuItem, type SheetMenuButtonProps } from "./notion/SheetMenu.js";
60
62
  export { SidePanel, type SidePanelLayout, type SidePanelProps } from "./notion/SidePanel.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,g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AgB,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACxJ,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -57,6 +57,8 @@ export { MiniProgress } from "./notion/MiniProgress.js";
57
57
  export { PageFrame } from "./notion/PageFrame.js";
58
58
  export { PageHeader } from "./notion/PageHeader.js";
59
59
  export { PropertyList } from "./notion/PropertyList.js";
60
+ export { clampSize, RESIZE_HANDLE_STEP } from "./notion/clamp-size.js";
61
+ export { ResizeHandle } from "./notion/ResizeHandle.js";
60
62
  export { RouteLoading } from "./notion/RouteLoading.js";
61
63
  export { SheetMenu, SheetMenuButton, SheetMenuItem } from "./notion/SheetMenu.js";
62
64
  export { SidePanel } from "./notion/SidePanel.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,oGAAoG;AACpG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAuB,MAAM,qBAAqB,CAAC;AAE1E,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AACh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,OAAO,EAAE,SAAS,EAA+E,MAAM,uBAAuB,CAAC;AAC/H,OAAO,EAAE,QAAQ,EAA4C,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAoB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAoE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAE,MAAM,EAAqC,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAA0G,MAAM,sBAAsB,CAAC;AACxJ,OAAO,EAAE,aAAa,EAA2B,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAqB,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,GAOf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAA0C,MAAM,wBAAwB,CAAC;AACjG,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,GAQX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,25 @@
1
+ export interface ResizeHandleProps {
2
+ /** The handle's accessible name, from the app's message layer (e.g. "Resize the plan column"). */
3
+ readonly label: string;
4
+ /** The id of the column the handle resizes. */
5
+ readonly controls: string;
6
+ /** The column's width in pixels (controlled). */
7
+ readonly value: number;
8
+ readonly min: number;
9
+ readonly max: number;
10
+ /** The width a double click restores. */
11
+ readonly defaultValue: number;
12
+ /** Every new width, during a drag and on each key. */
13
+ readonly onChange: (value: number) => void;
14
+ /** The width once a drag, a key or the reset ends: the moment to keep it. */
15
+ readonly onCommit?: (value: number) => void;
16
+ readonly className?: string;
17
+ }
18
+ /**
19
+ * A vertical handle on the right edge of a column that a pointer drags, or the keyboard steps, to set the column's width.
20
+ * It takes no width of its own (it lies over the border between two columns) and shows the theme's ring colour while
21
+ * hovered, focused or dragged. Arrow keys step the width (Shift: four steps), Home and End go to the limits, a double
22
+ * click restores the default. Hidden phone-wide, where the columns stack.
23
+ */
24
+ export declare function ResizeHandle({ label, controls, value, min, max, defaultValue, onChange, onCommit, className }: ResizeHandleProps): import("react").JSX.Element;
25
+ //# sourceMappingURL=ResizeHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../src/notion/ResizeHandle.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,iBAAiB;IAChC,kGAAkG;IAClG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAQD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAkFhI"}
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useRef, useState } from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { clampSize, RESIZE_HANDLE_STEP } from "./clamp-size.js";
6
+ const LARGE_STEP_FACTOR = 4;
7
+ /**
8
+ * A vertical handle on the right edge of a column that a pointer drags, or the keyboard steps, to set the column's width.
9
+ * It takes no width of its own (it lies over the border between two columns) and shows the theme's ring colour while
10
+ * hovered, focused or dragged. Arrow keys step the width (Shift: four steps), Home and End go to the limits, a double
11
+ * click restores the default. Hidden phone-wide, where the columns stack.
12
+ */
13
+ export function ResizeHandle({ label, controls, value, min, max, defaultValue, onChange, onCommit, className }) {
14
+ const dragRef = useRef(null);
15
+ const lastRef = useRef(value);
16
+ const [isDragging, setIsDragging] = useState(false);
17
+ lastRef.current = value;
18
+ function change(next) {
19
+ const clamped = clampSize(next, min, max, defaultValue);
20
+ if (clamped !== lastRef.current) {
21
+ lastRef.current = clamped;
22
+ onChange(clamped);
23
+ }
24
+ return clamped;
25
+ }
26
+ function startDrag(event) {
27
+ if (event.button !== 0)
28
+ return;
29
+ event.preventDefault();
30
+ event.currentTarget.setPointerCapture?.(event.pointerId);
31
+ dragRef.current = { pointerId: event.pointerId, startX: event.clientX, startValue: value };
32
+ setIsDragging(true);
33
+ }
34
+ function moveDrag(event) {
35
+ const drag = dragRef.current;
36
+ if (drag === null || drag.pointerId !== event.pointerId)
37
+ return;
38
+ change(drag.startValue + event.clientX - drag.startX);
39
+ }
40
+ function endDrag(event) {
41
+ const drag = dragRef.current;
42
+ if (drag === null || drag.pointerId !== event.pointerId)
43
+ return;
44
+ dragRef.current = null;
45
+ setIsDragging(false);
46
+ event.currentTarget.releasePointerCapture?.(event.pointerId);
47
+ if (lastRef.current !== drag.startValue)
48
+ onCommit?.(lastRef.current);
49
+ }
50
+ function stepByKey(event) {
51
+ const step = event.shiftKey ? RESIZE_HANDLE_STEP * LARGE_STEP_FACTOR : RESIZE_HANDLE_STEP;
52
+ const targets = { ArrowLeft: value - step, ArrowRight: value + step, Home: min, End: max };
53
+ const target = targets[event.key];
54
+ if (target === undefined)
55
+ return;
56
+ event.preventDefault();
57
+ const before = value;
58
+ const next = change(target);
59
+ if (next !== before)
60
+ onCommit?.(next);
61
+ }
62
+ function restoreDefault() {
63
+ const before = value;
64
+ const next = change(defaultValue);
65
+ if (next !== before)
66
+ onCommit?.(next);
67
+ }
68
+ return (_jsx("div", { role: "separator", "aria-orientation": "vertical", "aria-label": label, "aria-controls": controls, "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max, tabIndex: 0, title: label, "data-slot": "resize-handle", "data-dragging": isDragging ? "true" : undefined, className: cn("relative z-4 -mx-1 w-2 flex-none cursor-col-resize touch-none select-none outline-none max-sm:hidden", "after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 after:-translate-x-1/2 after:bg-transparent after:transition-colors", "hover:after:bg-ring focus-visible:after:bg-ring data-[dragging=true]:after:bg-ring", className), onPointerDown: startDrag, onPointerMove: moveDrag, onPointerUp: endDrag, onPointerCancel: endDrag, onKeyDown: stepByKey, onDoubleClick: restoreDefault }));
69
+ }
70
+ //# sourceMappingURL=ResizeHandle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizeHandle.js","sourceRoot":"","sources":["../../src/notion/ResizeHandle.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAyC,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,iBAAiB,GAAG,CAAC,CAAC;AA0B5B;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAqB;IA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xC,CAAC;IAED,OAAO,CACL,cACE,IAAI,EAAC,WAAW,sBACC,UAAU,gBACf,KAAK,mBACF,QAAQ,mBACR,KAAK,mBACL,GAAG,mBACH,GAAG,EAClB,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,KAAK,eACF,eAAe,mBACV,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC9C,SAAS,EAAE,EAAE,CACX,sGAAsG,EACtG,+HAA+H,EAC/H,oFAAoF,EACpF,SAAS,CACV,EACD,aAAa,EAAE,SAAS,EACxB,aAAa,EAAE,QAAQ,EACvB,WAAW,EAAE,OAAO,EACpB,eAAe,EAAE,OAAO,EACxB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,cAAc,GAC7B,CACH,CAAC;AACJ,CAAC"}
@@ -7,7 +7,9 @@ export interface SidePanelProps {
7
7
  readonly isOpen: boolean;
8
8
  readonly onClose: () => void;
9
9
  readonly closeLabel?: string;
10
+ readonly width?: number;
11
+ readonly footer?: ReactNode;
10
12
  readonly children: ReactNode;
11
13
  }
12
- export declare function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel, children }: SidePanelProps): import("react").JSX.Element;
14
+ export declare function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel, width, footer, children }: SidePanelProps): import("react").JSX.Element;
13
15
  //# sourceMappingURL=SidePanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanel.d.ts","sourceRoot":"","sources":["../../src/notion/SidePanel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAS9E,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAElE,MAAM,WAAW,cAAc;IAE7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,eAAe,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STROKE_WIDTH } from "./icon-stroke.js";
8
8
  // A non-modal panel at a side of a canvas (a map) that leaves the canvas usable. Its parent is a `relative` flex row
9
9
  // holding the canvas and the panel. Hidden while closed, so its content leaves the reading order.
10
- export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = messages.sidePanel.close, children }) {
10
+ export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = messages.sidePanel.close, width, footer, children }) {
11
11
  const panelRef = useRef(null);
12
12
  const wasOpenRef = useRef(isOpen);
13
13
  const headingId = `${id}-heading`;
@@ -23,6 +23,6 @@ export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = m
23
23
  event.stopPropagation();
24
24
  onClose();
25
25
  }
26
- return (_jsxs("aside", { ref: panelRef, id: id, tabIndex: -1, "data-slot": "side-panel", className: "absolute inset-y-0 right-0 z-3 flex w-[min(24rem,100%)] flex-col border-l border-border bg-background text-foreground shadow-menu outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[layout=beside]:relative data-[layout=beside]:w-auto data-[layout=beside]:max-w-full data-[layout=beside]:flex-[0_0_max(50%,24rem)] data-[layout=left]:right-auto data-[layout=left]:left-0 data-[layout=left]:border-r data-[layout=left]:border-l-0 max-sm:data-[layout=beside]:absolute max-sm:data-[layout=beside]:inset-0 max-sm:data-[layout=beside]:w-full max-sm:data-[layout=beside]:border-l-0 data-[layout=list]:relative data-[layout=list]:flex-none data-[layout=list]:border-r data-[layout=list]:border-l-0 max-sm:data-[layout=list]:absolute max-sm:data-[layout=list]:inset-0 max-sm:data-[layout=list]:w-full max-sm:data-[layout=list]:border-r-0 [&[hidden]]:hidden", "data-layout": layout, hidden: !isOpen, "aria-labelledby": headingId, "data-testid": id, onKeyDown: closeOnEscape, children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border py-2 pr-2 pl-4", children: [_jsx("h2", { id: headingId, className: "text-heading-3", children: heading }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": closeLabel, onClick: onClose, children: _jsx(X, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) })] }), _jsx("div", { "data-slot": "side-panel-content", className: "grid flex-1 content-start gap-3 overflow-y-auto p-3", children: children })] }));
26
+ return (_jsxs("aside", { ref: panelRef, id: id, tabIndex: -1, "data-slot": "side-panel", className: "absolute inset-y-0 right-0 z-3 flex w-[min(24rem,100%)] flex-col border-l border-border bg-background text-foreground shadow-menu outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[layout=beside]:relative data-[layout=beside]:w-auto data-[layout=beside]:max-w-full data-[layout=beside]:flex-[0_0_max(50%,24rem)] data-[layout=left]:right-auto data-[layout=left]:left-0 data-[layout=left]:border-r data-[layout=left]:border-l-0 max-sm:data-[layout=beside]:absolute max-sm:data-[layout=beside]:inset-0 max-sm:data-[layout=beside]:w-full max-sm:data-[layout=beside]:border-l-0 data-[layout=list]:relative data-[layout=list]:flex-none data-[layout=list]:border-r data-[layout=list]:border-l-0 max-sm:data-[layout=list]:absolute max-sm:data-[layout=list]:inset-0 max-sm:data-[layout=list]:w-full max-sm:data-[layout=list]:border-r-0 [&[hidden]]:hidden sm:data-[sized=true]:w-(--side-panel-width) sm:data-[sized=true]:flex-none", "data-layout": layout, "data-sized": width === undefined ? undefined : "true", style: width === undefined ? undefined : { "--side-panel-width": `${width}px` }, hidden: !isOpen, "aria-labelledby": headingId, "data-testid": id, onKeyDown: closeOnEscape, children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border py-2 pr-2 pl-4", children: [_jsx("h2", { id: headingId, className: "text-heading-3", children: heading }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": closeLabel, onClick: onClose, children: _jsx(X, { "aria-hidden": "true", strokeWidth: ICON_STROKE_WIDTH }) })] }), _jsx("div", { "data-slot": "side-panel-content", className: "grid flex-1 content-start gap-3 overflow-y-auto p-3", children: children }), footer === undefined ? null : (_jsx("div", { "data-slot": "side-panel-footer", className: "flex flex-none border-t border-border p-2", children: footer }))] }));
27
27
  }
28
28
  //# sourceMappingURL=SidePanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanel.js","sourceRoot":"","sources":["../../src/notion/SidePanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAsC,MAAM,OAAO,CAAC;AAE9E,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAmBrD,qHAAqH;AACrH,kGAAkG;AAClG,MAAM,UAAU,SAAS,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAkB;IACjI,MAAM,QAAQ,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,GAAG,EAAE,UAAU,CAAC;IAElC,4EAA4E;IAC5E,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;YAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;QAC7D,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC;IAC9B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,SAAS,aAAa,CAAC,KAAiC;QACtD,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ;YAAE,OAAO;QACnC,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,CACL,iBACE,GAAG,EAAE,QAAQ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L,EACN,2BAAe,oBAAoB,EAAC,SAAS,EAAC,qDAAqD,YAChG,QAAQ,GACL,EACL,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC7B,2BAAe,mBAAmB,EAAC,SAAS,EAAC,2CAA2C,YACrF,MAAM,GACH,CACP,IACK,CACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** A `ResizeHandle`'s keyboard step for an arrow key, in pixels; Shift takes four of them. */
2
+ export declare const RESIZE_HANDLE_STEP = 16;
3
+ /**
4
+ * `value` rounded and kept within `min` and `max`; a value that is not a finite number falls back to `fallback` (itself
5
+ * kept within the limits). Plain module, so a Server Component can read a kept width with it (#1311).
6
+ */
7
+ export declare function clampSize(value: number, min: number, max: number, fallback?: number): number;
8
+ //# sourceMappingURL=clamp-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp-size.d.ts","sourceRoot":"","sources":["../../src/notion/clamp-size.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY,GAAG,MAAM,CAGjG"}
@@ -0,0 +1,12 @@
1
+ /** A `ResizeHandle`'s keyboard step for an arrow key, in pixels; Shift takes four of them. */
2
+ export const RESIZE_HANDLE_STEP = 16;
3
+ /**
4
+ * `value` rounded and kept within `min` and `max`; a value that is not a finite number falls back to `fallback` (itself
5
+ * kept within the limits). Plain module, so a Server Component can read a kept width with it (#1311).
6
+ */
7
+ export function clampSize(value, min, max, fallback = min) {
8
+ if (!Number.isFinite(value))
9
+ return Math.min(Math.max(fallback, min), max);
10
+ return Math.min(Math.max(Math.round(value), min), max);
11
+ }
12
+ //# sourceMappingURL=clamp-size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp-size.js","sourceRoot":"","sources":["../../src/notion/clamp-size.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,QAAQ,GAAW,GAAG;IACvF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3E,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softure-ai/theme-notion",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "SOFTURE AI Notion theme: shadcn/ui components (new-york v4, Radix, Tailwind CSS v4, lucide) with the Notion design system's tokens and deltas, ready to import.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -64,7 +64,7 @@
64
64
  "@softure-ai/theme-kit": "^0.1.4",
65
65
  "class-variance-authority": "^0.7.1",
66
66
  "cmdk": "^1.1.1",
67
- "lucide-react": "^1.70.0",
67
+ "lucide-react": "^1.72.0",
68
68
  "pdfjs-dist": "^6.5.438",
69
69
  "radix-ui": "^1.8.1",
70
70
  "sonner": "^2.0.8",
package/src/index.ts CHANGED
@@ -71,6 +71,8 @@ export { MiniProgress, type MiniProgressProps } from "./notion/MiniProgress.js";
71
71
  export { PageFrame, type PageFrameProps } from "./notion/PageFrame.js";
72
72
  export { PageHeader, type PageCrumb, type PageHeaderProps } from "./notion/PageHeader.js";
73
73
  export { PropertyList, type Property, type PropertyListProps } from "./notion/PropertyList.js";
74
+ export { clampSize, RESIZE_HANDLE_STEP } from "./notion/clamp-size.js";
75
+ export { ResizeHandle, type ResizeHandleProps } from "./notion/ResizeHandle.js";
74
76
  export { RouteLoading, type RouteLoadingProps } from "./notion/RouteLoading.js";
75
77
  export { SheetMenu, SheetMenuButton, SheetMenuItem, type SheetMenuButtonProps } from "./notion/SheetMenu.js";
76
78
  export { SidePanel, type SidePanelLayout, type SidePanelProps } from "./notion/SidePanel.js";
@@ -0,0 +1,123 @@
1
+ "use client";
2
+
3
+ import { useRef, useState, type KeyboardEvent, type PointerEvent } from "react";
4
+
5
+ import { cn } from "../lib/utils.js";
6
+
7
+ import { clampSize, RESIZE_HANDLE_STEP } from "./clamp-size.js";
8
+
9
+ const LARGE_STEP_FACTOR = 4;
10
+
11
+ export interface ResizeHandleProps {
12
+ /** The handle's accessible name, from the app's message layer (e.g. "Resize the plan column"). */
13
+ readonly label: string;
14
+ /** The id of the column the handle resizes. */
15
+ readonly controls: string;
16
+ /** The column's width in pixels (controlled). */
17
+ readonly value: number;
18
+ readonly min: number;
19
+ readonly max: number;
20
+ /** The width a double click restores. */
21
+ readonly defaultValue: number;
22
+ /** Every new width, during a drag and on each key. */
23
+ readonly onChange: (value: number) => void;
24
+ /** The width once a drag, a key or the reset ends: the moment to keep it. */
25
+ readonly onCommit?: (value: number) => void;
26
+ readonly className?: string;
27
+ }
28
+
29
+ interface Drag {
30
+ readonly pointerId: number;
31
+ readonly startX: number;
32
+ readonly startValue: number;
33
+ }
34
+
35
+ /**
36
+ * A vertical handle on the right edge of a column that a pointer drags, or the keyboard steps, to set the column's width.
37
+ * It takes no width of its own (it lies over the border between two columns) and shows the theme's ring colour while
38
+ * hovered, focused or dragged. Arrow keys step the width (Shift: four steps), Home and End go to the limits, a double
39
+ * click restores the default. Hidden phone-wide, where the columns stack.
40
+ */
41
+ export function ResizeHandle({ label, controls, value, min, max, defaultValue, onChange, onCommit, className }: ResizeHandleProps) {
42
+ const dragRef = useRef<Drag | null>(null);
43
+ const lastRef = useRef(value);
44
+ const [isDragging, setIsDragging] = useState(false);
45
+ lastRef.current = value;
46
+
47
+ function change(next: number): number {
48
+ const clamped = clampSize(next, min, max, defaultValue);
49
+ if (clamped !== lastRef.current) {
50
+ lastRef.current = clamped;
51
+ onChange(clamped);
52
+ }
53
+ return clamped;
54
+ }
55
+
56
+ function startDrag(event: PointerEvent<HTMLDivElement>) {
57
+ if (event.button !== 0) return;
58
+ event.preventDefault();
59
+ event.currentTarget.setPointerCapture?.(event.pointerId);
60
+ dragRef.current = { pointerId: event.pointerId, startX: event.clientX, startValue: value };
61
+ setIsDragging(true);
62
+ }
63
+
64
+ function moveDrag(event: PointerEvent<HTMLDivElement>) {
65
+ const drag = dragRef.current;
66
+ if (drag === null || drag.pointerId !== event.pointerId) return;
67
+ change(drag.startValue + event.clientX - drag.startX);
68
+ }
69
+
70
+ function endDrag(event: PointerEvent<HTMLDivElement>) {
71
+ const drag = dragRef.current;
72
+ if (drag === null || drag.pointerId !== event.pointerId) return;
73
+ dragRef.current = null;
74
+ setIsDragging(false);
75
+ event.currentTarget.releasePointerCapture?.(event.pointerId);
76
+ if (lastRef.current !== drag.startValue) onCommit?.(lastRef.current);
77
+ }
78
+
79
+ function stepByKey(event: KeyboardEvent<HTMLDivElement>) {
80
+ const step = event.shiftKey ? RESIZE_HANDLE_STEP * LARGE_STEP_FACTOR : RESIZE_HANDLE_STEP;
81
+ const targets: Record<string, number> = { ArrowLeft: value - step, ArrowRight: value + step, Home: min, End: max };
82
+ const target = targets[event.key];
83
+ if (target === undefined) return;
84
+ event.preventDefault();
85
+ const before = value;
86
+ const next = change(target);
87
+ if (next !== before) onCommit?.(next);
88
+ }
89
+
90
+ function restoreDefault() {
91
+ const before = value;
92
+ const next = change(defaultValue);
93
+ if (next !== before) onCommit?.(next);
94
+ }
95
+
96
+ return (
97
+ <div
98
+ role="separator"
99
+ aria-orientation="vertical"
100
+ aria-label={label}
101
+ aria-controls={controls}
102
+ aria-valuenow={value}
103
+ aria-valuemin={min}
104
+ aria-valuemax={max}
105
+ tabIndex={0}
106
+ title={label}
107
+ data-slot="resize-handle"
108
+ data-dragging={isDragging ? "true" : undefined}
109
+ className={cn(
110
+ "relative z-4 -mx-1 w-2 flex-none cursor-col-resize touch-none select-none outline-none max-sm:hidden",
111
+ "after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 after:-translate-x-1/2 after:bg-transparent after:transition-colors",
112
+ "hover:after:bg-ring focus-visible:after:bg-ring data-[dragging=true]:after:bg-ring",
113
+ className,
114
+ )}
115
+ onPointerDown={startDrag}
116
+ onPointerMove={moveDrag}
117
+ onPointerUp={endDrag}
118
+ onPointerCancel={endDrag}
119
+ onKeyDown={stepByKey}
120
+ onDoubleClick={restoreDefault}
121
+ />
122
+ );
123
+ }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { X } from "lucide-react";
4
- import { useEffect, useRef, type KeyboardEvent, type ReactNode } from "react";
4
+ import { useEffect, useRef, type CSSProperties, type KeyboardEvent, type ReactNode } from "react";
5
5
 
6
6
  import { en as messages } from "../messages/en.js";
7
7
  import { Button } from "../ui/button.js";
@@ -22,12 +22,17 @@ export interface SidePanelProps {
22
22
  readonly onClose: () => void;
23
23
  // The close button's accessible name, from the app's message layer.
24
24
  readonly closeLabel?: string;
25
+ // The panel's width in pixels on a wide screen (a `ResizeHandle` sets it); phone-wide `beside` and `list` keep
26
+ // covering the canvas. Without it, the layout's own width.
27
+ readonly width?: number;
28
+ // A strip pinned below the scrolling content (an action that belongs to the panel's foot); none: no strip.
29
+ readonly footer?: ReactNode;
25
30
  readonly children: ReactNode;
26
31
  }
27
32
 
28
33
  // A non-modal panel at a side of a canvas (a map) that leaves the canvas usable. Its parent is a `relative` flex row
29
34
  // holding the canvas and the panel. Hidden while closed, so its content leaves the reading order.
30
- export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = messages.sidePanel.close, children }: SidePanelProps) {
35
+ export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = messages.sidePanel.close, width, footer, children }: SidePanelProps) {
31
36
  const panelRef = useRef<HTMLElement>(null);
32
37
  const wasOpenRef = useRef(isOpen);
33
38
  const headingId = `${id}-heading`;
@@ -50,8 +55,10 @@ export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = m
50
55
  id={id}
51
56
  tabIndex={-1}
52
57
  data-slot="side-panel"
53
- className="absolute inset-y-0 right-0 z-3 flex w-[min(24rem,100%)] flex-col border-l border-border bg-background text-foreground shadow-menu outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[layout=beside]:relative data-[layout=beside]:w-auto data-[layout=beside]:max-w-full data-[layout=beside]:flex-[0_0_max(50%,24rem)] data-[layout=left]:right-auto data-[layout=left]:left-0 data-[layout=left]:border-r data-[layout=left]:border-l-0 max-sm:data-[layout=beside]:absolute max-sm:data-[layout=beside]:inset-0 max-sm:data-[layout=beside]:w-full max-sm:data-[layout=beside]:border-l-0 data-[layout=list]:relative data-[layout=list]:flex-none data-[layout=list]:border-r data-[layout=list]:border-l-0 max-sm:data-[layout=list]:absolute max-sm:data-[layout=list]:inset-0 max-sm:data-[layout=list]:w-full max-sm:data-[layout=list]:border-r-0 [&[hidden]]:hidden"
58
+ className="absolute inset-y-0 right-0 z-3 flex w-[min(24rem,100%)] flex-col border-l border-border bg-background text-foreground shadow-menu outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-[layout=beside]:relative data-[layout=beside]:w-auto data-[layout=beside]:max-w-full data-[layout=beside]:flex-[0_0_max(50%,24rem)] data-[layout=left]:right-auto data-[layout=left]:left-0 data-[layout=left]:border-r data-[layout=left]:border-l-0 max-sm:data-[layout=beside]:absolute max-sm:data-[layout=beside]:inset-0 max-sm:data-[layout=beside]:w-full max-sm:data-[layout=beside]:border-l-0 data-[layout=list]:relative data-[layout=list]:flex-none data-[layout=list]:border-r data-[layout=list]:border-l-0 max-sm:data-[layout=list]:absolute max-sm:data-[layout=list]:inset-0 max-sm:data-[layout=list]:w-full max-sm:data-[layout=list]:border-r-0 [&[hidden]]:hidden sm:data-[sized=true]:w-(--side-panel-width) sm:data-[sized=true]:flex-none"
54
59
  data-layout={layout}
60
+ data-sized={width === undefined ? undefined : "true"}
61
+ style={width === undefined ? undefined : ({ "--side-panel-width": `${width}px` } as CSSProperties)}
55
62
  hidden={!isOpen}
56
63
  aria-labelledby={headingId}
57
64
  data-testid={id}
@@ -68,6 +75,11 @@ export function SidePanel({ id, heading, layout, isOpen, onClose, closeLabel = m
68
75
  <div data-slot="side-panel-content" className="grid flex-1 content-start gap-3 overflow-y-auto p-3">
69
76
  {children}
70
77
  </div>
78
+ {footer === undefined ? null : (
79
+ <div data-slot="side-panel-footer" className="flex flex-none border-t border-border p-2">
80
+ {footer}
81
+ </div>
82
+ )}
71
83
  </aside>
72
84
  );
73
85
  }
@@ -0,0 +1,11 @@
1
+ /** A `ResizeHandle`'s keyboard step for an arrow key, in pixels; Shift takes four of them. */
2
+ export const RESIZE_HANDLE_STEP = 16;
3
+
4
+ /**
5
+ * `value` rounded and kept within `min` and `max`; a value that is not a finite number falls back to `fallback` (itself
6
+ * kept within the limits). Plain module, so a Server Component can read a kept width with it (#1311).
7
+ */
8
+ export function clampSize(value: number, min: number, max: number, fallback: number = min): number {
9
+ if (!Number.isFinite(value)) return Math.min(Math.max(fallback, min), max);
10
+ return Math.min(Math.max(Math.round(value), min), max);
11
+ }