@heigin/ui 0.0.0-stage → 0.1.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 (124) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE +15 -0
  3. package/README.md +28 -2
  4. package/dist/base.css +44 -0
  5. package/dist/components/crm/activity-timeline.d.ts +23 -0
  6. package/dist/components/crm/activity-timeline.js +41 -0
  7. package/dist/components/crm/approval-card.d.ts +33 -0
  8. package/dist/components/crm/approval-card.js +101 -0
  9. package/dist/components/crm/channel-mark.d.ts +10 -0
  10. package/dist/components/crm/channel-mark.js +57 -0
  11. package/dist/components/crm/conversation-list-item.d.ts +23 -0
  12. package/dist/components/crm/conversation-list-item.js +62 -0
  13. package/dist/components/crm/crm.module.js +161 -0
  14. package/dist/components/crm/deal-stage.d.ts +13 -0
  15. package/dist/components/crm/deal-stage.js +27 -0
  16. package/dist/components/crm/detail-list.d.ts +17 -0
  17. package/dist/components/crm/detail-list.js +35 -0
  18. package/dist/components/crm/filter-chip.d.ts +16 -0
  19. package/dist/components/crm/filter-chip.js +45 -0
  20. package/dist/components/crm/filter-toolbar.d.ts +16 -0
  21. package/dist/components/crm/filter-toolbar.js +42 -0
  22. package/dist/components/crm/metric-card.d.ts +30 -0
  23. package/dist/components/crm/metric-card.js +61 -0
  24. package/dist/components/crm/money-value.d.ts +9 -0
  25. package/dist/components/crm/money-value.js +27 -0
  26. package/dist/components/crm/page-header.d.ts +11 -0
  27. package/dist/components/crm/page-header.js +28 -0
  28. package/dist/components/crm/record-header.d.ts +22 -0
  29. package/dist/components/crm/record-header.js +53 -0
  30. package/dist/components/crm/sidebar-nav.d.ts +33 -0
  31. package/dist/components/crm/sidebar-nav.js +53 -0
  32. package/dist/components/crm/sla-clock.d.ts +11 -0
  33. package/dist/components/crm/sla-clock.js +41 -0
  34. package/dist/components/crm/status-badge.d.ts +94 -0
  35. package/dist/components/crm/status-badge.js +106 -0
  36. package/dist/components/crm/task-row.d.ts +18 -0
  37. package/dist/components/crm/task-row.js +52 -0
  38. package/dist/components/crm/trust-rung-badge.d.ts +14 -0
  39. package/dist/components/crm/trust-rung-badge.js +35 -0
  40. package/dist/components/ui/alert-dialog.d.ts +22 -0
  41. package/dist/components/ui/alert-dialog.js +87 -0
  42. package/dist/components/ui/avatar.d.ts +13 -0
  43. package/dist/components/ui/avatar.js +38 -0
  44. package/dist/components/ui/avatar.module.js +17 -0
  45. package/dist/components/ui/badge.d.ts +12 -0
  46. package/dist/components/ui/badge.js +28 -0
  47. package/dist/components/ui/badge.module.js +25 -0
  48. package/dist/components/ui/button.d.ts +19 -0
  49. package/dist/components/ui/button.js +39 -0
  50. package/dist/components/ui/button.module.js +27 -0
  51. package/dist/components/ui/card.d.ts +19 -0
  52. package/dist/components/ui/card.js +35 -0
  53. package/dist/components/ui/card.module.js +23 -0
  54. package/dist/components/ui/checkbox.d.ts +11 -0
  55. package/dist/components/ui/checkbox.js +47 -0
  56. package/dist/components/ui/choice.module.js +28 -0
  57. package/dist/components/ui/dialog.d.ts +32 -0
  58. package/dist/components/ui/dialog.js +67 -0
  59. package/dist/components/ui/dialog.module.js +39 -0
  60. package/dist/components/ui/drawer.d.ts +20 -0
  61. package/dist/components/ui/drawer.js +44 -0
  62. package/dist/components/ui/dropdown-menu.d.ts +38 -0
  63. package/dist/components/ui/dropdown-menu.js +66 -0
  64. package/dist/components/ui/empty-state.d.ts +12 -0
  65. package/dist/components/ui/empty-state.js +33 -0
  66. package/dist/components/ui/empty-state.module.js +19 -0
  67. package/dist/components/ui/field.d.ts +38 -0
  68. package/dist/components/ui/field.js +77 -0
  69. package/dist/components/ui/field.module.js +17 -0
  70. package/dist/components/ui/icon-button.d.ts +9 -0
  71. package/dist/components/ui/icon-button.js +21 -0
  72. package/dist/components/ui/input.d.ts +8 -0
  73. package/dist/components/ui/input.js +23 -0
  74. package/dist/components/ui/input.module.js +25 -0
  75. package/dist/components/ui/kbd.d.ts +3 -0
  76. package/dist/components/ui/kbd.js +34 -0
  77. package/dist/components/ui/native-select.d.ts +10 -0
  78. package/dist/components/ui/native-select.js +26 -0
  79. package/dist/components/ui/pagination.d.ts +13 -0
  80. package/dist/components/ui/pagination.js +55 -0
  81. package/dist/components/ui/popover.d.ts +17 -0
  82. package/dist/components/ui/popover.js +41 -0
  83. package/dist/components/ui/popup.module.js +39 -0
  84. package/dist/components/ui/radio-group.d.ts +18 -0
  85. package/dist/components/ui/radio-group.js +50 -0
  86. package/dist/components/ui/search-input.d.ts +15 -0
  87. package/dist/components/ui/search-input.js +64 -0
  88. package/dist/components/ui/select.d.ts +27 -0
  89. package/dist/components/ui/select.js +71 -0
  90. package/dist/components/ui/skeleton.d.ts +12 -0
  91. package/dist/components/ui/skeleton.js +23 -0
  92. package/dist/components/ui/skeleton.module.js +15 -0
  93. package/dist/components/ui/spinner.d.ts +8 -0
  94. package/dist/components/ui/spinner.js +19 -0
  95. package/dist/components/ui/spinner.module.js +13 -0
  96. package/dist/components/ui/switch.d.ts +10 -0
  97. package/dist/components/ui/switch.js +35 -0
  98. package/dist/components/ui/table.d.ts +52 -0
  99. package/dist/components/ui/table.js +143 -0
  100. package/dist/components/ui/table.module.js +42 -0
  101. package/dist/components/ui/tabs.d.ts +25 -0
  102. package/dist/components/ui/tabs.js +47 -0
  103. package/dist/components/ui/tabs.module.js +21 -0
  104. package/dist/components/ui/textarea.d.ts +6 -0
  105. package/dist/components/ui/textarea.js +23 -0
  106. package/dist/components/ui/toast.d.ts +30 -0
  107. package/dist/components/ui/toast.js +81 -0
  108. package/dist/components/ui/toast.module.js +21 -0
  109. package/dist/components/ui/tooltip.d.ts +18 -0
  110. package/dist/components/ui/tooltip.js +30 -0
  111. package/dist/components/ui/visually-hidden.d.ts +3 -0
  112. package/dist/components/ui/visually-hidden.js +26 -0
  113. package/dist/index.d.ts +48 -0
  114. package/dist/index.js +50 -0
  115. package/dist/lib/cn.d.ts +2 -0
  116. package/dist/lib/cn.js +7 -0
  117. package/dist/lib/format.d.ts +6 -0
  118. package/dist/lib/format.js +33 -0
  119. package/dist/styles.css +2317 -0
  120. package/dist/tailwind.css +82 -0
  121. package/dist/tokens.css +131 -0
  122. package/dist/tokens.d.ts +339 -0
  123. package/dist/tokens.js +790 -0
  124. package/package.json +54 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@heigin/ui` are recorded here. This project follows [Semantic Versioning](https://semver.org).
4
+
5
+ ## Unreleased — 0.1.0
6
+
7
+ ### Added
8
+
9
+ - Design tokens taken from the live HeiGin CRM's production stylesheet (114 tokens, each tagged with its evidence: observed, derived or proposed), shipped as JSON, CSS custom properties (`--hg-*`), TypeScript, and an optional Tailwind v4 theme.
10
+ - 28 primitive modules built on Base UI: Button, IconButton, Field, Input, Textarea, SearchInput, Select, Checkbox, RadioGroup, Switch, Tabs, DropdownMenu, Pagination, Table, Badge, Avatar, Card, EmptyState, Skeleton, Spinner, Kbd, VisuallyHidden, Dialog, AlertDialog, Drawer, Popover, Tooltip and Toast.
11
+ - 16 CRM pattern modules: PageHeader, MetricCard, MoneyValue (INR formatters), StatusBadge (registry), SLAClock, ChannelMark, TrustRungBadge, ApprovalCard, TaskRow, ConversationListItem, ActivityTimeline, FilterChip, FilterToolbar, RecordHeader, DealStage and SidebarNav. These are **proposed** until the signed-in CRM screens are inspected.
12
+ - Copy-source manifests and the `copy-component` script.
13
+
14
+ ### Accessibility (deviations from production, proposed)
15
+
16
+ - `success-ink`, `danger-ink` and `input-focus-border` tokens fix text and focus contrast. See `docs/design-audit.md`.
17
+
18
+ ### Source-copy
19
+
20
+ - First release: no migration needed.
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ HeiGin UI — Proprietary License
2
+
3
+ Copyright (c) 2026 HeiGin. All rights reserved.
4
+
5
+ This software, including its source code, compiled packages (including the npm package
6
+ @heigin/ui), design tokens and documentation, is proprietary and confidential.
7
+
8
+ Use is permitted only by employees and contractors of HeiGin who have been granted access by
9
+ HeiGin, and only for building HeiGin products. No other person or entity may use, copy, modify,
10
+ merge, publish, distribute, sublicense, or sell copies of this software, in whole or in part,
11
+ including by copying source shown on the public documentation website.
12
+
13
+ Viewing the public documentation website does not grant any license to the software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
package/README.md CHANGED
@@ -1,3 +1,29 @@
1
- # Temporary Holding Version
1
+ # @heigin/ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ React + TypeScript components and design tokens for the HeiGin CRM.
4
+
5
+ ```bash
6
+ npm install @heigin/ui
7
+ ```
8
+
9
+ ```tsx
10
+ import "@heigin/ui/styles.css";
11
+ import { Button } from "@heigin/ui";
12
+
13
+ export function Example() {
14
+ return <Button variant="primary">Create lead</Button>;
15
+ }
16
+ ```
17
+
18
+ | Entry | What it is |
19
+ | --- | --- |
20
+ | `@heigin/ui` | Components, hooks and formatters (ESM + `.d.ts`) |
21
+ | `@heigin/ui/styles.css` | Tokens + all component styles (import once) |
22
+ | `@heigin/ui/base.css` | Optional global defaults (body font/colour, focus ring, reduced motion) |
23
+ | `@heigin/ui/tokens.css` | Tokens only (`--hg-*` custom properties) |
24
+ | `@heigin/ui/tokens` | Tokens as TypeScript (`tokens`, `vars`, `tokenMeta`) |
25
+ | `@heigin/ui/tailwind.css` | Optional Tailwind v4 `@theme` mapping |
26
+
27
+ Peer dependencies: `react` and `react-dom` >= 18.2. Interactive components are marked `"use client"` for the Next.js App Router.
28
+
29
+ Full documentation, the copy-source workflow and the release process live in the repository README.
package/dist/base.css ADDED
@@ -0,0 +1,44 @@
1
+ /*
2
+ Optional global defaults matching the HeiGin CRM shell.
3
+ Import once in your app root if you are not already setting these:
4
+ import "@heigin/ui/base.css";
5
+ */
6
+ html {
7
+ -webkit-text-size-adjust: 100%;
8
+ text-size-adjust: 100%;
9
+ }
10
+ body {
11
+ margin: 0;
12
+ background: var(--hg-color-bg);
13
+ color: var(--hg-color-ink);
14
+ font-family: var(--hg-font-family-sans);
15
+ font-size: var(--hg-font-size-md);
16
+ line-height: var(--hg-font-leading-normal);
17
+ letter-spacing: var(--hg-font-tracking-body);
18
+ font-feature-settings: var(--hg-font-features);
19
+ -webkit-font-smoothing: antialiased;
20
+ -moz-osx-font-smoothing: grayscale;
21
+ }
22
+ *,
23
+ *::before,
24
+ *::after {
25
+ box-sizing: border-box;
26
+ }
27
+ ::placeholder {
28
+ color: var(--hg-color-faint);
29
+ opacity: 1;
30
+ }
31
+ :focus-visible {
32
+ outline: var(--hg-focus-width) solid var(--hg-color-focus);
33
+ outline-offset: var(--hg-focus-offset);
34
+ }
35
+ @media (prefers-reduced-motion: reduce) {
36
+ *,
37
+ *::before,
38
+ *::after {
39
+ animation-duration: 0.01ms !important;
40
+ animation-iteration-count: 1 !important;
41
+ transition-duration: 0.01ms !important;
42
+ scroll-behavior: auto !important;
43
+ }
44
+ }
@@ -0,0 +1,23 @@
1
+ import * as React from "react";
2
+ export interface ActivityItemProps {
3
+ /** Icon for the activity type (call, WhatsApp, note, stage change...). Decorative. */
4
+ icon: React.ReactNode;
5
+ /** One-line summary, e.g. "<strong>Meera S</strong> called Asha Rao". */
6
+ children: React.ReactNode;
7
+ /** Machine-readable timestamp (ISO 8601). */
8
+ dateTime: string;
9
+ /** Display time, e.g. "2:40 pm" or "Yesterday". */
10
+ timeLabel: string;
11
+ /** Optional body: message excerpt, note, or change details. */
12
+ detail?: React.ReactNode;
13
+ className?: string;
14
+ }
15
+ /** One entry in a record's activity timeline. Use inside ActivityTimeline. Server-component safe. */
16
+ export declare function ActivityItem({ icon, children, dateTime, timeLabel, detail, className }: ActivityItemProps): React.JSX.Element;
17
+ export interface ActivityTimelineProps extends React.HTMLAttributes<HTMLOListElement> {
18
+ /** Accessible name, e.g. "Activity for Asha Rao". */
19
+ label: string;
20
+ children: React.ReactNode;
21
+ }
22
+ /** Chronological record history (newest first). An ordered list, so position is announced. */
23
+ export declare function ActivityTimeline({ label, className, children, ...props }: ActivityTimelineProps): React.JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { cn } from "../../lib/cn.js";
2
+ import crm_module_default from "./crm.module.js";
3
+ import "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/components/crm/activity-timeline.tsx
6
+ /** One entry in a record's activity timeline. Use inside ActivityTimeline. Server-component safe. */
7
+ function ActivityItem({ icon, children, dateTime, timeLabel, detail, className }) {
8
+ return /* @__PURE__ */ jsxs("li", {
9
+ className: cn(crm_module_default.timelineItem, className),
10
+ children: [/* @__PURE__ */ jsx("span", {
11
+ className: crm_module_default.timelineIcon,
12
+ "aria-hidden": "true",
13
+ children: icon
14
+ }), /* @__PURE__ */ jsxs("div", {
15
+ className: crm_module_default.timelineBody,
16
+ children: [
17
+ /* @__PURE__ */ jsx("span", { children }),
18
+ /* @__PURE__ */ jsx("time", {
19
+ dateTime,
20
+ className: crm_module_default.timelineTime,
21
+ children: timeLabel
22
+ }),
23
+ detail && /* @__PURE__ */ jsx("div", {
24
+ className: crm_module_default.timelineDetail,
25
+ children: detail
26
+ })
27
+ ]
28
+ })]
29
+ });
30
+ }
31
+ /** Chronological record history (newest first). An ordered list, so position is announced. */
32
+ function ActivityTimeline({ label, className, children, ...props }) {
33
+ return /* @__PURE__ */ jsx("ol", {
34
+ "aria-label": label,
35
+ className: cn(crm_module_default.timeline, className),
36
+ ...props,
37
+ children
38
+ });
39
+ }
40
+ //#endregion
41
+ export { ActivityItem, ActivityTimeline };
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { type TrustRung } from "./trust-rung-badge.js";
3
+ export interface ApprovalChange {
4
+ field: string;
5
+ from?: string;
6
+ to: string;
7
+ }
8
+ export interface ApprovalCardProps {
9
+ /** What needs approving, e.g. "Send reminder to Kaveri Textiles". */
10
+ title: string;
11
+ /** Why it was proposed, in one sentence. */
12
+ reason: string;
13
+ /** Who or what proposed it, e.g. "Agent · Receivable reminders" or "Meera S". */
14
+ requestedBy: string;
15
+ /** When the proposer is the AI agent, its trust rung. */
16
+ rung?: TrustRung;
17
+ changes?: ApprovalChange[];
18
+ /** When false, approving cannot be undone (e.g. a sent WhatsApp message) — the card warns up front. */
19
+ undoable?: boolean;
20
+ approveLabel?: string;
21
+ /** The draft itself (message, quote preview). */
22
+ children?: React.ReactNode;
23
+ onApprove: () => void | Promise<void>;
24
+ onReject: () => void | Promise<void>;
25
+ /** Shown after a decision when undoable. */
26
+ onUndo?: () => void;
27
+ className?: string;
28
+ }
29
+ /**
30
+ * An approval request: what, why, the change, and Approve / Reject. Records the outcome in place
31
+ * and offers Undo when the action is reversible.
32
+ */
33
+ export declare function ApprovalCard({ title, reason, requestedBy, rung, changes, undoable, approveLabel, children, onApprove, onReject, onUndo, className, }: ApprovalCardProps): React.JSX.Element;
@@ -0,0 +1,101 @@
1
+ "use client";
2
+ "use client";
3
+ import { Button } from "../ui/button.js";
4
+ import { Card } from "../ui/card.js";
5
+ import { VisuallyHidden } from "../ui/visually-hidden.js";
6
+ import crm_module_default from "./crm.module.js";
7
+ import { TrustRungBadge } from "./trust-rung-badge.js";
8
+ import * as React from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { Check, TriangleAlert, Undo2, X } from "lucide-react";
11
+ //#region src/components/crm/approval-card.tsx
12
+ /**
13
+ * An approval request: what, why, the change, and Approve / Reject. Records the outcome in place
14
+ * and offers Undo when the action is reversible.
15
+ */
16
+ function ApprovalCard({ title, reason, requestedBy, rung, changes, undoable = true, approveLabel = "Approve", children, onApprove, onReject, onUndo, className }) {
17
+ const [outcome, setOutcome] = React.useState(null);
18
+ const [pending, setPending] = React.useState(null);
19
+ const headingId = React.useId();
20
+ const decide = async (kind) => {
21
+ setPending(kind);
22
+ try {
23
+ await (kind === "approve" ? onApprove() : onReject());
24
+ setOutcome(kind === "approve" ? "approved" : "rejected");
25
+ } finally {
26
+ setPending(null);
27
+ }
28
+ };
29
+ return /* @__PURE__ */ jsx(Card, {
30
+ as: "article",
31
+ "aria-labelledby": headingId,
32
+ className,
33
+ "data-outcome": outcome ?? "pending",
34
+ children: /* @__PURE__ */ jsxs("div", {
35
+ className: crm_module_default.approval,
36
+ children: [
37
+ /* @__PURE__ */ jsxs("div", {
38
+ className: crm_module_default.approvalHead,
39
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
40
+ id: headingId,
41
+ className: crm_module_default.approvalTitle,
42
+ children: title
43
+ }), /* @__PURE__ */ jsx("p", {
44
+ className: crm_module_default.approvalReason,
45
+ children: reason
46
+ })] }), rung !== void 0 && /* @__PURE__ */ jsx(TrustRungBadge, { rung })]
47
+ }),
48
+ /* @__PURE__ */ jsxs("div", {
49
+ className: crm_module_default.rowMeta,
50
+ style: { marginTop: -6 },
51
+ children: ["Requested by ", requestedBy]
52
+ }),
53
+ changes && changes.length > 0 && /* @__PURE__ */ jsx("dl", {
54
+ className: crm_module_default.diff,
55
+ "aria-label": "Proposed changes",
56
+ children: changes.map((c) => /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx("dt", { children: c.field }), /* @__PURE__ */ jsxs("dd", { children: [c.from && /* @__PURE__ */ jsxs("del", { children: [/* @__PURE__ */ jsx(VisuallyHidden, { children: "from " }), c.from] }), /* @__PURE__ */ jsxs("ins", { children: [c.from && /* @__PURE__ */ jsx(VisuallyHidden, { children: "to " }), c.to] })] })] }, c.field))
57
+ }),
58
+ children,
59
+ outcome ? /* @__PURE__ */ jsxs("div", {
60
+ className: crm_module_default.approvalOutcome,
61
+ role: "status",
62
+ children: [/* @__PURE__ */ jsx("span", { children: outcome === "approved" ? "Approved." : "Rejected." }), undoable && onUndo && /* @__PURE__ */ jsx(Button, {
63
+ variant: "ghost",
64
+ size: "sm",
65
+ touch: false,
66
+ leadingIcon: /* @__PURE__ */ jsx(Undo2, { strokeWidth: 1.6 }),
67
+ onClick: () => {
68
+ onUndo();
69
+ setOutcome(null);
70
+ },
71
+ children: "Undo"
72
+ })]
73
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [!undoable && /* @__PURE__ */ jsxs("p", {
74
+ className: crm_module_default.irreversible,
75
+ children: [/* @__PURE__ */ jsx(TriangleAlert, {
76
+ strokeWidth: 1.6,
77
+ "aria-hidden": "true"
78
+ }), "This can't be undone once approved."]
79
+ }), /* @__PURE__ */ jsxs("div", {
80
+ className: crm_module_default.approvalActions,
81
+ children: [/* @__PURE__ */ jsx(Button, {
82
+ leadingIcon: /* @__PURE__ */ jsx(Check, { strokeWidth: 1.6 }),
83
+ loading: pending === "approve",
84
+ disabled: pending === "reject",
85
+ onClick: () => decide("approve"),
86
+ children: approveLabel
87
+ }), /* @__PURE__ */ jsx(Button, {
88
+ variant: "secondary",
89
+ leadingIcon: /* @__PURE__ */ jsx(X, { strokeWidth: 1.6 }),
90
+ loading: pending === "reject",
91
+ disabled: pending === "approve",
92
+ onClick: () => decide("reject"),
93
+ children: "Reject"
94
+ })]
95
+ })] })
96
+ ]
97
+ })
98
+ });
99
+ }
100
+ //#endregion
101
+ export { ApprovalCard };
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ export type Channel = "whatsapp" | "email" | "sms" | "call" | "missed_call" | "web_form" | "indiamart" | "in_person";
3
+ export interface ChannelMarkProps {
4
+ channel: Channel;
5
+ /** `icon` shows only the icon, but keeps the channel name for assistive tech and as a tooltip. */
6
+ display?: "icon-label" | "icon";
7
+ className?: string;
8
+ }
9
+ /** Where a lead or conversation came from. WhatsApp green is a channel mark only, never a success colour. */
10
+ export declare function ChannelMark({ channel, display, className }: ChannelMarkProps): React.JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { cn } from "../../lib/cn.js";
2
+ import crm_module_default from "./crm.module.js";
3
+ import "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Globe, Mail, MessageCircle, MessageSquare, Phone, PhoneMissed, Store, Users } from "lucide-react";
6
+ //#region src/components/crm/channel-mark.tsx
7
+ var CHANNELS = {
8
+ whatsapp: {
9
+ label: "WhatsApp",
10
+ Icon: MessageCircle
11
+ },
12
+ email: {
13
+ label: "Email",
14
+ Icon: Mail
15
+ },
16
+ sms: {
17
+ label: "SMS",
18
+ Icon: MessageSquare
19
+ },
20
+ call: {
21
+ label: "Call",
22
+ Icon: Phone
23
+ },
24
+ missed_call: {
25
+ label: "Missed call",
26
+ Icon: PhoneMissed
27
+ },
28
+ web_form: {
29
+ label: "Web form",
30
+ Icon: Globe
31
+ },
32
+ indiamart: {
33
+ label: "IndiaMART",
34
+ Icon: Store
35
+ },
36
+ in_person: {
37
+ label: "In person",
38
+ Icon: Users
39
+ }
40
+ };
41
+ /** Where a lead or conversation came from. WhatsApp green is a channel mark only, never a success colour. */
42
+ function ChannelMark({ channel, display = "icon-label", className }) {
43
+ const { label, Icon } = CHANNELS[channel];
44
+ return /* @__PURE__ */ jsxs("span", {
45
+ className: cn(crm_module_default.inlineMark, channel === "whatsapp" && crm_module_default.channelWhatsapp, className),
46
+ title: display === "icon" ? label : void 0,
47
+ role: display === "icon" ? "img" : void 0,
48
+ "aria-label": display === "icon" ? label : void 0,
49
+ "data-channel": channel,
50
+ children: [/* @__PURE__ */ jsx(Icon, {
51
+ strokeWidth: 1.6,
52
+ "aria-hidden": true
53
+ }), display === "icon-label" && label]
54
+ });
55
+ }
56
+ //#endregion
57
+ export { ChannelMark };
@@ -0,0 +1,23 @@
1
+ import * as React from "react";
2
+ import { type Channel } from "./channel-mark.js";
3
+ export interface ConversationListItemProps {
4
+ name: string;
5
+ /** Last message preview (plain text; truncated to one line). */
6
+ preview: string;
7
+ channel: Channel;
8
+ /** Display time, e.g. "10:42 am". */
9
+ timeLabel: string;
10
+ dateTime: string;
11
+ unreadCount?: number;
12
+ selected?: boolean;
13
+ /** Link to the thread. The whole row is clickable via a stretched link. */
14
+ href: string;
15
+ /** Extra trailing content, e.g. an SLAClock. */
16
+ aside?: React.ReactNode;
17
+ avatarSrc?: string;
18
+ /** Extra props for the row link (e.g. onClick for in-app selection, data attributes). */
19
+ linkProps?: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "className">;
20
+ className?: string;
21
+ }
22
+ /** One thread in the inbox list. Use inside a <ul>. Server-component safe. */
23
+ export declare function ConversationListItem({ name, preview, channel, timeLabel, dateTime, unreadCount, selected, href, aside, avatarSrc, linkProps, className, }: ConversationListItemProps): React.JSX.Element;
@@ -0,0 +1,62 @@
1
+ import { cn } from "../../lib/cn.js";
2
+ import { Avatar } from "../ui/avatar.js";
3
+ import { VisuallyHidden } from "../ui/visually-hidden.js";
4
+ import crm_module_default from "./crm.module.js";
5
+ import { ChannelMark } from "./channel-mark.js";
6
+ import "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/crm/conversation-list-item.tsx
9
+ /** One thread in the inbox list. Use inside a <ul>. Server-component safe. */
10
+ function ConversationListItem({ name, preview, channel, timeLabel, dateTime, unreadCount = 0, selected = false, href, aside, avatarSrc, linkProps, className }) {
11
+ const unread = unreadCount > 0;
12
+ return /* @__PURE__ */ jsxs("li", {
13
+ className: cn(crm_module_default.row, crm_module_default.rowInteractive, selected && crm_module_default.rowSelected, unread && crm_module_default.unread, className),
14
+ children: [
15
+ /* @__PURE__ */ jsx(Avatar, {
16
+ name,
17
+ src: avatarSrc,
18
+ decorative: true
19
+ }),
20
+ /* @__PURE__ */ jsxs("div", {
21
+ className: crm_module_default.rowMain,
22
+ children: [
23
+ /* @__PURE__ */ jsxs("a", {
24
+ ...linkProps,
25
+ href,
26
+ className: crm_module_default.rowTitle,
27
+ "aria-current": selected ? "true" : void 0,
28
+ children: [name, unread && /* @__PURE__ */ jsxs(VisuallyHidden, { children: [
29
+ ", ",
30
+ unreadCount,
31
+ " unread"
32
+ ] })]
33
+ }),
34
+ /* @__PURE__ */ jsx("div", {
35
+ className: crm_module_default.rowMeta,
36
+ children: preview
37
+ }),
38
+ /* @__PURE__ */ jsx("div", {
39
+ style: { marginTop: 4 },
40
+ children: /* @__PURE__ */ jsx(ChannelMark, { channel })
41
+ })
42
+ ]
43
+ }),
44
+ /* @__PURE__ */ jsxs("div", {
45
+ className: crm_module_default.rowAside,
46
+ children: [
47
+ /* @__PURE__ */ jsx("time", {
48
+ dateTime,
49
+ children: timeLabel
50
+ }),
51
+ unread && /* @__PURE__ */ jsx("span", {
52
+ className: crm_module_default.unreadDot,
53
+ "aria-hidden": "true"
54
+ }),
55
+ aside
56
+ ]
57
+ })
58
+ ]
59
+ });
60
+ }
61
+ //#endregion
62
+ export { ConversationListItem };
@@ -0,0 +1,161 @@
1
+ //#region src/components/crm/crm.module.css
2
+ var pageHeader = "hg-crm-module_pageHeader_GhNx-";
3
+ var pageHeaderText = "hg-crm-module_pageHeaderText_J5uzM";
4
+ var pageTitle = "hg-crm-module_pageTitle_DtdGz";
5
+ var recordTitle = "hg-crm-module_recordTitle_mbURR";
6
+ var pageDescription = "hg-crm-module_pageDescription_Ar6OV";
7
+ var pageActions = "hg-crm-module_pageActions_t-RSO";
8
+ var metric = "hg-crm-module_metric_PYEB-";
9
+ var metricGroup = "hg-crm-module_metricGroup_0yZAK";
10
+ var metricLabel = "hg-crm-module_metricLabel_llV-w";
11
+ var metricValue = "hg-crm-module_metricValue_LUn1F";
12
+ var metricHint = "hg-crm-module_metricHint_BbKKO";
13
+ var toneDanger = "hg-crm-module_toneDanger_FDDZq";
14
+ var toneWarning = "hg-crm-module_toneWarning_-V4Yn";
15
+ var toneSuccess = "hg-crm-module_toneSuccess_g3p5-";
16
+ var trendUp = "hg-crm-module_trendUp_d8byn";
17
+ var trendDown = "hg-crm-module_trendDown_cqvD9";
18
+ var money = "hg-crm-module_money_swfZL";
19
+ var inlineMark = "hg-crm-module_inlineMark_8tBE-";
20
+ var channelWhatsapp = "hg-crm-module_channelWhatsapp_wx3OA";
21
+ var tabular = "hg-crm-module_tabular_nwXOf";
22
+ var row = "hg-crm-module_row_cy6TN";
23
+ var rowInteractive = "hg-crm-module_rowInteractive_xqYTd";
24
+ var rowSelected = "hg-crm-module_rowSelected_0mBk9";
25
+ var rowMain = "hg-crm-module_rowMain_yVvAS";
26
+ var rowTitle = "hg-crm-module_rowTitle_a6WUX";
27
+ var rowMeta = "hg-crm-module_rowMeta_bRyzj";
28
+ var rowAside = "hg-crm-module_rowAside_1tn9Z";
29
+ var rowControl = "hg-crm-module_rowControl_GpMeB";
30
+ var unreadDot = "hg-crm-module_unreadDot_caKMG";
31
+ var unread = "hg-crm-module_unread_tLJN-";
32
+ var done = "hg-crm-module_done_E38Ff";
33
+ var timeline = "hg-crm-module_timeline_TqeR2";
34
+ var timelineItem = "hg-crm-module_timelineItem_P8RUA";
35
+ var timelineIcon = "hg-crm-module_timelineIcon_Cwftt";
36
+ var timelineBody = "hg-crm-module_timelineBody_iAWBs";
37
+ var timelineDetail = "hg-crm-module_timelineDetail_KqWFF";
38
+ var timelineTime = "hg-crm-module_timelineTime_jyg0m";
39
+ var approval = "hg-crm-module_approval_gZjt3";
40
+ var approvalHead = "hg-crm-module_approvalHead_pUman";
41
+ var approvalTitle = "hg-crm-module_approvalTitle_9fgn1";
42
+ var approvalReason = "hg-crm-module_approvalReason_-9HVT";
43
+ var diff = "hg-crm-module_diff_IrtdR";
44
+ var approvalActions = "hg-crm-module_approvalActions_SgdV6";
45
+ var approvalOutcome = "hg-crm-module_approvalOutcome_-HSyj";
46
+ var irreversible = "hg-crm-module_irreversible_DQYaJ";
47
+ var chip = "hg-crm-module_chip_NStjL";
48
+ var chipRemove = "hg-crm-module_chipRemove_TY-68";
49
+ var chipCount = "hg-crm-module_chipCount_OR1ym";
50
+ var chipStatic = "hg-crm-module_chipStatic_PFgVz";
51
+ var toolbar = "hg-crm-module_toolbar_-yYGo";
52
+ var toolbarSearch = "hg-crm-module_toolbarSearch_Hlqw2";
53
+ var toolbarChips = "hg-crm-module_toolbarChips_sIGg-";
54
+ var toolbarEnd = "hg-crm-module_toolbarEnd_B9jcI";
55
+ var scope = "hg-crm-module_scope_KA-Bw";
56
+ var record = "hg-crm-module_record_zU6MQ";
57
+ var recordText = "hg-crm-module_recordText_cgceM";
58
+ var recordTitleRow = "hg-crm-module_recordTitleRow_sAb2j";
59
+ var recordMeta = "hg-crm-module_recordMeta_lJLwO";
60
+ var breadcrumbs = "hg-crm-module_breadcrumbs_VRJgM";
61
+ var stages = "hg-crm-module_stages_IYKmz";
62
+ var stage = "hg-crm-module_stage_ZtmnD";
63
+ var stageBar = "hg-crm-module_stageBar_Oh2VF";
64
+ var stageDone = "hg-crm-module_stageDone_QOxxU";
65
+ var stageCurrent = "hg-crm-module_stageCurrent_NE8nR";
66
+ var stageLost = "hg-crm-module_stageLost_a70Uc";
67
+ var stageLabel = "hg-crm-module_stageLabel_nST9D";
68
+ var stagesCompact = "hg-crm-module_stagesCompact_nwm2T";
69
+ var sidebar = "hg-crm-module_sidebar_Qxo5X";
70
+ var navGroupLabel = "hg-crm-module_navGroupLabel_4W0RI";
71
+ var navList = "hg-crm-module_navList_niOzd";
72
+ var navItem = "hg-crm-module_navItem_UV1qU";
73
+ var navLabel = "hg-crm-module_navLabel_1cY7A";
74
+ var navCount = "hg-crm-module_navCount_Nd2Cb";
75
+ var details = "hg-crm-module_details_rH5Yl";
76
+ var detailRow = "hg-crm-module_detailRow_EyQUr";
77
+ var detailLabel = "hg-crm-module_detailLabel_vveUX";
78
+ var detailIcon = "hg-crm-module_detailIcon_V5pYf";
79
+ var detailValue = "hg-crm-module_detailValue_SOLpC";
80
+ var crm_module_default = {
81
+ pageHeader,
82
+ pageHeaderText,
83
+ pageTitle,
84
+ recordTitle,
85
+ pageDescription,
86
+ pageActions,
87
+ metric,
88
+ metricGroup,
89
+ metricLabel,
90
+ metricValue,
91
+ metricHint,
92
+ toneDanger,
93
+ toneWarning,
94
+ toneSuccess,
95
+ trendUp,
96
+ trendDown,
97
+ money,
98
+ inlineMark,
99
+ channelWhatsapp,
100
+ tabular,
101
+ row,
102
+ rowInteractive,
103
+ rowSelected,
104
+ rowMain,
105
+ rowTitle,
106
+ rowMeta,
107
+ rowAside,
108
+ rowControl,
109
+ unreadDot,
110
+ unread,
111
+ done,
112
+ timeline,
113
+ timelineItem,
114
+ timelineIcon,
115
+ timelineBody,
116
+ timelineDetail,
117
+ timelineTime,
118
+ approval,
119
+ approvalHead,
120
+ approvalTitle,
121
+ approvalReason,
122
+ diff,
123
+ approvalActions,
124
+ approvalOutcome,
125
+ irreversible,
126
+ chip,
127
+ chipRemove,
128
+ chipCount,
129
+ chipStatic,
130
+ toolbar,
131
+ toolbarSearch,
132
+ toolbarChips,
133
+ toolbarEnd,
134
+ scope,
135
+ record,
136
+ recordText,
137
+ recordTitleRow,
138
+ recordMeta,
139
+ breadcrumbs,
140
+ stages,
141
+ stage,
142
+ stageBar,
143
+ stageDone,
144
+ stageCurrent,
145
+ stageLost,
146
+ stageLabel,
147
+ stagesCompact,
148
+ sidebar,
149
+ navGroupLabel,
150
+ navList,
151
+ navItem,
152
+ navLabel,
153
+ navCount,
154
+ details,
155
+ detailRow,
156
+ detailLabel,
157
+ detailIcon,
158
+ detailValue
159
+ };
160
+ //#endregion
161
+ export { approval, approvalActions, approvalHead, approvalOutcome, approvalReason, approvalTitle, breadcrumbs, channelWhatsapp, chip, chipCount, chipRemove, chipStatic, crm_module_default as default, detailIcon, detailLabel, detailRow, detailValue, details, diff, done, inlineMark, irreversible, metric, metricGroup, metricHint, metricLabel, metricValue, money, navCount, navGroupLabel, navItem, navLabel, navList, pageActions, pageDescription, pageHeader, pageHeaderText, pageTitle, record, recordMeta, recordText, recordTitle, recordTitleRow, row, rowAside, rowControl, rowInteractive, rowMain, rowMeta, rowSelected, rowTitle, scope, sidebar, stage, stageBar, stageCurrent, stageDone, stageLabel, stageLost, stages, stagesCompact, tabular, timeline, timelineBody, timelineDetail, timelineIcon, timelineItem, timelineTime, toneDanger, toneSuccess, toneWarning, toolbar, toolbarChips, toolbarEnd, toolbarSearch, trendDown, trendUp, unread, unreadDot };
@@ -0,0 +1,13 @@
1
+ export interface DealStageProps {
2
+ /** Ordered pipeline stages. */
3
+ stages: string[];
4
+ /** Current stage (must be in `stages`). */
5
+ current: string;
6
+ /** Deal is closed-lost: the current segment turns red and the label says so. */
7
+ lost?: boolean;
8
+ /** Hide stage labels (for table cells). */
9
+ compact?: boolean;
10
+ className?: string;
11
+ }
12
+ /** Pipeline progress as segmented bars. Text conveys the position ("Stage 3 of 5: Proposal"). Server-component safe. */
13
+ export declare function DealStage({ stages, current, lost, compact, className }: DealStageProps): import("react").JSX.Element;