@webdevarif/dashui 0.3.0 → 0.3.1
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -204,8 +204,12 @@ declare function NotificationBell({ count, onClick, className, }: NotificationBe
|
|
|
204
204
|
|
|
205
205
|
interface ThemeToggleProps {
|
|
206
206
|
className?: string;
|
|
207
|
+
/** External controlled theme value. When provided, next-themes is not used. */
|
|
208
|
+
theme?: string;
|
|
209
|
+
/** External toggle handler. When provided, next-themes setTheme is not called. */
|
|
210
|
+
onToggle?: () => void;
|
|
207
211
|
}
|
|
208
|
-
declare function ThemeToggle({ className }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
212
|
+
declare function ThemeToggle({ className, theme: externalTheme, onToggle }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
209
213
|
|
|
210
214
|
interface NavItem {
|
|
211
215
|
href: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -204,8 +204,12 @@ declare function NotificationBell({ count, onClick, className, }: NotificationBe
|
|
|
204
204
|
|
|
205
205
|
interface ThemeToggleProps {
|
|
206
206
|
className?: string;
|
|
207
|
+
/** External controlled theme value. When provided, next-themes is not used. */
|
|
208
|
+
theme?: string;
|
|
209
|
+
/** External toggle handler. When provided, next-themes setTheme is not called. */
|
|
210
|
+
onToggle?: () => void;
|
|
207
211
|
}
|
|
208
|
-
declare function ThemeToggle({ className }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
212
|
+
declare function ThemeToggle({ className, theme: externalTheme, onToggle }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
209
213
|
|
|
210
214
|
interface NavItem {
|
|
211
215
|
href: string;
|
package/dist/index.js
CHANGED
|
@@ -1207,7 +1207,7 @@ function NotificationBell({
|
|
|
1207
1207
|
var React17 = __toESM(require("react"));
|
|
1208
1208
|
var import_next_themes = require("next-themes");
|
|
1209
1209
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1210
|
-
function ThemeToggle({ className }) {
|
|
1210
|
+
function ThemeToggle({ className, theme: externalTheme, onToggle }) {
|
|
1211
1211
|
const { resolvedTheme, setTheme } = (0, import_next_themes.useTheme)();
|
|
1212
1212
|
const [mounted, setMounted] = React17.useState(false);
|
|
1213
1213
|
React17.useEffect(() => {
|
|
@@ -1226,11 +1226,12 @@ function ThemeToggle({ className }) {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
);
|
|
1228
1228
|
}
|
|
1229
|
-
const isDark = resolvedTheme === "dark";
|
|
1229
|
+
const isDark = externalTheme !== void 0 ? externalTheme === "dark" : resolvedTheme === "dark";
|
|
1230
|
+
const handleToggle = onToggle ?? (() => setTheme(isDark ? "light" : "dark"));
|
|
1230
1231
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1231
1232
|
"button",
|
|
1232
1233
|
{
|
|
1233
|
-
onClick:
|
|
1234
|
+
onClick: handleToggle,
|
|
1234
1235
|
className: cn(
|
|
1235
1236
|
"flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
1236
1237
|
className
|