@umami/react-zen 0.237.0 → 0.238.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.d.mts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +84 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/styles.css +145 -49
- package/styles.full.css +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -563,14 +563,19 @@ declare function useBreakpoint(): BreakpointKey | null;
|
|
|
563
563
|
declare function useDebounce(value: string, delay: number): string;
|
|
564
564
|
|
|
565
565
|
type Theme = 'light' | 'dark';
|
|
566
|
+
type Palette = 'neutral' | 'slate' | 'gray' | 'zinc' | 'stone';
|
|
567
|
+
declare const PALETTES: Palette[];
|
|
566
568
|
interface ThemeState {
|
|
567
569
|
theme: Theme;
|
|
570
|
+
palette: Palette;
|
|
568
571
|
setTheme: (theme: Theme) => void;
|
|
572
|
+
setPalette: (palette: Palette) => void;
|
|
569
573
|
syncTheme: () => void;
|
|
570
574
|
initTheme: (preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system') => void;
|
|
575
|
+
initPalette: (preferred?: Palette) => void;
|
|
571
576
|
}
|
|
572
577
|
declare const useTheme: zustand.UseBoundStore<zustand.StoreApi<ThemeState>>;
|
|
573
|
-
declare function useInitTheme(preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system'): void;
|
|
578
|
+
declare function useInitTheme(preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system', preferredPalette?: Palette): void;
|
|
574
579
|
|
|
575
580
|
type ToastVariant = 'success' | 'error';
|
|
576
581
|
interface ToastOptions {
|
|
@@ -767,6 +772,11 @@ interface NavMenuItemProps extends RowProps {
|
|
|
767
772
|
}
|
|
768
773
|
declare function NavMenuItem({ isSelected, className, children, ...props }: NavMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
769
774
|
|
|
775
|
+
interface PaletteSwitcherProps {
|
|
776
|
+
className?: string;
|
|
777
|
+
}
|
|
778
|
+
declare function PaletteSwitcher({ className }: PaletteSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
779
|
+
|
|
770
780
|
interface PasswordFieldProps extends TextFieldProps$1 {
|
|
771
781
|
label?: string;
|
|
772
782
|
}
|
|
@@ -970,9 +980,10 @@ declare function ToastProvider({ children, ...props }: ToastProviderProps): reac
|
|
|
970
980
|
interface ZenProviderProps {
|
|
971
981
|
theme?: Theme;
|
|
972
982
|
colorScheme?: 'light' | 'dark' | 'system';
|
|
983
|
+
palette?: Palette;
|
|
973
984
|
toast?: ToasterProps;
|
|
974
985
|
children: ReactNode;
|
|
975
986
|
}
|
|
976
|
-
declare function ZenProvider({ children, theme, colorScheme, toast, }: ZenProviderProps): react_jsx_runtime.JSX.Element;
|
|
987
|
+
declare function ZenProvider({ children, theme, colorScheme, palette, toast, }: ZenProviderProps): react_jsx_runtime.JSX.Element;
|
|
977
988
|
|
|
978
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, AlertBanner, type AlertBannerProps, AlertDialog, type AlertDialogProps, Blockquote, type BlockquoteProps, Box, type BoxProps, type BoxRenderProps, Breadcrumb, Breadcrumbs, type BreakpointKey, Button, type ButtonProps, type ButtonRenderProps, Calendar, type CalendarProps, Checkbox, type CheckboxProps, Code, type CodeProps, Column, type ColumnProps, ComboBox, type ComboBoxProps, ConfirmationDialog, type ConfirmationDialogProps, Container, type ContainerProps, CopyButton, type CopyButtonProps, DataCard, type DataCardProps, DataColumn, type DataColumnProps, DataTable, type DataTableProps, Dialog, type DialogProps, Dots, type DotsProps, Flexbox, type FlexboxProps, FloatingTooltip, type FloatingTooltipProps, Form, FormButtons, type FormButtonsProps, FormController, type FormControllerProps, FormField, FormFieldArray, type FormFieldArrayProps, type FormFieldProps, type FormProps, FormResetButton, type FormResetButtonProps, FormSubmitButton, Grid, type GridProps, Heading, type HeadingProps, type HoverButtonProps, HoverTrigger, Icon, IconLabel, type IconLabelProps, type IconProps, Image, type ImageProps, Label, type LabelProps, List, ListItem, type ListItemProps, type ListProps, ListSection, type ListSectionProps, ListSeparator, Loading, LoadingButton, type LoadingButtonProps, type LoadingProps, Menu, MenuItem, type MenuItemProps, type MenuProps, MenuSection, type MenuSectionProps, MenuSeparator, Modal, type ModalProps, NavMenu, NavMenuGroup, type NavMenuGroupProps, NavMenuItem, type NavMenuItemProps, type NavMenuProps, Navbar, NavbarContext, NavbarItem, type NavbarItemProps, type NavbarProps, type NavigationContext, PasswordField, type PasswordFieldProps, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressCircle, type ProgressCircleProps, Radio, RadioGroup, type RadioGroupProps, type RenderProp, Row, type RowProps, SearchField, type SearchFieldProps, Select, type SelectProps, Sidebar, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, Slider, type SliderProps, Spinner, type SpinnerProps, StatusLight, type StatusLightProps, type StrokeWidth, SubMenuTrigger, type SubmenuTriggerProps, Switch, type SwitchProps, Tab, TabList, TabPanel, Table, TableBody, TableCell, type TableCellProps, TableColumn, type TableColumnProps, TableHeader, TableRow, Tabs, Text, TextField, type TextFieldProps, type TextProps, type TextRenderProps, type Theme, ThemeButton, type ThemeButtonProps, type ThemeMode, ThemeSwitcher, type ThemeSwitcherProps, Toast, ToastContext, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastState, type ToastVariant, Toaster, type ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, type ToggleGroupItemProps, type ToggleGroupProps, type ToggleProps, Tooltip, TooltipBubble, type TooltipBubbleProps, type TooltipProps, ZenProvider, type ZenProviderProps, cn, getCssColorValue, isHeightPreset, isMaxHeightPreset, isMaxWidthPreset, isMinHeightPreset, isMinWidthPreset, isWidthPreset, mapAlignContent, mapAlignItems, mapAlignSelf, mapBackgroundColor, mapBorder, mapBorderColor, mapBorderRadius, mapBorderWidth, mapCursor, mapDisplay, mapFlexDirection, mapFlexWrap, mapFontSize, mapFontWeight, mapGap, mapGridAutoFlow, mapGridColumns, mapGridRows, mapHeadingSize, mapHeight, mapJustifyContent, mapJustifyItems, mapLetterSpacing, mapLineHeight, mapMargin, mapMaxHeight, mapMaxWidth, mapMinHeight, mapMinWidth, mapOpacity, mapOverflow, mapPadding, mapPointerEvents, mapPosition, mapShadow, mapStateStyles, mapTextAlign, mapTextColor, mapTextDecorationStyle, mapTextIndent, mapTextTransform, mapTextWrap, mapVerticalAlign, mapWhitespace, mapWidth, mapWordBreak, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
|
989
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, AlertBanner, type AlertBannerProps, AlertDialog, type AlertDialogProps, Blockquote, type BlockquoteProps, Box, type BoxProps, type BoxRenderProps, Breadcrumb, Breadcrumbs, type BreakpointKey, Button, type ButtonProps, type ButtonRenderProps, Calendar, type CalendarProps, Checkbox, type CheckboxProps, Code, type CodeProps, Column, type ColumnProps, ComboBox, type ComboBoxProps, ConfirmationDialog, type ConfirmationDialogProps, Container, type ContainerProps, CopyButton, type CopyButtonProps, DataCard, type DataCardProps, DataColumn, type DataColumnProps, DataTable, type DataTableProps, Dialog, type DialogProps, Dots, type DotsProps, Flexbox, type FlexboxProps, FloatingTooltip, type FloatingTooltipProps, Form, FormButtons, type FormButtonsProps, FormController, type FormControllerProps, FormField, FormFieldArray, type FormFieldArrayProps, type FormFieldProps, type FormProps, FormResetButton, type FormResetButtonProps, FormSubmitButton, Grid, type GridProps, Heading, type HeadingProps, type HoverButtonProps, HoverTrigger, Icon, IconLabel, type IconLabelProps, type IconProps, Image, type ImageProps, Label, type LabelProps, List, ListItem, type ListItemProps, type ListProps, ListSection, type ListSectionProps, ListSeparator, Loading, LoadingButton, type LoadingButtonProps, type LoadingProps, Menu, MenuItem, type MenuItemProps, type MenuProps, MenuSection, type MenuSectionProps, MenuSeparator, Modal, type ModalProps, NavMenu, NavMenuGroup, type NavMenuGroupProps, NavMenuItem, type NavMenuItemProps, type NavMenuProps, Navbar, NavbarContext, NavbarItem, type NavbarItemProps, type NavbarProps, type NavigationContext, PALETTES, type Palette, PaletteSwitcher, type PaletteSwitcherProps, PasswordField, type PasswordFieldProps, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressCircle, type ProgressCircleProps, Radio, RadioGroup, type RadioGroupProps, type RenderProp, Row, type RowProps, SearchField, type SearchFieldProps, Select, type SelectProps, Sidebar, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, Slider, type SliderProps, Spinner, type SpinnerProps, StatusLight, type StatusLightProps, type StrokeWidth, SubMenuTrigger, type SubmenuTriggerProps, Switch, type SwitchProps, Tab, TabList, TabPanel, Table, TableBody, TableCell, type TableCellProps, TableColumn, type TableColumnProps, TableHeader, TableRow, Tabs, Text, TextField, type TextFieldProps, type TextProps, type TextRenderProps, type Theme, ThemeButton, type ThemeButtonProps, type ThemeMode, ThemeSwitcher, type ThemeSwitcherProps, Toast, ToastContext, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastState, type ToastVariant, Toaster, type ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, type ToggleGroupItemProps, type ToggleGroupProps, type ToggleProps, Tooltip, TooltipBubble, type TooltipBubbleProps, type TooltipProps, ZenProvider, type ZenProviderProps, cn, getCssColorValue, isHeightPreset, isMaxHeightPreset, isMaxWidthPreset, isMinHeightPreset, isMinWidthPreset, isWidthPreset, mapAlignContent, mapAlignItems, mapAlignSelf, mapBackgroundColor, mapBorder, mapBorderColor, mapBorderRadius, mapBorderWidth, mapCursor, mapDisplay, mapFlexDirection, mapFlexWrap, mapFontSize, mapFontWeight, mapGap, mapGridAutoFlow, mapGridColumns, mapGridRows, mapHeadingSize, mapHeight, mapJustifyContent, mapJustifyItems, mapLetterSpacing, mapLineHeight, mapMargin, mapMaxHeight, mapMaxWidth, mapMinHeight, mapMinWidth, mapOpacity, mapOverflow, mapPadding, mapPointerEvents, mapPosition, mapShadow, mapStateStyles, mapTextAlign, mapTextColor, mapTextDecorationStyle, mapTextIndent, mapTextTransform, mapTextWrap, mapVerticalAlign, mapWhitespace, mapWidth, mapWordBreak, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -563,14 +563,19 @@ declare function useBreakpoint(): BreakpointKey | null;
|
|
|
563
563
|
declare function useDebounce(value: string, delay: number): string;
|
|
564
564
|
|
|
565
565
|
type Theme = 'light' | 'dark';
|
|
566
|
+
type Palette = 'neutral' | 'slate' | 'gray' | 'zinc' | 'stone';
|
|
567
|
+
declare const PALETTES: Palette[];
|
|
566
568
|
interface ThemeState {
|
|
567
569
|
theme: Theme;
|
|
570
|
+
palette: Palette;
|
|
568
571
|
setTheme: (theme: Theme) => void;
|
|
572
|
+
setPalette: (palette: Palette) => void;
|
|
569
573
|
syncTheme: () => void;
|
|
570
574
|
initTheme: (preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system') => void;
|
|
575
|
+
initPalette: (preferred?: Palette) => void;
|
|
571
576
|
}
|
|
572
577
|
declare const useTheme: zustand.UseBoundStore<zustand.StoreApi<ThemeState>>;
|
|
573
|
-
declare function useInitTheme(preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system'): void;
|
|
578
|
+
declare function useInitTheme(preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system', preferredPalette?: Palette): void;
|
|
574
579
|
|
|
575
580
|
type ToastVariant = 'success' | 'error';
|
|
576
581
|
interface ToastOptions {
|
|
@@ -767,6 +772,11 @@ interface NavMenuItemProps extends RowProps {
|
|
|
767
772
|
}
|
|
768
773
|
declare function NavMenuItem({ isSelected, className, children, ...props }: NavMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
769
774
|
|
|
775
|
+
interface PaletteSwitcherProps {
|
|
776
|
+
className?: string;
|
|
777
|
+
}
|
|
778
|
+
declare function PaletteSwitcher({ className }: PaletteSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
779
|
+
|
|
770
780
|
interface PasswordFieldProps extends TextFieldProps$1 {
|
|
771
781
|
label?: string;
|
|
772
782
|
}
|
|
@@ -970,9 +980,10 @@ declare function ToastProvider({ children, ...props }: ToastProviderProps): reac
|
|
|
970
980
|
interface ZenProviderProps {
|
|
971
981
|
theme?: Theme;
|
|
972
982
|
colorScheme?: 'light' | 'dark' | 'system';
|
|
983
|
+
palette?: Palette;
|
|
973
984
|
toast?: ToasterProps;
|
|
974
985
|
children: ReactNode;
|
|
975
986
|
}
|
|
976
|
-
declare function ZenProvider({ children, theme, colorScheme, toast, }: ZenProviderProps): react_jsx_runtime.JSX.Element;
|
|
987
|
+
declare function ZenProvider({ children, theme, colorScheme, palette, toast, }: ZenProviderProps): react_jsx_runtime.JSX.Element;
|
|
977
988
|
|
|
978
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, AlertBanner, type AlertBannerProps, AlertDialog, type AlertDialogProps, Blockquote, type BlockquoteProps, Box, type BoxProps, type BoxRenderProps, Breadcrumb, Breadcrumbs, type BreakpointKey, Button, type ButtonProps, type ButtonRenderProps, Calendar, type CalendarProps, Checkbox, type CheckboxProps, Code, type CodeProps, Column, type ColumnProps, ComboBox, type ComboBoxProps, ConfirmationDialog, type ConfirmationDialogProps, Container, type ContainerProps, CopyButton, type CopyButtonProps, DataCard, type DataCardProps, DataColumn, type DataColumnProps, DataTable, type DataTableProps, Dialog, type DialogProps, Dots, type DotsProps, Flexbox, type FlexboxProps, FloatingTooltip, type FloatingTooltipProps, Form, FormButtons, type FormButtonsProps, FormController, type FormControllerProps, FormField, FormFieldArray, type FormFieldArrayProps, type FormFieldProps, type FormProps, FormResetButton, type FormResetButtonProps, FormSubmitButton, Grid, type GridProps, Heading, type HeadingProps, type HoverButtonProps, HoverTrigger, Icon, IconLabel, type IconLabelProps, type IconProps, Image, type ImageProps, Label, type LabelProps, List, ListItem, type ListItemProps, type ListProps, ListSection, type ListSectionProps, ListSeparator, Loading, LoadingButton, type LoadingButtonProps, type LoadingProps, Menu, MenuItem, type MenuItemProps, type MenuProps, MenuSection, type MenuSectionProps, MenuSeparator, Modal, type ModalProps, NavMenu, NavMenuGroup, type NavMenuGroupProps, NavMenuItem, type NavMenuItemProps, type NavMenuProps, Navbar, NavbarContext, NavbarItem, type NavbarItemProps, type NavbarProps, type NavigationContext, PasswordField, type PasswordFieldProps, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressCircle, type ProgressCircleProps, Radio, RadioGroup, type RadioGroupProps, type RenderProp, Row, type RowProps, SearchField, type SearchFieldProps, Select, type SelectProps, Sidebar, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, Slider, type SliderProps, Spinner, type SpinnerProps, StatusLight, type StatusLightProps, type StrokeWidth, SubMenuTrigger, type SubmenuTriggerProps, Switch, type SwitchProps, Tab, TabList, TabPanel, Table, TableBody, TableCell, type TableCellProps, TableColumn, type TableColumnProps, TableHeader, TableRow, Tabs, Text, TextField, type TextFieldProps, type TextProps, type TextRenderProps, type Theme, ThemeButton, type ThemeButtonProps, type ThemeMode, ThemeSwitcher, type ThemeSwitcherProps, Toast, ToastContext, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastState, type ToastVariant, Toaster, type ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, type ToggleGroupItemProps, type ToggleGroupProps, type ToggleProps, Tooltip, TooltipBubble, type TooltipBubbleProps, type TooltipProps, ZenProvider, type ZenProviderProps, cn, getCssColorValue, isHeightPreset, isMaxHeightPreset, isMaxWidthPreset, isMinHeightPreset, isMinWidthPreset, isWidthPreset, mapAlignContent, mapAlignItems, mapAlignSelf, mapBackgroundColor, mapBorder, mapBorderColor, mapBorderRadius, mapBorderWidth, mapCursor, mapDisplay, mapFlexDirection, mapFlexWrap, mapFontSize, mapFontWeight, mapGap, mapGridAutoFlow, mapGridColumns, mapGridRows, mapHeadingSize, mapHeight, mapJustifyContent, mapJustifyItems, mapLetterSpacing, mapLineHeight, mapMargin, mapMaxHeight, mapMaxWidth, mapMinHeight, mapMinWidth, mapOpacity, mapOverflow, mapPadding, mapPointerEvents, mapPosition, mapShadow, mapStateStyles, mapTextAlign, mapTextColor, mapTextDecorationStyle, mapTextIndent, mapTextTransform, mapTextWrap, mapVerticalAlign, mapWhitespace, mapWidth, mapWordBreak, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
|
989
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, AlertBanner, type AlertBannerProps, AlertDialog, type AlertDialogProps, Blockquote, type BlockquoteProps, Box, type BoxProps, type BoxRenderProps, Breadcrumb, Breadcrumbs, type BreakpointKey, Button, type ButtonProps, type ButtonRenderProps, Calendar, type CalendarProps, Checkbox, type CheckboxProps, Code, type CodeProps, Column, type ColumnProps, ComboBox, type ComboBoxProps, ConfirmationDialog, type ConfirmationDialogProps, Container, type ContainerProps, CopyButton, type CopyButtonProps, DataCard, type DataCardProps, DataColumn, type DataColumnProps, DataTable, type DataTableProps, Dialog, type DialogProps, Dots, type DotsProps, Flexbox, type FlexboxProps, FloatingTooltip, type FloatingTooltipProps, Form, FormButtons, type FormButtonsProps, FormController, type FormControllerProps, FormField, FormFieldArray, type FormFieldArrayProps, type FormFieldProps, type FormProps, FormResetButton, type FormResetButtonProps, FormSubmitButton, Grid, type GridProps, Heading, type HeadingProps, type HoverButtonProps, HoverTrigger, Icon, IconLabel, type IconLabelProps, type IconProps, Image, type ImageProps, Label, type LabelProps, List, ListItem, type ListItemProps, type ListProps, ListSection, type ListSectionProps, ListSeparator, Loading, LoadingButton, type LoadingButtonProps, type LoadingProps, Menu, MenuItem, type MenuItemProps, type MenuProps, MenuSection, type MenuSectionProps, MenuSeparator, Modal, type ModalProps, NavMenu, NavMenuGroup, type NavMenuGroupProps, NavMenuItem, type NavMenuItemProps, type NavMenuProps, Navbar, NavbarContext, NavbarItem, type NavbarItemProps, type NavbarProps, type NavigationContext, PALETTES, type Palette, PaletteSwitcher, type PaletteSwitcherProps, PasswordField, type PasswordFieldProps, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressCircle, type ProgressCircleProps, Radio, RadioGroup, type RadioGroupProps, type RenderProp, Row, type RowProps, SearchField, type SearchFieldProps, Select, type SelectProps, Sidebar, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, Slider, type SliderProps, Spinner, type SpinnerProps, StatusLight, type StatusLightProps, type StrokeWidth, SubMenuTrigger, type SubmenuTriggerProps, Switch, type SwitchProps, Tab, TabList, TabPanel, Table, TableBody, TableCell, type TableCellProps, TableColumn, type TableColumnProps, TableHeader, TableRow, Tabs, Text, TextField, type TextFieldProps, type TextProps, type TextRenderProps, type Theme, ThemeButton, type ThemeButtonProps, type ThemeMode, ThemeSwitcher, type ThemeSwitcherProps, Toast, ToastContext, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastState, type ToastVariant, Toaster, type ToasterProps, Toggle, ToggleGroup, ToggleGroupItem, type ToggleGroupItemProps, type ToggleGroupProps, type ToggleProps, Tooltip, TooltipBubble, type TooltipBubbleProps, type TooltipProps, ZenProvider, type ZenProviderProps, cn, getCssColorValue, isHeightPreset, isMaxHeightPreset, isMaxWidthPreset, isMinHeightPreset, isMinWidthPreset, isWidthPreset, mapAlignContent, mapAlignItems, mapAlignSelf, mapBackgroundColor, mapBorder, mapBorderColor, mapBorderRadius, mapBorderWidth, mapCursor, mapDisplay, mapFlexDirection, mapFlexWrap, mapFontSize, mapFontWeight, mapGap, mapGridAutoFlow, mapGridColumns, mapGridRows, mapHeadingSize, mapHeight, mapJustifyContent, mapJustifyItems, mapLetterSpacing, mapLineHeight, mapMargin, mapMaxHeight, mapMaxWidth, mapMinHeight, mapMinWidth, mapOpacity, mapOverflow, mapPadding, mapPointerEvents, mapPosition, mapShadow, mapStateStyles, mapTextAlign, mapTextColor, mapTextDecorationStyle, mapTextIndent, mapTextTransform, mapTextWrap, mapVerticalAlign, mapWhitespace, mapWidth, mapWordBreak, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
package/dist/index.js
CHANGED
|
@@ -3924,11 +3924,18 @@ function useDebounce(value, delay) {
|
|
|
3924
3924
|
}, [value, delay]);
|
|
3925
3925
|
return debouncedValue;
|
|
3926
3926
|
}
|
|
3927
|
-
var
|
|
3927
|
+
var PALETTES = ["neutral", "slate", "gray", "zinc", "stone"];
|
|
3928
|
+
var THEME_STORAGE_KEY = "theme";
|
|
3929
|
+
var PALETTE_STORAGE_KEY = "zen.palette";
|
|
3928
3930
|
function getThemeFromDOM() {
|
|
3929
3931
|
if (typeof window === "undefined") return "light";
|
|
3930
3932
|
return document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
3931
3933
|
}
|
|
3934
|
+
function getPaletteFromDOM() {
|
|
3935
|
+
if (typeof window === "undefined") return "neutral";
|
|
3936
|
+
const palette = document.documentElement.getAttribute("data-palette");
|
|
3937
|
+
return palette && PALETTES.includes(palette) ? palette : "neutral";
|
|
3938
|
+
}
|
|
3932
3939
|
function resolveTheme(preferred, colorScheme) {
|
|
3933
3940
|
if (preferred) {
|
|
3934
3941
|
return preferred;
|
|
@@ -3950,41 +3957,67 @@ function applyTheme(theme) {
|
|
|
3950
3957
|
document.documentElement.classList.remove("dark");
|
|
3951
3958
|
}
|
|
3952
3959
|
}
|
|
3960
|
+
function applyPalette(palette) {
|
|
3961
|
+
if (typeof window === "undefined") return;
|
|
3962
|
+
document.documentElement.setAttribute("data-palette", palette);
|
|
3963
|
+
}
|
|
3953
3964
|
var useTheme = zustand.create((set, get) => ({
|
|
3954
3965
|
theme: "light",
|
|
3966
|
+
palette: "neutral",
|
|
3955
3967
|
setTheme: (theme) => {
|
|
3956
3968
|
set({ theme });
|
|
3957
3969
|
if (typeof window !== "undefined") {
|
|
3958
|
-
localStorage.setItem(
|
|
3970
|
+
localStorage.setItem(THEME_STORAGE_KEY, theme);
|
|
3959
3971
|
applyTheme(theme);
|
|
3960
3972
|
}
|
|
3961
3973
|
},
|
|
3974
|
+
setPalette: (palette) => {
|
|
3975
|
+
set({ palette });
|
|
3976
|
+
if (typeof window !== "undefined") {
|
|
3977
|
+
localStorage.setItem(PALETTE_STORAGE_KEY, palette);
|
|
3978
|
+
applyPalette(palette);
|
|
3979
|
+
}
|
|
3980
|
+
},
|
|
3962
3981
|
syncTheme: () => {
|
|
3963
3982
|
const theme = getThemeFromDOM();
|
|
3964
|
-
|
|
3983
|
+
const palette = getPaletteFromDOM();
|
|
3984
|
+
const state = get();
|
|
3985
|
+
if (theme !== state.theme) {
|
|
3965
3986
|
set({ theme });
|
|
3966
3987
|
document.documentElement.setAttribute("data-theme", theme);
|
|
3967
3988
|
}
|
|
3989
|
+
if (palette !== state.palette) {
|
|
3990
|
+
set({ palette });
|
|
3991
|
+
}
|
|
3968
3992
|
},
|
|
3969
3993
|
initTheme: (preferred, colorScheme) => {
|
|
3970
3994
|
if (typeof window === "undefined") return;
|
|
3971
|
-
const stored = localStorage.getItem(
|
|
3995
|
+
const stored = localStorage.getItem(THEME_STORAGE_KEY);
|
|
3972
3996
|
const initial = resolveTheme(preferred || stored || void 0, colorScheme);
|
|
3973
3997
|
set({ theme: initial });
|
|
3974
3998
|
applyTheme(initial);
|
|
3999
|
+
},
|
|
4000
|
+
initPalette: (preferred) => {
|
|
4001
|
+
if (typeof window === "undefined") return;
|
|
4002
|
+
const stored = localStorage.getItem(PALETTE_STORAGE_KEY);
|
|
4003
|
+
const initial = preferred || (stored && PALETTES.includes(stored) ? stored : null) || "neutral";
|
|
4004
|
+
set({ palette: initial });
|
|
4005
|
+
applyPalette(initial);
|
|
3975
4006
|
}
|
|
3976
4007
|
}));
|
|
3977
|
-
function useInitTheme(preferred, colorScheme) {
|
|
4008
|
+
function useInitTheme(preferred, colorScheme, preferredPalette) {
|
|
3978
4009
|
const initTheme = useTheme((s) => s.initTheme);
|
|
4010
|
+
const initPalette = useTheme((s) => s.initPalette);
|
|
3979
4011
|
const syncTheme = useTheme((s) => s.syncTheme);
|
|
3980
4012
|
react.useLayoutEffect(() => {
|
|
3981
4013
|
initTheme(preferred, colorScheme);
|
|
3982
|
-
|
|
4014
|
+
initPalette(preferredPalette);
|
|
4015
|
+
}, [preferred, colorScheme, preferredPalette, initTheme, initPalette]);
|
|
3983
4016
|
react.useEffect(() => {
|
|
3984
4017
|
if (typeof window === "undefined") return;
|
|
3985
4018
|
const observer = new MutationObserver((mutations) => {
|
|
3986
4019
|
for (const mutation of mutations) {
|
|
3987
|
-
if (mutation.attributeName === "class") {
|
|
4020
|
+
if (mutation.attributeName === "class" || mutation.attributeName === "data-palette") {
|
|
3988
4021
|
syncTheme();
|
|
3989
4022
|
}
|
|
3990
4023
|
}
|
|
@@ -4424,6 +4457,43 @@ function NavMenuItem({ isSelected, className, children, ...props }) {
|
|
|
4424
4457
|
}
|
|
4425
4458
|
);
|
|
4426
4459
|
}
|
|
4460
|
+
var PALETTE_LABELS = {
|
|
4461
|
+
neutral: "Neutral",
|
|
4462
|
+
slate: "Slate",
|
|
4463
|
+
gray: "Gray",
|
|
4464
|
+
zinc: "Zinc",
|
|
4465
|
+
stone: "Stone"
|
|
4466
|
+
};
|
|
4467
|
+
function PaletteSwitcher({ className }) {
|
|
4468
|
+
const { palette, setPalette } = useTheme();
|
|
4469
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4470
|
+
"div",
|
|
4471
|
+
{
|
|
4472
|
+
className: cn(
|
|
4473
|
+
"inline-flex items-center bg-surface-base border border-edge rounded-md overflow-hidden",
|
|
4474
|
+
className
|
|
4475
|
+
),
|
|
4476
|
+
children: PALETTES.map((p) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4477
|
+
"button",
|
|
4478
|
+
{
|
|
4479
|
+
type: "button",
|
|
4480
|
+
onClick: () => setPalette(p),
|
|
4481
|
+
"aria-label": PALETTE_LABELS[p],
|
|
4482
|
+
"aria-pressed": palette === p,
|
|
4483
|
+
className: cn(
|
|
4484
|
+
"px-3 h-9 flex items-center justify-center cursor-pointer outline-none transition-colors text-sm",
|
|
4485
|
+
"[&:not(:first-child)]:border-l [&:not(:first-child)]:border-edge",
|
|
4486
|
+
"hover:bg-interactive",
|
|
4487
|
+
"focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset",
|
|
4488
|
+
palette === p ? "bg-interactive text-foreground-primary" : "text-foreground-muted"
|
|
4489
|
+
),
|
|
4490
|
+
children: PALETTE_LABELS[p]
|
|
4491
|
+
},
|
|
4492
|
+
p
|
|
4493
|
+
))
|
|
4494
|
+
}
|
|
4495
|
+
);
|
|
4496
|
+
}
|
|
4427
4497
|
var SvgEyeSlash = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 256 256", ...props, children: [
|
|
4428
4498
|
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
|
|
4429
4499
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5018,7 +5088,7 @@ function ThemeButton({
|
|
|
5018
5088
|
}
|
|
5019
5089
|
);
|
|
5020
5090
|
}
|
|
5021
|
-
var
|
|
5091
|
+
var STORAGE_KEY = "theme-mode";
|
|
5022
5092
|
function getSystemTheme() {
|
|
5023
5093
|
if (typeof window === "undefined") return "light";
|
|
5024
5094
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -5027,7 +5097,7 @@ function ThemeSwitcher({ className }) {
|
|
|
5027
5097
|
const { setTheme } = useTheme();
|
|
5028
5098
|
const [mode, setMode] = react.useState("system");
|
|
5029
5099
|
react.useEffect(() => {
|
|
5030
|
-
const stored = localStorage.getItem(
|
|
5100
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
5031
5101
|
if (stored && ["light", "dark", "system"].includes(stored)) {
|
|
5032
5102
|
setMode(stored);
|
|
5033
5103
|
}
|
|
@@ -5038,7 +5108,7 @@ function ThemeSwitcher({ className }) {
|
|
|
5038
5108
|
} else {
|
|
5039
5109
|
setTheme(mode);
|
|
5040
5110
|
}
|
|
5041
|
-
localStorage.setItem(
|
|
5111
|
+
localStorage.setItem(STORAGE_KEY, mode);
|
|
5042
5112
|
}, [mode, setTheme]);
|
|
5043
5113
|
react.useEffect(() => {
|
|
5044
5114
|
if (mode !== "system") return;
|
|
@@ -5164,9 +5234,10 @@ function ZenProvider({
|
|
|
5164
5234
|
children,
|
|
5165
5235
|
theme,
|
|
5166
5236
|
colorScheme,
|
|
5237
|
+
palette,
|
|
5167
5238
|
toast: toast2 = defaultToastConfig
|
|
5168
5239
|
}) {
|
|
5169
|
-
useInitTheme(theme, colorScheme);
|
|
5240
|
+
useInitTheme(theme, colorScheme, palette);
|
|
5170
5241
|
return /* @__PURE__ */ jsxRuntime.jsx(ToastProvider, { ...toast2, children });
|
|
5171
5242
|
}
|
|
5172
5243
|
|
|
@@ -5257,6 +5328,8 @@ exports.NavMenuItem = NavMenuItem;
|
|
|
5257
5328
|
exports.Navbar = Navbar;
|
|
5258
5329
|
exports.NavbarContext = NavbarContext;
|
|
5259
5330
|
exports.NavbarItem = NavbarItem;
|
|
5331
|
+
exports.PALETTES = PALETTES;
|
|
5332
|
+
exports.PaletteSwitcher = PaletteSwitcher;
|
|
5260
5333
|
exports.PasswordField = PasswordField;
|
|
5261
5334
|
exports.Popover = Popover;
|
|
5262
5335
|
exports.ProgressBar = ProgressBar;
|