@heigin/ui 0.1.1 → 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.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/components/crm/agent-decision-tree.d.ts +82 -0
  3. package/dist/components/crm/agent-decision-tree.js +580 -0
  4. package/dist/components/crm/agent-decision-tree.module.js +113 -0
  5. package/dist/components/crm/agent-task-trail.d.ts +56 -0
  6. package/dist/components/crm/agent-task-trail.js +419 -0
  7. package/dist/components/crm/agent-thinking.d.ts +36 -0
  8. package/dist/components/crm/agent-thinking.js +443 -0
  9. package/dist/components/crm/agent-thinking.module.js +33 -0
  10. package/dist/components/crm/agent.module.js +81 -0
  11. package/dist/components/crm/crm.module.js +44 -4
  12. package/dist/components/crm/record-header.d.ts +2 -2
  13. package/dist/components/crm/workspace-switcher.d.ts +49 -0
  14. package/dist/components/crm/workspace-switcher.js +205 -0
  15. package/dist/components/ui/avatar.d.ts +9 -1
  16. package/dist/components/ui/avatar.js +61 -4
  17. package/dist/components/ui/avatar.module.js +4 -2
  18. package/dist/components/ui/breadcrumb.d.ts +10 -0
  19. package/dist/components/ui/breadcrumb.js +48 -0
  20. package/dist/components/ui/breadcrumb.module.js +19 -0
  21. package/dist/components/ui/heigin-mark.d.ts +11 -0
  22. package/dist/components/ui/heigin-mark.js +41 -0
  23. package/dist/components/ui/loader.d.ts +21 -0
  24. package/dist/components/ui/loader.js +45 -0
  25. package/dist/components/ui/table.d.ts +9 -1
  26. package/dist/components/ui/table.js +136 -89
  27. package/dist/components/ui/table.module.js +13 -1
  28. package/dist/components/ui/thinking-orb.d.ts +27 -0
  29. package/dist/components/ui/thinking-orb.js +27 -0
  30. package/dist/components/ui/type-motion.d.ts +31 -0
  31. package/dist/components/ui/type-motion.js +394 -0
  32. package/dist/components/ui/type-motion.module.js +31 -0
  33. package/dist/index.d.ts +9 -0
  34. package/dist/index.js +10 -1
  35. package/dist/styles.css +1732 -7
  36. package/package.json +3 -2
@@ -12,13 +12,15 @@ import { ArrowDown, ArrowUp, ChevronsUpDown } from "lucide-react";
12
12
  * Generic data table: configurable columns, loading skeletons, empty state, row selection and
13
13
  * sortable headers. Sorting and pagination are controlled — the table never reorders data itself.
14
14
  */
