@handled-ai/design-system 0.18.19 → 0.18.21
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/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/data-table.js +1 -0
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/pill.d.ts +1 -1
- package/dist/components/score-analysis-modal.d.ts +8 -2
- package/dist/components/score-analysis-modal.js +19 -6
- package/dist/components/score-analysis-modal.js.map +1 -1
- package/dist/components/score-breakdown.d.ts +3 -1
- package/dist/components/score-breakdown.js +5 -6
- package/dist/components/score-breakdown.js.map +1 -1
- package/dist/components/score-ring.d.ts +6 -3
- package/dist/components/score-ring.js +30 -6
- package/dist/components/score-ring.js.map +1 -1
- package/dist/components/score-semantics.d.ts +24 -0
- package/dist/components/score-semantics.js +143 -0
- package/dist/components/score-semantics.js.map +1 -0
- package/dist/components/score-why-chips.d.ts +3 -2
- package/dist/components/score-why-chips.js +10 -21
- package/dist/components/score-why-chips.js.map +1 -1
- package/dist/components/signal-priority-popover.d.ts +1 -0
- package/dist/components/signal-priority-popover.js +20 -20
- package/dist/components/signal-priority-popover.js.map +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/prototype/index.d.ts +1 -0
- package/dist/prototype/prototype-accounts-view.d.ts +1 -0
- package/dist/prototype/prototype-admin-view.d.ts +1 -0
- package/dist/prototype/prototype-config.d.ts +1 -0
- package/dist/prototype/prototype-inbox-view.d.ts +1 -0
- package/dist/prototype/prototype-insights-view.d.ts +1 -0
- package/dist/prototype/prototype-shell.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/__tests__/score-analysis-modal.test.tsx +55 -0
- package/src/components/__tests__/score-breakdown-intent.test.tsx +47 -0
- package/src/components/__tests__/score-ring.test.tsx +43 -0
- package/src/components/__tests__/score-semantics.test.ts +101 -0
- package/src/components/__tests__/signal-priority-popover.test.tsx +7 -5
- package/src/components/data-table.tsx +1 -0
- package/src/components/score-analysis-modal.tsx +22 -5
- package/src/components/score-breakdown.tsx +7 -6
- package/src/components/score-ring.tsx +36 -5
- package/src/components/score-semantics.ts +154 -0
- package/src/components/score-why-chips.tsx +12 -23
- package/src/components/signal-priority-popover.tsx +21 -21
- package/src/index.ts +1 -0
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { ThumbsUp, ThumbsDown } from "lucide-react"
|
|
5
5
|
import { cn } from "../lib/utils"
|
|
6
|
+
import type { ScoreIntent } from "./score-semantics"
|
|
7
|
+
import { getScoreColor } from "./score-ring"
|
|
6
8
|
|
|
7
9
|
export interface ScoreFactor {
|
|
8
10
|
key: string
|
|
@@ -12,10 +14,8 @@ export interface ScoreFactor {
|
|
|
12
14
|
why: string
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
function getFactorBarColor(score: number) {
|
|
16
|
-
|
|
17
|
-
if (score >= 40) return "bg-amber-500"
|
|
18
|
-
return "bg-red-500"
|
|
17
|
+
function getFactorBarColor(score: number, intent: ScoreIntent = "positive") {
|
|
18
|
+
return getScoreColor(score, 100, intent).replace("text-", "bg-")
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function getRiskBadgeStyle(risk: "Low" | "Medium" | "High") {
|
|
@@ -34,6 +34,7 @@ interface ScoreBreakdownProps {
|
|
|
34
34
|
onFactorFeedback?: (factorKey: string, type: "up" | "down" | null, detail?: string) => void
|
|
35
35
|
className?: string
|
|
36
36
|
initialFeedback?: Record<string, { type: "up" | "down"; detail: string }>
|
|
37
|
+
scoreIntent?: ScoreIntent
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
function deriveInitialState<T>(
|
|
@@ -47,7 +48,7 @@ function deriveInitialState<T>(
|
|
|
47
48
|
return Object.fromEntries(filtered.map(([k, v]) => [k, mapFn(v)]))
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
function ScoreBreakdown({ factors, onFactorFeedback, className, initialFeedback }: ScoreBreakdownProps) {
|
|
51
|
+
function ScoreBreakdown({ factors, onFactorFeedback, className, initialFeedback, scoreIntent = "positive" }: ScoreBreakdownProps) {
|
|
51
52
|
const [feedback, setFeedback] = React.useState<Record<string, "up" | "down" | null>>(
|
|
52
53
|
() => deriveInitialState(initialFeedback, (v) => v.type)
|
|
53
54
|
)
|
|
@@ -170,7 +171,7 @@ function ScoreBreakdown({ factors, onFactorFeedback, className, initialFeedback
|
|
|
170
171
|
{factor.score !== null && (
|
|
171
172
|
<div className="w-full h-1 bg-muted rounded-full overflow-hidden">
|
|
172
173
|
<div
|
|
173
|
-
className={cn("h-full rounded-full", getFactorBarColor(factor.score))}
|
|
174
|
+
className={cn("h-full rounded-full", getFactorBarColor(factor.score, scoreIntent))}
|
|
174
175
|
style={{ width: `${factor.score}%` }}
|
|
175
176
|
/>
|
|
176
177
|
</div>
|
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
2
|
import { cn } from "../lib/utils"
|
|
3
|
+
import type { ScoreIntent } from "./score-semantics"
|
|
3
4
|
|
|
4
|
-
function getScoreColor(score: number, denominator: number) {
|
|
5
|
+
function getScoreColor(score: number, denominator: number, intent: ScoreIntent = "positive") {
|
|
5
6
|
const pct = (score / denominator) * 100
|
|
7
|
+
|
|
8
|
+
if (intent === "urgency") {
|
|
9
|
+
if (pct >= 80) return "text-red-600"
|
|
10
|
+
if (pct >= 60) return "text-orange-500"
|
|
11
|
+
if (pct >= 35) return "text-amber-500"
|
|
12
|
+
return "text-neutral-400"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (intent === "risk") {
|
|
16
|
+
if (pct >= 70) return "text-red-600"
|
|
17
|
+
if (pct >= 40) return "text-amber-500"
|
|
18
|
+
return "text-neutral-400"
|
|
19
|
+
}
|
|
20
|
+
|
|
6
21
|
if (pct >= 70) return "text-emerald-500"
|
|
7
22
|
if (pct >= 40) return "text-amber-500"
|
|
8
23
|
return "text-red-500"
|
|
9
24
|
}
|
|
10
25
|
|
|
11
|
-
function getScoreTrackColor(score: number, denominator: number) {
|
|
26
|
+
function getScoreTrackColor(score: number, denominator: number, intent: ScoreIntent = "positive") {
|
|
12
27
|
const pct = (score / denominator) * 100
|
|
28
|
+
|
|
29
|
+
if (intent === "urgency") {
|
|
30
|
+
if (pct >= 80) return "text-red-600/15"
|
|
31
|
+
if (pct >= 60) return "text-orange-500/15"
|
|
32
|
+
if (pct >= 35) return "text-amber-500/15"
|
|
33
|
+
return "text-neutral-400/15"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (intent === "risk") {
|
|
37
|
+
if (pct >= 70) return "text-red-600/15"
|
|
38
|
+
if (pct >= 40) return "text-amber-500/15"
|
|
39
|
+
return "text-neutral-400/15"
|
|
40
|
+
}
|
|
41
|
+
|
|
13
42
|
if (pct >= 70) return "text-emerald-500/15"
|
|
14
43
|
if (pct >= 40) return "text-amber-500/15"
|
|
15
44
|
return "text-red-500/15"
|
|
@@ -22,6 +51,7 @@ interface ScoreRingProps {
|
|
|
22
51
|
strokeWidth?: number
|
|
23
52
|
className?: string
|
|
24
53
|
showLabel?: boolean
|
|
54
|
+
intent?: ScoreIntent
|
|
25
55
|
}
|
|
26
56
|
|
|
27
57
|
function ScoreRing({
|
|
@@ -31,6 +61,7 @@ function ScoreRing({
|
|
|
31
61
|
strokeWidth = 10,
|
|
32
62
|
className,
|
|
33
63
|
showLabel = true,
|
|
64
|
+
intent = "positive",
|
|
34
65
|
}: ScoreRingProps) {
|
|
35
66
|
const radius = (size - strokeWidth) / 2
|
|
36
67
|
const circumference = 2 * Math.PI * radius
|
|
@@ -53,7 +84,7 @@ function ScoreRing({
|
|
|
53
84
|
fill="none"
|
|
54
85
|
stroke="currentColor"
|
|
55
86
|
strokeWidth={strokeWidth}
|
|
56
|
-
className={getScoreTrackColor(score, denominator)}
|
|
87
|
+
className={getScoreTrackColor(score, denominator, intent)}
|
|
57
88
|
/>
|
|
58
89
|
{/* Fill */}
|
|
59
90
|
<circle
|
|
@@ -66,7 +97,7 @@ function ScoreRing({
|
|
|
66
97
|
strokeLinecap="round"
|
|
67
98
|
strokeDasharray={circumference}
|
|
68
99
|
strokeDashoffset={offset}
|
|
69
|
-
className={cn("transition-all duration-500", getScoreColor(score, denominator))}
|
|
100
|
+
className={cn("transition-all duration-500", getScoreColor(score, denominator, intent))}
|
|
70
101
|
/>
|
|
71
102
|
</svg>
|
|
72
103
|
{showLabel && (
|
|
@@ -83,5 +114,5 @@ function ScoreRing({
|
|
|
83
114
|
)
|
|
84
115
|
}
|
|
85
116
|
|
|
86
|
-
export { ScoreRing, getScoreColor }
|
|
117
|
+
export { ScoreRing, getScoreColor, getScoreTrackColor }
|
|
87
118
|
export type { ScoreRingProps }
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
export type ScoreIntent = "urgency" | "risk" | "positive"
|
|
2
|
+
|
|
3
|
+
export type UrgencyLevel = "Low" | "Medium" | "High" | "Urgent"
|
|
4
|
+
export type RiskLevel = "Low Risk" | "Medium Risk" | "High Risk"
|
|
5
|
+
export type PositiveLevel = "Low" | "Medium" | "High"
|
|
6
|
+
|
|
7
|
+
export type ScoreSemanticClasses = {
|
|
8
|
+
solid: string
|
|
9
|
+
outline: string
|
|
10
|
+
dot: string
|
|
11
|
+
trigger: string
|
|
12
|
+
hover: string
|
|
13
|
+
open: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const URGENCY_SCORE_CLASSES: Record<UrgencyLevel, ScoreSemanticClasses> = {
|
|
17
|
+
Urgent: {
|
|
18
|
+
solid: "bg-red-600 text-white",
|
|
19
|
+
outline: "border-red-300 bg-red-50 text-red-800",
|
|
20
|
+
dot: "bg-red-600",
|
|
21
|
+
trigger: "border-red-300 bg-red-50 text-red-800",
|
|
22
|
+
hover: "hover:bg-red-100",
|
|
23
|
+
open: "bg-red-100",
|
|
24
|
+
},
|
|
25
|
+
High: {
|
|
26
|
+
solid: "bg-orange-500 text-white",
|
|
27
|
+
outline: "border-orange-300 bg-orange-50 text-orange-800",
|
|
28
|
+
dot: "bg-orange-500",
|
|
29
|
+
trigger: "border-orange-300 bg-orange-50 text-orange-800",
|
|
30
|
+
hover: "hover:bg-orange-100",
|
|
31
|
+
open: "bg-orange-100",
|
|
32
|
+
},
|
|
33
|
+
Medium: {
|
|
34
|
+
solid: "bg-amber-500 text-white",
|
|
35
|
+
outline: "border-amber-300 bg-amber-50 text-amber-800",
|
|
36
|
+
dot: "bg-amber-500",
|
|
37
|
+
trigger: "border-amber-300 bg-amber-50 text-amber-800",
|
|
38
|
+
hover: "hover:bg-amber-100",
|
|
39
|
+
open: "bg-amber-100",
|
|
40
|
+
},
|
|
41
|
+
Low: {
|
|
42
|
+
solid: "bg-neutral-300 text-neutral-900",
|
|
43
|
+
outline: "border-neutral-200 bg-neutral-50 text-neutral-700",
|
|
44
|
+
dot: "bg-neutral-400",
|
|
45
|
+
trigger: "border-neutral-200 bg-neutral-50 text-neutral-700",
|
|
46
|
+
hover: "hover:bg-neutral-100",
|
|
47
|
+
open: "bg-neutral-100",
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const RISK_SCORE_CLASSES: Record<RiskLevel, ScoreSemanticClasses> = {
|
|
52
|
+
"High Risk": {
|
|
53
|
+
solid: "bg-red-600 text-white",
|
|
54
|
+
outline: "border-red-300 bg-red-50 text-red-800",
|
|
55
|
+
dot: "bg-red-600",
|
|
56
|
+
trigger: "border-red-300 bg-red-50 text-red-800",
|
|
57
|
+
hover: "hover:bg-red-100",
|
|
58
|
+
open: "bg-red-100",
|
|
59
|
+
},
|
|
60
|
+
"Medium Risk": {
|
|
61
|
+
solid: "bg-amber-500 text-white",
|
|
62
|
+
outline: "border-amber-300 bg-amber-50 text-amber-800",
|
|
63
|
+
dot: "bg-amber-500",
|
|
64
|
+
trigger: "border-amber-300 bg-amber-50 text-amber-800",
|
|
65
|
+
hover: "hover:bg-amber-100",
|
|
66
|
+
open: "bg-amber-100",
|
|
67
|
+
},
|
|
68
|
+
"Low Risk": {
|
|
69
|
+
solid: "bg-neutral-300 text-neutral-900",
|
|
70
|
+
outline: "border-neutral-200 bg-neutral-50 text-neutral-700",
|
|
71
|
+
dot: "bg-neutral-400",
|
|
72
|
+
trigger: "border-neutral-200 bg-neutral-50 text-neutral-700",
|
|
73
|
+
hover: "hover:bg-neutral-100",
|
|
74
|
+
open: "bg-neutral-100",
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const POSITIVE_SCORE_CLASSES: Record<PositiveLevel, ScoreSemanticClasses> = {
|
|
79
|
+
High: {
|
|
80
|
+
solid: "bg-emerald-500 text-white",
|
|
81
|
+
outline: "border-emerald-300 bg-emerald-50 text-emerald-800",
|
|
82
|
+
dot: "bg-emerald-500",
|
|
83
|
+
trigger: "border-emerald-300 bg-emerald-50 text-emerald-800",
|
|
84
|
+
hover: "hover:bg-emerald-100",
|
|
85
|
+
open: "bg-emerald-100",
|
|
86
|
+
},
|
|
87
|
+
Medium: {
|
|
88
|
+
solid: "bg-amber-500 text-white",
|
|
89
|
+
outline: "border-amber-300 bg-amber-50 text-amber-800",
|
|
90
|
+
dot: "bg-amber-500",
|
|
91
|
+
trigger: "border-amber-300 bg-amber-50 text-amber-800",
|
|
92
|
+
hover: "hover:bg-amber-100",
|
|
93
|
+
open: "bg-amber-100",
|
|
94
|
+
},
|
|
95
|
+
Low: {
|
|
96
|
+
solid: "bg-red-500 text-white",
|
|
97
|
+
outline: "border-red-300 bg-red-50 text-red-800",
|
|
98
|
+
dot: "bg-red-500",
|
|
99
|
+
trigger: "border-red-300 bg-red-50 text-red-800",
|
|
100
|
+
hover: "hover:bg-red-100",
|
|
101
|
+
open: "bg-red-100",
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const SCORE_TONE_CLASSES: Record<string, string> = {
|
|
106
|
+
alert: "bg-red-50 text-red-600",
|
|
107
|
+
warn: "bg-amber-50 text-amber-600",
|
|
108
|
+
info: "bg-blue-50 text-blue-600",
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const DEFAULT_SCORE_TONE_CLASS = "bg-muted text-muted-foreground"
|
|
112
|
+
|
|
113
|
+
export function getUrgencyLevel(score: number): UrgencyLevel {
|
|
114
|
+
if (score >= 80) return "Urgent"
|
|
115
|
+
if (score >= 60) return "High"
|
|
116
|
+
if (score >= 35) return "Medium"
|
|
117
|
+
return "Low"
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function getUrgencyRange(label: UrgencyLevel): string {
|
|
121
|
+
switch (label) {
|
|
122
|
+
case "Urgent":
|
|
123
|
+
return "80-100"
|
|
124
|
+
case "High":
|
|
125
|
+
return "60-79"
|
|
126
|
+
case "Medium":
|
|
127
|
+
return "35-59"
|
|
128
|
+
case "Low":
|
|
129
|
+
return "0-34"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function getRiskLevel(score: number): RiskLevel {
|
|
134
|
+
if (score >= 70) return "High Risk"
|
|
135
|
+
if (score >= 40) return "Medium Risk"
|
|
136
|
+
return "Low Risk"
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function getPositiveLevel(score: number): PositiveLevel {
|
|
140
|
+
if (score >= 70) return "High"
|
|
141
|
+
if (score >= 40) return "Medium"
|
|
142
|
+
return "Low"
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function getScoreToneClasses(score: number, intent: ScoreIntent): ScoreSemanticClasses {
|
|
146
|
+
switch (intent) {
|
|
147
|
+
case "urgency":
|
|
148
|
+
return URGENCY_SCORE_CLASSES[getUrgencyLevel(score)]
|
|
149
|
+
case "risk":
|
|
150
|
+
return RISK_SCORE_CLASSES[getRiskLevel(score)]
|
|
151
|
+
case "positive":
|
|
152
|
+
return POSITIVE_SCORE_CLASSES[getPositiveLevel(score)]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -17,6 +17,12 @@ import type { LucideIcon } from "lucide-react"
|
|
|
17
17
|
import { FeedbackFooter } from "./feedback-primitives"
|
|
18
18
|
import type { FeedbackChipTree, FeedbackSubmitData, PersistedFeedbackData } from "./feedback-primitives"
|
|
19
19
|
import { cn } from "../lib/utils"
|
|
20
|
+
import {
|
|
21
|
+
DEFAULT_SCORE_TONE_CLASS,
|
|
22
|
+
SCORE_TONE_CLASSES,
|
|
23
|
+
getUrgencyLevel,
|
|
24
|
+
getUrgencyRange,
|
|
25
|
+
} from "./score-semantics"
|
|
20
26
|
import type {
|
|
21
27
|
QueueItem,
|
|
22
28
|
SignalScoreData,
|
|
@@ -33,24 +39,11 @@ export function getSignalScoreUrgencyLabel(
|
|
|
33
39
|
score: number,
|
|
34
40
|
providedLabel?: SignalScoreUrgencyLabel,
|
|
35
41
|
): SignalScoreUrgencyLabel {
|
|
36
|
-
|
|
37
|
-
if (score >= 80) return "Urgent"
|
|
38
|
-
if (score >= 60) return "High"
|
|
39
|
-
if (score >= 35) return "Medium"
|
|
40
|
-
return "Low"
|
|
42
|
+
return providedLabel ?? getUrgencyLevel(score)
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export function scoreRangeForUrgency(label: SignalScoreUrgencyLabel): string {
|
|
44
|
-
|
|
45
|
-
case "Urgent":
|
|
46
|
-
return "80-100"
|
|
47
|
-
case "High":
|
|
48
|
-
return "60-79"
|
|
49
|
-
case "Medium":
|
|
50
|
-
return "35-59"
|
|
51
|
-
case "Low":
|
|
52
|
-
return "0-34"
|
|
53
|
-
}
|
|
46
|
+
return getUrgencyRange(label)
|
|
54
47
|
}
|
|
55
48
|
|
|
56
49
|
function makeDomId(...parts: Array<string | undefined>): string {
|
|
@@ -107,15 +100,11 @@ function resolveIcon(iconName?: string): LucideIcon {
|
|
|
107
100
|
// Static tone class maps (REQUIRED for Tailwind v4 source scanning)
|
|
108
101
|
// ---------------------------------------------------------------------------
|
|
109
102
|
|
|
110
|
-
/** Shared tone-to-class map. Re-exported for
|
|
111
|
-
export const SIGNAL_TONE_CLASSES: Record<string, string> =
|
|
112
|
-
alert: "bg-red-50 text-red-600",
|
|
113
|
-
warn: "bg-amber-50 text-amber-600",
|
|
114
|
-
info: "bg-blue-50 text-blue-600",
|
|
115
|
-
}
|
|
103
|
+
/** Shared tone-to-class map. Re-exported for backward compatibility. */
|
|
104
|
+
export const SIGNAL_TONE_CLASSES: Record<string, string> = SCORE_TONE_CLASSES
|
|
116
105
|
|
|
117
|
-
/** Default tone for missing/unknown tone values */
|
|
118
|
-
export const DEFAULT_TONE_CLASS =
|
|
106
|
+
/** Default tone for missing/unknown tone values. Re-exported for backward compatibility. */
|
|
107
|
+
export const DEFAULT_TONE_CLASS = DEFAULT_SCORE_TONE_CLASS
|
|
119
108
|
|
|
120
109
|
// ---------------------------------------------------------------------------
|
|
121
110
|
// Em-dash fallback for missing slot data
|
|
@@ -22,7 +22,7 @@ import { cn } from "../lib/utils"
|
|
|
22
22
|
import { FeedbackFooter, InlineFeedbackControl } from "./feedback-primitives"
|
|
23
23
|
import type { FeedbackChipTree, FeedbackSubmitData, PersistedFeedbackData } from "./feedback-primitives"
|
|
24
24
|
import type { SignalScoreUrgencyLabel } from "../prototype/prototype-config"
|
|
25
|
-
import {
|
|
25
|
+
import { SCORE_TONE_CLASSES, URGENCY_SCORE_CLASSES, getUrgencyLevel, getUrgencyRange } from "./score-semantics"
|
|
26
26
|
|
|
27
27
|
// ---------------------------------------------------------------------------
|
|
28
28
|
// Types
|
|
@@ -75,28 +75,28 @@ export interface SignalPriorityPopoverProps {
|
|
|
75
75
|
// ---------------------------------------------------------------------------
|
|
76
76
|
|
|
77
77
|
const URGENCY_TRIGGER_DEFAULT: Record<SignalScoreUrgencyLabel, string> = {
|
|
78
|
-
Urgent:
|
|
79
|
-
High:
|
|
80
|
-
Medium:
|
|
81
|
-
Low:
|
|
78
|
+
Urgent: URGENCY_SCORE_CLASSES.Urgent.trigger,
|
|
79
|
+
High: URGENCY_SCORE_CLASSES.High.trigger,
|
|
80
|
+
Medium: URGENCY_SCORE_CLASSES.Medium.trigger,
|
|
81
|
+
Low: URGENCY_SCORE_CLASSES.Low.trigger,
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
const URGENCY_TRIGGER_HOVER: Record<SignalScoreUrgencyLabel, string> = {
|
|
85
|
-
Urgent:
|
|
86
|
-
High:
|
|
87
|
-
Medium:
|
|
88
|
-
Low:
|
|
85
|
+
Urgent: URGENCY_SCORE_CLASSES.Urgent.hover,
|
|
86
|
+
High: URGENCY_SCORE_CLASSES.High.hover,
|
|
87
|
+
Medium: URGENCY_SCORE_CLASSES.Medium.hover,
|
|
88
|
+
Low: URGENCY_SCORE_CLASSES.Low.hover,
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
const URGENCY_TRIGGER_OPEN: Record<SignalScoreUrgencyLabel, string> = {
|
|
92
|
-
Urgent:
|
|
93
|
-
High:
|
|
94
|
-
Medium:
|
|
95
|
-
Low:
|
|
92
|
+
Urgent: URGENCY_SCORE_CLASSES.Urgent.open,
|
|
93
|
+
High: URGENCY_SCORE_CLASSES.High.open,
|
|
94
|
+
Medium: URGENCY_SCORE_CLASSES.Medium.open,
|
|
95
|
+
Low: URGENCY_SCORE_CLASSES.Low.open,
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
/** Re-use shared tone classes from score-
|
|
99
|
-
const TONE_ICON_CLASSES: Record<PriorityFactor["tone"], string> =
|
|
98
|
+
/** Re-use shared tone classes from score-semantics. */
|
|
99
|
+
const TONE_ICON_CLASSES: Record<PriorityFactor["tone"], string> = SCORE_TONE_CLASSES as Record<PriorityFactor["tone"], string>
|
|
100
100
|
|
|
101
101
|
const DIRECTION_CLASSES: Record<PriorityFactor["direction"], string> = {
|
|
102
102
|
raises: "text-red-600",
|
|
@@ -124,10 +124,10 @@ const FACTOR_ICONS: Record<string, LucideIcon> = {
|
|
|
124
124
|
// ---------------------------------------------------------------------------
|
|
125
125
|
|
|
126
126
|
const URGENCY_DOT_CLASSES: Record<SignalScoreUrgencyLabel, string> = {
|
|
127
|
-
Urgent:
|
|
128
|
-
High:
|
|
129
|
-
Medium:
|
|
130
|
-
Low:
|
|
127
|
+
Urgent: URGENCY_SCORE_CLASSES.Urgent.dot,
|
|
128
|
+
High: URGENCY_SCORE_CLASSES.High.dot,
|
|
129
|
+
Medium: URGENCY_SCORE_CLASSES.Medium.dot,
|
|
130
|
+
Low: URGENCY_SCORE_CLASSES.Low.dot,
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
// ---------------------------------------------------------------------------
|
|
@@ -283,8 +283,8 @@ export function SignalPriorityPopover({
|
|
|
283
283
|
onFactorFeedback,
|
|
284
284
|
initialPriorityFeedback,
|
|
285
285
|
}: SignalPriorityPopoverProps) {
|
|
286
|
-
const urgencyLabel =
|
|
287
|
-
const scoreRange =
|
|
286
|
+
const urgencyLabel = providedLabel ?? getUrgencyLevel(score)
|
|
287
|
+
const scoreRange = getUrgencyRange(urgencyLabel)
|
|
288
288
|
|
|
289
289
|
const [open, setOpen] = React.useState(false)
|
|
290
290
|
const [feedback, setFeedback] = React.useState<"positive" | "negative" | null>(null)
|
package/src/index.ts
CHANGED
|
@@ -77,6 +77,7 @@ export * from "./components/rich-text-toolbar"
|
|
|
77
77
|
export * from "./components/score-analysis-modal"
|
|
78
78
|
export * from "./components/score-breakdown"
|
|
79
79
|
export * from "./components/score-feedback"
|
|
80
|
+
export * from "./components/score-semantics"
|
|
80
81
|
export * from "./components/score-why-chips"
|
|
81
82
|
export * from "./components/score-ring"
|
|
82
83
|
export * from "./components/scroll-area"
|