@sesionario/blocks 1.2.0 → 1.3.1
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.cjs +100 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +98 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -733,6 +733,88 @@ function ThemeSwitcher({
|
|
|
733
733
|
}
|
|
734
734
|
);
|
|
735
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
|
+
}
|
|
736
818
|
var defaultLabels2 = {
|
|
737
819
|
heading: "Organizations",
|
|
738
820
|
create: "Create organization",
|
|
@@ -749,10 +831,11 @@ function TenantAvatar({
|
|
|
749
831
|
"div",
|
|
750
832
|
{
|
|
751
833
|
className: cn(
|
|
752
|
-
"flex shrink-0 items-center justify-center overflow-hidden
|
|
834
|
+
"flex shrink-0 items-center justify-center overflow-hidden font-medium",
|
|
753
835
|
sizeClass
|
|
754
836
|
),
|
|
755
|
-
|
|
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) })
|
|
756
839
|
}
|
|
757
840
|
);
|
|
758
841
|
}
|
|
@@ -778,7 +861,7 @@ function SwitcherSkeleton({
|
|
|
778
861
|
{
|
|
779
862
|
"data-testid": "org-switcher-skeleton",
|
|
780
863
|
className: cn(
|
|
781
|
-
"pointer-events-none flex h-12 min-h-12 w-full items-center gap-2 rounded-md px-2",
|
|
864
|
+
"pointer-events-none flex h-12 min-h-12 w-full items-center gap-2 rounded-md px-2 has-[>svg]:px-2",
|
|
782
865
|
className
|
|
783
866
|
),
|
|
784
867
|
children: [
|
|
@@ -792,8 +875,8 @@ function SwitcherSkeleton({
|
|
|
792
875
|
}
|
|
793
876
|
);
|
|
794
877
|
}
|
|
795
|
-
var triggerClassName = "flex h-12 min-h-12 w-full items-center gap-2 rounded-md px-2 text-left text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-accent-foreground";
|
|
796
|
-
var collapsedTriggerClassName = "size-8 min-h-0 h-8 w-8 justify-center gap-0 p-0 px-0";
|
|
878
|
+
var triggerClassName = "flex h-12 min-h-12 w-full items-center gap-2 rounded-md px-2 py-0 has-[>svg]:px-2 text-left text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-accent-foreground";
|
|
879
|
+
var collapsedTriggerClassName = "size-8 min-h-0 h-8 w-8 justify-center gap-0 p-0 px-0 has-[>svg]:p-0 has-[>svg]:px-0";
|
|
797
880
|
function OrgSwitcher({
|
|
798
881
|
activeTenant,
|
|
799
882
|
tenants,
|
|
@@ -4379,7 +4462,7 @@ function VerifiedProfessionalBadge({
|
|
|
4379
4462
|
showLabel = false,
|
|
4380
4463
|
className
|
|
4381
4464
|
}) {
|
|
4382
|
-
if (status === "unverified") {
|
|
4465
|
+
if (status === "unverified" || status === "pending_review" && !showLabel) {
|
|
4383
4466
|
return null;
|
|
4384
4467
|
}
|
|
4385
4468
|
const label = LABELS[status];
|
|
@@ -4748,9 +4831,6 @@ function MessageScrollerButton({
|
|
|
4748
4831
|
}
|
|
4749
4832
|
);
|
|
4750
4833
|
}
|
|
4751
|
-
function initials(name) {
|
|
4752
|
-
return name.split(/\s+/).filter(Boolean).slice(0, 2).map((p) => p[0]?.toUpperCase() ?? "").join("");
|
|
4753
|
-
}
|
|
4754
4834
|
function ChatMessageList({
|
|
4755
4835
|
messages,
|
|
4756
4836
|
currentUserId,
|
|
@@ -4772,7 +4852,14 @@ function ChatMessageList({
|
|
|
4772
4852
|
"Mensaje eliminado \xB7 ",
|
|
4773
4853
|
m.senderName
|
|
4774
4854
|
] }) }) : /* @__PURE__ */ jsxRuntime.jsxs(Message, { align, children: [
|
|
4775
|
-
!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,
|
|
4776
4863
|
/* @__PURE__ */ jsxRuntime.jsxs(MessageContent, { children: [
|
|
4777
4864
|
!mine ? /* @__PURE__ */ jsxRuntime.jsx(MessageHeader, { children: m.senderName }) : null,
|
|
4778
4865
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4848,6 +4935,7 @@ exports.SearchCommand = SearchCommand;
|
|
|
4848
4935
|
exports.ThemeSwitcher = ThemeSwitcher;
|
|
4849
4936
|
exports.VerifiedProfessionalBadge = VerifiedProfessionalBadge;
|
|
4850
4937
|
exports.VideoPlayer = VideoPlayer;
|
|
4938
|
+
exports.avatarFallbackStyle = avatarFallbackStyle;
|
|
4851
4939
|
exports.bubbleVariants = bubbleVariants;
|
|
4852
4940
|
exports.cn = cn;
|
|
4853
4941
|
exports.createLiveHlsConfig = createLiveHlsConfig;
|
|
@@ -4855,6 +4943,8 @@ exports.createVodHlsConfig = createVodHlsConfig;
|
|
|
4855
4943
|
exports.defaultLanguages = defaultLanguages;
|
|
4856
4944
|
exports.describePlaybackError = describePlaybackError;
|
|
4857
4945
|
exports.fuzzyMatch = fuzzyMatch;
|
|
4946
|
+
exports.getAvatarColors = getAvatarColors;
|
|
4947
|
+
exports.getInitials = getInitials;
|
|
4858
4948
|
exports.markerVariants = markerVariants;
|
|
4859
4949
|
exports.normalizeEmojiQuery = normalizeEmojiQuery;
|
|
4860
4950
|
exports.shouldRetryLiveEdge404 = shouldRetryLiveEdge404;
|