@umami/react-zen 0.182.0 → 0.183.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 +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +54 -40
- package/dist/index.mjs +63 -49
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ export { BreadcrumbProps, BreadcrumbsProps, DialogTrigger, FileTrigger, Focusabl
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { HTMLAttributes, ReactNode, ReactElement, Dispatch, SetStateAction } from 'react';
|
|
5
5
|
import { UseFormProps, SubmitHandler, UseFormReturn, ControllerProps, ControllerRenderProps, FieldValues, ControllerFieldState, UseFormStateReturn, RegisterOptions } from 'react-hook-form';
|
|
6
|
+
import * as zustand from 'zustand';
|
|
6
7
|
|
|
7
8
|
interface FormProps extends UseFormProps, Omit<HTMLAttributes<HTMLFormElement>, 'children'> {
|
|
8
9
|
autoComplete?: string;
|
|
@@ -222,11 +223,13 @@ declare function ToastProvider({ children, ...props }: ToastProviderProps): reac
|
|
|
222
223
|
|
|
223
224
|
declare function useDebounce(value: string, delay: number): string;
|
|
224
225
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
theme:
|
|
228
|
-
setTheme:
|
|
229
|
-
|
|
226
|
+
type Theme = 'light' | 'dark';
|
|
227
|
+
interface ThemeState {
|
|
228
|
+
theme: Theme;
|
|
229
|
+
setTheme: (theme: Theme) => void;
|
|
230
|
+
initTheme: (preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system') => void;
|
|
231
|
+
}
|
|
232
|
+
declare const useTheme: zustand.UseBoundStore<zustand.StoreApi<ThemeState>>;
|
|
230
233
|
|
|
231
234
|
type ToastVariant = 'success' | 'error';
|
|
232
235
|
interface ToastOptions {
|
|
@@ -703,10 +706,7 @@ interface TextFieldProps extends TextFieldProps$1 {
|
|
|
703
706
|
}
|
|
704
707
|
declare function TextField({ value, defaultValue, label, placeholder, allowCopy, asTextArea, resize, onChange, isReadOnly, isDisabled, className, children, ...props }: TextFieldProps): react.JSX.Element;
|
|
705
708
|
|
|
706
|
-
|
|
707
|
-
defaultTheme?: string;
|
|
708
|
-
}
|
|
709
|
-
declare function ThemeButton({ className, variant, defaultTheme, onPress, ...props }: ThemeButtonProps): react.JSX.Element;
|
|
709
|
+
declare function ThemeButton({ className, variant, onPress, ...props }: ButtonProps): react.JSX.Element;
|
|
710
710
|
|
|
711
711
|
interface ToggleProps extends ToggleButtonProps {
|
|
712
712
|
label?: string;
|
|
@@ -727,11 +727,11 @@ interface ToggleGroupItemProps extends TagProps {
|
|
|
727
727
|
declare function ToggleGroupItem({ className, children, ...props }: ToggleGroupItemProps): react.JSX.Element;
|
|
728
728
|
|
|
729
729
|
interface ZenProviderProps {
|
|
730
|
-
theme?:
|
|
730
|
+
theme?: Theme;
|
|
731
731
|
colorScheme?: 'light' | 'dark' | 'system';
|
|
732
732
|
toast?: ToasterProps;
|
|
733
733
|
children: ReactNode;
|
|
734
734
|
}
|
|
735
|
-
declare function ZenProvider({ children,
|
|
735
|
+
declare function ZenProvider({ children, theme, colorScheme, toast, }: ZenProviderProps): react.JSX.Element;
|
|
736
736
|
|
|
737
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, AlertBanner, type AlertBannerProps, AlertDialog, type AlertDialogProps, Blockquote, type BlockquoteProps, Box, type BoxProps, Breadcrumb, Breadcrumbs, Button, type ButtonProps, Calendar, type CalendarProps, Checkbox, type CheckboxProps, Code, type CodeProps, Column, type ColumnProps, ComboBox, type ComboBoxProps, ConfirmationDialog, type ConfirmationDialogProps, Container, type ContainerProps, CopyButton, 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, type IconProps, Image, type ImageProps, InlineEditField, type InlineEditFieldProps, 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, ProgressBar, type ProgressBarProps, ProgressCircle, type ProgressCircleProps, Radio, RadioGroup, type RadioGroupProps, Row, type RowProps, SearchField, type SearchFieldProps, Select, type SelectProps, Sidebar, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, Slider, type SliderProps, Slot, Spinner, type SpinnerProps, StatusLight, type StatusLightProps, 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, ThemeButton,
|
|
737
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, AlertBanner, type AlertBannerProps, AlertDialog, type AlertDialogProps, Blockquote, type BlockquoteProps, Box, type BoxProps, Breadcrumb, Breadcrumbs, Button, type ButtonProps, Calendar, type CalendarProps, Checkbox, type CheckboxProps, Code, type CodeProps, Column, type ColumnProps, ComboBox, type ComboBoxProps, ConfirmationDialog, type ConfirmationDialogProps, Container, type ContainerProps, CopyButton, 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, type IconProps, Image, type ImageProps, InlineEditField, type InlineEditFieldProps, 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, ProgressBar, type ProgressBarProps, ProgressCircle, type ProgressCircleProps, Radio, RadioGroup, type RadioGroupProps, Row, type RowProps, SearchField, type SearchFieldProps, Select, type SelectProps, Sidebar, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, Slider, type SliderProps, Slot, Spinner, type SpinnerProps, StatusLight, type StatusLightProps, 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, ThemeButton, Toast, type ToastOptions, 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, useDebounce, useNavigationContext, useTheme, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { BreadcrumbProps, BreadcrumbsProps, DialogTrigger, FileTrigger, Focusabl
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { HTMLAttributes, ReactNode, ReactElement, Dispatch, SetStateAction } from 'react';
|
|
5
5
|
import { UseFormProps, SubmitHandler, UseFormReturn, ControllerProps, ControllerRenderProps, FieldValues, ControllerFieldState, UseFormStateReturn, RegisterOptions } from 'react-hook-form';
|
|
6
|
+
import * as zustand from 'zustand';
|
|
6
7
|
|
|
7
8
|
interface FormProps extends UseFormProps, Omit<HTMLAttributes<HTMLFormElement>, 'children'> {
|
|
8
9
|
autoComplete?: string;
|
|
@@ -222,11 +223,13 @@ declare function ToastProvider({ children, ...props }: ToastProviderProps): reac
|
|
|
222
223
|
|
|
223
224
|
declare function useDebounce(value: string, delay: number): string;
|
|
224
225
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
theme:
|
|
228
|
-
setTheme:
|
|
229
|
-
|
|
226
|
+
type Theme = 'light' | 'dark';
|
|
227
|
+
interface ThemeState {
|
|
228
|
+
theme: Theme;
|
|
229
|
+
setTheme: (theme: Theme) => void;
|
|
230
|
+
initTheme: (preferred?: Theme, colorScheme?: 'light' | 'dark' | 'system') => void;
|
|
231
|
+
}
|
|
232
|
+
declare const useTheme: zustand.UseBoundStore<zustand.StoreApi<ThemeState>>;
|
|
230
233
|
|
|
231
234
|
type ToastVariant = 'success' | 'error';
|
|
232
235
|
interface ToastOptions {
|
|
@@ -703,10 +706,7 @@ interface TextFieldProps extends TextFieldProps$1 {
|
|
|
703
706
|
}
|
|
704
707
|
declare function TextField({ value, defaultValue, label, placeholder, allowCopy, asTextArea, resize, onChange, isReadOnly, isDisabled, className, children, ...props }: TextFieldProps): react.JSX.Element;
|
|
705
708
|
|
|
706
|
-
|
|
707
|
-
defaultTheme?: string;
|
|
708
|
-
}
|
|
709
|
-
declare function ThemeButton({ className, variant, defaultTheme, onPress, ...props }: ThemeButtonProps): react.JSX.Element;
|
|
709
|
+
declare function ThemeButton({ className, variant, onPress, ...props }: ButtonProps): react.JSX.Element;
|
|
710
710
|
|
|
711
711
|
interface ToggleProps extends ToggleButtonProps {
|
|
712
712
|
label?: string;
|
|
@@ -727,11 +727,11 @@ interface ToggleGroupItemProps extends TagProps {
|
|
|
727
727
|
declare function ToggleGroupItem({ className, children, ...props }: ToggleGroupItemProps): react.JSX.Element;
|
|
728
728
|
|
|
729
729
|
interface ZenProviderProps {
|
|
730
|
-
theme?:
|
|
730
|
+
theme?: Theme;
|
|
731
731
|
colorScheme?: 'light' | 'dark' | 'system';
|
|
732
732
|
toast?: ToasterProps;
|
|
733
733
|
children: ReactNode;
|
|
734
734
|
}
|
|
735
|
-
declare function ZenProvider({ children,
|
|
735
|
+
declare function ZenProvider({ children, theme, colorScheme, toast, }: ZenProviderProps): react.JSX.Element;
|
|
736
736
|
|
|
737
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, AlertBanner, type AlertBannerProps, AlertDialog, type AlertDialogProps, Blockquote, type BlockquoteProps, Box, type BoxProps, Breadcrumb, Breadcrumbs, Button, type ButtonProps, Calendar, type CalendarProps, Checkbox, type CheckboxProps, Code, type CodeProps, Column, type ColumnProps, ComboBox, type ComboBoxProps, ConfirmationDialog, type ConfirmationDialogProps, Container, type ContainerProps, CopyButton, 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, type IconProps, Image, type ImageProps, InlineEditField, type InlineEditFieldProps, 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, ProgressBar, type ProgressBarProps, ProgressCircle, type ProgressCircleProps, Radio, RadioGroup, type RadioGroupProps, Row, type RowProps, SearchField, type SearchFieldProps, Select, type SelectProps, Sidebar, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, Slider, type SliderProps, Slot, Spinner, type SpinnerProps, StatusLight, type StatusLightProps, 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, ThemeButton,
|
|
737
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, AlertBanner, type AlertBannerProps, AlertDialog, type AlertDialogProps, Blockquote, type BlockquoteProps, Box, type BoxProps, Breadcrumb, Breadcrumbs, Button, type ButtonProps, Calendar, type CalendarProps, Checkbox, type CheckboxProps, Code, type CodeProps, Column, type ColumnProps, ComboBox, type ComboBoxProps, ConfirmationDialog, type ConfirmationDialogProps, Container, type ContainerProps, CopyButton, 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, type IconProps, Image, type ImageProps, InlineEditField, type InlineEditFieldProps, 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, ProgressBar, type ProgressBarProps, ProgressCircle, type ProgressCircleProps, Radio, RadioGroup, type RadioGroupProps, Row, type RowProps, SearchField, type SearchFieldProps, Select, type SelectProps, Sidebar, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, Slider, type SliderProps, Slot, Spinner, type SpinnerProps, StatusLight, type StatusLightProps, 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, ThemeButton, Toast, type ToastOptions, 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, useDebounce, useNavigationContext, useTheme, useToast };
|
package/dist/index.js
CHANGED
|
@@ -41,12 +41,12 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
41
41
|
}
|
|
42
42
|
var objectIs = "function" === typeof Object.is ? Object.is : is2;
|
|
43
43
|
var useState19 = React5.useState;
|
|
44
|
-
var
|
|
45
|
-
var
|
|
44
|
+
var useEffect12 = React5.useEffect;
|
|
45
|
+
var useLayoutEffect3 = React5.useLayoutEffect;
|
|
46
46
|
var useDebugValue = React5.useDebugValue;
|
|
47
47
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
48
48
|
var value = getSnapshot(), _useState = useState19({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
49
|
-
|
|
49
|
+
useLayoutEffect3(
|
|
50
50
|
function() {
|
|
51
51
|
inst.value = value;
|
|
52
52
|
inst.getSnapshot = getSnapshot;
|
|
@@ -54,7 +54,7 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
54
54
|
},
|
|
55
55
|
[subscribe, value, getSnapshot]
|
|
56
56
|
);
|
|
57
|
-
|
|
57
|
+
useEffect12(
|
|
58
58
|
function() {
|
|
59
59
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
60
60
|
return subscribe(function() {
|
|
@@ -107,7 +107,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
107
107
|
inst: { value, getSnapshot }
|
|
108
108
|
});
|
|
109
109
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
110
|
-
|
|
110
|
+
useLayoutEffect3(
|
|
111
111
|
function() {
|
|
112
112
|
inst.value = value;
|
|
113
113
|
inst.getSnapshot = getSnapshot;
|
|
@@ -115,7 +115,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
115
115
|
},
|
|
116
116
|
[subscribe, value, getSnapshot]
|
|
117
117
|
);
|
|
118
|
-
|
|
118
|
+
useEffect12(
|
|
119
119
|
function() {
|
|
120
120
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
121
121
|
return subscribe(function() {
|
|
@@ -141,7 +141,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
141
141
|
return getSnapshot();
|
|
142
142
|
}
|
|
143
143
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
144
|
-
var React5 = import_react198.default, objectIs = "function" === typeof Object.is ? Object.is : is2, useState19 = React5.useState,
|
|
144
|
+
var React5 = import_react198.default, objectIs = "function" === typeof Object.is ? Object.is : is2, useState19 = React5.useState, useEffect12 = React5.useEffect, useLayoutEffect3 = React5.useLayoutEffect, useDebugValue = React5.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
145
145
|
exports.useSyncExternalStore = void 0 !== React5.useSyncExternalStore ? React5.useSyncExternalStore : shim;
|
|
146
146
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
147
147
|
})();
|
|
@@ -1933,8 +1933,8 @@ function $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, context) {
|
|
|
1933
1933
|
mergedRef
|
|
1934
1934
|
];
|
|
1935
1935
|
}
|
|
1936
|
-
function $64fa3d84918910a7$export$9d4c57ee4c6ffdd8(
|
|
1937
|
-
let [hasSlot, setHasSlot] = (0, import_react23.useState)(
|
|
1936
|
+
function $64fa3d84918910a7$export$9d4c57ee4c6ffdd8(initialState2 = true) {
|
|
1937
|
+
let [hasSlot, setHasSlot] = (0, import_react23.useState)(initialState2);
|
|
1938
1938
|
let hasRun = (0, import_react23.useRef)(false);
|
|
1939
1939
|
let ref = (0, import_react23.useCallback)((el) => {
|
|
1940
1940
|
hasRun.current = true;
|
|
@@ -32366,13 +32366,13 @@ var createStoreImpl = (createState) => {
|
|
|
32366
32366
|
}
|
|
32367
32367
|
};
|
|
32368
32368
|
const getState = () => state;
|
|
32369
|
-
const getInitialState = () =>
|
|
32369
|
+
const getInitialState = () => initialState2;
|
|
32370
32370
|
const subscribe = (listener) => {
|
|
32371
32371
|
listeners.add(listener);
|
|
32372
32372
|
return () => listeners.delete(listener);
|
|
32373
32373
|
};
|
|
32374
32374
|
const api = { setState, getState, getInitialState, subscribe };
|
|
32375
|
-
const
|
|
32375
|
+
const initialState2 = state = createState(setState, getState, api);
|
|
32376
32376
|
return api;
|
|
32377
32377
|
};
|
|
32378
32378
|
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
@@ -32511,25 +32511,40 @@ function useDebounce(value, delay) {
|
|
|
32511
32511
|
|
|
32512
32512
|
// src/components/hooks/useTheme.ts
|
|
32513
32513
|
var import_react181 = require("react");
|
|
32514
|
-
function
|
|
32515
|
-
|
|
32516
|
-
|
|
32517
|
-
|
|
32518
|
-
|
|
32519
|
-
|
|
32520
|
-
|
|
32521
|
-
|
|
32522
|
-
|
|
32523
|
-
|
|
32514
|
+
function resolveTheme(preferred, colorScheme) {
|
|
32515
|
+
if (preferred) {
|
|
32516
|
+
return preferred;
|
|
32517
|
+
}
|
|
32518
|
+
if (colorScheme === "light" || colorScheme === "dark") {
|
|
32519
|
+
return colorScheme;
|
|
32520
|
+
}
|
|
32521
|
+
if (typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
32522
|
+
return "dark";
|
|
32523
|
+
}
|
|
32524
|
+
return "light";
|
|
32524
32525
|
}
|
|
32525
|
-
|
|
32526
|
-
|
|
32527
|
-
|
|
32528
|
-
|
|
32529
|
-
|
|
32526
|
+
var useTheme = create((set2, get2) => ({
|
|
32527
|
+
theme: "light",
|
|
32528
|
+
setTheme: (theme) => {
|
|
32529
|
+
set2({ theme });
|
|
32530
|
+
if (typeof window !== "undefined") {
|
|
32531
|
+
localStorage.setItem("zen.theme", theme);
|
|
32532
|
+
document.documentElement.setAttribute("data-theme", theme);
|
|
32530
32533
|
}
|
|
32531
|
-
},
|
|
32532
|
-
|
|
32534
|
+
},
|
|
32535
|
+
initTheme: (preferred, colorScheme) => {
|
|
32536
|
+
if (typeof window === "undefined") return;
|
|
32537
|
+
const stored = localStorage.getItem("zen.theme");
|
|
32538
|
+
const initial = resolveTheme(preferred || stored || void 0, colorScheme);
|
|
32539
|
+
set2({ theme: initial });
|
|
32540
|
+
document.documentElement.setAttribute("data-theme", initial);
|
|
32541
|
+
}
|
|
32542
|
+
}));
|
|
32543
|
+
function useInitTheme(preferred, colorScheme) {
|
|
32544
|
+
const initTheme = useTheme((s) => s.initTheme);
|
|
32545
|
+
(0, import_react181.useLayoutEffect)(() => {
|
|
32546
|
+
initTheme(preferred, colorScheme);
|
|
32547
|
+
}, [preferred, colorScheme, initTheme]);
|
|
32533
32548
|
}
|
|
32534
32549
|
|
|
32535
32550
|
// src/components/Accordion.tsx
|
|
@@ -34215,14 +34230,8 @@ var ThemeButton_default = { "button": "ThemeButton_button__MDUzN" };
|
|
|
34215
34230
|
|
|
34216
34231
|
// src/components/ThemeButton.tsx
|
|
34217
34232
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
34218
|
-
function ThemeButton({
|
|
34219
|
-
|
|
34220
|
-
variant = "quiet",
|
|
34221
|
-
defaultTheme,
|
|
34222
|
-
onPress,
|
|
34223
|
-
...props
|
|
34224
|
-
}) {
|
|
34225
|
-
const { theme, setTheme: setTheme2 } = useTheme(defaultTheme);
|
|
34233
|
+
function ThemeButton({ className, variant = "quiet", onPress, ...props }) {
|
|
34234
|
+
const { theme, setTheme } = useTheme();
|
|
34226
34235
|
const transitions = useTransition(theme, {
|
|
34227
34236
|
initial: { opacity: 1 },
|
|
34228
34237
|
from: {
|
|
@@ -34236,7 +34245,7 @@ function ThemeButton({
|
|
|
34236
34245
|
}
|
|
34237
34246
|
});
|
|
34238
34247
|
function handleClick(e) {
|
|
34239
|
-
|
|
34248
|
+
setTheme(theme === "light" ? "dark" : "light");
|
|
34240
34249
|
onPress?.(e);
|
|
34241
34250
|
}
|
|
34242
34251
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
@@ -34329,11 +34338,16 @@ function ToggleGroupItem({ className, children, ...props }) {
|
|
|
34329
34338
|
|
|
34330
34339
|
// src/components/ZenProvider.tsx
|
|
34331
34340
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
34332
|
-
var
|
|
34341
|
+
var defaultToastConfig = {
|
|
34333
34342
|
duration: 3e3
|
|
34334
34343
|
};
|
|
34335
|
-
function ZenProvider({
|
|
34336
|
-
|
|
34344
|
+
function ZenProvider({
|
|
34345
|
+
children,
|
|
34346
|
+
theme,
|
|
34347
|
+
colorScheme,
|
|
34348
|
+
toast = defaultToastConfig
|
|
34349
|
+
}) {
|
|
34350
|
+
useInitTheme(theme, colorScheme);
|
|
34337
34351
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ToastProvider, { ...toast, children });
|
|
34338
34352
|
}
|
|
34339
34353
|
/*! Bundled license information:
|
package/dist/index.mjs
CHANGED
|
@@ -35,12 +35,12 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
35
35
|
}
|
|
36
36
|
var objectIs = "function" === typeof Object.is ? Object.is : is2;
|
|
37
37
|
var useState19 = React5.useState;
|
|
38
|
-
var
|
|
39
|
-
var
|
|
38
|
+
var useEffect12 = React5.useEffect;
|
|
39
|
+
var useLayoutEffect3 = React5.useLayoutEffect;
|
|
40
40
|
var useDebugValue = React5.useDebugValue;
|
|
41
41
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
42
42
|
var value = getSnapshot(), _useState = useState19({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
43
|
-
|
|
43
|
+
useLayoutEffect3(
|
|
44
44
|
function() {
|
|
45
45
|
inst.value = value;
|
|
46
46
|
inst.getSnapshot = getSnapshot;
|
|
@@ -48,7 +48,7 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
48
48
|
},
|
|
49
49
|
[subscribe, value, getSnapshot]
|
|
50
50
|
);
|
|
51
|
-
|
|
51
|
+
useEffect12(
|
|
52
52
|
function() {
|
|
53
53
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
54
54
|
return subscribe(function() {
|
|
@@ -101,7 +101,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
101
101
|
inst: { value, getSnapshot }
|
|
102
102
|
});
|
|
103
103
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
104
|
-
|
|
104
|
+
useLayoutEffect3(
|
|
105
105
|
function() {
|
|
106
106
|
inst.value = value;
|
|
107
107
|
inst.getSnapshot = getSnapshot;
|
|
@@ -109,7 +109,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
109
109
|
},
|
|
110
110
|
[subscribe, value, getSnapshot]
|
|
111
111
|
);
|
|
112
|
-
|
|
112
|
+
useEffect12(
|
|
113
113
|
function() {
|
|
114
114
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
115
115
|
return subscribe(function() {
|
|
@@ -135,7 +135,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
135
135
|
return getSnapshot();
|
|
136
136
|
}
|
|
137
137
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
138
|
-
var React5 = __import_react2, objectIs = "function" === typeof Object.is ? Object.is : is2, useState19 = React5.useState,
|
|
138
|
+
var React5 = __import_react2, objectIs = "function" === typeof Object.is ? Object.is : is2, useState19 = React5.useState, useEffect12 = React5.useEffect, useLayoutEffect3 = React5.useLayoutEffect, useDebugValue = React5.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
139
139
|
exports.useSyncExternalStore = void 0 !== React5.useSyncExternalStore ? React5.useSyncExternalStore : shim;
|
|
140
140
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
141
141
|
})();
|
|
@@ -1814,8 +1814,8 @@ function $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, context) {
|
|
|
1814
1814
|
mergedRef
|
|
1815
1815
|
];
|
|
1816
1816
|
}
|
|
1817
|
-
function $64fa3d84918910a7$export$9d4c57ee4c6ffdd8(
|
|
1818
|
-
let [hasSlot, setHasSlot] = (0, $iETbY$useState)(
|
|
1817
|
+
function $64fa3d84918910a7$export$9d4c57ee4c6ffdd8(initialState2 = true) {
|
|
1818
|
+
let [hasSlot, setHasSlot] = (0, $iETbY$useState)(initialState2);
|
|
1819
1819
|
let hasRun = (0, $iETbY$useRef)(false);
|
|
1820
1820
|
let ref = (0, $iETbY$useCallback)((el) => {
|
|
1821
1821
|
hasRun.current = true;
|
|
@@ -32247,13 +32247,13 @@ var createStoreImpl = (createState) => {
|
|
|
32247
32247
|
}
|
|
32248
32248
|
};
|
|
32249
32249
|
const getState = () => state;
|
|
32250
|
-
const getInitialState = () =>
|
|
32250
|
+
const getInitialState = () => initialState2;
|
|
32251
32251
|
const subscribe = (listener) => {
|
|
32252
32252
|
listeners.add(listener);
|
|
32253
32253
|
return () => listeners.delete(listener);
|
|
32254
32254
|
};
|
|
32255
32255
|
const api = { setState, getState, getInitialState, subscribe };
|
|
32256
|
-
const
|
|
32256
|
+
const initialState2 = state = createState(setState, getState, api);
|
|
32257
32257
|
return api;
|
|
32258
32258
|
};
|
|
32259
32259
|
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
@@ -32391,26 +32391,41 @@ function useDebounce(value, delay) {
|
|
|
32391
32391
|
}
|
|
32392
32392
|
|
|
32393
32393
|
// src/components/hooks/useTheme.ts
|
|
32394
|
-
import {
|
|
32395
|
-
function
|
|
32396
|
-
|
|
32397
|
-
|
|
32398
|
-
|
|
32399
|
-
|
|
32400
|
-
|
|
32401
|
-
|
|
32402
|
-
|
|
32403
|
-
|
|
32404
|
-
|
|
32394
|
+
import { useLayoutEffect as useLayoutEffect2 } from "react";
|
|
32395
|
+
function resolveTheme(preferred, colorScheme) {
|
|
32396
|
+
if (preferred) {
|
|
32397
|
+
return preferred;
|
|
32398
|
+
}
|
|
32399
|
+
if (colorScheme === "light" || colorScheme === "dark") {
|
|
32400
|
+
return colorScheme;
|
|
32401
|
+
}
|
|
32402
|
+
if (typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
32403
|
+
return "dark";
|
|
32404
|
+
}
|
|
32405
|
+
return "light";
|
|
32405
32406
|
}
|
|
32406
|
-
|
|
32407
|
-
|
|
32408
|
-
|
|
32409
|
-
|
|
32410
|
-
|
|
32407
|
+
var useTheme = create((set2, get2) => ({
|
|
32408
|
+
theme: "light",
|
|
32409
|
+
setTheme: (theme) => {
|
|
32410
|
+
set2({ theme });
|
|
32411
|
+
if (typeof window !== "undefined") {
|
|
32412
|
+
localStorage.setItem("zen.theme", theme);
|
|
32413
|
+
document.documentElement.setAttribute("data-theme", theme);
|
|
32411
32414
|
}
|
|
32412
|
-
},
|
|
32413
|
-
|
|
32415
|
+
},
|
|
32416
|
+
initTheme: (preferred, colorScheme) => {
|
|
32417
|
+
if (typeof window === "undefined") return;
|
|
32418
|
+
const stored = localStorage.getItem("zen.theme");
|
|
32419
|
+
const initial = resolveTheme(preferred || stored || void 0, colorScheme);
|
|
32420
|
+
set2({ theme: initial });
|
|
32421
|
+
document.documentElement.setAttribute("data-theme", initial);
|
|
32422
|
+
}
|
|
32423
|
+
}));
|
|
32424
|
+
function useInitTheme(preferred, colorScheme) {
|
|
32425
|
+
const initTheme = useTheme((s) => s.initTheme);
|
|
32426
|
+
useLayoutEffect2(() => {
|
|
32427
|
+
initTheme(preferred, colorScheme);
|
|
32428
|
+
}, [preferred, colorScheme, initTheme]);
|
|
32414
32429
|
}
|
|
32415
32430
|
|
|
32416
32431
|
// src/components/Accordion.tsx
|
|
@@ -32915,7 +32930,7 @@ var import_classnames25 = __toESM(require_classnames());
|
|
|
32915
32930
|
import { useState as useState10 } from "react";
|
|
32916
32931
|
|
|
32917
32932
|
// src/components/TextField.tsx
|
|
32918
|
-
import { useEffect as
|
|
32933
|
+
import { useEffect as useEffect8, useState as useState9 } from "react";
|
|
32919
32934
|
var import_classnames24 = __toESM(require_classnames());
|
|
32920
32935
|
|
|
32921
32936
|
// src/components/CopyButton.tsx
|
|
@@ -32968,7 +32983,7 @@ function TextField2({
|
|
|
32968
32983
|
setInputValue(value2);
|
|
32969
32984
|
return onChange?.(value2);
|
|
32970
32985
|
};
|
|
32971
|
-
|
|
32986
|
+
useEffect8(() => {
|
|
32972
32987
|
setInputValue(value);
|
|
32973
32988
|
}, [value]);
|
|
32974
32989
|
return /* @__PURE__ */ jsxs20(Fragment6, { children: [
|
|
@@ -33187,7 +33202,7 @@ function Dots({ size = "md", className, ...props }) {
|
|
|
33187
33202
|
|
|
33188
33203
|
// src/components/FloatingTooltip.tsx
|
|
33189
33204
|
var import_classnames31 = __toESM(require_classnames());
|
|
33190
|
-
import { useEffect as
|
|
33205
|
+
import { useEffect as useEffect9, useState as useState11 } from "react";
|
|
33191
33206
|
|
|
33192
33207
|
// src/components/Tooltip.tsx
|
|
33193
33208
|
var import_classnames30 = __toESM(require_classnames());
|
|
@@ -33214,7 +33229,7 @@ var FloatingTooltip_default = { "floating": "FloatingTooltip_floating__ZjM4N" };
|
|
|
33214
33229
|
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
33215
33230
|
function FloatingTooltip({ className, style, children, ...props }) {
|
|
33216
33231
|
const [position, setPosition] = useState11({ x: -1e3, y: -1e3 });
|
|
33217
|
-
|
|
33232
|
+
useEffect9(() => {
|
|
33218
33233
|
const handler = (e) => {
|
|
33219
33234
|
setPosition({ x: e.clientX, y: e.clientY });
|
|
33220
33235
|
};
|
|
@@ -33270,7 +33285,7 @@ function Heading2({
|
|
|
33270
33285
|
}
|
|
33271
33286
|
|
|
33272
33287
|
// src/components/HoverTrigger.tsx
|
|
33273
|
-
import { useRef as useRef8, useState as useState12, useEffect as
|
|
33288
|
+
import { useRef as useRef8, useState as useState12, useEffect as useEffect10 } from "react";
|
|
33274
33289
|
|
|
33275
33290
|
// css-modules:E:\dev\umami-react-zen\src\components\HoverTrigger.module.css
|
|
33276
33291
|
var HoverTrigger_default = { "wrapper": "HoverTrigger_wrapper__NGFlN" };
|
|
@@ -33291,7 +33306,7 @@ function HoverTrigger({
|
|
|
33291
33306
|
const isOverMenu = useRef8(false);
|
|
33292
33307
|
const isOverButton = useRef8(false);
|
|
33293
33308
|
const timeout = useRef8(null);
|
|
33294
|
-
|
|
33309
|
+
useEffect10(() => {
|
|
33295
33310
|
if (isOpen !== open) {
|
|
33296
33311
|
setOpen(isOpen);
|
|
33297
33312
|
}
|
|
@@ -33771,7 +33786,7 @@ function Radio2({ children, className, ...props }) {
|
|
|
33771
33786
|
}
|
|
33772
33787
|
|
|
33773
33788
|
// src/components/SearchField.tsx
|
|
33774
|
-
import { useState as useState17, useEffect as
|
|
33789
|
+
import { useState as useState17, useEffect as useEffect11 } from "react";
|
|
33775
33790
|
var import_classnames45 = __toESM(require_classnames());
|
|
33776
33791
|
import { Fragment as Fragment12, jsx as jsx60, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
33777
33792
|
function SearchField2({
|
|
@@ -33799,7 +33814,7 @@ function SearchField2({
|
|
|
33799
33814
|
onSearch?.("");
|
|
33800
33815
|
onChange?.("");
|
|
33801
33816
|
};
|
|
33802
|
-
|
|
33817
|
+
useEffect11(() => {
|
|
33803
33818
|
if (delay > 0) {
|
|
33804
33819
|
onSearch?.(searchValue);
|
|
33805
33820
|
}
|
|
@@ -34100,14 +34115,8 @@ var ThemeButton_default = { "button": "ThemeButton_button__MDUzN" };
|
|
|
34100
34115
|
|
|
34101
34116
|
// src/components/ThemeButton.tsx
|
|
34102
34117
|
import { jsx as jsx67, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
34103
|
-
function ThemeButton({
|
|
34104
|
-
|
|
34105
|
-
variant = "quiet",
|
|
34106
|
-
defaultTheme,
|
|
34107
|
-
onPress,
|
|
34108
|
-
...props
|
|
34109
|
-
}) {
|
|
34110
|
-
const { theme, setTheme: setTheme2 } = useTheme(defaultTheme);
|
|
34118
|
+
function ThemeButton({ className, variant = "quiet", onPress, ...props }) {
|
|
34119
|
+
const { theme, setTheme } = useTheme();
|
|
34111
34120
|
const transitions = useTransition(theme, {
|
|
34112
34121
|
initial: { opacity: 1 },
|
|
34113
34122
|
from: {
|
|
@@ -34121,7 +34130,7 @@ function ThemeButton({
|
|
|
34121
34130
|
}
|
|
34122
34131
|
});
|
|
34123
34132
|
function handleClick(e) {
|
|
34124
|
-
|
|
34133
|
+
setTheme(theme === "light" ? "dark" : "light");
|
|
34125
34134
|
onPress?.(e);
|
|
34126
34135
|
}
|
|
34127
34136
|
return /* @__PURE__ */ jsxs41(
|
|
@@ -34214,11 +34223,16 @@ function ToggleGroupItem({ className, children, ...props }) {
|
|
|
34214
34223
|
|
|
34215
34224
|
// src/components/ZenProvider.tsx
|
|
34216
34225
|
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
34217
|
-
var
|
|
34226
|
+
var defaultToastConfig = {
|
|
34218
34227
|
duration: 3e3
|
|
34219
34228
|
};
|
|
34220
|
-
function ZenProvider({
|
|
34221
|
-
|
|
34229
|
+
function ZenProvider({
|
|
34230
|
+
children,
|
|
34231
|
+
theme,
|
|
34232
|
+
colorScheme,
|
|
34233
|
+
toast = defaultToastConfig
|
|
34234
|
+
}) {
|
|
34235
|
+
useInitTheme(theme, colorScheme);
|
|
34222
34236
|
return /* @__PURE__ */ jsx70(ToastProvider, { ...toast, children });
|
|
34223
34237
|
}
|
|
34224
34238
|
export {
|