@handled-ai/design-system 0.18.32 → 0.18.33
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/draft-feedback-inline.js +10 -10
- package/dist/components/draft-feedback-inline.js.map +1 -1
- package/dist/components/pill.d.ts +1 -1
- package/dist/components/score-feedback.js +5 -5
- package/dist/components/score-feedback.js.map +1 -1
- package/dist/components/suggested-actions.js +24 -5
- package/dist/components/suggested-actions.js.map +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/__tests__/draft-feedback-inline.test.tsx +72 -0
- package/src/components/__tests__/suggested-actions-feedback-header.test.tsx +86 -0
- package/src/components/draft-feedback-inline.tsx +13 -12
- package/src/components/score-feedback.tsx +6 -6
- package/src/components/suggested-actions.tsx +28 -5
- package/src/index.ts +0 -1
- package/dist/components/related-record-action-card.d.ts +0 -19
- package/dist/components/related-record-action-card.js +0 -150
- package/dist/components/related-record-action-card.js.map +0 -1
- package/src/components/__tests__/related-record-action-card.test.tsx +0 -123
- package/src/components/related-record-action-card.tsx +0 -169
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { ExternalLink } from "lucide-react"
|
|
5
|
-
|
|
6
|
-
import { BRAND_ICONS } from "../lib/icons"
|
|
7
|
-
import { cn } from "../lib/utils"
|
|
8
|
-
|
|
9
|
-
export type RelatedRecordActionCardKind = "case" | "account" | "opportunity" | "salesforce" | "generic"
|
|
10
|
-
|
|
11
|
-
export type RelatedRecordActionIcon = "salesforce" | React.ReactNode
|
|
12
|
-
|
|
13
|
-
export interface RelatedRecordActionCardProps {
|
|
14
|
-
kind: RelatedRecordActionCardKind
|
|
15
|
-
label: string
|
|
16
|
-
subtitle?: string
|
|
17
|
-
disabledReason?: string
|
|
18
|
-
href?: string
|
|
19
|
-
external?: boolean
|
|
20
|
-
icon?: RelatedRecordActionIcon
|
|
21
|
-
onClick?: React.MouseEventHandler<HTMLButtonElement>
|
|
22
|
-
className?: string
|
|
23
|
-
testId?: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function renderActionIcon(icon: RelatedRecordActionIcon | undefined, kind: RelatedRecordActionCardKind) {
|
|
27
|
-
if (icon === "salesforce" || kind === "salesforce") {
|
|
28
|
-
return (
|
|
29
|
-
<img
|
|
30
|
-
src={BRAND_ICONS.salesforce}
|
|
31
|
-
alt="Salesforce"
|
|
32
|
-
className="h-4 w-4 object-contain"
|
|
33
|
-
draggable={false}
|
|
34
|
-
/>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (icon) {
|
|
39
|
-
return icon
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return <span aria-hidden="true">{kind.slice(0, 1).toUpperCase()}</span>
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function RelatedRecordActionCard({
|
|
46
|
-
kind,
|
|
47
|
-
label,
|
|
48
|
-
subtitle,
|
|
49
|
-
disabledReason,
|
|
50
|
-
href,
|
|
51
|
-
external,
|
|
52
|
-
icon,
|
|
53
|
-
onClick,
|
|
54
|
-
className,
|
|
55
|
-
testId,
|
|
56
|
-
}: RelatedRecordActionCardProps) {
|
|
57
|
-
const isDisabled = Boolean(disabledReason) || (!href && !onClick)
|
|
58
|
-
|
|
59
|
-
const content = (
|
|
60
|
-
<>
|
|
61
|
-
<span
|
|
62
|
-
data-slot="related-record-action-card-icon"
|
|
63
|
-
className={cn(
|
|
64
|
-
"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border text-xs font-semibold transition-colors",
|
|
65
|
-
isDisabled
|
|
66
|
-
? "border-border/60 bg-muted/40 text-muted-foreground"
|
|
67
|
-
: "border-border bg-muted/30 text-muted-foreground group-hover:bg-muted/60 group-active:text-primary"
|
|
68
|
-
)}
|
|
69
|
-
>
|
|
70
|
-
{renderActionIcon(icon, kind)}
|
|
71
|
-
</span>
|
|
72
|
-
<span className="min-w-0 flex-1">
|
|
73
|
-
<span
|
|
74
|
-
data-slot="related-record-action-card-label"
|
|
75
|
-
className={cn(
|
|
76
|
-
"block truncate text-sm font-medium transition-colors",
|
|
77
|
-
isDisabled ? "text-muted-foreground" : "text-foreground group-active:text-primary"
|
|
78
|
-
)}
|
|
79
|
-
>
|
|
80
|
-
{label}
|
|
81
|
-
</span>
|
|
82
|
-
{subtitle && (
|
|
83
|
-
<span
|
|
84
|
-
data-slot="related-record-action-card-subtitle"
|
|
85
|
-
className="mt-0.5 block truncate text-xs text-muted-foreground"
|
|
86
|
-
>
|
|
87
|
-
{subtitle}
|
|
88
|
-
</span>
|
|
89
|
-
)}
|
|
90
|
-
{disabledReason && (
|
|
91
|
-
<span
|
|
92
|
-
data-slot="related-record-action-card-disabled-reason"
|
|
93
|
-
className="mt-1 block text-xs text-muted-foreground"
|
|
94
|
-
>
|
|
95
|
-
{disabledReason}
|
|
96
|
-
</span>
|
|
97
|
-
)}
|
|
98
|
-
</span>
|
|
99
|
-
{external && (
|
|
100
|
-
<>
|
|
101
|
-
<span className="sr-only">opens in a new tab</span>
|
|
102
|
-
<ExternalLink
|
|
103
|
-
aria-hidden="true"
|
|
104
|
-
data-slot="related-record-action-card-external-icon"
|
|
105
|
-
className={cn(
|
|
106
|
-
"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-colors",
|
|
107
|
-
isDisabled ? "" : "group-active:text-primary"
|
|
108
|
-
)}
|
|
109
|
-
/>
|
|
110
|
-
</>
|
|
111
|
-
)}
|
|
112
|
-
</>
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
if (isDisabled) {
|
|
116
|
-
return (
|
|
117
|
-
<div
|
|
118
|
-
aria-disabled="true"
|
|
119
|
-
data-kind={kind}
|
|
120
|
-
data-slot="related-record-action-card"
|
|
121
|
-
data-testid={testId}
|
|
122
|
-
className={cn(
|
|
123
|
-
"group flex w-full items-center gap-3 rounded-lg border px-3 py-2 text-left transition-colors",
|
|
124
|
-
"cursor-not-allowed border-border/60 bg-muted/20 text-muted-foreground opacity-70",
|
|
125
|
-
className
|
|
126
|
-
)}
|
|
127
|
-
>
|
|
128
|
-
{content}
|
|
129
|
-
</div>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (href) {
|
|
134
|
-
return (
|
|
135
|
-
<a
|
|
136
|
-
href={href}
|
|
137
|
-
target={external ? "_blank" : undefined}
|
|
138
|
-
rel={external ? "noopener noreferrer" : undefined}
|
|
139
|
-
data-kind={kind}
|
|
140
|
-
data-slot="related-record-action-card"
|
|
141
|
-
data-testid={testId}
|
|
142
|
-
className={cn(
|
|
143
|
-
"group flex w-full items-center gap-3 rounded-lg border border-border bg-background px-3 py-2 text-left transition-colors",
|
|
144
|
-
"cursor-pointer hover:bg-muted/50 hover:border-border/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:text-primary",
|
|
145
|
-
className
|
|
146
|
-
)}
|
|
147
|
-
>
|
|
148
|
-
{content}
|
|
149
|
-
</a>
|
|
150
|
-
)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return (
|
|
154
|
-
<button
|
|
155
|
-
type="button"
|
|
156
|
-
onClick={onClick}
|
|
157
|
-
data-kind={kind}
|
|
158
|
-
data-slot="related-record-action-card"
|
|
159
|
-
data-testid={testId}
|
|
160
|
-
className={cn(
|
|
161
|
-
"group flex w-full items-center gap-3 rounded-lg border border-border bg-background px-3 py-2 text-left transition-colors",
|
|
162
|
-
"cursor-pointer hover:bg-muted/50 hover:border-border/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:text-primary",
|
|
163
|
-
className
|
|
164
|
-
)}
|
|
165
|
-
>
|
|
166
|
-
{content}
|
|
167
|
-
</button>
|
|
168
|
-
)
|
|
169
|
-
}
|