@open-lakehouse/ui-kit 0.0.0-stage → 0.0.2
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 +14 -0
- package/DESIGN.md +105 -0
- package/README.md +48 -2
- package/dist/ThemeProvider.d.ts +11 -0
- package/dist/ThemeProvider.d.ts.map +1 -0
- package/dist/ThemeProvider.js +40 -0
- package/dist/ThemeProvider.js.map +1 -0
- package/dist/badge.d.ts +10 -0
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +22 -0
- package/dist/badge.js.map +1 -0
- package/dist/button.d.ts +12 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +34 -0
- package/dist/button.js.map +1 -0
- package/dist/card.d.ts +9 -0
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +20 -0
- package/dist/card.js.map +1 -0
- package/dist/commit-history.d.ts +76 -0
- package/dist/commit-history.d.ts.map +1 -0
- package/dist/commit-history.js +121 -0
- package/dist/commit-history.js.map +1 -0
- package/dist/dialog.d.ts +22 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +27 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dropdown-menu.d.ts +16 -0
- package/dist/dropdown-menu.d.ts.map +1 -0
- package/dist/dropdown-menu.js +23 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/input.d.ts +4 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +11 -0
- package/dist/input.js.map +1 -0
- package/dist/label.d.ts +5 -0
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +8 -0
- package/dist/label.js.map +1 -0
- package/dist/resizable.d.ts +29 -0
- package/dist/resizable.d.ts.map +1 -0
- package/dist/resizable.js +54 -0
- package/dist/resizable.js.map +1 -0
- package/dist/select.d.ts +10 -0
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +23 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.d.ts +6 -0
- package/dist/separator.d.ts.map +1 -0
- package/dist/separator.js +7 -0
- package/dist/separator.js.map +1 -0
- package/dist/sheet.d.ts +23 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/sheet.js +37 -0
- package/dist/sheet.js.map +1 -0
- package/dist/sonner.d.ts +3 -0
- package/dist/sonner.d.ts.map +1 -0
- package/dist/sonner.js +15 -0
- package/dist/sonner.js.map +1 -0
- package/dist/switch.d.ts +8 -0
- package/dist/switch.d.ts.map +1 -0
- package/dist/switch.js +9 -0
- package/dist/switch.js.map +1 -0
- package/dist/tabs.d.ts +8 -0
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +13 -0
- package/dist/tabs.js.map +1 -0
- package/dist/textarea.d.ts +4 -0
- package/dist/textarea.d.ts.map +1 -0
- package/dist/textarea.js +11 -0
- package/dist/textarea.js.map +1 -0
- package/dist/tooltip.d.ts +8 -0
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +11 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -0
- package/package.json +54 -4
- package/src/ThemeProvider.tsx +57 -0
- package/src/badge.tsx +34 -0
- package/src/button.tsx +56 -0
- package/src/card.tsx +87 -0
- package/src/commit-history.tsx +339 -0
- package/src/dialog.tsx +119 -0
- package/src/dropdown-menu.tsx +99 -0
- package/src/index.ts +87 -0
- package/src/input.tsx +27 -0
- package/src/label.tsx +21 -0
- package/src/resizable.tsx +95 -0
- package/src/select.tsx +127 -0
- package/src/separator.tsx +25 -0
- package/src/sheet.tsx +131 -0
- package/src/sonner.tsx +26 -0
- package/src/switch.tsx +47 -0
- package/src/tabs.tsx +53 -0
- package/src/textarea.tsx +25 -0
- package/src/tooltip.tsx +28 -0
- package/src/utils.ts +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.0.2](https://github.com/open-lakehouse/trestle/compare/ui-kit-v0.0.1...ui-kit-v0.0.2) - 2026-11-21
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- add a GitHub-style commit history component (#425)
|
package/DESIGN.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Design token contract: `@open-lakehouse/ui-kit`
|
|
2
|
+
|
|
3
|
+
This is the shared design contract for every Open Lakehouse web UI: trestle's
|
|
4
|
+
environment editor, mangrove's Unity Catalog UI, headwaters' lineage UI and the
|
|
5
|
+
desktop shell. It follows the
|
|
6
|
+
[`design.md`](https://github.com/google-labs-code/design.md) convention. It is
|
|
7
|
+
the one place that fixes the *contract*, but not the concrete look, so a
|
|
8
|
+
component themed here drops into any of those apps unchanged.
|
|
9
|
+
|
|
10
|
+
The primitives in this package are **headless with respect to theme**. They emit
|
|
11
|
+
semantic Tailwind utilities (`bg-background`, `text-foreground`, `border-border`,
|
|
12
|
+
…) and own **no color values, no light/dark palette, and no Tailwind config**.
|
|
13
|
+
Each host application supplies the actual values as CSS variables. Separate apps
|
|
14
|
+
stay visually coherent because they agree on the variable *names and meanings*
|
|
15
|
+
below, and each one can still pick its own values.
|
|
16
|
+
|
|
17
|
+
## How theming is injected
|
|
18
|
+
|
|
19
|
+
1. The host defines the variables below on `:root` (light) and `.dark` (dark) in
|
|
20
|
+
its own global stylesheet.
|
|
21
|
+
2. The host maps them to Tailwind color tokens via `@theme inline`
|
|
22
|
+
(`--color-background: hsl(var(--background));` …).
|
|
23
|
+
3. The host adds a `@source` glob so Tailwind scans this package and generates
|
|
24
|
+
the utilities the primitives reference. When the package is installed from the
|
|
25
|
+
registry, point the glob at the build. Inside a workspace that links it, point
|
|
26
|
+
it at the source:
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
@source "../node_modules/@open-lakehouse/ui-kit/dist"; /* installed */
|
|
30
|
+
@source "../../ui-kit/src"; /* workspace */
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Do the same for every other `@open-lakehouse/*` UI package the host renders,
|
|
34
|
+
including ones it only renders indirectly.
|
|
35
|
+
|
|
36
|
+
The reference implementation of steps 1–3 is trestle's
|
|
37
|
+
`node/env-app/src/globals.css`. A host may pick entirely different values. Only
|
|
38
|
+
the variable names are the contract.
|
|
39
|
+
|
|
40
|
+
## The variables (HSL components: `H S% L%`)
|
|
41
|
+
|
|
42
|
+
Every consumer MUST define the required groups on both `:root` and `.dark`. An
|
|
43
|
+
optional group is needed only by the views that use it.
|
|
44
|
+
|
|
45
|
+
### Surfaces & text (required)
|
|
46
|
+
| Variable | Meaning |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `--background` / `--foreground` | App canvas + primary text on it |
|
|
49
|
+
| `--card` / `--card-foreground` | Raised surface (panels, cards, graph nodes) + its text |
|
|
50
|
+
| `--popover` / `--popover-foreground` | Floating surface (menus, tooltips) + its text |
|
|
51
|
+
| `--muted` / `--muted-foreground` | Subdued fill + secondary/label text |
|
|
52
|
+
|
|
53
|
+
### Interaction (required)
|
|
54
|
+
| Variable | Meaning |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| `--primary` / `--primary-foreground` | Primary action fill + text on it (also the graph's selected/incident accent) |
|
|
57
|
+
| `--secondary` / `--secondary-foreground` | Secondary action fill + text on it |
|
|
58
|
+
| `--accent` / `--accent-foreground` | Hover/active accent fill + text on it |
|
|
59
|
+
| `--destructive` / `--destructive-foreground` | Danger action fill + text on it |
|
|
60
|
+
| `--success` / `--success-foreground` | Success fill + text on it (used by the `success` badge) |
|
|
61
|
+
| `--border` | Hairline borders (also the default `border-color`) |
|
|
62
|
+
| `--input` | Form control border |
|
|
63
|
+
| `--ring` | Focus ring |
|
|
64
|
+
| `--radius` | Base corner radius (a length such as `0.5rem`, not an HSL triple) |
|
|
65
|
+
|
|
66
|
+
### Status accents (required)
|
|
67
|
+
| Variable | Meaning |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| `--status-planned` | Neutral / not started |
|
|
70
|
+
| `--status-ready` | Ready / warning-amber |
|
|
71
|
+
| `--status-done` | Success |
|
|
72
|
+
| `--status-in-progress` | Active (usually tracks `--primary`) |
|
|
73
|
+
| `--status-blocked` | Error / blocked |
|
|
74
|
+
|
|
75
|
+
### IDE chrome (optional; IDE-style shells such as env-editor's `WorkspaceShell`)
|
|
76
|
+
| Variable | Meaning |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `--sidebar` / `--sidebar-foreground` | Sidebar and tab-strip surface + text |
|
|
79
|
+
| `--sidebar-accent` | Selected / hovered row in the sidebar |
|
|
80
|
+
| `--activitybar` | The icon rail left of the sidebar |
|
|
81
|
+
| `--statusbar` / `--statusbar-foreground` | The status bar along the bottom + text on it |
|
|
82
|
+
|
|
83
|
+
### Delta-log action slots (optional; mangrove's `log-query` views)
|
|
84
|
+
| Variable | Meaning |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| `--action-add` / `--action-remove` | add / remove actions (reuse the good / critical hues) |
|
|
87
|
+
| `--action-metadata` / `--action-protocol` / `--action-txn` / `--action-domain` | the neutral action kinds, as distinct categorical hues |
|
|
88
|
+
|
|
89
|
+
These views always pair a hue with an icon and label.
|
|
90
|
+
|
|
91
|
+
### Typography (font stacks, not HSL; required)
|
|
92
|
+
| Variable | Meaning |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| `--font-sans` | UI sans-serif stack |
|
|
95
|
+
| `--font-mono` | Monospace stack (code, identifiers, ports, data cells) |
|
|
96
|
+
|
|
97
|
+
## Rules
|
|
98
|
+
|
|
99
|
+
- **Add a token here before using it in a primitive.** A primitive must never
|
|
100
|
+
reference a `--var` that isn't in this contract, or hosts will render it unset.
|
|
101
|
+
- **Values live in hosts, not here.** Do not add a `:root {}` block or a
|
|
102
|
+
Tailwind config to this package.
|
|
103
|
+
- **Changing a token's meaning is a contract change.** Coordinate it across the
|
|
104
|
+
consuming apps (trestle's env-app, mangrove, headwaters, the desktop shell) so
|
|
105
|
+
palettes stay aligned.
|
package/README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@open-lakehouse/ui-kit`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The shared presentational kit for the Open Lakehouse web UIs: the shadcn/Radix
|
|
4
|
+
primitives (`Button`, `Dialog`, `Select`, `Tooltip`, …), the `cn` class-merge
|
|
5
|
+
helper, and the `ThemeProvider` / `useTheme` theme context. Trestle's
|
|
6
|
+
env-editor, mangrove's Unity Catalog UI, headwaters' lineage UI and the desktop
|
|
7
|
+
shell all build on it, so the primitives live in one place instead of being
|
|
8
|
+
copied per repo.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bun add @open-lakehouse/ui-kit # or npm / pnpm
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Published to npmjs.com and GitHub Packages. `react` and `react-dom` (19) are
|
|
17
|
+
peers.
|
|
18
|
+
|
|
19
|
+
## Public surface
|
|
20
|
+
|
|
21
|
+
Import from the barrel, `@open-lakehouse/ui-kit`:
|
|
22
|
+
|
|
23
|
+
- Primitives: `Badge`, `Button`, `Card*`, `Dialog*`, `DropdownMenu*`, `Input`,
|
|
24
|
+
`Label`, `ResizeHandle` / `usePaneSize`, `Select*`, `Separator`, `Sheet*`,
|
|
25
|
+
`Switch`, `Tabs*`, `Textarea`, `Toaster`, `Tooltip*` (plus the `*Variants` and
|
|
26
|
+
`*Props` for `Badge` / `Button`).
|
|
27
|
+
- Composites: `CommitHistory`, a GitHub-style history (entries grouped by day
|
|
28
|
+
along a timeline, with author, relative time, badges and a copyable ref).
|
|
29
|
+
Hosts map their own records (revisions, commits, table versions) to
|
|
30
|
+
`CommitHistoryEntry`.
|
|
31
|
+
- Helpers: `cn`, `groupByDay`, `formatRelativeTime`.
|
|
32
|
+
- Theme: `ThemeProvider`, `useTheme`.
|
|
33
|
+
|
|
34
|
+
## Tailwind
|
|
35
|
+
|
|
36
|
+
This package ships Tailwind utility classes but owns no Tailwind config and no
|
|
37
|
+
theme values. The consuming app supplies the design tokens and points a
|
|
38
|
+
`@source` glob at this package so Tailwind generates the utilities. The token
|
|
39
|
+
contract every consumer must satisfy, and the `@source` lines, are in
|
|
40
|
+
[`DESIGN.md`](./DESIGN.md).
|
|
41
|
+
|
|
42
|
+
## Distribution
|
|
43
|
+
|
|
44
|
+
`bun run build` emits ESM + declarations to `dist/`, and `exports` point there.
|
|
45
|
+
Inside trestle's `node/` workspace, consumers resolve the `source` export
|
|
46
|
+
condition to `src/` instead (`customConditions` in `tsconfig.base.json`,
|
|
47
|
+
`resolve.conditions` in the Vite configs), so local development needs no build
|
|
48
|
+
step. Releases are cut by release-plz through the placeholder crate in
|
|
49
|
+
`Cargo.toml`; see [`node/README.md`](../README.md).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type Theme = "dark" | "light" | "system";
|
|
2
|
+
interface ThemeContextValue {
|
|
3
|
+
theme: Theme;
|
|
4
|
+
setTheme: (theme: Theme) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function ThemeProvider({ children }: {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export declare function useTheme(): ThemeContextValue;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEzC,UAAU,iBAAiB;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAOD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,+BAsCxE;AAED,wBAAgB,QAAQ,sBAEvB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
3
|
+
const ThemeContext = createContext({
|
|
4
|
+
theme: "system",
|
|
5
|
+
setTheme: () => { },
|
|
6
|
+
});
|
|
7
|
+
export function ThemeProvider({ children }) {
|
|
8
|
+
const [theme, setThemeState] = useState("system");
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const stored = localStorage.getItem("theme");
|
|
11
|
+
if (stored)
|
|
12
|
+
setThemeState(stored);
|
|
13
|
+
}, []);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const root = document.documentElement;
|
|
16
|
+
if (theme === "dark") {
|
|
17
|
+
root.classList.add("dark");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (theme === "light") {
|
|
21
|
+
root.classList.remove("dark");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// "system": follow the OS preference and keep following it live.
|
|
25
|
+
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
26
|
+
const apply = () => root.classList.toggle("dark", media.matches);
|
|
27
|
+
apply();
|
|
28
|
+
media.addEventListener("change", apply);
|
|
29
|
+
return () => media.removeEventListener("change", apply);
|
|
30
|
+
}, [theme]);
|
|
31
|
+
function setTheme(t) {
|
|
32
|
+
setThemeState(t);
|
|
33
|
+
localStorage.setItem("theme", t);
|
|
34
|
+
}
|
|
35
|
+
return (_jsx(ThemeContext.Provider, { value: { theme, setTheme }, children: children }));
|
|
36
|
+
}
|
|
37
|
+
export function useTheme() {
|
|
38
|
+
return useContext(ThemeContext);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AASvE,MAAM,YAAY,GAAG,aAAa,CAAoB;IACpD,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAiC;IACvE,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAQ,QAAQ,CAAC,CAAC;IAEzD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAiB,CAAC;QAC7D,IAAI,MAAM;YAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC;QAEtC,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC3B,OAAO;QACT,CAAC;QACD,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;YACtB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC9B,OAAO;QACT,CAAC;QAED,iEAAiE;QACjE,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;QAChE,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACjE,KAAK,EAAE,CAAC;QACR,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,SAAS,QAAQ,CAAC,CAAQ;QACxB,aAAa,CAAC,CAAC,CAAC,CAAC;QACjB,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,CACL,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,YAC9C,QAAQ,GACa,CACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/badge.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "primary" | "success" | "outline" | "destructive" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
|
|
7
|
+
}
|
|
8
|
+
declare function Badge({ className, variant, ...props }: BadgeProps): React.JSX.Element;
|
|
9
|
+
export { Badge, badgeVariants };
|
|
10
|
+
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../src/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAIpC,QAAA,MAAM,aAAa;;8EAgBlB,CAAC;AAEF,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EAC3C,YAAY,CAAC,OAAO,aAAa,CAAC;CAAG;AAEzC,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,qBAI1D;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/badge.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "./utils.js";
|
|
4
|
+
const badgeVariants = cva("inline-flex items-center rounded border px-1.5 py-0.5 text-xs font-medium uppercase tracking-wide transition-colors", {
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: "border-transparent bg-muted text-muted-foreground",
|
|
8
|
+
primary: "border-transparent bg-primary/15 text-primary",
|
|
9
|
+
success: "border-transparent bg-success/15 text-success",
|
|
10
|
+
outline: "border-border text-muted-foreground",
|
|
11
|
+
destructive: "border-transparent bg-destructive/15 text-destructive",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
variant: "default",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
function Badge({ className, variant, ...props }) {
|
|
19
|
+
return (_jsx("span", { className: cn(badgeVariants({ variant }), className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
export { Badge, badgeVariants };
|
|
22
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../src/badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,aAAa,GAAG,GAAG,CACvB,qHAAqH,EACrH;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,mDAAmD;YAC5D,OAAO,EAAE,+CAA+C;YACxD,OAAO,EAAE,+CAA+C;YACxD,OAAO,EAAE,qCAAqC;YAC9C,WAAW,EAAE,uDAAuD;SACrE;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;KACnB;CACF,CACF,CAAC;AAMF,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAc;IACzD,OAAO,CACL,eAAM,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAC1E,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "outline" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { Button, buttonVariants };
|
|
12
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../src/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,cAAc;;;8EA2BnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,MAAM,uFAWX,CAAC;AAGF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { Slot as SlotPrimitive } from "radix-ui";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
10
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
11
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
13
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
14
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
default: "h-10 px-4 py-2",
|
|
18
|
+
sm: "h-9 rounded-md px-3",
|
|
19
|
+
lg: "h-11 rounded-md px-8",
|
|
20
|
+
icon: "h-10 w-10",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "default",
|
|
25
|
+
size: "default",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
29
|
+
const Comp = asChild ? SlotPrimitive.Slot : "button";
|
|
30
|
+
return (_jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
31
|
+
});
|
|
32
|
+
Button.displayName = "Button";
|
|
33
|
+
export { Button, buttonVariants };
|
|
34
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../src/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,cAAc,GAAG,GAAG,CACxB,0VAA0V,EAC1V;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,wDAAwD;YACjE,WAAW,EACT,oEAAoE;YACtE,OAAO,EACL,gFAAgF;YAClF,SAAS,EACP,8DAA8D;YAChE,KAAK,EAAE,8CAA8C;YACrD,IAAI,EAAE,iDAAiD;SACxD;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,gBAAgB;YACzB,EAAE,EAAE,qBAAqB;YACzB,EAAE,EAAE,sBAAsB;YAC1B,IAAI,EAAE,WAAW;SAClB;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAC;AAQF,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAC7B,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IACrD,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAC3D,GAAG,EAAE,GAAG,KACJ,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/card.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, };
|
|
9
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../src/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,QAAA,MAAM,IAAI,6GAYR,CAAC;AAGH,QAAA,MAAM,UAAU,6GASd,CAAC;AAGH,QAAA,MAAM,SAAS,6GASb,CAAC;AAGH,QAAA,MAAM,eAAe,6GASnB,CAAC;AAGH,QAAA,MAAM,WAAW,6GAKf,CAAC;AAGH,QAAA,MAAM,UAAU,6GASd,CAAC;AAGH,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,CAAC"}
|
package/dist/card.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "./utils.js";
|
|
4
|
+
// A raised surface for grouping content (the module/capability picker tiles, panels).
|
|
5
|
+
// Headless with respect to theme: it emits `bg-card`/`text-card-foreground`/`border`
|
|
6
|
+
// semantic utilities and owns no color values, per the ui-kit DESIGN.md contract.
|
|
7
|
+
const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("rounded-lg border bg-card text-card-foreground shadow-sm", className), ...props })));
|
|
8
|
+
Card.displayName = "Card";
|
|
9
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex flex-col gap-1 p-4", className), ...props })));
|
|
10
|
+
CardHeader.displayName = "CardHeader";
|
|
11
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("text-sm font-semibold leading-none", className), ...props })));
|
|
12
|
+
CardTitle.displayName = "CardTitle";
|
|
13
|
+
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("text-xs text-muted-foreground", className), ...props })));
|
|
14
|
+
CardDescription.displayName = "CardDescription";
|
|
15
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("p-4 pt-0", className), ...props })));
|
|
16
|
+
CardContent.displayName = "CardContent";
|
|
17
|
+
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex items-center p-4 pt-0", className), ...props })));
|
|
18
|
+
CardFooter.displayName = "CardFooter";
|
|
19
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, };
|
|
20
|
+
//# sourceMappingURL=card.js.map
|
package/dist/card.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../src/card.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,sFAAsF;AACtF,qFAAqF;AACrF,kFAAkF;AAElF,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAG3B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,0DAA0D,EAC1D,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AACH,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;AAE1B,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAGjC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,KAC/C,KAAK,GACT,CACH,CAAC,CAAC;AACH,UAAU,CAAC,WAAW,GAAG,Y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}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** Who made a commit. */
|
|
3
|
+
export interface CommitAuthor {
|
|
4
|
+
name: string;
|
|
5
|
+
/** Drawn in place of the initials, where the host has one. */
|
|
6
|
+
avatarUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
/** One commit (or revision, version…) in a `CommitHistory`. */
|
|
9
|
+
export interface CommitHistoryEntry {
|
|
10
|
+
/** Stable identity: the React key and what `selectedId` matches. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** The first line of the message, or a fallback such as "Revision #3". */
|
|
13
|
+
title: ReactNode;
|
|
14
|
+
/** The rest of the message, clamped to two lines. */
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
/** A short hash or digest, drawn in mono with a copy button. */
|
|
17
|
+
ref?: string;
|
|
18
|
+
/** The full hash, for the ref's tooltip and what the copy button copies. */
|
|
19
|
+
refTitle?: string;
|
|
20
|
+
author?: CommitAuthor;
|
|
21
|
+
/** When it was made (a `Date` or an ISO 8601 string). Entries without one
|
|
22
|
+
* are grouped under "Undated". */
|
|
23
|
+
timestamp?: string | Date;
|
|
24
|
+
/** Small tags next to the ref, e.g. a number or "HEAD". */
|
|
25
|
+
badges?: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/** The entries made on one calendar day, or the undated ones. */
|
|
28
|
+
export interface CommitDayGroup {
|
|
29
|
+
/** `YYYY-MM-DD` in local time, or `"undated"`. */
|
|
30
|
+
key: string;
|
|
31
|
+
/** Midnight of that day; absent for the undated group. */
|
|
32
|
+
day?: Date;
|
|
33
|
+
entries: CommitHistoryEntry[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Group `entries` by local calendar day, keeping their order: groups appear in
|
|
37
|
+
* the order of their first entry (newest first when the entries are), and
|
|
38
|
+
* entries without a (valid) timestamp come last, under `"undated"`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function groupByDay(entries: readonly CommitHistoryEntry[]): CommitDayGroup[];
|
|
41
|
+
/**
|
|
42
|
+
* How long ago `date` was, relative to `now`: "just now" under a minute, then
|
|
43
|
+
* the largest whole unit ("5 minutes ago", "yesterday", "3 weeks ago").
|
|
44
|
+
* A `date` after `now` reads "just now" too (clock skew between hosts).
|
|
45
|
+
*/
|
|
46
|
+
export declare function formatRelativeTime(date: Date, now?: Date, locale?: string): string;
|
|
47
|
+
export interface CommitHistoryProps {
|
|
48
|
+
/** Newest first. */
|
|
49
|
+
entries: readonly CommitHistoryEntry[];
|
|
50
|
+
/** Makes each entry's title a button. */
|
|
51
|
+
onSelect?: (entry: CommitHistoryEntry) => void;
|
|
52
|
+
/** The highlighted entry. */
|
|
53
|
+
selectedId?: string;
|
|
54
|
+
/** Per-entry actions (e.g. compare), shown on hover and focus. */
|
|
55
|
+
renderActions?: (entry: CommitHistoryEntry) => ReactNode;
|
|
56
|
+
/** Group the entries under a heading per day. Defaults to true. */
|
|
57
|
+
groupByDay?: boolean;
|
|
58
|
+
/** Narrow layout for sidebars: the ref and badges move under the title. */
|
|
59
|
+
compact?: boolean;
|
|
60
|
+
/** A day's heading. Defaults to the date, e.g. "Nov 21, 2026". */
|
|
61
|
+
dayLabel?: (day: Date) => ReactNode;
|
|
62
|
+
/** Drawn when there are no entries. */
|
|
63
|
+
emptyState?: ReactNode;
|
|
64
|
+
/** The reference time for relative timestamps. Defaults to now. */
|
|
65
|
+
now?: Date;
|
|
66
|
+
"aria-label"?: string;
|
|
67
|
+
className?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A commit history in the style of GitHub's commits page: the entries grouped
|
|
71
|
+
* by day along a timeline, each with its title, author, relative time, badges
|
|
72
|
+
* and a copyable ref. Generic over what is being versioned: the host maps its
|
|
73
|
+
* own records (revisions, commits, table versions) to `CommitHistoryEntry`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function CommitHistory({ entries, onSelect, selectedId, renderActions, groupByDay: grouped, compact, dayLabel, emptyState, now, "aria-label": ariaLabel, className, }: CommitHistoryProps): import("react").JSX.Element;
|
|
76
|
+
//# sourceMappingURL=commit-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-history.d.ts","sourceRoot":"","sources":["../src/commit-history.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAIjD,yBAAyB;AACzB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,+DAA+D;AAC/D,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,0EAA0E;IAC1E,KAAK,EAAE,SAAS,CAAC;IACjB,qDAAqD;IACrD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;uCACmC;IACnC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAED,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAUD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,SAAS,kBAAkB,EAAE,GACrC,cAAc,EAAE,CAwBlB;AAWD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,GAAG,GAAE,IAAiB,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CASR;AAUD,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvC,yCAAyC;IACzC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,SAAS,CAAC;IACzD,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,SAAS,CAAC;IACpC,uCAAuC;IACvC,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,mEAAmE;IACnE,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,QAAQ,EACR,UAAU,EACV,aAAa,EACb,UAAU,EAAE,OAAc,EAC1B,OAAe,EACf,QAA0B,EAC1B,UAAU,EACV,GAAG,EACH,YAAY,EAAE,SAAS,EACvB,SAAS,GACV,EAAE,kBAAkB,+BA4CpB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Check, Copy, GitCommitHorizontal } from "lucide-react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { cn } from "./utils.js";
|
|
5
|
+
function toDate(value) {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
9
|
+
return Number.isNaN(date.getTime()) ? undefined : date;
|
|
10
|
+
}
|
|
11
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
12
|
+
/**
|
|
13
|
+
* Group `entries` by local calendar day, keeping their order: groups appear in
|
|
14
|
+
* the order of their first entry (newest first when the entries are), and
|
|
15
|
+
* entries without a (valid) timestamp come last, under `"undated"`.
|
|
16
|
+
*/
|
|
17
|
+
export function groupByDay(entries) {
|
|
18
|
+
const groups = new Map();
|
|
19
|
+
const undated = [];
|
|
20
|
+
for (const entry of entries) {
|
|
21
|
+
const date = toDate(entry.timestamp);
|
|
22
|
+
if (!date) {
|
|
23
|
+
undated.push(entry);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const key = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
27
|
+
let group = groups.get(key);
|
|
28
|
+
if (!group) {
|
|
29
|
+
group = {
|
|
30
|
+
key,
|
|
31
|
+
day: new Date(date.getFullYear(), date.getMonth(), date.getDate()),
|
|
32
|
+
entries: [],
|
|
33
|
+
};
|
|
34
|
+
groups.set(key, group);
|
|
35
|
+
}
|
|
36
|
+
group.entries.push(entry);
|
|
37
|
+
}
|
|
38
|
+
const out = [...groups.values()];
|
|
39
|
+
if (undated.length > 0)
|
|
40
|
+
out.push({ key: "undated", entries: undated });
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
const UNITS = [
|
|
44
|
+
["minute", 60],
|
|
45
|
+
["hour", 60 * 60],
|
|
46
|
+
["day", 24 * 60 * 60],
|
|
47
|
+
["week", 7 * 24 * 60 * 60],
|
|
48
|
+
["month", 30 * 24 * 60 * 60],
|
|
49
|
+
["year", 365 * 24 * 60 * 60],
|
|
50
|
+
];
|
|
51
|
+
/**
|
|
52
|
+
* How long ago `date` was, relative to `now`: "just now" under a minute, then
|
|
53
|
+
* the largest whole unit ("5 minutes ago", "yesterday", "3 weeks ago").
|
|
54
|
+
* A `date` after `now` reads "just now" too (clock skew between hosts).
|
|
55
|
+
*/
|
|
56
|
+
export function formatRelativeTime(date, now = new Date(), locale) {
|
|
57
|
+
const seconds = Math.round((now.getTime() - date.getTime()) / 1000);
|
|
58
|
+
if (seconds < 60)
|
|
59
|
+
return "just now";
|
|
60
|
+
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
61
|
+
let unit = UNITS[0];
|
|
62
|
+
for (const candidate of UNITS) {
|
|
63
|
+
if (seconds >= candidate[1])
|
|
64
|
+
unit = candidate;
|
|
65
|
+
}
|
|
66
|
+
return rtf.format(-Math.floor(seconds / unit[1]), unit[0]);
|
|
67
|
+
}
|
|
68
|
+
function defaultDayLabel(day) {
|
|
69
|
+
return day.toLocaleDateString(undefined, {
|
|
70
|
+
month: "short",
|
|
71
|
+
day: "numeric",
|
|
72
|
+
year: "numeric",
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A commit history in the style of GitHub's commits page: the entries grouped
|
|
77
|
+
* by day along a timeline, each with its title, author, relative time, badges
|
|
78
|
+
* and a copyable ref. Generic over what is being versioned: the host maps its
|
|
79
|
+
* own records (revisions, commits, table versions) to `CommitHistoryEntry`.
|
|
80
|
+
*/
|
|
81
|
+
export function CommitHistory({ entries, onSelect, selectedId, renderActions, groupByDay: grouped = true, compact = false, dayLabel = defaultDayLabel, emptyState, now, "aria-label": ariaLabel, className, }) {
|
|
82
|
+
if (entries.length === 0) {
|
|
83
|
+
return (_jsx("div", { className: cn("text-xs text-muted-foreground", className), children: emptyState ?? "No commits yet." }));
|
|
84
|
+
}
|
|
85
|
+
const groups = grouped
|
|
86
|
+
? groupByDay(entries)
|
|
87
|
+
: [{ key: "all", entries: [...entries] }];
|
|
88
|
+
const row = (entry) => (_jsx(CommitRow, { entry: entry, selected: entry.id === selectedId, onSelect: onSelect, actions: renderActions?.(entry), compact: compact, now: now }, entry.id));
|
|
89
|
+
return (_jsx("section", { "aria-label": ariaLabel, className: cn("text-sm", className), children: groups.map((group) => (_jsxs("div", { children: [grouped && (_jsxs("h3", { className: "flex items-center gap-1.5 py-1 text-xs text-muted-foreground", children: [_jsx(GitCommitHorizontal, { "aria-hidden": true, className: "h-3.5 w-3.5 shrink-0" }), group.day ? dayLabel(group.day) : "Undated"] })), _jsx("div", { className: cn(grouped && "ml-[7px] border-l pb-3 pl-3"), children: _jsx("ol", { className: "divide-y overflow-hidden rounded-md border bg-card text-card-foreground", children: group.entries.map(row) }) })] }, group.key))) }));
|
|
90
|
+
}
|
|
91
|
+
function CommitRow({ entry, selected, onSelect, actions, compact, now, }) {
|
|
92
|
+
const date = toDate(entry.timestamp);
|
|
93
|
+
const titleClass = "block w-full truncate text-left font-medium";
|
|
94
|
+
const tags = (entry.badges || entry.ref) && (_jsxs("span", { className: "flex shrink-0 items-center gap-1", children: [entry.badges, entry.ref && _jsx(RefChip, { value: entry.ref, full: entry.refTitle })] }));
|
|
95
|
+
return (_jsxs("li", { className: cn("group flex items-start gap-2", compact ? "px-2 py-1.5" : "px-3 py-2", selected && "bg-accent text-accent-foreground"), children: [_jsxs("div", { className: "min-w-0 flex-1", children: [onSelect ? (_jsx("button", { type: "button", className: cn(titleClass, "rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"), "aria-current": selected || undefined, onClick: () => onSelect(entry), children: entry.title })) : (_jsx("span", { className: titleClass, children: entry.title })), entry.description && (_jsx("p", { className: "mt-0.5 line-clamp-2 text-xs text-muted-foreground", children: entry.description })), _jsxs("div", { className: "mt-0.5 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground", children: [entry.author && (_jsxs(_Fragment, { children: [_jsx(Avatar, { author: entry.author }), _jsx("span", { className: "truncate font-medium text-foreground", children: entry.author.name })] })), date && (_jsxs("time", { dateTime: date.toISOString(), title: date.toLocaleString(), children: [entry.author && !compact ? "committed " : "", formatRelativeTime(date, now)] })), compact && tags] })] }), !compact && tags, actions && (_jsx("span", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100", children: actions }))] }));
|
|
96
|
+
}
|
|
97
|
+
function Avatar({ author }) {
|
|
98
|
+
if (author.avatarUrl) {
|
|
99
|
+
return (_jsx("img", { src: author.avatarUrl, alt: "", className: "h-4 w-4 shrink-0 rounded-full" }));
|
|
100
|
+
}
|
|
101
|
+
const initials = author.name
|
|
102
|
+
.split(/\s+/)
|
|
103
|
+
.filter(Boolean)
|
|
104
|
+
.slice(0, 2)
|
|
105
|
+
.map((part) => part[0]?.toUpperCase())
|
|
106
|
+
.join("");
|
|
107
|
+
return (_jsx("span", { "aria-hidden": true, className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground", children: initials }));
|
|
108
|
+
}
|
|
109
|
+
/** A short ref in mono, copying the full one on a click. */
|
|
110
|
+
function RefChip({ value, full }) {
|
|
111
|
+
const [copied, setCopied] = useState(false);
|
|
112
|
+
const text = full ?? value;
|
|
113
|
+
const copy = () => {
|
|
114
|
+
void navigator.clipboard?.writeText(text).then(() => {
|
|
115
|
+
setCopied(true);
|
|
116
|
+
setTimeout(() => setCopied(false), 1500);
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
return (_jsxs("span", { className: "inline-flex items-center rounded border bg-background font-mono text-[11px] text-muted-foreground", title: text, children: [_jsx("span", { className: "px-1", children: value }), _jsx("button", { type: "button", "aria-label": `Copy ${text}`, onClick: copy, className: "border-l px-0.5 py-0.5 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&_svg]:h-3 [&_svg]:w-3", children: copied ? _jsx(Check, {}) : _jsx(Copy, {}) })] }));
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=commit-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-history.js","sourceRoot":"","sources":["../src/commit-history.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC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CAAC;IACL,CAAC,CAAC;IACF,OAAO,CACL,gBACE,SAAS,EAAC,mGAAmG,EAC7G,KAAK,EAAE,IAAI,aAEX,eAAM,SAAS,EAAC,MAAM,YAAE,KAAK,GAAQ,EACrC,iBACE,IAAI,EAAC,QAAQ,gBACD,QAAQ,IAAI,EAAE,EAC1B,OAAO,EAAE,IAAI,EACb,SAAS,EAAC,8IAA8I,YAEvJ,MAAM,CAAC,CAAC,CAAC,KAAC,KAAK,KAAG,CAAC,CAAC,CAAC,KAAC,IAAI,KAAG,GACvB,IACJ,CACR,CAAC;AACJ,CAAC"}
|
package/dist/dialog.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
4
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
6
|
+
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
9
|
+
showClose?: boolean;
|
|
10
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
12
|
+
declare namespace DialogHeader {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
declare function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
16
|
+
declare namespace DialogFooter {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
19
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
20
|
+
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
21
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
22
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../src/dialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,MAAM,uCAAuB,CAAC;AACpC,QAAA,MAAM,aAAa,8GAA0B,CAAC;AAC9C,QAAA,MAAM,YAAY,6CAAyB,CAAC;AAC5C,QAAA,MAAM,WAAW,4GAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa,8JAYjB,CAAC;AAGH,QAAA,MAAM,aAAa;gBAGH,OAAO;wCAsBrB,CAAC;AAGH,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,qBAUtC;kBAbQ,YAAY;;;AAgBrB,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,qBAOtC;kBAVQ,YAAY;;;AAarB,QAAA,MAAM,WAAW,oKASf,CAAC;AAGH,QAAA,MAAM,iBAAiB,8KASrB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
|