@stll/ui 0.7.0 → 0.9.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.
@@ -0,0 +1,58 @@
1
+ import { cn } from "../lib/utils.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useRef } from "react";
4
+ import { useVirtualizer } from "@tanstack/react-virtual";
5
+ //#region src/kanban/virtual-cell.tsx
6
+ const DEFAULT_ESTIMATE_SIZE_PX = 128;
7
+ const DEFAULT_OVERSCAN = 8;
8
+ const DEFAULT_LOAD_MORE_THRESHOLD_PX = 200;
9
+ const KANBAN_VIRTUAL_CELL_PAGINATION = {
10
+ NONE: "none",
11
+ CURSOR: "cursor"
12
+ };
13
+ /** Bounded, virtualized Kanban cell with cursor-page request deduplication. */
14
+ const KanbanVirtualCell = ({ rows, getRowKey, renderRow, pagination, containerRef, active = false, backgroundColor, footer, estimateSize = DEFAULT_ESTIMATE_SIZE_PX, overscan = DEFAULT_OVERSCAN, loadMoreThreshold = DEFAULT_LOAD_MORE_THRESHOLD_PX, className }) => {
15
+ const internalRef = useRef(null);
16
+ const scrollRef = containerRef ?? internalRef;
17
+ const requestedPageKeyRef = useRef(null);
18
+ const virtualizer = useVirtualizer({
19
+ count: rows.length,
20
+ estimateSize: () => estimateSize,
21
+ getItemKey: (index) => {
22
+ const row = rows.at(index);
23
+ return row === void 0 ? index : getRowKey(row);
24
+ },
25
+ getScrollElement: () => scrollRef.current,
26
+ overscan
27
+ });
28
+ const handleScroll = ({ currentTarget }) => {
29
+ if (pagination.type !== "cursor" || !pagination.hasMore || pagination.loading) return;
30
+ if (currentTarget.scrollHeight - currentTarget.scrollTop - currentTarget.clientHeight > loadMoreThreshold) return;
31
+ if (requestedPageKeyRef.current === pagination.pageKey) return;
32
+ requestedPageKeyRef.current = pagination.pageKey;
33
+ pagination.onRequestMore();
34
+ };
35
+ return /* @__PURE__ */ jsxs("div", {
36
+ className: cn("bg-muted/20 max-h-[min(60vh,40rem)] min-h-20 overflow-y-auto overscroll-y-contain rounded-xl p-2 transition-[background-color,outline-color]", active && "bg-primary/5 ring-primary/50 ring-2", className),
37
+ onScroll: handleScroll,
38
+ ref: scrollRef,
39
+ style: backgroundColor ? { backgroundColor } : void 0,
40
+ children: [/* @__PURE__ */ jsx("div", {
41
+ className: "relative",
42
+ style: { height: virtualizer.getTotalSize() },
43
+ children: virtualizer.getVirtualItems().map((virtualRow) => {
44
+ const row = rows.at(virtualRow.index);
45
+ if (row === void 0) return null;
46
+ return /* @__PURE__ */ jsx("div", {
47
+ className: "absolute inset-x-0 top-0 pb-2",
48
+ "data-index": virtualRow.index,
49
+ ref: virtualizer.measureElement,
50
+ style: { transform: `translateY(${virtualRow.start}px)` },
51
+ children: renderRow(row)
52
+ }, getRowKey(row));
53
+ })
54
+ }), footer]
55
+ });
56
+ };
57
+ //#endregion
58
+ export { KANBAN_VIRTUAL_CELL_PAGINATION, KanbanVirtualCell };
@@ -0,0 +1,10 @@
1
+ //#region src/lib/control-size.d.ts
2
+ declare const CONTROL_SIZE: Readonly<{
3
+ readonly sm: "sm";
4
+ readonly default: "default";
5
+ readonly lg: "lg";
6
+ }>;
7
+ type ControlSize = (typeof CONTROL_SIZE)[keyof typeof CONTROL_SIZE];
8
+ declare const CONTROL_SIZES: readonly ("sm" | "default" | "lg")[];
9
+ //#endregion
10
+ export { CONTROL_SIZE, CONTROL_SIZES, type ControlSize };
@@ -0,0 +1,9 @@
1
+ //#region src/lib/control-size.ts
2
+ const CONTROL_SIZE = Object.freeze({
3
+ sm: "sm",
4
+ default: "default",
5
+ lg: "lg"
6
+ });
7
+ const CONTROL_SIZES = Object.freeze(Object.values(CONTROL_SIZE));
8
+ //#endregion
9
+ export { CONTROL_SIZE, CONTROL_SIZES };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/ui",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Stella's design system: bidi-aware React primitives built on Base UI, the dockable inspector pane, and the Tailwind v4 theme they are styled with.",
5
5
  "keywords": [
6
6
  "base-ui",
@@ -37,6 +37,10 @@
37
37
  "types": "./dist/components/accordion.d.ts",
38
38
  "import": "./dist/components/accordion.js"
39
39
  },
40
+ "./application-rail": {
41
+ "types": "./dist/components/application-rail.d.ts",
42
+ "import": "./dist/components/application-rail.js"
43
+ },
40
44
  "./alert-dialog": {
41
45
  "types": "./dist/components/alert-dialog.d.ts",
42
46
  "import": "./dist/components/alert-dialog.js"
@@ -85,6 +89,10 @@
85
89
  "types": "./dist/components/command.d.ts",
86
90
  "import": "./dist/components/command.js"
87
91
  },
92
+ "./control-size": {
93
+ "types": "./dist/lib/control-size.d.ts",
94
+ "import": "./dist/lib/control-size.js"
95
+ },
88
96
  "./calendar": {
89
97
  "types": "./dist/calendar/index.d.ts",
90
98
  "import": "./dist/calendar/index.js"
@@ -314,6 +322,10 @@
314
322
  "types": "./dist/components/accordion.d.ts",
315
323
  "import": "./dist/components/accordion.js"
316
324
  },
325
+ "./components/application-rail": {
326
+ "types": "./dist/components/application-rail.d.ts",
327
+ "import": "./dist/components/application-rail.js"
328
+ },
317
329
  "./components/alert-dialog": {
318
330
  "types": "./dist/components/alert-dialog.d.ts",
319
331
  "import": "./dist/components/alert-dialog.js"
@@ -545,6 +557,7 @@
545
557
  "prepack": "bun run build"
546
558
  },
547
559
  "dependencies": {
560
+ "better-result": "3.0.0",
548
561
  "class-variance-authority": "^0.7.1",
549
562
  "clsx": "^2.1.1",
550
563
  "input-otp": "^1.5.0",
@@ -559,6 +572,7 @@
559
572
  "@dnd-kit/sortable": "^10.0.0",
560
573
  "@playwright/test": "^1.62.0",
561
574
  "@stll/typescript-config": "0.0.0",
575
+ "@tanstack/react-virtual": "^3.14.10",
562
576
  "@types/react": "^19.2.17",
563
577
  "@types/react-dom": "^19.2.3",
564
578
  "bun-types": "1.4.0",
@@ -574,6 +588,7 @@
574
588
  "@base-ui/react": "^1.7.0",
575
589
  "@dnd-kit/core": "^6.3.1",
576
590
  "@dnd-kit/sortable": "^10.0.0",
591
+ "@tanstack/react-virtual": "^3.14.10",
577
592
  "react": ">=19",
578
593
  "react-dom": ">=19",
579
594
  "tailwindcss": "^4.3.0"