@umami/react-zen 0.231.0 → 0.232.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 +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +71 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/styles.full.css +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -619,7 +619,7 @@ declare function Image({ src, alt, objectFit, isCentered, borderRadius, shadow,
|
|
|
619
619
|
interface LabelProps extends Omit<TextProps, 'as' | 'render'> {
|
|
620
620
|
htmlFor?: string;
|
|
621
621
|
}
|
|
622
|
-
declare function Label({ size, weight, ...props }: LabelProps): react_jsx_runtime.JSX.Element;
|
|
622
|
+
declare function Label({ size, weight, lineHeight, ...props }: LabelProps): react_jsx_runtime.JSX.Element;
|
|
623
623
|
|
|
624
624
|
interface LoadingProps extends BoxProps {
|
|
625
625
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -747,6 +747,7 @@ interface SelectProps extends SelectProps$1<HTMLSelectElement> {
|
|
|
747
747
|
searchValue?: string;
|
|
748
748
|
searchDelay?: number;
|
|
749
749
|
isFullscreen?: boolean;
|
|
750
|
+
maxHeight?: string | number;
|
|
750
751
|
onSearch?: (value: string) => void;
|
|
751
752
|
onChange?: (e: any) => void;
|
|
752
753
|
buttonProps?: ButtonProps;
|
|
@@ -756,7 +757,7 @@ interface SelectProps extends SelectProps$1<HTMLSelectElement> {
|
|
|
756
757
|
defaultChildren: ReactNode;
|
|
757
758
|
}) => ReactNode);
|
|
758
759
|
}
|
|
759
|
-
declare function Select({ items, value, defaultValue, label, isLoading, allowSearch, searchValue, searchDelay, isFullscreen, onSearch, onChange, buttonProps, listProps, popoverProps, renderValue, className, children, ...props }: SelectProps): react_jsx_runtime.JSX.Element;
|
|
760
|
+
declare function Select({ items, value, defaultValue, label, isLoading, allowSearch, searchValue, searchDelay, isFullscreen, maxHeight, onSearch, onChange, buttonProps, listProps, popoverProps, renderValue, className, children, ...props }: SelectProps): react_jsx_runtime.JSX.Element;
|
|
760
761
|
|
|
761
762
|
interface SidebarProps extends ColumnProps {
|
|
762
763
|
isCollapsed?: boolean;
|
|
@@ -845,6 +846,12 @@ interface ThemeButtonProps extends ButtonProps {
|
|
|
845
846
|
}
|
|
846
847
|
declare function ThemeButton({ className, variant, target, onPress, ...props }: ThemeButtonProps): react_jsx_runtime.JSX.Element;
|
|
847
848
|
|
|
849
|
+
type ThemeMode = 'light' | 'dark' | 'system';
|
|
850
|
+
interface ThemeSwitcherProps {
|
|
851
|
+
className?: string;
|
|
852
|
+
}
|
|
853
|
+
declare function ThemeSwitcher({ className }: ThemeSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
854
|
+
|
|
848
855
|
interface ToggleProps extends ToggleButtonProps {
|
|
849
856
|
label?: string;
|
|
850
857
|
value?: string;
|
|
@@ -896,4 +903,4 @@ interface ZenProviderProps {
|
|
|
896
903
|
}
|
|
897
904
|
declare function ZenProvider({ children, theme, colorScheme, toast, }: ZenProviderProps): react_jsx_runtime.JSX.Element;
|
|
898
905
|
|
|
899
|
-
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, 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, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
|
906
|
+
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, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -619,7 +619,7 @@ declare function Image({ src, alt, objectFit, isCentered, borderRadius, shadow,
|
|
|
619
619
|
interface LabelProps extends Omit<TextProps, 'as' | 'render'> {
|
|
620
620
|
htmlFor?: string;
|
|
621
621
|
}
|
|
622
|
-
declare function Label({ size, weight, ...props }: LabelProps): react_jsx_runtime.JSX.Element;
|
|
622
|
+
declare function Label({ size, weight, lineHeight, ...props }: LabelProps): react_jsx_runtime.JSX.Element;
|
|
623
623
|
|
|
624
624
|
interface LoadingProps extends BoxProps {
|
|
625
625
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -747,6 +747,7 @@ interface SelectProps extends SelectProps$1<HTMLSelectElement> {
|
|
|
747
747
|
searchValue?: string;
|
|
748
748
|
searchDelay?: number;
|
|
749
749
|
isFullscreen?: boolean;
|
|
750
|
+
maxHeight?: string | number;
|
|
750
751
|
onSearch?: (value: string) => void;
|
|
751
752
|
onChange?: (e: any) => void;
|
|
752
753
|
buttonProps?: ButtonProps;
|
|
@@ -756,7 +757,7 @@ interface SelectProps extends SelectProps$1<HTMLSelectElement> {
|
|
|
756
757
|
defaultChildren: ReactNode;
|
|
757
758
|
}) => ReactNode);
|
|
758
759
|
}
|
|
759
|
-
declare function Select({ items, value, defaultValue, label, isLoading, allowSearch, searchValue, searchDelay, isFullscreen, onSearch, onChange, buttonProps, listProps, popoverProps, renderValue, className, children, ...props }: SelectProps): react_jsx_runtime.JSX.Element;
|
|
760
|
+
declare function Select({ items, value, defaultValue, label, isLoading, allowSearch, searchValue, searchDelay, isFullscreen, maxHeight, onSearch, onChange, buttonProps, listProps, popoverProps, renderValue, className, children, ...props }: SelectProps): react_jsx_runtime.JSX.Element;
|
|
760
761
|
|
|
761
762
|
interface SidebarProps extends ColumnProps {
|
|
762
763
|
isCollapsed?: boolean;
|
|
@@ -845,6 +846,12 @@ interface ThemeButtonProps extends ButtonProps {
|
|
|
845
846
|
}
|
|
846
847
|
declare function ThemeButton({ className, variant, target, onPress, ...props }: ThemeButtonProps): react_jsx_runtime.JSX.Element;
|
|
847
848
|
|
|
849
|
+
type ThemeMode = 'light' | 'dark' | 'system';
|
|
850
|
+
interface ThemeSwitcherProps {
|
|
851
|
+
className?: string;
|
|
852
|
+
}
|
|
853
|
+
declare function ThemeSwitcher({ className }: ThemeSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
854
|
+
|
|
848
855
|
interface ToggleProps extends ToggleButtonProps {
|
|
849
856
|
label?: string;
|
|
850
857
|
value?: string;
|
|
@@ -896,4 +903,4 @@ interface ZenProviderProps {
|
|
|
896
903
|
}
|
|
897
904
|
declare function ZenProvider({ children, theme, colorScheme, toast, }: ZenProviderProps): react_jsx_runtime.JSX.Element;
|
|
898
905
|
|
|
899
|
-
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, 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, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
|
906
|
+
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, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
package/dist/index.js
CHANGED
|
@@ -215,7 +215,7 @@ tailwindVariants.tv({
|
|
|
215
215
|
});
|
|
216
216
|
var tooltip = tailwindVariants.tv({
|
|
217
217
|
base: [
|
|
218
|
-
"bg-surface-inverted text-foreground-inverted text-
|
|
218
|
+
"bg-surface-inverted text-foreground-inverted text-base px-2 py-1 rounded",
|
|
219
219
|
"entering:animate-popover-in",
|
|
220
220
|
"exiting:animate-popover-out"
|
|
221
221
|
]
|
|
@@ -2880,13 +2880,14 @@ function useFieldId(id) {
|
|
|
2880
2880
|
const generatedId = react.useId();
|
|
2881
2881
|
return id ?? generatedId;
|
|
2882
2882
|
}
|
|
2883
|
-
function Label({ size = "
|
|
2883
|
+
function Label({ size = "base", weight = "semibold", lineHeight = "loose", ...props }) {
|
|
2884
2884
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2885
2885
|
Text,
|
|
2886
2886
|
{
|
|
2887
2887
|
...props,
|
|
2888
2888
|
size,
|
|
2889
2889
|
weight,
|
|
2890
|
+
lineHeight,
|
|
2890
2891
|
render: (renderProps) => /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Label, { ...renderProps })
|
|
2891
2892
|
}
|
|
2892
2893
|
);
|
|
@@ -4643,6 +4644,7 @@ function Select({
|
|
|
4643
4644
|
searchValue,
|
|
4644
4645
|
searchDelay,
|
|
4645
4646
|
isFullscreen,
|
|
4647
|
+
maxHeight,
|
|
4646
4648
|
onSearch,
|
|
4647
4649
|
onChange,
|
|
4648
4650
|
buttonProps,
|
|
@@ -4713,8 +4715,8 @@ function Select({
|
|
|
4713
4715
|
shouldFocusOnHover: false,
|
|
4714
4716
|
autoFocus: "first"
|
|
4715
4717
|
},
|
|
4716
|
-
className: cn("
|
|
4717
|
-
style: { ...listProps?.style, display: isLoading ? "none" : void 0 },
|
|
4718
|
+
className: cn("overflow-auto", listProps?.className),
|
|
4719
|
+
style: { ...listProps?.style, maxHeight, display: isLoading ? "none" : void 0 },
|
|
4718
4720
|
children
|
|
4719
4721
|
}
|
|
4720
4722
|
)
|
|
@@ -4984,6 +4986,70 @@ function ThemeButton({
|
|
|
4984
4986
|
}
|
|
4985
4987
|
);
|
|
4986
4988
|
}
|
|
4989
|
+
var STORAGE_KEY2 = "theme-mode";
|
|
4990
|
+
function getSystemTheme() {
|
|
4991
|
+
if (typeof window === "undefined") return "light";
|
|
4992
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
4993
|
+
}
|
|
4994
|
+
function ThemeSwitcher({ className }) {
|
|
4995
|
+
const { setTheme } = useTheme();
|
|
4996
|
+
const [mode, setMode] = react.useState("system");
|
|
4997
|
+
react.useEffect(() => {
|
|
4998
|
+
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
4999
|
+
if (stored && ["light", "dark", "system"].includes(stored)) {
|
|
5000
|
+
setMode(stored);
|
|
5001
|
+
}
|
|
5002
|
+
}, []);
|
|
5003
|
+
react.useEffect(() => {
|
|
5004
|
+
if (mode === "system") {
|
|
5005
|
+
setTheme(getSystemTheme());
|
|
5006
|
+
} else {
|
|
5007
|
+
setTheme(mode);
|
|
5008
|
+
}
|
|
5009
|
+
localStorage.setItem(STORAGE_KEY2, mode);
|
|
5010
|
+
}, [mode, setTheme]);
|
|
5011
|
+
react.useEffect(() => {
|
|
5012
|
+
if (mode !== "system") return;
|
|
5013
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
5014
|
+
const handleChange = () => {
|
|
5015
|
+
setTheme(getSystemTheme());
|
|
5016
|
+
};
|
|
5017
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
5018
|
+
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
5019
|
+
}, [mode, setTheme]);
|
|
5020
|
+
const options = [
|
|
5021
|
+
{ value: "light", icon: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Sun, {}), label: "Light" },
|
|
5022
|
+
{ value: "dark", icon: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Moon, {}), label: "Dark" },
|
|
5023
|
+
{ value: "system", icon: /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Monitor, {}), label: "System" }
|
|
5024
|
+
];
|
|
5025
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5026
|
+
"div",
|
|
5027
|
+
{
|
|
5028
|
+
className: cn(
|
|
5029
|
+
"inline-flex items-center bg-surface-base border border-edge rounded-md overflow-hidden",
|
|
5030
|
+
className
|
|
5031
|
+
),
|
|
5032
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5033
|
+
"button",
|
|
5034
|
+
{
|
|
5035
|
+
type: "button",
|
|
5036
|
+
onClick: () => setMode(option.value),
|
|
5037
|
+
"aria-label": option.label,
|
|
5038
|
+
"aria-pressed": mode === option.value,
|
|
5039
|
+
className: cn(
|
|
5040
|
+
"size-9 flex items-center justify-center cursor-pointer outline-none transition-colors",
|
|
5041
|
+
"[&:not(:first-child)]:border-l [&:not(:first-child)]:border-edge",
|
|
5042
|
+
"hover:bg-interactive",
|
|
5043
|
+
"focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset",
|
|
5044
|
+
mode === option.value ? "bg-interactive text-foreground-primary" : "text-foreground-muted"
|
|
5045
|
+
),
|
|
5046
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "sm", children: option.icon })
|
|
5047
|
+
},
|
|
5048
|
+
option.value
|
|
5049
|
+
))
|
|
5050
|
+
}
|
|
5051
|
+
);
|
|
5052
|
+
}
|
|
4987
5053
|
function Toggle({ label, children, className, ...props }) {
|
|
4988
5054
|
const isSelected = typeof props.value !== "undefined" ? !!props.value : void 0;
|
|
4989
5055
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -5190,6 +5256,7 @@ exports.Tabs = Tabs;
|
|
|
5190
5256
|
exports.Text = Text;
|
|
5191
5257
|
exports.TextField = TextField;
|
|
5192
5258
|
exports.ThemeButton = ThemeButton;
|
|
5259
|
+
exports.ThemeSwitcher = ThemeSwitcher;
|
|
5193
5260
|
exports.Toast = Toast;
|
|
5194
5261
|
exports.ToastContext = ToastContext;
|
|
5195
5262
|
exports.ToastProvider = ToastProvider;
|