@sesionario/blocks 1.3.1 → 1.4.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.d.cts CHANGED
@@ -9,6 +9,7 @@ import * as RPNInput from 'react-phone-number-input';
9
9
  import { MessageScroller as MessageScroller$1 } from '@shadcn/react/message-scroller';
10
10
  export { useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility } from '@shadcn/react/message-scroller';
11
11
  import { ClassValue } from 'clsx';
12
+ export { AvatarColors, avatarFallbackStyle, getAvatarColors, getInitials } from './avatar.cjs';
12
13
 
13
14
  /**
14
15
  * Blocks Context Interfaces
@@ -334,6 +335,8 @@ interface EmojiPickerPopoverProps extends EmojiPickerProps {
334
335
  triggerLabel?: string;
335
336
  /** Extra classes for the trigger button. */
336
337
  triggerClassName?: string;
338
+ /** Disable the trigger (e.g. when the host field is disabled). */
339
+ disabled?: boolean;
337
340
  /** Popover side. Default `"top"`. */
338
341
  side?: React.ComponentProps<typeof PopoverContent>["side"];
339
342
  /** Popover alignment. Default `"end"`. */
@@ -347,10 +350,38 @@ interface EmojiPickerPopoverProps extends EmojiPickerProps {
347
350
  }
348
351
  /**
349
352
  * Convenience wrapper: a `Smile` icon button that opens {@link EmojiPicker} in
350
- * a popover. Drop it next to a textarea/input; wire `onSelect` to insert at the
351
- * caret. Uncontrolled by default; pass `open`/`onOpenChange` to control it.
353
+ * a popover. Prefer {@link EmojiTextarea} / {@link EmojiInput} for in-field
354
+ * adornment; use this when you need a standalone trigger. Uncontrolled by
355
+ * default; pass `open`/`onOpenChange` to control it.
356
+ */
357
+ declare function EmojiPickerPopover({ onSelect, triggerLabel, triggerClassName, disabled, side, align, open, onOpenChange, keepOpenOnSelect, locale, ...pickerProps }: EmojiPickerPopoverProps): React.JSX.Element;
358
+
359
+ type PickerPassthrough = Pick<EmojiPickerPopoverProps, "triggerLabel" | "keepOpenOnSelect" | "open" | "onOpenChange" | "side" | "align" | "labels" | "recentLimit" | "storageKey">;
360
+ type EmojiFieldSharedProps = PickerPassthrough & {
361
+ /** Locale for the emoji picker labels. Default `"en"`. */
362
+ locale?: EmojiPickerLocale;
363
+ /** Extra classes for the emoji trigger button. */
364
+ emojiTriggerClassName?: string;
365
+ };
366
+ type EmojiTextareaProps = Omit<React.ComponentProps<"textarea">, "children"> & EmojiFieldSharedProps;
367
+ declare const EmojiTextarea: React.ForwardRefExoticComponent<Omit<EmojiTextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
368
+ type EmojiInputProps = Omit<React.ComponentProps<"input">, "children"> & EmojiFieldSharedProps;
369
+ declare const EmojiInput: React.ForwardRefExoticComponent<Omit<EmojiInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
370
+
371
+ /**
372
+ * Splices `text` into `value` at the current caret (falling back to the end
373
+ * when the element is unfocused/unavailable), returning the new value and the
374
+ * caret position right after the inserted text. Used to insert an emoji into
375
+ * a controlled textarea/input without clobbering whatever the user was
376
+ * typing.
352
377
  */
353
- declare function EmojiPickerPopover({ onSelect, triggerLabel, triggerClassName, side, align, open, onOpenChange, keepOpenOnSelect, locale, ...pickerProps }: EmojiPickerPopoverProps): React.JSX.Element;
378
+ declare function insertAtCaret(element: {
379
+ selectionStart: number | null;
380
+ selectionEnd: number | null;
381
+ } | null, value: string, text: string): {
382
+ value: string;
383
+ caret: number;
384
+ };
354
385
 
