@algenium/blocks 1.3.0 → 1.4.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/dist/index.cjs +303 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +299 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -174,6 +174,24 @@ declare const LanguageContext: React.Context<LanguageContextValue | null>;
|
|
|
174
174
|
* Returns null if no provider is present (components should fall back to props).
|
|
175
175
|
*/
|
|
176
176
|
declare function useLanguageContext(): LanguageContextValue | null;
|
|
177
|
+
/**
|
|
178
|
+
* Isolated data plane environments aligned with API key environments.
|
|
179
|
+
*/
|
|
180
|
+
type BlocksDataEnvironment = "production" | "staging" | "development";
|
|
181
|
+
declare const BLOCKS_DATA_ENVIRONMENTS: readonly BlocksDataEnvironment[];
|
|
182
|
+
declare function isBlocksDataEnvironment(value: string): value is BlocksDataEnvironment;
|
|
183
|
+
/**
|
|
184
|
+
* Context value for environment switcher / banner.
|
|
185
|
+
* Apps provide persistence (cookie + store) and wire `setEnvironment`.
|
|
186
|
+
*/
|
|
187
|
+
interface EnvironmentContextValue {
|
|
188
|
+
environment: BlocksDataEnvironment;
|
|
189
|
+
setEnvironment: (environment: BlocksDataEnvironment) => void;
|
|
190
|
+
/** Optional override of environments shown in the switcher */
|
|
191
|
+
environments?: readonly BlocksDataEnvironment[];
|
|
192
|
+
}
|
|
193
|
+
declare const EnvironmentContext: React.Context<EnvironmentContextValue | null>;
|
|
194
|
+
declare function useEnvironmentContext(): EnvironmentContextValue | null;
|
|
177
195
|
|
|
178
196
|
type ThemeSwitcherLabels = {
|
|
179
197
|
/** Tooltip label for the theme switcher */
|
|
@@ -265,6 +283,48 @@ type LanguageSwitcherProps = {
|
|
|
265
283
|
};
|
|
266
284
|
declare function LanguageSwitcher({ languages: propLanguages, currentLanguage: propCurrentLanguage, onLanguageChange: propOnLanguageChange, labels, className, size, shape, variant, showIcon, align, side, tooltipSide, tooltipAlign, tooltipSideOffset, }: LanguageSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
267
285
|
|
|
286
|
+
type EnvironmentSwitcherLabels = {
|
|
287
|
+
/** Tooltip / aria for the control */
|
|
288
|
+
environment?: string;
|
|
289
|
+
live?: string;
|
|
290
|
+
staging?: string;
|
|
291
|
+
development?: string;
|
|
292
|
+
};
|
|
293
|
+
type EnvironmentSwitcherProps = {
|
|
294
|
+
className?: string;
|
|
295
|
+
/** Current environment. Overrides context when set. */
|
|
296
|
+
environment?: BlocksDataEnvironment;
|
|
297
|
+
/** Called after user selects an environment. Overrides context when set. */
|
|
298
|
+
onEnvironmentChange?: (environment: BlocksDataEnvironment) => void;
|
|
299
|
+
/** Environments shown in the menu (defaults to all three) */
|
|
300
|
+
environments?: readonly BlocksDataEnvironment[];
|
|
301
|
+
labels?: EnvironmentSwitcherLabels;
|
|
302
|
+
size?: "sm" | "md" | "lg";
|
|
303
|
+
shape?: "rounded" | "pill";
|
|
304
|
+
variant?: "default" | "mini";
|
|
305
|
+
align?: "start" | "center" | "end";
|
|
306
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
307
|
+
tooltipSide?: "top" | "right" | "bottom" | "left";
|
|
308
|
+
tooltipAlign?: "start" | "center" | "end";
|
|
309
|
+
tooltipSideOffset?: number;
|
|
310
|
+
};
|
|
311
|
+
declare function EnvironmentSwitcher({ className, environment: propEnvironment, onEnvironmentChange: propOnEnvironmentChange, environments: propEnvironments, labels: userLabels, size, shape, variant, align, side, tooltipSide, tooltipAlign, tooltipSideOffset, }: EnvironmentSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
312
|
+
|
|
313
|
+
type EnvironmentBannerLabels = {
|
|
314
|
+
stagingMessage?: string;
|
|
315
|
+
developmentMessage?: string;
|
|
316
|
+
dismiss?: string;
|
|
317
|
+
};
|
|
318
|
+
type EnvironmentBannerProps = {
|
|
319
|
+
className?: string;
|
|
320
|
+
/** Overrides context when set */
|
|
321
|
+
environment?: BlocksDataEnvironment;
|
|
322
|
+
labels?: EnvironmentBannerLabels;
|
|
323
|
+
/** When false, banner is not shown (e.g. embed) */
|
|
324
|
+
enabled?: boolean;
|
|
325
|
+
};
|
|
326
|
+
declare function EnvironmentBanner({ className, environment: propEnvironment, labels: userLabels, enabled, }: EnvironmentBannerProps): react_jsx_runtime.JSX.Element | null;
|
|
327
|
+
|
|
268
328
|
interface AvatarEditorProps {
|
|
269
329
|
/** Current cropped image as data URL (controlled) */
|
|
270
330
|
value?: string | null;
|
|
@@ -663,4 +723,4 @@ declare function ScrollBar({ className, orientation, ...props }: React.Component
|
|
|
663
723
|
|
|
664
724
|
declare function cn(...inputs: ClassValue[]): string;
|
|
665
725
|
|
|
666
|
-
export { AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, type BlocksNotification, Button, CalendarContext, type CalendarContextValue, type CalendarData, type CalendarEvent, CalendarSubscribeButton, type CalendarSubscribeButtonProps, CalendarView, type CalendarViewLabels, type CalendarViewMode, type CalendarViewProps, CalendarWidget, type CalendarWidgetLabels, type CalendarWidgetProps, type ChatConversation, type ChatConversationRoom, type ChatMessageData, type ChatRoomConfig, ChatRoomView, type ChatRoomViewLabels, type ChatRoomViewProps, ChatSidebar, ChatSidebarContext, type ChatSidebarContextValue, type ChatSidebarLabels, type ChatSidebarProps, ChatSidebarProvider, type ChatSidebarProviderProps, type ChatSidebarView, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EventDialog, type EventDialogLabels, type EventDialogProps, EventRsvpBadge, type EventRsvpBadgeProps, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, MiniCalendar, type MiniCalendarProps, type Notification, type NotificationType, NotificationsContext, type NotificationsContextValue, NotificationsWidget, type NotificationsWidgetProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, Slider, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UpcomingEvents, type UpcomingEventsProps, type UseChatRoomResult, buttonVariants, cn, defaultLanguages, toggleVariants, useCalendarContext, useChatRoom, useChatSidebar, useLanguageContext, useNotificationsContext };
|
|
726
|
+
export { AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, BLOCKS_DATA_ENVIRONMENTS, type BlocksDataEnvironment, type BlocksLanguage, type BlocksNotification, Button, CalendarContext, type CalendarContextValue, type CalendarData, type CalendarEvent, CalendarSubscribeButton, type CalendarSubscribeButtonProps, CalendarView, type CalendarViewLabels, type CalendarViewMode, type CalendarViewProps, CalendarWidget, type CalendarWidgetLabels, type CalendarWidgetProps, type ChatConversation, type ChatConversationRoom, type ChatMessageData, type ChatRoomConfig, ChatRoomView, type ChatRoomViewLabels, type ChatRoomViewProps, ChatSidebar, ChatSidebarContext, type ChatSidebarContextValue, type ChatSidebarLabels, type ChatSidebarProps, ChatSidebarProvider, type ChatSidebarProviderProps, type ChatSidebarView, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EnvironmentBanner, type EnvironmentBannerLabels, type EnvironmentBannerProps, EnvironmentContext, type EnvironmentContextValue, EnvironmentSwitcher, type EnvironmentSwitcherLabels, type EnvironmentSwitcherProps, EventDialog, type EventDialogLabels, type EventDialogProps, EventRsvpBadge, type EventRsvpBadgeProps, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, MiniCalendar, type MiniCalendarProps, type Notification, type NotificationType, NotificationsContext, type NotificationsContextValue, NotificationsWidget, type NotificationsWidgetProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, Slider, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UpcomingEvents, type UpcomingEventsProps, type UseChatRoomResult, buttonVariants, cn, defaultLanguages, isBlocksDataEnvironment, toggleVariants, useCalendarContext, useChatRoom, useChatSidebar, useEnvironmentContext, useLanguageContext, useNotificationsContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -174,6 +174,24 @@ declare const LanguageContext: React.Context<LanguageContextValue | null>;
|
|
|
174
174
|
* Returns null if no provider is present (components should fall back to props).
|
|
175
175
|
*/
|
|
176
176
|
declare function useLanguageContext(): LanguageContextValue | null;
|
|
177
|
+
/**
|
|
178
|
+
* Isolated data plane environments aligned with API key environments.
|
|
179
|
+
*/
|
|
180
|
+
type BlocksDataEnvironment = "production" | "staging" | "development";
|
|
181
|
+
declare const BLOCKS_DATA_ENVIRONMENTS: readonly BlocksDataEnvironment[];
|
|
182
|
+
declare function isBlocksDataEnvironment(value: string): value is BlocksDataEnvironment;
|
|
183
|
+
/**
|
|
184
|
+
* Context value for environment switcher / banner.
|
|
185
|
+
* Apps provide persistence (cookie + store) and wire `setEnvironment`.
|
|
186
|
+
*/
|
|
187
|
+
interface EnvironmentContextValue {
|
|
188
|
+
environment: BlocksDataEnvironment;
|
|
189
|
+
setEnvironment: (environment: BlocksDataEnvironment) => void;
|
|
190
|
+
/** Optional override of environments shown in the switcher */
|
|
191
|
+
environments?: readonly BlocksDataEnvironment[];
|
|
192
|
+
}
|
|
193
|
+
declare const EnvironmentContext: React.Context<EnvironmentContextValue | null>;
|
|
194
|
+
declare function useEnvironmentContext(): EnvironmentContextValue | null;
|
|
177
195
|
|
|
178
196
|
type ThemeSwitcherLabels = {
|
|
179
197
|
/** Tooltip label for the theme switcher */
|
|
@@ -265,6 +283,48 @@ type LanguageSwitcherProps = {
|
|
|
265
283
|
};
|
|
266
284
|
declare function LanguageSwitcher({ languages: propLanguages, currentLanguage: propCurrentLanguage, onLanguageChange: propOnLanguageChange, labels, className, size, shape, variant, showIcon, align, side, tooltipSide, tooltipAlign, tooltipSideOffset, }: LanguageSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
267
285
|
|
|
286
|
+
type EnvironmentSwitcherLabels = {
|
|
287
|
+
/** Tooltip / aria for the control */
|
|
288
|
+
environment?: string;
|
|
289
|
+
live?: string;
|
|
290
|
+
staging?: string;
|
|
291
|
+
development?: string;
|
|
292
|
+
};
|
|
293
|
+
type EnvironmentSwitcherProps = {
|
|
294
|
+
className?: string;
|
|
295
|
+
/** Current environment. Overrides context when set. */
|
|
296
|
+
environment?: BlocksDataEnvironment;
|
|
297
|
+
/** Called after user selects an environment. Overrides context when set. */
|
|
298
|
+
onEnvironmentChange?: (environment: BlocksDataEnvironment) => void;
|
|
299
|
+
/** Environments shown in the menu (defaults to all three) */
|
|
300
|
+
environments?: readonly BlocksDataEnvironment[];
|
|
301
|
+
labels?: EnvironmentSwitcherLabels;
|
|
302
|
+
size?: "sm" | "md" | "lg";
|
|
303
|
+
shape?: "rounded" | "pill";
|
|
304
|
+
variant?: "default" | "mini";
|
|
305
|
+
align?: "start" | "center" | "end";
|
|
306
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
307
|
+
tooltipSide?: "top" | "right" | "bottom" | "left";
|
|
308
|
+
tooltipAlign?: "start" | "center" | "end";
|
|
309
|
+
tooltipSideOffset?: number;
|
|
310
|
+
};
|
|
311
|
+
declare function EnvironmentSwitcher({ className, environment: propEnvironment, onEnvironmentChange: propOnEnvironmentChange, environments: propEnvironments, labels: userLabels, size, shape, variant, align, side, tooltipSide, tooltipAlign, tooltipSideOffset, }: EnvironmentSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
312
|
+
|
|
313
|
+
type EnvironmentBannerLabels = {
|
|
314
|
+
stagingMessage?: string;
|
|
315
|
+
developmentMessage?: string;
|
|
316
|
+
dismiss?: string;
|
|
317
|
+
};
|
|
318
|
+
type EnvironmentBannerProps = {
|
|
319
|
+
className?: string;
|
|
320
|
+
/** Overrides context when set */
|
|
321
|
+
environment?: BlocksDataEnvironment;
|
|
322
|
+
labels?: EnvironmentBannerLabels;
|
|
323
|
+
/** When false, banner is not shown (e.g. embed) */
|
|
324
|
+
enabled?: boolean;
|
|
325
|
+
};
|
|
326
|
+
declare function EnvironmentBanner({ className, environment: propEnvironment, labels: userLabels, enabled, }: EnvironmentBannerProps): react_jsx_runtime.JSX.Element | null;
|
|
327
|
+
|
|
268
328
|
interface AvatarEditorProps {
|
|
269
329
|
/** Current cropped image as data URL (controlled) */
|
|
270
330
|
value?: string | null;
|
|
@@ -663,4 +723,4 @@ declare function ScrollBar({ className, orientation, ...props }: React.Component
|
|
|
663
723
|
|
|
664
724
|
declare function cn(...inputs: ClassValue[]): string;
|
|
665
725
|
|
|
666
|
-
export { AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, type BlocksNotification, Button, CalendarContext, type CalendarContextValue, type CalendarData, type CalendarEvent, CalendarSubscribeButton, type CalendarSubscribeButtonProps, CalendarView, type CalendarViewLabels, type CalendarViewMode, type CalendarViewProps, CalendarWidget, type CalendarWidgetLabels, type CalendarWidgetProps, type ChatConversation, type ChatConversationRoom, type ChatMessageData, type ChatRoomConfig, ChatRoomView, type ChatRoomViewLabels, type ChatRoomViewProps, ChatSidebar, ChatSidebarContext, type ChatSidebarContextValue, type ChatSidebarLabels, type ChatSidebarProps, ChatSidebarProvider, type ChatSidebarProviderProps, type ChatSidebarView, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EventDialog, type EventDialogLabels, type EventDialogProps, EventRsvpBadge, type EventRsvpBadgeProps, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, MiniCalendar, type MiniCalendarProps, type Notification, type NotificationType, NotificationsContext, type NotificationsContextValue, NotificationsWidget, type NotificationsWidgetProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, Slider, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UpcomingEvents, type UpcomingEventsProps, type UseChatRoomResult, buttonVariants, cn, defaultLanguages, toggleVariants, useCalendarContext, useChatRoom, useChatSidebar, useLanguageContext, useNotificationsContext };
|
|
726
|
+
export { AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, BLOCKS_DATA_ENVIRONMENTS, type BlocksDataEnvironment, type BlocksLanguage, type BlocksNotification, Button, CalendarContext, type CalendarContextValue, type CalendarData, type CalendarEvent, CalendarSubscribeButton, type CalendarSubscribeButtonProps, CalendarView, type CalendarViewLabels, type CalendarViewMode, type CalendarViewProps, CalendarWidget, type CalendarWidgetLabels, type CalendarWidgetProps, type ChatConversation, type ChatConversationRoom, type ChatMessageData, type ChatRoomConfig, ChatRoomView, type ChatRoomViewLabels, type ChatRoomViewProps, ChatSidebar, ChatSidebarContext, type ChatSidebarContextValue, type ChatSidebarLabels, type ChatSidebarProps, ChatSidebarProvider, type ChatSidebarProviderProps, type ChatSidebarView, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EnvironmentBanner, type EnvironmentBannerLabels, type EnvironmentBannerProps, EnvironmentContext, type EnvironmentContextValue, EnvironmentSwitcher, type EnvironmentSwitcherLabels, type EnvironmentSwitcherProps, EventDialog, type EventDialogLabels, type EventDialogProps, EventRsvpBadge, type EventRsvpBadgeProps, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, MiniCalendar, type MiniCalendarProps, type Notification, type NotificationType, NotificationsContext, type NotificationsContextValue, NotificationsWidget, type NotificationsWidgetProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, Slider, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UpcomingEvents, type UpcomingEventsProps, type UseChatRoomResult, buttonVariants, cn, defaultLanguages, isBlocksDataEnvironment, toggleVariants, useCalendarContext, useChatRoom, useChatSidebar, useEnvironmentContext, useLanguageContext, useNotificationsContext };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React2 from 'react';
|
|
2
2
|
import { createContext, useContext, useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
|
3
3
|
import { useTheme } from 'next-themes';
|
|
4
|
-
import { CheckIcon, CircleIcon, ChevronRightIcon, Monitor, Sun, Moon, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw,
|
|
4
|
+
import { CheckIcon, CircleIcon, ChevronRightIcon, Monitor, Sun, Moon, Languages, FlaskConical, X, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, XIcon, User, Pencil, Check, Loader2, Bell, CheckCheck, XCircle, AlertTriangle, CheckCircle, Info, Trash2, Clock, MapPin, Link, CalendarDays, ExternalLink, ChevronLeft, ChevronRight, Plus, HelpCircle, MessageSquare, Wifi, WifiOff, FileIcon, Download, Paperclip, Send, ArrowLeft } from 'lucide-react';
|
|
5
5
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
6
6
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -40,6 +40,20 @@ var LanguageContext = createContext(null);
|
|
|
40
40
|
function useLanguageContext() {
|
|
41
41
|
return useContext(LanguageContext);
|
|
42
42
|
}
|
|
43
|
+
var BLOCKS_DATA_ENVIRONMENTS = [
|
|
44
|
+
"production",
|
|
45
|
+
"staging",
|
|
46
|
+
"development"
|
|
47
|
+
];
|
|
48
|
+
function isBlocksDataEnvironment(value) {
|
|
49
|
+
return BLOCKS_DATA_ENVIRONMENTS.includes(value);
|
|
50
|
+
}
|
|
51
|
+
var EnvironmentContext = createContext(
|
|
52
|
+
null
|
|
53
|
+
);
|
|
54
|
+
function useEnvironmentContext() {
|
|
55
|
+
return useContext(EnvironmentContext);
|
|
56
|
+
}
|
|
43
57
|
|
|
44
58
|
// node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
45
59
|
function r(e) {
|
|
@@ -3641,7 +3655,7 @@ function LanguageSwitcher({
|
|
|
3641
3655
|
const onLanguageChange = propOnLanguageChange ?? context?.setLanguage;
|
|
3642
3656
|
const sizes = sizeClasses2[size];
|
|
3643
3657
|
const shapeClass = shapeClasses2[shape];
|
|
3644
|
-
const
|
|
3658
|
+
const defaultLabels4 = {
|
|
3645
3659
|
language: labels.language ?? "Language"
|
|
3646
3660
|
};
|
|
3647
3661
|
if (variant === "mini") {
|
|
@@ -3652,7 +3666,7 @@ function LanguageSwitcher({
|
|
|
3652
3666
|
{
|
|
3653
3667
|
variant: "ghost",
|
|
3654
3668
|
size: "icon",
|
|
3655
|
-
"aria-label":
|
|
3669
|
+
"aria-label": defaultLabels4.language,
|
|
3656
3670
|
className: cn(sizes.buttonMini, shapeClass, className),
|
|
3657
3671
|
children: /* @__PURE__ */ jsx(Languages, { className: sizes.iconMini })
|
|
3658
3672
|
}
|
|
@@ -3663,7 +3677,7 @@ function LanguageSwitcher({
|
|
|
3663
3677
|
side: tooltipSide,
|
|
3664
3678
|
align: tooltipAlign,
|
|
3665
3679
|
sideOffset: tooltipSideOffset,
|
|
3666
|
-
children:
|
|
3680
|
+
children: defaultLabels4.language
|
|
3667
3681
|
}
|
|
3668
3682
|
)
|
|
3669
3683
|
] }),
|
|
@@ -3746,6 +3760,286 @@ function LanguageSwitcher({
|
|
|
3746
3760
|
}
|
|
3747
3761
|
);
|
|
3748
3762
|
}
|
|
3763
|
+
var defaultLabels2 = {
|
|
3764
|
+
environment: "Data environment",
|
|
3765
|
+
live: "Live",
|
|
3766
|
+
staging: "Staging",
|
|
3767
|
+
development: "Development"
|
|
3768
|
+
};
|
|
3769
|
+
var sizeClasses3 = {
|
|
3770
|
+
sm: {
|
|
3771
|
+
container: "h-7 p-0.5 text-xs",
|
|
3772
|
+
button: "h-6 px-2",
|
|
3773
|
+
buttonMini: "h-7 gap-1.5 px-2",
|
|
3774
|
+
dot: "size-2",
|
|
3775
|
+
iconMini: "size-3.5"
|
|
3776
|
+
},
|
|
3777
|
+
md: {
|
|
3778
|
+
container: "h-8 p-0.5 text-xs",
|
|
3779
|
+
button: "h-7 px-2.5",
|
|
3780
|
+
buttonMini: "h-8 gap-2 px-2.5",
|
|
3781
|
+
dot: "size-2.5",
|
|
3782
|
+
iconMini: "size-4"
|
|
3783
|
+
},
|
|
3784
|
+
lg: {
|
|
3785
|
+
container: "h-9 p-0.5 text-sm",
|
|
3786
|
+
button: "h-8 px-3",
|
|
3787
|
+
buttonMini: "h-9 gap-2 px-3",
|
|
3788
|
+
dot: "size-2.5",
|
|
3789
|
+
iconMini: "size-4"
|
|
3790
|
+
}
|
|
3791
|
+
};
|
|
3792
|
+
var shapeClasses3 = {
|
|
3793
|
+
rounded: "rounded-md",
|
|
3794
|
+
pill: "rounded-full"
|
|
3795
|
+
};
|
|
3796
|
+
function envDotClass(env) {
|
|
3797
|
+
switch (env) {
|
|
3798
|
+
case "production":
|
|
3799
|
+
return "bg-emerald-500";
|
|
3800
|
+
case "staging":
|
|
3801
|
+
return "bg-orange-500";
|
|
3802
|
+
case "development":
|
|
3803
|
+
return "bg-amber-400";
|
|
3804
|
+
default:
|
|
3805
|
+
return "bg-muted-foreground";
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
function labelForEnv(env, labels) {
|
|
3809
|
+
switch (env) {
|
|
3810
|
+
case "production":
|
|
3811
|
+
return labels.live;
|
|
3812
|
+
case "staging":
|
|
3813
|
+
return labels.staging;
|
|
3814
|
+
case "development":
|
|
3815
|
+
return labels.development;
|
|
3816
|
+
default:
|
|
3817
|
+
return env;
|
|
3818
|
+
}
|
|
3819
|
+
}
|
|
3820
|
+
function EnvironmentSwitcher({
|
|
3821
|
+
className,
|
|
3822
|
+
environment: propEnvironment,
|
|
3823
|
+
onEnvironmentChange: propOnEnvironmentChange,
|
|
3824
|
+
environments: propEnvironments,
|
|
3825
|
+
labels: userLabels,
|
|
3826
|
+
size = "sm",
|
|
3827
|
+
shape = "rounded",
|
|
3828
|
+
variant = "mini",
|
|
3829
|
+
align = "end",
|
|
3830
|
+
side = "bottom",
|
|
3831
|
+
tooltipSide = "bottom",
|
|
3832
|
+
tooltipAlign = "center",
|
|
3833
|
+
tooltipSideOffset = 8
|
|
3834
|
+
}) {
|
|
3835
|
+
const ctx = useEnvironmentContext();
|
|
3836
|
+
const labels = { ...defaultLabels2, ...userLabels };
|
|
3837
|
+
const environments = propEnvironments ?? ctx?.environments ?? [...BLOCKS_DATA_ENVIRONMENTS];
|
|
3838
|
+
const environment = propEnvironment ?? ctx?.environment ?? "production";
|
|
3839
|
+
const setEnvironment = propOnEnvironmentChange ?? ctx?.setEnvironment ?? (() => {
|
|
3840
|
+
});
|
|
3841
|
+
const sizes = sizeClasses3[size];
|
|
3842
|
+
const shapeClass = shapeClasses3[shape];
|
|
3843
|
+
const handleSelect = (next) => {
|
|
3844
|
+
if (next === environment) return;
|
|
3845
|
+
setEnvironment(next);
|
|
3846
|
+
};
|
|
3847
|
+
if (variant === "mini") {
|
|
3848
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { modal: false, children: [
|
|
3849
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
3850
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3851
|
+
Button,
|
|
3852
|
+
{
|
|
3853
|
+
"data-testid": "environment-switcher",
|
|
3854
|
+
variant: "outline",
|
|
3855
|
+
size: "sm",
|
|
3856
|
+
"aria-label": labels.environment,
|
|
3857
|
+
className: cn(
|
|
3858
|
+
sizes.buttonMini,
|
|
3859
|
+
shapeClass,
|
|
3860
|
+
"font-medium tabular-nums border-border bg-background",
|
|
3861
|
+
className
|
|
3862
|
+
),
|
|
3863
|
+
children: [
|
|
3864
|
+
/* @__PURE__ */ jsx(
|
|
3865
|
+
"span",
|
|
3866
|
+
{
|
|
3867
|
+
className: cn(
|
|
3868
|
+
"rounded-full shrink-0 ring-1 ring-background",
|
|
3869
|
+
sizes.dot,
|
|
3870
|
+
envDotClass(environment)
|
|
3871
|
+
),
|
|
3872
|
+
"aria-hidden": true
|
|
3873
|
+
}
|
|
3874
|
+
),
|
|
3875
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[5.5rem] truncate", children: labelForEnv(environment, labels) })
|
|
3876
|
+
]
|
|
3877
|
+
}
|
|
3878
|
+
) }) }),
|
|
3879
|
+
/* @__PURE__ */ jsx(
|
|
3880
|
+
TooltipContent,
|
|
3881
|
+
{
|
|
3882
|
+
side: tooltipSide,
|
|
3883
|
+
align: tooltipAlign,
|
|
3884
|
+
sideOffset: tooltipSideOffset,
|
|
3885
|
+
children: labels.environment
|
|
3886
|
+
}
|
|
3887
|
+
)
|
|
3888
|
+
] }),
|
|
3889
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { side, align, sideOffset: 8, children: environments.map((env) => /* @__PURE__ */ jsxs(
|
|
3890
|
+
DropdownMenuItem,
|
|
3891
|
+
{
|
|
3892
|
+
onClick: () => handleSelect(env),
|
|
3893
|
+
className: cn(
|
|
3894
|
+
"gap-2 cursor-pointer",
|
|
3895
|
+
environment === env && "bg-accent"
|
|
3896
|
+
),
|
|
3897
|
+
children: [
|
|
3898
|
+
/* @__PURE__ */ jsx(
|
|
3899
|
+
"span",
|
|
3900
|
+
{
|
|
3901
|
+
className: cn(
|
|
3902
|
+
"rounded-full shrink-0 ring-1 ring-background",
|
|
3903
|
+
sizes.dot,
|
|
3904
|
+
envDotClass(env)
|
|
3905
|
+
),
|
|
3906
|
+
"aria-hidden": true
|
|
3907
|
+
}
|
|
3908
|
+
),
|
|
3909
|
+
/* @__PURE__ */ jsx("span", { children: labelForEnv(env, labels) })
|
|
3910
|
+
]
|
|
3911
|
+
},
|
|
3912
|
+
env
|
|
3913
|
+
)) })
|
|
3914
|
+
] });
|
|
3915
|
+
}
|
|
3916
|
+
return /* @__PURE__ */ jsxs(
|
|
3917
|
+
"div",
|
|
3918
|
+
{
|
|
3919
|
+
"data-testid": "environment-switcher",
|
|
3920
|
+
className: cn(
|
|
3921
|
+
"relative isolate flex items-center bg-background ring-1 ring-border",
|
|
3922
|
+
sizes.container,
|
|
3923
|
+
shapeClass,
|
|
3924
|
+
className
|
|
3925
|
+
),
|
|
3926
|
+
children: [
|
|
3927
|
+
/* @__PURE__ */ jsx(
|
|
3928
|
+
FlaskConical,
|
|
3929
|
+
{
|
|
3930
|
+
className: cn(sizes.iconMini, "ml-1.5 mr-1 text-muted-foreground"),
|
|
3931
|
+
"aria-hidden": true
|
|
3932
|
+
}
|
|
3933
|
+
),
|
|
3934
|
+
environments.map((env) => {
|
|
3935
|
+
const isActive = environment === env;
|
|
3936
|
+
return /* @__PURE__ */ jsxs(
|
|
3937
|
+
"button",
|
|
3938
|
+
{
|
|
3939
|
+
type: "button",
|
|
3940
|
+
"aria-label": labelForEnv(env, labels),
|
|
3941
|
+
"aria-pressed": isActive,
|
|
3942
|
+
className: cn(
|
|
3943
|
+
"relative min-w-0 font-semibold capitalize",
|
|
3944
|
+
sizes.button,
|
|
3945
|
+
shapeClass
|
|
3946
|
+
),
|
|
3947
|
+
onClick: () => handleSelect(env),
|
|
3948
|
+
children: [
|
|
3949
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: isActive && /* @__PURE__ */ jsx(
|
|
3950
|
+
motion.div,
|
|
3951
|
+
{
|
|
3952
|
+
className: cn("absolute inset-0 bg-secondary", shapeClass),
|
|
3953
|
+
layoutId: "activeEnvironment",
|
|
3954
|
+
initial: { opacity: 0 },
|
|
3955
|
+
animate: { opacity: 1 },
|
|
3956
|
+
exit: { opacity: 0 },
|
|
3957
|
+
transition: { type: "spring", duration: 0.5 }
|
|
3958
|
+
}
|
|
3959
|
+
) }),
|
|
3960
|
+
/* @__PURE__ */ jsxs(
|
|
3961
|
+
"span",
|
|
3962
|
+
{
|
|
3963
|
+
className: cn(
|
|
3964
|
+
"relative z-10 flex max-w-[4.5rem] items-center justify-center gap-1 truncate sm:max-w-[6rem]",
|
|
3965
|
+
isActive ? "text-foreground" : "text-muted-foreground"
|
|
3966
|
+
),
|
|
3967
|
+
children: [
|
|
3968
|
+
/* @__PURE__ */ jsx(
|
|
3969
|
+
"span",
|
|
3970
|
+
{
|
|
3971
|
+
className: cn(
|
|
3972
|
+
"rounded-full shrink-0 ring-1 ring-background",
|
|
3973
|
+
"h-1.5 w-1.5",
|
|
3974
|
+
envDotClass(env)
|
|
3975
|
+
),
|
|
3976
|
+
"aria-hidden": true
|
|
3977
|
+
}
|
|
3978
|
+
),
|
|
3979
|
+
labelForEnv(env, labels)
|
|
3980
|
+
]
|
|
3981
|
+
}
|
|
3982
|
+
)
|
|
3983
|
+
]
|
|
3984
|
+
},
|
|
3985
|
+
env
|
|
3986
|
+
);
|
|
3987
|
+
})
|
|
3988
|
+
]
|
|
3989
|
+
}
|
|
3990
|
+
);
|
|
3991
|
+
}
|
|
3992
|
+
var defaultLabels3 = {
|
|
3993
|
+
stagingMessage: "You are viewing staging data \u2014 changes do not affect live customers.",
|
|
3994
|
+
developmentMessage: "You are viewing development data \u2014 for testing only.",
|
|
3995
|
+
dismiss: "Dismiss"
|
|
3996
|
+
};
|
|
3997
|
+
function EnvironmentBanner({
|
|
3998
|
+
className,
|
|
3999
|
+
environment: propEnvironment,
|
|
4000
|
+
labels: userLabels,
|
|
4001
|
+
enabled = true
|
|
4002
|
+
}) {
|
|
4003
|
+
const ctx = useEnvironmentContext();
|
|
4004
|
+
const labels = { ...defaultLabels3, ...userLabels };
|
|
4005
|
+
const [dismissed, setDismissed] = useState(false);
|
|
4006
|
+
const environment = propEnvironment ?? ctx?.environment ?? "production";
|
|
4007
|
+
const handleDismiss = useCallback(() => {
|
|
4008
|
+
setDismissed(true);
|
|
4009
|
+
}, []);
|
|
4010
|
+
if (!enabled || dismissed || environment === "production") {
|
|
4011
|
+
return null;
|
|
4012
|
+
}
|
|
4013
|
+
const isStaging = environment === "staging";
|
|
4014
|
+
const message = isStaging ? labels.stagingMessage : labels.developmentMessage;
|
|
4015
|
+
return /* @__PURE__ */ jsxs(
|
|
4016
|
+
"div",
|
|
4017
|
+
{
|
|
4018
|
+
role: "status",
|
|
4019
|
+
"data-testid": "environment-banner",
|
|
4020
|
+
className: cn(
|
|
4021
|
+
"flex w-full items-center justify-center gap-2 border-b px-3 py-2 text-center text-sm font-medium",
|
|
4022
|
+
isStaging ? "border-orange-500/30 bg-orange-500/15 text-orange-950 dark:text-orange-100" : "border-amber-500/30 bg-amber-500/15 text-amber-950 dark:text-amber-100",
|
|
4023
|
+
className
|
|
4024
|
+
),
|
|
4025
|
+
children: [
|
|
4026
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: message }),
|
|
4027
|
+
/* @__PURE__ */ jsx(
|
|
4028
|
+
Button,
|
|
4029
|
+
{
|
|
4030
|
+
type: "button",
|
|
4031
|
+
variant: "ghost",
|
|
4032
|
+
size: "icon",
|
|
4033
|
+
className: "h-7 w-7 shrink-0 opacity-80 hover:opacity-100",
|
|
4034
|
+
onClick: handleDismiss,
|
|
4035
|
+
"aria-label": labels.dismiss,
|
|
4036
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
4037
|
+
}
|
|
4038
|
+
)
|
|
4039
|
+
]
|
|
4040
|
+
}
|
|
4041
|
+
);
|
|
4042
|
+
}
|
|
3749
4043
|
function Slider({
|
|
3750
4044
|
className,
|
|
3751
4045
|
defaultValue,
|
|
@@ -6969,6 +7263,6 @@ function formatRelativeTime(dateStr) {
|
|
|
6969
7263
|
return date.toLocaleDateString([], { month: "short", day: "numeric" });
|
|
6970
7264
|
}
|
|
6971
7265
|
|
|
6972
|
-
export { AvatarEditor, AvatarEditorDialog, Button, CalendarContext, CalendarSubscribeButton, CalendarView, CalendarWidget, ChatRoomView, ChatSidebar, ChatSidebarContext, ChatSidebarProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EventDialog, EventRsvpBadge, LanguageContext, LanguageSwitcher, MiniCalendar, NotificationsContext, NotificationsWidget, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, Slider, ThemeSwitcher, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UpcomingEvents, buttonVariants, cn, defaultLanguages, toggleVariants, useCalendarContext, useChatRoom, useChatSidebar, useLanguageContext, useNotificationsContext };
|
|
7266
|
+
export { AvatarEditor, AvatarEditorDialog, BLOCKS_DATA_ENVIRONMENTS, Button, CalendarContext, CalendarSubscribeButton, CalendarView, CalendarWidget, ChatRoomView, ChatSidebar, ChatSidebarContext, ChatSidebarProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EnvironmentBanner, EnvironmentContext, EnvironmentSwitcher, EventDialog, EventRsvpBadge, LanguageContext, LanguageSwitcher, MiniCalendar, NotificationsContext, NotificationsWidget, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ScrollArea, ScrollBar, Slider, ThemeSwitcher, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UpcomingEvents, buttonVariants, cn, defaultLanguages, isBlocksDataEnvironment, toggleVariants, useCalendarContext, useChatRoom, useChatSidebar, useEnvironmentContext, useLanguageContext, useNotificationsContext };
|
|
6973
7267
|
//# sourceMappingURL=index.js.map
|
|
6974
7268
|
//# sourceMappingURL=index.js.map
|