@sesionario/blocks 1.1.1 → 1.3.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 +2 -0
- package/dist/index.cjs +328 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +325 -58
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ Shared UI components for [Sesionario](https://github.com/Docufacil) applications
|
|
|
4
4
|
|
|
5
5
|
This package is the Sesionario-specific successor to `@algenium/blocks`. It ships only the components, hooks, and data the five Sesionario apps (`admin`, `app`, `auth`, `backoffice`, `pharma`) actually use, plus shadcn `Empty` primitives under the hood of `EmptyState`.
|
|
6
6
|
|
|
7
|
+
Shared feedback patterns include `ConfirmDestructiveDialog` (confirm before delete/mute and similar irreversible actions).
|
|
8
|
+
|
|
7
9
|
## Install
|
|
8
10
|
|
|
9
11
|
```bash
|
package/dist/index.cjs
CHANGED
|
@@ -7,10 +7,11 @@ var clsx = require('clsx');
|
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
8
8
|
var classVarianceAuthority = require('class-variance-authority');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
11
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
10
12
|
var nextThemes = require('next-themes');
|
|
11
13
|
var framerMotion = require('framer-motion');
|
|
12
14
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
13
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
14
15
|
var SliderPrimitive = require('@radix-ui/react-slider');
|
|
15
16
|
var TogglePrimitive = require('@radix-ui/react-toggle');
|
|
16
17
|
var DialogPrimitive = require('@radix-ui/react-dialog');
|
|
@@ -43,6 +44,7 @@ function _interopNamespace(e) {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
|
|
47
|
+
var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
|
|
46
48
|
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
47
49
|
var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
|
|
48
50
|
var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
|
|
@@ -242,6 +244,217 @@ function EmptyState({
|
|
|
242
244
|
}
|
|
243
245
|
);
|
|
244
246
|
}
|
|
247
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
248
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
249
|
+
{
|
|
250
|
+
variants: {
|
|
251
|
+
variant: {
|
|
252
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
253
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
254
|
+
outline: "border bg-background text-foreground shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:text-foreground dark:hover:bg-muted dark:hover:text-foreground",
|
|
255
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
256
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50 dark:hover:text-foreground",
|
|
257
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
258
|
+
},
|
|
259
|
+
size: {
|
|
260
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
261
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
262
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
263
|
+
icon: "size-9",
|
|
264
|
+
"icon-sm": "size-8",
|
|
265
|
+
"icon-lg": "size-10"
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
defaultVariants: {
|
|
269
|
+
variant: "default",
|
|
270
|
+
size: "default"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
function Button({
|
|
275
|
+
className,
|
|
276
|
+
variant = "default",
|
|
277
|
+
size = "default",
|
|
278
|
+
asChild = false,
|
|
279
|
+
...props
|
|
280
|
+
}) {
|
|
281
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
282
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
283
|
+
Comp,
|
|
284
|
+
{
|
|
285
|
+
"data-slot": "button",
|
|
286
|
+
"data-variant": variant,
|
|
287
|
+
"data-size": size,
|
|
288
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
289
|
+
...props
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
function AlertDialog({
|
|
294
|
+
...props
|
|
295
|
+
}) {
|
|
296
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AlertDialogPrimitive__namespace.Root, { "data-slot": "alert-dialog", ...props });
|
|
297
|
+
}
|
|
298
|
+
function AlertDialogPortal({
|
|
299
|
+
...props
|
|
300
|
+
}) {
|
|
301
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AlertDialogPrimitive__namespace.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
302
|
+
}
|
|
303
|
+
function AlertDialogOverlay({
|
|
304
|
+
className,
|
|
305
|
+
...props
|
|
306
|
+
}) {
|
|
307
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
+
AlertDialogPrimitive__namespace.Overlay,
|
|
309
|
+
{
|
|
310
|
+
"data-slot": "alert-dialog-overlay",
|
|
311
|
+
className: cn(
|
|
312
|
+
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
313
|
+
className
|
|
314
|
+
),
|
|
315
|
+
...props
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
function AlertDialogContent({
|
|
320
|
+
className,
|
|
321
|
+
size = "default",
|
|
322
|
+
...props
|
|
323
|
+
}) {
|
|
324
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
|
|
325
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
|
|
326
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
327
|
+
AlertDialogPrimitive__namespace.Content,
|
|
328
|
+
{
|
|
329
|
+
"data-slot": "alert-dialog-content",
|
|
330
|
+
"data-size": size,
|
|
331
|
+
className: cn(
|
|
332
|
+
"group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
|
|
333
|
+
className
|
|
334
|
+
),
|
|
335
|
+
...props
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
] });
|
|
339
|
+
}
|
|
340
|
+
function AlertDialogHeader({
|
|
341
|
+
className,
|
|
342
|
+
...props
|
|
343
|
+
}) {
|
|
344
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
345
|
+
"div",
|
|
346
|
+
{
|
|
347
|
+
"data-slot": "alert-dialog-header",
|
|
348
|
+
className: cn(
|
|
349
|
+
"flex flex-col gap-1.5 text-center sm:text-left",
|
|
350
|
+
className
|
|
351
|
+
),
|
|
352
|
+
...props
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
function AlertDialogFooter({
|
|
357
|
+
className,
|
|
358
|
+
...props
|
|
359
|
+
}) {
|
|
360
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
361
|
+
"div",
|
|
362
|
+
{
|
|
363
|
+
"data-slot": "alert-dialog-footer",
|
|
364
|
+
className: cn(
|
|
365
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
366
|
+
className
|
|
367
|
+
),
|
|
368
|
+
...props
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
function AlertDialogTitle({
|
|
373
|
+
className,
|
|
374
|
+
...props
|
|
375
|
+
}) {
|
|
376
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
377
|
+
AlertDialogPrimitive__namespace.Title,
|
|
378
|
+
{
|
|
379
|
+
"data-slot": "alert-dialog-title",
|
|
380
|
+
className: cn("text-lg font-semibold", className),
|
|
381
|
+
...props
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
function AlertDialogDescription({
|
|
386
|
+
className,
|
|
387
|
+
...props
|
|
388
|
+
}) {
|
|
389
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
390
|
+
AlertDialogPrimitive__namespace.Description,
|
|
391
|
+
{
|
|
392
|
+
"data-slot": "alert-dialog-description",
|
|
393
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
394
|
+
...props
|
|
395
|
+
}
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
function AlertDialogAction({
|
|
399
|
+
className,
|
|
400
|
+
variant = "default",
|
|
401
|
+
size = "default",
|
|
402
|
+
...props
|
|
403
|
+
}) {
|
|
404
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
405
|
+
AlertDialogPrimitive__namespace.Action,
|
|
406
|
+
{
|
|
407
|
+
"data-slot": "alert-dialog-action",
|
|
408
|
+
className: cn(className),
|
|
409
|
+
...props
|
|
410
|
+
}
|
|
411
|
+
) });
|
|
412
|
+
}
|
|
413
|
+
function AlertDialogCancel({
|
|
414
|
+
className,
|
|
415
|
+
variant = "outline",
|
|
416
|
+
size = "default",
|
|
417
|
+
...props
|
|
418
|
+
}) {
|
|
419
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
420
|
+
AlertDialogPrimitive__namespace.Cancel,
|
|
421
|
+
{
|
|
422
|
+
"data-slot": "alert-dialog-cancel",
|
|
423
|
+
className: cn(className),
|
|
424
|
+
...props
|
|
425
|
+
}
|
|
426
|
+
) });
|
|
427
|
+
}
|
|
428
|
+
function ConfirmDestructiveDialog({
|
|
429
|
+
open,
|
|
430
|
+
onOpenChange,
|
|
431
|
+
title,
|
|
432
|
+
description,
|
|
433
|
+
confirmLabel = "Eliminar",
|
|
434
|
+
cancelLabel = "Cancelar",
|
|
435
|
+
onConfirm
|
|
436
|
+
}) {
|
|
437
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogContent, { size: "sm", children: [
|
|
438
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AlertDialogHeader, { children: [
|
|
439
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogTitle, { children: title }),
|
|
440
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogDescription, { children: description })
|
|
441
|
+
] }),
|
|
442
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AlertDialogFooter, { children: [
|
|
443
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogCancel, { children: cancelLabel }),
|
|
444
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
445
|
+
AlertDialogAction,
|
|
446
|
+
{
|
|
447
|
+
variant: "destructive",
|
|
448
|
+
onClick: () => {
|
|
449
|
+
onConfirm();
|
|
450
|
+
onOpenChange(false);
|
|
451
|
+
},
|
|
452
|
+
children: confirmLabel
|
|
453
|
+
}
|
|
454
|
+
)
|
|
455
|
+
] })
|
|
456
|
+
] }) });
|
|
457
|
+
}
|
|
245
458
|
var miniMenuContentClassName = "max-h-none overflow-x-visible overflow-y-visible";
|
|
246
459
|
var miniMenuContentDefaults = {
|
|
247
460
|
sideOffset: 8,
|
|
@@ -348,52 +561,6 @@ function DropdownMenuShortcut({
|
|
|
348
561
|
}
|
|
349
562
|
);
|
|
350
563
|
}
|
|
351
|
-
var buttonVariants = classVarianceAuthority.cva(
|
|
352
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
353
|
-
{
|
|
354
|
-
variants: {
|
|
355
|
-
variant: {
|
|
356
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
357
|
-
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
358
|
-
outline: "border bg-background text-foreground shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:text-foreground dark:hover:bg-muted dark:hover:text-foreground",
|
|
359
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
360
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50 dark:hover:text-foreground",
|
|
361
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
362
|
-
},
|
|
363
|
-
size: {
|
|
364
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
365
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
366
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
367
|
-
icon: "size-9",
|
|
368
|
-
"icon-sm": "size-8",
|
|
369
|
-
"icon-lg": "size-10"
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
defaultVariants: {
|
|
373
|
-
variant: "default",
|
|
374
|
-
size: "default"
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
);
|
|
378
|
-
function Button({
|
|
379
|
-
className,
|
|
380
|
-
variant = "default",
|
|
381
|
-
size = "default",
|
|
382
|
-
asChild = false,
|
|
383
|
-
...props
|
|
384
|
-
}) {
|
|
385
|
-
const Comp = asChild ? reactSlot.Slot : "button";
|
|
386
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
387
|
-
Comp,
|
|
388
|
-
{
|
|
389
|
-
"data-slot": "button",
|
|
390
|
-
"data-variant": variant,
|
|
391
|
-
"data-size": size,
|
|
392
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
393
|
-
...props
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
564
|
var defaultLabels = {
|
|
398
565
|
theme: "Theme",
|
|
399
566
|
system: "System",
|
|
@@ -443,6 +610,7 @@ function ThemeSwitcher({
|
|
|
443
610
|
}) {
|
|
444
611
|
const { theme, setTheme } = nextThemes.useTheme();
|
|
445
612
|
const [mounted, setMounted] = React5.useState(false);
|
|
613
|
+
const reduceMotion = framerMotion.useReducedMotion();
|
|
446
614
|
const sizes = sizeClasses[size];
|
|
447
615
|
const shapeClass = shapeClasses[shape];
|
|
448
616
|
const labels = { ...defaultLabels, ...userLabels };
|
|
@@ -526,11 +694,17 @@ function ThemeSwitcher({
|
|
|
526
694
|
"button",
|
|
527
695
|
{
|
|
528
696
|
"aria-label": labels[key],
|
|
697
|
+
"aria-pressed": isActive,
|
|
529
698
|
className: cn("relative", sizes.button, shapeClass),
|
|
530
699
|
onClick: () => handleThemeClick(key),
|
|
531
700
|
type: "button",
|
|
532
701
|
children: [
|
|
533
|
-
|
|
702
|
+
reduceMotion ? isActive ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
703
|
+
"div",
|
|
704
|
+
{
|
|
705
|
+
className: cn("absolute inset-0 bg-secondary", shapeClass)
|
|
706
|
+
}
|
|
707
|
+
) : null : /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isActive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
534
708
|
framerMotion.motion.div,
|
|
535
709
|
{
|
|
536
710
|
className: cn("absolute inset-0 bg-secondary", shapeClass),
|
|
@@ -559,6 +733,88 @@ function ThemeSwitcher({
|
|
|
559
733
|
}
|
|
560
734
|
);
|
|
561
735
|
}
|
|
736
|
+
|
|
737
|
+
// src/lib/avatar.ts
|
|
738
|
+
var EMPTY_COLORS = {
|
|
739
|
+
backgroundColor: "#9ca3af",
|
|
740
|
+
color: "#111111"
|
|
741
|
+
};
|
|
742
|
+
var AVATAR_PALETTE = [
|
|
743
|
+
"#4f6d8c",
|
|
744
|
+
// slate blue
|
|
745
|
+
"#3d7a6a",
|
|
746
|
+
// teal
|
|
747
|
+
"#6b5b8a",
|
|
748
|
+
// muted purple
|
|
749
|
+
"#8a5a4a",
|
|
750
|
+
// warm brown
|
|
751
|
+
"#4a7a8a",
|
|
752
|
+
// steel cyan
|
|
753
|
+
"#7a6b4a",
|
|
754
|
+
// olive
|
|
755
|
+
"#5a6b8a",
|
|
756
|
+
// periwinkle
|
|
757
|
+
"#8a4a5a",
|
|
758
|
+
// rose
|
|
759
|
+
"#4a8a6b",
|
|
760
|
+
// green
|
|
761
|
+
"#6b4a7a",
|
|
762
|
+
// plum
|
|
763
|
+
"#8a6b4a",
|
|
764
|
+
// amber brown
|
|
765
|
+
"#4a5a8a",
|
|
766
|
+
// indigo
|
|
767
|
+
"#7a4a6b",
|
|
768
|
+
// mauve
|
|
769
|
+
"#5a8a4a",
|
|
770
|
+
// leaf
|
|
771
|
+
"#8a5a7a",
|
|
772
|
+
// dusty pink
|
|
773
|
+
"#3d6b7a"
|
|
774
|
+
// deep teal
|
|
775
|
+
];
|
|
776
|
+
function hashString(input) {
|
|
777
|
+
let hash = 2166136261;
|
|
778
|
+
for (let i = 0; i < input.length; i++) {
|
|
779
|
+
hash ^= input.charCodeAt(i);
|
|
780
|
+
hash = Math.imul(hash, 16777619);
|
|
781
|
+
}
|
|
782
|
+
return hash >>> 0;
|
|
783
|
+
}
|
|
784
|
+
function srgbToLinear(channel) {
|
|
785
|
+
const c = channel / 255;
|
|
786
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
787
|
+
}
|
|
788
|
+
function relativeLuminance(hex) {
|
|
789
|
+
const normalized = hex.replace("#", "");
|
|
790
|
+
const r = Number.parseInt(normalized.slice(0, 2), 16);
|
|
791
|
+
const g = Number.parseInt(normalized.slice(2, 4), 16);
|
|
792
|
+
const b = Number.parseInt(normalized.slice(4, 6), 16);
|
|
793
|
+
return 0.2126 * srgbToLinear(r) + 0.7152 * srgbToLinear(g) + 0.0722 * srgbToLinear(b);
|
|
794
|
+
}
|
|
795
|
+
function contrastingTextColor(backgroundHex) {
|
|
796
|
+
return relativeLuminance(backgroundHex) > 0.179 ? "#111111" : "#ffffff";
|
|
797
|
+
}
|
|
798
|
+
function getInitials(name, max = 2) {
|
|
799
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
800
|
+
if (parts.length === 0) return "?";
|
|
801
|
+
const letters = parts.slice(0, Math.max(1, max)).map((part) => part.charAt(0)).join("");
|
|
802
|
+
return letters.toUpperCase() || "?";
|
|
803
|
+
}
|
|
804
|
+
function getAvatarColors(name) {
|
|
805
|
+
const normalized = name.trim().toLowerCase();
|
|
806
|
+
if (!normalized) {
|
|
807
|
+
return { ...EMPTY_COLORS };
|
|
808
|
+
}
|
|
809
|
+
const backgroundColor = AVATAR_PALETTE[hashString(normalized) % AVATAR_PALETTE.length];
|
|
810
|
+
return {
|
|
811
|
+
backgroundColor,
|
|
812
|
+
color: contrastingTextColor(backgroundColor)
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
function avatarFallbackStyle(name) {
|
|
816
|
+
return getAvatarColors(name);
|
|
817
|
+
}
|
|
562
818
|
var defaultLabels2 = {
|
|
563
819
|
heading: "Organizations",
|
|
564
820
|
create: "Create organization",
|
|
@@ -575,10 +831,11 @@ function TenantAvatar({
|
|
|
575
831
|
"div",
|
|
576
832
|
{
|
|
577
833
|
className: cn(
|
|
578
|
-
"flex shrink-0 items-center justify-center overflow-hidden
|
|
834
|
+
"flex shrink-0 items-center justify-center overflow-hidden font-medium",
|
|
579
835
|
sizeClass
|
|
580
836
|
),
|
|
581
|
-
|
|
837
|
+
style: logo ? void 0 : avatarFallbackStyle(name),
|
|
838
|
+
children: logo ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: textClass, children: getInitials(name) })
|
|
582
839
|
}
|
|
583
840
|
);
|
|
584
841
|
}
|
|
@@ -795,6 +1052,7 @@ function LanguageSwitcher({
|
|
|
795
1052
|
const onLanguageChange = propOnLanguageChange ?? context?.setLanguage;
|
|
796
1053
|
const sizes = sizeClasses2[size];
|
|
797
1054
|
const shapeClass = shapeClasses2[shape];
|
|
1055
|
+
const reduceMotion = framerMotion.useReducedMotion();
|
|
798
1056
|
const defaultLabels4 = {
|
|
799
1057
|
language: labels.language ?? "Language"
|
|
800
1058
|
};
|
|
@@ -856,11 +1114,17 @@ function LanguageSwitcher({
|
|
|
856
1114
|
"button",
|
|
857
1115
|
{
|
|
858
1116
|
"aria-label": label,
|
|
1117
|
+
"aria-pressed": isActive,
|
|
859
1118
|
className: cn("relative font-semibold", sizes.button, shapeClass),
|
|
860
1119
|
onClick: () => onLanguageChange?.(key),
|
|
861
1120
|
type: "button",
|
|
862
1121
|
children: [
|
|
863
|
-
|
|
1122
|
+
reduceMotion ? isActive ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1123
|
+
"div",
|
|
1124
|
+
{
|
|
1125
|
+
className: cn("absolute inset-0 bg-secondary", shapeClass)
|
|
1126
|
+
}
|
|
1127
|
+
) : null : /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isActive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
864
1128
|
framerMotion.motion.div,
|
|
865
1129
|
{
|
|
866
1130
|
className: cn("absolute inset-0 bg-secondary", shapeClass),
|
|
@@ -4198,7 +4462,7 @@ function VerifiedProfessionalBadge({
|
|
|
4198
4462
|
showLabel = false,
|
|
4199
4463
|
className
|
|
4200
4464
|
}) {
|
|
4201
|
-
if (status === "unverified") {
|
|
4465
|
+
if (status === "unverified" || status === "pending_review" && !showLabel) {
|
|
4202
4466
|
return null;
|
|
4203
4467
|
}
|
|
4204
4468
|
const label = LABELS[status];
|
|
@@ -4567,9 +4831,6 @@ function MessageScrollerButton({
|
|
|
4567
4831
|
}
|
|
4568
4832
|
);
|
|
4569
4833
|
}
|
|
4570
|
-
function initials(name) {
|
|
4571
|
-
return name.split(/\s+/).filter(Boolean).slice(0, 2).map((p) => p[0]?.toUpperCase() ?? "").join("");
|
|
4572
|
-
}
|
|
4573
4834
|
function ChatMessageList({
|
|
4574
4835
|
messages,
|
|
4575
4836
|
currentUserId,
|
|
@@ -4591,7 +4852,14 @@ function ChatMessageList({
|
|
|
4591
4852
|
"Mensaje eliminado \xB7 ",
|
|
4592
4853
|
m.senderName
|
|
4593
4854
|
] }) }) : /* @__PURE__ */ jsxRuntime.jsxs(Message, { align, children: [
|
|
4594
|
-
!mine ? /* @__PURE__ */ jsxRuntime.jsx(MessageAvatar, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4855
|
+
!mine ? /* @__PURE__ */ jsxRuntime.jsx(MessageAvatar, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4856
|
+
"span",
|
|
4857
|
+
{
|
|
4858
|
+
className: "flex size-8 items-center justify-center rounded-full text-xs font-medium",
|
|
4859
|
+
style: avatarFallbackStyle(m.senderName),
|
|
4860
|
+
children: getInitials(m.senderName)
|
|
4861
|
+
}
|
|
4862
|
+
) }) : null,
|
|
4595
4863
|
/* @__PURE__ */ jsxRuntime.jsxs(MessageContent, { children: [
|
|
4596
4864
|
!mine ? /* @__PURE__ */ jsxRuntime.jsx(MessageHeader, { children: m.senderName }) : null,
|
|
4597
4865
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4629,6 +4897,7 @@ exports.BubbleContent = BubbleContent;
|
|
|
4629
4897
|
exports.BubbleGroup = BubbleGroup;
|
|
4630
4898
|
exports.BubbleReactions = BubbleReactions;
|
|
4631
4899
|
exports.ChatMessageList = ChatMessageList;
|
|
4900
|
+
exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
|
|
4632
4901
|
exports.EmojiPicker = EmojiPicker;
|
|
4633
4902
|
exports.EmojiPickerPopover = EmojiPickerPopover;
|
|
4634
4903
|
exports.Empty = Empty;
|
|
@@ -4666,6 +4935,7 @@ exports.SearchCommand = SearchCommand;
|
|
|
4666
4935
|
exports.ThemeSwitcher = ThemeSwitcher;
|
|
4667
4936
|
exports.VerifiedProfessionalBadge = VerifiedProfessionalBadge;
|
|
4668
4937
|
exports.VideoPlayer = VideoPlayer;
|
|
4938
|
+
exports.avatarFallbackStyle = avatarFallbackStyle;
|
|
4669
4939
|
exports.bubbleVariants = bubbleVariants;
|
|
4670
4940
|
exports.cn = cn;
|
|
4671
4941
|
exports.createLiveHlsConfig = createLiveHlsConfig;
|
|
@@ -4673,6 +4943,8 @@ exports.createVodHlsConfig = createVodHlsConfig;
|
|
|
4673
4943
|
exports.defaultLanguages = defaultLanguages;
|
|
4674
4944
|
exports.describePlaybackError = describePlaybackError;
|
|
4675
4945
|
exports.fuzzyMatch = fuzzyMatch;
|
|
4946
|
+
exports.getAvatarColors = getAvatarColors;
|
|
4947
|
+
exports.getInitials = getInitials;
|
|
4676
4948
|
exports.markerVariants = markerVariants;
|
|
4677
4949
|
exports.normalizeEmojiQuery = normalizeEmojiQuery;
|
|
4678
4950
|
exports.shouldRetryLiveEdge404 = shouldRetryLiveEdge404;
|