15
- function Table({ caption, showCaption = false, columns, rows, getRowId, loading = false, loadingRows = 5, empty, selectedIds, onSelectionChange, getRowLabel, sort, onSortChange, onRowClick, density = "default", stickyHeader = false, bordered = true, className }) {
15
+ function Table({ caption, showCaption = false, columns, rows, getRowId, loading = false, loadingRows = 5, empty, selectedIds, onSelectionChange, getRowLabel, sort, onSortChange, onRowClick, bulkActions, rowActions, toolbar, footer, density = "default", stickyHeader = false, bordered = true, className }) {
16
16
  const selectable = Boolean(selectedIds && onSelectionChange);
17
17
  const rowIds = rows.map(getRowId);
18
18
  const selectedCount = selectable ? rowIds.filter((id) => selectedIds.has(id)).length : 0;
19
19
  const allSelected = rows.length > 0 && selectedCount === rows.length;
20
20
  const someSelected = selectedCount > 0 && !allSelected;
21
- const colCount = columns.length + (selectable ? 1 : 0);
21
+ const hasRowActions = Boolean(rowActions);
22
+ const colCount = columns.length + (selectable ? 1 : 0) + (hasRowActions ? 1 : 0);
23
+ const clearSelection = () => onSelectionChange?.(/* @__PURE__ */ new Set());
22
24
  const toggleAll = () => {
23
25
  if (!onSelectionChange || !selectedIds) return;
24
26
  const next = new Set(selectedIds);
@@ -45,98 +47,143 @@ function Table({ caption, showCaption = false, columns, rows, getRowId, loading
45
47
  });
46
48
  else onSortChange(null);
47
49
  };
48
- return /* @__PURE__ */ jsx("div", {
50
+ const showBulkBar = selectable && selectedCount > 0 && bulkActions;
51
+ return /* @__PURE__ */ jsxs("div", {
49
52
  className: cn(table_module_default.scroller, bordered && table_module_default.bordered, className),
50
- children: /* @__PURE__ */ jsxs("table", {
51
- className: cn(table_module_default.table, density === "compact" && table_module_default.compact, stickyHeader && table_module_default.sticky),
52
- "aria-busy": loading || void 0,
53
- children: [
54
- /* @__PURE__ */ jsx("caption", {
55
- className: showCaption ? table_module_default.caption : table_module_default.srOnly,
56
- children: caption
57
- }),
58
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [selectable && /* @__PURE__ */ jsx("th", {
59
- scope: "col",
60
- className: table_module_default.selectCell,
61
- children: /* @__PURE__ */ jsx(Checkbox, {
62
- "aria-label": "Select all rows",
63
- checked: allSelected,
64
- indeterminate: someSelected,
65
- disabled: loading || rows.length === 0,
66
- onCheckedChange: toggleAll
67
- })
68
- }), columns.map((column) => {
69
- const active = sort?.columnId === column.id;
70
- const ariaSort = active ? sort.direction === "asc" ? "ascending" : "descending" : column.sortable ? "none" : void 0;
71
- return /* @__PURE__ */ jsx("th", {
72
- scope: "col",
73
- "aria-sort": ariaSort,
74
- style: { width: column.width },
75
- className: cn(table_module_default[`align-${column.align ?? "start"}`], column.hideOnMobile && table_module_default.hideOnMobile),
76
- children: column.sortable && onSortChange ? /* @__PURE__ */ jsxs("button", {
77
- type: "button",
78
- className: table_module_default.sortButton,
79
- onClick: () => cycleSort(column.id),
80
- children: [column.header, /* @__PURE__ */ jsx("span", {
81
- className: cn(table_module_default.sortIcon, active && table_module_default.sortIconActive),
82
- "aria-hidden": "true",
83
- children: active ? sort.direction === "asc" ? /* @__PURE__ */ jsx(ArrowUp, { strokeWidth: 1.6 }) : /* @__PURE__ */ jsx(ArrowDown, { strokeWidth: 1.6 }) : /* @__PURE__ */ jsx(ChevronsUpDown, { strokeWidth: 1.6 })
84
- })]
85
- }) : column.header
86
- }, column.id);
87
- })] }) }),
88
- /* @__PURE__ */ jsxs("tbody", { children: [
89
- loading && Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsxs("tr", {
90
- className: table_module_default.skeletonRow,
91
- children: [selectable && /* @__PURE__ */ jsx("td", {
53
+ children: [
54
+ toolbar && /* @__PURE__ */ jsx("div", {
55
+ className: table_module_default.toolbar,
56
+ children: toolbar
57
+ }),
58
+ showBulkBar && /* @__PURE__ */ jsxs("div", {
59
+ className: table_module_default.bulkBar,
60
+ role: "toolbar",
61
+ "aria-label": `${selectedCount} selected`,
62
+ children: [/* @__PURE__ */ jsxs("span", {
63
+ className: table_module_default.bulkCount,
64
+ children: [selectedCount, " selected"]
65
+ }), bulkActions(selectedCount, clearSelection)]
66
+ }),
67
+ /* @__PURE__ */ jsxs("table", {
68
+ className: cn(table_module_default.table, density === "compact" && table_module_default.compact, stickyHeader && table_module_default.sticky),
69
+ "aria-busy": loading || void 0,
70
+ children: [
71
+ /* @__PURE__ */ jsx("caption", {
72
+ className: showCaption ? table_module_default.caption : table_module_default.srOnly,
73
+ children: caption
74
+ }),
75
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
76
+ selectable && /* @__PURE__ */ jsx("th", {
77
+ scope: "col",
92
78
  className: table_module_default.selectCell,
93
- children: /* @__PURE__ */ jsx(Skeleton, {
94
- width: 16,
95
- height: 16
79
+ children: /* @__PURE__ */ jsx(Checkbox, {
80
+ "aria-label": "Select all rows",
81
+ checked: allSelected,
82
+ indeterminate: someSelected,
83
+ disabled: loading || rows.length === 0,
84
+ onCheckedChange: toggleAll
96
85
  })
97
- }), columns.map((column) => /* @__PURE__ */ jsx("td", {
98
- className: column.hideOnMobile ? table_module_default.hideOnMobile : void 0,
99
- children: /* @__PURE__ */ jsx(Skeleton, {
100
- shape: "text",
101
- width: `${50 + (i * 17 + column.id.length * 7) % 40}%`
86
+ }),
87
+ columns.map((column) => {
88
+ const active = sort?.columnId === column.id;
89
+ const ariaSort = active ? sort.direction === "asc" ? "ascending" : "descending" : column.sortable ? "none" : void 0;
90
+ return /* @__PURE__ */ jsx("th", {
91
+ scope: "col",
92
+ "aria-sort": ariaSort,
93
+ style: { width: column.width },
94
+ className: cn(table_module_default[`align-${column.align ?? "start"}`], column.hideOnMobile && table_module_default.hideOnMobile),
95
+ children: column.sortable && onSortChange ? /* @__PURE__ */ jsxs("button", {
96
+ type: "button",
97
+ className: table_module_default.sortButton,
98
+ onClick: () => cycleSort(column.id),
99
+ children: [column.header, /* @__PURE__ */ jsx("span", {
100
+ className: cn(table_module_default.sortIcon, active && table_module_default.sortIconActive),
101
+ "aria-hidden": "true",
102
+ children: active ? sort.direction === "asc" ? /* @__PURE__ */ jsx(ArrowUp, { strokeWidth: 1.6 }) : /* @__PURE__ */ jsx(ArrowDown, { strokeWidth: 1.6 }) : /* @__PURE__ */ jsx(ChevronsUpDown, { strokeWidth: 1.6 })
103
+ })]
104
+ }) : column.header
105
+ }, column.id);
106
+ }),
107
+ hasRowActions && /* @__PURE__ */ jsx("th", {
108
+ scope: "col",
109
+ className: table_module_default.actionsCell,
110
+ children: /* @__PURE__ */ jsx("span", {
111
+ className: table_module_default.srOnly,
112
+ children: "Actions"
102
113
  })
103
- }, column.id))]
104
- }, `skeleton-${i}`)),
105
- !loading && rows.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
106
- colSpan: colCount,
107
- className: table_module_default.emptyCell,
108
- children: empty ?? /* @__PURE__ */ jsx("span", {
109
- className: table_module_default.emptyText,
110
- children: "No results"
111
114
  })
112
- }) }),
113
- !loading && rows.map((row) => {
114
- const id = getRowId(row);
115
- const selected = selectable && selectedIds.has(id);
116
- return /* @__PURE__ */ jsxs("tr", {
117
- "data-selected": selected ? "" : void 0,
118
- "aria-selected": selectable ? selected : void 0,
119
- className: cn(onRowClick && table_module_default.clickable),
120
- onClick: onRowClick ? (event) => {
121
- if (event.target.closest("a,button,input,[role=checkbox],[role=menuitem]")) return;
122
- onRowClick(row);
123
- } : void 0,
124
- children: [selectable && /* @__PURE__ */ jsx("td", {
125
- className: table_module_default.selectCell,
126
- children: /* @__PURE__ */ jsx(Checkbox, {
127
- "aria-label": getRowLabel ? getRowLabel(row) : `Select row ${id}`,
128
- checked: selected,
129
- onCheckedChange: () => toggleRow(id)
130
- })
131
- }), columns.map((column) => /* @__PURE__ */ jsx("td", {
132
- className: cn(table_module_default[`align-${column.align ?? "start"}`], column.numeric && table_module_default.numeric, column.hideOnMobile && table_module_default.hideOnMobile),
133
- children: column.cell ? column.cell(row) : String(row[column.id] ?? "")
134
- }, column.id))]
135
- }, id);
136
- })
137
- ] })
138
- ]
139
- })
115
+ ] }) }),
116
+ /* @__PURE__ */ jsxs("tbody", { children: [
117
+ loading && Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsxs("tr", {
118
+ className: table_module_default.skeletonRow,
119
+ children: [
120
+ selectable && /* @__PURE__ */ jsx("td", {
121
+ className: table_module_default.selectCell,
122
+ children: /* @__PURE__ */ jsx(Skeleton, {
123
+ width: 16,
124
+ height: 16
125
+ })
126
+ }),
127
+ columns.map((column) => /* @__PURE__ */ jsx("td", {
128
+ className: column.hideOnMobile ? table_module_default.hideOnMobile : void 0,
129
+ children: /* @__PURE__ */ jsx(Skeleton, {
130
+ shape: "text",
131
+ width: `${50 + (i * 17 + column.id.length * 7) % 40}%`
132
+ })
133
+ }, column.id)),
134
+ hasRowActions && /* @__PURE__ */ jsx("td", { className: table_module_default.actionsCell })
135
+ ]
136
+ }, `skeleton-${i}`)),
137
+ !loading && rows.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
138
+ colSpan: colCount,
139
+ className: table_module_default.emptyCell,
140
+ children: empty ?? /* @__PURE__ */ jsx("span", {
141
+ className: table_module_default.emptyText,
142
+ children: "No results"
143
+ })
144
+ }) }),
145
+ !loading && rows.map((row) => {
146
+ const id = getRowId(row);
147
+ const selected = selectable && selectedIds.has(id);
148
+ return /* @__PURE__ */ jsxs("tr", {
149
+ "data-selected": selected ? "" : void 0,
150
+ "aria-selected": selectable ? selected : void 0,
151
+ className: cn(onRowClick && table_module_default.clickable),
152
+ onClick: onRowClick ? (event) => {
153
+ if (event.target.closest("a,button,input,[role=checkbox],[role=menuitem]")) return;
154
+ onRowClick(row);
155
+ } : void 0,
156
+ children: [
157
+ selectable && /* @__PURE__ */ jsx("td", {
158
+ className: table_module_default.selectCell,
159
+ children: /* @__PURE__ */ jsx(Checkbox, {
160
+ "aria-label": getRowLabel ? getRowLabel(row) : `Select row ${id}`,
161
+ checked: selected,
162
+ onCheckedChange: () => toggleRow(id)
163
+ })
164
+ }),
165
+ columns.map((column) => /* @__PURE__ */ jsx("td", {
166
+ className: cn(table_module_default[`align-${column.align ?? "start"}`], column.numeric && table_module_default.numeric, column.hideOnMobile && table_module_default.hideOnMobile),
167
+ children: column.cell ? column.cell(row) : String(row[column.id] ?? "")
168
+ }, column.id)),
169
+ hasRowActions && /* @__PURE__ */ jsx("td", {
170
+ className: table_module_default.actionsCell,
171
+ children: /* @__PURE__ */ jsx("div", {
172
+ className: table_module_default.rowActions,
173
+ children: rowActions(row)
174
+ })
175
+ })
176
+ ]
177
+ }, id);
178
+ })
179
+ ] })
180
+ ]
181
+ }),
182
+ footer && /* @__PURE__ */ jsx("div", {
183
+ className: table_module_default.footer,
184
+ children: footer
185
+ })
186
+ ]
140
187
  });
