@vvedantb/ui 0.63.1 → 0.64.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.
|
@@ -118,42 +118,81 @@ function OptionRow(t0) {
|
|
|
118
118
|
* Read-only record of an AskUserQuestion prompt and the answer given. The live
|
|
119
119
|
* prompt is `MultipleChoiceQuestion` in the composer dock; this is the history
|
|
120
120
|
* left behind in the transcript once the question is answered.
|
|
121
|
+
*
|
|
122
|
+
* `headerAction` renders at the right end of the "Question" header row, for
|
|
123
|
+
* controls such as a pager when the caller shows one question at a time.
|
|
121
124
|
*/
|
|
122
125
|
export function ActivityQuestionCard(t0) {
|
|
123
|
-
const $ = _c(
|
|
126
|
+
const $ = _c(20);
|
|
124
127
|
const {
|
|
125
128
|
questions,
|
|
126
|
-
answers
|
|
129
|
+
answers,
|
|
130
|
+
headerAction
|
|
127
131
|
} = t0;
|
|
132
|
+
const merge = useCn();
|
|
128
133
|
if (questions.length === 0) {
|
|
129
134
|
return null;
|
|
130
135
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
const t1 = headerAction ? "min-h-7" : undefined;
|
|
137
|
+
let t2;
|
|
138
|
+
if ($[0] !== merge || $[1] !== t1) {
|
|
139
|
+
t2 = merge("flex items-center justify-between gap-2", t1);
|
|
140
|
+
$[0] = merge;
|
|
141
|
+
$[1] = t1;
|
|
142
|
+
$[2] = t2;
|
|
143
|
+
} else {
|
|
144
|
+
t2 = $[2];
|
|
145
|
+
}
|
|
146
|
+
let t3;
|
|
147
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
148
|
+
t3 = /*#__PURE__*/_jsx(IconMessageQuestion, {
|
|
134
149
|
size: 14
|
|
135
150
|
});
|
|
136
|
-
$[
|
|
151
|
+
$[3] = t3;
|
|
137
152
|
} else {
|
|
138
|
-
|
|
153
|
+
t3 = $[3];
|
|
139
154
|
}
|
|
140
|
-
const
|
|
141
|
-
let
|
|
142
|
-
if ($[
|
|
143
|
-
|
|
155
|
+
const t4 = questions.length > 1 ? "Questions" : "Question";
|
|
156
|
+
let t5;
|
|
157
|
+
if ($[4] !== t4) {
|
|
158
|
+
t5 = /*#__PURE__*/_jsxs("div", {
|
|
144
159
|
className: "flex items-center gap-1.5 text-xs font-medium text-muted-foreground",
|
|
145
|
-
children: [
|
|
160
|
+
children: [t3, t4]
|
|
146
161
|
});
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
162
|
+
$[4] = t4;
|
|
163
|
+
$[5] = t5;
|
|
149
164
|
} else {
|
|
150
|
-
|
|
165
|
+
t5 = $[5];
|
|
151
166
|
}
|
|
152
|
-
let
|
|
153
|
-
if ($[
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
167
|
+
let t6;
|
|
168
|
+
if ($[6] !== headerAction) {
|
|
169
|
+
t6 = headerAction ? /*#__PURE__*/_jsx("div", {
|
|
170
|
+
className: "flex shrink-0 items-center gap-1",
|
|
171
|
+
children: headerAction
|
|
172
|
+
}) : null;
|
|
173
|
+
$[6] = headerAction;
|
|
174
|
+
$[7] = t6;
|
|
175
|
+
} else {
|
|
176
|
+
t6 = $[7];
|
|
177
|
+
}
|
|
178
|
+
let t7;
|
|
179
|
+
if ($[8] !== t2 || $[9] !== t5 || $[10] !== t6) {
|
|
180
|
+
t7 = /*#__PURE__*/_jsxs("div", {
|
|
181
|
+
className: t2,
|
|
182
|
+
children: [t5, t6]
|
|
183
|
+
});
|
|
184
|
+
$[8] = t2;
|
|
185
|
+
$[9] = t5;
|
|
186
|
+
$[10] = t6;
|
|
187
|
+
$[11] = t7;
|
|
188
|
+
} else {
|
|
189
|
+
t7 = $[11];
|
|
190
|
+
}
|
|
191
|
+
let t8;
|
|
192
|
+
if ($[12] !== answers || $[13] !== questions) {
|
|
193
|
+
let t9;
|
|
194
|
+
if ($[15] !== answers) {
|
|
195
|
+
t9 = (question, questionIndex) => {
|
|
157
196
|
const answer = answers?.[question.question];
|
|
158
197
|
const hasAnswer = answer !== undefined && answer.trim().length > 0;
|
|
159
198
|
const chosen = selectedLabels(answer, question);
|
|
@@ -198,29 +237,29 @@ export function ActivityQuestionCard(t0) {
|
|
|
198
237
|
})]
|
|
199
238
|
}, `${question.question}-${questionIndex}`);
|
|
200
239
|
};
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
240
|
+
$[15] = answers;
|
|
241
|
+
$[16] = t9;
|
|
203
242
|
} else {
|
|
204
|
-
|
|
243
|
+
t9 = $[16];
|
|
205
244
|
}
|
|
206
|
-
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
245
|
+
t8 = questions.map(t9);
|
|
246
|
+
$[12] = answers;
|
|
247
|
+
$[13] = questions;
|
|
248
|
+
$[14] = t8;
|
|
210
249
|
} else {
|
|
211
|
-
|
|
250
|
+
t8 = $[14];
|
|
212
251
|
}
|
|
213
|
-
let
|
|
214
|
-
if ($[
|
|
215
|
-
|
|
252
|
+
let t9;
|
|
253
|
+
if ($[17] !== t7 || $[18] !== t8) {
|
|
254
|
+
t9 = /*#__PURE__*/_jsxs("div", {
|
|
216
255
|
className: "rounded-surface bg-card p-3 space-y-3",
|
|
217
|
-
children: [
|
|
256
|
+
children: [t7, t8]
|
|
218
257
|
});
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
258
|
+
$[17] = t7;
|
|
259
|
+
$[18] = t8;
|
|
260
|
+
$[19] = t9;
|
|
222
261
|
} else {
|
|
223
|
-
|
|
262
|
+
t9 = $[19];
|
|
224
263
|
}
|
|
225
|
-
return
|
|
264
|
+
return t9;
|
|
226
265
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
|
|
6
6
|
"type": "module",
|
|
@@ -79,21 +79,39 @@ function OptionRow({
|
|
|
79
79
|
* Read-only record of an AskUserQuestion prompt and the answer given. The live
|
|
80
80
|
* prompt is `MultipleChoiceQuestion` in the composer dock; this is the history
|
|
81
81
|
* left behind in the transcript once the question is answered.
|
|
82
|
+
*
|
|
83
|
+
* `headerAction` renders at the right end of the "Question" header row, for
|
|
84
|
+
* controls such as a pager when the caller shows one question at a time.
|
|
82
85
|
*/
|
|
83
86
|
export function ActivityQuestionCard({
|
|
84
87
|
questions,
|
|
85
88
|
answers,
|
|
89
|
+
headerAction,
|
|
86
90
|
}: {
|
|
87
91
|
questions: ActivityQuestion[];
|
|
88
92
|
answers?: Record<string, string>;
|
|
93
|
+
headerAction?: ReactNode;
|
|
89
94
|
}) {
|
|
95
|
+
const merge = useCn();
|
|
90
96
|
if (questions.length === 0) return null;
|
|
91
97
|
|
|
92
98
|
return (
|
|
93
99
|
<div className="rounded-surface bg-card p-3 space-y-3">
|
|
94
|
-
<div
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
<div
|
|
101
|
+
className={merge(
|
|
102
|
+
"flex items-center justify-between gap-2",
|
|
103
|
+
// The action row's 28px buttons set the height, so the header keeps
|
|
104
|
+
// clear of the question text below.
|
|
105
|
+
headerAction ? "min-h-7" : undefined,
|
|
106
|
+
)}
|
|
107
|
+
>
|
|
108
|
+
<div className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
|
|
109
|
+
<IconMessageQuestion size={14} />
|
|
110
|
+
{questions.length > 1 ? "Questions" : "Question"}
|
|
111
|
+
</div>
|
|
112
|
+
{headerAction ? (
|
|
113
|
+
<div className="flex shrink-0 items-center gap-1">{headerAction}</div>
|
|
114
|
+
) : null}
|
|
97
115
|
</div>
|
|
98
116
|
{questions.map((question, questionIndex) => {
|
|
99
117
|
const answer = answers?.[question.question];
|