@umami/react-zen 0.231.0 → 0.233.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/README.md +3 -3
- package/dist/index.d.mts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +108 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/styles.full.css +1 -1
- package/tailwind.preset.ts +34 -0
package/dist/index.mjs
CHANGED
|
@@ -194,7 +194,7 @@ tv({
|
|
|
194
194
|
});
|
|
195
195
|
var tooltip = tv({
|
|
196
196
|
base: [
|
|
197
|
-
"bg-surface-inverted text-foreground-inverted text-
|
|
197
|
+
"bg-surface-inverted text-foreground-inverted text-base px-2 py-1 rounded",
|
|
198
198
|
"entering:animate-popover-in",
|
|
199
199
|
"exiting:animate-popover-out"
|
|
200
200
|
]
|
|
@@ -2263,6 +2263,37 @@ function isMinHeightPreset(value) {
|
|
|
2263
2263
|
function isMaxHeightPreset(value) {
|
|
2264
2264
|
return value in maxHeightMap;
|
|
2265
2265
|
}
|
|
2266
|
+
function addStatePrefix(prefix, className) {
|
|
2267
|
+
if (!className) return "";
|
|
2268
|
+
return className.split(" ").filter(Boolean).map((cls) => `${prefix}:${cls}`).join(" ");
|
|
2269
|
+
}
|
|
2270
|
+
function mapStateStyles(prefix, styles) {
|
|
2271
|
+
if (!styles) return "";
|
|
2272
|
+
const classes = [];
|
|
2273
|
+
if (styles.color !== void 0) {
|
|
2274
|
+
const colorClass = mapTextColor(
|
|
2275
|
+
typeof styles.color === "boolean" ? "true" : String(styles.color)
|
|
2276
|
+
);
|
|
2277
|
+
if (colorClass) classes.push(addStatePrefix(prefix, colorClass));
|
|
2278
|
+
}
|
|
2279
|
+
if (styles.backgroundColor !== void 0) {
|
|
2280
|
+
const bgClass = mapBackgroundColor(
|
|
2281
|
+
typeof styles.backgroundColor === "boolean" ? "true" : String(styles.backgroundColor)
|
|
2282
|
+
);
|
|
2283
|
+
if (bgClass) classes.push(addStatePrefix(prefix, bgClass));
|
|
2284
|
+
}
|
|
2285
|
+
if (styles.borderColor !== void 0) {
|
|
2286
|
+
const borderClass = mapBorderColor(
|
|
2287
|
+
typeof styles.borderColor === "boolean" ? "true" : String(styles.borderColor)
|
|
2288
|
+
);
|
|
2289
|
+
if (borderClass) classes.push(addStatePrefix(prefix, borderClass));
|
|
2290
|
+
}
|
|
2291
|
+
if (styles.opacity !== void 0) {
|
|
2292
|
+
const opacityClass = mapOpacity(styles.opacity);
|
|
2293
|
+
if (opacityClass) classes.push(addStatePrefix(prefix, opacityClass));
|
|
2294
|
+
}
|
|
2295
|
+
return classes.join(" ");
|
|
2296
|
+
}
|
|
2266
2297
|
var sizeMap = {
|
|
2267
2298
|
xs: "w-3 h-3",
|
|
2268
2299
|
sm: "w-4 h-4",
|
|
@@ -2478,6 +2509,9 @@ var Box = forwardRef(function Box2({
|
|
|
2478
2509
|
order,
|
|
2479
2510
|
zIndex,
|
|
2480
2511
|
theme,
|
|
2512
|
+
hover,
|
|
2513
|
+
focus,
|
|
2514
|
+
active,
|
|
2481
2515
|
as = "div",
|
|
2482
2516
|
render,
|
|
2483
2517
|
className,
|
|
@@ -2532,6 +2566,9 @@ var Box = forwardRef(function Box2({
|
|
|
2532
2566
|
mapPointerEvents(pointerEvents),
|
|
2533
2567
|
mapAlignSelf(alignSelf),
|
|
2534
2568
|
theme && `${theme}-theme`,
|
|
2569
|
+
mapStateStyles("hover", hover),
|
|
2570
|
+
mapStateStyles("focus", focus),
|
|
2571
|
+
mapStateStyles("active", active),
|
|
2535
2572
|
className
|
|
2536
2573
|
);
|
|
2537
2574
|
const widthStyle = getSizingStyle(width, isWidthPreset);
|
|
@@ -2859,13 +2896,14 @@ function useFieldId(id) {
|
|
|
2859
2896
|
const generatedId = useId();
|
|
2860
2897
|
return id ?? generatedId;
|
|
2861
2898
|
}
|
|
2862
|
-
function Label({ size = "
|
|
2899
|
+
function Label({ size = "base", weight = "semibold", lineHeight = "loose", ...props }) {
|
|
2863
2900
|
return /* @__PURE__ */ jsx(
|
|
2864
2901
|
Text,
|
|
2865
2902
|
{
|
|
2866
2903
|
...props,
|
|
2867
2904
|
size,
|
|
2868
2905
|
weight,
|
|
2906
|
+
lineHeight,
|
|
2869
2907
|
render: (renderProps) => /* @__PURE__ */ jsx(Label$1, { ...renderProps })
|
|
2870
2908
|
}
|
|
2871
2909
|
);
|
|
@@ -4622,6 +4660,7 @@ function Select({
|
|
|
4622
4660
|
searchValue,
|
|
4623
4661
|
searchDelay,
|
|
4624
4662
|
isFullscreen,
|
|
4663
|
+
maxHeight,
|
|
4625
4664
|
onSearch,
|
|
4626
4665
|
onChange,
|
|
4627
4666
|
buttonProps,
|
|
@@ -4692,8 +4731,8 @@ function Select({
|
|
|
4692
4731
|
shouldFocusOnHover: false,
|
|
4693
4732
|
autoFocus: "first"
|
|
4694
4733
|
},
|
|
4695
|
-
className: cn("
|
|
4696
|
-
style: { ...listProps?.style, display: isLoading ? "none" : void 0 },
|
|
4734
|
+
className: cn("overflow-auto", listProps?.className),
|
|
4735
|
+
style: { ...listProps?.style, maxHeight, display: isLoading ? "none" : void 0 },
|
|
4697
4736
|
children
|
|
4698
4737
|
}
|
|
4699
4738
|
)
|
|
@@ -4963,6 +5002,70 @@ function ThemeButton({
|
|
|
4963
5002
|
}
|
|
4964
5003
|
);
|
|
4965
5004
|
}
|
|
5005
|
+
var STORAGE_KEY2 = "theme-mode";
|
|
5006
|
+
function getSystemTheme() {
|
|
5007
|
+
if (typeof window === "undefined") return "light";
|
|
5008
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
5009
|
+
}
|
|
5010
|
+
function ThemeSwitcher({ className }) {
|
|
5011
|
+
const { setTheme } = useTheme();
|
|
5012
|
+
const [mode, setMode] = useState("system");
|
|
5013
|
+
useEffect(() => {
|
|
5014
|
+
const stored = localStorage.getItem(STORAGE_KEY2);
|
|
5015
|
+
if (stored && ["light", "dark", "system"].includes(stored)) {
|
|
5016
|
+
setMode(stored);
|
|
5017
|
+
}
|
|
5018
|
+
}, []);
|
|
5019
|
+
useEffect(() => {
|
|
5020
|
+
if (mode === "system") {
|
|
5021
|
+
setTheme(getSystemTheme());
|
|
5022
|
+
} else {
|
|
5023
|
+
setTheme(mode);
|
|
5024
|
+
}
|
|
5025
|
+
localStorage.setItem(STORAGE_KEY2, mode);
|
|
5026
|
+
}, [mode, setTheme]);
|
|
5027
|
+
useEffect(() => {
|
|
5028
|
+
if (mode !== "system") return;
|
|
5029
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
5030
|
+
const handleChange = () => {
|
|
5031
|
+
setTheme(getSystemTheme());
|
|
5032
|
+
};
|
|
5033
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
5034
|
+
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
5035
|
+
}, [mode, setTheme]);
|
|
5036
|
+
const options = [
|
|
5037
|
+
{ value: "light", icon: /* @__PURE__ */ jsx(icons_exports.Sun, {}), label: "Light" },
|
|
5038
|
+
{ value: "dark", icon: /* @__PURE__ */ jsx(icons_exports.Moon, {}), label: "Dark" },
|
|
5039
|
+
{ value: "system", icon: /* @__PURE__ */ jsx(icons_exports.Monitor, {}), label: "System" }
|
|
5040
|
+
];
|
|
5041
|
+
return /* @__PURE__ */ jsx(
|
|
5042
|
+
"div",
|
|
5043
|
+
{
|
|
5044
|
+
className: cn(
|
|
5045
|
+
"inline-flex items-center bg-surface-base border border-edge rounded-md overflow-hidden",
|
|
5046
|
+
className
|
|
5047
|
+
),
|
|
5048
|
+
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
5049
|
+
"button",
|
|
5050
|
+
{
|
|
5051
|
+
type: "button",
|
|
5052
|
+
onClick: () => setMode(option.value),
|
|
5053
|
+
"aria-label": option.label,
|
|
5054
|
+
"aria-pressed": mode === option.value,
|
|
5055
|
+
className: cn(
|
|
5056
|
+
"size-9 flex items-center justify-center cursor-pointer outline-none transition-colors",
|
|
5057
|
+
"[&:not(:first-child)]:border-l [&:not(:first-child)]:border-edge",
|
|
5058
|
+
"hover:bg-interactive",
|
|
5059
|
+
"focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset",
|
|
5060
|
+
mode === option.value ? "bg-interactive text-foreground-primary" : "text-foreground-muted"
|
|
5061
|
+
),
|
|
5062
|
+
children: /* @__PURE__ */ jsx(Icon, { size: "sm", children: option.icon })
|
|
5063
|
+
},
|
|
5064
|
+
option.value
|
|
5065
|
+
))
|
|
5066
|
+
}
|
|
5067
|
+
);
|
|
5068
|
+
}
|
|
4966
5069
|
function Toggle({ label, children, className, ...props }) {
|
|
4967
5070
|
const isSelected = typeof props.value !== "undefined" ? !!props.value : void 0;
|
|
4968
5071
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -5051,6 +5154,6 @@ function ZenProvider({
|
|
|
5051
5154
|
return /* @__PURE__ */ jsx(ToastProvider, { ...toast2, children });
|
|
5052
5155
|
}
|
|
5053
5156
|
|
|
5054
|
-
export { Accordion, AccordionItem, AlertBanner, AlertDialog, Blockquote, Box, Breadcrumb, Breadcrumbs, Button, Calendar, Checkbox, Code, Column, ComboBox, ConfirmationDialog, Container, CopyButton, DataCard, DataColumn, DataTable, Dialog, Dots, Flexbox, FloatingTooltip, Form, FormButtons, FormController, FormField, FormFieldArray, FormResetButton, FormSubmitButton, Grid, Heading, HoverTrigger, Icon, IconLabel, Image, Label, List, ListItem, ListSection, ListSeparator, Loading, LoadingButton, Menu, MenuItem, MenuSection, MenuSeparator, Modal, NavMenu, NavMenuGroup, NavMenuItem, Navbar, NavbarContext, NavbarItem, PasswordField, Popover, ProgressBar, ProgressCircle, Radio, RadioGroup, Row, SearchField, Select, Sidebar, SidebarHeader, SidebarItem, SidebarSection, Slider, Spinner, StatusLight, SubMenuTrigger, Switch, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, Tabs, Text, TextField, ThemeButton, Toast, ToastContext, ToastProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipBubble, ZenProvider, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
|
5157
|
+
export { Accordion, AccordionItem, AlertBanner, AlertDialog, Blockquote, Box, Breadcrumb, Breadcrumbs, Button, Calendar, Checkbox, Code, Column, ComboBox, ConfirmationDialog, Container, CopyButton, DataCard, DataColumn, DataTable, Dialog, Dots, Flexbox, FloatingTooltip, Form, FormButtons, FormController, FormField, FormFieldArray, FormResetButton, FormSubmitButton, Grid, Heading, HoverTrigger, Icon, IconLabel, Image, Label, List, ListItem, ListSection, ListSeparator, Loading, LoadingButton, Menu, MenuItem, MenuSection, MenuSeparator, Modal, NavMenu, NavMenuGroup, NavMenuItem, Navbar, NavbarContext, NavbarItem, PasswordField, Popover, ProgressBar, ProgressCircle, Radio, RadioGroup, Row, SearchField, Select, Sidebar, SidebarHeader, SidebarItem, SidebarSection, Slider, Spinner, StatusLight, SubMenuTrigger, Switch, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, Tabs, Text, TextField, ThemeButton, ThemeSwitcher, Toast, ToastContext, ToastProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipBubble, ZenProvider, removeToast, resolveRender, useBreakpoint, useDebounce, useInitTheme, useNavigationContext, useTheme, useToast };
|
|
5055
5158
|
//# sourceMappingURL=index.mjs.map
|
|
5056
5159
|
//# sourceMappingURL=index.mjs.map
|