@sesionario/blocks 1.20.0 → 1.22.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/README.md +75 -0
- package/dist/index.cjs +413 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -3
- package/dist/index.d.ts +177 -3
- package/dist/index.js +408 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React7 from 'react';
|
|
3
|
-
import { createContext, useContext, useState, useRef,
|
|
3
|
+
import { createContext, forwardRef, useContext, useState, useRef, useId, useEffect, useCallback, useLayoutEffect, useMemo } from 'react';
|
|
4
4
|
import { ChevronsUpDown, CheckIcon, Smile, SearchIcon, Search, Clock, Flag, Hash, Lightbulb, Trophy, Plane, Apple, Leaf, Hand, Loader2, AlertTriangle, Inbox, X, ChevronLeft, ChevronRight, Monitor, Sun, Moon, Building2, Check, Plus, Languages, BadgeCheck, Settings, User, Activity, LogOut, LogIn, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, Pencil, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, PictureInPicture2, Minimize, Maximize, ArrowDownIcon, MessageCircleDashedIcon, MessageCircle, ChevronUp, ChevronDown, XIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -425,6 +425,348 @@ function ConfirmDestructiveDialog({
|
|
|
425
425
|
] })
|
|
426
426
|
] }) });
|
|
427
427
|
}
|
|
428
|
+
|
|
429
|
+
// src/components/editable/types.ts
|
|
430
|
+
var DEFAULT_EDITABLE_SECTION_LABELS = {
|
|
431
|
+
edit: "Editar",
|
|
432
|
+
save: "Guardar",
|
|
433
|
+
saving: "Guardando\u2026",
|
|
434
|
+
cancel: "Cancelar",
|
|
435
|
+
saved: "Guardado",
|
|
436
|
+
discardTitle: "\xBFDescartar cambios?",
|
|
437
|
+
discardDescription: "Si sales ahora, se perder\xE1n los cambios que no hayas guardado.",
|
|
438
|
+
discardConfirm: "Descartar",
|
|
439
|
+
discardCancel: "Seguir editando"
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
// src/components/editable/useEditableSection.ts
|
|
443
|
+
function focusFirstField(container) {
|
|
444
|
+
if (!container) return;
|
|
445
|
+
const target = container.querySelector(
|
|
446
|
+
"[data-autofocus], input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), [contenteditable='true']"
|
|
447
|
+
);
|
|
448
|
+
target?.focus();
|
|
449
|
+
}
|
|
450
|
+
function useEditableSection({
|
|
451
|
+
onSave,
|
|
452
|
+
onDiscard,
|
|
453
|
+
isDirty = false,
|
|
454
|
+
labelledBy,
|
|
455
|
+
title,
|
|
456
|
+
labels,
|
|
457
|
+
stableHeight = false
|
|
458
|
+
}) {
|
|
459
|
+
const resolvedLabels = {
|
|
460
|
+
...DEFAULT_EDITABLE_SECTION_LABELS,
|
|
461
|
+
...labels
|
|
462
|
+
};
|
|
463
|
+
const [mode, setMode] = useState("reading");
|
|
464
|
+
const [status, setStatus] = useState(null);
|
|
465
|
+
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
466
|
+
const [minHeightPx, setMinHeightPx] = useState(void 0);
|
|
467
|
+
const contentRef = useRef(null);
|
|
468
|
+
const editButtonRef = useRef(null);
|
|
469
|
+
const measuredHeightRef = useRef(0);
|
|
470
|
+
const shouldFocusEditRef = useRef(false);
|
|
471
|
+
const shouldFocusFirstFieldRef = useRef(false);
|
|
472
|
+
const editButtonId = useId();
|
|
473
|
+
const contentFormId = useId();
|
|
474
|
+
const isEditing = mode === "editing" || mode === "saving";
|
|
475
|
+
const isSaving = mode === "saving";
|
|
476
|
+
useEffect(() => {
|
|
477
|
+
if (mode === "reading" && shouldFocusEditRef.current) {
|
|
478
|
+
shouldFocusEditRef.current = false;
|
|
479
|
+
editButtonRef.current?.focus();
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
if (mode === "editing" && shouldFocusFirstFieldRef.current) {
|
|
483
|
+
shouldFocusFirstFieldRef.current = false;
|
|
484
|
+
const invalid = contentRef.current?.querySelector(
|
|
485
|
+
"[aria-invalid='true']"
|
|
486
|
+
);
|
|
487
|
+
if (invalid) {
|
|
488
|
+
invalid.focus();
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
focusFirstField(contentRef.current);
|
|
492
|
+
}
|
|
493
|
+
}, [mode]);
|
|
494
|
+
const exitToReading = useCallback(() => {
|
|
495
|
+
setConfirmOpen(false);
|
|
496
|
+
shouldFocusEditRef.current = true;
|
|
497
|
+
setMode("reading");
|
|
498
|
+
onDiscard?.();
|
|
499
|
+
}, [onDiscard]);
|
|
500
|
+
const startEdit = useCallback(() => {
|
|
501
|
+
setStatus(null);
|
|
502
|
+
shouldFocusFirstFieldRef.current = true;
|
|
503
|
+
setMode("editing");
|
|
504
|
+
}, []);
|
|
505
|
+
const requestCancel = useCallback(() => {
|
|
506
|
+
if (isSaving) return;
|
|
507
|
+
if (isDirty) {
|
|
508
|
+
setConfirmOpen(true);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
exitToReading();
|
|
512
|
+
}, [exitToReading, isDirty, isSaving]);
|
|
513
|
+
const handleSubmit = useCallback(
|
|
514
|
+
(event) => {
|
|
515
|
+
event.preventDefault();
|
|
516
|
+
if (isSaving) return;
|
|
517
|
+
void (async () => {
|
|
518
|
+
setMode("saving");
|
|
519
|
+
setStatus(null);
|
|
520
|
+
try {
|
|
521
|
+
await onSave();
|
|
522
|
+
setStatus(resolvedLabels.saved);
|
|
523
|
+
shouldFocusEditRef.current = true;
|
|
524
|
+
setMode("reading");
|
|
525
|
+
} catch {
|
|
526
|
+
shouldFocusFirstFieldRef.current = true;
|
|
527
|
+
setMode("editing");
|
|
528
|
+
}
|
|
529
|
+
})();
|
|
530
|
+
},
|
|
531
|
+
[isSaving, onSave, resolvedLabels.saved]
|
|
532
|
+
);
|
|
533
|
+
const handleFormKeyDown = useCallback(
|
|
534
|
+
(event) => {
|
|
535
|
+
if (event.key !== "Escape") return;
|
|
536
|
+
event.preventDefault();
|
|
537
|
+
requestCancel();
|
|
538
|
+
},
|
|
539
|
+
[requestCancel]
|
|
540
|
+
);
|
|
541
|
+
useEffect(() => {
|
|
542
|
+
if (!stableHeight || !isEditing) return;
|
|
543
|
+
const el = contentRef.current;
|
|
544
|
+
if (!el) return;
|
|
545
|
+
const measure = () => {
|
|
546
|
+
const height = el.getBoundingClientRect().height;
|
|
547
|
+
if (height > measuredHeightRef.current) {
|
|
548
|
+
measuredHeightRef.current = height;
|
|
549
|
+
setMinHeightPx(height);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
measure();
|
|
553
|
+
const observer = new ResizeObserver(measure);
|
|
554
|
+
observer.observe(el);
|
|
555
|
+
return () => observer.disconnect();
|
|
556
|
+
}, [isEditing, stableHeight]);
|
|
557
|
+
const editButtonNameProps = labelledBy != null ? { "aria-labelledby": `${labelledBy} ${editButtonId}` } : title != null && title.length > 0 ? { "aria-label": `${resolvedLabels.edit} ${title}` } : { "aria-label": resolvedLabels.edit };
|
|
558
|
+
return {
|
|
559
|
+
mode,
|
|
560
|
+
isEditing,
|
|
561
|
+
isSaving,
|
|
562
|
+
startEdit,
|
|
563
|
+
requestCancel,
|
|
564
|
+
formProps: {
|
|
565
|
+
onSubmit: handleSubmit,
|
|
566
|
+
onKeyDown: handleFormKeyDown,
|
|
567
|
+
noValidate: true
|
|
568
|
+
},
|
|
569
|
+
contentRef,
|
|
570
|
+
editButtonRef,
|
|
571
|
+
contentFormId,
|
|
572
|
+
editButtonProps: {
|
|
573
|
+
type: "button",
|
|
574
|
+
id: editButtonId,
|
|
575
|
+
onClick: startEdit,
|
|
576
|
+
ref: editButtonRef,
|
|
577
|
+
...editButtonNameProps
|
|
578
|
+
},
|
|
579
|
+
saveButtonProps: {
|
|
580
|
+
type: "submit",
|
|
581
|
+
disabled: isSaving
|
|
582
|
+
},
|
|
583
|
+
cancelButtonProps: {
|
|
584
|
+
type: "button",
|
|
585
|
+
onClick: requestCancel,
|
|
586
|
+
disabled: isSaving
|
|
587
|
+
},
|
|
588
|
+
status,
|
|
589
|
+
statusProps: {
|
|
590
|
+
role: "status",
|
|
591
|
+
"aria-live": "polite",
|
|
592
|
+
className: "sr-only"
|
|
593
|
+
},
|
|
594
|
+
confirmDiscard: {
|
|
595
|
+
open: confirmOpen,
|
|
596
|
+
onOpenChange: setConfirmOpen,
|
|
597
|
+
title: resolvedLabels.discardTitle,
|
|
598
|
+
description: resolvedLabels.discardDescription,
|
|
599
|
+
confirmLabel: resolvedLabels.discardConfirm,
|
|
600
|
+
cancelLabel: resolvedLabels.discardCancel,
|
|
601
|
+
onConfirm: exitToReading
|
|
602
|
+
},
|
|
603
|
+
resolvedLabels,
|
|
604
|
+
contentStyle: stableHeight && minHeightPx != null ? { minHeight: minHeightPx } : void 0,
|
|
605
|
+
actionsClassName: "flex min-h-9 min-w-[11rem] flex-wrap items-center justify-end gap-2"
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
function EditableSection({
|
|
609
|
+
readView,
|
|
610
|
+
editView,
|
|
611
|
+
children,
|
|
612
|
+
className,
|
|
613
|
+
...options
|
|
614
|
+
}) {
|
|
615
|
+
const section = useEditableSection(options);
|
|
616
|
+
const {
|
|
617
|
+
isEditing,
|
|
618
|
+
isSaving,
|
|
619
|
+
formProps,
|
|
620
|
+
contentRef,
|
|
621
|
+
contentFormId,
|
|
622
|
+
editButtonProps,
|
|
623
|
+
saveButtonProps,
|
|
624
|
+
cancelButtonProps,
|
|
625
|
+
status,
|
|
626
|
+
statusProps,
|
|
627
|
+
confirmDiscard,
|
|
628
|
+
resolvedLabels,
|
|
629
|
+
contentStyle,
|
|
630
|
+
actionsClassName,
|
|
631
|
+
mode
|
|
632
|
+
} = section;
|
|
633
|
+
const actionButtons = !isEditing ? /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", ...editButtonProps, children: resolvedLabels.edit }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
634
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", ...cancelButtonProps, children: resolvedLabels.cancel }),
|
|
635
|
+
/* @__PURE__ */ jsx(
|
|
636
|
+
Button,
|
|
637
|
+
{
|
|
638
|
+
size: "sm",
|
|
639
|
+
type: "submit",
|
|
640
|
+
form: contentFormId,
|
|
641
|
+
disabled: saveButtonProps.disabled,
|
|
642
|
+
children: isSaving ? resolvedLabels.saving : resolvedLabels.save
|
|
643
|
+
}
|
|
644
|
+
)
|
|
645
|
+
] });
|
|
646
|
+
const actions = /* @__PURE__ */ jsx("div", { "data-slot": "editable-section-actions", className: actionsClassName, children: actionButtons });
|
|
647
|
+
const content = isEditing ? /* @__PURE__ */ jsx(
|
|
648
|
+
"form",
|
|
649
|
+
{
|
|
650
|
+
id: contentFormId,
|
|
651
|
+
ref: contentRef,
|
|
652
|
+
"data-slot": "editable-section-content",
|
|
653
|
+
className: cn("sesionario-editable-section-content space-y-4"),
|
|
654
|
+
style: contentStyle,
|
|
655
|
+
...formProps,
|
|
656
|
+
children: editView()
|
|
657
|
+
}
|
|
658
|
+
) : /* @__PURE__ */ jsx(
|
|
659
|
+
"div",
|
|
660
|
+
{
|
|
661
|
+
ref: contentRef,
|
|
662
|
+
"data-slot": "editable-section-content",
|
|
663
|
+
className: "sesionario-editable-section-content",
|
|
664
|
+
style: contentStyle,
|
|
665
|
+
children: readView()
|
|
666
|
+
}
|
|
667
|
+
);
|
|
668
|
+
const statusNode = /* @__PURE__ */ jsx("span", { ...statusProps, "data-slot": "editable-section-status", children: status });
|
|
669
|
+
const dialog = /* @__PURE__ */ jsx(
|
|
670
|
+
ConfirmDestructiveDialog,
|
|
671
|
+
{
|
|
672
|
+
open: confirmDiscard.open,
|
|
673
|
+
onOpenChange: confirmDiscard.onOpenChange,
|
|
674
|
+
title: confirmDiscard.title,
|
|
675
|
+
description: confirmDiscard.description,
|
|
676
|
+
confirmLabel: confirmDiscard.confirmLabel,
|
|
677
|
+
cancelLabel: confirmDiscard.cancelLabel,
|
|
678
|
+
onConfirm: confirmDiscard.onConfirm
|
|
679
|
+
}
|
|
680
|
+
);
|
|
681
|
+
if (children) {
|
|
682
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
683
|
+
children({
|
|
684
|
+
actions,
|
|
685
|
+
content,
|
|
686
|
+
status: statusNode,
|
|
687
|
+
mode,
|
|
688
|
+
isSaving,
|
|
689
|
+
isEditing
|
|
690
|
+
}),
|
|
691
|
+
dialog
|
|
692
|
+
] });
|
|
693
|
+
}
|
|
694
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "editable-section", className: cn("space-y-4", className), children: [
|
|
695
|
+
actions,
|
|
696
|
+
content,
|
|
697
|
+
statusNode,
|
|
698
|
+
dialog
|
|
699
|
+
] });
|
|
700
|
+
}
|
|
701
|
+
function DataList({ className, ...props }) {
|
|
702
|
+
return /* @__PURE__ */ jsx(
|
|
703
|
+
"dl",
|
|
704
|
+
{
|
|
705
|
+
"data-slot": "data-list",
|
|
706
|
+
className: cn("grid gap-4 sm:grid-cols-2", className),
|
|
707
|
+
...props
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
function DataListItem({
|
|
712
|
+
label,
|
|
713
|
+
children,
|
|
714
|
+
empty = "\u2014",
|
|
715
|
+
className,
|
|
716
|
+
labelClassName,
|
|
717
|
+
valueClassName
|
|
718
|
+
}) {
|
|
719
|
+
const isEmpty = children == null || children === false || typeof children === "string" && children.trim().length === 0;
|
|
720
|
+
return /* @__PURE__ */ jsxs(
|
|
721
|
+
"div",
|
|
722
|
+
{
|
|
723
|
+
"data-slot": "data-list-item",
|
|
724
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
725
|
+
children: [
|
|
726
|
+
/* @__PURE__ */ jsx(
|
|
727
|
+
"dt",
|
|
728
|
+
{
|
|
729
|
+
className: cn(
|
|
730
|
+
"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
731
|
+
labelClassName
|
|
732
|
+
),
|
|
733
|
+
children: label
|
|
734
|
+
}
|
|
735
|
+
),
|
|
736
|
+
/* @__PURE__ */ jsx(
|
|
737
|
+
"dd",
|
|
738
|
+
{
|
|
739
|
+
className: cn(
|
|
740
|
+
"text-sm wrap-break-word",
|
|
741
|
+
isEmpty && "text-muted-foreground",
|
|
742
|
+
valueClassName
|
|
743
|
+
),
|
|
744
|
+
children: isEmpty ? empty : children
|
|
745
|
+
}
|
|
746
|
+
)
|
|
747
|
+
]
|
|
748
|
+
}
|
|
749
|
+
);
|
|
750
|
+
}
|
|
751
|
+
function FieldMessage({
|
|
752
|
+
id,
|
|
753
|
+
children,
|
|
754
|
+
className,
|
|
755
|
+
...props
|
|
756
|
+
}) {
|
|
757
|
+
const hasMessage = children != null && children !== false && !(typeof children === "string" && children.trim().length === 0);
|
|
758
|
+
return /* @__PURE__ */ jsx(
|
|
759
|
+
"p",
|
|
760
|
+
{
|
|
761
|
+
id,
|
|
762
|
+
role: hasMessage ? "alert" : void 0,
|
|
763
|
+
"data-slot": "field-message",
|
|
764
|
+
className: cn("min-h-5 text-xs text-destructive", className),
|
|
765
|
+
...props,
|
|
766
|
+
children: hasMessage ? children : "\xA0"
|
|
767
|
+
}
|
|
768
|
+
);
|
|
769
|
+
}
|
|
428
770
|
var COLLAPSED_MAX_HEIGHT_REM = 11;
|
|
429
771
|
function ExpandableText({
|
|
430
772
|
children,
|
|
@@ -1313,13 +1655,13 @@ function TenantAvatar({
|
|
|
1313
1655
|
logo,
|
|
1314
1656
|
size = "md"
|
|
1315
1657
|
}) {
|
|
1316
|
-
const sizeClass = size === "sm" ? "size-6
|
|
1658
|
+
const sizeClass = size === "sm" ? "size-6" : "size-8";
|
|
1317
1659
|
const textClass = size === "sm" ? "text-xs" : "text-sm";
|
|
1318
1660
|
return /* @__PURE__ */ jsx(
|
|
1319
1661
|
"div",
|
|
1320
1662
|
{
|
|
1321
1663
|
className: cn(
|
|
1322
|
-
"flex shrink-0 items-center justify-center overflow-hidden font-medium",
|
|
1664
|
+
"flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium",
|
|
1323
1665
|
sizeClass
|
|
1324
1666
|
),
|
|
1325
1667
|
style: logo ? void 0 : avatarFallbackStyle(name),
|
|
@@ -1340,7 +1682,7 @@ function SwitcherSkeleton({
|
|
|
1340
1682
|
"pointer-events-none flex size-8 items-center justify-center rounded-md",
|
|
1341
1683
|
className
|
|
1342
1684
|
),
|
|
1343
|
-
children: /* @__PURE__ */ jsx("div", { className: "size-8 shrink-0 animate-pulse rounded-
|
|
1685
|
+
children: /* @__PURE__ */ jsx("div", { className: "size-8 shrink-0 animate-pulse rounded-full bg-muted" })
|
|
1344
1686
|
}
|
|
1345
1687
|
);
|
|
1346
1688
|
}
|
|
@@ -1353,7 +1695,7 @@ function SwitcherSkeleton({
|
|
|
1353
1695
|
className
|
|
1354
1696
|
),
|
|
1355
1697
|
children: [
|
|
1356
|
-
/* @__PURE__ */ jsx("div", { className: "size-8 shrink-0 animate-pulse rounded-
|
|
1698
|
+
/* @__PURE__ */ jsx("div", { className: "size-8 shrink-0 animate-pulse rounded-full bg-muted" }),
|
|
1357
1699
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
1358
1700
|
/* @__PURE__ */ jsx("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" }),
|
|
1359
1701
|
/* @__PURE__ */ jsx("div", { className: "h-3 w-16 animate-pulse rounded bg-muted" })
|
|
@@ -1396,7 +1738,7 @@ function OrgSwitcher({
|
|
|
1396
1738
|
triggerClassNameProp
|
|
1397
1739
|
),
|
|
1398
1740
|
children: [
|
|
1399
|
-
/* @__PURE__ */ jsx("div", { className: "flex size-8 items-center justify-center rounded-
|
|
1741
|
+
/* @__PURE__ */ jsx("div", { className: "flex size-8 items-center justify-center rounded-full bg-muted", children: /* @__PURE__ */ jsx(Building2, { className: "size-4 text-muted-foreground" }) }),
|
|
1400
1742
|
!collapsed ? /* @__PURE__ */ jsx("div", { className: "grid min-w-0 flex-1 text-left leading-tight", children: /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: labels.empty }) }) : null
|
|
1401
1743
|
]
|
|
1402
1744
|
}
|
|
@@ -1413,7 +1755,7 @@ function OrgSwitcher({
|
|
|
1413
1755
|
className
|
|
1414
1756
|
),
|
|
1415
1757
|
children: [
|
|
1416
|
-
/* @__PURE__ */ jsx("div", { className: "flex size-8 items-center justify-center rounded-
|
|
1758
|
+
/* @__PURE__ */ jsx("div", { className: "flex size-8 items-center justify-center rounded-full bg-muted", children: /* @__PURE__ */ jsx(Building2, { className: "size-4 text-muted-foreground" }) }),
|
|
1417
1759
|
!collapsed ? /* @__PURE__ */ jsx("div", { className: "grid min-w-0 flex-1 text-left leading-tight", children: /* @__PURE__ */ jsx("span", { className: "truncate font-medium text-muted-foreground", children: labels.empty }) }) : null
|
|
1418
1760
|
]
|
|
1419
1761
|
}
|
|
@@ -2299,8 +2641,6 @@ function AvatarEditor({
|
|
|
2299
2641
|
canvas.width = displaySize;
|
|
2300
2642
|
canvas.height = displaySize;
|
|
2301
2643
|
ctx.clearRect(0, 0, displaySize, displaySize);
|
|
2302
|
-
ctx.fillStyle = "#1a1a2e";
|
|
2303
|
-
ctx.fillRect(0, 0, displaySize, displaySize);
|
|
2304
2644
|
ctx.save();
|
|
2305
2645
|
ctx.translate(displaySize / 2, displaySize / 2);
|
|
2306
2646
|
ctx.rotate(rotation * Math.PI / 180);
|
|
@@ -2322,28 +2662,6 @@ function AvatarEditor({
|
|
|
2322
2662
|
drawHeight
|
|
2323
2663
|
);
|
|
2324
2664
|
ctx.restore();
|
|
2325
|
-
ctx.globalCompositeOperation = "destination-in";
|
|
2326
|
-
ctx.beginPath();
|
|
2327
|
-
ctx.arc(
|
|
2328
|
-
displaySize / 2,
|
|
2329
|
-
displaySize / 2,
|
|
2330
|
-
displaySize / 2 - 4,
|
|
2331
|
-
0,
|
|
2332
|
-
Math.PI * 2
|
|
2333
|
-
);
|
|
2334
|
-
ctx.fill();
|
|
2335
|
-
ctx.globalCompositeOperation = "source-over";
|
|
2336
|
-
ctx.strokeStyle = "hsl(var(--primary))";
|
|
2337
|
-
ctx.lineWidth = 3;
|
|
2338
|
-
ctx.beginPath();
|
|
2339
|
-
ctx.arc(
|
|
2340
|
-
displaySize / 2,
|
|
2341
|
-
displaySize / 2,
|
|
2342
|
-
displaySize / 2 - 2,
|
|
2343
|
-
0,
|
|
2344
|
-
Math.PI * 2
|
|
2345
|
-
);
|
|
2346
|
-
ctx.stroke();
|
|
2347
2665
|
const dataUrl = generateOutput();
|
|
2348
2666
|
if (dataUrl) {
|
|
2349
2667
|
onChange?.(dataUrl);
|
|
@@ -2449,6 +2767,8 @@ function AvatarEditor({
|
|
|
2449
2767
|
const gapSize = isLarge ? "gap-6" : "gap-4";
|
|
2450
2768
|
const controlGap = isLarge ? "gap-3" : "gap-2";
|
|
2451
2769
|
const sliderHeight = isLarge ? "[&_[role=slider]]:h-6 [&_[role=slider]]:w-6" : "";
|
|
2770
|
+
const guideRadius = size / 2 - 2;
|
|
2771
|
+
const guideCenter = size / 2;
|
|
2452
2772
|
return /* @__PURE__ */ jsxs(
|
|
2453
2773
|
"div",
|
|
2454
2774
|
{
|
|
@@ -2512,6 +2832,36 @@ function AvatarEditor({
|
|
|
2512
2832
|
onTouchEnd: handleMouseUp
|
|
2513
2833
|
}
|
|
2514
2834
|
),
|
|
2835
|
+
imageLoaded && /* @__PURE__ */ jsxs(
|
|
2836
|
+
"svg",
|
|
2837
|
+
{
|
|
2838
|
+
width: size,
|
|
2839
|
+
height: size,
|
|
2840
|
+
className: "pointer-events-none absolute inset-0",
|
|
2841
|
+
"aria-hidden": "true",
|
|
2842
|
+
children: [
|
|
2843
|
+
/* @__PURE__ */ jsx(
|
|
2844
|
+
"path",
|
|
2845
|
+
{
|
|
2846
|
+
d: `M0 0H${size}V${size}H0Z M${guideCenter - guideRadius} ${guideCenter}a${guideRadius} ${guideRadius} 0 1 0 ${guideRadius * 2} 0a${guideRadius} ${guideRadius} 0 1 0 ${-guideRadius * 2} 0`,
|
|
2847
|
+
fill: "rgb(0 0 0 / 0.45)",
|
|
2848
|
+
fillRule: "evenodd"
|
|
2849
|
+
}
|
|
2850
|
+
),
|
|
2851
|
+
/* @__PURE__ */ jsx(
|
|
2852
|
+
"circle",
|
|
2853
|
+
{
|
|
2854
|
+
cx: guideCenter,
|
|
2855
|
+
cy: guideCenter,
|
|
2856
|
+
r: guideRadius,
|
|
2857
|
+
fill: "none",
|
|
2858
|
+
stroke: "hsl(var(--primary))",
|
|
2859
|
+
strokeWidth: "3"
|
|
2860
|
+
}
|
|
2861
|
+
)
|
|
2862
|
+
]
|
|
2863
|
+
}
|
|
2864
|
+
),
|
|
2515
2865
|
showGrid && imageLoaded && /* @__PURE__ */ jsx(
|
|
2516
2866
|
"div",
|
|
2517
2867
|
{
|
|
@@ -6959,6 +7309,32 @@ function PaymentIcon({
|
|
|
6959
7309
|
}
|
|
6960
7310
|
);
|
|
6961
7311
|
}
|
|
7312
|
+
var BrandX = forwardRef(function BrandX2({
|
|
7313
|
+
className,
|
|
7314
|
+
size = 24,
|
|
7315
|
+
"aria-label": ariaLabel,
|
|
7316
|
+
"aria-labelledby": ariaLabelledby,
|
|
7317
|
+
...props
|
|
7318
|
+
}, ref) {
|
|
7319
|
+
const labelled = Boolean(ariaLabel || ariaLabelledby);
|
|
7320
|
+
return /* @__PURE__ */ jsx(
|
|
7321
|
+
"svg",
|
|
7322
|
+
{
|
|
7323
|
+
ref,
|
|
7324
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7325
|
+
viewBox: "0 0 24 24",
|
|
7326
|
+
fill: "currentColor",
|
|
7327
|
+
...props,
|
|
7328
|
+
"aria-label": ariaLabel,
|
|
7329
|
+
"aria-labelledby": ariaLabelledby,
|
|
7330
|
+
"aria-hidden": labelled ? void 0 : true,
|
|
7331
|
+
width: size,
|
|
7332
|
+
height: size,
|
|
7333
|
+
className: cn("shrink-0", className),
|
|
7334
|
+
children: /* @__PURE__ */ jsx("path", { d: "M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z" })
|
|
7335
|
+
}
|
|
7336
|
+
);
|
|
7337
|
+
});
|
|
6962
7338
|
function MessageGroup({ className, ...props }) {
|
|
6963
7339
|
return /* @__PURE__ */ jsx(
|
|
6964
7340
|
"div",
|
|
@@ -8289,6 +8665,6 @@ function useRealtimeChannel({
|
|
|
8289
8665
|
}, [enabled, reconnectDelayMs]);
|
|
8290
8666
|
}
|
|
8291
8667
|
|
|
8292
|
-
export { AvatarEditor, AvatarEditorDialog, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, DropdownMenuItem, DropdownMenuSeparator, EmojiInput, EmojiPicker, EmojiPickerPopover, EmojiTextarea, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, ExpandableText, FeedVideoPlayer, ImageLightbox, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageComposer, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PLATFORM_ACCOUNT_ORG_COLLAPSE_AT, PaymentIcon, PhoneInput, PlatformAccountMenu, PlatformNavbar, SearchCommand, SearchablePicker, SupportMessengerProvider, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, formatPaymentCardBrand, fuzzyMatch, getAvatarColors, getInitials, insertAtCaret, markerVariants, mergePlatformAccountOrgs, normalizeEmojiQuery, normalizePaymentCardBrand, paymentIconBrandFromStripe, paymentTypeFromStripeBrand, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats, useRealtimeChannel, useScrollFadeXEdges, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
|
8668
|
+
export { AvatarEditor, AvatarEditorDialog, BrandX, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, DEFAULT_EDITABLE_SECTION_LABELS, DataList, DataListItem, DropdownMenuItem, DropdownMenuSeparator, EditableSection, EmojiInput, EmojiPicker, EmojiPickerPopover, EmojiTextarea, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, ExpandableText, FeedVideoPlayer, FieldMessage, ImageLightbox, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageComposer, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PLATFORM_ACCOUNT_ORG_COLLAPSE_AT, PaymentIcon, PhoneInput, PlatformAccountMenu, PlatformNavbar, SearchCommand, SearchablePicker, SupportMessengerProvider, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, formatPaymentCardBrand, fuzzyMatch, getAvatarColors, getInitials, insertAtCaret, markerVariants, mergePlatformAccountOrgs, normalizeEmojiQuery, normalizePaymentCardBrand, paymentIconBrandFromStripe, paymentTypeFromStripeBrand, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats, useRealtimeChannel, useScrollFadeXEdges, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
|
8293
8669
|
//# sourceMappingURL=index.js.map
|
|
8294
8670
|
//# sourceMappingURL=index.js.map
|