@hackcove/ui 0.2.4 → 0.2.5
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/README.md +47 -4
- package/dist/Badge.d.ts +9 -0
- package/dist/Badge.js +10 -0
- package/dist/Breadcrumbs.d.ts +22 -3
- package/dist/Breadcrumbs.js +23 -2
- package/dist/Button.d.ts +18 -8
- package/dist/Button.js +54 -22
- package/dist/ButtonGroup.d.ts +14 -0
- package/dist/ButtonGroup.js +10 -0
- package/dist/ButtonLink.d.ts +20 -0
- package/dist/ButtonLink.js +18 -0
- package/dist/Callout.d.ts +10 -2
- package/dist/Callout.js +8 -3
- package/dist/Checkbox.d.ts +10 -4
- package/dist/Checkbox.js +8 -3
- package/dist/ColourSchemeToggle.d.ts +14 -3
- package/dist/ColourSchemeToggle.js +13 -9
- package/dist/DateField.d.ts +15 -2
- package/dist/DateField.js +8 -4
- package/dist/DatePicker.d.ts +1 -1
- package/dist/DatePicker.js +3 -3
- package/dist/Drawer.d.ts +29 -0
- package/dist/Drawer.js +26 -0
- package/dist/FileDrop.d.ts +10 -0
- package/dist/FileDrop.js +11 -0
- package/dist/Input.d.ts +3 -2
- package/dist/Input.js +5 -4
- package/dist/KeyValueList.d.ts +11 -4
- package/dist/KeyValueList.js +14 -5
- package/dist/ListRow.d.ts +36 -0
- package/dist/ListRow.js +31 -0
- package/dist/NavTabs.d.ts +15 -4
- package/dist/NavTabs.js +13 -2
- package/dist/PageFade.d.ts +25 -0
- package/dist/PageFade.js +39 -0
- package/dist/ProgressBar.d.ts +26 -0
- package/dist/ProgressBar.js +32 -0
- package/dist/SegmentedControl.d.ts +11 -0
- package/dist/SegmentedControl.js +22 -0
- package/dist/Select.d.ts +3 -2
- package/dist/Select.js +4 -4
- package/dist/SplitBar.d.ts +21 -0
- package/dist/SplitBar.js +15 -0
- package/dist/StatTile.d.ts +16 -0
- package/dist/StatTile.js +21 -0
- package/dist/Table.d.ts +48 -0
- package/dist/Table.js +42 -0
- package/dist/Tabs.d.ts +13 -0
- package/dist/Tabs.js +23 -0
- package/dist/TextLink.d.ts +19 -4
- package/dist/TextLink.js +19 -4
- package/dist/Textarea.d.ts +3 -2
- package/dist/Textarea.js +4 -4
- package/dist/Timeline.d.ts +21 -0
- package/dist/Timeline.js +19 -0
- package/dist/colourScheme.d.ts +11 -2
- package/dist/colourScheme.js +16 -3
- package/dist/control.d.ts +19 -2
- package/dist/control.js +25 -2
- package/dist/index.d.ts +21 -5
- package/dist/index.js +18 -3
- package/dist/link.d.ts +22 -0
- package/dist/link.js +11 -0
- package/dist/switcher.d.ts +66 -0
- package/dist/switcher.js +53 -0
- package/dist/ui.d.ts +25 -5
- package/dist/ui.js +51 -7
- package/package.json +1 -1
package/dist/ui.d.ts
CHANGED
|
@@ -4,10 +4,25 @@ export declare function PageTitle({ title, subtitle }: {
|
|
|
4
4
|
title: string;
|
|
5
5
|
subtitle?: string;
|
|
6
6
|
}): import("react").JSX.Element;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A bordered panel with an optional title and count; `as` picks the element (default `section`).
|
|
9
|
+
* Three opt-in forms for data views: `flush` drops the padding and clips the corners, for a table
|
|
10
|
+
* that runs edge to edge; `bar` puts the title, count and `actions` in a tinted strip across the
|
|
11
|
+
* top, over the body; `dashed` is an empty-state shell, a dashed outline with centred muted text.
|
|
12
|
+
* `dashed` stands alone: it ignores `flush` and `bar`. A flush card has no padding for a `title`,
|
|
13
|
+
* so give it a `bar`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Card({ title, count, actions, bar, flush, dashed, as: Tag, className, children, }: {
|
|
9
16
|
title?: string;
|
|
10
17
|
count?: number;
|
|
18
|
+
/** Buttons or links at the end of the header: in the strip with `bar`, else beside the title. */
|
|
19
|
+
actions?: ReactNode;
|
|
20
|
+
/** Put the title, count and actions in a tinted strip above the body, edge to edge. */
|
|
21
|
+
bar?: boolean;
|
|
22
|
+
/** No padding and `overflow-hidden`: the body (a table, a list) fills the card. */
|
|
23
|
+
flush?: boolean;
|
|
24
|
+
/** An empty-state shell: dashed outline, no shadow, no fill, centred muted text. */
|
|
25
|
+
dashed?: boolean;
|
|
11
26
|
as?: "section" | "article" | "div";
|
|
12
27
|
className?: string;
|
|
13
28
|
children: ReactNode;
|
|
@@ -17,11 +32,16 @@ export declare function EpicHeader({ color, label }: {
|
|
|
17
32
|
color: string;
|
|
18
33
|
label: string;
|
|
19
34
|
}): import("react").JSX.Element;
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
export type PillTone = "slate" | "amber" | "emerald" | "blue" | "red" | "violet" | "sky";
|
|
36
|
+
/**
|
|
37
|
+
* A small tinted label; `dot` adds a leading dot in the pill's own text colour, `round` swaps the
|
|
38
|
+
* rounded-md corners for a full pill shape.
|
|
39
|
+
*/
|
|
40
|
+
export declare function Pill({ children, tone, dot, round, }: {
|
|
22
41
|
children: ReactNode;
|
|
23
|
-
tone?:
|
|
42
|
+
tone?: PillTone;
|
|
24
43
|
dot?: boolean;
|
|
44
|
+
round?: boolean;
|
|
25
45
|
}): import("react").JSX.Element;
|
|
26
46
|
export declare function Empty({ children }: {
|
|
27
47
|
children: ReactNode;
|
package/dist/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from "./cx.js";
|
|
3
3
|
import { PageHeaderContent } from "./PageHeader.js";
|
|
4
4
|
// Small presentational primitives written against Tailwind's slate-based class vocabulary
|
|
@@ -7,24 +7,68 @@ import { PageHeaderContent } from "./PageHeader.js";
|
|
|
7
7
|
export function PageTitle({ title, subtitle }) {
|
|
8
8
|
return _jsx(PageHeaderContent, { title: title, subtitle: subtitle });
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (_jsxs(
|
|
10
|
+
function CardHeading({ title, count, bar, spaced, }) {
|
|
11
|
+
const ink = bar ? "text-slate-500" : "text-slate-400";
|
|
12
|
+
return (_jsxs("div", { className: cx("flex items-baseline gap-2", spaced && "mb-3"), children: [_jsx("h2", { className: cx("text-xs font-semibold uppercase tracking-wide", ink), children: title }), count !== undefined && _jsx("span", { className: cx("text-xs font-medium", ink), children: count })] }));
|
|
13
|
+
}
|
|
14
|
+
function CardActions({ children }) {
|
|
15
|
+
return _jsx("div", { className: "ml-auto flex items-center gap-2", children: children });
|
|
16
|
+
}
|
|
17
|
+
function CardBar({ heading, actions }) {
|
|
18
|
+
return (_jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-slate-200/70 bg-slate-50 px-5 py-3", children: [heading, actions && _jsx(CardActions, { children: actions })] }));
|
|
19
|
+
}
|
|
20
|
+
function CardHeader({ heading, actions }) {
|
|
21
|
+
if (!actions)
|
|
22
|
+
return heading;
|
|
23
|
+
return (_jsxs("div", { className: "mb-3 flex items-center justify-between gap-3", children: [heading, _jsx(CardActions, { children: actions })] }));
|
|
24
|
+
}
|
|
25
|
+
/** `dashed` stands alone; `bar` needs a title or actions to fill it. */
|
|
26
|
+
function cardForm(asked, hasHeader) {
|
|
27
|
+
const dashed = asked.dashed ?? false;
|
|
28
|
+
return {
|
|
29
|
+
flush: (asked.flush ?? false) && !dashed,
|
|
30
|
+
bar: (asked.bar ?? false) && !dashed && hasHeader,
|
|
31
|
+
dashed,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function cardClass(form) {
|
|
35
|
+
const { flush, bar, dashed } = form;
|
|
36
|
+
const clipped = flush || bar;
|
|
37
|
+
const padding = dashed ? "p-8 text-center text-sm text-slate-500" : "p-5";
|
|
38
|
+
return cx("rounded-xl border", dashed ? "border-dashed border-slate-300" : "border-slate-200/70 bg-white", !clipped && padding, !dashed && "shadow-sm", clipped && "overflow-hidden");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A bordered panel with an optional title and count; `as` picks the element (default `section`).
|
|
42
|
+
* Three opt-in forms for data views: `flush` drops the padding and clips the corners, for a table
|
|
43
|
+
* that runs edge to edge; `bar` puts the title, count and `actions` in a tinted strip across the
|
|
44
|
+
* top, over the body; `dashed` is an empty-state shell, a dashed outline with centred muted text.
|
|
45
|
+
* `dashed` stands alone: it ignores `flush` and `bar`. A flush card has no padding for a `title`,
|
|
46
|
+
* so give it a `bar`.
|
|
47
|
+
*/
|
|
48
|
+
export function Card({ title, count, actions, bar, flush, dashed, as: Tag = "section", className, children, }) {
|
|
49
|
+
const form = cardForm({ flush, bar, dashed }, Boolean(title || actions));
|
|
50
|
+
const heading = title && (_jsx(CardHeading, { title: title, count: count, bar: form.bar, spaced: !form.bar && !actions }));
|
|
51
|
+
return (_jsx(Tag, { className: cx(cardClass(form), className), children: form.bar ? (_jsxs(_Fragment, { children: [_jsx(CardBar, { heading: heading, actions: actions }), _jsx("div", { className: form.flush ? undefined : "p-5", children: children })] })) : (_jsxs(_Fragment, { children: [_jsx(CardHeader, { heading: heading, actions: actions }), children] })) }));
|
|
13
52
|
}
|
|
14
53
|
/** A coloured epic header row: a dot in the epic's colour + its label. */
|
|
15
54
|
export function EpicHeader({ color, label }) {
|
|
16
55
|
return (_jsxs("div", { className: "mb-1.5 mt-3 flex items-center gap-2 first:mt-0", children: [_jsx("span", { className: "inline-block h-2.5 w-2.5 rounded-full", style: { backgroundColor: color } }), _jsx("span", { className: "text-sm font-semibold text-slate-700", children: label })] }));
|
|
17
56
|
}
|
|
18
|
-
/**
|
|
19
|
-
|
|
57
|
+
/**
|
|
58
|
+
* A small tinted label; `dot` adds a leading dot in the pill's own text colour, `round` swaps the
|
|
59
|
+
* rounded-md corners for a full pill shape.
|
|
60
|
+
*/
|
|
61
|
+
export function Pill({ children, tone = "slate", dot = false, round = false, }) {
|
|
20
62
|
const tones = {
|
|
21
63
|
slate: "bg-slate-100 text-slate-600",
|
|
22
64
|
amber: "bg-amber-50 text-amber-700",
|
|
23
65
|
emerald: "bg-emerald-50 text-emerald-700",
|
|
24
66
|
blue: "bg-blue-50 text-blue-700",
|
|
25
67
|
red: "bg-red-50 text-red-900",
|
|
68
|
+
violet: "bg-violet-50 text-violet-700",
|
|
69
|
+
sky: "bg-sky-50 text-sky-700",
|
|
26
70
|
};
|
|
27
|
-
return (_jsxs("span", { className: cx("rounded-md px-1.5 py-0.5 text-xs font-medium", tones[tone], dot && "inline-flex items-center gap-1"), children: [dot && _jsx("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 rounded-full bg-current" }), children] }));
|
|
71
|
+
return (_jsxs("span", { className: cx(round ? "rounded-full" : "rounded-md", "px-1.5 py-0.5 text-xs font-medium", tones[tone], dot && "inline-flex items-center gap-1"), children: [dot && _jsx("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 rounded-full bg-current" }), children] }));
|
|
28
72
|
}
|
|
29
73
|
export function Empty({ children }) {
|
|
30
74
|
return _jsx("p", { className: "text-sm text-slate-400", children: children });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hackcove/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Hack Cove React components: primitives, typography roles and a safe Markdown renderer, written against Tailwind v4 utilities. Pair with a @hackcove/theme-* package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|