355
386
  /**
356
387
  * Playback error description, ported from the app's HLS player but stripped of
@@ -778,21 +809,4 @@ declare function ChatMessageList({ messages, currentUserId, emptyTitle, emptyDes
778
809
 
779
810
  declare function cn(...inputs: ClassValue[]): string;
780
811
 
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 };
812
+ export { type AutoplayState, 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, EmojiInput, type EmojiInputProps, EmojiPicker, type EmojiPickerLabels, type EmojiPickerLocale, EmojiPickerPopover, type EmojiPickerPopoverProps, type EmojiPickerProps, type EmojiSkinTone, EmojiTextarea, type EmojiTextareaProps, 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, bubbleVariants, cn, createLiveHlsConfig, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey };
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import * as RPNInput from 'react-phone-number-input';
9
9
  import { MessageScroller as MessageScroller$1 } from '@shadcn/react/message-scroller';
10
10
  export { useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility } from '@shadcn/react/message-scroller';
11
11
  import { ClassValue } from 'clsx';
12
+ export { AvatarColors, avatarFallbackStyle, getAvatarColors, getInitials } from './avatar.js';
12
13
 
13
14
  /**
14
15
  * Blocks Context Interfaces
@@ -334,6 +335,8 @@ interface EmojiPickerPopoverProps extends EmojiPickerProps {
334
335
  triggerLabel?: string;
335
336
  /** Extra classes for the trigger button. */
336
337
  triggerClassName?: string;
338
+ /** Disable the trigger (e.g. when the host field is disabled). */
339
+ disabled?: boolean;
337
340
  /** Popover side. Default `"top"`. */
338
341
  side?: React.ComponentProps<typeof PopoverContent>["side"];
339
342
  /** Popover alignment. Default `"end"`. */
@@ -347,10 +350,38 @@ interface EmojiPickerPopoverProps extends EmojiPickerProps {
347
350
  }
348
351
  /**
349
352
  * Convenience wrapper: a `Smile` icon button that opens {@link EmojiPicker} in
350
- * a popover. Drop it next to a textarea/input; wire `onSelect` to insert at the
351
- * caret. Uncontrolled by default; pass `open`/`onOpenChange` to control it.
353
+ * a popover. Prefer {@link EmojiTextarea} / {@link EmojiInput} for in-field
354
+ * adornment; use this when you need a standalone trigger. Uncontrolled by
355
+ * default; pass `open`/`onOpenChange` to control it.
356
+ */
357
+ declare function EmojiPickerPopover({ onSelect, triggerLabel, triggerClassName, disabled, side, align, open, onOpenChange, keepOpenOnSelect, locale, ...pickerProps }: EmojiPickerPopoverProps): React.JSX.Element;
358
+
359
+ type PickerPassthrough = Pick<EmojiPickerPopoverProps, "triggerLabel" | "keepOpenOnSelect" | "open" | "onOpenChange" | "side" | "align" | "labels" | "recentLimit" | "storageKey">;
360
+ type EmojiFieldSharedProps = PickerPassthrough & {
361
+ /** Locale for the emoji picker labels. Default `"en"`. */
362
+ locale?: EmojiPickerLocale;
363
+ /** Extra classes for the emoji trigger button. */
364
+ emojiTriggerClassName?: string;
365
+ };
366
+ type EmojiTextareaProps = Omit<React.ComponentProps<"textarea">, "children"> & EmojiFieldSharedProps;
367
+ declare const EmojiTextarea: React.ForwardRefExoticComponent<Omit<EmojiTextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
368
+ type EmojiInputProps = Omit<React.ComponentProps<"input">, "children"> & EmojiFieldSharedProps;
369
+ declare const EmojiInput: React.ForwardRefExoticComponent<Omit<EmojiInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
370
+
371
+ /**
372
+ * Splices `text` into `value` at the current caret (falling back to the end
373
+ * when the element is unfocused/unavailable), returning the new value and the
374
+ * caret position right after the inserted text. Used to insert an emoji into
375
+ * a controlled textarea/input without clobbering whatever the user was
376
+ * typing.
352
377
  */
353
- declare function EmojiPickerPopover({ onSelect, triggerLabel, triggerClassName, side, align, open, onOpenChange, keepOpenOnSelect, locale, ...pickerProps }: EmojiPickerPopoverProps): React.JSX.Element;
378
+ declare function insertAtCaret(element: {
379
+ selectionStart: number | null;
380
+ selectionEnd: number | null;
381
+ } | null, value: string, text: string): {
382
+ value: string;
383
+ caret: number;
384
+ };
354
385
 
355
386
  /**
356
387
  * Playback error description, ported from the app's HLS player but stripped of
@@ -778,21 +809,4 @@ declare function ChatMessageList({ messages, currentUserId, emptyTitle, emptyDes
778
809
 
779
810
  declare function cn(...inputs: ClassValue[]): string;
780
811
 
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 };
812
+ export { type AutoplayState, 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, EmojiInput, type EmojiInputProps, EmojiPicker, type EmojiPickerLabels, type EmojiPickerLocale, EmojiPickerPopover, type EmojiPickerPopoverProps, type EmojiPickerProps, type EmojiSkinTone, EmojiTextarea, type EmojiTextareaProps, 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, bubbleVariants, cn, createLiveHlsConfig, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey };