@petrarca/sonnet-ui 0.4.2 → 0.5.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.
- package/dist/index.d.ts +104 -1
- package/dist/index.js +737 -510
- package/dist/index.js.map +1 -1
- package/dist/json-editor/index.d.ts +9 -1
- package/dist/json-editor/index.js +24 -17
- package/dist/json-editor/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -147,10 +147,10 @@ var buttonVariants = cva3(
|
|
|
147
147
|
link: "text-primary underline-offset-4 hover:underline"
|
|
148
148
|
},
|
|
149
149
|
size: {
|
|
150
|
-
default: "h-
|
|
151
|
-
sm: "h-
|
|
152
|
-
lg: "h-
|
|
153
|
-
icon: "h-
|
|
150
|
+
default: "h-9 px-4 py-2",
|
|
151
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
152
|
+
lg: "h-10 rounded-md px-8",
|
|
153
|
+
icon: "h-9 w-9",
|
|
154
154
|
compact: "h-7 w-7 p-0"
|
|
155
155
|
}
|
|
156
156
|
},
|
|
@@ -175,15 +175,96 @@ var Button = React3.forwardRef(
|
|
|
175
175
|
);
|
|
176
176
|
Button.displayName = "Button";
|
|
177
177
|
|
|
178
|
-
// src/
|
|
178
|
+
// src/icon-button.tsx
|
|
179
|
+
import * as React5 from "react";
|
|
180
|
+
import { cn as cn6 } from "@petrarca/sonnet-core";
|
|
181
|
+
|
|
182
|
+
// src/tooltip.tsx
|
|
179
183
|
import * as React4 from "react";
|
|
184
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
180
185
|
import { cn as cn5 } from "@petrarca/sonnet-core";
|
|
181
186
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
182
|
-
var
|
|
183
|
-
|
|
187
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
188
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
189
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
190
|
+
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx5(
|
|
191
|
+
TooltipPrimitive.Content,
|
|
184
192
|
{
|
|
185
193
|
ref,
|
|
194
|
+
sideOffset,
|
|
186
195
|
className: cn5(
|
|
196
|
+
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
|
197
|
+
className
|
|
198
|
+
),
|
|
199
|
+
...props
|
|
200
|
+
}
|
|
201
|
+
));
|
|
202
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
203
|
+
|
|
204
|
+
// src/simple-tooltip.tsx
|
|
205
|
+
import { jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
206
|
+
function SimpleTooltip({
|
|
207
|
+
label,
|
|
208
|
+
children,
|
|
209
|
+
side,
|
|
210
|
+
align,
|
|
211
|
+
delayDuration = 700,
|
|
212
|
+
sideOffset
|
|
213
|
+
}) {
|
|
214
|
+
return /* @__PURE__ */ jsx6(TooltipProvider, { delayDuration, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
215
|
+
/* @__PURE__ */ jsx6(TooltipTrigger, { asChild: true, children }),
|
|
216
|
+
/* @__PURE__ */ jsx6(TooltipContent, { side, align, sideOffset, children: label })
|
|
217
|
+
] }) });
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// src/icon-button.tsx
|
|
221
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
222
|
+
function revealClass(disabled) {
|
|
223
|
+
return disabled ? "disabled:opacity-30 group-hover/row:disabled:opacity-30" : "opacity-0 group-hover/row:opacity-100 focus:opacity-100";
|
|
224
|
+
}
|
|
225
|
+
var IconButton = React5.forwardRef(
|
|
226
|
+
function IconButton2({
|
|
227
|
+
label,
|
|
228
|
+
children,
|
|
229
|
+
tone = "default",
|
|
230
|
+
variant = "ghost",
|
|
231
|
+
tooltipSide,
|
|
232
|
+
revealOnHover = false,
|
|
233
|
+
className,
|
|
234
|
+
disabled,
|
|
235
|
+
...props
|
|
236
|
+
}, ref) {
|
|
237
|
+
const toneClass = variant === "ghost" ? tone === "destructive" ? "text-muted-foreground hover:text-destructive" : "text-muted-foreground hover:text-foreground" : tone === "destructive" ? "hover:text-destructive" : void 0;
|
|
238
|
+
return /* @__PURE__ */ jsx7(SimpleTooltip, { label, side: tooltipSide, children: /* @__PURE__ */ jsx7(
|
|
239
|
+
Button,
|
|
240
|
+
{
|
|
241
|
+
ref,
|
|
242
|
+
type: "button",
|
|
243
|
+
size: "compact",
|
|
244
|
+
variant,
|
|
245
|
+
"aria-label": label,
|
|
246
|
+
disabled,
|
|
247
|
+
className: cn6(
|
|
248
|
+
toneClass,
|
|
249
|
+
revealOnHover && revealClass(disabled),
|
|
250
|
+
className
|
|
251
|
+
),
|
|
252
|
+
...props,
|
|
253
|
+
children
|
|
254
|
+
}
|
|
255
|
+
) });
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
// src/card.tsx
|
|
260
|
+
import * as React6 from "react";
|
|
261
|
+
import { cn as cn7 } from "@petrarca/sonnet-core";
|
|
262
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
263
|
+
var Card = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
ref,
|
|
267
|
+
className: cn7(
|
|
187
268
|
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
188
269
|
className
|
|
189
270
|
),
|
|
@@ -191,20 +272,20 @@ var Card = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ j
|
|
|
191
272
|
}
|
|
192
273
|
));
|
|
193
274
|
Card.displayName = "Card";
|
|
194
|
-
var CardHeader =
|
|
275
|
+
var CardHeader = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
195
276
|
"div",
|
|
196
277
|
{
|
|
197
278
|
ref,
|
|
198
|
-
className:
|
|
279
|
+
className: cn7("flex flex-col space-y-1.5 p-6", className),
|
|
199
280
|
...props
|
|
200
281
|
}
|
|
201
282
|
));
|
|
202
283
|
CardHeader.displayName = "CardHeader";
|
|
203
|
-
var CardTitle =
|
|
284
|
+
var CardTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
204
285
|
"div",
|
|
205
286
|
{
|
|
206
287
|
ref,
|
|
207
|
-
className:
|
|
288
|
+
className: cn7(
|
|
208
289
|
"text-2xl font-semibold leading-none tracking-tight",
|
|
209
290
|
className
|
|
210
291
|
),
|
|
@@ -212,47 +293,47 @@ var CardTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
212
293
|
}
|
|
213
294
|
));
|
|
214
295
|
CardTitle.displayName = "CardTitle";
|
|
215
|
-
var CardDescription =
|
|
296
|
+
var CardDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
216
297
|
"div",
|
|
217
298
|
{
|
|
218
299
|
ref,
|
|
219
|
-
className:
|
|
300
|
+
className: cn7("text-sm text-muted-foreground", className),
|
|
220
301
|
...props
|
|
221
302
|
}
|
|
222
303
|
));
|
|
223
304
|
CardDescription.displayName = "CardDescription";
|
|
224
|
-
var CardContent =
|
|
305
|
+
var CardContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("div", { ref, className: cn7("p-6 pt-0", className), ...props }));
|
|
225
306
|
CardContent.displayName = "CardContent";
|
|
226
|
-
var CardFooter =
|
|
307
|
+
var CardFooter = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
227
308
|
"div",
|
|
228
309
|
{
|
|
229
310
|
ref,
|
|
230
|
-
className:
|
|
311
|
+
className: cn7("flex items-center p-6 pt-0", className),
|
|
231
312
|
...props
|
|
232
313
|
}
|
|
233
314
|
));
|
|
234
315
|
CardFooter.displayName = "CardFooter";
|
|
235
316
|
|
|
236
317
|
// src/checkbox.tsx
|
|
237
|
-
import * as
|
|
318
|
+
import * as React7 from "react";
|
|
238
319
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
239
320
|
import { Check } from "lucide-react";
|
|
240
|
-
import { cn as
|
|
241
|
-
import { jsx as
|
|
242
|
-
var Checkbox =
|
|
321
|
+
import { cn as cn8 } from "@petrarca/sonnet-core";
|
|
322
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
323
|
+
var Checkbox = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
|
|
243
324
|
CheckboxPrimitive.Root,
|
|
244
325
|
{
|
|
245
326
|
ref,
|
|
246
|
-
className:
|
|
327
|
+
className: cn8(
|
|
247
328
|
"grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
248
329
|
className
|
|
249
330
|
),
|
|
250
331
|
...props,
|
|
251
|
-
children: /* @__PURE__ */
|
|
332
|
+
children: /* @__PURE__ */ jsx9(
|
|
252
333
|
CheckboxPrimitive.Indicator,
|
|
253
334
|
{
|
|
254
|
-
className:
|
|
255
|
-
children: /* @__PURE__ */
|
|
335
|
+
className: cn8("grid place-content-center text-current"),
|
|
336
|
+
children: /* @__PURE__ */ jsx9(Check, { className: "h-4 w-4" })
|
|
256
337
|
}
|
|
257
338
|
)
|
|
258
339
|
}
|
|
@@ -266,26 +347,26 @@ var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
|
|
|
266
347
|
var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
|
|
267
348
|
|
|
268
349
|
// src/command.tsx
|
|
269
|
-
import * as
|
|
350
|
+
import * as React9 from "react";
|
|
270
351
|
import { Command as CommandPrimitive } from "cmdk";
|
|
271
352
|
import { Search } from "lucide-react";
|
|
272
|
-
import { cn as
|
|
353
|
+
import { cn as cn10 } from "@petrarca/sonnet-core";
|
|
273
354
|
|
|
274
355
|
// src/dialog.tsx
|
|
275
|
-
import * as
|
|
356
|
+
import * as React8 from "react";
|
|
276
357
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
277
358
|
import { X } from "lucide-react";
|
|
278
|
-
import { cn as
|
|
279
|
-
import { jsx as
|
|
359
|
+
import { cn as cn9 } from "@petrarca/sonnet-core";
|
|
360
|
+
import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
280
361
|
var Dialog = DialogPrimitive.Root;
|
|
281
362
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
282
363
|
var DialogPortal = DialogPrimitive.Portal;
|
|
283
364
|
var DialogClose = DialogPrimitive.Close;
|
|
284
|
-
var DialogOverlay =
|
|
365
|
+
var DialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
285
366
|
DialogPrimitive.Overlay,
|
|
286
367
|
{
|
|
287
368
|
ref,
|
|
288
|
-
className:
|
|
369
|
+
className: cn9(
|
|
289
370
|
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
290
371
|
className
|
|
291
372
|
),
|
|
@@ -293,22 +374,22 @@ var DialogOverlay = React6.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
293
374
|
}
|
|
294
375
|
));
|
|
295
376
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
296
|
-
var DialogContent =
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
/* @__PURE__ */
|
|
377
|
+
var DialogContent = React8.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(DialogPortal, { children: [
|
|
378
|
+
/* @__PURE__ */ jsx10(DialogOverlay, {}),
|
|
379
|
+
/* @__PURE__ */ jsxs2(
|
|
299
380
|
DialogPrimitive.Content,
|
|
300
381
|
{
|
|
301
382
|
ref,
|
|
302
|
-
className:
|
|
383
|
+
className: cn9(
|
|
303
384
|
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
304
385
|
className
|
|
305
386
|
),
|
|
306
387
|
...props,
|
|
307
388
|
children: [
|
|
308
389
|
children,
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ jsxs2(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
391
|
+
/* @__PURE__ */ jsx10(X, { className: "h-4 w-4" }),
|
|
392
|
+
/* @__PURE__ */ jsx10("span", { className: "sr-only", children: "Close" })
|
|
312
393
|
] })
|
|
313
394
|
]
|
|
314
395
|
}
|
|
@@ -318,10 +399,10 @@ DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
|
318
399
|
var DialogHeader = ({
|
|
319
400
|
className,
|
|
320
401
|
...props
|
|
321
|
-
}) => /* @__PURE__ */
|
|
402
|
+
}) => /* @__PURE__ */ jsx10(
|
|
322
403
|
"div",
|
|
323
404
|
{
|
|
324
|
-
className:
|
|
405
|
+
className: cn9(
|
|
325
406
|
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
326
407
|
className
|
|
327
408
|
),
|
|
@@ -332,10 +413,10 @@ DialogHeader.displayName = "DialogHeader";
|
|
|
332
413
|
var DialogFooter = ({
|
|
333
414
|
className,
|
|
334
415
|
...props
|
|
335
|
-
}) => /* @__PURE__ */
|
|
416
|
+
}) => /* @__PURE__ */ jsx10(
|
|
336
417
|
"div",
|
|
337
418
|
{
|
|
338
|
-
className:
|
|
419
|
+
className: cn9(
|
|
339
420
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
340
421
|
className
|
|
341
422
|
),
|
|
@@ -343,11 +424,11 @@ var DialogFooter = ({
|
|
|
343
424
|
}
|
|
344
425
|
);
|
|
345
426
|
DialogFooter.displayName = "DialogFooter";
|
|
346
|
-
var DialogTitle =
|
|
427
|
+
var DialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
347
428
|
DialogPrimitive.Title,
|
|
348
429
|
{
|
|
349
430
|
ref,
|
|
350
|
-
className:
|
|
431
|
+
className: cn9(
|
|
351
432
|
"text-lg font-semibold leading-none tracking-tight",
|
|
352
433
|
className
|
|
353
434
|
),
|
|
@@ -355,23 +436,23 @@ var DialogTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
355
436
|
}
|
|
356
437
|
));
|
|
357
438
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
358
|
-
var DialogDescription =
|
|
439
|
+
var DialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
359
440
|
DialogPrimitive.Description,
|
|
360
441
|
{
|
|
361
442
|
ref,
|
|
362
|
-
className:
|
|
443
|
+
className: cn9("text-sm text-muted-foreground", className),
|
|
363
444
|
...props
|
|
364
445
|
}
|
|
365
446
|
));
|
|
366
447
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
367
448
|
|
|
368
449
|
// src/command.tsx
|
|
369
|
-
import { jsx as
|
|
370
|
-
var Command =
|
|
450
|
+
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
451
|
+
var Command = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
371
452
|
CommandPrimitive,
|
|
372
453
|
{
|
|
373
454
|
ref,
|
|
374
|
-
className:
|
|
455
|
+
className: cn10(
|
|
375
456
|
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
376
457
|
className
|
|
377
458
|
),
|
|
@@ -380,15 +461,15 @@ var Command = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
380
461
|
));
|
|
381
462
|
Command.displayName = CommandPrimitive.displayName;
|
|
382
463
|
var CommandDialog = ({ children, ...props }) => {
|
|
383
|
-
return /* @__PURE__ */
|
|
464
|
+
return /* @__PURE__ */ jsx11(Dialog, { ...props, children: /* @__PURE__ */ jsx11(DialogContent, { className: "overflow-hidden p-0 shadow-lg", children: /* @__PURE__ */ jsx11(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children }) }) });
|
|
384
465
|
};
|
|
385
|
-
var CommandInput =
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
466
|
+
var CommandInput = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs3("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
467
|
+
/* @__PURE__ */ jsx11(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
468
|
+
/* @__PURE__ */ jsx11(
|
|
388
469
|
CommandPrimitive.Input,
|
|
389
470
|
{
|
|
390
471
|
ref,
|
|
391
|
-
className:
|
|
472
|
+
className: cn10(
|
|
392
473
|
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
393
474
|
className
|
|
394
475
|
),
|
|
@@ -397,16 +478,16 @@ var CommandInput = React7.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
397
478
|
)
|
|
398
479
|
] }));
|
|
399
480
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
400
|
-
var CommandList =
|
|
481
|
+
var CommandList = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
401
482
|
CommandPrimitive.List,
|
|
402
483
|
{
|
|
403
484
|
ref,
|
|
404
|
-
className:
|
|
485
|
+
className: cn10("max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
405
486
|
...props
|
|
406
487
|
}
|
|
407
488
|
));
|
|
408
489
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
409
|
-
var CommandEmpty =
|
|
490
|
+
var CommandEmpty = React9.forwardRef((props, ref) => /* @__PURE__ */ jsx11(
|
|
410
491
|
CommandPrimitive.Empty,
|
|
411
492
|
{
|
|
412
493
|
ref,
|
|
@@ -415,11 +496,11 @@ var CommandEmpty = React7.forwardRef((props, ref) => /* @__PURE__ */ jsx8(
|
|
|
415
496
|
}
|
|
416
497
|
));
|
|
417
498
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
418
|
-
var CommandGroup =
|
|
499
|
+
var CommandGroup = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
419
500
|
CommandPrimitive.Group,
|
|
420
501
|
{
|
|
421
502
|
ref,
|
|
422
|
-
className:
|
|
503
|
+
className: cn10(
|
|
423
504
|
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
424
505
|
className
|
|
425
506
|
),
|
|
@@ -427,20 +508,20 @@ var CommandGroup = React7.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
427
508
|
}
|
|
428
509
|
));
|
|
429
510
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
430
|
-
var CommandSeparator =
|
|
511
|
+
var CommandSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
431
512
|
CommandPrimitive.Separator,
|
|
432
513
|
{
|
|
433
514
|
ref,
|
|
434
|
-
className:
|
|
515
|
+
className: cn10("-mx-1 h-px bg-border", className),
|
|
435
516
|
...props
|
|
436
517
|
}
|
|
437
518
|
));
|
|
438
519
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
439
|
-
var CommandItem =
|
|
520
|
+
var CommandItem = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
440
521
|
CommandPrimitive.Item,
|
|
441
522
|
{
|
|
442
523
|
ref,
|
|
443
|
-
className:
|
|
524
|
+
className: cn10(
|
|
444
525
|
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
445
526
|
className
|
|
446
527
|
),
|
|
@@ -452,10 +533,10 @@ var CommandShortcut = ({
|
|
|
452
533
|
className,
|
|
453
534
|
...props
|
|
454
535
|
}) => {
|
|
455
|
-
return /* @__PURE__ */
|
|
536
|
+
return /* @__PURE__ */ jsx11(
|
|
456
537
|
"span",
|
|
457
538
|
{
|
|
458
|
-
className:
|
|
539
|
+
className: cn10(
|
|
459
540
|
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
460
541
|
className
|
|
461
542
|
),
|
|
@@ -466,22 +547,22 @@ var CommandShortcut = ({
|
|
|
466
547
|
CommandShortcut.displayName = "CommandShortcut";
|
|
467
548
|
|
|
468
549
|
// src/dropdown-menu.tsx
|
|
469
|
-
import * as
|
|
550
|
+
import * as React10 from "react";
|
|
470
551
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
471
552
|
import { Check as Check2, ChevronRight, Circle } from "lucide-react";
|
|
472
|
-
import { cn as
|
|
473
|
-
import { jsx as
|
|
553
|
+
import { cn as cn11 } from "@petrarca/sonnet-core";
|
|
554
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
474
555
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
475
556
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
476
557
|
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
477
558
|
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
478
559
|
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
479
560
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
480
|
-
var DropdownMenuSubTrigger =
|
|
561
|
+
var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs4(
|
|
481
562
|
DropdownMenuPrimitive.SubTrigger,
|
|
482
563
|
{
|
|
483
564
|
ref,
|
|
484
|
-
className:
|
|
565
|
+
className: cn11(
|
|
485
566
|
"flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
486
567
|
inset && "pl-8",
|
|
487
568
|
className
|
|
@@ -489,16 +570,16 @@ var DropdownMenuSubTrigger = React8.forwardRef(({ className, inset, children, ..
|
|
|
489
570
|
...props,
|
|
490
571
|
children: [
|
|
491
572
|
children,
|
|
492
|
-
/* @__PURE__ */
|
|
573
|
+
/* @__PURE__ */ jsx12(ChevronRight, { className: "ml-auto" })
|
|
493
574
|
]
|
|
494
575
|
}
|
|
495
576
|
));
|
|
496
577
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
497
|
-
var DropdownMenuSubContent =
|
|
578
|
+
var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
498
579
|
DropdownMenuPrimitive.SubContent,
|
|
499
580
|
{
|
|
500
581
|
ref,
|
|
501
|
-
className:
|
|
582
|
+
className: cn11(
|
|
502
583
|
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
503
584
|
className
|
|
504
585
|
),
|
|
@@ -506,12 +587,12 @@ var DropdownMenuSubContent = React8.forwardRef(({ className, ...props }, ref) =>
|
|
|
506
587
|
}
|
|
507
588
|
));
|
|
508
589
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
509
|
-
var DropdownMenuContent =
|
|
590
|
+
var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx12(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx12(
|
|
510
591
|
DropdownMenuPrimitive.Content,
|
|
511
592
|
{
|
|
512
593
|
ref,
|
|
513
594
|
sideOffset,
|
|
514
|
-
className:
|
|
595
|
+
className: cn11(
|
|
515
596
|
"z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
516
597
|
className
|
|
517
598
|
),
|
|
@@ -519,11 +600,11 @@ var DropdownMenuContent = React8.forwardRef(({ className, sideOffset = 4, ...pro
|
|
|
519
600
|
}
|
|
520
601
|
) }));
|
|
521
602
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
522
|
-
var DropdownMenuItem =
|
|
603
|
+
var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
523
604
|
DropdownMenuPrimitive.Item,
|
|
524
605
|
{
|
|
525
606
|
ref,
|
|
526
|
-
className:
|
|
607
|
+
className: cn11(
|
|
527
608
|
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
528
609
|
inset && "pl-8",
|
|
529
610
|
className
|
|
@@ -532,44 +613,44 @@ var DropdownMenuItem = React8.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
532
613
|
}
|
|
533
614
|
));
|
|
534
615
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
535
|
-
var DropdownMenuCheckboxItem =
|
|
616
|
+
var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs4(
|
|
536
617
|
DropdownMenuPrimitive.CheckboxItem,
|
|
537
618
|
{
|
|
538
619
|
ref,
|
|
539
|
-
className:
|
|
620
|
+
className: cn11(
|
|
540
621
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
541
622
|
className
|
|
542
623
|
),
|
|
543
624
|
checked,
|
|
544
625
|
...props,
|
|
545
626
|
children: [
|
|
546
|
-
/* @__PURE__ */
|
|
627
|
+
/* @__PURE__ */ jsx12("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx12(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx12(Check2, { className: "h-4 w-4" }) }) }),
|
|
547
628
|
children
|
|
548
629
|
]
|
|
549
630
|
}
|
|
550
631
|
));
|
|
551
632
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
552
|
-
var DropdownMenuRadioItem =
|
|
633
|
+
var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs4(
|
|
553
634
|
DropdownMenuPrimitive.RadioItem,
|
|
554
635
|
{
|
|
555
636
|
ref,
|
|
556
|
-
className:
|
|
637
|
+
className: cn11(
|
|
557
638
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
558
639
|
className
|
|
559
640
|
),
|
|
560
641
|
...props,
|
|
561
642
|
children: [
|
|
562
|
-
/* @__PURE__ */
|
|
643
|
+
/* @__PURE__ */ jsx12("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx12(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx12(Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
|
563
644
|
children
|
|
564
645
|
]
|
|
565
646
|
}
|
|
566
647
|
));
|
|
567
648
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
568
|
-
var DropdownMenuLabel =
|
|
649
|
+
var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
569
650
|
DropdownMenuPrimitive.Label,
|
|
570
651
|
{
|
|
571
652
|
ref,
|
|
572
|
-
className:
|
|
653
|
+
className: cn11(
|
|
573
654
|
"px-2 py-1.5 text-sm font-semibold",
|
|
574
655
|
inset && "pl-8",
|
|
575
656
|
className
|
|
@@ -578,11 +659,11 @@ var DropdownMenuLabel = React8.forwardRef(({ className, inset, ...props }, ref)
|
|
|
578
659
|
}
|
|
579
660
|
));
|
|
580
661
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
581
|
-
var DropdownMenuSeparator =
|
|
662
|
+
var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
582
663
|
DropdownMenuPrimitive.Separator,
|
|
583
664
|
{
|
|
584
665
|
ref,
|
|
585
|
-
className:
|
|
666
|
+
className: cn11("-mx-1 my-1 h-px bg-muted", className),
|
|
586
667
|
...props
|
|
587
668
|
}
|
|
588
669
|
));
|
|
@@ -591,10 +672,10 @@ var DropdownMenuShortcut = ({
|
|
|
591
672
|
className,
|
|
592
673
|
...props
|
|
593
674
|
}) => {
|
|
594
|
-
return /* @__PURE__ */
|
|
675
|
+
return /* @__PURE__ */ jsx12(
|
|
595
676
|
"span",
|
|
596
677
|
{
|
|
597
|
-
className:
|
|
678
|
+
className: cn11("ml-auto text-xs tracking-widest opacity-60", className),
|
|
598
679
|
...props
|
|
599
680
|
}
|
|
600
681
|
);
|
|
@@ -602,16 +683,16 @@ var DropdownMenuShortcut = ({
|
|
|
602
683
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
603
684
|
|
|
604
685
|
// src/input.tsx
|
|
605
|
-
import * as
|
|
606
|
-
import { cn as
|
|
607
|
-
import { jsx as
|
|
608
|
-
var Input =
|
|
686
|
+
import * as React11 from "react";
|
|
687
|
+
import { cn as cn12 } from "@petrarca/sonnet-core";
|
|
688
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
689
|
+
var Input = React11.forwardRef(
|
|
609
690
|
({ className, type, ...props }, ref) => {
|
|
610
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ jsx13(
|
|
611
692
|
"input",
|
|
612
693
|
{
|
|
613
694
|
type,
|
|
614
|
-
className:
|
|
695
|
+
className: cn12(
|
|
615
696
|
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
616
697
|
className
|
|
617
698
|
),
|
|
@@ -625,17 +706,17 @@ Input.displayName = "Input";
|
|
|
625
706
|
|
|
626
707
|
// src/input-group.tsx
|
|
627
708
|
import { cva as cva4 } from "class-variance-authority";
|
|
628
|
-
import { cn as
|
|
709
|
+
import { cn as cn14 } from "@petrarca/sonnet-core";
|
|
629
710
|
|
|
630
711
|
// src/textarea.tsx
|
|
631
|
-
import * as
|
|
632
|
-
import { cn as
|
|
633
|
-
import { jsx as
|
|
634
|
-
var Textarea =
|
|
635
|
-
return /* @__PURE__ */
|
|
712
|
+
import * as React12 from "react";
|
|
713
|
+
import { cn as cn13 } from "@petrarca/sonnet-core";
|
|
714
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
715
|
+
var Textarea = React12.forwardRef(({ className, ...props }, ref) => {
|
|
716
|
+
return /* @__PURE__ */ jsx14(
|
|
636
717
|
"textarea",
|
|
637
718
|
{
|
|
638
|
-
className:
|
|
719
|
+
className: cn13(
|
|
639
720
|
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
640
721
|
className
|
|
641
722
|
),
|
|
@@ -647,14 +728,14 @@ var Textarea = React10.forwardRef(({ className, ...props }, ref) => {
|
|
|
647
728
|
Textarea.displayName = "Textarea";
|
|
648
729
|
|
|
649
730
|
// src/input-group.tsx
|
|
650
|
-
import { jsx as
|
|
731
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
651
732
|
function InputGroup({ className, ...props }) {
|
|
652
|
-
return /* @__PURE__ */
|
|
733
|
+
return /* @__PURE__ */ jsx15(
|
|
653
734
|
"div",
|
|
654
735
|
{
|
|
655
736
|
"data-slot": "input-group",
|
|
656
737
|
role: "group",
|
|
657
|
-
className:
|
|
738
|
+
className: cn14(
|
|
658
739
|
"group/input-group border-input dark:bg-input/30 shadow-xs relative flex w-full items-center rounded-md border outline-none transition-[color,box-shadow]",
|
|
659
740
|
"h-9 has-[>textarea]:h-auto",
|
|
660
741
|
// Variants based on alignment.
|
|
@@ -693,13 +774,13 @@ function InputGroupAddon({
|
|
|
693
774
|
align = "inline-start",
|
|
694
775
|
...props
|
|
695
776
|
}) {
|
|
696
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ jsx15(
|
|
697
778
|
"div",
|
|
698
779
|
{
|
|
699
780
|
role: "group",
|
|
700
781
|
"data-slot": "input-group-addon",
|
|
701
782
|
"data-align": align,
|
|
702
|
-
className:
|
|
783
|
+
className: cn14(inputGroupAddonVariants({ align }), className),
|
|
703
784
|
onClick: (e) => {
|
|
704
785
|
if (e.target.closest("button")) {
|
|
705
786
|
return;
|
|
@@ -733,22 +814,22 @@ function InputGroupButton({
|
|
|
733
814
|
size = "xs",
|
|
734
815
|
...props
|
|
735
816
|
}) {
|
|
736
|
-
return /* @__PURE__ */
|
|
817
|
+
return /* @__PURE__ */ jsx15(
|
|
737
818
|
Button,
|
|
738
819
|
{
|
|
739
820
|
type,
|
|
740
821
|
"data-size": size,
|
|
741
822
|
variant,
|
|
742
|
-
className:
|
|
823
|
+
className: cn14(inputGroupButtonVariants({ size }), className),
|
|
743
824
|
...props
|
|
744
825
|
}
|
|
745
826
|
);
|
|
746
827
|
}
|
|
747
828
|
function InputGroupText({ className, ...props }) {
|
|
748
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ jsx15(
|
|
749
830
|
"span",
|
|
750
831
|
{
|
|
751
|
-
className:
|
|
832
|
+
className: cn14(
|
|
752
833
|
"text-muted-foreground flex items-center gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",
|
|
753
834
|
className
|
|
754
835
|
),
|
|
@@ -760,11 +841,11 @@ function InputGroupInput({
|
|
|
760
841
|
className,
|
|
761
842
|
...props
|
|
762
843
|
}) {
|
|
763
|
-
return /* @__PURE__ */
|
|
844
|
+
return /* @__PURE__ */ jsx15(
|
|
764
845
|
Input,
|
|
765
846
|
{
|
|
766
847
|
"data-slot": "input-group-control",
|
|
767
|
-
className:
|
|
848
|
+
className: cn14(
|
|
768
849
|
"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
769
850
|
className
|
|
770
851
|
),
|
|
@@ -776,11 +857,11 @@ function InputGroupTextarea({
|
|
|
776
857
|
className,
|
|
777
858
|
...props
|
|
778
859
|
}) {
|
|
779
|
-
return /* @__PURE__ */
|
|
860
|
+
return /* @__PURE__ */ jsx15(
|
|
780
861
|
Textarea,
|
|
781
862
|
{
|
|
782
863
|
"data-slot": "input-group-control",
|
|
783
|
-
className:
|
|
864
|
+
className: cn14(
|
|
784
865
|
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
785
866
|
className
|
|
786
867
|
),
|
|
@@ -790,38 +871,38 @@ function InputGroupTextarea({
|
|
|
790
871
|
}
|
|
791
872
|
|
|
792
873
|
// src/label.tsx
|
|
793
|
-
import * as
|
|
874
|
+
import * as React13 from "react";
|
|
794
875
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
795
876
|
import { cva as cva5 } from "class-variance-authority";
|
|
796
|
-
import { cn as
|
|
797
|
-
import { jsx as
|
|
877
|
+
import { cn as cn15 } from "@petrarca/sonnet-core";
|
|
878
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
798
879
|
var labelVariants = cva5(
|
|
799
880
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
800
881
|
);
|
|
801
|
-
var Label2 =
|
|
882
|
+
var Label2 = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx16(
|
|
802
883
|
LabelPrimitive.Root,
|
|
803
884
|
{
|
|
804
885
|
ref,
|
|
805
|
-
className:
|
|
886
|
+
className: cn15(labelVariants(), className),
|
|
806
887
|
...props
|
|
807
888
|
}
|
|
808
889
|
));
|
|
809
890
|
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
810
891
|
|
|
811
892
|
// src/popover.tsx
|
|
812
|
-
import * as
|
|
893
|
+
import * as React14 from "react";
|
|
813
894
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
814
|
-
import { cn as
|
|
815
|
-
import { jsx as
|
|
895
|
+
import { cn as cn16 } from "@petrarca/sonnet-core";
|
|
896
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
816
897
|
var Popover = PopoverPrimitive.Root;
|
|
817
898
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
818
|
-
var PopoverContent =
|
|
899
|
+
var PopoverContent = React14.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx17(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx17(
|
|
819
900
|
PopoverPrimitive.Content,
|
|
820
901
|
{
|
|
821
902
|
ref,
|
|
822
903
|
align,
|
|
823
904
|
sideOffset,
|
|
824
|
-
className:
|
|
905
|
+
className: cn16(
|
|
825
906
|
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",
|
|
826
907
|
className
|
|
827
908
|
),
|
|
@@ -831,54 +912,54 @@ var PopoverContent = React12.forwardRef(({ className, align = "center", sideOffs
|
|
|
831
912
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
832
913
|
|
|
833
914
|
// src/scroll-area.tsx
|
|
834
|
-
import * as
|
|
915
|
+
import * as React15 from "react";
|
|
835
916
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
836
|
-
import { cn as
|
|
837
|
-
import { jsx as
|
|
838
|
-
var ScrollArea =
|
|
917
|
+
import { cn as cn17 } from "@petrarca/sonnet-core";
|
|
918
|
+
import { jsx as jsx18, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
919
|
+
var ScrollArea = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs5(
|
|
839
920
|
ScrollAreaPrimitive.Root,
|
|
840
921
|
{
|
|
841
922
|
ref,
|
|
842
|
-
className:
|
|
923
|
+
className: cn17("relative overflow-hidden", className),
|
|
843
924
|
...props,
|
|
844
925
|
children: [
|
|
845
|
-
/* @__PURE__ */
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
/* @__PURE__ */
|
|
926
|
+
/* @__PURE__ */ jsx18(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
927
|
+
/* @__PURE__ */ jsx18(ScrollBar, {}),
|
|
928
|
+
/* @__PURE__ */ jsx18(ScrollAreaPrimitive.Corner, {})
|
|
848
929
|
]
|
|
849
930
|
}
|
|
850
931
|
));
|
|
851
932
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
852
|
-
var ScrollBar =
|
|
933
|
+
var ScrollBar = React15.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx18(
|
|
853
934
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
854
935
|
{
|
|
855
936
|
ref,
|
|
856
937
|
orientation,
|
|
857
|
-
className:
|
|
938
|
+
className: cn17(
|
|
858
939
|
"flex touch-none select-none transition-colors",
|
|
859
940
|
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
860
941
|
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
861
942
|
className
|
|
862
943
|
),
|
|
863
944
|
...props,
|
|
864
|
-
children: /* @__PURE__ */
|
|
945
|
+
children: /* @__PURE__ */ jsx18(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
865
946
|
}
|
|
866
947
|
));
|
|
867
948
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
868
949
|
|
|
869
950
|
// src/separator.tsx
|
|
870
|
-
import * as
|
|
951
|
+
import * as React16 from "react";
|
|
871
952
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
872
|
-
import { cn as
|
|
873
|
-
import { jsx as
|
|
874
|
-
var Separator2 =
|
|
875
|
-
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */
|
|
953
|
+
import { cn as cn18 } from "@petrarca/sonnet-core";
|
|
954
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
955
|
+
var Separator2 = React16.forwardRef(
|
|
956
|
+
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx19(
|
|
876
957
|
SeparatorPrimitive.Root,
|
|
877
958
|
{
|
|
878
959
|
ref,
|
|
879
960
|
decorative,
|
|
880
961
|
orientation,
|
|
881
|
-
className:
|
|
962
|
+
className: cn18(
|
|
882
963
|
"shrink-0 bg-border",
|
|
883
964
|
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
884
965
|
className
|
|
@@ -890,19 +971,19 @@ var Separator2 = React14.forwardRef(
|
|
|
890
971
|
Separator2.displayName = SeparatorPrimitive.Root.displayName;
|
|
891
972
|
|
|
892
973
|
// src/resize-handle.tsx
|
|
893
|
-
import * as
|
|
894
|
-
import { cn as
|
|
895
|
-
import { jsx as
|
|
896
|
-
var ResizeHandle =
|
|
974
|
+
import * as React17 from "react";
|
|
975
|
+
import { cn as cn19 } from "@petrarca/sonnet-core";
|
|
976
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
977
|
+
var ResizeHandle = React17.forwardRef(
|
|
897
978
|
({ orientation = "vertical", gripLength = 48, className, style, ...props }, ref) => {
|
|
898
979
|
const isVertical = orientation === "vertical";
|
|
899
|
-
return /* @__PURE__ */
|
|
980
|
+
return /* @__PURE__ */ jsx20(
|
|
900
981
|
"div",
|
|
901
982
|
{
|
|
902
983
|
ref,
|
|
903
984
|
role: "separator",
|
|
904
985
|
"aria-orientation": orientation,
|
|
905
|
-
className:
|
|
986
|
+
className: cn19(
|
|
906
987
|
"group relative flex shrink-0 select-none touch-none items-center justify-center rounded-sm",
|
|
907
988
|
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
908
989
|
isVertical ? "mx-1 w-2 cursor-col-resize" : "my-1 h-2 cursor-row-resize",
|
|
@@ -910,7 +991,7 @@ var ResizeHandle = React15.forwardRef(
|
|
|
910
991
|
),
|
|
911
992
|
style,
|
|
912
993
|
...props,
|
|
913
|
-
children: /* @__PURE__ */
|
|
994
|
+
children: /* @__PURE__ */ jsx20(
|
|
914
995
|
"div",
|
|
915
996
|
{
|
|
916
997
|
className: "pointer-events-none absolute rounded-full bg-border transition-colors group-hover:bg-border-strong",
|
|
@@ -924,20 +1005,20 @@ var ResizeHandle = React15.forwardRef(
|
|
|
924
1005
|
ResizeHandle.displayName = "ResizeHandle";
|
|
925
1006
|
|
|
926
1007
|
// src/sheet.tsx
|
|
927
|
-
import * as
|
|
1008
|
+
import * as React18 from "react";
|
|
928
1009
|
import * as DialogPrimitive2 from "@radix-ui/react-dialog";
|
|
929
1010
|
import { X as X2 } from "lucide-react";
|
|
930
|
-
import { cn as
|
|
931
|
-
import { jsx as
|
|
1011
|
+
import { cn as cn20 } from "@petrarca/sonnet-core";
|
|
1012
|
+
import { jsx as jsx21, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
932
1013
|
var Sheet = DialogPrimitive2.Root;
|
|
933
1014
|
var SheetTrigger = DialogPrimitive2.Trigger;
|
|
934
1015
|
var SheetClose = DialogPrimitive2.Close;
|
|
935
1016
|
var SheetPortal = DialogPrimitive2.Portal;
|
|
936
|
-
var SheetOverlay =
|
|
1017
|
+
var SheetOverlay = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
937
1018
|
DialogPrimitive2.Overlay,
|
|
938
1019
|
{
|
|
939
1020
|
ref,
|
|
940
|
-
className:
|
|
1021
|
+
className: cn20(
|
|
941
1022
|
"fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
942
1023
|
className
|
|
943
1024
|
),
|
|
@@ -945,14 +1026,14 @@ var SheetOverlay = React16.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
945
1026
|
}
|
|
946
1027
|
));
|
|
947
1028
|
SheetOverlay.displayName = "SheetOverlay";
|
|
948
|
-
var SheetContent =
|
|
949
|
-
({ className, children, side = "right", offsetTop = "0px", style, ...props }, ref) => /* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
/* @__PURE__ */
|
|
1029
|
+
var SheetContent = React18.forwardRef(
|
|
1030
|
+
({ className, children, side = "right", offsetTop = "0px", style, ...props }, ref) => /* @__PURE__ */ jsxs6(SheetPortal, { children: [
|
|
1031
|
+
/* @__PURE__ */ jsx21(SheetOverlay, {}),
|
|
1032
|
+
/* @__PURE__ */ jsxs6(
|
|
952
1033
|
DialogPrimitive2.Content,
|
|
953
1034
|
{
|
|
954
1035
|
ref,
|
|
955
|
-
className:
|
|
1036
|
+
className: cn20(
|
|
956
1037
|
"fixed z-50 flex flex-col bg-background shadow-xl transition-transform duration-300 ease-in-out",
|
|
957
1038
|
"bottom-0 w-[480px] max-w-[90vw] border-l",
|
|
958
1039
|
side === "right" && "right-0 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",
|
|
@@ -963,9 +1044,9 @@ var SheetContent = React16.forwardRef(
|
|
|
963
1044
|
...props,
|
|
964
1045
|
children: [
|
|
965
1046
|
children,
|
|
966
|
-
/* @__PURE__ */
|
|
967
|
-
/* @__PURE__ */
|
|
968
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ jsxs6(DialogPrimitive2.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", children: [
|
|
1048
|
+
/* @__PURE__ */ jsx21(X2, { className: "h-4 w-4" }),
|
|
1049
|
+
/* @__PURE__ */ jsx21("span", { className: "sr-only", children: "Close" })
|
|
969
1050
|
] })
|
|
970
1051
|
]
|
|
971
1052
|
}
|
|
@@ -976,21 +1057,21 @@ SheetContent.displayName = "SheetContent";
|
|
|
976
1057
|
var SheetHeader = ({
|
|
977
1058
|
className,
|
|
978
1059
|
...props
|
|
979
|
-
}) => /* @__PURE__ */
|
|
980
|
-
var SheetTitle =
|
|
1060
|
+
}) => /* @__PURE__ */ jsx21("div", { className: cn20("shrink-0 border-b px-6 py-4", className), ...props });
|
|
1061
|
+
var SheetTitle = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
981
1062
|
DialogPrimitive2.Title,
|
|
982
1063
|
{
|
|
983
1064
|
ref,
|
|
984
|
-
className:
|
|
1065
|
+
className: cn20("text-lg font-semibold", className),
|
|
985
1066
|
...props
|
|
986
1067
|
}
|
|
987
1068
|
));
|
|
988
1069
|
SheetTitle.displayName = "SheetTitle";
|
|
989
|
-
var SheetDescription =
|
|
1070
|
+
var SheetDescription = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
990
1071
|
DialogPrimitive2.Description,
|
|
991
1072
|
{
|
|
992
1073
|
ref,
|
|
993
|
-
className:
|
|
1074
|
+
className: cn20("text-sm text-muted-foreground mt-1", className),
|
|
994
1075
|
...props
|
|
995
1076
|
}
|
|
996
1077
|
));
|
|
@@ -998,20 +1079,20 @@ SheetDescription.displayName = "SheetDescription";
|
|
|
998
1079
|
var SheetBody = ({
|
|
999
1080
|
className,
|
|
1000
1081
|
...props
|
|
1001
|
-
}) => /* @__PURE__ */
|
|
1082
|
+
}) => /* @__PURE__ */ jsx21(
|
|
1002
1083
|
"div",
|
|
1003
1084
|
{
|
|
1004
|
-
className:
|
|
1085
|
+
className: cn20("flex-1 overflow-y-auto px-6 py-4", className),
|
|
1005
1086
|
...props
|
|
1006
1087
|
}
|
|
1007
1088
|
);
|
|
1008
1089
|
var SheetFooter = ({
|
|
1009
1090
|
className,
|
|
1010
1091
|
...props
|
|
1011
|
-
}) => /* @__PURE__ */
|
|
1092
|
+
}) => /* @__PURE__ */ jsx21(
|
|
1012
1093
|
"div",
|
|
1013
1094
|
{
|
|
1014
|
-
className:
|
|
1095
|
+
className: cn20(
|
|
1015
1096
|
"shrink-0 border-t px-6 py-4 flex justify-end gap-2",
|
|
1016
1097
|
className
|
|
1017
1098
|
),
|
|
@@ -1020,8 +1101,8 @@ var SheetFooter = ({
|
|
|
1020
1101
|
);
|
|
1021
1102
|
|
|
1022
1103
|
// src/simple-group.tsx
|
|
1023
|
-
import { cn as
|
|
1024
|
-
import { jsx as
|
|
1104
|
+
import { cn as cn21 } from "@petrarca/sonnet-core";
|
|
1105
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1025
1106
|
var gapMap = {
|
|
1026
1107
|
0: "gap-0",
|
|
1027
1108
|
xs: "gap-1",
|
|
@@ -1083,10 +1164,10 @@ function SimpleGroup({
|
|
|
1083
1164
|
const wrapClass = wrap ? wrapMap[wrap] : void 0;
|
|
1084
1165
|
const growClass = grow ? "[&>*]:flex-1" : void 0;
|
|
1085
1166
|
const mtClass = mt ? mtMap[mt] : void 0;
|
|
1086
|
-
return /* @__PURE__ */
|
|
1167
|
+
return /* @__PURE__ */ jsx22(
|
|
1087
1168
|
"div",
|
|
1088
1169
|
{
|
|
1089
|
-
className:
|
|
1170
|
+
className: cn21(
|
|
1090
1171
|
"flex flex-row",
|
|
1091
1172
|
gapClass,
|
|
1092
1173
|
alignClass,
|
|
@@ -1104,8 +1185,8 @@ function SimpleGroup({
|
|
|
1104
1185
|
}
|
|
1105
1186
|
|
|
1106
1187
|
// src/simple-stack.tsx
|
|
1107
|
-
import { cn as
|
|
1108
|
-
import { jsx as
|
|
1188
|
+
import { cn as cn22 } from "@petrarca/sonnet-core";
|
|
1189
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1109
1190
|
var gapMap2 = {
|
|
1110
1191
|
0: "gap-0",
|
|
1111
1192
|
xs: "gap-1",
|
|
@@ -1145,10 +1226,10 @@ function SimpleStack({
|
|
|
1145
1226
|
const alignClass = align ? alignMap2[align] : void 0;
|
|
1146
1227
|
const justifyClass = justify ? justifyMap2[justify] : void 0;
|
|
1147
1228
|
const heightStyle = h !== void 0 ? { height: typeof h === "number" ? `${h}px` : h } : void 0;
|
|
1148
|
-
return /* @__PURE__ */
|
|
1229
|
+
return /* @__PURE__ */ jsx23(
|
|
1149
1230
|
"div",
|
|
1150
1231
|
{
|
|
1151
|
-
className:
|
|
1232
|
+
className: cn22(
|
|
1152
1233
|
"flex flex-col",
|
|
1153
1234
|
gapClass,
|
|
1154
1235
|
alignClass,
|
|
@@ -1161,96 +1242,58 @@ function SimpleStack({
|
|
|
1161
1242
|
);
|
|
1162
1243
|
}
|
|
1163
1244
|
|
|
1164
|
-
// src/tooltip.tsx
|
|
1165
|
-
import * as React17 from "react";
|
|
1166
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
1167
|
-
import { cn as cn21 } from "@petrarca/sonnet-core";
|
|
1168
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1169
|
-
var TooltipProvider = TooltipPrimitive.Provider;
|
|
1170
|
-
var Tooltip = TooltipPrimitive.Root;
|
|
1171
|
-
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1172
|
-
var TooltipContent = React17.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
1173
|
-
TooltipPrimitive.Content,
|
|
1174
|
-
{
|
|
1175
|
-
ref,
|
|
1176
|
-
sideOffset,
|
|
1177
|
-
className: cn21(
|
|
1178
|
-
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
|
1179
|
-
className
|
|
1180
|
-
),
|
|
1181
|
-
...props
|
|
1182
|
-
}
|
|
1183
|
-
));
|
|
1184
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
1185
|
-
|
|
1186
|
-
// src/simple-tooltip.tsx
|
|
1187
|
-
import { jsx as jsx22, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1188
|
-
function SimpleTooltip({
|
|
1189
|
-
label,
|
|
1190
|
-
children,
|
|
1191
|
-
side,
|
|
1192
|
-
align,
|
|
1193
|
-
delayDuration = 700,
|
|
1194
|
-
sideOffset
|
|
1195
|
-
}) {
|
|
1196
|
-
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration, children: /* @__PURE__ */ jsxs6(Tooltip, { children: [
|
|
1197
|
-
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children }),
|
|
1198
|
-
/* @__PURE__ */ jsx22(TooltipContent, { side, align, sideOffset, children: label })
|
|
1199
|
-
] }) });
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
1245
|
// src/skeleton.tsx
|
|
1203
|
-
import { cn as
|
|
1204
|
-
import { jsx as
|
|
1246
|
+
import { cn as cn23 } from "@petrarca/sonnet-core";
|
|
1247
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1205
1248
|
function Skeleton({
|
|
1206
1249
|
className,
|
|
1207
1250
|
...props
|
|
1208
1251
|
}) {
|
|
1209
|
-
return /* @__PURE__ */
|
|
1252
|
+
return /* @__PURE__ */ jsx24(
|
|
1210
1253
|
"div",
|
|
1211
1254
|
{
|
|
1212
|
-
className:
|
|
1255
|
+
className: cn23("animate-pulse rounded-md bg-muted", className),
|
|
1213
1256
|
...props
|
|
1214
1257
|
}
|
|
1215
1258
|
);
|
|
1216
1259
|
}
|
|
1217
1260
|
|
|
1218
1261
|
// src/spinner.tsx
|
|
1219
|
-
import { cn as
|
|
1220
|
-
import { jsx as
|
|
1262
|
+
import { cn as cn24 } from "@petrarca/sonnet-core";
|
|
1263
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1221
1264
|
var sizeClasses = {
|
|
1222
1265
|
sm: "h-4 w-4 border-2",
|
|
1223
1266
|
md: "h-8 w-8 border-2",
|
|
1224
1267
|
lg: "h-12 w-12 border-3"
|
|
1225
1268
|
};
|
|
1226
1269
|
function Spinner({ className, size = "md" }) {
|
|
1227
|
-
return /* @__PURE__ */
|
|
1270
|
+
return /* @__PURE__ */ jsx25(
|
|
1228
1271
|
"div",
|
|
1229
1272
|
{
|
|
1230
|
-
className:
|
|
1273
|
+
className: cn24(
|
|
1231
1274
|
"inline-block animate-spin rounded-full border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",
|
|
1232
1275
|
sizeClasses[size],
|
|
1233
1276
|
className
|
|
1234
1277
|
),
|
|
1235
1278
|
role: "status",
|
|
1236
|
-
children: /* @__PURE__ */
|
|
1279
|
+
children: /* @__PURE__ */ jsx25("span", { className: "!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]", children: "Loading..." })
|
|
1237
1280
|
}
|
|
1238
1281
|
);
|
|
1239
1282
|
}
|
|
1240
1283
|
|
|
1241
1284
|
// src/tabs.tsx
|
|
1242
|
-
import * as
|
|
1285
|
+
import * as React19 from "react";
|
|
1243
1286
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
1244
|
-
import { cn as
|
|
1245
|
-
import { jsx as
|
|
1287
|
+
import { cn as cn25 } from "@petrarca/sonnet-core";
|
|
1288
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1246
1289
|
var Tabs = TabsPrimitive.Root;
|
|
1247
|
-
var TabsList =
|
|
1290
|
+
var TabsList = React19.forwardRef(({ className, align = "start", ...props }, ref) => {
|
|
1248
1291
|
const alignClass = align === "center" ? "justify-center" : align === "end" ? "justify-end" : "justify-start";
|
|
1249
|
-
return /* @__PURE__ */
|
|
1292
|
+
return /* @__PURE__ */ jsx26(
|
|
1250
1293
|
TabsPrimitive.List,
|
|
1251
1294
|
{
|
|
1252
1295
|
ref,
|
|
1253
|
-
className:
|
|
1296
|
+
className: cn25(
|
|
1254
1297
|
"inline-flex h-10 items-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
1255
1298
|
alignClass,
|
|
1256
1299
|
className
|
|
@@ -1260,11 +1303,11 @@ var TabsList = React18.forwardRef(({ className, align = "start", ...props }, ref
|
|
|
1260
1303
|
);
|
|
1261
1304
|
});
|
|
1262
1305
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
1263
|
-
var TabsTrigger =
|
|
1306
|
+
var TabsTrigger = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
1264
1307
|
TabsPrimitive.Trigger,
|
|
1265
1308
|
{
|
|
1266
1309
|
ref,
|
|
1267
|
-
className:
|
|
1310
|
+
className: cn25(
|
|
1268
1311
|
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
1269
1312
|
className
|
|
1270
1313
|
),
|
|
@@ -1272,11 +1315,11 @@ var TabsTrigger = React18.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
1272
1315
|
}
|
|
1273
1316
|
));
|
|
1274
1317
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
1275
|
-
var TabsContent =
|
|
1318
|
+
var TabsContent = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
1276
1319
|
TabsPrimitive.Content,
|
|
1277
1320
|
{
|
|
1278
1321
|
ref,
|
|
1279
|
-
className:
|
|
1322
|
+
className: cn25(
|
|
1280
1323
|
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
1281
1324
|
"data-[state=inactive]:hidden",
|
|
1282
1325
|
className
|
|
@@ -1285,6 +1328,20 @@ var TabsContent = React18.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
1285
1328
|
}
|
|
1286
1329
|
));
|
|
1287
1330
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
1331
|
+
var TabsSeparator = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
1332
|
+
"div",
|
|
1333
|
+
{
|
|
1334
|
+
ref,
|
|
1335
|
+
role: "separator",
|
|
1336
|
+
"aria-orientation": "vertical",
|
|
1337
|
+
className: cn25(
|
|
1338
|
+
"mx-2 h-6 w-0.5 shrink-0 rounded-full bg-muted-foreground/40",
|
|
1339
|
+
className
|
|
1340
|
+
),
|
|
1341
|
+
...props
|
|
1342
|
+
}
|
|
1343
|
+
));
|
|
1344
|
+
TabsSeparator.displayName = "TabsSeparator";
|
|
1288
1345
|
|
|
1289
1346
|
// src/stepper.tsx
|
|
1290
1347
|
import { Check as Check3 } from "lucide-react";
|
|
@@ -1292,20 +1349,20 @@ import {
|
|
|
1292
1349
|
Direction as DirectionPrimitive,
|
|
1293
1350
|
Slot as SlotPrimitive
|
|
1294
1351
|
} from "radix-ui";
|
|
1295
|
-
import * as
|
|
1352
|
+
import * as React23 from "react";
|
|
1296
1353
|
import { useComposedRefs } from "@petrarca/sonnet-core";
|
|
1297
|
-
import { cn as
|
|
1354
|
+
import { cn as cn26 } from "@petrarca/sonnet-core";
|
|
1298
1355
|
|
|
1299
1356
|
// src/radix/hooks/use-as-ref.ts
|
|
1300
|
-
import * as
|
|
1357
|
+
import * as React21 from "react";
|
|
1301
1358
|
|
|
1302
1359
|
// src/radix/hooks/use-isomorphic-layout-effect.ts
|
|
1303
|
-
import * as
|
|
1304
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
1360
|
+
import * as React20 from "react";
|
|
1361
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React20.useLayoutEffect : React20.useEffect;
|
|
1305
1362
|
|
|
1306
1363
|
// src/radix/hooks/use-as-ref.ts
|
|
1307
1364
|
function useAsRef(props) {
|
|
1308
|
-
const ref =
|
|
1365
|
+
const ref = React21.useRef(props);
|
|
1309
1366
|
useIsomorphicLayoutEffect(() => {
|
|
1310
1367
|
ref.current = props;
|
|
1311
1368
|
});
|
|
@@ -1313,9 +1370,9 @@ function useAsRef(props) {
|
|
|
1313
1370
|
}
|
|
1314
1371
|
|
|
1315
1372
|
// src/radix/hooks/use-lazy-ref.ts
|
|
1316
|
-
import * as
|
|
1373
|
+
import * as React22 from "react";
|
|
1317
1374
|
function useLazyRef(fn) {
|
|
1318
|
-
const ref =
|
|
1375
|
+
const ref = React22.useRef(null);
|
|
1319
1376
|
if (ref.current === null) {
|
|
1320
1377
|
ref.current = fn();
|
|
1321
1378
|
}
|
|
@@ -1323,7 +1380,7 @@ function useLazyRef(fn) {
|
|
|
1323
1380
|
}
|
|
1324
1381
|
|
|
1325
1382
|
// src/stepper.tsx
|
|
1326
|
-
import { jsx as
|
|
1383
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1327
1384
|
var ROOT_NAME = "Stepper";
|
|
1328
1385
|
var LIST_NAME = "StepperList";
|
|
1329
1386
|
var ITEM_NAME = "StepperItem";
|
|
@@ -1442,9 +1499,9 @@ function getDataState(value, itemValue, stepState, steps, variant = "item") {
|
|
|
1442
1499
|
}
|
|
1443
1500
|
return "inactive";
|
|
1444
1501
|
}
|
|
1445
|
-
var StoreContext =
|
|
1502
|
+
var StoreContext = React23.createContext(null);
|
|
1446
1503
|
function useStoreContext(consumerName) {
|
|
1447
|
-
const context =
|
|
1504
|
+
const context = React23.useContext(StoreContext);
|
|
1448
1505
|
if (!context) {
|
|
1449
1506
|
throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);
|
|
1450
1507
|
}
|
|
@@ -1452,15 +1509,15 @@ function useStoreContext(consumerName) {
|
|
|
1452
1509
|
}
|
|
1453
1510
|
function useStore(selector) {
|
|
1454
1511
|
const store = useStoreContext("useStore");
|
|
1455
|
-
const getSnapshot =
|
|
1512
|
+
const getSnapshot = React23.useCallback(
|
|
1456
1513
|
() => selector(store.getState()),
|
|
1457
1514
|
[store, selector]
|
|
1458
1515
|
);
|
|
1459
|
-
return
|
|
1516
|
+
return React23.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
1460
1517
|
}
|
|
1461
|
-
var StepperContext =
|
|
1518
|
+
var StepperContext = React23.createContext(null);
|
|
1462
1519
|
function useStepperContext(consumerName) {
|
|
1463
|
-
const context =
|
|
1520
|
+
const context = React23.useContext(StepperContext);
|
|
1464
1521
|
if (!context) {
|
|
1465
1522
|
throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);
|
|
1466
1523
|
}
|
|
@@ -1498,7 +1555,7 @@ function Stepper(props) {
|
|
|
1498
1555
|
onValueRemove,
|
|
1499
1556
|
onValidate
|
|
1500
1557
|
});
|
|
1501
|
-
const store =
|
|
1558
|
+
const store = React23.useMemo(() => {
|
|
1502
1559
|
return {
|
|
1503
1560
|
subscribe: (cb) => {
|
|
1504
1561
|
listenersRef.current.add(cb);
|
|
@@ -1572,9 +1629,9 @@ function Stepper(props) {
|
|
|
1572
1629
|
}
|
|
1573
1630
|
}, [value]);
|
|
1574
1631
|
const dir = DirectionPrimitive.useDirection(dirProp);
|
|
1575
|
-
const instanceId =
|
|
1632
|
+
const instanceId = React23.useId();
|
|
1576
1633
|
const rootId = id ?? instanceId;
|
|
1577
|
-
const contextValue =
|
|
1634
|
+
const contextValue = React23.useMemo(
|
|
1578
1635
|
() => ({
|
|
1579
1636
|
rootId,
|
|
1580
1637
|
dir,
|
|
@@ -1587,7 +1644,7 @@ function Stepper(props) {
|
|
|
1587
1644
|
[rootId, dir, orientation, activationMode, disabled, nonInteractive, loop]
|
|
1588
1645
|
);
|
|
1589
1646
|
const RootPrimitive = asChild ? SlotPrimitive.Slot : "div";
|
|
1590
|
-
return /* @__PURE__ */
|
|
1647
|
+
return /* @__PURE__ */ jsx27(StoreContext.Provider, { value: store, children: /* @__PURE__ */ jsx27(StepperContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx27(
|
|
1591
1648
|
RootPrimitive,
|
|
1592
1649
|
{
|
|
1593
1650
|
id: rootId,
|
|
@@ -1596,7 +1653,7 @@ function Stepper(props) {
|
|
|
1596
1653
|
"data-slot": "stepper",
|
|
1597
1654
|
dir,
|
|
1598
1655
|
...rootProps,
|
|
1599
|
-
className:
|
|
1656
|
+
className: cn26(
|
|
1600
1657
|
"flex gap-3",
|
|
1601
1658
|
orientation === "horizontal" ? "w-full flex-col" : "flex-row",
|
|
1602
1659
|
className
|
|
@@ -1604,9 +1661,9 @@ function Stepper(props) {
|
|
|
1604
1661
|
}
|
|
1605
1662
|
) }) });
|
|
1606
1663
|
}
|
|
1607
|
-
var FocusContext =
|
|
1664
|
+
var FocusContext = React23.createContext(null);
|
|
1608
1665
|
function useFocusContext(consumerName) {
|
|
1609
|
-
const context =
|
|
1666
|
+
const context = React23.useContext(FocusContext);
|
|
1610
1667
|
if (!context) {
|
|
1611
1668
|
throw new Error(
|
|
1612
1669
|
`\`${consumerName}\` must be used within \`FocusProvider\``
|
|
@@ -1633,32 +1690,32 @@ function StepperList(props) {
|
|
|
1633
1690
|
onFocus: onFocusProp,
|
|
1634
1691
|
onMouseDown: onMouseDownProp
|
|
1635
1692
|
});
|
|
1636
|
-
const [tabStopId, setTabStopId] =
|
|
1637
|
-
const [isTabbingBackOut, setIsTabbingBackOut] =
|
|
1638
|
-
const [focusableItemCount, setFocusableItemCount] =
|
|
1639
|
-
const isClickFocusRef =
|
|
1640
|
-
const itemsRef =
|
|
1641
|
-
const listRef =
|
|
1693
|
+
const [tabStopId, setTabStopId] = React23.useState(null);
|
|
1694
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React23.useState(false);
|
|
1695
|
+
const [focusableItemCount, setFocusableItemCount] = React23.useState(0);
|
|
1696
|
+
const isClickFocusRef = React23.useRef(false);
|
|
1697
|
+
const itemsRef = React23.useRef(/* @__PURE__ */ new Map());
|
|
1698
|
+
const listRef = React23.useRef(null);
|
|
1642
1699
|
const composedRef = useComposedRefs(ref, listRef);
|
|
1643
|
-
const onItemFocus =
|
|
1700
|
+
const onItemFocus = React23.useCallback((tabStopId2) => {
|
|
1644
1701
|
setTabStopId(tabStopId2);
|
|
1645
1702
|
}, []);
|
|
1646
|
-
const onItemShiftTab =
|
|
1703
|
+
const onItemShiftTab = React23.useCallback(() => {
|
|
1647
1704
|
setIsTabbingBackOut(true);
|
|
1648
1705
|
}, []);
|
|
1649
|
-
const onFocusableItemAdd =
|
|
1706
|
+
const onFocusableItemAdd = React23.useCallback(() => {
|
|
1650
1707
|
setFocusableItemCount((prevCount) => prevCount + 1);
|
|
1651
1708
|
}, []);
|
|
1652
|
-
const onFocusableItemRemove =
|
|
1709
|
+
const onFocusableItemRemove = React23.useCallback(() => {
|
|
1653
1710
|
setFocusableItemCount((prevCount) => prevCount - 1);
|
|
1654
1711
|
}, []);
|
|
1655
|
-
const onItemRegister =
|
|
1712
|
+
const onItemRegister = React23.useCallback((item) => {
|
|
1656
1713
|
itemsRef.current.set(item.id, item);
|
|
1657
1714
|
}, []);
|
|
1658
|
-
const onItemUnregister =
|
|
1715
|
+
const onItemUnregister = React23.useCallback((id) => {
|
|
1659
1716
|
itemsRef.current.delete(id);
|
|
1660
1717
|
}, []);
|
|
1661
|
-
const getItems =
|
|
1718
|
+
const getItems = React23.useCallback(() => {
|
|
1662
1719
|
return Array.from(itemsRef.current.values()).filter((item) => item.ref.current).sort((a, b) => {
|
|
1663
1720
|
const elementA = a.ref.current;
|
|
1664
1721
|
const elementB = b.ref.current;
|
|
@@ -1673,7 +1730,7 @@ function StepperList(props) {
|
|
|
1673
1730
|
return 0;
|
|
1674
1731
|
});
|
|
1675
1732
|
}, []);
|
|
1676
|
-
const onBlur =
|
|
1733
|
+
const onBlur = React23.useCallback(
|
|
1677
1734
|
(event) => {
|
|
1678
1735
|
propsRef.current.onBlur?.(event);
|
|
1679
1736
|
if (event.defaultPrevented) return;
|
|
@@ -1681,7 +1738,7 @@ function StepperList(props) {
|
|
|
1681
1738
|
},
|
|
1682
1739
|
[propsRef]
|
|
1683
1740
|
);
|
|
1684
|
-
const onFocus =
|
|
1741
|
+
const onFocus = React23.useCallback(
|
|
1685
1742
|
(event) => {
|
|
1686
1743
|
propsRef.current.onFocus?.(event);
|
|
1687
1744
|
if (event.defaultPrevented) return;
|
|
@@ -1710,7 +1767,7 @@ function StepperList(props) {
|
|
|
1710
1767
|
},
|
|
1711
1768
|
[propsRef, isTabbingBackOut, currentValue, tabStopId]
|
|
1712
1769
|
);
|
|
1713
|
-
const onMouseDown =
|
|
1770
|
+
const onMouseDown = React23.useCallback(
|
|
1714
1771
|
(event) => {
|
|
1715
1772
|
propsRef.current.onMouseDown?.(event);
|
|
1716
1773
|
if (event.defaultPrevented) return;
|
|
@@ -1718,7 +1775,7 @@ function StepperList(props) {
|
|
|
1718
1775
|
},
|
|
1719
1776
|
[propsRef]
|
|
1720
1777
|
);
|
|
1721
|
-
const focusContextValue =
|
|
1778
|
+
const focusContextValue = React23.useMemo(
|
|
1722
1779
|
() => ({
|
|
1723
1780
|
tabStopId,
|
|
1724
1781
|
onItemFocus,
|
|
@@ -1741,7 +1798,7 @@ function StepperList(props) {
|
|
|
1741
1798
|
]
|
|
1742
1799
|
);
|
|
1743
1800
|
const ListPrimitive = asChild ? SlotPrimitive.Slot : "div";
|
|
1744
|
-
return /* @__PURE__ */
|
|
1801
|
+
return /* @__PURE__ */ jsx27(FocusContext.Provider, { value: focusContextValue, children: /* @__PURE__ */ jsx27(
|
|
1745
1802
|
ListPrimitive,
|
|
1746
1803
|
{
|
|
1747
1804
|
role: "tablist",
|
|
@@ -1752,7 +1809,7 @@ function StepperList(props) {
|
|
|
1752
1809
|
tabIndex: isTabbingBackOut || focusableItemCount === 0 ? -1 : 0,
|
|
1753
1810
|
...listProps,
|
|
1754
1811
|
ref: composedRef,
|
|
1755
|
-
className:
|
|
1812
|
+
className: cn26(
|
|
1756
1813
|
"flex outline-none",
|
|
1757
1814
|
orientation === "horizontal" ? "flex-row items-center" : "flex-col items-start",
|
|
1758
1815
|
className
|
|
@@ -1764,11 +1821,11 @@ function StepperList(props) {
|
|
|
1764
1821
|
}
|
|
1765
1822
|
) });
|
|
1766
1823
|
}
|
|
1767
|
-
var StepperItemContext =
|
|
1824
|
+
var StepperItemContext = React23.createContext(
|
|
1768
1825
|
null
|
|
1769
1826
|
);
|
|
1770
1827
|
function useStepperItemContext(consumerName) {
|
|
1771
|
-
const context =
|
|
1828
|
+
const context = React23.useContext(StepperItemContext);
|
|
1772
1829
|
if (!context) {
|
|
1773
1830
|
throw new Error(`\`${consumerName}\` must be used within \`${ITEM_NAME}\``);
|
|
1774
1831
|
}
|
|
@@ -1801,7 +1858,7 @@ function StepperItem(props) {
|
|
|
1801
1858
|
const stepState = useStore((state) => state.steps.get(itemValue));
|
|
1802
1859
|
const steps = useStore((state) => state.steps);
|
|
1803
1860
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
1804
|
-
const itemContextValue =
|
|
1861
|
+
const itemContextValue = React23.useMemo(
|
|
1805
1862
|
() => ({
|
|
1806
1863
|
value: itemValue,
|
|
1807
1864
|
stepState
|
|
@@ -1809,7 +1866,7 @@ function StepperItem(props) {
|
|
|
1809
1866
|
[itemValue, stepState]
|
|
1810
1867
|
);
|
|
1811
1868
|
const ItemPrimitive = asChild ? SlotPrimitive.Slot : "div";
|
|
1812
|
-
return /* @__PURE__ */
|
|
1869
|
+
return /* @__PURE__ */ jsx27(StepperItemContext.Provider, { value: itemContextValue, children: /* @__PURE__ */ jsx27(
|
|
1813
1870
|
ItemPrimitive,
|
|
1814
1871
|
{
|
|
1815
1872
|
"data-disabled": stepState?.disabled ? "" : void 0,
|
|
@@ -1819,7 +1876,7 @@ function StepperItem(props) {
|
|
|
1819
1876
|
dir: context.dir,
|
|
1820
1877
|
...itemProps,
|
|
1821
1878
|
ref,
|
|
1822
|
-
className:
|
|
1879
|
+
className: cn26(
|
|
1823
1880
|
"relative flex not-last:flex-1 items-center",
|
|
1824
1881
|
orientation === "horizontal" ? "flex-row" : "flex-col",
|
|
1825
1882
|
className
|
|
@@ -1868,11 +1925,11 @@ function StepperTrigger(props) {
|
|
|
1868
1925
|
const isActive = value === itemValue;
|
|
1869
1926
|
const isTabStop = focusContext.tabStopId === triggerId;
|
|
1870
1927
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
1871
|
-
const triggerRef =
|
|
1928
|
+
const triggerRef = React23.useRef(null);
|
|
1872
1929
|
const composedRef = useComposedRefs(ref, triggerRef);
|
|
1873
|
-
const isArrowKeyPressedRef =
|
|
1874
|
-
const isMouseClickRef =
|
|
1875
|
-
|
|
1930
|
+
const isArrowKeyPressedRef = React23.useRef(false);
|
|
1931
|
+
const isMouseClickRef = React23.useRef(false);
|
|
1932
|
+
React23.useEffect(() => {
|
|
1876
1933
|
function onKeyDown2(event) {
|
|
1877
1934
|
if (ARROW_KEYS.includes(event.key)) {
|
|
1878
1935
|
isArrowKeyPressedRef.current = true;
|
|
@@ -1906,7 +1963,7 @@ function StepperTrigger(props) {
|
|
|
1906
1963
|
}
|
|
1907
1964
|
};
|
|
1908
1965
|
}, [focusContext, triggerId, itemValue, isTabStop, isDisabled]);
|
|
1909
|
-
const onClick =
|
|
1966
|
+
const onClick = React23.useCallback(
|
|
1910
1967
|
async (event) => {
|
|
1911
1968
|
propsRef.current.onClick?.(event);
|
|
1912
1969
|
if (event.defaultPrevented) return;
|
|
@@ -1927,7 +1984,7 @@ function StepperTrigger(props) {
|
|
|
1927
1984
|
propsRef
|
|
1928
1985
|
]
|
|
1929
1986
|
);
|
|
1930
|
-
const onFocus =
|
|
1987
|
+
const onFocus = React23.useCallback(
|
|
1931
1988
|
async (event) => {
|
|
1932
1989
|
propsRef.current.onFocus?.(event);
|
|
1933
1990
|
if (event.defaultPrevented) return;
|
|
@@ -1955,7 +2012,7 @@ function StepperTrigger(props) {
|
|
|
1955
2012
|
propsRef
|
|
1956
2013
|
]
|
|
1957
2014
|
);
|
|
1958
|
-
const onKeyDown =
|
|
2015
|
+
const onKeyDown = React23.useCallback(
|
|
1959
2016
|
async (event) => {
|
|
1960
2017
|
propsRef.current.onKeyDown?.(event);
|
|
1961
2018
|
if (event.defaultPrevented) return;
|
|
@@ -2010,7 +2067,7 @@ function StepperTrigger(props) {
|
|
|
2010
2067
|
steps
|
|
2011
2068
|
]
|
|
2012
2069
|
);
|
|
2013
|
-
const onMouseDown =
|
|
2070
|
+
const onMouseDown = React23.useCallback(
|
|
2014
2071
|
(event) => {
|
|
2015
2072
|
propsRef.current.onMouseDown?.(event);
|
|
2016
2073
|
if (event.defaultPrevented) return;
|
|
@@ -2024,7 +2081,7 @@ function StepperTrigger(props) {
|
|
|
2024
2081
|
[focusContext, triggerId, isDisabled, propsRef]
|
|
2025
2082
|
);
|
|
2026
2083
|
const TriggerPrimitive = asChild ? SlotPrimitive.Slot : "button";
|
|
2027
|
-
return /* @__PURE__ */
|
|
2084
|
+
return /* @__PURE__ */ jsx27(
|
|
2028
2085
|
TriggerPrimitive,
|
|
2029
2086
|
{
|
|
2030
2087
|
id: triggerId,
|
|
@@ -2043,7 +2100,7 @@ function StepperTrigger(props) {
|
|
|
2043
2100
|
tabIndex: isTabStop ? 0 : -1,
|
|
2044
2101
|
...triggerProps,
|
|
2045
2102
|
ref: composedRef,
|
|
2046
|
-
className:
|
|
2103
|
+
className: cn26(
|
|
2047
2104
|
"inline-flex items-center justify-center gap-3 rounded-md text-left outline-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2048
2105
|
"not-has-data-[slot=description]:rounded-full not-has-data-[slot=title]:rounded-full",
|
|
2049
2106
|
className
|
|
@@ -2066,7 +2123,7 @@ function StepperIndicator(props) {
|
|
|
2066
2123
|
const stepPosition = Array.from(steps.keys()).indexOf(itemValue) + 1;
|
|
2067
2124
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
2068
2125
|
const IndicatorPrimitive = asChild ? SlotPrimitive.Slot : "div";
|
|
2069
|
-
return /* @__PURE__ */
|
|
2126
|
+
return /* @__PURE__ */ jsx27(
|
|
2070
2127
|
IndicatorPrimitive,
|
|
2071
2128
|
{
|
|
2072
2129
|
"data-state": dataState,
|
|
@@ -2074,11 +2131,11 @@ function StepperIndicator(props) {
|
|
|
2074
2131
|
dir: context.dir,
|
|
2075
2132
|
...indicatorProps,
|
|
2076
2133
|
ref,
|
|
2077
|
-
className:
|
|
2134
|
+
className: cn26(
|
|
2078
2135
|
"flex size-7 shrink-0 items-center justify-center rounded-full border-2 border-muted bg-background font-medium text-muted-foreground text-sm transition-colors data-[state=active]:border-primary data-[state=completed]:border-primary data-[state=active]:bg-primary data-[state=completed]:bg-primary data-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground",
|
|
2079
2136
|
className
|
|
2080
2137
|
),
|
|
2081
|
-
children: typeof children === "function" ? children(dataState) : children ? children : dataState === "completed" ? /* @__PURE__ */
|
|
2138
|
+
children: typeof children === "function" ? children(dataState) : children ? children : dataState === "completed" ? /* @__PURE__ */ jsx27(Check3, { className: "size-4" }) : stepPosition
|
|
2082
2139
|
}
|
|
2083
2140
|
);
|
|
2084
2141
|
}
|
|
@@ -2106,7 +2163,7 @@ function StepperSeparator(props) {
|
|
|
2106
2163
|
"separator"
|
|
2107
2164
|
);
|
|
2108
2165
|
const SeparatorPrimitive2 = asChild ? SlotPrimitive.Slot : "div";
|
|
2109
|
-
return /* @__PURE__ */
|
|
2166
|
+
return /* @__PURE__ */ jsx27(
|
|
2110
2167
|
SeparatorPrimitive2,
|
|
2111
2168
|
{
|
|
2112
2169
|
role: "separator",
|
|
@@ -2118,7 +2175,7 @@ function StepperSeparator(props) {
|
|
|
2118
2175
|
dir: context.dir,
|
|
2119
2176
|
...separatorProps,
|
|
2120
2177
|
ref,
|
|
2121
|
-
className:
|
|
2178
|
+
className: cn26(
|
|
2122
2179
|
"bg-border transition-colors data-[state=active]:bg-primary data-[state=completed]:bg-primary",
|
|
2123
2180
|
orientation === "horizontal" ? "h-px flex-1" : "h-10 w-px",
|
|
2124
2181
|
className
|
|
@@ -2132,7 +2189,7 @@ function StepperTitle(props) {
|
|
|
2132
2189
|
const itemContext = useStepperItemContext(TITLE_NAME);
|
|
2133
2190
|
const titleId = getId(context.rootId, "title", itemContext.value);
|
|
2134
2191
|
const TitlePrimitive = asChild ? SlotPrimitive.Slot : "span";
|
|
2135
|
-
return /* @__PURE__ */
|
|
2192
|
+
return /* @__PURE__ */ jsx27(
|
|
2136
2193
|
TitlePrimitive,
|
|
2137
2194
|
{
|
|
2138
2195
|
id: titleId,
|
|
@@ -2140,7 +2197,7 @@ function StepperTitle(props) {
|
|
|
2140
2197
|
dir: context.dir,
|
|
2141
2198
|
...titleProps,
|
|
2142
2199
|
ref,
|
|
2143
|
-
className:
|
|
2200
|
+
className: cn26("font-medium text-sm", className)
|
|
2144
2201
|
}
|
|
2145
2202
|
);
|
|
2146
2203
|
}
|
|
@@ -2150,7 +2207,7 @@ function StepperDescription(props) {
|
|
|
2150
2207
|
const itemContext = useStepperItemContext(DESCRIPTION_NAME);
|
|
2151
2208
|
const descriptionId = getId(context.rootId, "description", itemContext.value);
|
|
2152
2209
|
const DescriptionPrimitive = asChild ? SlotPrimitive.Slot : "span";
|
|
2153
|
-
return /* @__PURE__ */
|
|
2210
|
+
return /* @__PURE__ */ jsx27(
|
|
2154
2211
|
DescriptionPrimitive,
|
|
2155
2212
|
{
|
|
2156
2213
|
id: descriptionId,
|
|
@@ -2158,7 +2215,7 @@ function StepperDescription(props) {
|
|
|
2158
2215
|
dir: context.dir,
|
|
2159
2216
|
...descriptionProps,
|
|
2160
2217
|
ref,
|
|
2161
|
-
className:
|
|
2218
|
+
className: cn26("text-muted-foreground text-xs", className)
|
|
2162
2219
|
}
|
|
2163
2220
|
);
|
|
2164
2221
|
}
|
|
@@ -2177,7 +2234,7 @@ function StepperContent(props) {
|
|
|
2177
2234
|
const triggerId = getId(context.rootId, "trigger", valueProp);
|
|
2178
2235
|
if (valueProp !== value && !forceMount) return null;
|
|
2179
2236
|
const ContentPrimitive = asChild ? SlotPrimitive.Slot : "div";
|
|
2180
|
-
return /* @__PURE__ */
|
|
2237
|
+
return /* @__PURE__ */ jsx27(
|
|
2181
2238
|
ContentPrimitive,
|
|
2182
2239
|
{
|
|
2183
2240
|
id: contentId,
|
|
@@ -2187,7 +2244,7 @@ function StepperContent(props) {
|
|
|
2187
2244
|
dir: context.dir,
|
|
2188
2245
|
...contentProps,
|
|
2189
2246
|
ref,
|
|
2190
|
-
className:
|
|
2247
|
+
className: cn26("flex-1 outline-none", className)
|
|
2191
2248
|
}
|
|
2192
2249
|
);
|
|
2193
2250
|
}
|
|
@@ -2202,7 +2259,7 @@ function StepperPrev(props) {
|
|
|
2202
2259
|
const stepKeys = Array.from(steps.keys());
|
|
2203
2260
|
const currentIndex = stepKeys.length > 0 ? stepKeys.indexOf(value ?? "") : -1;
|
|
2204
2261
|
const isDisabled = disabled || currentIndex <= 0;
|
|
2205
|
-
const onClick =
|
|
2262
|
+
const onClick = React23.useCallback(
|
|
2206
2263
|
async (event) => {
|
|
2207
2264
|
propsRef.current.onClick?.(event);
|
|
2208
2265
|
if (event.defaultPrevented || isDisabled) return;
|
|
@@ -2215,7 +2272,7 @@ function StepperPrev(props) {
|
|
|
2215
2272
|
[propsRef, isDisabled, currentIndex, stepKeys, store]
|
|
2216
2273
|
);
|
|
2217
2274
|
const PrevPrimitive = asChild ? SlotPrimitive.Slot : "button";
|
|
2218
|
-
return /* @__PURE__ */
|
|
2275
|
+
return /* @__PURE__ */ jsx27(
|
|
2219
2276
|
PrevPrimitive,
|
|
2220
2277
|
{
|
|
2221
2278
|
type: "button",
|
|
@@ -2237,7 +2294,7 @@ function StepperNext(props) {
|
|
|
2237
2294
|
const stepKeys = Array.from(steps.keys());
|
|
2238
2295
|
const currentIndex = stepKeys.length > 0 ? stepKeys.indexOf(value ?? "") : -1;
|
|
2239
2296
|
const isDisabled = disabled || stepKeys.length === 0 || currentIndex >= stepKeys.length - 1;
|
|
2240
|
-
const onClick =
|
|
2297
|
+
const onClick = React23.useCallback(
|
|
2241
2298
|
async (event) => {
|
|
2242
2299
|
propsRef.current.onClick?.(event);
|
|
2243
2300
|
if (event.defaultPrevented || isDisabled) return;
|
|
@@ -2250,7 +2307,7 @@ function StepperNext(props) {
|
|
|
2250
2307
|
[propsRef, isDisabled, currentIndex, stepKeys, store]
|
|
2251
2308
|
);
|
|
2252
2309
|
const NextPrimitive = asChild ? SlotPrimitive.Slot : "button";
|
|
2253
|
-
return /* @__PURE__ */
|
|
2310
|
+
return /* @__PURE__ */ jsx27(
|
|
2254
2311
|
NextPrimitive,
|
|
2255
2312
|
{
|
|
2256
2313
|
type: "button",
|
|
@@ -2276,7 +2333,8 @@ import {
|
|
|
2276
2333
|
useReactTable
|
|
2277
2334
|
} from "@tanstack/react-table";
|
|
2278
2335
|
import { ChevronRight as ChevronRight2 } from "lucide-react";
|
|
2279
|
-
import { cn as
|
|
2336
|
+
import { cn as cn27 } from "@petrarca/sonnet-core";
|
|
2337
|
+
import { useComponentDefaults } from "@petrarca/sonnet-core/config";
|
|
2280
2338
|
|
|
2281
2339
|
// src/EntityTable/tableSchema/mergeUiSchema.ts
|
|
2282
2340
|
function resolveCellRenderer(property, uiEntry) {
|
|
@@ -2306,12 +2364,12 @@ function mergeColumnConfig(key, property, uiSchema) {
|
|
|
2306
2364
|
}
|
|
2307
2365
|
|
|
2308
2366
|
// src/EntityTable/tableSchema/cellRegistry.ts
|
|
2309
|
-
import
|
|
2367
|
+
import React24 from "react";
|
|
2310
2368
|
import { warnLog } from "@petrarca/sonnet-core";
|
|
2311
2369
|
|
|
2312
2370
|
// src/EntityTable/tableSchema/cellRenderers.tsx
|
|
2313
2371
|
import { formatDate, formatDateTime } from "@petrarca/sonnet-core";
|
|
2314
|
-
import { Fragment, jsx as
|
|
2372
|
+
import { Fragment, jsx as jsx28, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2315
2373
|
function resolveValue(value, options) {
|
|
2316
2374
|
const key = options.valueKey;
|
|
2317
2375
|
if (key && value != null && typeof value === "object") {
|
|
@@ -2327,60 +2385,95 @@ function TextCell({
|
|
|
2327
2385
|
options
|
|
2328
2386
|
}) {
|
|
2329
2387
|
const text = resolveValue(value, options);
|
|
2330
|
-
return /* @__PURE__ */
|
|
2388
|
+
return /* @__PURE__ */ jsx28("span", { className: cx("", options), children: text == null ? "\u2014" : String(text) });
|
|
2331
2389
|
}
|
|
2332
2390
|
function MutedCell({
|
|
2333
2391
|
value,
|
|
2334
2392
|
options
|
|
2335
2393
|
}) {
|
|
2336
2394
|
const text = resolveValue(value, options);
|
|
2337
|
-
return /* @__PURE__ */
|
|
2395
|
+
return /* @__PURE__ */ jsx28("span", { className: cx("text-muted-foreground", options), children: text == null ? "\u2014" : String(text) });
|
|
2338
2396
|
}
|
|
2339
2397
|
function BoldCell({
|
|
2340
2398
|
value,
|
|
2341
2399
|
options
|
|
2342
2400
|
}) {
|
|
2343
2401
|
const text = resolveValue(value, options);
|
|
2344
|
-
return /* @__PURE__ */
|
|
2402
|
+
return /* @__PURE__ */ jsx28("span", { className: cx("font-medium", options), children: text == null ? "\u2014" : String(text) });
|
|
2345
2403
|
}
|
|
2346
2404
|
function CodeCell({
|
|
2347
2405
|
value,
|
|
2348
2406
|
options
|
|
2349
2407
|
}) {
|
|
2350
2408
|
const text = resolveValue(value, options);
|
|
2351
|
-
return /* @__PURE__ */
|
|
2409
|
+
return /* @__PURE__ */ jsx28("span", { className: cx("font-mono text-xs", options), children: text == null ? "\u2014" : String(text) });
|
|
2352
2410
|
}
|
|
2353
2411
|
function BadgeCell({
|
|
2354
2412
|
value,
|
|
2355
2413
|
options
|
|
2356
2414
|
}) {
|
|
2357
2415
|
if (value == null)
|
|
2358
|
-
return /* @__PURE__ */
|
|
2416
|
+
return /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
2359
2417
|
const key = String(value);
|
|
2360
2418
|
const colors = options.colors;
|
|
2361
2419
|
const labels = options.labels;
|
|
2362
2420
|
const color = colors?.[key];
|
|
2363
2421
|
const label = labels?.[key] ?? key;
|
|
2364
|
-
return /* @__PURE__ */
|
|
2422
|
+
return /* @__PURE__ */ jsx28(Badge, { badgeColor: color, children: label });
|
|
2423
|
+
}
|
|
2424
|
+
function conditionHolds(value, when) {
|
|
2425
|
+
const isEmpty = value == null || value === "";
|
|
2426
|
+
switch (when) {
|
|
2427
|
+
case "empty":
|
|
2428
|
+
return isEmpty;
|
|
2429
|
+
case "present":
|
|
2430
|
+
return !isEmpty;
|
|
2431
|
+
case "truthy":
|
|
2432
|
+
return Boolean(value);
|
|
2433
|
+
case "falsy":
|
|
2434
|
+
return !value;
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
function renderConditionalFallback(value, fallback) {
|
|
2438
|
+
if (fallback === "dash" || value == null || value === "") {
|
|
2439
|
+
return /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
2440
|
+
}
|
|
2441
|
+
if (fallback === "muted-value") {
|
|
2442
|
+
return /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: String(value) });
|
|
2443
|
+
}
|
|
2444
|
+
return /* @__PURE__ */ jsx28("span", { children: String(value) });
|
|
2445
|
+
}
|
|
2446
|
+
function ConditionalBadgeCell({
|
|
2447
|
+
value,
|
|
2448
|
+
options
|
|
2449
|
+
}) {
|
|
2450
|
+
const when = options.when ?? "truthy";
|
|
2451
|
+
const variant = options.variant ?? "secondary";
|
|
2452
|
+
const fallback = options.fallback ?? "dash";
|
|
2453
|
+
if (conditionHolds(value, when)) {
|
|
2454
|
+
const label = options.label != null ? String(options.label) : String(value ?? "");
|
|
2455
|
+
return /* @__PURE__ */ jsx28(Badge, { variant, children: label });
|
|
2456
|
+
}
|
|
2457
|
+
return renderConditionalFallback(value, fallback);
|
|
2365
2458
|
}
|
|
2366
2459
|
function DateCell({
|
|
2367
2460
|
value,
|
|
2368
2461
|
options
|
|
2369
2462
|
}) {
|
|
2370
|
-
return /* @__PURE__ */
|
|
2463
|
+
return /* @__PURE__ */ jsx28("span", { className: cx("text-muted-foreground", options), children: formatDate(value) });
|
|
2371
2464
|
}
|
|
2372
2465
|
function DateTimeCell({
|
|
2373
2466
|
value,
|
|
2374
2467
|
options
|
|
2375
2468
|
}) {
|
|
2376
|
-
return /* @__PURE__ */
|
|
2469
|
+
return /* @__PURE__ */ jsx28("span", { className: cx("text-muted-foreground", options), children: formatDateTime(value) });
|
|
2377
2470
|
}
|
|
2378
2471
|
function BooleanCell({ value }) {
|
|
2379
|
-
return /* @__PURE__ */
|
|
2472
|
+
return /* @__PURE__ */ jsx28("span", { className: value ? "text-green-600" : "text-muted-foreground", children: value ? "Yes" : "No" });
|
|
2380
2473
|
}
|
|
2381
2474
|
function NumberCell({ value }) {
|
|
2382
2475
|
const text = value == null ? "\u2014" : String(value);
|
|
2383
|
-
return /* @__PURE__ */
|
|
2476
|
+
return /* @__PURE__ */ jsx28("span", { className: "tabular-nums", children: text });
|
|
2384
2477
|
}
|
|
2385
2478
|
function TruncateCell({
|
|
2386
2479
|
value,
|
|
@@ -2388,7 +2481,7 @@ function TruncateCell({
|
|
|
2388
2481
|
}) {
|
|
2389
2482
|
const resolved = resolveValue(value, options);
|
|
2390
2483
|
const text = resolved == null ? "\u2014" : String(resolved);
|
|
2391
|
-
return /* @__PURE__ */
|
|
2484
|
+
return /* @__PURE__ */ jsx28("span", { className: "block truncate max-w-xs", title: text, children: text });
|
|
2392
2485
|
}
|
|
2393
2486
|
function OverflowListCell({
|
|
2394
2487
|
value,
|
|
@@ -2396,7 +2489,7 @@ function OverflowListCell({
|
|
|
2396
2489
|
}) {
|
|
2397
2490
|
const items = Array.isArray(value) ? value : [];
|
|
2398
2491
|
if (items.length === 0)
|
|
2399
|
-
return /* @__PURE__ */
|
|
2492
|
+
return /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
2400
2493
|
const displayKey = options.displayKey;
|
|
2401
2494
|
const fallbackKey = options.fallbackKey;
|
|
2402
2495
|
const prefixKey = options.prefixKey;
|
|
@@ -2421,8 +2514,8 @@ function JoinCell({
|
|
|
2421
2514
|
}) {
|
|
2422
2515
|
const sep = options.separator ?? ", ";
|
|
2423
2516
|
if (!Array.isArray(value) || value.length === 0)
|
|
2424
|
-
return /* @__PURE__ */
|
|
2425
|
-
return /* @__PURE__ */
|
|
2517
|
+
return /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
2518
|
+
return /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: value.join(sep) });
|
|
2426
2519
|
}
|
|
2427
2520
|
|
|
2428
2521
|
// src/EntityTable/tableSchema/cellRegistry.ts
|
|
@@ -2432,6 +2525,7 @@ var CELL_RENDERERS = {
|
|
|
2432
2525
|
bold: BoldCell,
|
|
2433
2526
|
code: CodeCell,
|
|
2434
2527
|
badge: BadgeCell,
|
|
2528
|
+
"badge-when": ConditionalBadgeCell,
|
|
2435
2529
|
date: DateCell,
|
|
2436
2530
|
datetime: DateTimeCell,
|
|
2437
2531
|
boolean: BooleanCell,
|
|
@@ -2453,7 +2547,7 @@ function resolveCellRenderer2(name, localRenderers) {
|
|
|
2453
2547
|
return localRenderers?.[name] ?? CELL_RENDERERS[name] ?? TextCell;
|
|
2454
2548
|
}
|
|
2455
2549
|
function createRenderer(render) {
|
|
2456
|
-
return ({ row, options }) =>
|
|
2550
|
+
return ({ row, options }) => React24.createElement(React24.Fragment, null, render(row, options));
|
|
2457
2551
|
}
|
|
2458
2552
|
function validateRendererNames(renderers) {
|
|
2459
2553
|
for (const name of Object.keys(renderers)) {
|
|
@@ -2468,12 +2562,12 @@ function validateRendererNames(renderers) {
|
|
|
2468
2562
|
// src/EntityTable/tableSchema/columnResolver.ts
|
|
2469
2563
|
function resolveColumns(schema, uiSchema) {
|
|
2470
2564
|
const properties = schema.properties ?? {};
|
|
2471
|
-
const entries = Object.entries(properties).map(([key, property]) => {
|
|
2565
|
+
const entries = Object.entries(properties).map(([key, property], index) => {
|
|
2472
2566
|
const config = mergeColumnConfig(key, property, uiSchema);
|
|
2473
|
-
return { key, property, config };
|
|
2567
|
+
return { key, property, config, index };
|
|
2474
2568
|
}).filter(({ config }) => !config.hidden);
|
|
2475
2569
|
const ordered = entries.filter(({ config }) => config.order !== void 0).sort((a, b) => a.config.order - b.config.order);
|
|
2476
|
-
const unordered = entries.filter(({ config }) => config.order === void 0).sort((a, b) => a.
|
|
2570
|
+
const unordered = entries.filter(({ config }) => config.order === void 0).sort((a, b) => a.index - b.index);
|
|
2477
2571
|
const sorted = [...ordered, ...unordered];
|
|
2478
2572
|
return sorted.map(({ key, property, config }) => {
|
|
2479
2573
|
const cellRenderer = config.cellRenderer ?? inferCellRenderer(property.type, property.format);
|
|
@@ -2494,7 +2588,7 @@ function keyToLabel(key) {
|
|
|
2494
2588
|
}
|
|
2495
2589
|
|
|
2496
2590
|
// src/EntityTable/EntityTable.tsx
|
|
2497
|
-
import { jsx as
|
|
2591
|
+
import { jsx as jsx29, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2498
2592
|
var coreRowModel = getCoreRowModel();
|
|
2499
2593
|
function resolveTableDefaults(props) {
|
|
2500
2594
|
return {
|
|
@@ -2502,6 +2596,24 @@ function resolveTableDefaults(props) {
|
|
|
2502
2596
|
selectionMode: props.selectionMode ?? false
|
|
2503
2597
|
};
|
|
2504
2598
|
}
|
|
2599
|
+
var ENTITY_TABLE_BUILTIN = {
|
|
2600
|
+
rowActivation: "click",
|
|
2601
|
+
showChevron: true
|
|
2602
|
+
};
|
|
2603
|
+
function useResolvedActivation(props) {
|
|
2604
|
+
const resolved = useComponentDefaults(
|
|
2605
|
+
"EntityTable",
|
|
2606
|
+
ENTITY_TABLE_BUILTIN,
|
|
2607
|
+
{
|
|
2608
|
+
rowActivation: props.rowActivation,
|
|
2609
|
+
showChevron: props.showChevron
|
|
2610
|
+
}
|
|
2611
|
+
);
|
|
2612
|
+
return {
|
|
2613
|
+
rowActivation: resolved.rowActivation,
|
|
2614
|
+
showChevron: resolved.showChevron
|
|
2615
|
+
};
|
|
2616
|
+
}
|
|
2505
2617
|
function buildColumnDefs(resolved, localRenderers) {
|
|
2506
2618
|
return resolved.map((col) => {
|
|
2507
2619
|
const Renderer = resolveCellRenderer2(col.cellRenderer, localRenderers);
|
|
@@ -2513,7 +2625,7 @@ function buildColumnDefs(resolved, localRenderers) {
|
|
|
2513
2625
|
cell: ({
|
|
2514
2626
|
getValue,
|
|
2515
2627
|
row
|
|
2516
|
-
}) => /* @__PURE__ */
|
|
2628
|
+
}) => /* @__PURE__ */ jsx29(
|
|
2517
2629
|
Renderer,
|
|
2518
2630
|
{
|
|
2519
2631
|
value: getValue(),
|
|
@@ -2531,7 +2643,7 @@ function buildSelectColumn() {
|
|
|
2531
2643
|
return {
|
|
2532
2644
|
id: "_select",
|
|
2533
2645
|
size: 40,
|
|
2534
|
-
header: ({ table: t }) => /* @__PURE__ */
|
|
2646
|
+
header: ({ table: t }) => /* @__PURE__ */ jsx29(
|
|
2535
2647
|
Checkbox,
|
|
2536
2648
|
{
|
|
2537
2649
|
checked: t.getIsAllPageRowsSelected() || (t.getIsSomePageRowsSelected() ? "indeterminate" : false),
|
|
@@ -2539,7 +2651,7 @@ function buildSelectColumn() {
|
|
|
2539
2651
|
"aria-label": "Select all"
|
|
2540
2652
|
}
|
|
2541
2653
|
),
|
|
2542
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2654
|
+
cell: ({ row }) => /* @__PURE__ */ jsx29(
|
|
2543
2655
|
Checkbox,
|
|
2544
2656
|
{
|
|
2545
2657
|
checked: row.getIsSelected(),
|
|
@@ -2647,6 +2759,29 @@ function useEntityTableState(props, selectionMode) {
|
|
|
2647
2759
|
columns
|
|
2648
2760
|
};
|
|
2649
2761
|
}
|
|
2762
|
+
function useActiveRowEvent(args) {
|
|
2763
|
+
const {
|
|
2764
|
+
selectionMode,
|
|
2765
|
+
rowActivation,
|
|
2766
|
+
onRowClick,
|
|
2767
|
+
onActiveRowChange,
|
|
2768
|
+
activeRowIndex,
|
|
2769
|
+
dataRows,
|
|
2770
|
+
setActiveRowIndex
|
|
2771
|
+
} = args;
|
|
2772
|
+
const singleActiveMode = !selectionMode && rowActivation === "double-click" && !!onRowClick;
|
|
2773
|
+
const onChangeRef = useRef4(onActiveRowChange);
|
|
2774
|
+
onChangeRef.current = onActiveRowChange;
|
|
2775
|
+
useEffect3(() => {
|
|
2776
|
+
if (!singleActiveMode) return;
|
|
2777
|
+
const row = activeRowIndex >= 0 ? dataRows[activeRowIndex] ?? null : null;
|
|
2778
|
+
onChangeRef.current?.(row);
|
|
2779
|
+
}, [singleActiveMode, activeRowIndex, dataRows]);
|
|
2780
|
+
return useCallback2(
|
|
2781
|
+
(index) => setActiveRowIndex(index),
|
|
2782
|
+
[setActiveRowIndex]
|
|
2783
|
+
);
|
|
2784
|
+
}
|
|
2650
2785
|
function useTableKeyboard(table, activeRowIndex, setActiveRowIndex, selectionMode, onRowClick) {
|
|
2651
2786
|
return useCallback2(
|
|
2652
2787
|
(e) => {
|
|
@@ -2693,9 +2828,9 @@ function handleSpaceKey(e, tableRows, selectionMode, activeRowIndex) {
|
|
|
2693
2828
|
e.preventDefault();
|
|
2694
2829
|
tableRows[activeRowIndex]?.toggleSelected();
|
|
2695
2830
|
}
|
|
2696
|
-
function resolveTrailingCols(rowActions, onRowClick, selectionMode) {
|
|
2831
|
+
function resolveTrailingCols(rowActions, onRowClick, selectionMode, showChevron) {
|
|
2697
2832
|
const hasRowActions = !!(rowActions && rowActions.length > 0);
|
|
2698
|
-
const hasChevron = !!(onRowClick && !selectionMode && !hasRowActions);
|
|
2833
|
+
const hasChevron = !!(onRowClick && showChevron && !selectionMode && !hasRowActions);
|
|
2699
2834
|
return {
|
|
2700
2835
|
hasRowActions,
|
|
2701
2836
|
hasChevron,
|
|
@@ -2713,7 +2848,7 @@ function StatusRows({
|
|
|
2713
2848
|
colCount
|
|
2714
2849
|
}) {
|
|
2715
2850
|
if (isLoading) {
|
|
2716
|
-
return /* @__PURE__ */
|
|
2851
|
+
return /* @__PURE__ */ jsx29("tr", { children: /* @__PURE__ */ jsx29(
|
|
2717
2852
|
"td",
|
|
2718
2853
|
{
|
|
2719
2854
|
colSpan: colCount,
|
|
@@ -2723,7 +2858,7 @@ function StatusRows({
|
|
|
2723
2858
|
) });
|
|
2724
2859
|
}
|
|
2725
2860
|
if (isError) {
|
|
2726
|
-
return /* @__PURE__ */
|
|
2861
|
+
return /* @__PURE__ */ jsx29("tr", { children: /* @__PURE__ */ jsx29(
|
|
2727
2862
|
"td",
|
|
2728
2863
|
{
|
|
2729
2864
|
colSpan: colCount,
|
|
@@ -2733,7 +2868,7 @@ function StatusRows({
|
|
|
2733
2868
|
) });
|
|
2734
2869
|
}
|
|
2735
2870
|
if (isEmpty) {
|
|
2736
|
-
return /* @__PURE__ */
|
|
2871
|
+
return /* @__PURE__ */ jsx29("tr", { children: /* @__PURE__ */ jsx29(
|
|
2737
2872
|
"td",
|
|
2738
2873
|
{
|
|
2739
2874
|
colSpan: colCount,
|
|
@@ -2753,7 +2888,7 @@ function RowActionCell({
|
|
|
2753
2888
|
actions,
|
|
2754
2889
|
rowOriginal
|
|
2755
2890
|
}) {
|
|
2756
|
-
return /* @__PURE__ */
|
|
2891
|
+
return /* @__PURE__ */ jsx29("td", { className: "px-4 py-3 w-24 text-right", children: /* @__PURE__ */ jsx29("div", { className: "flex items-center justify-end gap-1", children: actions.map((action) => /* @__PURE__ */ jsx29(
|
|
2757
2892
|
ActionButton,
|
|
2758
2893
|
{
|
|
2759
2894
|
action,
|
|
@@ -2770,7 +2905,7 @@ function ActionButton({
|
|
|
2770
2905
|
if (isHidden) return null;
|
|
2771
2906
|
const isDisabled = action.disabled?.(rowOriginal);
|
|
2772
2907
|
const Icon = action.icon;
|
|
2773
|
-
return /* @__PURE__ */
|
|
2908
|
+
return /* @__PURE__ */ jsx29(
|
|
2774
2909
|
"button",
|
|
2775
2910
|
{
|
|
2776
2911
|
title: action.label,
|
|
@@ -2779,28 +2914,62 @@ function ActionButton({
|
|
|
2779
2914
|
e.stopPropagation();
|
|
2780
2915
|
action.onClick(rowOriginal);
|
|
2781
2916
|
},
|
|
2782
|
-
className:
|
|
2917
|
+
className: cn27(
|
|
2783
2918
|
"inline-flex items-center justify-center h-7 w-7 rounded-md transition-colors",
|
|
2784
2919
|
action.variant === "destructive" ? "text-destructive hover:bg-destructive/10" : "text-muted-foreground hover:bg-accent",
|
|
2785
2920
|
isDisabled ? "opacity-30 cursor-not-allowed group-hover/row:opacity-30" : "opacity-0 group-hover/row:opacity-100 focus:opacity-100"
|
|
2786
2921
|
),
|
|
2787
|
-
children: Icon ? /* @__PURE__ */
|
|
2922
|
+
children: Icon ? /* @__PURE__ */ jsx29(Icon, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx29("span", { className: "text-xs", children: action.label })
|
|
2788
2923
|
},
|
|
2789
2924
|
action.label
|
|
2790
2925
|
);
|
|
2791
2926
|
}
|
|
2927
|
+
function ChevronCell({
|
|
2928
|
+
rowOriginal,
|
|
2929
|
+
rowActivation,
|
|
2930
|
+
onRowClick
|
|
2931
|
+
}) {
|
|
2932
|
+
const asButton = rowActivation === "double-click" && !!onRowClick;
|
|
2933
|
+
return /* @__PURE__ */ jsx29("td", { className: "px-4 py-3 w-10", children: asButton ? /* @__PURE__ */ jsx29(
|
|
2934
|
+
"button",
|
|
2935
|
+
{
|
|
2936
|
+
type: "button",
|
|
2937
|
+
title: "Open",
|
|
2938
|
+
onClick: (e) => {
|
|
2939
|
+
e.stopPropagation();
|
|
2940
|
+
onRowClick(rowOriginal);
|
|
2941
|
+
},
|
|
2942
|
+
className: "inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2943
|
+
children: /* @__PURE__ */ jsx29(ChevronRight2, { className: "h-4 w-4" })
|
|
2944
|
+
}
|
|
2945
|
+
) : /* @__PURE__ */ jsx29(ChevronRight2, { className: "h-4 w-4 text-muted-foreground" }) });
|
|
2946
|
+
}
|
|
2947
|
+
function rowClassName(row, isActive, selectionMode, singleClickSelects, onRowClick) {
|
|
2948
|
+
return cn27(
|
|
2949
|
+
"border-b last:border-b-0 transition-colors group/row",
|
|
2950
|
+
onRowClick && !selectionMode && "hover:bg-accent/50 cursor-pointer",
|
|
2951
|
+
selectionMode && "cursor-default",
|
|
2952
|
+
row.getIsSelected() && "bg-primary/10",
|
|
2953
|
+
isActive && selectionMode && "bg-accent",
|
|
2954
|
+
isActive && singleClickSelects && "bg-primary/10"
|
|
2955
|
+
);
|
|
2956
|
+
}
|
|
2792
2957
|
function DataRow({
|
|
2793
2958
|
row,
|
|
2794
2959
|
index,
|
|
2795
2960
|
selectionMode,
|
|
2961
|
+
rowActivation,
|
|
2796
2962
|
activeRowIndex,
|
|
2797
2963
|
onRowClick,
|
|
2964
|
+
onActivateRow,
|
|
2798
2965
|
setActiveRowIndex,
|
|
2799
2966
|
containerRef,
|
|
2800
2967
|
hasRowActions,
|
|
2801
2968
|
hasChevron,
|
|
2802
2969
|
rowActions
|
|
2803
2970
|
}) {
|
|
2971
|
+
const singleClickSelects = !selectionMode && rowActivation === "double-click" && !!onRowClick;
|
|
2972
|
+
const isActive = index === activeRowIndex;
|
|
2804
2973
|
return /* @__PURE__ */ jsxs8(
|
|
2805
2974
|
"tr",
|
|
2806
2975
|
{
|
|
@@ -2809,35 +2978,51 @@ function DataRow({
|
|
|
2809
2978
|
row,
|
|
2810
2979
|
index,
|
|
2811
2980
|
selectionMode,
|
|
2981
|
+
rowActivation,
|
|
2812
2982
|
onRowClick,
|
|
2983
|
+
onActivateRow,
|
|
2813
2984
|
setActiveRowIndex,
|
|
2814
2985
|
containerRef
|
|
2815
2986
|
);
|
|
2816
2987
|
},
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
row
|
|
2822
|
-
|
|
2988
|
+
onDoubleClick: () => {
|
|
2989
|
+
if (singleClickSelects && onRowClick) onRowClick(row.original);
|
|
2990
|
+
},
|
|
2991
|
+
className: rowClassName(
|
|
2992
|
+
row,
|
|
2993
|
+
isActive,
|
|
2994
|
+
selectionMode,
|
|
2995
|
+
singleClickSelects,
|
|
2996
|
+
onRowClick
|
|
2823
2997
|
),
|
|
2824
2998
|
children: [
|
|
2825
|
-
row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
2826
|
-
hasRowActions && /* @__PURE__ */
|
|
2827
|
-
hasChevron && /* @__PURE__ */
|
|
2999
|
+
row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx29("td", { className: "px-4 py-3", children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)),
|
|
3000
|
+
hasRowActions && /* @__PURE__ */ jsx29(RowActionCell, { actions: rowActions, rowOriginal: row.original }),
|
|
3001
|
+
hasChevron && /* @__PURE__ */ jsx29(
|
|
3002
|
+
ChevronCell,
|
|
3003
|
+
{
|
|
3004
|
+
rowOriginal: row.original,
|
|
3005
|
+
rowActivation,
|
|
3006
|
+
onRowClick
|
|
3007
|
+
}
|
|
3008
|
+
)
|
|
2828
3009
|
]
|
|
2829
3010
|
},
|
|
2830
3011
|
row.id
|
|
2831
3012
|
);
|
|
2832
3013
|
}
|
|
2833
|
-
function handleRowClick(row, index, selectionMode, onRowClick, setActiveRowIndex, containerRef) {
|
|
3014
|
+
function handleRowClick(row, index, selectionMode, rowActivation, onRowClick, onActivateRow, setActiveRowIndex, containerRef) {
|
|
2834
3015
|
if (selectionMode) {
|
|
2835
3016
|
row.toggleSelected();
|
|
2836
3017
|
setActiveRowIndex(index);
|
|
2837
3018
|
containerRef.current?.focus();
|
|
2838
|
-
|
|
2839
|
-
onRowClick(row.original);
|
|
3019
|
+
return;
|
|
2840
3020
|
}
|
|
3021
|
+
if (rowActivation === "double-click" && onRowClick) {
|
|
3022
|
+
onActivateRow(index);
|
|
3023
|
+
return;
|
|
3024
|
+
}
|
|
3025
|
+
if (onRowClick) onRowClick(row.original);
|
|
2841
3026
|
}
|
|
2842
3027
|
function TableFooter({
|
|
2843
3028
|
isPaginated,
|
|
@@ -2848,7 +3033,7 @@ function TableFooter({
|
|
|
2848
3033
|
}) {
|
|
2849
3034
|
if (!data?.meta) return null;
|
|
2850
3035
|
if (isPaginated) {
|
|
2851
|
-
return /* @__PURE__ */
|
|
3036
|
+
return /* @__PURE__ */ jsx29(PaginationFooter, { table, entityLabel });
|
|
2852
3037
|
}
|
|
2853
3038
|
return /* @__PURE__ */ jsxs8("p", { className: "text-xs text-muted-foreground mt-3", children: [
|
|
2854
3039
|
"Showing ",
|
|
@@ -2867,9 +3052,11 @@ function EntityTable(props) {
|
|
|
2867
3052
|
errorMessage,
|
|
2868
3053
|
entityLabel,
|
|
2869
3054
|
onRowClick,
|
|
3055
|
+
onActiveRowChange,
|
|
2870
3056
|
rowActions
|
|
2871
3057
|
} = props;
|
|
2872
3058
|
const { isFiltered, selectionMode } = resolveTableDefaults(props);
|
|
3059
|
+
const { rowActivation, showChevron } = useResolvedActivation(props);
|
|
2873
3060
|
const {
|
|
2874
3061
|
table,
|
|
2875
3062
|
dataRows,
|
|
@@ -2886,23 +3073,33 @@ function EntityTable(props) {
|
|
|
2886
3073
|
selectionMode,
|
|
2887
3074
|
onRowClick
|
|
2888
3075
|
);
|
|
3076
|
+
const handleActivateRow = useActiveRowEvent({
|
|
3077
|
+
selectionMode,
|
|
3078
|
+
rowActivation,
|
|
3079
|
+
onRowClick,
|
|
3080
|
+
onActiveRowChange,
|
|
3081
|
+
activeRowIndex,
|
|
3082
|
+
dataRows,
|
|
3083
|
+
setActiveRowIndex
|
|
3084
|
+
});
|
|
2889
3085
|
const { hasRowActions, hasChevron, hasTrailingCol } = resolveTrailingCols(
|
|
2890
3086
|
rowActions,
|
|
2891
3087
|
onRowClick,
|
|
2892
|
-
selectionMode
|
|
3088
|
+
selectionMode,
|
|
3089
|
+
showChevron
|
|
2893
3090
|
);
|
|
2894
3091
|
const colCount = columns.length + (hasTrailingCol ? 1 : 0);
|
|
2895
3092
|
return /* @__PURE__ */ jsxs8("div", { children: [
|
|
2896
|
-
/* @__PURE__ */
|
|
3093
|
+
/* @__PURE__ */ jsx29(
|
|
2897
3094
|
"div",
|
|
2898
3095
|
{
|
|
2899
3096
|
ref: selectionMode ? containerRef : void 0,
|
|
2900
3097
|
tabIndex: selectionMode ? 0 : void 0,
|
|
2901
3098
|
onKeyDown: selectionMode ? handleKeyDown : void 0,
|
|
2902
|
-
className:
|
|
3099
|
+
className: cn27("rounded-lg border", selectionMode && "outline-none"),
|
|
2903
3100
|
children: /* @__PURE__ */ jsxs8("table", { className: "w-full text-sm", children: [
|
|
2904
|
-
/* @__PURE__ */
|
|
2905
|
-
table.getFlatHeaders().map((header) => /* @__PURE__ */
|
|
3101
|
+
/* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs8("tr", { className: "border-b bg-muted/40", children: [
|
|
3102
|
+
table.getFlatHeaders().map((header) => /* @__PURE__ */ jsx29(
|
|
2906
3103
|
"th",
|
|
2907
3104
|
{
|
|
2908
3105
|
className: "text-left text-xs font-medium text-muted-foreground px-4 py-2.5",
|
|
@@ -2914,7 +3111,7 @@ function EntityTable(props) {
|
|
|
2914
3111
|
},
|
|
2915
3112
|
header.id
|
|
2916
3113
|
)),
|
|
2917
|
-
hasRowActions && /* @__PURE__ */
|
|
3114
|
+
hasRowActions && /* @__PURE__ */ jsx29(
|
|
2918
3115
|
"th",
|
|
2919
3116
|
{
|
|
2920
3117
|
"aria-label": "Actions",
|
|
@@ -2922,10 +3119,10 @@ function EntityTable(props) {
|
|
|
2922
3119
|
className: "w-24 text-right text-xs font-medium text-muted-foreground px-4 py-2.5"
|
|
2923
3120
|
}
|
|
2924
3121
|
),
|
|
2925
|
-
hasChevron && /* @__PURE__ */
|
|
3122
|
+
hasChevron && /* @__PURE__ */ jsx29("th", { "aria-label": "Open", scope: "col", className: "w-10" })
|
|
2926
3123
|
] }) }),
|
|
2927
3124
|
/* @__PURE__ */ jsxs8("tbody", { children: [
|
|
2928
|
-
/* @__PURE__ */
|
|
3125
|
+
/* @__PURE__ */ jsx29(
|
|
2929
3126
|
StatusRows,
|
|
2930
3127
|
{
|
|
2931
3128
|
isLoading,
|
|
@@ -2938,14 +3135,16 @@ function EntityTable(props) {
|
|
|
2938
3135
|
colCount
|
|
2939
3136
|
}
|
|
2940
3137
|
),
|
|
2941
|
-
table.getRowModel().rows.map((row, index) => /* @__PURE__ */
|
|
3138
|
+
table.getRowModel().rows.map((row, index) => /* @__PURE__ */ jsx29(
|
|
2942
3139
|
DataRow,
|
|
2943
3140
|
{
|
|
2944
3141
|
row,
|
|
2945
3142
|
index,
|
|
2946
3143
|
selectionMode,
|
|
3144
|
+
rowActivation,
|
|
2947
3145
|
activeRowIndex,
|
|
2948
3146
|
onRowClick,
|
|
3147
|
+
onActivateRow: handleActivateRow,
|
|
2949
3148
|
setActiveRowIndex,
|
|
2950
3149
|
containerRef,
|
|
2951
3150
|
hasRowActions,
|
|
@@ -2958,7 +3157,7 @@ function EntityTable(props) {
|
|
|
2958
3157
|
] })
|
|
2959
3158
|
}
|
|
2960
3159
|
),
|
|
2961
|
-
/* @__PURE__ */
|
|
3160
|
+
/* @__PURE__ */ jsx29(
|
|
2962
3161
|
TableFooter,
|
|
2963
3162
|
{
|
|
2964
3163
|
isPaginated,
|
|
@@ -2980,9 +3179,9 @@ function PaginationFooter({
|
|
|
2980
3179
|
const from = rowCount === 0 ? 0 : pageIndex * pageSize + 1;
|
|
2981
3180
|
const to = Math.min((pageIndex + 1) * pageSize, rowCount);
|
|
2982
3181
|
return /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between mt-3", children: [
|
|
2983
|
-
/* @__PURE__ */
|
|
3182
|
+
/* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: rowCount === 0 ? `No ${entityLabel}` : `Showing ${from}\u2013${to} of ${rowCount} ${entityLabel}` }),
|
|
2984
3183
|
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1", children: [
|
|
2985
|
-
/* @__PURE__ */
|
|
3184
|
+
/* @__PURE__ */ jsx29(
|
|
2986
3185
|
"button",
|
|
2987
3186
|
{
|
|
2988
3187
|
type: "button",
|
|
@@ -2992,8 +3191,8 @@ function PaginationFooter({
|
|
|
2992
3191
|
children: "Previous"
|
|
2993
3192
|
}
|
|
2994
3193
|
),
|
|
2995
|
-
/* @__PURE__ */
|
|
2996
|
-
/* @__PURE__ */
|
|
3194
|
+
/* @__PURE__ */ jsx29("span", { className: "text-xs text-muted-foreground px-2", children: pageCount > 0 ? `${pageIndex + 1} / ${pageCount}` : "--" }),
|
|
3195
|
+
/* @__PURE__ */ jsx29(
|
|
2997
3196
|
"button",
|
|
2998
3197
|
{
|
|
2999
3198
|
type: "button",
|
|
@@ -3008,13 +3207,13 @@ function PaginationFooter({
|
|
|
3008
3207
|
}
|
|
3009
3208
|
|
|
3010
3209
|
// src/PropertyList/PropertyList.tsx
|
|
3011
|
-
import
|
|
3210
|
+
import React27 from "react";
|
|
3012
3211
|
import { copyTextToClipboard } from "@petrarca/sonnet-core";
|
|
3013
3212
|
|
|
3014
3213
|
// src/PropertyList/PropertyValue.tsx
|
|
3015
3214
|
import { useState as useState3 } from "react";
|
|
3016
3215
|
import { JSONTree } from "react-json-tree";
|
|
3017
|
-
import { jsx as
|
|
3216
|
+
import { jsx as jsx30, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3018
3217
|
var DEFAULT_CLAMP_CHARS = 180;
|
|
3019
3218
|
var tokenTheme = {
|
|
3020
3219
|
scheme: "sonnet",
|
|
@@ -3054,13 +3253,13 @@ function JsonValue({ value }) {
|
|
|
3054
3253
|
children: [
|
|
3055
3254
|
summary,
|
|
3056
3255
|
" ",
|
|
3057
|
-
/* @__PURE__ */
|
|
3256
|
+
/* @__PURE__ */ jsx30("span", { className: "text-xs", children: "\u2014 show" })
|
|
3058
3257
|
]
|
|
3059
3258
|
}
|
|
3060
3259
|
);
|
|
3061
3260
|
}
|
|
3062
3261
|
return /* @__PURE__ */ jsxs9("div", { className: "text-xs font-mono", children: [
|
|
3063
|
-
/* @__PURE__ */
|
|
3262
|
+
/* @__PURE__ */ jsx30(
|
|
3064
3263
|
"button",
|
|
3065
3264
|
{
|
|
3066
3265
|
type: "button",
|
|
@@ -3072,7 +3271,7 @@ function JsonValue({ value }) {
|
|
|
3072
3271
|
children: "hide"
|
|
3073
3272
|
}
|
|
3074
3273
|
),
|
|
3075
|
-
/* @__PURE__ */
|
|
3274
|
+
/* @__PURE__ */ jsx30("div", { className: "max-h-64 overflow-auto rounded border border-border bg-muted/30 px-2 py-1", children: /* @__PURE__ */ jsx30(
|
|
3076
3275
|
JSONTree,
|
|
3077
3276
|
{
|
|
3078
3277
|
data: value,
|
|
@@ -3088,8 +3287,8 @@ function LongTextValue({ text }) {
|
|
|
3088
3287
|
const [open, setOpen] = useState3(false);
|
|
3089
3288
|
if (!open) {
|
|
3090
3289
|
return /* @__PURE__ */ jsxs9("span", { className: "break-words", children: [
|
|
3091
|
-
/* @__PURE__ */
|
|
3092
|
-
/* @__PURE__ */
|
|
3290
|
+
/* @__PURE__ */ jsx30("span", { className: "line-clamp-3 align-bottom", children: text }),
|
|
3291
|
+
/* @__PURE__ */ jsx30(
|
|
3093
3292
|
"button",
|
|
3094
3293
|
{
|
|
3095
3294
|
type: "button",
|
|
@@ -3104,8 +3303,8 @@ function LongTextValue({ text }) {
|
|
|
3104
3303
|
] });
|
|
3105
3304
|
}
|
|
3106
3305
|
return /* @__PURE__ */ jsxs9("span", { className: "break-words", children: [
|
|
3107
|
-
/* @__PURE__ */
|
|
3108
|
-
/* @__PURE__ */
|
|
3306
|
+
/* @__PURE__ */ jsx30("span", { className: "block max-h-64 overflow-auto whitespace-pre-wrap rounded border border-border bg-muted/30 px-2 py-1", children: text }),
|
|
3307
|
+
/* @__PURE__ */ jsx30(
|
|
3109
3308
|
"button",
|
|
3110
3309
|
{
|
|
3111
3310
|
type: "button",
|
|
@@ -3123,12 +3322,12 @@ function renderFromSchema(value, schema, className) {
|
|
|
3123
3322
|
const cellName = schema["x-ui-cell"] ?? inferCellRenderer(schema.type, schema.format);
|
|
3124
3323
|
if (cellName === "json") {
|
|
3125
3324
|
const parsed = typeof value === "string" ? safeParse(value) : value;
|
|
3126
|
-
return isObjectLike(parsed) ? /* @__PURE__ */
|
|
3325
|
+
return isObjectLike(parsed) ? /* @__PURE__ */ jsx30(JsonValue, { value: parsed }) : null;
|
|
3127
3326
|
}
|
|
3128
3327
|
if (cellName && cellName !== "text") {
|
|
3129
3328
|
const Renderer = CELL_RENDERERS[cellName];
|
|
3130
3329
|
if (Renderer) {
|
|
3131
|
-
return /* @__PURE__ */
|
|
3330
|
+
return /* @__PURE__ */ jsx30("span", { className, children: /* @__PURE__ */ jsx30(
|
|
3132
3331
|
Renderer,
|
|
3133
3332
|
{
|
|
3134
3333
|
value,
|
|
@@ -3142,23 +3341,23 @@ function renderFromSchema(value, schema, className) {
|
|
|
3142
3341
|
}
|
|
3143
3342
|
function renderObjectLike(value, className) {
|
|
3144
3343
|
if (Array.isArray(value) && value.every((v) => !isObjectLike(v))) {
|
|
3145
|
-
return /* @__PURE__ */
|
|
3344
|
+
return /* @__PURE__ */ jsx30("span", { className: `break-words ${className ?? ""}`, children: value.map(String).join(", ") });
|
|
3146
3345
|
}
|
|
3147
|
-
return /* @__PURE__ */
|
|
3346
|
+
return /* @__PURE__ */ jsx30(JsonValue, { value });
|
|
3148
3347
|
}
|
|
3149
3348
|
function renderString(value, className, clampChars) {
|
|
3150
3349
|
if (typeof value === "boolean") {
|
|
3151
|
-
return /* @__PURE__ */
|
|
3350
|
+
return /* @__PURE__ */ jsx30("span", { className, children: value ? "true" : "false" });
|
|
3152
3351
|
}
|
|
3153
3352
|
const str = String(value);
|
|
3154
3353
|
if (str.length > clampChars || str.includes("\n")) {
|
|
3155
|
-
return /* @__PURE__ */
|
|
3354
|
+
return /* @__PURE__ */ jsx30("span", { className, children: /* @__PURE__ */ jsx30(LongTextValue, { text: str }) });
|
|
3156
3355
|
}
|
|
3157
|
-
return /* @__PURE__ */
|
|
3356
|
+
return /* @__PURE__ */ jsx30("span", { className: `break-words ${className ?? ""}`, children: str });
|
|
3158
3357
|
}
|
|
3159
3358
|
function renderFromValue(value, className, clampChars) {
|
|
3160
3359
|
if (value == null) {
|
|
3161
|
-
return /* @__PURE__ */
|
|
3360
|
+
return /* @__PURE__ */ jsx30("span", { className: `text-muted-foreground ${className ?? ""}`, children: "\u2014" });
|
|
3162
3361
|
}
|
|
3163
3362
|
if (isObjectLike(value)) return renderObjectLike(value, className);
|
|
3164
3363
|
return renderString(value, className, clampChars);
|
|
@@ -3181,7 +3380,7 @@ function safeParse(s) {
|
|
|
3181
3380
|
}
|
|
3182
3381
|
|
|
3183
3382
|
// src/PropertyList/PropertyList.tsx
|
|
3184
|
-
import { jsx as
|
|
3383
|
+
import { jsx as jsx31, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3185
3384
|
function PropertyList({
|
|
3186
3385
|
properties,
|
|
3187
3386
|
propertySchemas,
|
|
@@ -3193,9 +3392,9 @@ function PropertyList({
|
|
|
3193
3392
|
}) {
|
|
3194
3393
|
const entries = Object.entries(properties ?? {});
|
|
3195
3394
|
if (entries.length === 0) {
|
|
3196
|
-
return /* @__PURE__ */
|
|
3395
|
+
return /* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground italic", children: emptyLabel });
|
|
3197
3396
|
}
|
|
3198
|
-
const header = showHeader && /* @__PURE__ */
|
|
3397
|
+
const header = showHeader && /* @__PURE__ */ jsx31("p", { className: "text-[11px] text-muted-foreground mb-1.5", children: "Properties" });
|
|
3199
3398
|
const dtClass = `text-[11px] text-muted-foreground ${copyable ? "cursor-pointer hover:text-foreground" : ""}`;
|
|
3200
3399
|
const dtProps = (value) => copyable ? {
|
|
3201
3400
|
onClick: () => copyTextToClipboard(stringForCopy(value)),
|
|
@@ -3204,17 +3403,17 @@ function PropertyList({
|
|
|
3204
3403
|
if (layout === "stacked") {
|
|
3205
3404
|
return /* @__PURE__ */ jsxs10("div", { className, children: [
|
|
3206
3405
|
header,
|
|
3207
|
-
/* @__PURE__ */
|
|
3208
|
-
/* @__PURE__ */
|
|
3209
|
-
/* @__PURE__ */
|
|
3406
|
+
/* @__PURE__ */ jsx31("dl", { className: "space-y-1", children: entries.map(([key, value]) => /* @__PURE__ */ jsxs10("div", { children: [
|
|
3407
|
+
/* @__PURE__ */ jsx31("dt", { className: dtClass, ...dtProps(value), children: key }),
|
|
3408
|
+
/* @__PURE__ */ jsx31("dd", { className: "text-sm text-foreground font-medium break-words", children: /* @__PURE__ */ jsx31(PropertyValue, { value, schema: propertySchemas?.[key] }) })
|
|
3210
3409
|
] }, key)) })
|
|
3211
3410
|
] });
|
|
3212
3411
|
}
|
|
3213
3412
|
return /* @__PURE__ */ jsxs10("div", { className, children: [
|
|
3214
3413
|
header,
|
|
3215
|
-
/* @__PURE__ */
|
|
3216
|
-
/* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3414
|
+
/* @__PURE__ */ jsx31("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 items-baseline", children: entries.map(([key, value]) => /* @__PURE__ */ jsxs10(React27.Fragment, { children: [
|
|
3415
|
+
/* @__PURE__ */ jsx31("dt", { className: `${dtClass} whitespace-nowrap`, ...dtProps(value), children: key }),
|
|
3416
|
+
/* @__PURE__ */ jsx31("dd", { className: "text-sm text-foreground min-w-0 break-words", children: /* @__PURE__ */ jsx31(PropertyValue, { value, schema: propertySchemas?.[key] }) })
|
|
3218
3417
|
] }, key)) })
|
|
3219
3418
|
] });
|
|
3220
3419
|
}
|
|
@@ -3225,13 +3424,13 @@ function stringForCopy(value) {
|
|
|
3225
3424
|
}
|
|
3226
3425
|
|
|
3227
3426
|
// src/EntitySelect/EntitySelect.tsx
|
|
3228
|
-
import * as
|
|
3229
|
-
import { Check as Check4, ChevronsUpDown, Loader2 } from "lucide-react";
|
|
3230
|
-
import { cn as
|
|
3427
|
+
import * as React28 from "react";
|
|
3428
|
+
import { Check as Check4, ChevronsUpDown, Loader2, X as X3 } from "lucide-react";
|
|
3429
|
+
import { cn as cn28 } from "@petrarca/sonnet-core";
|
|
3231
3430
|
import {
|
|
3232
3431
|
useEntityOptions
|
|
3233
3432
|
} from "@petrarca/sonnet-core/hooks";
|
|
3234
|
-
import { Fragment as Fragment2, jsx as
|
|
3433
|
+
import { Fragment as Fragment2, jsx as jsx32, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3235
3434
|
function emptyStateMessage({
|
|
3236
3435
|
mode,
|
|
3237
3436
|
search,
|
|
@@ -3249,8 +3448,8 @@ function emptyStateMessage({
|
|
|
3249
3448
|
return emptyMessage;
|
|
3250
3449
|
}
|
|
3251
3450
|
function useHasSearched(submit) {
|
|
3252
|
-
const [hasSearched, setHasSearched] =
|
|
3253
|
-
const wrappedSubmit =
|
|
3451
|
+
const [hasSearched, setHasSearched] = React28.useState(false);
|
|
3452
|
+
const wrappedSubmit = React28.useCallback(() => {
|
|
3254
3453
|
setHasSearched(true);
|
|
3255
3454
|
submit();
|
|
3256
3455
|
}, [submit]);
|
|
@@ -3281,11 +3480,11 @@ function EntitySelectLabel({
|
|
|
3281
3480
|
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
3282
3481
|
children: [
|
|
3283
3482
|
label,
|
|
3284
|
-
required && /* @__PURE__ */
|
|
3483
|
+
required && /* @__PURE__ */ jsx32("span", { className: "ml-1 text-destructive", children: "*" })
|
|
3285
3484
|
]
|
|
3286
3485
|
}
|
|
3287
3486
|
),
|
|
3288
|
-
description && /* @__PURE__ */
|
|
3487
|
+
description && /* @__PURE__ */ jsx32("p", { className: "text-sm text-muted-foreground", children: description })
|
|
3289
3488
|
] });
|
|
3290
3489
|
}
|
|
3291
3490
|
function EntitySelectDropdown({
|
|
@@ -3303,7 +3502,7 @@ function EntitySelectDropdown({
|
|
|
3303
3502
|
handleSelect
|
|
3304
3503
|
}) {
|
|
3305
3504
|
return /* @__PURE__ */ jsxs11(Command, { shouldFilter: false, children: [
|
|
3306
|
-
/* @__PURE__ */
|
|
3505
|
+
/* @__PURE__ */ jsx32(
|
|
3307
3506
|
CommandInput,
|
|
3308
3507
|
{
|
|
3309
3508
|
placeholder: searchPlaceholder,
|
|
@@ -3318,7 +3517,7 @@ function EntitySelectDropdown({
|
|
|
3318
3517
|
}
|
|
3319
3518
|
),
|
|
3320
3519
|
/* @__PURE__ */ jsxs11(CommandList, { children: [
|
|
3321
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx32(CommandEmpty, { children: emptyStateMessage({
|
|
3322
3521
|
mode,
|
|
3323
3522
|
search,
|
|
3324
3523
|
minChars,
|
|
@@ -3326,16 +3525,16 @@ function EntitySelectDropdown({
|
|
|
3326
3525
|
hasSearched,
|
|
3327
3526
|
emptyMessage
|
|
3328
3527
|
}) }),
|
|
3329
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ jsx32(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsxs11(
|
|
3330
3529
|
CommandItem,
|
|
3331
3530
|
{
|
|
3332
3531
|
value: option.value,
|
|
3333
3532
|
onSelect: handleSelect,
|
|
3334
3533
|
children: [
|
|
3335
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ jsx32(
|
|
3336
3535
|
Check4,
|
|
3337
3536
|
{
|
|
3338
|
-
className:
|
|
3537
|
+
className: cn28(
|
|
3339
3538
|
"mr-2 h-4 w-4",
|
|
3340
3539
|
value === option.value ? "opacity-100" : "opacity-0"
|
|
3341
3540
|
)
|
|
@@ -3354,11 +3553,13 @@ function EntitySelect(props) {
|
|
|
3354
3553
|
fetcher,
|
|
3355
3554
|
queryKey,
|
|
3356
3555
|
value,
|
|
3556
|
+
selectedOption,
|
|
3357
3557
|
onChange,
|
|
3358
3558
|
onChangeOption,
|
|
3359
3559
|
onBlur,
|
|
3360
3560
|
label,
|
|
3361
3561
|
required,
|
|
3562
|
+
clearable,
|
|
3362
3563
|
description,
|
|
3363
3564
|
error,
|
|
3364
3565
|
className,
|
|
@@ -3372,8 +3573,8 @@ function EntitySelect(props) {
|
|
|
3372
3573
|
emptyMessage,
|
|
3373
3574
|
disabled
|
|
3374
3575
|
} = resolveEntitySelectDefaults(props);
|
|
3375
|
-
const [open, setOpen] =
|
|
3376
|
-
const [selectedLabel, setSelectedLabel] =
|
|
3576
|
+
const [open, setOpen] = React28.useState(false);
|
|
3577
|
+
const [selectedLabel, setSelectedLabel] = React28.useState(null);
|
|
3377
3578
|
const {
|
|
3378
3579
|
options,
|
|
3379
3580
|
isLoading,
|
|
@@ -3382,7 +3583,7 @@ function EntitySelect(props) {
|
|
|
3382
3583
|
submit: rawSubmit
|
|
3383
3584
|
} = useEntityOptions({ fetcher, queryKey, mode, minChars });
|
|
3384
3585
|
const [hasSearched, submit] = useHasSearched(rawSubmit);
|
|
3385
|
-
|
|
3586
|
+
React28.useEffect(() => {
|
|
3386
3587
|
if (!value) {
|
|
3387
3588
|
setSelectedLabel(null);
|
|
3388
3589
|
return;
|
|
@@ -3390,9 +3591,22 @@ function EntitySelect(props) {
|
|
|
3390
3591
|
const found = options.find((opt) => opt.value === value);
|
|
3391
3592
|
if (found) {
|
|
3392
3593
|
setSelectedLabel(found.label);
|
|
3594
|
+
} else if (selectedOption && selectedOption.value === value) {
|
|
3595
|
+
setSelectedLabel(selectedOption.label);
|
|
3393
3596
|
}
|
|
3394
|
-
}, [value, options]);
|
|
3395
|
-
const
|
|
3597
|
+
}, [value, options, selectedOption]);
|
|
3598
|
+
const handleClear = React28.useCallback(
|
|
3599
|
+
(e) => {
|
|
3600
|
+
e.preventDefault();
|
|
3601
|
+
e.stopPropagation();
|
|
3602
|
+
setSelectedLabel(null);
|
|
3603
|
+
onChange?.(null);
|
|
3604
|
+
onChangeOption?.(null);
|
|
3605
|
+
},
|
|
3606
|
+
[onChange, onChangeOption]
|
|
3607
|
+
);
|
|
3608
|
+
const showClear = Boolean(clearable && value && !required && !disabled);
|
|
3609
|
+
const handleSelect = React28.useCallback(
|
|
3396
3610
|
(selectedValue) => {
|
|
3397
3611
|
const opt = options.find((o) => o.value === selectedValue);
|
|
3398
3612
|
if (opt) setSelectedLabel(opt.label);
|
|
@@ -3405,7 +3619,7 @@ function EntitySelect(props) {
|
|
|
3405
3619
|
},
|
|
3406
3620
|
[options, value, onChange, onChangeOption, setSearch]
|
|
3407
3621
|
);
|
|
3408
|
-
const handleOpenChange =
|
|
3622
|
+
const handleOpenChange = React28.useCallback(
|
|
3409
3623
|
(newOpen) => {
|
|
3410
3624
|
setOpen(newOpen);
|
|
3411
3625
|
if (!newOpen) {
|
|
@@ -3415,8 +3629,8 @@ function EntitySelect(props) {
|
|
|
3415
3629
|
},
|
|
3416
3630
|
[onBlur, setSearch]
|
|
3417
3631
|
);
|
|
3418
|
-
return /* @__PURE__ */ jsxs11("div", { className:
|
|
3419
|
-
/* @__PURE__ */
|
|
3632
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn28("space-y-2", className), children: [
|
|
3633
|
+
/* @__PURE__ */ jsx32(
|
|
3420
3634
|
EntitySelectLabel,
|
|
3421
3635
|
{
|
|
3422
3636
|
id,
|
|
@@ -3426,34 +3640,45 @@ function EntitySelect(props) {
|
|
|
3426
3640
|
}
|
|
3427
3641
|
),
|
|
3428
3642
|
/* @__PURE__ */ jsxs11(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
3429
|
-
/* @__PURE__ */
|
|
3643
|
+
/* @__PURE__ */ jsx32(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
3430
3644
|
Button,
|
|
3431
3645
|
{
|
|
3432
3646
|
id,
|
|
3433
3647
|
variant: "outline",
|
|
3434
3648
|
role: "combobox",
|
|
3435
3649
|
"aria-expanded": open,
|
|
3436
|
-
className:
|
|
3650
|
+
className: cn28(
|
|
3437
3651
|
"w-full justify-between",
|
|
3438
3652
|
!selectedLabel && "text-muted-foreground",
|
|
3439
3653
|
error && "border-destructive"
|
|
3440
3654
|
),
|
|
3441
3655
|
disabled,
|
|
3442
3656
|
children: [
|
|
3443
|
-
/* @__PURE__ */
|
|
3657
|
+
/* @__PURE__ */ jsx32("span", { className: "truncate", children: selectedLabel ?? placeholder }),
|
|
3444
3658
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
3445
|
-
isLoading && /* @__PURE__ */
|
|
3446
|
-
/* @__PURE__ */
|
|
3659
|
+
isLoading && /* @__PURE__ */ jsx32(Loader2, { className: "h-4 w-4 animate-spin opacity-50" }),
|
|
3660
|
+
showClear && /* @__PURE__ */ jsx32(
|
|
3661
|
+
"span",
|
|
3662
|
+
{
|
|
3663
|
+
role: "button",
|
|
3664
|
+
"aria-label": "Clear selection",
|
|
3665
|
+
tabIndex: -1,
|
|
3666
|
+
className: "rounded-sm opacity-50 hover:opacity-100",
|
|
3667
|
+
onPointerDown: handleClear,
|
|
3668
|
+
children: /* @__PURE__ */ jsx32(X3, { className: "h-4 w-4 shrink-0" })
|
|
3669
|
+
}
|
|
3670
|
+
),
|
|
3671
|
+
/* @__PURE__ */ jsx32(ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
3447
3672
|
] })
|
|
3448
3673
|
]
|
|
3449
3674
|
}
|
|
3450
3675
|
) }),
|
|
3451
|
-
/* @__PURE__ */
|
|
3676
|
+
/* @__PURE__ */ jsx32(
|
|
3452
3677
|
PopoverContent,
|
|
3453
3678
|
{
|
|
3454
3679
|
className: "w-[--radix-popover-trigger-width] p-0",
|
|
3455
3680
|
align: "start",
|
|
3456
|
-
children: /* @__PURE__ */
|
|
3681
|
+
children: /* @__PURE__ */ jsx32(
|
|
3457
3682
|
EntitySelectDropdown,
|
|
3458
3683
|
{
|
|
3459
3684
|
searchPlaceholder,
|
|
@@ -3473,23 +3698,23 @@ function EntitySelect(props) {
|
|
|
3473
3698
|
}
|
|
3474
3699
|
)
|
|
3475
3700
|
] }),
|
|
3476
|
-
error && /* @__PURE__ */
|
|
3701
|
+
error && /* @__PURE__ */ jsx32("p", { className: "text-sm font-medium text-destructive", children: error })
|
|
3477
3702
|
] });
|
|
3478
3703
|
}
|
|
3479
3704
|
|
|
3480
3705
|
// src/EntityTree/EntityTree.tsx
|
|
3481
3706
|
import {
|
|
3482
|
-
forwardRef as
|
|
3707
|
+
forwardRef as forwardRef21,
|
|
3483
3708
|
useImperativeHandle as useImperativeHandle2,
|
|
3484
3709
|
useMemo as useMemo4,
|
|
3485
3710
|
useRef as useRef6
|
|
3486
3711
|
} from "react";
|
|
3487
3712
|
import { Pencil } from "lucide-react";
|
|
3488
|
-
import { cn as
|
|
3713
|
+
import { cn as cn30 } from "@petrarca/sonnet-core";
|
|
3489
3714
|
|
|
3490
3715
|
// src/TreeView/TreeView.tsx
|
|
3491
3716
|
import {
|
|
3492
|
-
forwardRef as
|
|
3717
|
+
forwardRef as forwardRef20,
|
|
3493
3718
|
useCallback as useCallback4,
|
|
3494
3719
|
useEffect as useEffect5,
|
|
3495
3720
|
useId as useId2,
|
|
@@ -3499,8 +3724,8 @@ import {
|
|
|
3499
3724
|
useState as useState5
|
|
3500
3725
|
} from "react";
|
|
3501
3726
|
import { ChevronRight as ChevronRight3 } from "lucide-react";
|
|
3502
|
-
import { cn as
|
|
3503
|
-
import { jsx as
|
|
3727
|
+
import { cn as cn29 } from "@petrarca/sonnet-core";
|
|
3728
|
+
import { jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3504
3729
|
function flatten(nodes, expandedIds, depth = 0, parentId = null, result = []) {
|
|
3505
3730
|
for (const node of nodes) {
|
|
3506
3731
|
result.push({ node, depth, parentId });
|
|
@@ -3517,15 +3742,15 @@ function ToggleIcon({
|
|
|
3517
3742
|
isExpanded
|
|
3518
3743
|
}) {
|
|
3519
3744
|
if (!hasChildren) {
|
|
3520
|
-
return /* @__PURE__ */
|
|
3745
|
+
return /* @__PURE__ */ jsx33("span", { className: "block w-1.5 h-1.5 rounded-full bg-border mx-auto" });
|
|
3521
3746
|
}
|
|
3522
3747
|
if (isLoading) {
|
|
3523
|
-
return /* @__PURE__ */
|
|
3748
|
+
return /* @__PURE__ */ jsx33("span", { className: "block w-3 h-3 rounded-full border-2 border-muted-foreground/40 border-t-foreground animate-spin" });
|
|
3524
3749
|
}
|
|
3525
|
-
return /* @__PURE__ */
|
|
3750
|
+
return /* @__PURE__ */ jsx33(
|
|
3526
3751
|
ChevronRight3,
|
|
3527
3752
|
{
|
|
3528
|
-
className:
|
|
3753
|
+
className: cn29(
|
|
3529
3754
|
"h-3.5 w-3.5 text-muted-foreground transition-transform",
|
|
3530
3755
|
isExpanded && "rotate-90"
|
|
3531
3756
|
)
|
|
@@ -3580,7 +3805,7 @@ function NodeRow({
|
|
|
3580
3805
|
"aria-selected": onSelectionChange ? isSelected : void 0,
|
|
3581
3806
|
"aria-busy": node.isLoading,
|
|
3582
3807
|
tabIndex: isFocused ? 0 : -1,
|
|
3583
|
-
className:
|
|
3808
|
+
className: cn29(
|
|
3584
3809
|
"flex items-center gap-1 px-2 py-1.5 rounded-sm text-sm select-none",
|
|
3585
3810
|
"cursor-pointer transition-colors",
|
|
3586
3811
|
"hover:bg-accent/60",
|
|
@@ -3590,13 +3815,13 @@ function NodeRow({
|
|
|
3590
3815
|
style: { paddingLeft: depth * indentPx + 8 },
|
|
3591
3816
|
onClick: handleClick,
|
|
3592
3817
|
children: [
|
|
3593
|
-
/* @__PURE__ */
|
|
3818
|
+
/* @__PURE__ */ jsx33(
|
|
3594
3819
|
"span",
|
|
3595
3820
|
{
|
|
3596
3821
|
className: "shrink-0 flex items-center justify-center w-4 h-4",
|
|
3597
3822
|
onClick: handleToggle,
|
|
3598
3823
|
"aria-hidden": true,
|
|
3599
|
-
children: /* @__PURE__ */
|
|
3824
|
+
children: /* @__PURE__ */ jsx33(
|
|
3600
3825
|
ToggleIcon,
|
|
3601
3826
|
{
|
|
3602
3827
|
hasChildren: node.hasChildren,
|
|
@@ -3606,7 +3831,7 @@ function NodeRow({
|
|
|
3606
3831
|
)
|
|
3607
3832
|
}
|
|
3608
3833
|
),
|
|
3609
|
-
onSelectionChange && isSelectable && /* @__PURE__ */
|
|
3834
|
+
onSelectionChange && isSelectable && /* @__PURE__ */ jsx33(
|
|
3610
3835
|
"input",
|
|
3611
3836
|
{
|
|
3612
3837
|
type: "checkbox",
|
|
@@ -3618,8 +3843,8 @@ function NodeRow({
|
|
|
3618
3843
|
tabIndex: -1
|
|
3619
3844
|
}
|
|
3620
3845
|
),
|
|
3621
|
-
/* @__PURE__ */
|
|
3622
|
-
node.isError && /* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ jsx33("span", { className: "flex-1 min-w-0", children: renderNode(node, depth) }),
|
|
3847
|
+
node.isError && /* @__PURE__ */ jsx33("span", { className: "shrink-0 text-xs text-destructive", "aria-live": "polite", children: "Failed to load" })
|
|
3623
3848
|
]
|
|
3624
3849
|
}
|
|
3625
3850
|
);
|
|
@@ -3795,10 +4020,10 @@ function TreeViewInner({
|
|
|
3795
4020
|
]
|
|
3796
4021
|
);
|
|
3797
4022
|
if (nodes.length === 0) {
|
|
3798
|
-
return /* @__PURE__ */
|
|
4023
|
+
return /* @__PURE__ */ jsx33(
|
|
3799
4024
|
"div",
|
|
3800
4025
|
{
|
|
3801
|
-
className:
|
|
4026
|
+
className: cn29(
|
|
3802
4027
|
"py-8 text-center text-sm text-muted-foreground",
|
|
3803
4028
|
className
|
|
3804
4029
|
),
|
|
@@ -3806,15 +4031,15 @@ function TreeViewInner({
|
|
|
3806
4031
|
}
|
|
3807
4032
|
);
|
|
3808
4033
|
}
|
|
3809
|
-
return /* @__PURE__ */
|
|
4034
|
+
return /* @__PURE__ */ jsx33(
|
|
3810
4035
|
"ul",
|
|
3811
4036
|
{
|
|
3812
4037
|
ref: listRef,
|
|
3813
4038
|
role: "tree",
|
|
3814
4039
|
"aria-label": "Tree",
|
|
3815
|
-
className:
|
|
4040
|
+
className: cn29("outline-none", className),
|
|
3816
4041
|
onKeyDown: handleKeyDown,
|
|
3817
|
-
children: flatNodes.map((flat) => /* @__PURE__ */
|
|
4042
|
+
children: flatNodes.map((flat) => /* @__PURE__ */ jsx33(
|
|
3818
4043
|
NodeRow,
|
|
3819
4044
|
{
|
|
3820
4045
|
flat,
|
|
@@ -3836,10 +4061,10 @@ function TreeViewInner({
|
|
|
3836
4061
|
}
|
|
3837
4062
|
);
|
|
3838
4063
|
}
|
|
3839
|
-
var TreeView =
|
|
4064
|
+
var TreeView = forwardRef20(TreeViewInner);
|
|
3840
4065
|
|
|
3841
4066
|
// src/EntityTree/EntityTree.tsx
|
|
3842
|
-
import { jsx as
|
|
4067
|
+
import { jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3843
4068
|
function buildCellRow(resolved, activeNodeIdRef, onNodeEdit, localRenderers) {
|
|
3844
4069
|
return function renderCells(node) {
|
|
3845
4070
|
const isActive = node.id === activeNodeIdRef.current;
|
|
@@ -3850,12 +4075,12 @@ function buildCellRow(resolved, activeNodeIdRef, onNodeEdit, localRenderers) {
|
|
|
3850
4075
|
localRenderers
|
|
3851
4076
|
);
|
|
3852
4077
|
const value = node.data[col.key];
|
|
3853
|
-
return /* @__PURE__ */
|
|
4078
|
+
return /* @__PURE__ */ jsx34(
|
|
3854
4079
|
"span",
|
|
3855
4080
|
{
|
|
3856
4081
|
className: "shrink-0",
|
|
3857
4082
|
style: col.width !== void 0 ? { width: col.width } : void 0,
|
|
3858
|
-
children: /* @__PURE__ */
|
|
4083
|
+
children: /* @__PURE__ */ jsx34(
|
|
3859
4084
|
Renderer,
|
|
3860
4085
|
{
|
|
3861
4086
|
value,
|
|
@@ -3867,7 +4092,7 @@ function buildCellRow(resolved, activeNodeIdRef, onNodeEdit, localRenderers) {
|
|
|
3867
4092
|
col.key
|
|
3868
4093
|
);
|
|
3869
4094
|
}),
|
|
3870
|
-
onNodeEdit && /* @__PURE__ */
|
|
4095
|
+
onNodeEdit && /* @__PURE__ */ jsx34("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ jsx34(
|
|
3871
4096
|
"button",
|
|
3872
4097
|
{
|
|
3873
4098
|
type: "button",
|
|
@@ -3876,11 +4101,11 @@ function buildCellRow(resolved, activeNodeIdRef, onNodeEdit, localRenderers) {
|
|
|
3876
4101
|
onNodeEdit(node);
|
|
3877
4102
|
},
|
|
3878
4103
|
"aria-label": "Edit",
|
|
3879
|
-
className:
|
|
4104
|
+
className: cn30(
|
|
3880
4105
|
"p-1 rounded hover:bg-background text-muted-foreground hover:text-foreground transition-colors",
|
|
3881
4106
|
isActive ? "opacity-100" : "opacity-0 group-hover/row:opacity-100"
|
|
3882
4107
|
),
|
|
3883
|
-
children: /* @__PURE__ */
|
|
4108
|
+
children: /* @__PURE__ */ jsx34(Pencil, { className: "h-3.5 w-3.5" })
|
|
3884
4109
|
}
|
|
3885
4110
|
) })
|
|
3886
4111
|
] });
|
|
@@ -3903,10 +4128,10 @@ function renderTreeStatus({
|
|
|
3903
4128
|
className
|
|
3904
4129
|
}) {
|
|
3905
4130
|
if (isLoading && nodes.length === 0) {
|
|
3906
|
-
return /* @__PURE__ */
|
|
4131
|
+
return /* @__PURE__ */ jsx34(
|
|
3907
4132
|
"div",
|
|
3908
4133
|
{
|
|
3909
|
-
className:
|
|
4134
|
+
className: cn30(
|
|
3910
4135
|
"py-8 text-center text-sm text-muted-foreground",
|
|
3911
4136
|
className
|
|
3912
4137
|
),
|
|
@@ -3915,10 +4140,10 @@ function renderTreeStatus({
|
|
|
3915
4140
|
);
|
|
3916
4141
|
}
|
|
3917
4142
|
if (isError) {
|
|
3918
|
-
return /* @__PURE__ */
|
|
4143
|
+
return /* @__PURE__ */ jsx34(
|
|
3919
4144
|
"div",
|
|
3920
4145
|
{
|
|
3921
|
-
className:
|
|
4146
|
+
className: cn30("py-8 text-center text-sm text-destructive", className),
|
|
3922
4147
|
children: errorMessage ?? `Failed to load ${entityLabel}.`
|
|
3923
4148
|
}
|
|
3924
4149
|
);
|
|
@@ -3927,7 +4152,7 @@ function renderTreeStatus({
|
|
|
3927
4152
|
return /* @__PURE__ */ jsxs13(
|
|
3928
4153
|
"div",
|
|
3929
4154
|
{
|
|
3930
|
-
className:
|
|
4155
|
+
className: cn30(
|
|
3931
4156
|
"py-8 text-center text-sm text-muted-foreground",
|
|
3932
4157
|
className
|
|
3933
4158
|
),
|
|
@@ -4019,7 +4244,7 @@ function EntityTreeInner(props, ref) {
|
|
|
4019
4244
|
className
|
|
4020
4245
|
});
|
|
4021
4246
|
if (statusView) return statusView;
|
|
4022
|
-
return /* @__PURE__ */
|
|
4247
|
+
return /* @__PURE__ */ jsx34("div", { className: cn30("rounded-lg border", className), children: /* @__PURE__ */ jsx34(
|
|
4023
4248
|
TreeView,
|
|
4024
4249
|
{
|
|
4025
4250
|
ref: treeRef,
|
|
@@ -4038,12 +4263,12 @@ function EntityTreeInner(props, ref) {
|
|
|
4038
4263
|
}
|
|
4039
4264
|
) });
|
|
4040
4265
|
}
|
|
4041
|
-
var EntityTree =
|
|
4266
|
+
var EntityTree = forwardRef21(EntityTreeInner);
|
|
4042
4267
|
|
|
4043
4268
|
// src/SearchInput/SearchInput.tsx
|
|
4044
|
-
import
|
|
4045
|
-
import { Search as Search2, X as
|
|
4046
|
-
import { cn as
|
|
4269
|
+
import React33, { useMemo as useMemo6, useRef as useRef9, useState as useState8, useEffect as useEffect9 } from "react";
|
|
4270
|
+
import { Search as Search2, X as X4, ChevronDown } from "lucide-react";
|
|
4271
|
+
import { cn as cn32 } from "@petrarca/sonnet-core";
|
|
4047
4272
|
import { getFieldTitle as getFieldTitle2 } from "@petrarca/sonnet-core/schema";
|
|
4048
4273
|
import { isEmptyFilterExpr } from "@petrarca/sonnet-core/search";
|
|
4049
4274
|
|
|
@@ -4351,7 +4576,7 @@ function useSearchInput({
|
|
|
4351
4576
|
|
|
4352
4577
|
// src/SearchInput/widgets/TextSearchWidget.tsx
|
|
4353
4578
|
import { useRef as useRef8, useEffect as useEffect7 } from "react";
|
|
4354
|
-
import { jsx as
|
|
4579
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
4355
4580
|
function TextSearchWidget({
|
|
4356
4581
|
value,
|
|
4357
4582
|
onChange,
|
|
@@ -4364,7 +4589,7 @@ function TextSearchWidget({
|
|
|
4364
4589
|
useEffect7(() => {
|
|
4365
4590
|
if (autoFocus) inputRef.current?.focus();
|
|
4366
4591
|
}, [autoFocus]);
|
|
4367
|
-
return /* @__PURE__ */
|
|
4592
|
+
return /* @__PURE__ */ jsx35(
|
|
4368
4593
|
Input,
|
|
4369
4594
|
{
|
|
4370
4595
|
ref: inputRef,
|
|
@@ -4391,8 +4616,8 @@ function TextSearchWidget({
|
|
|
4391
4616
|
|
|
4392
4617
|
// src/SearchInput/widgets/EnumSearchWidget.tsx
|
|
4393
4618
|
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
4394
|
-
import { cn as
|
|
4395
|
-
import { jsx as
|
|
4619
|
+
import { cn as cn31 } from "@petrarca/sonnet-core";
|
|
4620
|
+
import { jsx as jsx36, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4396
4621
|
function EnumSearchWidget({
|
|
4397
4622
|
property,
|
|
4398
4623
|
options: widgetOptions,
|
|
@@ -4457,7 +4682,7 @@ function EnumSearchWidget({
|
|
|
4457
4682
|
}
|
|
4458
4683
|
}
|
|
4459
4684
|
return /* @__PURE__ */ jsxs14(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
4460
|
-
/* @__PURE__ */
|
|
4685
|
+
/* @__PURE__ */ jsx36(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx36(
|
|
4461
4686
|
"button",
|
|
4462
4687
|
{
|
|
4463
4688
|
type: "button",
|
|
@@ -4473,7 +4698,7 @@ function EnumSearchWidget({
|
|
|
4473
4698
|
align: "start",
|
|
4474
4699
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
4475
4700
|
children: [
|
|
4476
|
-
/* @__PURE__ */
|
|
4701
|
+
/* @__PURE__ */ jsx36(
|
|
4477
4702
|
"input",
|
|
4478
4703
|
{
|
|
4479
4704
|
autoFocus: true,
|
|
@@ -4485,12 +4710,12 @@ function EnumSearchWidget({
|
|
|
4485
4710
|
}
|
|
4486
4711
|
),
|
|
4487
4712
|
/* @__PURE__ */ jsxs14("div", { children: [
|
|
4488
|
-
filtered.length === 0 && /* @__PURE__ */
|
|
4489
|
-
filtered.map((item, i) => /* @__PURE__ */
|
|
4713
|
+
filtered.length === 0 && /* @__PURE__ */ jsx36("p", { className: "px-2 py-1.5 text-sm text-muted-foreground", children: "No matches" }),
|
|
4714
|
+
filtered.map((item, i) => /* @__PURE__ */ jsx36(
|
|
4490
4715
|
"button",
|
|
4491
4716
|
{
|
|
4492
4717
|
type: "button",
|
|
4493
|
-
className:
|
|
4718
|
+
className: cn31(
|
|
4494
4719
|
"w-full text-left px-2 py-1.5 text-sm rounded transition-colors",
|
|
4495
4720
|
i === highlightedIndex ? "bg-accent text-accent-foreground" : "hover:bg-accent hover:text-accent-foreground"
|
|
4496
4721
|
),
|
|
@@ -4529,7 +4754,7 @@ var DEFAULT_SEARCH_WIDGETS = {
|
|
|
4529
4754
|
};
|
|
4530
4755
|
|
|
4531
4756
|
// src/SearchInput/SearchInput.tsx
|
|
4532
|
-
import { Fragment as Fragment3, jsx as
|
|
4757
|
+
import { Fragment as Fragment3, jsx as jsx37, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4533
4758
|
function resolveSearchDefaults(props) {
|
|
4534
4759
|
return {
|
|
4535
4760
|
mode: props.mode ?? "explicit",
|
|
@@ -4550,7 +4775,7 @@ function FacetPicker({
|
|
|
4550
4775
|
inputRef
|
|
4551
4776
|
}) {
|
|
4552
4777
|
return /* @__PURE__ */ jsxs15(Popover, { open: pickerVisible, onOpenChange: setPickerOpen, modal: false, children: [
|
|
4553
|
-
/* @__PURE__ */
|
|
4778
|
+
/* @__PURE__ */ jsx37(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx37(
|
|
4554
4779
|
"button",
|
|
4555
4780
|
{
|
|
4556
4781
|
type: "button",
|
|
@@ -4561,21 +4786,21 @@ function FacetPicker({
|
|
|
4561
4786
|
setPickerOpen((o) => !o);
|
|
4562
4787
|
inputRef.current?.focus();
|
|
4563
4788
|
},
|
|
4564
|
-
children: /* @__PURE__ */
|
|
4789
|
+
children: /* @__PURE__ */ jsx37(ChevronDown, { className: "h-3 w-3" })
|
|
4565
4790
|
}
|
|
4566
4791
|
) }),
|
|
4567
|
-
/* @__PURE__ */
|
|
4792
|
+
/* @__PURE__ */ jsx37(
|
|
4568
4793
|
PopoverContent,
|
|
4569
4794
|
{
|
|
4570
|
-
className:
|
|
4795
|
+
className: cn32("w-44 p-1", !hasFacetsToShow && "hidden"),
|
|
4571
4796
|
align: "start",
|
|
4572
4797
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
4573
4798
|
onFocusOutside: (e) => e.preventDefault(),
|
|
4574
|
-
children: filteredFacets.map((facet, i) => /* @__PURE__ */
|
|
4799
|
+
children: filteredFacets.map((facet, i) => /* @__PURE__ */ jsx37(
|
|
4575
4800
|
"button",
|
|
4576
4801
|
{
|
|
4577
4802
|
type: "button",
|
|
4578
|
-
className:
|
|
4803
|
+
className: cn32(
|
|
4579
4804
|
"w-full text-left px-2 py-1.5 text-sm rounded transition-colors",
|
|
4580
4805
|
i === highlightedIndex ? "bg-accent text-accent-foreground" : "hover:bg-accent hover:text-accent-foreground"
|
|
4581
4806
|
),
|
|
@@ -4609,7 +4834,7 @@ function ValueEntry({
|
|
|
4609
4834
|
onInputFocus
|
|
4610
4835
|
}) {
|
|
4611
4836
|
if (pendingFacet && PendingWidget) {
|
|
4612
|
-
return /* @__PURE__ */
|
|
4837
|
+
return /* @__PURE__ */ jsx37(
|
|
4613
4838
|
PendingWidget,
|
|
4614
4839
|
{
|
|
4615
4840
|
property: pendingFacet.property,
|
|
@@ -4631,7 +4856,7 @@ function ValueEntry({
|
|
|
4631
4856
|
}
|
|
4632
4857
|
);
|
|
4633
4858
|
}
|
|
4634
|
-
return /* @__PURE__ */
|
|
4859
|
+
return /* @__PURE__ */ jsx37(
|
|
4635
4860
|
Input,
|
|
4636
4861
|
{
|
|
4637
4862
|
ref: inputRef,
|
|
@@ -4700,10 +4925,10 @@ function ActiveChips({
|
|
|
4700
4925
|
schema,
|
|
4701
4926
|
onRemove
|
|
4702
4927
|
}) {
|
|
4703
|
-
return /* @__PURE__ */
|
|
4928
|
+
return /* @__PURE__ */ jsx37(Fragment3, { children: terms.map((term, i) => {
|
|
4704
4929
|
const property = schema?.properties?.[term.key];
|
|
4705
4930
|
const label = property ? getFieldTitle2(term.key, property) : term.key;
|
|
4706
|
-
return /* @__PURE__ */
|
|
4931
|
+
return /* @__PURE__ */ jsx37(
|
|
4707
4932
|
FilterChip,
|
|
4708
4933
|
{
|
|
4709
4934
|
label: `${label}: ${term.value}`,
|
|
@@ -4728,7 +4953,7 @@ function SearchActions({
|
|
|
4728
4953
|
onCommit
|
|
4729
4954
|
}) {
|
|
4730
4955
|
return /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
4731
|
-
!isEmpty && /* @__PURE__ */
|
|
4956
|
+
!isEmpty && /* @__PURE__ */ jsx37(
|
|
4732
4957
|
"button",
|
|
4733
4958
|
{
|
|
4734
4959
|
type: "button",
|
|
@@ -4738,10 +4963,10 @@ function SearchActions({
|
|
|
4738
4963
|
},
|
|
4739
4964
|
className: "text-muted-foreground hover:text-foreground transition-colors shrink-0",
|
|
4740
4965
|
"aria-label": "Clear search",
|
|
4741
|
-
children: /* @__PURE__ */
|
|
4966
|
+
children: /* @__PURE__ */ jsx37(X4, { className: "h-4 w-4" })
|
|
4742
4967
|
}
|
|
4743
4968
|
),
|
|
4744
|
-
showSearchButton && mode === "explicit" && /* @__PURE__ */
|
|
4969
|
+
showSearchButton && mode === "explicit" && /* @__PURE__ */ jsx37(
|
|
4745
4970
|
Button,
|
|
4746
4971
|
{
|
|
4747
4972
|
type: "button",
|
|
@@ -4826,7 +5051,7 @@ function SearchInput(props) {
|
|
|
4826
5051
|
const showFacetControls = isFaceted && !pendingFacet;
|
|
4827
5052
|
const pickerVisible = showFacetControls && pickerOpen;
|
|
4828
5053
|
const hasFacetsToShow = pickerVisible && filteredFacets.length > 0;
|
|
4829
|
-
const acceptFacet =
|
|
5054
|
+
const acceptFacet = React33.useCallback(
|
|
4830
5055
|
(facet) => {
|
|
4831
5056
|
selectFacet(facet);
|
|
4832
5057
|
setPickerOpen(false);
|
|
@@ -4854,7 +5079,7 @@ function SearchInput(props) {
|
|
|
4854
5079
|
"div",
|
|
4855
5080
|
{
|
|
4856
5081
|
ref: containerRef,
|
|
4857
|
-
className:
|
|
5082
|
+
className: cn32(
|
|
4858
5083
|
"flex flex-wrap items-center gap-1.5 rounded-md border border-input bg-background px-2 py-1.5 text-sm min-h-9",
|
|
4859
5084
|
disabled ? "opacity-50 cursor-not-allowed" : "cursor-text",
|
|
4860
5085
|
className
|
|
@@ -4867,8 +5092,8 @@ function SearchInput(props) {
|
|
|
4867
5092
|
}
|
|
4868
5093
|
},
|
|
4869
5094
|
children: [
|
|
4870
|
-
/* @__PURE__ */
|
|
4871
|
-
isFaceted && /* @__PURE__ */
|
|
5095
|
+
/* @__PURE__ */ jsx37(Search2, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
5096
|
+
isFaceted && /* @__PURE__ */ jsx37(
|
|
4872
5097
|
ActiveChips,
|
|
4873
5098
|
{
|
|
4874
5099
|
terms: activeTerms,
|
|
@@ -4881,7 +5106,7 @@ function SearchInput(props) {
|
|
|
4881
5106
|
":"
|
|
4882
5107
|
] }),
|
|
4883
5108
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1 flex-1 min-w-[120px]", children: [
|
|
4884
|
-
showFacetControls && /* @__PURE__ */
|
|
5109
|
+
showFacetControls && /* @__PURE__ */ jsx37(
|
|
4885
5110
|
FacetPicker,
|
|
4886
5111
|
{
|
|
4887
5112
|
pickerVisible,
|
|
@@ -4894,7 +5119,7 @@ function SearchInput(props) {
|
|
|
4894
5119
|
inputRef
|
|
4895
5120
|
}
|
|
4896
5121
|
),
|
|
4897
|
-
/* @__PURE__ */
|
|
5122
|
+
/* @__PURE__ */ jsx37(
|
|
4898
5123
|
ValueEntry,
|
|
4899
5124
|
{
|
|
4900
5125
|
pendingFacet,
|
|
@@ -4918,7 +5143,7 @@ function SearchInput(props) {
|
|
|
4918
5143
|
}
|
|
4919
5144
|
)
|
|
4920
5145
|
] }),
|
|
4921
|
-
/* @__PURE__ */
|
|
5146
|
+
/* @__PURE__ */ jsx37(
|
|
4922
5147
|
SearchActions,
|
|
4923
5148
|
{
|
|
4924
5149
|
isEmpty,
|
|
@@ -4940,7 +5165,7 @@ function FilterChip({ label, onRemove }) {
|
|
|
4940
5165
|
className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full",
|
|
4941
5166
|
children: [
|
|
4942
5167
|
label,
|
|
4943
|
-
/* @__PURE__ */
|
|
5168
|
+
/* @__PURE__ */ jsx37(
|
|
4944
5169
|
"button",
|
|
4945
5170
|
{
|
|
4946
5171
|
type: "button",
|
|
@@ -4950,7 +5175,7 @@ function FilterChip({ label, onRemove }) {
|
|
|
4950
5175
|
},
|
|
4951
5176
|
className: "ml-0.5 hover:text-destructive transition-colors",
|
|
4952
5177
|
"aria-label": `Remove filter ${label}`,
|
|
4953
|
-
children: /* @__PURE__ */
|
|
5178
|
+
children: /* @__PURE__ */ jsx37(X4, { className: "h-3 w-3" })
|
|
4954
5179
|
}
|
|
4955
5180
|
)
|
|
4956
5181
|
]
|
|
@@ -4960,9 +5185,9 @@ function FilterChip({ label, onRemove }) {
|
|
|
4960
5185
|
|
|
4961
5186
|
// src/Clipboard/ClipboardButton.tsx
|
|
4962
5187
|
import { Copy } from "lucide-react";
|
|
4963
|
-
import { jsx as
|
|
5188
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
4964
5189
|
function ClipboardButton({ hasItems, onClick }) {
|
|
4965
|
-
return /* @__PURE__ */
|
|
5190
|
+
return /* @__PURE__ */ jsx38(
|
|
4966
5191
|
Button,
|
|
4967
5192
|
{
|
|
4968
5193
|
variant: "ghost",
|
|
@@ -4973,21 +5198,21 @@ function ClipboardButton({ hasItems, onClick }) {
|
|
|
4973
5198
|
opacity: hasItems ? 1 : 0.4,
|
|
4974
5199
|
cursor: hasItems ? "pointer" : "not-allowed"
|
|
4975
5200
|
},
|
|
4976
|
-
children: /* @__PURE__ */
|
|
5201
|
+
children: /* @__PURE__ */ jsx38(Copy, { size: 16 })
|
|
4977
5202
|
}
|
|
4978
5203
|
);
|
|
4979
5204
|
}
|
|
4980
5205
|
var ClipboardButton_default = ClipboardButton;
|
|
4981
5206
|
|
|
4982
5207
|
// src/Clipboard/ClipboardItem.tsx
|
|
4983
|
-
import { X as
|
|
4984
|
-
import { jsx as
|
|
5208
|
+
import { X as X5, Plus } from "lucide-react";
|
|
5209
|
+
import { jsx as jsx39, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4985
5210
|
function ClipboardItemComponent({ item, onAddItem, onRemove }) {
|
|
4986
5211
|
const handleAddClick = (e) => {
|
|
4987
5212
|
const keepInClipboard = e.shiftKey;
|
|
4988
5213
|
onAddItem(item, keepInClipboard);
|
|
4989
5214
|
};
|
|
4990
|
-
return /* @__PURE__ */
|
|
5215
|
+
return /* @__PURE__ */ jsx39(
|
|
4991
5216
|
"div",
|
|
4992
5217
|
{
|
|
4993
5218
|
className: "p-3 rounded mb-2",
|
|
@@ -4997,8 +5222,8 @@ function ClipboardItemComponent({ item, onAddItem, onRemove }) {
|
|
|
4997
5222
|
},
|
|
4998
5223
|
children: /* @__PURE__ */ jsxs16(SimpleGroup, { justify: "space-between", wrap: "nowrap", align: "flex-start", children: [
|
|
4999
5224
|
/* @__PURE__ */ jsxs16("div", { className: "flex-1 min-w-0 overflow-hidden", children: [
|
|
5000
|
-
/* @__PURE__ */
|
|
5001
|
-
/* @__PURE__ */
|
|
5225
|
+
/* @__PURE__ */ jsx39("p", { className: "text-sm font-semibold truncate", children: item.label }),
|
|
5226
|
+
/* @__PURE__ */ jsx39("p", { className: "text-xs text-muted-foreground truncate", children: item.displayName }),
|
|
5002
5227
|
/* @__PURE__ */ jsxs16("p", { className: "text-xs text-muted-foreground font-mono", children: [
|
|
5003
5228
|
"#",
|
|
5004
5229
|
item.entityId
|
|
@@ -5013,19 +5238,19 @@ function ClipboardItemComponent({ item, onAddItem, onRemove }) {
|
|
|
5013
5238
|
onClick: handleAddClick,
|
|
5014
5239
|
title: "Click to add and remove from clipboard, Shift+Click to keep in clipboard",
|
|
5015
5240
|
children: [
|
|
5016
|
-
/* @__PURE__ */
|
|
5241
|
+
/* @__PURE__ */ jsx39(Plus, { size: 16 }),
|
|
5017
5242
|
"Add"
|
|
5018
5243
|
]
|
|
5019
5244
|
}
|
|
5020
5245
|
),
|
|
5021
|
-
/* @__PURE__ */
|
|
5246
|
+
/* @__PURE__ */ jsx39(
|
|
5022
5247
|
Button,
|
|
5023
5248
|
{
|
|
5024
5249
|
size: "sm",
|
|
5025
5250
|
variant: "ghost",
|
|
5026
5251
|
onClick: () => onRemove(item.id),
|
|
5027
5252
|
title: "Remove from clipboard",
|
|
5028
|
-
children: /* @__PURE__ */
|
|
5253
|
+
children: /* @__PURE__ */ jsx39(X5, { size: 16 })
|
|
5029
5254
|
}
|
|
5030
5255
|
)
|
|
5031
5256
|
] })
|
|
@@ -5123,13 +5348,13 @@ var useClipboard = create()(
|
|
|
5123
5348
|
var clipboardStore_default = useClipboard;
|
|
5124
5349
|
|
|
5125
5350
|
// src/Clipboard/ClipboardMenu.tsx
|
|
5126
|
-
import { jsx as
|
|
5351
|
+
import { jsx as jsx40, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5127
5352
|
function ClipboardMenu({ onAddItem }) {
|
|
5128
5353
|
const { items, removeItem, clear } = clipboardStore_default();
|
|
5129
5354
|
if (items.length === 0) {
|
|
5130
5355
|
return /* @__PURE__ */ jsxs17("div", { style: { padding: "16px", textAlign: "center", width: "300px" }, children: [
|
|
5131
|
-
/* @__PURE__ */
|
|
5132
|
-
/* @__PURE__ */
|
|
5356
|
+
/* @__PURE__ */ jsx40("p", { className: "text-sm text-muted-foreground", children: "No items in clipboard" }),
|
|
5357
|
+
/* @__PURE__ */ jsx40("p", { className: "text-xs text-muted-foreground mt-1", children: 'Right-click a node and select "Copy"' })
|
|
5133
5358
|
] });
|
|
5134
5359
|
}
|
|
5135
5360
|
return /* @__PURE__ */ jsxs17(
|
|
@@ -5143,7 +5368,7 @@ function ClipboardMenu({ onAddItem }) {
|
|
|
5143
5368
|
maxHeight: "500px"
|
|
5144
5369
|
},
|
|
5145
5370
|
children: [
|
|
5146
|
-
/* @__PURE__ */
|
|
5371
|
+
/* @__PURE__ */ jsx40(ScrollArea, { className: "flex-1 p-3 min-h-0", children: /* @__PURE__ */ jsx40(SimpleStack, { gap: 0, children: items.map((item) => /* @__PURE__ */ jsx40(
|
|
5147
5372
|
ClipboardItem_default,
|
|
5148
5373
|
{
|
|
5149
5374
|
item,
|
|
@@ -5152,8 +5377,8 @@ function ClipboardMenu({ onAddItem }) {
|
|
|
5152
5377
|
},
|
|
5153
5378
|
item.id
|
|
5154
5379
|
)) }) }),
|
|
5155
|
-
/* @__PURE__ */
|
|
5156
|
-
/* @__PURE__ */
|
|
5380
|
+
/* @__PURE__ */ jsx40(Separator2, {}),
|
|
5381
|
+
/* @__PURE__ */ jsx40("div", { style: { padding: "8px 12px", flexShrink: 0 }, children: /* @__PURE__ */ jsxs17(
|
|
5157
5382
|
Button,
|
|
5158
5383
|
{
|
|
5159
5384
|
className: "w-full",
|
|
@@ -5161,7 +5386,7 @@ function ClipboardMenu({ onAddItem }) {
|
|
|
5161
5386
|
size: "sm",
|
|
5162
5387
|
onClick: clear,
|
|
5163
5388
|
children: [
|
|
5164
|
-
/* @__PURE__ */
|
|
5389
|
+
/* @__PURE__ */ jsx40(Trash2, { size: 16 }),
|
|
5165
5390
|
"Clear All (",
|
|
5166
5391
|
items.length,
|
|
5167
5392
|
")"
|
|
@@ -5233,6 +5458,7 @@ export {
|
|
|
5233
5458
|
EntitySelect,
|
|
5234
5459
|
EntityTable,
|
|
5235
5460
|
EntityTree,
|
|
5461
|
+
IconButton,
|
|
5236
5462
|
Input,
|
|
5237
5463
|
InputGroup,
|
|
5238
5464
|
InputGroupAddon,
|
|
@@ -5280,6 +5506,7 @@ export {
|
|
|
5280
5506
|
Tabs,
|
|
5281
5507
|
TabsContent,
|
|
5282
5508
|
TabsList,
|
|
5509
|
+
TabsSeparator,
|
|
5283
5510
|
TabsTrigger,
|
|
5284
5511
|
Textarea,
|
|
5285
5512
|
Tooltip,
|