@heigin/ui 0.1.0 → 0.2.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 +25 -1
- package/dist/components/crm/agent-decision-tree.d.ts +82 -0
- package/dist/components/crm/agent-decision-tree.js +580 -0
- package/dist/components/crm/agent-decision-tree.module.js +113 -0
- package/dist/components/crm/agent-task-trail.d.ts +56 -0
- package/dist/components/crm/agent-task-trail.js +419 -0
- package/dist/components/crm/agent-thinking.d.ts +36 -0
- package/dist/components/crm/agent-thinking.js +443 -0
- package/dist/components/crm/agent-thinking.module.js +33 -0
- package/dist/components/crm/agent.module.js +81 -0
- package/dist/components/crm/crm.module.js +44 -4
- package/dist/components/crm/record-header.d.ts +2 -2
- package/dist/components/crm/workspace-switcher.d.ts +49 -0
- package/dist/components/crm/workspace-switcher.js +205 -0
- package/dist/components/ui/avatar.d.ts +9 -1
- package/dist/components/ui/avatar.js +61 -4
- package/dist/components/ui/avatar.module.js +4 -2
- package/dist/components/ui/breadcrumb.d.ts +10 -0
- package/dist/components/ui/breadcrumb.js +48 -0
- package/dist/components/ui/breadcrumb.module.js +19 -0
- package/dist/components/ui/heigin-mark.d.ts +11 -0
- package/dist/components/ui/heigin-mark.js +41 -0
- package/dist/components/ui/loader.d.ts +21 -0
- package/dist/components/ui/loader.js +45 -0
- package/dist/components/ui/pagination.d.ts +1 -2
- package/dist/components/ui/pagination.js +0 -1
- package/dist/components/ui/table.d.ts +9 -1
- package/dist/components/ui/table.js +136 -89
- package/dist/components/ui/table.module.js +13 -1
- package/dist/components/ui/thinking-orb.d.ts +27 -0
- package/dist/components/ui/thinking-orb.js +27 -0
- package/dist/components/ui/type-motion.d.ts +31 -0
- package/dist/components/ui/type-motion.js +394 -0
- package/dist/components/ui/type-motion.module.js +31 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -1
- package/dist/styles.css +1733 -8
- package/dist/tokens.css +1 -1
- package/dist/tokens.d.ts +2 -2
- package/dist/tokens.js +7 -6
- package/package.json +3 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface Workspace {
|
|
3
|
+
id: string;
|
|
4
|
+
/** Display name — a company name, team name, or sign-in subdomain. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Optional secondary line, e.g. the user's role in the workspace. */
|
|
7
|
+
caption?: string;
|
|
8
|
+
/** Optional avatar URL. Falls back to an initials disc. */
|
|
9
|
+
avatarUrl?: string;
|
|
10
|
+
/** 1–2 characters for the initials disc. Derived from `name` when omitted. */
|
|
11
|
+
initials?: string;
|
|
12
|
+
/** CSS colour for the initials disc. Falls back to the HeiGin brand. */
|
|
13
|
+
accent?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkspaceSwitcherProps {
|
|
16
|
+
/** The currently active workspace — appears in the trigger and gets the check. */
|
|
17
|
+
current: Workspace;
|
|
18
|
+
/** Workspaces the user owns or belongs to directly. */
|
|
19
|
+
owned: Workspace[];
|
|
20
|
+
/** Workspaces the user was invited to from outside their org. */
|
|
21
|
+
external?: Workspace[];
|
|
22
|
+
/** Called when the user picks any workspace, including the current one. */
|
|
23
|
+
onSelect: (workspace: Workspace) => void;
|
|
24
|
+
/** Show a "New workspace" row at the bottom of the list when set. */
|
|
25
|
+
onNew?: () => void;
|
|
26
|
+
/** Show a "View all workspaces" link in the footer when set. */
|
|
27
|
+
onViewAll?: () => void;
|
|
28
|
+
/** Show the search input once the combined list hits this many entries. Pass false to always hide. Default 6. */
|
|
29
|
+
searchThreshold?: number | false;
|
|
30
|
+
/** Labels for the two sections and the chrome. Pass through to override copy. */
|
|
31
|
+
labels?: {
|
|
32
|
+
yours?: string;
|
|
33
|
+
external?: string;
|
|
34
|
+
newWorkspace?: string;
|
|
35
|
+
viewAll?: string;
|
|
36
|
+
search?: string;
|
|
37
|
+
empty?: string;
|
|
38
|
+
triggerLabel?: string;
|
|
39
|
+
};
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A workspace / tenant switcher for the sidebar: shows the active workspace
|
|
44
|
+
* in a compact trigger, and reveals a searchable list grouped into
|
|
45
|
+
* **Your workspaces** and **External** (ones shared in from outside the org).
|
|
46
|
+
* Users with access to multiple HeiGin workspaces can switch without
|
|
47
|
+
* signing out and re-entering a subdomain.
|
|
48
|
+
*/
|
|
49
|
+
export declare function WorkspaceSwitcher({ current, owned, external, onSelect, onNew, onViewAll, searchThreshold, labels, className, }: WorkspaceSwitcherProps): React.JSX.Element;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import popup_module_default from "../ui/popup.module.js";
|
|
5
|
+
import crm_module_default from "./crm.module.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Check, ChevronsUpDown, Plus } from "lucide-react";
|
|
9
|
+
import { Popover } from "@base-ui/react/popover";
|
|
10
|
+
//#region src/components/crm/workspace-switcher.tsx
|
|
11
|
+
var DEFAULT_LABELS = {
|
|
12
|
+
yours: "Your workspaces",
|
|
13
|
+
external: "External",
|
|
14
|
+
newWorkspace: "New workspace",
|
|
15
|
+
viewAll: "View all workspaces",
|
|
16
|
+
search: "Search workspaces…",
|
|
17
|
+
empty: "No workspaces match.",
|
|
18
|
+
triggerLabel: "Switch workspace"
|
|
19
|
+
};
|
|
20
|
+
var initialsOf = (ws) => ws.initials ?? ws.name.replace(/^https?:\/\//, "").split(/[\s._-]+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
21
|
+
function Mark({ ws, size = 20 }) {
|
|
22
|
+
if (ws.avatarUrl) return /* @__PURE__ */ jsx("img", {
|
|
23
|
+
src: ws.avatarUrl,
|
|
24
|
+
alt: "",
|
|
25
|
+
className: crm_module_default.wsMarkImg,
|
|
26
|
+
width: size,
|
|
27
|
+
height: size
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ jsx("span", {
|
|
30
|
+
className: crm_module_default.wsMark,
|
|
31
|
+
style: {
|
|
32
|
+
width: size,
|
|
33
|
+
height: size,
|
|
34
|
+
backgroundColor: ws.accent ?? "var(--hg-color-brand, #4f46e5)"
|
|
35
|
+
},
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
children: initialsOf(ws)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A workspace / tenant switcher for the sidebar: shows the active workspace
|
|
42
|
+
* in a compact trigger, and reveals a searchable list grouped into
|
|
43
|
+
* **Your workspaces** and **External** (ones shared in from outside the org).
|
|
44
|
+
* Users with access to multiple HeiGin workspaces can switch without
|
|
45
|
+
* signing out and re-entering a subdomain.
|
|
46
|
+
*/
|
|
47
|
+
function WorkspaceSwitcher({ current, owned, external = [], onSelect, onNew, onViewAll, searchThreshold = 6, labels, className }) {
|
|
48
|
+
const L = {
|
|
49
|
+
...DEFAULT_LABELS,
|
|
50
|
+
...labels ?? {}
|
|
51
|
+
};
|
|
52
|
+
const [open, setOpen] = React.useState(false);
|
|
53
|
+
const [query, setQuery] = React.useState("");
|
|
54
|
+
const total = owned.length + external.length;
|
|
55
|
+
const showSearch = searchThreshold !== false && total >= searchThreshold;
|
|
56
|
+
const q = query.trim().toLowerCase();
|
|
57
|
+
const match = (ws) => !q || ws.name.toLowerCase().includes(q) || (ws.caption?.toLowerCase().includes(q) ?? false);
|
|
58
|
+
const ownedFiltered = owned.filter(match);
|
|
59
|
+
const externalFiltered = external.filter(match);
|
|
60
|
+
const nothingMatches = q !== "" && ownedFiltered.length === 0 && externalFiltered.length === 0;
|
|
61
|
+
const pick = (ws) => {
|
|
62
|
+
onSelect(ws);
|
|
63
|
+
setOpen(false);
|
|
64
|
+
setQuery("");
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ jsxs(Popover.Root, {
|
|
67
|
+
open,
|
|
68
|
+
onOpenChange: setOpen,
|
|
69
|
+
children: [/* @__PURE__ */ jsxs(Popover.Trigger, {
|
|
70
|
+
className: cn(crm_module_default.wsTrigger, className),
|
|
71
|
+
"aria-label": L.triggerLabel,
|
|
72
|
+
"data-testid": "workspace-switcher-trigger",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx(Mark, { ws: current }),
|
|
75
|
+
/* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: crm_module_default.wsTriggerName,
|
|
77
|
+
children: current.name
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, {
|
|
80
|
+
size: 14,
|
|
81
|
+
strokeWidth: 1.8,
|
|
82
|
+
className: crm_module_default.wsTriggerChevron,
|
|
83
|
+
"aria-hidden": "true"
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
}), /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
87
|
+
className: popup_module_default.positioner,
|
|
88
|
+
side: "bottom",
|
|
89
|
+
align: "start",
|
|
90
|
+
sideOffset: 6,
|
|
91
|
+
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
92
|
+
className: cn(popup_module_default.popup, crm_module_default.wsPopup),
|
|
93
|
+
"data-testid": "workspace-switcher-popup",
|
|
94
|
+
children: [
|
|
95
|
+
showSearch && /* @__PURE__ */ jsx("div", {
|
|
96
|
+
className: crm_module_default.wsSearch,
|
|
97
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
98
|
+
type: "search",
|
|
99
|
+
value: query,
|
|
100
|
+
onChange: (e) => setQuery(e.target.value),
|
|
101
|
+
placeholder: L.search,
|
|
102
|
+
"aria-label": L.search,
|
|
103
|
+
className: crm_module_default.wsSearchInput,
|
|
104
|
+
autoFocus: true
|
|
105
|
+
})
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ jsxs("div", {
|
|
108
|
+
className: crm_module_default.wsScroll,
|
|
109
|
+
role: "listbox",
|
|
110
|
+
"aria-label": L.triggerLabel,
|
|
111
|
+
children: [
|
|
112
|
+
ownedFiltered.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
113
|
+
className: crm_module_default.wsSectionLabel,
|
|
114
|
+
children: L.yours
|
|
115
|
+
}), ownedFiltered.map((ws) => /* @__PURE__ */ jsx(WsRow, {
|
|
116
|
+
ws,
|
|
117
|
+
active: ws.id === current.id,
|
|
118
|
+
onSelect: pick
|
|
119
|
+
}, ws.id))] }),
|
|
120
|
+
externalFiltered.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
121
|
+
className: crm_module_default.wsSectionLabel,
|
|
122
|
+
children: L.external
|
|
123
|
+
}), externalFiltered.map((ws) => /* @__PURE__ */ jsx(WsRow, {
|
|
124
|
+
ws,
|
|
125
|
+
active: ws.id === current.id,
|
|
126
|
+
onSelect: pick
|
|
127
|
+
}, ws.id))] }),
|
|
128
|
+
nothingMatches && /* @__PURE__ */ jsx("p", {
|
|
129
|
+
className: crm_module_default.wsEmpty,
|
|
130
|
+
children: L.empty
|
|
131
|
+
}),
|
|
132
|
+
onNew && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
133
|
+
className: crm_module_default.wsDivider,
|
|
134
|
+
role: "separator"
|
|
135
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
className: cn(crm_module_default.wsRow, crm_module_default.wsRowAction),
|
|
138
|
+
onClick: () => {
|
|
139
|
+
onNew();
|
|
140
|
+
setOpen(false);
|
|
141
|
+
},
|
|
142
|
+
"data-testid": "workspace-switcher-new",
|
|
143
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
144
|
+
className: crm_module_default.wsAction,
|
|
145
|
+
children: /* @__PURE__ */ jsx(Plus, {
|
|
146
|
+
size: 14,
|
|
147
|
+
strokeWidth: 2,
|
|
148
|
+
"aria-hidden": "true"
|
|
149
|
+
})
|
|
150
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
151
|
+
className: crm_module_default.wsRowName,
|
|
152
|
+
children: L.newWorkspace
|
|
153
|
+
})]
|
|
154
|
+
})] })
|
|
155
|
+
]
|
|
156
|
+
}),
|
|
157
|
+
onViewAll && /* @__PURE__ */ jsx("button", {
|
|
158
|
+
type: "button",
|
|
159
|
+
className: crm_module_default.wsFooter,
|
|
160
|
+
onClick: () => {
|
|
161
|
+
onViewAll();
|
|
162
|
+
setOpen(false);
|
|
163
|
+
},
|
|
164
|
+
"data-testid": "workspace-switcher-view-all",
|
|
165
|
+
children: L.viewAll
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
}) })]
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function WsRow({ ws, active, onSelect }) {
|
|
173
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
174
|
+
type: "button",
|
|
175
|
+
role: "option",
|
|
176
|
+
"aria-selected": active,
|
|
177
|
+
className: crm_module_default.wsRow,
|
|
178
|
+
onClick: () => onSelect(ws),
|
|
179
|
+
"data-testid": `workspace-switcher-row-${ws.id}`,
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx(Mark, {
|
|
182
|
+
ws,
|
|
183
|
+
size: 20
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ jsxs("span", {
|
|
186
|
+
className: crm_module_default.wsRowName,
|
|
187
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
188
|
+
className: crm_module_default.wsRowNameText,
|
|
189
|
+
children: ws.name
|
|
190
|
+
}), ws.caption && /* @__PURE__ */ jsx("span", {
|
|
191
|
+
className: crm_module_default.wsRowCaption,
|
|
192
|
+
children: ws.caption
|
|
193
|
+
})]
|
|
194
|
+
}),
|
|
195
|
+
active && /* @__PURE__ */ jsx(Check, {
|
|
196
|
+
size: 14,
|
|
197
|
+
strokeWidth: 2.4,
|
|
198
|
+
className: crm_module_default.wsRowCheck,
|
|
199
|
+
"aria-hidden": "true"
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
export { WorkspaceSwitcher };
|
|
@@ -4,10 +4,18 @@ export interface AvatarProps extends Omit<React.HTMLAttributes<HTMLSpanElement>,
|
|
|
4
4
|
name: string;
|
|
5
5
|
src?: string;
|
|
6
6
|
size?: "xs" | "sm" | "md" | "lg";
|
|
7
|
+
/** `circle` for people (default), `square` for company logos / tenant marks. */
|
|
8
|
+
shape?: "circle" | "square";
|
|
9
|
+
/**
|
|
10
|
+
* When no `src` is set, tint the initials disc with a colour derived from
|
|
11
|
+
* `name` so the same person/company always lands on the same tint. Off by
|
|
12
|
+
* default so existing usage keeps the single accent colour.
|
|
13
|
+
*/
|
|
14
|
+
tinted?: boolean;
|
|
7
15
|
/** Render as decorative (when the name is already shown next to it). */
|
|
8
16
|
decorative?: boolean;
|
|
9
17
|
}
|
|
10
18
|
/** Up to two initials from a name: "Asha Rao" -> "AR", "northwind" -> "N". */
|
|
11
19
|
export declare function getInitials(name: string): string;
|
|
12
|
-
/**
|
|
20
|
+
/** Avatar: image when available, initials otherwise (also the fallback if the image fails). */
|
|
13
21
|
export declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -7,21 +7,78 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
//#region src/components/ui/avatar.tsx
|
|
8
8
|
/** Up to two initials from a name: "Asha Rao" -> "AR", "northwind" -> "N". */
|
|
9
9
|
function getInitials(name) {
|
|
10
|
-
const parts = name.trim().split(
|
|
10
|
+
const parts = name.trim().split(/[\s._/-]+/).filter(Boolean);
|
|
11
11
|
if (parts.length === 0) return "?";
|
|
12
12
|
return (parts[0].charAt(0) + (parts.length > 1 ? parts[parts.length - 1].charAt(0) : "")).toUpperCase();
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Soft, token-friendly tint palette. One entry per hash bucket so the same
|
|
16
|
+
* `name` always picks the same tint. Light background with a readable ink.
|
|
17
|
+
*/
|
|
18
|
+
var TINTS = [
|
|
19
|
+
{
|
|
20
|
+
bg: "#e0f2fe",
|
|
21
|
+
fg: "#075985"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
bg: "#ede9fe",
|
|
25
|
+
fg: "#5b21b6"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
bg: "#dcfce7",
|
|
29
|
+
fg: "#166534"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
bg: "#fef3c7",
|
|
33
|
+
fg: "#92400e"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
bg: "#ffe4e6",
|
|
37
|
+
fg: "#9f1239"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
bg: "#dbeafe",
|
|
41
|
+
fg: "#1e40af"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
bg: "#ccfbf1",
|
|
45
|
+
fg: "#115e59"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
bg: "#fae8ff",
|
|
49
|
+
fg: "#86198f"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
bg: "#fde68a",
|
|
53
|
+
fg: "#78350f"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
bg: "#e5e7eb",
|
|
57
|
+
fg: "#374151"
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
function hashName(name) {
|
|
61
|
+
let h = 0;
|
|
62
|
+
for (let i = 0; i < name.length; i++) h = h * 31 + name.charCodeAt(i) | 0;
|
|
63
|
+
return Math.abs(h);
|
|
64
|
+
}
|
|
65
|
+
/** Avatar: image when available, initials otherwise (also the fallback if the image fails). */
|
|
66
|
+
var Avatar = React.forwardRef(function Avatar({ name, src, size = "md", shape = "circle", tinted = false, decorative = false, className, style, ...props }, ref) {
|
|
16
67
|
const [failed, setFailed] = React.useState(false);
|
|
17
68
|
React.useEffect(() => setFailed(false), [src]);
|
|
18
69
|
const showImage = Boolean(src) && !failed;
|
|
70
|
+
const tint = tinted && !showImage ? TINTS[hashName(name) % TINTS.length] : null;
|
|
19
71
|
return /* @__PURE__ */ jsx("span", {
|
|
20
72
|
ref,
|
|
21
73
|
role: decorative ? void 0 : "img",
|
|
22
74
|
"aria-label": decorative ? void 0 : name,
|
|
23
75
|
"aria-hidden": decorative || void 0,
|
|
24
|
-
className: cn(avatar_module_default.avatar, avatar_module_default[size], className),
|
|
76
|
+
className: cn(avatar_module_default.avatar, avatar_module_default[size], shape === "square" && avatar_module_default.square, className),
|
|
77
|
+
style: tint ? {
|
|
78
|
+
background: tint.bg,
|
|
79
|
+
color: tint.fg,
|
|
80
|
+
...style
|
|
81
|
+
} : style,
|
|
25
82
|
...props,
|
|
26
83
|
children: showImage ? /* @__PURE__ */ jsx("img", {
|
|
27
84
|
src,
|
|
@@ -5,13 +5,15 @@ var sm = "hg-avatar-module_sm_L-cah";
|
|
|
5
5
|
var md = "hg-avatar-module_md_7WX0P";
|
|
6
6
|
var lg = "hg-avatar-module_lg_WGzan";
|
|
7
7
|
var image = "hg-avatar-module_image_2aRlv";
|
|
8
|
+
var square = "hg-avatar-module_square_kjKzx";
|
|
8
9
|
var avatar_module_default = {
|
|
9
10
|
avatar,
|
|
10
11
|
xs,
|
|
11
12
|
sm,
|
|
12
13
|
md,
|
|
13
14
|
lg,
|
|
14
|
-
image
|
|
15
|
+
image,
|
|
16
|
+
square
|
|
15
17
|
};
|
|
16
18
|
//#endregion
|
|
17
|
-
export { avatar, avatar_module_default as default, image, lg, md, sm, xs };
|
|
19
|
+
export { avatar, avatar_module_default as default, image, lg, md, sm, square, xs };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface BreadcrumbItem {
|
|
3
|
+
label: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface BreadcrumbProps extends React.ComponentPropsWithoutRef<"nav"> {
|
|
7
|
+
items: BreadcrumbItem[];
|
|
8
|
+
separator?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import breadcrumb_module_default from "./breadcrumb.module.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ui/breadcrumb.tsx
|
|
6
|
+
var Breadcrumb = React.forwardRef(function Breadcrumb({ items, separator, className, ...props }, ref) {
|
|
7
|
+
if (items.length <= 1) return null;
|
|
8
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
9
|
+
ref,
|
|
10
|
+
"aria-label": "Breadcrumb",
|
|
11
|
+
className: cn(breadcrumb_module_default.nav, className),
|
|
12
|
+
...props,
|
|
13
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
14
|
+
className: breadcrumb_module_default.list,
|
|
15
|
+
children: items.map((item, i) => {
|
|
16
|
+
const isLast = i === items.length - 1;
|
|
17
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
18
|
+
className: breadcrumb_module_default.item,
|
|
19
|
+
children: [i > 0 && /* @__PURE__ */ jsx("span", {
|
|
20
|
+
className: breadcrumb_module_default.separator,
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
children: separator ?? /* @__PURE__ */ jsx("svg", {
|
|
23
|
+
width: "12",
|
|
24
|
+
height: "12",
|
|
25
|
+
viewBox: "0 0 24 24",
|
|
26
|
+
fill: "none",
|
|
27
|
+
stroke: "currentColor",
|
|
28
|
+
strokeWidth: "2",
|
|
29
|
+
strokeLinecap: "round",
|
|
30
|
+
strokeLinejoin: "round",
|
|
31
|
+
children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
|
|
32
|
+
})
|
|
33
|
+
}), isLast || !item.href ? /* @__PURE__ */ jsx("span", {
|
|
34
|
+
className: cn(breadcrumb_module_default.label, isLast && breadcrumb_module_default.current),
|
|
35
|
+
"aria-current": isLast ? "page" : void 0,
|
|
36
|
+
children: item.label
|
|
37
|
+
}) : /* @__PURE__ */ jsx("a", {
|
|
38
|
+
href: item.href,
|
|
39
|
+
className: breadcrumb_module_default.link,
|
|
40
|
+
children: item.label
|
|
41
|
+
})]
|
|
42
|
+
}, i);
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//#endregion
|
|
48
|
+
export { Breadcrumb };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/components/ui/breadcrumb.module.css
|
|
2
|
+
var nav = "hg-breadcrumb-module_nav_bY3Hg";
|
|
3
|
+
var list = "hg-breadcrumb-module_list_aVVLR";
|
|
4
|
+
var item = "hg-breadcrumb-module_item_cBnSf";
|
|
5
|
+
var separator = "hg-breadcrumb-module_separator_qT-T-";
|
|
6
|
+
var link = "hg-breadcrumb-module_link_RTg-M";
|
|
7
|
+
var label = "hg-breadcrumb-module_label_24qcz";
|
|
8
|
+
var current = "hg-breadcrumb-module_current_henO6";
|
|
9
|
+
var breadcrumb_module_default = {
|
|
10
|
+
nav,
|
|
11
|
+
list,
|
|
12
|
+
item,
|
|
13
|
+
separator,
|
|
14
|
+
link,
|
|
15
|
+
label,
|
|
16
|
+
current
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { current, breadcrumb_module_default as default, item, label, link, list, nav, separator };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface HeiGinMarkProps extends Omit<React.SVGProps<SVGSVGElement>, "children"> {
|
|
3
|
+
/** Width and height in px. Default 20. */
|
|
4
|
+
size?: number;
|
|
5
|
+
/** Draw the mark on its accent tile (default) or as bare strokes in `currentColor`. */
|
|
6
|
+
tile?: boolean;
|
|
7
|
+
/** Accessible name. Leave unset when the mark sits next to the visible word "HeiGin". */
|
|
8
|
+
title?: string;
|
|
9
|
+
}
|
|
10
|
+
/** The HeiGin mark: two offset bars, on the accent tile by default. Server-component safe. */
|
|
11
|
+
export declare function HeiGinMark({ size, tile, title, ...props }: HeiGinMarkProps): React.JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/ui/heigin-mark.tsx
|
|
4
|
+
/** The HeiGin mark: two offset bars, on the accent tile by default. Server-component safe. */
|
|
5
|
+
function HeiGinMark({ size = 20, tile = true, title, ...props }) {
|
|
6
|
+
const titleId = React.useId();
|
|
7
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
8
|
+
width: size,
|
|
9
|
+
height: size,
|
|
10
|
+
viewBox: "0 0 64 64",
|
|
11
|
+
fill: "none",
|
|
12
|
+
...title ? {
|
|
13
|
+
role: "img",
|
|
14
|
+
"aria-labelledby": titleId
|
|
15
|
+
} : {
|
|
16
|
+
"aria-hidden": true,
|
|
17
|
+
focusable: "false"
|
|
18
|
+
},
|
|
19
|
+
...props,
|
|
20
|
+
children: [
|
|
21
|
+
title && /* @__PURE__ */ jsx("title", {
|
|
22
|
+
id: titleId,
|
|
23
|
+
children: title
|
|
24
|
+
}),
|
|
25
|
+
tile && /* @__PURE__ */ jsx("rect", {
|
|
26
|
+
width: "64",
|
|
27
|
+
height: "64",
|
|
28
|
+
rx: "14",
|
|
29
|
+
fill: "var(--hg-color-accent, #1f1f1f)"
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ jsxs("g", {
|
|
32
|
+
transform: tile ? "translate(12 12) scale(0.75)" : "translate(5 5) scale(0.9)",
|
|
33
|
+
stroke: tile ? "var(--hg-color-on-accent, #fff)" : "currentColor",
|
|
34
|
+
strokeWidth: "5.39329",
|
|
35
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M35.5928 0V35.594" }), /* @__PURE__ */ jsx("path", { d: "M17.797 17.797V53.3909" })]
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { HeiGinMark };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ThinkingOrbState } from "./thinking-orb.js";
|
|
3
|
+
/** `orb` is HeiGin's dotted thinking orb; `spinner` is the plain ring. */
|
|
4
|
+
export type LoaderVariant = "orb" | "spinner";
|
|
5
|
+
export interface LoaderProps {
|
|
6
|
+
/** Which indicator to draw. Default `orb`. */
|
|
7
|
+
variant?: LoaderVariant;
|
|
8
|
+
/** `sm` and `md` draw a 20px orb (14px / 16px spinner); `lg` draws a 32px orb (20px spinner). */
|
|
9
|
+
size?: "sm" | "md" | "lg";
|
|
10
|
+
/** What the orb animates while it waits. Ignored by the spinner. */
|
|
11
|
+
orbState?: ThinkingOrbState;
|
|
12
|
+
/** Accessible label. Pass `null` when nearby text already says what is loading. */
|
|
13
|
+
label?: string | null;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One loading indicator with a choice of style: the thinking orb or a spinner. Agent components
|
|
19
|
+
* take a `loader` prop and pass it here, so a product can pick one style everywhere.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Loader({ variant, size, orbState, label, className, style }: LoaderProps): React.JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { Spinner } from "./spinner.js";
|
|
5
|
+
import { ThinkingOrb } from "./thinking-orb.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ui/loader.tsx
|
|
9
|
+
var ORB_SIZE = {
|
|
10
|
+
sm: 20,
|
|
11
|
+
md: 20,
|
|
12
|
+
lg: 32
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* One loading indicator with a choice of style: the thinking orb or a spinner. Agent components
|
|
16
|
+
* take a `loader` prop and pass it here, so a product can pick one style everywhere.
|
|
17
|
+
*/
|
|
18
|
+
function Loader({ variant = "orb", size = "md", orbState = "working", label = "Loading", className, style }) {
|
|
19
|
+
if (variant === "spinner") return /* @__PURE__ */ jsx(Spinner, {
|
|
20
|
+
size,
|
|
21
|
+
label,
|
|
22
|
+
className,
|
|
23
|
+
style
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ jsx("span", {
|
|
26
|
+
role: label ? "status" : void 0,
|
|
27
|
+
"aria-label": label ?? void 0,
|
|
28
|
+
"aria-hidden": label ? void 0 : true,
|
|
29
|
+
"data-variant": "orb",
|
|
30
|
+
className: cn(className),
|
|
31
|
+
style: {
|
|
32
|
+
display: "inline-flex",
|
|
33
|
+
flexShrink: 0,
|
|
34
|
+
lineHeight: 0,
|
|
35
|
+
...style
|
|
36
|
+
},
|
|
37
|
+
children: /* @__PURE__ */ jsx(ThinkingOrb, {
|
|
38
|
+
state: orbState,
|
|
39
|
+
size: ORB_SIZE[size],
|
|
40
|
+
label: null
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Loader };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
export interface PaginationProps {
|
|
3
2
|
/** 1-based current page. */
|
|
4
3
|
page: number;
|
|
@@ -10,4 +9,4 @@ export interface PaginationProps {
|
|
|
10
9
|
className?: string;
|
|
11
10
|
}
|
|
12
11
|
/** Previous/next pager with a live range label. Controlled. */
|
|
13
|
-
export declare function Pagination({ page, pageSize, totalItems, onPageChange, formatRange, className }: PaginationProps):
|
|
12
|
+
export declare function Pagination({ page, pageSize, totalItems, onPageChange, formatRange, className }: PaginationProps): import("react").JSX.Element;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn } from "../../lib/cn.js";
|
|
4
4
|
import { IconButton } from "./icon-button.js";
|
|
5
|
-
import "react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
8
7
|
//#region src/components/ui/pagination.tsx
|
|
@@ -39,6 +39,14 @@ export interface TableProps<T> {
|
|
|
39
39
|
onSortChange?: (sort: SortState | null) => void;
|
|
40
40
|
/** Makes rows clickable (mouse) — always also provide a link or button in the row for keyboard users. */
|
|
41
41
|
onRowClick?: (row: T) => void;
|
|
42
|
+
/** Bulk actions bar: rendered above the table when rows are selected. Receives count and a clear callback. */
|
|
43
|
+
bulkActions?: (count: number, clearSelection: () => void) => React.ReactNode;
|
|
44
|
+
/** Per-row action buttons/menus. Adds an actions column on the right. */
|
|
45
|
+
rowActions?: (row: T) => React.ReactNode;
|
|
46
|
+
/** Toolbar rendered above the table inside the bordered card (search, filter, action buttons). */
|
|
47
|
+
toolbar?: React.ReactNode;
|
|
48
|
+
/** Footer rendered below the table inside the bordered card (pagination, scope text). */
|
|
49
|
+
footer?: React.ReactNode;
|
|
42
50
|
density?: "default" | "compact";
|
|
43
51
|
stickyHeader?: boolean;
|
|
44
52
|
/** Wrap the table in its own bordered surface, as production list pages do. Default `true`; pass `false` inside a Card. */
|
|
@@ -49,4 +57,4 @@ export interface TableProps<T> {
|
|
|
49
57
|
* Generic data table: configurable columns, loading skeletons, empty state, row selection and
|
|
50
58
|
* sortable headers. Sorting and pagination are controlled — the table never reorders data itself.
|
|
51
59
|
*/
|
|
52
|
-
export declare function Table<T>({ caption, showCaption, columns, rows, getRowId, loading, loadingRows, empty, selectedIds, onSelectionChange, getRowLabel, sort, onSortChange, onRowClick, density, stickyHeader, bordered, className, }: TableProps<T>): React.JSX.Element;
|
|
60
|
+
export declare function Table<T>({ caption, showCaption, columns, rows, getRowId, loading, loadingRows, empty, selectedIds, onSelectionChange, getRowLabel, sort, onSortChange, onRowClick, bulkActions, rowActions, toolbar, footer, density, stickyHeader, bordered, className, }: TableProps<T>): React.JSX.Element;
|