@umami/react-zen 0.236.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 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.js +84 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -16
- 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
|
@@ -181,8 +181,6 @@ interface BoxProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
|
|
|
181
181
|
display?: Responsive$1<Display>;
|
|
182
182
|
color?: FontColor;
|
|
183
183
|
backgroundColor?: BackgroundColor;
|
|
184
|
-
fontSize?: Responsive$1<FontSize>;
|
|
185
|
-
fontWeight?: Responsive$1<FontWeight>;
|
|
186
184
|
border?: Responsive$1<Border>;
|
|
187
185
|
borderWidth?: Responsive$1<BorderWidth>;
|
|
188
186
|
borderColor?: BorderColor;
|
|
@@ -565,14 +563,19 @@ declare function useBreakpoint(): BreakpointKey | null;
|
|
|
565
563
|
declare function useDebounce(value: string, delay: number): string;
|
|
566
564
|
|
|
567
565
|
type Theme = 'light' | 'dark';
|
|
566
|
+
type Palette = 'neutral' | 'slate' | 'gray' | 'zinc' | 'stone';
|
|
567
|
+
declare const PALETTES: Palette[];
|
|
568
568
|
interface ThemeState {
|
|
569
569
|
theme: Theme;
|
|
570
|
+
palette: Palette;
|
|
570
571
|
setTheme: (theme: Theme) => void;
|
|
572
|
+
setPalette: (palette: Palette) => void;
|
|
571
573
|
syncTheme: () => void;
|
|
572
574
|
initTheme: (preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system') => void;
|
|
575
|
+
initPalette: (preferred?: Palette) => void;
|
|
573
576
|
}
|
|
574
577
|
declare const useTheme: zustand.UseBoundStore<zustand.StoreApi<ThemeState>>;
|
|
575
|
-
declare function useInitTheme(preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system'): void;
|
|
578
|
+
declare function useInitTheme(preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system', preferredPalette?: Palette): void;
|
|
576
579
|
|
|
577
580
|
type ToastVariant = 'success' | 'error';
|
|
578
581
|
interface ToastOptions {
|
|
@@ -769,6 +772,11 @@ interface NavMenuItemProps extends RowProps {
|
|
|
769
772
|
}
|
|
770
773
|
declare function NavMenuItem({ isSelected, className, children, ...props }: NavMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
771
774
|
|
|
775
|
+
interface PaletteSwitcherProps {
|
|
776
|
+
className?: string;
|
|
777
|
+
}
|
|
778
|
+
declare function PaletteSwitcher({ className }: PaletteSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
779
|
+
|
|
772
780
|
interface PasswordFieldProps extends TextFieldProps$1 {
|
|
773
781
|
label?: string;
|
|
774
782
|
}
|
|
@@ -972,9 +980,10 @@ declare function ToastProvider({ children, ...props }: ToastProviderProps): reac
|
|
|
972
980
|
interface ZenProviderProps {
|
|
973
981
|
theme?: Theme;
|
|
974
982
|
colorScheme?: 'light' | 'dark' | 'system';
|
|
983
|
+
palette?: Palette;
|
|
975
984
|
toast?: ToasterProps;
|
|
976
985
|
children: ReactNode;
|
|
977
986
|
}
|
|
978
|
-
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;
|
|
979
988
|
|
|
980
|
-
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
|
@@ -181,8 +181,6 @@ interface BoxProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
|
|
|
181
181
|
display?: Responsive$1<Display>;
|
|
182
182
|
color?: FontColor;
|
|
183
183
|
backgroundColor?: BackgroundColor;
|
|
184
|
-
fontSize?: Responsive$1<FontSize>;
|
|
185
|
-
fontWeight?: Responsive$1<FontWeight>;
|
|
186
184
|
border?: Responsive$1<Border>;
|
|
187
185
|
borderWidth?: Responsive$1<BorderWidth>;
|
|
188
186
|
borderColor?: BorderColor;
|
|
@@ -565,14 +563,19 @@ declare function useBreakpoint(): BreakpointKey | null;
|
|
|
565
563
|
declare function useDebounce(value: string, delay: number): string;
|
|
566
564
|
|
|
567
565
|
type Theme = 'light' | 'dark';
|
|
566
|
+
type Palette = 'neutral' | 'slate' | 'gray' | 'zinc' | 'stone';
|
|
567
|
+
declare const PALETTES: Palette[];
|
|
568
568
|
interface ThemeState {
|
|
569
569
|
theme: Theme;
|
|
570
|
+
palette: Palette;
|
|
570
571
|
setTheme: (theme: Theme) => void;
|
|
572
|
+
setPalette: (palette: Palette) => void;
|
|
571
573
|
syncTheme: () => void;
|
|
572
574
|
initTheme: (preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system') => void;
|
|
575
|
+
initPalette: (preferred?: Palette) => void;
|
|
573
576
|
}
|
|
574
577
|
declare const useTheme: zustand.UseBoundStore<zustand.StoreApi<ThemeState>>;
|
|
575
|
-
declare function useInitTheme(preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system'): void;
|
|
578
|
+
declare function useInitTheme(preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system', preferredPalette?: Palette): void;
|
|
576
579
|
|
|
577
580
|
type ToastVariant = 'success' | 'error';
|
|
578
581
|
interface ToastOptions {
|
|
@@ -769,6 +772,11 @@ interface NavMenuItemProps extends RowProps {
|
|
|
769
772
|
}
|
|
770
773
|
declare function NavMenuItem({ isSelected, className, children, ...props }: NavMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
771
774
|
|
|
775
|
+
interface PaletteSwitcherProps {
|
|
776
|
+
className?: string;
|
|
777
|
+
}
|
|
778
|
+
declare function PaletteSwitcher({ className }: PaletteSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
779
|
+
|
|
772
780
|
interface PasswordFieldProps extends TextFieldProps$1 {
|
|
773
781
|
label?: string;
|
|
774
782
|
}
|
|
@@ -972,9 +980,10 @@ declare function ToastProvider({ children, ...props }: ToastProviderProps): reac
|
|
|
972
980
|
interface ZenProviderProps {
|
|
973
981
|
theme?: Theme;
|
|
974
982
|
colorScheme?: 'light' | 'dark' | 'system';
|
|
983
|
+
palette?: Palette;
|
|
975
984
|
toast?: ToasterProps;
|
|
976
985
|
children: ReactNode;
|
|
977
986
|
}
|
|
978
|
-
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;
|
|
979
988
|
|
|
980
|
-
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
|
@@ -2478,8 +2478,6 @@ var Box = react.forwardRef(function Box2({
|
|
|
2478
2478
|
display,
|
|
2479
2479
|
color,
|
|
2480
2480
|
backgroundColor,
|
|
2481
|
-
fontSize,
|
|
2482
|
-
fontWeight,
|
|
2483
2481
|
border,
|
|
2484
2482
|
borderWidth,
|
|
2485
2483
|
borderColor,
|
|
@@ -2548,8 +2546,6 @@ var Box = react.forwardRef(function Box2({
|
|
|
2548
2546
|
mapDisplay(display),
|
|
2549
2547
|
mapTextColor(toStringValue(color)),
|
|
2550
2548
|
mapBackgroundColor(toStringValue(backgroundColor)),
|
|
2551
|
-
mapFontSize(fontSize),
|
|
2552
|
-
mapFontWeight(fontWeight),
|
|
2553
2549
|
mapBorder(border),
|
|
2554
2550
|
mapBorderWidth(borderWidth),
|
|
2555
2551
|
mapBorderColor(toStringValue(borderColor)),
|
|
@@ -3928,11 +3924,18 @@ function useDebounce(value, delay) {
|
|
|
3928
3924
|
}, [value, delay]);
|
|
3929
3925
|
return debouncedValue;
|
|
3930
3926
|
}
|
|
3931
|
-
var
|
|
3927
|
+
var PALETTES = ["neutral", "slate", "gray", "zinc", "stone"];
|
|
3928
|
+
var THEME_STORAGE_KEY = "theme";
|
|
3929
|
+
var PALETTE_STORAGE_KEY = "zen.palette";
|
|
3932
3930
|
function getThemeFromDOM() {
|
|
3933
3931
|
if (typeof window === "undefined") return "light";
|
|
3934
3932
|
return document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
3935
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
|
+
}
|
|
3936
3939
|
function resolveTheme(preferred, colorScheme) {
|
|
3937
3940
|
if (preferred) {
|
|
3938
3941
|
return preferred;
|
|
@@ -3954,41 +3957,67 @@ function applyTheme(theme) {
|
|
|
3954
3957
|
document.documentElement.classList.remove("dark");
|
|
3955
3958
|
}
|
|
3956
3959
|
}
|
|
3960
|
+
function applyPalette(palette) {
|
|
3961
|
+
if (typeof window === "undefined") return;
|
|
3962
|
+
document.documentElement.setAttribute("data-palette", palette);
|
|
3963
|
+
}
|
|
3957
3964
|
var useTheme = zustand.create((set, get) => ({
|
|
3958
3965
|
theme: "light",
|
|
3966
|
+
palette: "neutral",
|
|
3959
3967
|
setTheme: (theme) => {
|
|
3960
3968
|
set({ theme });
|
|
3961
3969
|
if (typeof window !== "undefined") {
|
|
3962
|
-
localStorage.setItem(
|
|
3970
|
+
localStorage.setItem(THEME_STORAGE_KEY, theme);
|
|
3963
3971
|
applyTheme(theme);
|
|
3964
3972
|
}
|
|
3965
3973
|
},
|
|
3974
|
+
setPalette: (palette) => {
|
|
3975
|
+
set({ palette });
|
|
3976
|
+
if (typeof window !== "undefined") {
|
|
3977
|
+
localStorage.setItem(PALETTE_STORAGE_KEY, palette);
|
|
3978
|
+
applyPalette(palette);
|
|
3979
|
+
}
|
|
3980
|
+
},
|
|
3966
3981
|
syncTheme: () => {
|
|
3967
3982
|
const theme = getThemeFromDOM();
|
|
3968
|
-
|
|
3983
|
+
const palette = getPaletteFromDOM();
|
|
3984
|
+
const state = get();
|
|
3985
|
+
if (theme !== state.theme) {
|
|
3969
3986
|
set({ theme });
|
|
3970
3987
|
document.documentElement.setAttribute("data-theme", theme);
|
|
3971
3988
|
}
|
|
3989
|
+
if (palette !== state.palette) {
|
|
3990
|
+
set({ palette });
|
|
3991
|
+
}
|
|
3972
3992
|
},
|
|
3973
3993
|
initTheme: (preferred, colorScheme) => {
|
|
3974
3994
|
if (typeof window === "undefined") return;
|
|
3975
|
-
const stored = localStorage.getItem(
|
|
3995
|
+
const stored = localStorage.getItem(THEME_STORAGE_KEY);
|
|
3976
3996
|
const initial = resolveTheme(preferred || stored || void 0, colorScheme);
|
|
3977
3997
|
set({ theme: initial });
|
|
3978
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);
|
|
3979
4006
|
}
|
|
3980
4007
|
}));
|
|
3981
|
-
function useInitTheme(preferred, colorScheme) {
|
|
4008
|
+
function useInitTheme(preferred, colorScheme, preferredPalette) {
|
|
3982
4009
|
const initTheme = useTheme((s) => s.initTheme);
|
|
4010
|
+
const initPalette = useTheme((s) => s.initPalette);
|
|
3983
4011
|
const syncTheme = useTheme((s) => s.syncTheme);
|
|
3984
4012
|
react.useLayoutEffect(() => {
|
|
3985
4013
|
initTheme(preferred, colorScheme);
|
|
3986
|
-
|
|
4014
|
+
initPalette(preferredPalette);
|
|
4015
|
+
}, [preferred, colorScheme, preferredPalette, initTheme, initPalette]);
|
|
3987
4016
|
react.useEffect(() => {
|
|
3988
4017
|
if (typeof window === "undefined") return;
|
|
3989
4018
|
const observer = new MutationObserver((mutations) => {
|
|
3990
4019
|
for (const mutation of mutations) {
|
|
3991
|
-
if (mutation.attributeName === "class") {
|
|
4020
|
+
if (mutation.attributeName === "class" || mutation.attributeName === "data-palette") {
|
|
3992
4021
|
syncTheme();
|
|
3993
4022
|
}
|
|
3994
4023
|
}
|
|
@@ -4428,6 +4457,43 @@ function NavMenuItem({ isSelected, className, children, ...props }) {
|
|
|
4428
4457
|
}
|
|
4429
4458
|
);
|
|
4430
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
|
+
}
|
|
4431
4497
|
var SvgEyeSlash = (props) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 256 256", ...props, children: [
|
|
4432
4498
|
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", d: "M0 0h256v256H0z" }),
|
|
4433
4499
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5022,7 +5088,7 @@ function ThemeButton({
|
|
|
5022
5088
|
}
|
|
5023
5089
|
);
|
|
5024
5090
|
}
|
|
5025
|
-
var
|
|
5091
|
+
var STORAGE_KEY = "theme-mode";
|
|
5026
5092
|
function getSystemTheme() {
|
|
5027
5093
|
if (typeof window === "undefined") return "light";
|
|
5028
5094
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -5031,7 +5097,7 @@ function ThemeSwitcher({ className }) {
|
|
|
5031
5097
|
const { setTheme } = useTheme();
|
|
5032
5098
|
const [mode, setMode] = react.useState("system");
|
|
5033
5099
|
react.useEffect(() => {
|
|
5034
|
-
const stored = localStorage.getItem(
|
|
5100
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
5035
5101
|
if (stored && ["light", "dark", "system"].includes(stored)) {
|
|
5036
5102
|
setMode(stored);
|
|
5037
5103
|
}
|
|
@@ -5042,7 +5108,7 @@ function ThemeSwitcher({ className }) {
|
|
|
5042
5108
|
} else {
|
|
5043
5109
|
setTheme(mode);
|
|
5044
5110
|
}
|
|
5045
|
-
localStorage.setItem(
|
|
5111
|
+
localStorage.setItem(STORAGE_KEY, mode);
|
|
5046
5112
|
}, [mode, setTheme]);
|
|
5047
5113
|
react.useEffect(() => {
|
|
5048
5114
|
if (mode !== "system") return;
|
|
@@ -5168,9 +5234,10 @@ function ZenProvider({
|
|
|
5168
5234
|
children,
|
|
5169
5235
|
theme,
|
|
5170
5236
|
colorScheme,
|
|
5237
|
+
palette,
|
|
5171
5238
|
toast: toast2 = defaultToastConfig
|
|
5172
5239
|
}) {
|
|
5173
|
-
useInitTheme(theme, colorScheme);
|
|
5240
|
+
useInitTheme(theme, colorScheme, palette);
|
|
5174
5241
|
return /* @__PURE__ */ jsxRuntime.jsx(ToastProvider, { ...toast2, children });
|
|
5175
5242
|
}
|
|
5176
5243
|
|
|
@@ -5261,6 +5328,8 @@ exports.NavMenuItem = NavMenuItem;
|
|
|
5261
5328
|
exports.Navbar = Navbar;
|
|
5262
5329
|
exports.NavbarContext = NavbarContext;
|
|
5263
5330
|
exports.NavbarItem = NavbarItem;
|
|
5331
|
+
exports.PALETTES = PALETTES;
|
|
5332
|
+
exports.PaletteSwitcher = PaletteSwitcher;
|
|
5264
5333
|
exports.PasswordField = PasswordField;
|
|
5265
5334
|
exports.Popover = Popover;
|
|
5266
5335
|
exports.ProgressBar = ProgressBar;
|