141
188
  }
142
189
  //#endregion
@@ -15,6 +15,12 @@ var emptyCell = "hg-table-module_emptyCell_DVD9X";
15
15
  var emptyText = "hg-table-module_emptyText_2x9nh";
16
16
  var caption = "hg-table-module_caption_KTNye";
17
17
  var srOnly = "hg-table-module_srOnly_tRNri";
18
+ var toolbar = "hg-table-module_toolbar_HEOhG";
19
+ var footer = "hg-table-module_footer_Miexz";
20
+ var bulkBar = "hg-table-module_bulkBar_a11IM";
21
+ var bulkCount = "hg-table-module_bulkCount_UAWaS";
22
+ var actionsCell = "hg-table-module_actionsCell_ZESNr";
23
+ var rowActions = "hg-table-module_rowActions_WddVX";
18
24
  var hideOnMobile = "hg-table-module_hideOnMobile_ykrgY";
19
25
  var table_module_default = {
20
26
  scroller,
@@ -36,7 +42,13 @@ var table_module_default = {
36
42
  emptyText,
37
43
  caption,
38
44
  srOnly,
45
+ toolbar,
46
+ footer,
47
+ bulkBar,
48
+ bulkCount,
49
+ actionsCell,
50
+ rowActions,
39
51
  hideOnMobile
40
52
  };
41
53
  //#endregion
42
- export { bordered, caption, clickable, compact, table_module_default as default, emptyCell, emptyText, hideOnMobile, numeric, scroller, selectCell, skeletonRow, sortButton, sortIcon, sortIconActive, srOnly, sticky, table };
54
+ export { actionsCell, bordered, bulkBar, bulkCount, caption, clickable, compact, table_module_default as default, emptyCell, emptyText, footer, hideOnMobile, numeric, rowActions, scroller, selectCell, skeletonRow, sortButton, sortIcon, sortIconActive, srOnly, sticky, table, toolbar };
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ export type ThinkingOrbState = "working" | "searching" | "solving" | "listening" | "connecting" | "weaving" | "composing" | "breathing" | "shaping";
3
+ export type ThinkingOrbSize = 20 | 32 | 64;
4
+ export interface ThinkingOrbProps {
5
+ /** What the agent is doing. Each state is its own animation. */
6
+ state?: ThinkingOrbState;
7
+ /** 64 for avatar scale, 20 for inline with text, 32 in between. These are separate tunings, not one design scaled. */
8
+ size?: ThinkingOrbSize;
9
+ /** `auto` follows an ancestor `data-theme` or `dark`/`light` class, then the OS setting. Pin it on a surface whose colour is fixed. */
10
+ theme?: "auto" | "light" | "dark";
11
+ /** Multiplier on the state's own speed. */
12
+ speed?: number;
13
+ /** Freeze on the current frame. */
14
+ paused?: boolean;
15
+ /** Ink colour as `#rgb`, `#rrggbb` or `rgb()`. Leave unset for the neutral ink. */
16
+ color?: string;
17
+ /** Accessible label. Defaults to the state ("Searching…"). Pass `null` when nearby text already says it. */
18
+ label?: string | null;
19
+ className?: string;
20
+ style?: React.CSSProperties;
21
+ }
22
+ /**
23
+ * Dotted orb that shows what an agent is doing: working, searching, solving, listening,
24
+ * connecting, weaving, composing, breathing or shaping. Draws on a 2D canvas, pauses
25
+ * offscreen and shows a still frame under reduced motion.
26
+ */
27
+ export declare function ThinkingOrb({ state, size, theme, speed, paused, color, label, className, style, }: ThinkingOrbProps): React.JSX.Element;
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ "use client";
3
+ import "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { ThinkingOrb } from "thinking-orbs";
6
+ //#region src/components/ui/thinking-orb.tsx
7
+ /**
8
+ * Dotted orb that shows what an agent is doing: working, searching, solving, listening,
9
+ * connecting, weaving, composing, breathing or shaping. Draws on a 2D canvas, pauses
10
+ * offscreen and shows a still frame under reduced motion.
11
+ */
12
+ function ThinkingOrb$1({ state = "working", size = 64, theme = "auto", speed = 1, paused = false, color, label, className, style }) {
13
+ return /* @__PURE__ */ jsx(ThinkingOrb, {
14
+ state,
15
+ size,
16
+ theme,
17
+ speed,
18
+ paused,
19
+ color,
20
+ "aria-label": label ?? void 0,
21
+ "aria-hidden": label === null ? true : void 0,
22
+ className,
23
+ style
24
+ });
25
+ }
26
+ //#endregion
27
+ export { ThinkingOrb$1 as ThinkingOrb };
@@ -0,0 +1,31 @@
1
+ import * as React from "react";
2
+ export type TypeMotionEffect = "pop" | "shuffle" | "word" | "lens" | "bubble" | "swell" | "sticker" | "burst";
3
+ /** An image (`{ src }`) or any element, such as an icon or a styled span. */
4
+ export type TypeMotionArt = {
5
+ src: string;
6
+ alt?: string;
7
+ } | React.ReactElement;
8
+ export interface TypeMotionProps extends Omit<React.HTMLAttributes<HTMLElement>, "children"> {
9
+ /** The headline. Use "\n" for a line break. */
10
+ text: string;
11
+ /** What hovering does. Default `lens`: letters near the pointer turn into artwork. */
12
+ effect?: TypeMotionEffect;
13
+ /** What letters turn into. Defaults to HeiGin orbs, symbols and the mark. */
14
+ artwork?: TypeMotionArt[];
15
+ as?: "h1" | "h2" | "h3" | "p" | "div";
16
+ /** Reach of `lens` and `swell`, in em. Default 0.85. */
17
+ radius?: number;
18
+ /** How long a letter stays swapped after the pointer leaves, in ms. Default 900. */
19
+ hold?: number;
20
+ /** Artwork size relative to the type. Default 0.84. */
21
+ artScale?: number;
22
+ /** Tilt each piece of artwork a little. */
23
+ tilt?: boolean;
24
+ }
25
+ /** HeiGin's built-in artwork: shaded orbs in the brand palette, four symbols and the mark. */
26
+ export declare const typeMotionDefaultArtwork: TypeMotionArt[];
27
+ /**
28
+ * A headline whose letters turn into artwork under the pointer: lens, pop, shuffle, word,
29
+ * bubble, swell, sticker or burst. The text stays one accessible heading; the effects are decoration.
30
+ */
31
+ export declare function TypeMotion({ text, effect, artwork, as, radius, hold, artScale, tilt, className, style, ...props }: TypeMotionProps): React.JSX.Element;