@hackcove/ui 0.2.3 → 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 +83 -13
- package/dist/AppShell.d.ts +19 -4
- package/dist/AppShell.js +45 -3
- package/dist/Avatar.d.ts +9 -4
- package/dist/Avatar.js +9 -3
- 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/BulletList.d.ts +3 -0
- package/dist/BulletList.js +6 -0
- 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/Code.d.ts +3 -0
- package/dist/Code.js +6 -0
- package/dist/ColourSchemeToggle.d.ts +14 -3
- package/dist/ColourSchemeToggle.js +13 -9
- package/dist/Container.d.ts +3 -1
- package/dist/Container.js +2 -2
- 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/Divider.d.ts +3 -0
- package/dist/Divider.js +6 -0
- 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/InlineLinks.d.ts +11 -0
- package/dist/InlineLinks.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/Markdown.js +1 -1
- 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/PageLayouts.d.ts +22 -1
- package/dist/PageLayouts.js +20 -2
- 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/Stack.d.ts +18 -6
- package/dist/Stack.js +20 -6
- 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 +27 -0
- package/dist/TextLink.js +23 -0
- 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/Video.d.ts +10 -0
- package/dist/Video.js +10 -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 +29 -7
- package/dist/index.js +24 -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/typography.d.ts +32 -24
- package/dist/typography.js +39 -9
- package/dist/ui.d.ts +25 -5
- package/dist/ui.js +51 -7
- package/package.json +19 -1
package/dist/typography.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, ElementType, ReactNode } from "react";
|
|
1
|
+
import type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from "react";
|
|
2
2
|
export type TypographyColor = "default" | "secondary" | "tertiary" | "muted" | "brand";
|
|
3
3
|
/** Own props shared by every typography component; the rest follow the rendered element. */
|
|
4
4
|
type OwnProps = {
|
|
@@ -19,57 +19,65 @@ export type TypographyProps<E extends ElementType> = OwnProps & {
|
|
|
19
19
|
* overriding PageHeading's size.
|
|
20
20
|
*/
|
|
21
21
|
export declare const Display: {
|
|
22
|
-
<E extends ElementType = "h1">(
|
|
22
|
+
<E extends ElementType = "h1">(props: TypographyProps<E>): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
23
23
|
displayName: string;
|
|
24
24
|
};
|
|
25
25
|
/** The supporting sentence under a `Display`. `p`, text-lg/7 normal, secondary. */
|
|
26
26
|
export declare const Lead: {
|
|
27
|
-
<E extends ElementType = "p">(
|
|
27
|
+
<E extends ElementType = "p">(props: TypographyProps<E>): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
30
30
|
/** Page title. `h1`, text-2xl/8 semibold, primary text. */
|
|
31
31
|
export declare const PageHeading: {
|
|
32
|
-
<E extends ElementType = "h1">(
|
|
33
|
-
displayName: string;
|
|
34
|
-
};
|
|
35
|
-
/** Top-level section header. `h2`, text-base/6 semibold, primary text. */
|
|
36
|
-
export declare const SectionHeading: {
|
|
37
|
-
<E extends ElementType = "h2">({ as, color, className, children, ...rest }: TypographyProps<E>): import("react").JSX.Element;
|
|
38
|
-
displayName: string;
|
|
39
|
-
};
|
|
40
|
-
/** Nested header. `h3`, text-sm/5 semibold, primary text. */
|
|
41
|
-
export declare const SubsectionHeading: {
|
|
42
|
-
<E extends ElementType = "h3">({ as, color, className, children, ...rest }: TypographyProps<E>): import("react").JSX.Element;
|
|
32
|
+
<E extends ElementType = "h1">(props: TypographyProps<E>): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
43
33
|
displayName: string;
|
|
44
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Top-level section header. `h2`, text-base/6 semibold, primary text. `rule` sets
|
|
37
|
+
* a hairline under it (the `Divider` line colour) with the space either side of
|
|
38
|
+
* the line built in.
|
|
39
|
+
*/
|
|
40
|
+
export declare function SectionHeading<E extends ElementType = "h2">({ rule, ...props }: TypographyProps<E> & {
|
|
41
|
+
rule?: boolean;
|
|
42
|
+
}): ReactElement;
|
|
43
|
+
export type SubsectionHeadingSize = "sm" | "base" | "lg";
|
|
44
|
+
/**
|
|
45
|
+
* Nested header. `h3`, text-sm/5 semibold, primary text. `size` steps it up for
|
|
46
|
+
* a card, drawer or form-group title: `sm` (default), `base` (bold) or `lg`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function SubsectionHeading<E extends ElementType = "h3">({ size, ...props }: TypographyProps<E> & {
|
|
49
|
+
size?: SubsectionHeadingSize;
|
|
50
|
+
}): ReactElement;
|
|
45
51
|
/** Dialog/modal title. `h2`, text-base/6 semibold, primary text. */
|
|
46
52
|
export declare const ModalHeading: {
|
|
47
|
-
<E extends ElementType = "h2">(
|
|
53
|
+
<E extends ElementType = "h2">(props: TypographyProps<E>): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
48
54
|
displayName: string;
|
|
49
55
|
};
|
|
50
56
|
/** Supporting line under a heading. `p`, text-sm/5 normal, secondary. */
|
|
51
57
|
export declare const Subtitle: {
|
|
52
|
-
<E extends ElementType = "p">(
|
|
58
|
+
<E extends ElementType = "p">(props: TypographyProps<E>): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
53
59
|
displayName: string;
|
|
54
60
|
};
|
|
55
61
|
/** Small all-caps label above a group. `span`, text-xs semibold uppercase, tertiary. */
|
|
56
62
|
export declare const Overline: {
|
|
57
|
-
<E extends ElementType = "span">(
|
|
58
|
-
displayName: string;
|
|
59
|
-
};
|
|
60
|
-
/** Default running text. `span` (inline; `as="p"` for a paragraph), text-sm/5 normal, secondary. */
|
|
61
|
-
export declare const Body: {
|
|
62
|
-
<E extends ElementType = "span">({ as, color, className, children, ...rest }: TypographyProps<E>): import("react").JSX.Element;
|
|
63
|
+
<E extends ElementType = "span">(props: TypographyProps<E>): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
63
64
|
displayName: string;
|
|
64
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Default running text. `span` (inline; `as="p"` for a paragraph), text-sm/5 normal, secondary.
|
|
68
|
+
* `preserveNewlines` keeps the line breaks in the text (a user-typed note); runs of spaces still collapse.
|
|
69
|
+
*/
|
|
70
|
+
export declare function Body<E extends ElementType = "span">({ preserveNewlines, ...props }: TypographyProps<E> & {
|
|
71
|
+
preserveNewlines?: boolean;
|
|
72
|
+
}): ReactElement;
|
|
65
73
|
/** Emphasised run of body text. `span`, text-sm/5 medium, primary text. */
|
|
66
74
|
export declare const BodyStrong: {
|
|
67
|
-
<E extends ElementType = "span">(
|
|
75
|
+
<E extends ElementType = "span">(props: TypographyProps<E>): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
68
76
|
displayName: string;
|
|
69
77
|
};
|
|
70
78
|
/** Fine print / metadata. `span` (inline; `as="p"` for a block), text-xs/4 normal, tertiary. */
|
|
71
79
|
export declare const Caption: {
|
|
72
|
-
<E extends ElementType = "span">(
|
|
80
|
+
<E extends ElementType = "span">(props: TypographyProps<E>): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
73
81
|
displayName: string;
|
|
74
82
|
};
|
|
75
83
|
export {};
|
package/dist/typography.js
CHANGED
|
@@ -15,13 +15,20 @@ const COLOR = {
|
|
|
15
15
|
* layout classes — never the pinned size/weight.
|
|
16
16
|
*/
|
|
17
17
|
function typography(displayName, defaultAs, variantClass, defaultColor) {
|
|
18
|
-
function Typography(
|
|
19
|
-
|
|
20
|
-
return (_jsx(Tag, { className: cx(variantClass, COLOR[color ?? defaultColor], className), ...rest, children: children }));
|
|
18
|
+
function Typography(props) {
|
|
19
|
+
return pinned(defaultAs, variantClass, defaultColor, props);
|
|
21
20
|
}
|
|
22
21
|
Typography.displayName = displayName;
|
|
23
22
|
return Typography;
|
|
24
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* The one place a pinned role renders. The few roles with an opt-in prop of their own are
|
|
26
|
+
* written by hand, not by `typography`, and call this too.
|
|
27
|
+
*/
|
|
28
|
+
function pinned(defaultAs, variantClass, defaultColor, { as, color, className, children, ...rest }) {
|
|
29
|
+
const Tag = as ?? defaultAs;
|
|
30
|
+
return (_jsx(Tag, { className: cx(variantClass, COLOR[color ?? defaultColor], className), ...rest, children: children }));
|
|
31
|
+
}
|
|
25
32
|
// --- Structural roles (block by default) -----------------------------------
|
|
26
33
|
/**
|
|
27
34
|
* Marketing-scale headline — the one line at the top of a public page. `h1`,
|
|
@@ -35,10 +42,27 @@ export const Display = typography("Display", "h1", "text-4xl/[1.1] font-semibold
|
|
|
35
42
|
export const Lead = typography("Lead", "p", "text-lg/7 font-normal sm:text-xl/8", "secondary");
|
|
36
43
|
/** Page title. `h1`, text-2xl/8 semibold, primary text. */
|
|
37
44
|
export const PageHeading = typography("PageHeading", "h1", "text-2xl/8 font-semibold tracking-tight", "default");
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Top-level section header. `h2`, text-base/6 semibold, primary text. `rule` sets
|
|
47
|
+
* a hairline under it (the `Divider` line colour) with the space either side of
|
|
48
|
+
* the line built in.
|
|
49
|
+
*/
|
|
50
|
+
export function SectionHeading({ rule, ...props }) {
|
|
51
|
+
const variant = cx(rule && "mb-4 border-b border-slate-200/70 pb-2", "text-base/6 font-semibold");
|
|
52
|
+
return pinned("h2", variant, "default", props);
|
|
53
|
+
}
|
|
54
|
+
const SUBSECTION_SIZE = {
|
|
55
|
+
sm: "text-sm/5 font-semibold",
|
|
56
|
+
base: "text-base/6 font-bold",
|
|
57
|
+
lg: "text-lg/7 font-semibold",
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Nested header. `h3`, text-sm/5 semibold, primary text. `size` steps it up for
|
|
61
|
+
* a card, drawer or form-group title: `sm` (default), `base` (bold) or `lg`.
|
|
62
|
+
*/
|
|
63
|
+
export function SubsectionHeading({ size = "sm", ...props }) {
|
|
64
|
+
return pinned("h3", SUBSECTION_SIZE[size], "default", props);
|
|
65
|
+
}
|
|
42
66
|
/** Dialog/modal title. `h2`, text-base/6 semibold, primary text. */
|
|
43
67
|
export const ModalHeading = typography("ModalHeading", "h2", "text-base/6 font-semibold", "default");
|
|
44
68
|
/** Supporting line under a heading. `p`, text-sm/5 normal, secondary. */
|
|
@@ -46,8 +70,14 @@ export const Subtitle = typography("Subtitle", "p", "text-sm/5 font-normal", "se
|
|
|
46
70
|
// --- Inline roles (inline by default) --------------------------------------
|
|
47
71
|
/** Small all-caps label above a group. `span`, text-xs semibold uppercase, tertiary. */
|
|
48
72
|
export const Overline = typography("Overline", "span", "text-xs font-semibold uppercase tracking-wide", "tertiary");
|
|
49
|
-
/**
|
|
50
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Default running text. `span` (inline; `as="p"` for a paragraph), text-sm/5 normal, secondary.
|
|
75
|
+
* `preserveNewlines` keeps the line breaks in the text (a user-typed note); runs of spaces still collapse.
|
|
76
|
+
*/
|
|
77
|
+
export function Body({ preserveNewlines, ...props }) {
|
|
78
|
+
const variant = cx(preserveNewlines && "whitespace-pre-line", "text-sm/5 font-normal");
|
|
79
|
+
return pinned("span", variant, "secondary", props);
|
|
80
|
+
}
|
|
51
81
|
/** Emphasised run of body text. `span`, text-sm/5 medium, primary text. */
|
|
52
82
|
export const BodyStrong = typography("BodyStrong", "span", "text-sm/5 font-medium", "default");
|
|
53
83
|
/** Fine print / metadata. `span` (inline; `as="p"` for a block), text-xs/4 normal, tertiary. */
|
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,8 +1,26 @@
|
|
|
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
|
+
"keywords": [
|
|
6
|
+
"components",
|
|
7
|
+
"design-system",
|
|
8
|
+
"hackcove",
|
|
9
|
+
"markdown",
|
|
10
|
+
"react",
|
|
11
|
+
"tailwind",
|
|
12
|
+
"tailwindcss",
|
|
13
|
+
"ui"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/madangryscientist/hackcove/tree/main/packages/ui#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/madangryscientist/hackcove/issues"
|
|
18
|
+
},
|
|
5
19
|
"license": "MIT",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Jacobus Langner",
|
|
22
|
+
"url": "https://github.com/madangryscientist"
|
|
23
|
+
},
|
|
6
24
|
"repository": {
|
|
7
25
|
"type": "git",
|
|
8
26
|
"url": "git+https://github.com/madangryscientist/hackcove.git",
|