analytica-frontend-lib 1.0.16 → 1.0.18
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.css +211 -0
- package/dist/index.d.mts +108 -2
- package/dist/index.d.ts +108 -2
- package/dist/index.js +337 -47
- package/dist/index.mjs +328 -39
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Button: () => Button,
|
|
24
|
+
CheckBox: () => CheckBox,
|
|
24
25
|
DropdownMenu: () => DropdownMenu,
|
|
25
26
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
26
27
|
IconButton: () => IconButton,
|
|
@@ -39,7 +40,11 @@ __export(index_exports, {
|
|
|
39
40
|
TableHead: () => TableHead,
|
|
40
41
|
TableHeader: () => TableHeader,
|
|
41
42
|
TableRow: () => TableRow,
|
|
42
|
-
Text: () => Text
|
|
43
|
+
Text: () => Text,
|
|
44
|
+
Toast: () => Toast,
|
|
45
|
+
Toaster: () => Toaster,
|
|
46
|
+
useToast: () => useToast,
|
|
47
|
+
useToastStore: () => useToastStore
|
|
43
48
|
});
|
|
44
49
|
module.exports = __toCommonJS(index_exports);
|
|
45
50
|
|
|
@@ -251,25 +256,305 @@ var Text = ({
|
|
|
251
256
|
);
|
|
252
257
|
};
|
|
253
258
|
|
|
254
|
-
// src/components/
|
|
255
|
-
var
|
|
259
|
+
// src/components/Toast/Toast.tsx
|
|
260
|
+
var import_phosphor_react = require("phosphor-react");
|
|
256
261
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
257
|
-
var
|
|
258
|
-
|
|
262
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
263
|
+
solid: {
|
|
264
|
+
warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
|
|
265
|
+
success: "bg-success text-success-800 border-none focus-visible:outline-none",
|
|
266
|
+
info: "bg-info text-info-800 border-none focus-visible:outline-none"
|
|
267
|
+
},
|
|
268
|
+
outlined: {
|
|
269
|
+
warning: "bg-warning text-warning-800 border border-warning-200 focus-visible:outline-none",
|
|
270
|
+
success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
|
|
271
|
+
info: "bg-info text-info-800 border border-info-200 focus-visible:outline-none"
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
var iconMap = {
|
|
275
|
+
success: import_phosphor_react.CheckCircle,
|
|
276
|
+
info: import_phosphor_react.Info,
|
|
277
|
+
warning: import_phosphor_react.WarningCircle
|
|
278
|
+
};
|
|
279
|
+
var Toast = ({
|
|
280
|
+
variant = "outlined",
|
|
281
|
+
action = "success",
|
|
282
|
+
className = "",
|
|
283
|
+
onClose,
|
|
284
|
+
title,
|
|
285
|
+
description,
|
|
286
|
+
position = "default",
|
|
287
|
+
...props
|
|
288
|
+
}) => {
|
|
289
|
+
const variantClasses = VARIANT_ACTION_CLASSES2[variant][action];
|
|
290
|
+
const positionClasses = {
|
|
291
|
+
"top-left": "fixed top-4 left-4",
|
|
292
|
+
"top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
|
|
293
|
+
"top-right": "fixed top-4 right-4",
|
|
294
|
+
"bottom-left": "fixed bottom-4 left-4",
|
|
295
|
+
"bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
|
|
296
|
+
"bottom-right": "fixed bottom-4 right-4",
|
|
297
|
+
default: ""
|
|
298
|
+
};
|
|
299
|
+
const IconAction = iconMap[action] || iconMap["success"];
|
|
300
|
+
const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
|
|
301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
role: "alert",
|
|
305
|
+
"aria-live": "assertive",
|
|
306
|
+
"aria-atomic": "true",
|
|
307
|
+
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
308
|
+
...props,
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-row items-start gap-3", children: [
|
|
311
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconAction, {}) }),
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col items-start justify-start", children: [
|
|
313
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "font-semibold text-md", children: title }),
|
|
314
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-md text-text-900", children: description })
|
|
315
|
+
] })
|
|
316
|
+
] }),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
318
|
+
"button",
|
|
319
|
+
{
|
|
320
|
+
onClick: onClose,
|
|
321
|
+
"aria-label": "Dismiss notification",
|
|
322
|
+
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
323
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react.X, {})
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// src/components/Toast/utils/ToastStore.ts
|
|
332
|
+
var import_zustand = require("zustand");
|
|
333
|
+
var useToastStore = (0, import_zustand.create)((set) => ({
|
|
334
|
+
toasts: [],
|
|
335
|
+
addToast: (toast) => {
|
|
336
|
+
const id = crypto.randomUUID();
|
|
337
|
+
set((state) => ({
|
|
338
|
+
toasts: [...state.toasts, { id, ...toast }]
|
|
339
|
+
}));
|
|
340
|
+
},
|
|
341
|
+
removeToast: (id) => {
|
|
342
|
+
set((state) => ({
|
|
343
|
+
toasts: state.toasts.filter((t) => t.id !== id)
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
}));
|
|
347
|
+
|
|
348
|
+
// src/components/Toast/utils/Toaster.tsx
|
|
349
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
350
|
+
var Toaster = () => {
|
|
351
|
+
const toasts = useToastStore((state) => state.toasts);
|
|
352
|
+
const removeToast = useToastStore((state) => state.removeToast);
|
|
353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
354
|
+
Toast,
|
|
355
|
+
{
|
|
356
|
+
title: toast.title,
|
|
357
|
+
description: toast.description,
|
|
358
|
+
variant: toast.variant,
|
|
359
|
+
action: toast.action,
|
|
360
|
+
position: toast.position,
|
|
361
|
+
onClose: () => removeToast(toast.id)
|
|
362
|
+
},
|
|
363
|
+
toast.id
|
|
364
|
+
)) });
|
|
365
|
+
};
|
|
366
|
+
var useToast = () => {
|
|
367
|
+
const addToast = useToastStore((state) => state.addToast);
|
|
368
|
+
const removeToast = useToastStore((state) => state.removeToast);
|
|
369
|
+
return { addToast, removeToast };
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
// src/components/CheckBox/CheckBox.tsx
|
|
373
|
+
var import_react2 = require("react");
|
|
374
|
+
var import_phosphor_react2 = require("phosphor-react");
|
|
375
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
376
|
+
var SIZE_CLASSES2 = {
|
|
377
|
+
small: {
|
|
378
|
+
checkbox: "w-4 h-4",
|
|
379
|
+
// 16px x 16px
|
|
380
|
+
textSize: "sm",
|
|
381
|
+
spacing: "gap-1.5",
|
|
382
|
+
// 6px
|
|
383
|
+
borderWidth: "border-2",
|
|
384
|
+
iconSize: 14,
|
|
385
|
+
// pixels for Phosphor icons
|
|
386
|
+
labelHeight: "h-[21px]"
|
|
387
|
+
},
|
|
388
|
+
medium: {
|
|
389
|
+
checkbox: "w-5 h-5",
|
|
390
|
+
// 20px x 20px
|
|
391
|
+
textSize: "md",
|
|
392
|
+
spacing: "gap-2",
|
|
393
|
+
// 8px
|
|
394
|
+
borderWidth: "border-2",
|
|
395
|
+
iconSize: 16,
|
|
396
|
+
// pixels for Phosphor icons
|
|
397
|
+
labelHeight: "h-6"
|
|
398
|
+
},
|
|
399
|
+
large: {
|
|
400
|
+
checkbox: "w-6 h-6",
|
|
401
|
+
// 24px x 24px
|
|
402
|
+
textSize: "lg",
|
|
403
|
+
spacing: "gap-2",
|
|
404
|
+
// 8px
|
|
405
|
+
borderWidth: "border-[3px]",
|
|
406
|
+
// 3px border
|
|
407
|
+
iconSize: 20,
|
|
408
|
+
// pixels for Phosphor icons
|
|
409
|
+
labelHeight: "h-[27px]"
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
413
|
+
var STATE_CLASSES = {
|
|
414
|
+
default: {
|
|
415
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
416
|
+
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
417
|
+
},
|
|
418
|
+
hovered: {
|
|
419
|
+
unchecked: "border-border-500 bg-background",
|
|
420
|
+
checked: "border-primary-800 bg-primary-800 text-text"
|
|
421
|
+
},
|
|
422
|
+
focused: {
|
|
423
|
+
unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
|
|
424
|
+
checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
|
|
425
|
+
},
|
|
426
|
+
invalid: {
|
|
427
|
+
unchecked: "border-error-700 bg-background hover:border-error-600",
|
|
428
|
+
checked: "border-error-700 bg-primary-950 text-text"
|
|
429
|
+
},
|
|
430
|
+
disabled: {
|
|
431
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
|
|
432
|
+
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
var CheckBox = (0, import_react2.forwardRef)(
|
|
436
|
+
({
|
|
437
|
+
label,
|
|
438
|
+
size = "medium",
|
|
439
|
+
state = "default",
|
|
440
|
+
indeterminate = false,
|
|
441
|
+
errorMessage,
|
|
442
|
+
helperText,
|
|
443
|
+
className = "",
|
|
444
|
+
labelClassName = "",
|
|
445
|
+
checked: checkedProp,
|
|
446
|
+
disabled,
|
|
447
|
+
id,
|
|
448
|
+
onChange,
|
|
449
|
+
...props
|
|
450
|
+
}, ref) => {
|
|
451
|
+
const generatedId = (0, import_react2.useId)();
|
|
452
|
+
const inputId = id ?? `checkbox-${generatedId}`;
|
|
453
|
+
const [internalChecked, setInternalChecked] = (0, import_react2.useState)(false);
|
|
454
|
+
const isControlled = checkedProp !== void 0;
|
|
455
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
456
|
+
const handleChange = (event) => {
|
|
457
|
+
if (!isControlled) {
|
|
458
|
+
setInternalChecked(event.target.checked);
|
|
459
|
+
}
|
|
460
|
+
onChange?.(event);
|
|
461
|
+
};
|
|
462
|
+
const currentState = disabled ? "disabled" : state;
|
|
463
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
464
|
+
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
465
|
+
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
466
|
+
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
467
|
+
const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
468
|
+
const renderIcon = () => {
|
|
469
|
+
if (indeterminate) {
|
|
470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
471
|
+
import_phosphor_react2.Minus,
|
|
472
|
+
{
|
|
473
|
+
size: sizeClasses.iconSize,
|
|
474
|
+
weight: "bold",
|
|
475
|
+
color: "currentColor"
|
|
476
|
+
}
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
if (checked) {
|
|
480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
481
|
+
import_phosphor_react2.Check,
|
|
482
|
+
{
|
|
483
|
+
size: sizeClasses.iconSize,
|
|
484
|
+
weight: "bold",
|
|
485
|
+
color: "currentColor"
|
|
486
|
+
}
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
return null;
|
|
490
|
+
};
|
|
491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col", children: [
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
493
|
+
"div",
|
|
494
|
+
{
|
|
495
|
+
className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
496
|
+
children: [
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
498
|
+
"input",
|
|
499
|
+
{
|
|
500
|
+
ref,
|
|
501
|
+
type: "checkbox",
|
|
502
|
+
id: inputId,
|
|
503
|
+
checked,
|
|
504
|
+
disabled,
|
|
505
|
+
onChange: handleChange,
|
|
506
|
+
className: "sr-only",
|
|
507
|
+
...props
|
|
508
|
+
}
|
|
509
|
+
),
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
511
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
512
|
+
"div",
|
|
513
|
+
{
|
|
514
|
+
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
515
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
516
|
+
Text,
|
|
517
|
+
{
|
|
518
|
+
as: "label",
|
|
519
|
+
htmlFor: inputId,
|
|
520
|
+
size: sizeClasses.textSize,
|
|
521
|
+
weight: "normal",
|
|
522
|
+
color: "black",
|
|
523
|
+
className: `cursor-pointer select-none leading-[150%] flex items-center font-roboto ${labelClassName}`,
|
|
524
|
+
children: label
|
|
525
|
+
}
|
|
526
|
+
)
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
]
|
|
530
|
+
}
|
|
531
|
+
),
|
|
532
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
|
|
533
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperText })
|
|
534
|
+
] });
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
CheckBox.displayName = "CheckBox";
|
|
538
|
+
|
|
539
|
+
// src/components/Table/Table.tsx
|
|
540
|
+
var import_react3 = require("react");
|
|
541
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
542
|
+
var Table = (0, import_react3.forwardRef)(
|
|
543
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
259
544
|
"table",
|
|
260
545
|
{
|
|
261
546
|
ref,
|
|
262
547
|
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
263
548
|
...props,
|
|
264
549
|
children: [
|
|
265
|
-
/* @__PURE__ */ (0,
|
|
550
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
266
551
|
children
|
|
267
552
|
]
|
|
268
553
|
}
|
|
269
554
|
) })
|
|
270
555
|
);
|
|
271
556
|
Table.displayName = "Table";
|
|
272
|
-
var TableHeader = (0,
|
|
557
|
+
var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
273
558
|
"thead",
|
|
274
559
|
{
|
|
275
560
|
ref,
|
|
@@ -278,7 +563,7 @@ var TableHeader = (0, import_react2.forwardRef)(({ className, ...props }, ref) =
|
|
|
278
563
|
}
|
|
279
564
|
));
|
|
280
565
|
TableHeader.displayName = "TableHeader";
|
|
281
|
-
var TableBody = (0,
|
|
566
|
+
var TableBody = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
282
567
|
"tbody",
|
|
283
568
|
{
|
|
284
569
|
ref,
|
|
@@ -287,7 +572,7 @@ var TableBody = (0, import_react2.forwardRef)(({ className, ...props }, ref) =>
|
|
|
287
572
|
}
|
|
288
573
|
));
|
|
289
574
|
TableBody.displayName = "TableBody";
|
|
290
|
-
var TableFooter = (0,
|
|
575
|
+
var TableFooter = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
291
576
|
"tfoot",
|
|
292
577
|
{
|
|
293
578
|
ref,
|
|
@@ -302,9 +587,9 @@ var VARIANT_STATES_ROW = {
|
|
|
302
587
|
invalid: "border-b-2 border-indicator-error",
|
|
303
588
|
disabled: "border-b border-border-100 bg-background-50 opacity-50 cursor-not-allowed"
|
|
304
589
|
};
|
|
305
|
-
var TableRow = (0,
|
|
590
|
+
var TableRow = (0, import_react3.forwardRef)(
|
|
306
591
|
({ state = "default", className, ...props }, ref) => {
|
|
307
|
-
return /* @__PURE__ */ (0,
|
|
592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
308
593
|
"tr",
|
|
309
594
|
{
|
|
310
595
|
ref,
|
|
@@ -321,7 +606,7 @@ var TableRow = (0, import_react2.forwardRef)(
|
|
|
321
606
|
}
|
|
322
607
|
);
|
|
323
608
|
TableRow.displayName = "TableRow";
|
|
324
|
-
var TableHead = (0,
|
|
609
|
+
var TableHead = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
325
610
|
"th",
|
|
326
611
|
{
|
|
327
612
|
ref,
|
|
@@ -330,7 +615,7 @@ var TableHead = (0, import_react2.forwardRef)(({ className, ...props }, ref) =>
|
|
|
330
615
|
}
|
|
331
616
|
));
|
|
332
617
|
TableHead.displayName = "TableHead";
|
|
333
|
-
var TableCell = (0,
|
|
618
|
+
var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
334
619
|
"td",
|
|
335
620
|
{
|
|
336
621
|
ref,
|
|
@@ -339,7 +624,7 @@ var TableCell = (0, import_react2.forwardRef)(({ className, ...props }, ref) =>
|
|
|
339
624
|
}
|
|
340
625
|
));
|
|
341
626
|
TableCell.displayName = "TableCell";
|
|
342
|
-
var TableCaption = (0,
|
|
627
|
+
var TableCaption = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
343
628
|
"caption",
|
|
344
629
|
{
|
|
345
630
|
ref,
|
|
@@ -350,23 +635,23 @@ var TableCaption = (0, import_react2.forwardRef)(({ className, ...props }, ref)
|
|
|
350
635
|
TableCaption.displayName = "TableCaption";
|
|
351
636
|
|
|
352
637
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
353
|
-
var
|
|
354
|
-
var
|
|
355
|
-
var DropdownMenuContext = (0,
|
|
638
|
+
var import_react4 = require("react");
|
|
639
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
640
|
+
var DropdownMenuContext = (0, import_react4.createContext)(
|
|
356
641
|
void 0
|
|
357
642
|
);
|
|
358
643
|
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
359
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
644
|
+
const [internalOpen, setInternalOpen] = (0, import_react4.useState)(false);
|
|
360
645
|
const isControlled = open !== void 0;
|
|
361
646
|
const currentOpen = isControlled ? open : internalOpen;
|
|
362
|
-
const setOpen = (0,
|
|
647
|
+
const setOpen = (0, import_react4.useCallback)(
|
|
363
648
|
(newOpen) => {
|
|
364
649
|
if (onOpenChange) onOpenChange(newOpen);
|
|
365
650
|
if (!isControlled) setInternalOpen(newOpen);
|
|
366
651
|
},
|
|
367
652
|
[isControlled, onOpenChange]
|
|
368
653
|
);
|
|
369
|
-
const menuRef = (0,
|
|
654
|
+
const menuRef = (0, import_react4.useRef)(null);
|
|
370
655
|
const handleEscape = (event) => {
|
|
371
656
|
if (event.key === "Escape") {
|
|
372
657
|
setOpen(false);
|
|
@@ -377,7 +662,7 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
377
662
|
setOpen(false);
|
|
378
663
|
}
|
|
379
664
|
};
|
|
380
|
-
(0,
|
|
665
|
+
(0, import_react4.useEffect)(() => {
|
|
381
666
|
if (currentOpen) {
|
|
382
667
|
document.addEventListener("mousedown", handleClickOutside);
|
|
383
668
|
document.addEventListener("keydown", handleEscape);
|
|
@@ -387,18 +672,18 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
387
672
|
document.removeEventListener("keydown", handleEscape);
|
|
388
673
|
};
|
|
389
674
|
}, [currentOpen]);
|
|
390
|
-
const value = (0,
|
|
675
|
+
const value = (0, import_react4.useMemo)(
|
|
391
676
|
() => ({ open: currentOpen, setOpen }),
|
|
392
677
|
[currentOpen, setOpen]
|
|
393
678
|
);
|
|
394
|
-
return /* @__PURE__ */ (0,
|
|
679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative", ref: menuRef, children }) });
|
|
395
680
|
};
|
|
396
|
-
var DropdownMenuTrigger = (0,
|
|
397
|
-
const context = (0,
|
|
681
|
+
var DropdownMenuTrigger = (0, import_react4.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
682
|
+
const context = (0, import_react4.useContext)(DropdownMenuContext);
|
|
398
683
|
if (!context)
|
|
399
684
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
400
685
|
const { open, setOpen } = context;
|
|
401
|
-
return /* @__PURE__ */ (0,
|
|
686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
402
687
|
"button",
|
|
403
688
|
{
|
|
404
689
|
ref,
|
|
@@ -430,7 +715,7 @@ var ALIGN_CLASSES = {
|
|
|
430
715
|
center: "left-1/2 -translate-x-1/2",
|
|
431
716
|
end: "right-0"
|
|
432
717
|
};
|
|
433
|
-
var MenuLabel = (0,
|
|
718
|
+
var MenuLabel = (0, import_react4.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
434
719
|
"fieldset",
|
|
435
720
|
{
|
|
436
721
|
ref,
|
|
@@ -440,7 +725,7 @@ var MenuLabel = (0, import_react3.forwardRef)(({ className, inset, ...props }, r
|
|
|
440
725
|
}
|
|
441
726
|
));
|
|
442
727
|
MenuLabel.displayName = "MenuLabel";
|
|
443
|
-
var MenuContent = (0,
|
|
728
|
+
var MenuContent = (0, import_react4.forwardRef)(
|
|
444
729
|
({
|
|
445
730
|
className,
|
|
446
731
|
align = "start",
|
|
@@ -449,9 +734,9 @@ var MenuContent = (0, import_react3.forwardRef)(
|
|
|
449
734
|
children,
|
|
450
735
|
...props
|
|
451
736
|
}, ref) => {
|
|
452
|
-
const { open } = (0,
|
|
453
|
-
const [isVisible, setIsVisible] = (0,
|
|
454
|
-
(0,
|
|
737
|
+
const { open } = (0, import_react4.useContext)(DropdownMenuContext);
|
|
738
|
+
const [isVisible, setIsVisible] = (0, import_react4.useState)(open);
|
|
739
|
+
(0, import_react4.useEffect)(() => {
|
|
455
740
|
if (open) {
|
|
456
741
|
setIsVisible(true);
|
|
457
742
|
} else {
|
|
@@ -465,7 +750,7 @@ var MenuContent = (0, import_react3.forwardRef)(
|
|
|
465
750
|
const horizontal = ALIGN_CLASSES[align];
|
|
466
751
|
return `absolute ${vertical} ${horizontal}`;
|
|
467
752
|
};
|
|
468
|
-
return /* @__PURE__ */ (0,
|
|
753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
469
754
|
"div",
|
|
470
755
|
{
|
|
471
756
|
ref,
|
|
@@ -489,7 +774,7 @@ var MenuContent = (0, import_react3.forwardRef)(
|
|
|
489
774
|
}
|
|
490
775
|
);
|
|
491
776
|
MenuContent.displayName = "MenuContent";
|
|
492
|
-
var MenuItem = (0,
|
|
777
|
+
var MenuItem = (0, import_react4.forwardRef)(
|
|
493
778
|
({
|
|
494
779
|
className,
|
|
495
780
|
inset,
|
|
@@ -510,7 +795,7 @@ var MenuItem = (0, import_react3.forwardRef)(
|
|
|
510
795
|
}
|
|
511
796
|
onClick?.(e);
|
|
512
797
|
};
|
|
513
|
-
return /* @__PURE__ */ (0,
|
|
798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
514
799
|
"div",
|
|
515
800
|
{
|
|
516
801
|
ref,
|
|
@@ -539,7 +824,7 @@ var MenuItem = (0, import_react3.forwardRef)(
|
|
|
539
824
|
}
|
|
540
825
|
);
|
|
541
826
|
MenuItem.displayName = "MenuItem";
|
|
542
|
-
var MenuSeparator = (0,
|
|
827
|
+
var MenuSeparator = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
543
828
|
"div",
|
|
544
829
|
{
|
|
545
830
|
ref,
|
|
@@ -550,9 +835,9 @@ var MenuSeparator = (0, import_react3.forwardRef)(({ className, ...props }, ref)
|
|
|
550
835
|
MenuSeparator.displayName = "MenuSeparator";
|
|
551
836
|
|
|
552
837
|
// src/components/NavButton/NavButton.tsx
|
|
553
|
-
var
|
|
554
|
-
var
|
|
555
|
-
var NavButton = (0,
|
|
838
|
+
var import_react5 = require("react");
|
|
839
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
840
|
+
var NavButton = (0, import_react5.forwardRef)(
|
|
556
841
|
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
557
842
|
const baseClasses = [
|
|
558
843
|
"flex",
|
|
@@ -579,7 +864,7 @@ var NavButton = (0, import_react4.forwardRef)(
|
|
|
579
864
|
];
|
|
580
865
|
const stateClasses = selected ? ["bg-primary-50", "text-primary-950"] : [];
|
|
581
866
|
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
582
|
-
return /* @__PURE__ */ (0,
|
|
867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
583
868
|
"button",
|
|
584
869
|
{
|
|
585
870
|
ref,
|
|
@@ -589,8 +874,8 @@ var NavButton = (0, import_react4.forwardRef)(
|
|
|
589
874
|
"aria-pressed": selected,
|
|
590
875
|
...props,
|
|
591
876
|
children: [
|
|
592
|
-
/* @__PURE__ */ (0,
|
|
593
|
-
/* @__PURE__ */ (0,
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
594
879
|
]
|
|
595
880
|
}
|
|
596
881
|
);
|
|
@@ -599,9 +884,9 @@ var NavButton = (0, import_react4.forwardRef)(
|
|
|
599
884
|
NavButton.displayName = "NavButton";
|
|
600
885
|
|
|
601
886
|
// src/components/IconButton/IconButton.tsx
|
|
602
|
-
var
|
|
603
|
-
var
|
|
604
|
-
var IconButton = (0,
|
|
887
|
+
var import_react6 = require("react");
|
|
888
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
889
|
+
var IconButton = (0, import_react6.forwardRef)(
|
|
605
890
|
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
606
891
|
const baseClasses = [
|
|
607
892
|
"inline-flex",
|
|
@@ -633,7 +918,7 @@ var IconButton = (0, import_react5.forwardRef)(
|
|
|
633
918
|
...activeClasses
|
|
634
919
|
].join(" ");
|
|
635
920
|
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
636
|
-
return /* @__PURE__ */ (0,
|
|
921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
637
922
|
"button",
|
|
638
923
|
{
|
|
639
924
|
ref,
|
|
@@ -643,7 +928,7 @@ var IconButton = (0, import_react5.forwardRef)(
|
|
|
643
928
|
"aria-pressed": active,
|
|
644
929
|
"aria-label": ariaLabel,
|
|
645
930
|
...props,
|
|
646
|
-
children: /* @__PURE__ */ (0,
|
|
931
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex items-center justify-center", children: icon })
|
|
647
932
|
}
|
|
648
933
|
);
|
|
649
934
|
}
|
|
@@ -652,6 +937,7 @@ IconButton.displayName = "IconButton";
|
|
|
652
937
|
// Annotate the CommonJS export names for ESM import in node:
|
|
653
938
|
0 && (module.exports = {
|
|
654
939
|
Button,
|
|
940
|
+
CheckBox,
|
|
655
941
|
DropdownMenu,
|
|
656
942
|
DropdownMenuTrigger,
|
|
657
943
|
IconButton,
|
|
@@ -670,5 +956,9 @@ IconButton.displayName = "IconButton";
|
|
|
670
956
|
TableHead,
|
|
671
957
|
TableHeader,
|
|
672
958
|
TableRow,
|
|
673
|
-
Text
|
|
959
|
+
Text,
|
|
960
|
+
Toast,
|
|
961
|
+
Toaster,
|
|
962
|
+
useToast,
|
|
963
|
+
useToastStore
|
|
674
964
|
});
|