@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.d.cts
CHANGED
|
@@ -778,4 +778,21 @@ declare function ChatMessageList({ messages, currentUserId, emptyTitle, emptyDes
|
|
|
778
778
|
|
|
779
779
|
declare function cn(...inputs: ClassValue[]): string;
|
|
780
780
|
|
|
781
|
-
|
|
781
|
+
type AvatarColors = {
|
|
782
|
+
backgroundColor: string;
|
|
783
|
+
color: string;
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* Word-based initials from a display name (max letters, default 2).
|
|
787
|
+
* Empty / whitespace-only names yield `"?"`.
|
|
788
|
+
*/
|
|
789
|
+
declare function getInitials(name: string, max?: number): string;
|
|
790
|
+
/**
|
|
791
|
+
* Deterministic background + contrasting foreground from a full name.
|
|
792
|
+
* Same name (case-insensitive) always maps to the same colors.
|
|
793
|
+
*/
|
|
794
|
+
declare function getAvatarColors(name: string): AvatarColors;
|
|
795
|
+
/** CSS style object for `AvatarFallback` (or any letter-avatar container). */
|
|
796
|
+
declare function avatarFallbackStyle(name: string): Pick<AvatarColors, "backgroundColor" | "color">;
|
|
797
|
+
|
|
798
|
+
export { type AutoplayState, type AvatarColors, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type DescribedPlaybackError, type EmojiCategoryData, type EmojiCategoryKey, type EmojiDatum, EmojiPicker, type EmojiPickerLabels, type EmojiPickerLocale, EmojiPickerPopover, type EmojiPickerPopoverProps, type EmojiPickerProps, type EmojiSkinTone, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, type EmptyStateProps, EmptyTitle, ErrorState, type FeatureEntry, type HlsPlayerMode, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, type MexicoMapProps, type MexicoState, type MexicoStateId, OrgSwitcher, type OrgSwitcherLabels, type OrgSwitcherProps, type OrgSwitcherTenant, PhoneInput, type PhoneInputProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, getAvatarColors, getInitials, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey };
|
package/dist/index.d.ts
CHANGED
|
@@ -778,4 +778,21 @@ declare function ChatMessageList({ messages, currentUserId, emptyTitle, emptyDes
|
|
|
778
778
|
|
|
779
779
|
declare function cn(...inputs: ClassValue[]): string;
|
|
780
780
|
|
|
781
|
-
|
|
781
|
+
type AvatarColors = {
|
|
782
|
+
backgroundColor: string;
|
|
783
|
+
color: string;
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* Word-based initials from a display name (max letters, default 2).
|
|
787
|
+
* Empty / whitespace-only names yield `"?"`.
|
|
788
|
+
*/
|
|
789
|
+
declare function getInitials(name: string, max?: number): string;
|
|
790
|
+
/**
|
|
791
|
+
* Deterministic background + contrasting foreground from a full name.
|
|
792
|
+
* Same name (case-insensitive) always maps to the same colors.
|
|
793
|
+
*/
|
|
794
|
+
declare function getAvatarColors(name: string): AvatarColors;
|
|
795
|
+
/** CSS style object for `AvatarFallback` (or any letter-avatar container). */
|
|
796
|
+
declare function avatarFallbackStyle(name: string): Pick<AvatarColors, "backgroundColor" | "color">;
|
|
797
|
+
|
|
798
|
+
export { type AutoplayState, type AvatarColors, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type DescribedPlaybackError, type EmojiCategoryData, type EmojiCategoryKey, type EmojiDatum, EmojiPicker, type EmojiPickerLabels, type EmojiPickerLocale, EmojiPickerPopover, type EmojiPickerPopoverProps, type EmojiPickerProps, type EmojiSkinTone, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, type EmptyStateProps, EmptyTitle, ErrorState, type FeatureEntry, type HlsPlayerMode, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, type MexicoMapProps, type MexicoState, type MexicoStateId, OrgSwitcher, type OrgSwitcherLabels, type OrgSwitcherProps, type OrgSwitcherTenant, PhoneInput, type PhoneInputProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, getAvatarColors, getInitials, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey };
|
package/dist/index.js
CHANGED
|
@@ -702,6 +702,88 @@ function ThemeSwitcher({
|
|
|
702
702
|
}
|
|
703
703
|
);
|
|
704
704
|
}
|
|
705
|
+
|
|
706
|
+
// src/lib/avatar.ts
|
|
707
|
+
var EMPTY_COLORS = {
|
|
708
|
+
backgroundColor: "#9ca3af",
|
|
709
|
+
color: "#111111"
|
|
710
|
+
};
|
|
711
|
+
var AVATAR_PALETTE = [
|
|
712
|
+
"#4f6d8c",
|
|
713
|
+
// slate blue
|
|
714
|
+
"#3d7a6a",
|
|
715
|
+
// teal
|
|
716
|
+
"#6b5b8a",
|
|
717
|
+
// muted purple
|
|
718
|
+
"#8a5a4a",
|
|
719
|
+
// warm brown
|
|
720
|
+
"#4a7a8a",
|
|
721
|
+
// steel cyan
|
|
722
|
+
"#7a6b4a",
|
|
723
|
+
// olive
|
|
724
|
+
"#5a6b8a",
|
|
725
|
+
// periwinkle
|
|
726
|
+
"#8a4a5a",
|
|
727
|
+
// rose
|
|
728
|
+
"#4a8a6b",
|
|
729
|
+
// green
|
|
730
|
+
"#6b4a7a",
|
|
731
|
+
// plum
|
|
732
|
+
"#8a6b4a",
|
|
733
|
+
// amber brown
|
|
734
|
+
"#4a5a8a",
|
|
735
|
+
// indigo
|
|
736
|
+
"#7a4a6b",
|
|
737
|
+
// mauve
|
|
738
|
+
"#5a8a4a",
|
|
739
|
+
// leaf
|
|
740
|
+
"#8a5a7a",
|
|
741
|
+
// dusty pink
|
|
742
|
+
"#3d6b7a"
|
|
743
|
+
// deep teal
|
|
744
|
+
];
|
|
745
|
+
function hashString(input) {
|
|
746
|
+
let hash = 2166136261;
|
|
747
|
+
for (let i = 0; i < input.length; i++) {
|
|
748
|
+
hash ^= input.charCodeAt(i);
|
|
749
|
+
hash = Math.imul(hash, 16777619);
|
|
750
|
+
}
|
|
751
|
+
return hash >>> 0;
|
|
752
|
+
}
|
|
753
|
+
function srgbToLinear(channel) {
|
|
754
|
+
const c = channel / 255;
|
|
755
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
756
|
+
}
|
|
757
|
+
function relativeLuminance(hex) {
|
|
758
|
+
const normalized = hex.replace("#", "");
|
|
759
|
+
const r = Number.parseInt(normalized.slice(0, 2), 16);
|
|
760
|
+
const g = Number.parseInt(normalized.slice(2, 4), 16);
|
|
761
|
+
const b = Number.parseInt(normalized.slice(4, 6), 16);
|
|
762
|
+
return 0.2126 * srgbToLinear(r) + 0.7152 * srgbToLinear(g) + 0.0722 * srgbToLinear(b);
|
|
763
|
+
}
|
|
764
|
+
function contrastingTextColor(backgroundHex) {
|
|
765
|
+
return relativeLuminance(backgroundHex) > 0.179 ? "#111111" : "#ffffff";
|
|
766
|
+
}
|
|
767
|
+
function getInitials(name, max = 2) {
|
|
768
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
769
|
+
if (parts.length === 0) return "?";
|
|
770
|
+
const letters = parts.slice(0, Math.max(1, max)).map((part) => part.charAt(0)).join("");
|
|
771
|
+
return letters.toUpperCase() || "?";
|
|
772
|
+
}
|
|
773
|
+
function getAvatarColors(name) {
|
|
774
|
+
const normalized = name.trim().toLowerCase();
|
|
775
|
+
if (!normalized) {
|
|
776
|
+
return { ...EMPTY_COLORS };
|
|
777
|
+
}
|
|
778
|
+
const backgroundColor = AVATAR_PALETTE[hashString(normalized) % AVATAR_PALETTE.length];
|
|
779
|
+
return {
|
|
780
|
+
backgroundColor,
|
|
781
|
+
color: contrastingTextColor(backgroundColor)
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
function avatarFallbackStyle(name) {
|
|
785
|
+
return getAvatarColors(name);
|
|
786
|
+
}
|
|
705
787
|
var defaultLabels2 = {
|
|
706
788
|
heading: "Organizations",
|
|
707
789
|
create: "Create organization",
|
|
@@ -718,10 +800,11 @@ function TenantAvatar({
|
|
|
718
800
|
"div",
|
|
719
801
|
{
|
|
720
802
|
className: cn(
|
|
721
|
-
"flex shrink-0 items-center justify-center overflow-hidden
|
|
803
|
+
"flex shrink-0 items-center justify-center overflow-hidden font-medium",
|
|
722
804
|
sizeClass
|
|
723
805
|
),
|
|
724
|
-
|
|
806
|
+
style: logo ? void 0 : avatarFallbackStyle(name),
|
|
807
|
+
children: logo ? /* @__PURE__ */ jsx("img", { src: logo, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx("span", { className: textClass, children: getInitials(name) })
|
|
725
808
|
}
|
|
726
809
|
);
|
|
727
810
|
}
|
|
@@ -747,7 +830,7 @@ function SwitcherSkeleton({
|
|
|
747
830
|
{
|
|
748
831
|
"data-testid": "org-switcher-skeleton",
|
|
749
832
|
className: cn(
|
|
750
|
-
"pointer-events-none flex h-12 min-h-12 w-full items-center gap-2 rounded-md px-2",
|
|
833
|
+
"pointer-events-none flex h-12 min-h-12 w-full items-center gap-2 rounded-md px-2 has-[>svg]:px-2",
|
|
751
834
|
className
|
|
752
835
|
),
|
|
753
836
|
children: [
|
|
@@ -761,8 +844,8 @@ function SwitcherSkeleton({
|
|
|
761
844
|
}
|
|
762
845
|
);
|
|
763
846
|
}
|
|
764
|
-
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";
|
|
765
|
-
var collapsedTriggerClassName = "size-8 min-h-0 h-8 w-8 justify-center gap-0 p-0 px-0";
|
|
847
|
+
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";
|
|
848
|
+
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";
|
|
766
849
|
function OrgSwitcher({
|
|
767
850
|
activeTenant,
|
|
768
851
|
tenants,
|
|
@@ -4348,7 +4431,7 @@ function VerifiedProfessionalBadge({
|
|
|
4348
4431
|
showLabel = false,
|
|
4349
4432
|
className
|
|
4350
4433
|
}) {
|
|
4351
|
-
if (status === "unverified") {
|
|
4434
|
+
if (status === "unverified" || status === "pending_review" && !showLabel) {
|
|
4352
4435
|
return null;
|
|
4353
4436
|
}
|
|
4354
4437
|
const label = LABELS[status];
|
|
@@ -4717,9 +4800,6 @@ function MessageScrollerButton({
|
|
|
4717
4800
|
}
|
|
4718
4801
|
);
|
|
4719
4802
|
}
|
|
4720
|
-
function initials(name) {
|
|
4721
|
-
return name.split(/\s+/).filter(Boolean).slice(0, 2).map((p) => p[0]?.toUpperCase() ?? "").join("");
|
|
4722
|
-
}
|
|
4723
4803
|
function ChatMessageList({
|
|
4724
4804
|
messages,
|
|
4725
4805
|
currentUserId,
|
|
@@ -4741,7 +4821,14 @@ function ChatMessageList({
|
|
|
4741
4821
|
"Mensaje eliminado \xB7 ",
|
|
4742
4822
|
m.senderName
|
|
4743
4823
|
] }) }) : /* @__PURE__ */ jsxs(Message, { align, children: [
|
|
4744
|
-
!mine ? /* @__PURE__ */ jsx(MessageAvatar, { children: /* @__PURE__ */ jsx(
|
|
4824
|
+
!mine ? /* @__PURE__ */ jsx(MessageAvatar, { children: /* @__PURE__ */ jsx(
|
|
4825
|
+
"span",
|
|
4826
|
+
{
|
|
4827
|
+
className: "flex size-8 items-center justify-center rounded-full text-xs font-medium",
|
|
4828
|
+
style: avatarFallbackStyle(m.senderName),
|
|
4829
|
+
children: getInitials(m.senderName)
|
|
4830
|
+
}
|
|
4831
|
+
) }) : null,
|
|
4745
4832
|
/* @__PURE__ */ jsxs(MessageContent, { children: [
|
|
4746
4833
|
!mine ? /* @__PURE__ */ jsx(MessageHeader, { children: m.senderName }) : null,
|
|
4747
4834
|
/* @__PURE__ */ jsx(
|
|
@@ -4760,6 +4847,6 @@ function ChatMessageList({
|
|
|
4760
4847
|
] }) });
|
|
4761
4848
|
}
|
|
4762
4849
|
|
|
4763
|
-
export { AvatarEditor, AvatarEditorDialog, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, EmojiPicker, EmojiPickerPopover, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PhoneInput, SearchCommand, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, bubbleVariants, cn, createLiveHlsConfig, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey };
|
|
4850
|
+
export { AvatarEditor, AvatarEditorDialog, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, EmojiPicker, EmojiPickerPopover, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PhoneInput, SearchCommand, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, getAvatarColors, getInitials, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey };
|
|
4764
4851
|
//# sourceMappingURL=index.js.map
|
|
4765
4852
|
//# sourceMappingURL=index.js.map
|