@pixpilot/shadcn-ui 0.26.0 → 0.28.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/file-upload/FileUpload.d.cts +2 -2
- package/dist/file-upload/FileUpload.d.ts +2 -2
- package/dist/file-upload-inline/FileUploadInline.d.ts +2 -2
- package/dist/index.cjs +9 -2
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/input/Input.d.ts +2 -2
- package/dist/theme-provider/index.d.ts +2 -2
- package/dist/theme-provider/index.js +2 -2
- package/dist/theme-toggle/ThemeModeDropdown.cjs +81 -0
- package/dist/theme-toggle/ThemeModeDropdown.d.cts +25 -0
- package/dist/theme-toggle/ThemeModeDropdown.d.ts +25 -0
- package/dist/theme-toggle/ThemeModeDropdown.js +76 -0
- package/dist/theme-toggle/ThemeModeSwitchInside.cjs +86 -0
- package/dist/theme-toggle/ThemeModeSwitchInside.d.cts +33 -0
- package/dist/theme-toggle/ThemeModeSwitchInside.d.ts +33 -0
- package/dist/theme-toggle/ThemeModeSwitchInside.js +82 -0
- package/dist/theme-toggle/ThemeModeSwitchOutside.cjs +68 -0
- package/dist/theme-toggle/ThemeModeSwitchOutside.d.cts +30 -0
- package/dist/theme-toggle/ThemeModeSwitchOutside.d.ts +30 -0
- package/dist/theme-toggle/ThemeModeSwitchOutside.js +63 -0
- package/dist/theme-toggle/ThemeModeToggleButton.cjs +48 -0
- package/dist/theme-toggle/ThemeModeToggleButton.d.cts +21 -0
- package/dist/theme-toggle/ThemeModeToggleButton.d.ts +21 -0
- package/dist/theme-toggle/ThemeModeToggleButton.js +43 -0
- package/dist/theme-toggle/index.cjs +4 -0
- package/dist/theme-toggle/index.d.cts +4 -0
- package/dist/theme-toggle/index.d.ts +4 -0
- package/dist/theme-toggle/index.js +4 -0
- package/package.json +2 -2
- package/dist/ThemeToggle.cjs +0 -98
- package/dist/ThemeToggle.d.cts +0 -6
- package/dist/ThemeToggle.d.ts +0 -6
- package/dist/ThemeToggle.js +0 -94
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileUploadProps } from "./types/index.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/file-upload/FileUpload.d.ts
|
|
5
|
-
declare function FileUpload(props: FileUploadProps):
|
|
5
|
+
declare function FileUpload(props: FileUploadProps): react_jsx_runtime6.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { FileUpload };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileUploadProps } from "./types/index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/file-upload/FileUpload.d.ts
|
|
5
|
-
declare function FileUpload(props: FileUploadProps):
|
|
5
|
+
declare function FileUpload(props: FileUploadProps): react_jsx_runtime6.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { FileUpload };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FileUploadInlineProps } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/file-upload-inline/FileUploadInline.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* FileUploadInline - An inline file upload component using FileUpload primitives
|
|
7
7
|
*/
|
|
8
|
-
declare function FileUploadInline(props: FileUploadInlineProps):
|
|
8
|
+
declare function FileUploadInline(props: FileUploadInlineProps): react_jsx_runtime7.JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { FileUploadInline };
|
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,11 @@ require('./tabs/index.cjs');
|
|
|
53
53
|
const require_tags_input = require('./tags-input.cjs');
|
|
54
54
|
const require_ThemeProvider = require('./theme-provider/ThemeProvider.cjs');
|
|
55
55
|
require('./theme-provider/index.cjs');
|
|
56
|
-
const
|
|
56
|
+
const require_ThemeModeDropdown = require('./theme-toggle/ThemeModeDropdown.cjs');
|
|
57
|
+
const require_ThemeModeSwitchInside = require('./theme-toggle/ThemeModeSwitchInside.cjs');
|
|
58
|
+
const require_ThemeModeSwitchOutside = require('./theme-toggle/ThemeModeSwitchOutside.cjs');
|
|
59
|
+
const require_ThemeModeToggleButton = require('./theme-toggle/ThemeModeToggleButton.cjs');
|
|
60
|
+
require('./theme-toggle/index.cjs');
|
|
57
61
|
const require_toast = require('./toast/toast.cjs');
|
|
58
62
|
require('./toast/index.cjs');
|
|
59
63
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
@@ -98,8 +102,11 @@ exports.TabsContext = require_TabsContext.TabsContext;
|
|
|
98
102
|
exports.TabsList = require_TabsList.TabsList;
|
|
99
103
|
exports.TabsTrigger = require_TabsTrigger.TabsTrigger;
|
|
100
104
|
exports.TagsInput = require_tags_input.TagsInput;
|
|
105
|
+
exports.ThemeModeDropdown = require_ThemeModeDropdown.ThemeModeDropdown;
|
|
106
|
+
exports.ThemeModeSwitchInside = require_ThemeModeSwitchInside.ThemeModeSwitchInside;
|
|
107
|
+
exports.ThemeModeSwitchOutside = require_ThemeModeSwitchOutside.ThemeModeSwitchOutside;
|
|
108
|
+
exports.ThemeModeToggleButton = require_ThemeModeToggleButton.ThemeModeToggleButton;
|
|
101
109
|
exports.ThemeProvider = require_ThemeProvider.ThemeProvider;
|
|
102
|
-
exports.ThemeToggle = require_ThemeToggle.ThemeToggle;
|
|
103
110
|
exports.cn = __pixpilot_shadcn.cn;
|
|
104
111
|
exports.showConfirmDialog = require_confirmation_dialogs.showConfirmDialog;
|
|
105
112
|
exports.toast = require_toast.toast;
|
package/dist/index.d.cts
CHANGED
|
@@ -58,8 +58,12 @@ import "./tabs/index.cjs";
|
|
|
58
58
|
import { TagsInput, TagsInputProps } from "./tags-input.cjs";
|
|
59
59
|
import { ThemeProvider, ThemeProviderProps } from "./theme-provider/ThemeProvider.cjs";
|
|
60
60
|
import { useTheme } from "./theme-provider/index.cjs";
|
|
61
|
-
import {
|
|
61
|
+
import { ThemeModeDropdown, ThemeModeDropdownProps } from "./theme-toggle/ThemeModeDropdown.cjs";
|
|
62
|
+
import { ThemeModeSwitchInside, ThemeModeSwitchInsideProps, ThemeModeSwitchInsideSize } from "./theme-toggle/ThemeModeSwitchInside.cjs";
|
|
63
|
+
import { ThemeModeSwitchOutside, ThemeModeSwitchOutsideProps } from "./theme-toggle/ThemeModeSwitchOutside.cjs";
|
|
64
|
+
import { ThemeModeToggleButton, ThemeModeToggleButtonProps } from "./theme-toggle/ThemeModeToggleButton.cjs";
|
|
65
|
+
import "./theme-toggle/index.cjs";
|
|
62
66
|
import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast/toast.cjs";
|
|
63
67
|
import "./toast/index.cjs";
|
|
64
68
|
import { cn } from "@pixpilot/shadcn";
|
|
65
|
-
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerBaseSection, ColorPickerProps, ColorSelect, ColorSelectOption, BaseColorSelectProps as ColorSelectProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Input, InputProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, PresetColor, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderInput, SliderInputProps, SliderProps, SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps,
|
|
69
|
+
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerBaseSection, ColorPickerProps, ColorSelect, ColorSelectOption, BaseColorSelectProps as ColorSelectProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Input, InputProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, PresetColor, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderInput, SliderInputProps, SliderProps, SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeModeDropdown, ThemeModeDropdownProps, ThemeModeSwitchInside, ThemeModeSwitchInsideProps, ThemeModeSwitchInsideSize, ThemeModeSwitchOutside, ThemeModeSwitchOutsideProps, ThemeModeToggleButton, ThemeModeToggleButtonProps, ThemeProvider, ThemeProviderProps, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useSelectKeyboard, useTabsContext, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -60,8 +60,12 @@ import "./tabs/index.js";
|
|
|
60
60
|
import { TagsInput, TagsInputProps } from "./tags-input.js";
|
|
61
61
|
import { ThemeProvider, ThemeProviderProps } from "./theme-provider/ThemeProvider.js";
|
|
62
62
|
import { useTheme } from "./theme-provider/index.js";
|
|
63
|
-
import {
|
|
63
|
+
import { ThemeModeDropdown, ThemeModeDropdownProps } from "./theme-toggle/ThemeModeDropdown.js";
|
|
64
|
+
import { ThemeModeSwitchInside, ThemeModeSwitchInsideProps, ThemeModeSwitchInsideSize } from "./theme-toggle/ThemeModeSwitchInside.js";
|
|
65
|
+
import { ThemeModeSwitchOutside, ThemeModeSwitchOutsideProps } from "./theme-toggle/ThemeModeSwitchOutside.js";
|
|
66
|
+
import { ThemeModeToggleButton, ThemeModeToggleButtonProps } from "./theme-toggle/ThemeModeToggleButton.js";
|
|
67
|
+
import "./theme-toggle/index.js";
|
|
64
68
|
import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast/toast.js";
|
|
65
69
|
import "./toast/index.js";
|
|
66
70
|
import { cn } from "@pixpilot/shadcn";
|
|
67
|
-
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerBaseSection, ColorPickerProps, ColorSelect, ColorSelectOption, BaseColorSelectProps as ColorSelectProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Input, InputProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, PresetColor, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderInput, SliderInputProps, SliderProps, SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps,
|
|
71
|
+
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerBaseSection, ColorPickerProps, ColorSelect, ColorSelectOption, BaseColorSelectProps as ColorSelectProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Input, InputProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, PresetColor, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderInput, SliderInputProps, SliderProps, SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeModeDropdown, ThemeModeDropdownProps, ThemeModeSwitchInside, ThemeModeSwitchInsideProps, ThemeModeSwitchInsideSize, ThemeModeSwitchOutside, ThemeModeSwitchOutsideProps, ThemeModeToggleButton, ThemeModeToggleButtonProps, ThemeProvider, ThemeProviderProps, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useSelectKeyboard, useTabsContext, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -54,9 +54,13 @@ import "./tabs/index.js";
|
|
|
54
54
|
import { TagsInput } from "./tags-input.js";
|
|
55
55
|
import { ThemeProvider } from "./theme-provider/ThemeProvider.js";
|
|
56
56
|
import { useTheme } from "./theme-provider/index.js";
|
|
57
|
-
import {
|
|
57
|
+
import { ThemeModeDropdown } from "./theme-toggle/ThemeModeDropdown.js";
|
|
58
|
+
import { ThemeModeSwitchInside } from "./theme-toggle/ThemeModeSwitchInside.js";
|
|
59
|
+
import { ThemeModeSwitchOutside } from "./theme-toggle/ThemeModeSwitchOutside.js";
|
|
60
|
+
import { ThemeModeToggleButton } from "./theme-toggle/ThemeModeToggleButton.js";
|
|
61
|
+
import "./theme-toggle/index.js";
|
|
58
62
|
import { DEFAULT_ALERT_DURATION, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast/toast.js";
|
|
59
63
|
import "./toast/index.js";
|
|
60
64
|
import { cn } from "@pixpilot/shadcn";
|
|
61
65
|
|
|
62
|
-
export { AbsoluteFill, Alert, AvatarUpload, Button, CircleLoader, CloseButtonAbsolute, CloseButtonRounded, ColorPicker, ColorPickerBase, ColorSelect, Combobox, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, FileUpload, FileUploadInline, IconPicker, Input, Layout, LayoutFooter, LayoutHeader, LayoutMain, LoadingOverlay, Pagination, RichTextEditor, ScaledPreview, Select, Slider, SliderInput, SliderSelect, Tabs, TabsContent, TabsContext, TabsList, TabsTrigger, TagsInput,
|
|
66
|
+
export { AbsoluteFill, Alert, AvatarUpload, Button, CircleLoader, CloseButtonAbsolute, CloseButtonRounded, ColorPicker, ColorPickerBase, ColorSelect, Combobox, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, FileUpload, FileUploadInline, IconPicker, Input, Layout, LayoutFooter, LayoutHeader, LayoutMain, LoadingOverlay, Pagination, RichTextEditor, ScaledPreview, Select, Slider, SliderInput, SliderSelect, Tabs, TabsContent, TabsContext, TabsList, TabsTrigger, TagsInput, ThemeModeDropdown, ThemeModeSwitchInside, ThemeModeSwitchOutside, ThemeModeToggleButton, ThemeProvider, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useSelectKeyboard, useTabsContext, useTheme };
|
package/dist/input/Input.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputProps } from "@pixpilot/shadcn";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/input/Input.d.ts
|
|
6
6
|
type InputProps$1 = InputProps & {
|
|
@@ -10,6 +10,6 @@ type InputProps$1 = InputProps & {
|
|
|
10
10
|
prefixClassName?: string;
|
|
11
11
|
suffixClassName?: string;
|
|
12
12
|
};
|
|
13
|
-
declare function Input$1(props: InputProps$1):
|
|
13
|
+
declare function Input$1(props: InputProps$1): react_jsx_runtime8.JSX.Element;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { Input$1 as Input, InputProps$1 as InputProps };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ThemeProvider as ThemeProvider$1, ThemeProviderProps } from "./ThemeProvider.js";
|
|
2
|
-
import { useTheme
|
|
3
|
-
export { useTheme
|
|
2
|
+
import { useTheme } from "next-themes";
|
|
3
|
+
export { useTheme };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
6
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
7
|
+
let lucide_react = require("lucide-react");
|
|
8
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
9
|
+
let react = require("react");
|
|
10
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
13
|
+
|
|
14
|
+
//#region src/theme-toggle/ThemeModeDropdown.tsx
|
|
15
|
+
/**
|
|
16
|
+
* Theme mode selector dropdown.
|
|
17
|
+
* Provides Light / Dark / System options.
|
|
18
|
+
* Pure component - requires theme and setTheme props.
|
|
19
|
+
*/
|
|
20
|
+
function ThemeModeDropdown(props) {
|
|
21
|
+
const { align = "end", className, theme, setTheme, resolvedTheme, disabled } = props;
|
|
22
|
+
const isDark = resolvedTheme === "dark";
|
|
23
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DropdownMenu, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.DropdownMenuTrigger, {
|
|
24
|
+
asChild: true,
|
|
25
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Button, {
|
|
26
|
+
variant: "outline",
|
|
27
|
+
size: "icon",
|
|
28
|
+
className: (0, __pixpilot_shadcn.cn)(className),
|
|
29
|
+
disabled,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Sun, { className: (0, __pixpilot_shadcn.cn)("h-[1.2rem] w-[1.2rem] transition-all", isDark ? "scale-0 -rotate-90" : "scale-100 rotate-0") }),
|
|
32
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Moon, { className: (0, __pixpilot_shadcn.cn)("absolute h-[1.2rem] w-[1.2rem] transition-all", isDark ? "scale-100 rotate-0" : "scale-0 rotate-90") }),
|
|
33
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
34
|
+
className: "sr-only",
|
|
35
|
+
children: "Toggle theme"
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DropdownMenuContent, {
|
|
40
|
+
align,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DropdownMenuItem, {
|
|
43
|
+
onClick: () => setTheme?.("light"),
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Sun, { className: "h-4 w-4 mr-2" }),
|
|
46
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
47
|
+
className: "flex-1",
|
|
48
|
+
children: "Light"
|
|
49
|
+
}),
|
|
50
|
+
theme === "light" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-4 w-4 ml-2" })
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DropdownMenuItem, {
|
|
54
|
+
onClick: () => setTheme?.("dark"),
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Moon, { className: "h-4 w-4 mr-2" }),
|
|
57
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
58
|
+
className: "flex-1",
|
|
59
|
+
children: "Dark"
|
|
60
|
+
}),
|
|
61
|
+
theme === "dark" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-4 w-4 ml-2" })
|
|
62
|
+
]
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DropdownMenuItem, {
|
|
65
|
+
onClick: () => setTheme?.("system"),
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Monitor, { className: "h-4 w-4 mr-2" }),
|
|
68
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
69
|
+
className: "flex-1",
|
|
70
|
+
children: "System"
|
|
71
|
+
}),
|
|
72
|
+
theme === "system" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-4 w-4 ml-2" })
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
})] });
|
|
77
|
+
}
|
|
78
|
+
ThemeModeDropdown.displayName = "ThemeModeDropdown";
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
exports.ThemeModeDropdown = ThemeModeDropdown;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/theme-toggle/ThemeModeDropdown.d.ts
|
|
4
|
+
interface ThemeModeDropdownProps {
|
|
5
|
+
align?: 'start' | 'center' | 'end';
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Current theme value ("light" | "dark" | "system") */
|
|
8
|
+
theme?: string;
|
|
9
|
+
/** Function to change the theme */
|
|
10
|
+
setTheme?: (theme: string) => void;
|
|
11
|
+
/** The resolved theme ("light" | "dark") */
|
|
12
|
+
resolvedTheme?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Theme mode selector dropdown.
|
|
17
|
+
* Provides Light / Dark / System options.
|
|
18
|
+
* Pure component - requires theme and setTheme props.
|
|
19
|
+
*/
|
|
20
|
+
declare function ThemeModeDropdown(props: ThemeModeDropdownProps): react_jsx_runtime10.JSX.Element;
|
|
21
|
+
declare namespace ThemeModeDropdown {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { ThemeModeDropdown, ThemeModeDropdownProps };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/theme-toggle/ThemeModeDropdown.d.ts
|
|
4
|
+
interface ThemeModeDropdownProps {
|
|
5
|
+
align?: 'start' | 'center' | 'end';
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Current theme value ("light" | "dark" | "system") */
|
|
8
|
+
theme?: string;
|
|
9
|
+
/** Function to change the theme */
|
|
10
|
+
setTheme?: (theme: string) => void;
|
|
11
|
+
/** The resolved theme ("light" | "dark") */
|
|
12
|
+
resolvedTheme?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Theme mode selector dropdown.
|
|
17
|
+
* Provides Light / Dark / System options.
|
|
18
|
+
* Pure component - requires theme and setTheme props.
|
|
19
|
+
*/
|
|
20
|
+
declare function ThemeModeDropdown(props: ThemeModeDropdownProps): react_jsx_runtime10.JSX.Element;
|
|
21
|
+
declare namespace ThemeModeDropdown {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { ThemeModeDropdown, ThemeModeDropdownProps };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, cn } from "@pixpilot/shadcn";
|
|
5
|
+
import { Check, Monitor, Moon, Sun } from "lucide-react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/theme-toggle/ThemeModeDropdown.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Theme mode selector dropdown.
|
|
12
|
+
* Provides Light / Dark / System options.
|
|
13
|
+
* Pure component - requires theme and setTheme props.
|
|
14
|
+
*/
|
|
15
|
+
function ThemeModeDropdown(props) {
|
|
16
|
+
const { align = "end", className, theme, setTheme, resolvedTheme, disabled } = props;
|
|
17
|
+
const isDark = resolvedTheme === "dark";
|
|
18
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
19
|
+
asChild: true,
|
|
20
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
21
|
+
variant: "outline",
|
|
22
|
+
size: "icon",
|
|
23
|
+
className: cn(className),
|
|
24
|
+
disabled,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Sun, { className: cn("h-[1.2rem] w-[1.2rem] transition-all", isDark ? "scale-0 -rotate-90" : "scale-100 rotate-0") }),
|
|
27
|
+
/* @__PURE__ */ jsx(Moon, { className: cn("absolute h-[1.2rem] w-[1.2rem] transition-all", isDark ? "scale-100 rotate-0" : "scale-0 rotate-90") }),
|
|
28
|
+
/* @__PURE__ */ jsx("span", {
|
|
29
|
+
className: "sr-only",
|
|
30
|
+
children: "Toggle theme"
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
})
|
|
34
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
35
|
+
align,
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
38
|
+
onClick: () => setTheme?.("light"),
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Sun, { className: "h-4 w-4 mr-2" }),
|
|
41
|
+
/* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "flex-1",
|
|
43
|
+
children: "Light"
|
|
44
|
+
}),
|
|
45
|
+
theme === "light" && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 ml-2" })
|
|
46
|
+
]
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
49
|
+
onClick: () => setTheme?.("dark"),
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx(Moon, { className: "h-4 w-4 mr-2" }),
|
|
52
|
+
/* @__PURE__ */ jsx("span", {
|
|
53
|
+
className: "flex-1",
|
|
54
|
+
children: "Dark"
|
|
55
|
+
}),
|
|
56
|
+
theme === "dark" && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 ml-2" })
|
|
57
|
+
]
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
60
|
+
onClick: () => setTheme?.("system"),
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsx(Monitor, { className: "h-4 w-4 mr-2" }),
|
|
63
|
+
/* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: "flex-1",
|
|
65
|
+
children: "System"
|
|
66
|
+
}),
|
|
67
|
+
theme === "system" && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 ml-2" })
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
})] });
|
|
72
|
+
}
|
|
73
|
+
ThemeModeDropdown.displayName = "ThemeModeDropdown";
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { ThemeModeDropdown };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
6
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
7
|
+
let lucide_react = require("lucide-react");
|
|
8
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
11
|
+
|
|
12
|
+
//#region src/theme-toggle/ThemeModeSwitchInside.tsx
|
|
13
|
+
const DEFAULT_ICON_SIZE = 16;
|
|
14
|
+
const TOGGLE_WRAPPER_CLASS_NAME = (0, __pixpilot_shadcn.cn)("relative inline-flex items-center gap-1 rounded-full border border-border p-1 bg-transparent");
|
|
15
|
+
const ICON_CLASS_NAME = (0, __pixpilot_shadcn.cn)("pointer-events-none rounded-full transition-colors");
|
|
16
|
+
const SWITCH_OVERLAY_CLASS_NAME = (0, __pixpilot_shadcn.cn)("absolute inset-0 h-full w-full opacity-0 cursor-pointer rounded-full", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "ring-offset-background disabled:cursor-not-allowed");
|
|
17
|
+
const SIZE_STYLES = {
|
|
18
|
+
sm: {
|
|
19
|
+
wrapper: "h-8",
|
|
20
|
+
iconPadding: "p-1",
|
|
21
|
+
defaultIconSize: 22
|
|
22
|
+
},
|
|
23
|
+
md: {
|
|
24
|
+
wrapper: "h-8/5",
|
|
25
|
+
iconPadding: "p-1",
|
|
26
|
+
defaultIconSize: 24
|
|
27
|
+
},
|
|
28
|
+
lg: {
|
|
29
|
+
wrapper: "h-10 p-1.5 gap-1.5",
|
|
30
|
+
iconPadding: "p-1.5",
|
|
31
|
+
defaultIconSize: 30
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Light/Dark theme switch with icons inside the switch.
|
|
36
|
+
* Icons are embedded within the switch control.
|
|
37
|
+
* Pure component - requires resolvedTheme and setTheme props.
|
|
38
|
+
*/
|
|
39
|
+
function ThemeModeSwitchInside(props) {
|
|
40
|
+
const { showIcons = true, size = "md", iconSize: iconSizeProp, className, switchClassName, disabled, ariaLabel = "Toggle theme", resolvedTheme, setTheme } = props;
|
|
41
|
+
const sizeStyles = SIZE_STYLES[size];
|
|
42
|
+
const iconSize = iconSizeProp ?? sizeStyles.defaultIconSize ?? DEFAULT_ICON_SIZE;
|
|
43
|
+
const isDark = resolvedTheme === "dark";
|
|
44
|
+
const onCheckedChange = (checked) => {
|
|
45
|
+
setTheme?.(checked ? "dark" : "light");
|
|
46
|
+
};
|
|
47
|
+
if (!showIcons) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Switch, {
|
|
48
|
+
checked: isDark,
|
|
49
|
+
onCheckedChange,
|
|
50
|
+
disabled,
|
|
51
|
+
className: (0, __pixpilot_shadcn.cn)(switchClassName),
|
|
52
|
+
"aria-label": ariaLabel
|
|
53
|
+
});
|
|
54
|
+
const sunClassName = (0, __pixpilot_shadcn.cn)(ICON_CLASS_NAME, sizeStyles.iconPadding, isDark ? "text-muted-foreground" : "bg-primary/10 text-accent-foreground");
|
|
55
|
+
const moonClassName = (0, __pixpilot_shadcn.cn)(ICON_CLASS_NAME, sizeStyles.iconPadding, isDark ? "bg-accent text-accent-foreground" : "text-muted-foreground");
|
|
56
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
57
|
+
className: (0, __pixpilot_shadcn.cn)(TOGGLE_WRAPPER_CLASS_NAME, sizeStyles.wrapper, disabled && "opacity-50", className),
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Switch, {
|
|
60
|
+
checked: isDark,
|
|
61
|
+
onCheckedChange,
|
|
62
|
+
disabled,
|
|
63
|
+
className: (0, __pixpilot_shadcn.cn)(SWITCH_OVERLAY_CLASS_NAME, switchClassName),
|
|
64
|
+
"aria-label": ariaLabel
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SunIcon, {
|
|
67
|
+
className: sunClassName,
|
|
68
|
+
style: {
|
|
69
|
+
width: iconSize,
|
|
70
|
+
height: iconSize
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.MoonIcon, {
|
|
74
|
+
className: moonClassName,
|
|
75
|
+
style: {
|
|
76
|
+
width: iconSize,
|
|
77
|
+
height: iconSize
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
ThemeModeSwitchInside.displayName = "ThemeModeSwitchInside";
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
exports.ThemeModeSwitchInside = ThemeModeSwitchInside;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/theme-toggle/ThemeModeSwitchInside.d.ts
|
|
4
|
+
type ThemeModeSwitchInsideSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
interface ThemeModeSwitchInsideProps {
|
|
6
|
+
/** Whether to render the sun/moon icons at all. */
|
|
7
|
+
showIcons?: boolean;
|
|
8
|
+
/** Visual size of the toggle pill. */
|
|
9
|
+
size?: ThemeModeSwitchInsideSize;
|
|
10
|
+
/** Icon size in pixels. */
|
|
11
|
+
iconSize?: number;
|
|
12
|
+
/** Wrapper class name. */
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Class name applied to the underlying Switch. */
|
|
15
|
+
switchClassName?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
/** The resolved theme ("light" | "dark") */
|
|
19
|
+
resolvedTheme?: string;
|
|
20
|
+
/** Function to change the theme */
|
|
21
|
+
setTheme?: (theme: string) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Light/Dark theme switch with icons inside the switch.
|
|
25
|
+
* Icons are embedded within the switch control.
|
|
26
|
+
* Pure component - requires resolvedTheme and setTheme props.
|
|
27
|
+
*/
|
|
28
|
+
declare function ThemeModeSwitchInside(props: ThemeModeSwitchInsideProps): react_jsx_runtime11.JSX.Element;
|
|
29
|
+
declare namespace ThemeModeSwitchInside {
|
|
30
|
+
var displayName: string;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ThemeModeSwitchInside, ThemeModeSwitchInsideProps, ThemeModeSwitchInsideSize };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/theme-toggle/ThemeModeSwitchInside.d.ts
|
|
4
|
+
type ThemeModeSwitchInsideSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
interface ThemeModeSwitchInsideProps {
|
|
6
|
+
/** Whether to render the sun/moon icons at all. */
|
|
7
|
+
showIcons?: boolean;
|
|
8
|
+
/** Visual size of the toggle pill. */
|
|
9
|
+
size?: ThemeModeSwitchInsideSize;
|
|
10
|
+
/** Icon size in pixels. */
|
|
11
|
+
iconSize?: number;
|
|
12
|
+
/** Wrapper class name. */
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Class name applied to the underlying Switch. */
|
|
15
|
+
switchClassName?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
/** The resolved theme ("light" | "dark") */
|
|
19
|
+
resolvedTheme?: string;
|
|
20
|
+
/** Function to change the theme */
|
|
21
|
+
setTheme?: (theme: string) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Light/Dark theme switch with icons inside the switch.
|
|
25
|
+
* Icons are embedded within the switch control.
|
|
26
|
+
* Pure component - requires resolvedTheme and setTheme props.
|
|
27
|
+
*/
|
|
28
|
+
declare function ThemeModeSwitchInside(props: ThemeModeSwitchInsideProps): react_jsx_runtime11.JSX.Element;
|
|
29
|
+
declare namespace ThemeModeSwitchInside {
|
|
30
|
+
var displayName: string;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ThemeModeSwitchInside, ThemeModeSwitchInsideProps, ThemeModeSwitchInsideSize };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { Switch, cn } from "@pixpilot/shadcn";
|
|
5
|
+
import { MoonIcon, SunIcon } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/theme-toggle/ThemeModeSwitchInside.tsx
|
|
9
|
+
const DEFAULT_ICON_SIZE = 16;
|
|
10
|
+
const TOGGLE_WRAPPER_CLASS_NAME = cn("relative inline-flex items-center gap-1 rounded-full border border-border p-1 bg-transparent");
|
|
11
|
+
const ICON_CLASS_NAME = cn("pointer-events-none rounded-full transition-colors");
|
|
12
|
+
const SWITCH_OVERLAY_CLASS_NAME = cn("absolute inset-0 h-full w-full opacity-0 cursor-pointer rounded-full", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "ring-offset-background disabled:cursor-not-allowed");
|
|
13
|
+
const SIZE_STYLES = {
|
|
14
|
+
sm: {
|
|
15
|
+
wrapper: "h-8",
|
|
16
|
+
iconPadding: "p-1",
|
|
17
|
+
defaultIconSize: 22
|
|
18
|
+
},
|
|
19
|
+
md: {
|
|
20
|
+
wrapper: "h-8/5",
|
|
21
|
+
iconPadding: "p-1",
|
|
22
|
+
defaultIconSize: 24
|
|
23
|
+
},
|
|
24
|
+
lg: {
|
|
25
|
+
wrapper: "h-10 p-1.5 gap-1.5",
|
|
26
|
+
iconPadding: "p-1.5",
|
|
27
|
+
defaultIconSize: 30
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Light/Dark theme switch with icons inside the switch.
|
|
32
|
+
* Icons are embedded within the switch control.
|
|
33
|
+
* Pure component - requires resolvedTheme and setTheme props.
|
|
34
|
+
*/
|
|
35
|
+
function ThemeModeSwitchInside(props) {
|
|
36
|
+
const { showIcons = true, size = "md", iconSize: iconSizeProp, className, switchClassName, disabled, ariaLabel = "Toggle theme", resolvedTheme, setTheme } = props;
|
|
37
|
+
const sizeStyles = SIZE_STYLES[size];
|
|
38
|
+
const iconSize = iconSizeProp ?? sizeStyles.defaultIconSize ?? DEFAULT_ICON_SIZE;
|
|
39
|
+
const isDark = resolvedTheme === "dark";
|
|
40
|
+
const onCheckedChange = (checked) => {
|
|
41
|
+
setTheme?.(checked ? "dark" : "light");
|
|
42
|
+
};
|
|
43
|
+
if (!showIcons) return /* @__PURE__ */ jsx(Switch, {
|
|
44
|
+
checked: isDark,
|
|
45
|
+
onCheckedChange,
|
|
46
|
+
disabled,
|
|
47
|
+
className: cn(switchClassName),
|
|
48
|
+
"aria-label": ariaLabel
|
|
49
|
+
});
|
|
50
|
+
const sunClassName = cn(ICON_CLASS_NAME, sizeStyles.iconPadding, isDark ? "text-muted-foreground" : "bg-primary/10 text-accent-foreground");
|
|
51
|
+
const moonClassName = cn(ICON_CLASS_NAME, sizeStyles.iconPadding, isDark ? "bg-accent text-accent-foreground" : "text-muted-foreground");
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: cn(TOGGLE_WRAPPER_CLASS_NAME, sizeStyles.wrapper, disabled && "opacity-50", className),
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Switch, {
|
|
56
|
+
checked: isDark,
|
|
57
|
+
onCheckedChange,
|
|
58
|
+
disabled,
|
|
59
|
+
className: cn(SWITCH_OVERLAY_CLASS_NAME, switchClassName),
|
|
60
|
+
"aria-label": ariaLabel
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsx(SunIcon, {
|
|
63
|
+
className: sunClassName,
|
|
64
|
+
style: {
|
|
65
|
+
width: iconSize,
|
|
66
|
+
height: iconSize
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsx(MoonIcon, {
|
|
70
|
+
className: moonClassName,
|
|
71
|
+
style: {
|
|
72
|
+
width: iconSize,
|
|
73
|
+
height: iconSize
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
ThemeModeSwitchInside.displayName = "ThemeModeSwitchInside";
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { ThemeModeSwitchInside };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
6
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
7
|
+
let lucide_react = require("lucide-react");
|
|
8
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
9
|
+
let react = require("react");
|
|
10
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
13
|
+
|
|
14
|
+
//#region src/theme-toggle/ThemeModeSwitchOutside.tsx
|
|
15
|
+
const DEFAULT_ICON_SIZE = 16;
|
|
16
|
+
/**
|
|
17
|
+
* Light/Dark theme switch with icons outside the switch.
|
|
18
|
+
* Icons flank the switch control on either side.
|
|
19
|
+
* Pure component - requires resolvedTheme and setTheme props.
|
|
20
|
+
*/
|
|
21
|
+
function ThemeModeSwitchOutside(props) {
|
|
22
|
+
const { showIcons = true, iconSize = DEFAULT_ICON_SIZE, className, switchClassName, disabled, ariaLabel = "Toggle theme", resolvedTheme, setTheme } = props;
|
|
23
|
+
const isDark = resolvedTheme === "dark";
|
|
24
|
+
const onCheckedChange = (checked) => {
|
|
25
|
+
setTheme?.(checked ? "dark" : "light");
|
|
26
|
+
};
|
|
27
|
+
if (!showIcons) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Switch, {
|
|
28
|
+
checked: isDark,
|
|
29
|
+
onCheckedChange,
|
|
30
|
+
disabled,
|
|
31
|
+
className: (0, __pixpilot_shadcn.cn)(switchClassName),
|
|
32
|
+
"aria-label": ariaLabel
|
|
33
|
+
});
|
|
34
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
35
|
+
className: (0, __pixpilot_shadcn.cn)("inline-flex items-center gap-2 px-2", className),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SunIcon, {
|
|
38
|
+
className: (0, __pixpilot_shadcn.cn)("transition-opacity ", isDark ? "opacity-50 " : "opacity-100"),
|
|
39
|
+
style: {
|
|
40
|
+
width: iconSize,
|
|
41
|
+
height: iconSize
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Switch, {
|
|
45
|
+
checked: isDark,
|
|
46
|
+
onCheckedChange,
|
|
47
|
+
disabled,
|
|
48
|
+
className: (0, __pixpilot_shadcn.cn)(switchClassName),
|
|
49
|
+
"aria-label": ariaLabel
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.MoonIcon, {
|
|
52
|
+
className: (0, __pixpilot_shadcn.cn)("transition-opacity", isDark ? "opacity-100" : "opacity-50"),
|
|
53
|
+
style: {
|
|
54
|
+
width: iconSize,
|
|
55
|
+
height: iconSize
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
59
|
+
className: "sr-only",
|
|
60
|
+
children: ariaLabel
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
ThemeModeSwitchOutside.displayName = "ThemeModeSwitchOutside";
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.ThemeModeSwitchOutside = ThemeModeSwitchOutside;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/theme-toggle/ThemeModeSwitchOutside.d.ts
|
|
4
|
+
interface ThemeModeSwitchOutsideProps {
|
|
5
|
+
/** Whether to render the sun/moon icons at all. */
|
|
6
|
+
showIcons?: boolean;
|
|
7
|
+
/** Icon size in pixels. */
|
|
8
|
+
iconSize?: number;
|
|
9
|
+
/** Wrapper class name. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Class name applied to the underlying Switch. */
|
|
12
|
+
switchClassName?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
/** The resolved theme ("light" | "dark") */
|
|
16
|
+
resolvedTheme?: string;
|
|
17
|
+
/** Function to change the theme */
|
|
18
|
+
setTheme?: (theme: string) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Light/Dark theme switch with icons outside the switch.
|
|
22
|
+
* Icons flank the switch control on either side.
|
|
23
|
+
* Pure component - requires resolvedTheme and setTheme props.
|
|
24
|
+
*/
|
|
25
|
+
declare function ThemeModeSwitchOutside(props: ThemeModeSwitchOutsideProps): react_jsx_runtime12.JSX.Element;
|
|
26
|
+
declare namespace ThemeModeSwitchOutside {
|
|
27
|
+
var displayName: string;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { ThemeModeSwitchOutside, ThemeModeSwitchOutsideProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/theme-toggle/ThemeModeSwitchOutside.d.ts
|
|
4
|
+
interface ThemeModeSwitchOutsideProps {
|
|
5
|
+
/** Whether to render the sun/moon icons at all. */
|
|
6
|
+
showIcons?: boolean;
|
|
7
|
+
/** Icon size in pixels. */
|
|
8
|
+
iconSize?: number;
|
|
9
|
+
/** Wrapper class name. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Class name applied to the underlying Switch. */
|
|
12
|
+
switchClassName?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
/** The resolved theme ("light" | "dark") */
|
|
16
|
+
resolvedTheme?: string;
|
|
17
|
+
/** Function to change the theme */
|
|
18
|
+
setTheme?: (theme: string) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Light/Dark theme switch with icons outside the switch.
|
|
22
|
+
* Icons flank the switch control on either side.
|
|
23
|
+
* Pure component - requires resolvedTheme and setTheme props.
|
|
24
|
+
*/
|
|
25
|
+
declare function ThemeModeSwitchOutside(props: ThemeModeSwitchOutsideProps): react_jsx_runtime12.JSX.Element;
|
|
26
|
+
declare namespace ThemeModeSwitchOutside {
|
|
27
|
+
var displayName: string;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { ThemeModeSwitchOutside, ThemeModeSwitchOutsideProps };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { Switch, cn } from "@pixpilot/shadcn";
|
|
5
|
+
import { MoonIcon, SunIcon } from "lucide-react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/theme-toggle/ThemeModeSwitchOutside.tsx
|
|
10
|
+
const DEFAULT_ICON_SIZE = 16;
|
|
11
|
+
/**
|
|
12
|
+
* Light/Dark theme switch with icons outside the switch.
|
|
13
|
+
* Icons flank the switch control on either side.
|
|
14
|
+
* Pure component - requires resolvedTheme and setTheme props.
|
|
15
|
+
*/
|
|
16
|
+
function ThemeModeSwitchOutside(props) {
|
|
17
|
+
const { showIcons = true, iconSize = DEFAULT_ICON_SIZE, className, switchClassName, disabled, ariaLabel = "Toggle theme", resolvedTheme, setTheme } = props;
|
|
18
|
+
const isDark = resolvedTheme === "dark";
|
|
19
|
+
const onCheckedChange = (checked) => {
|
|
20
|
+
setTheme?.(checked ? "dark" : "light");
|
|
21
|
+
};
|
|
22
|
+
if (!showIcons) return /* @__PURE__ */ jsx(Switch, {
|
|
23
|
+
checked: isDark,
|
|
24
|
+
onCheckedChange,
|
|
25
|
+
disabled,
|
|
26
|
+
className: cn(switchClassName),
|
|
27
|
+
"aria-label": ariaLabel
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: cn("inline-flex items-center gap-2 px-2", className),
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx(SunIcon, {
|
|
33
|
+
className: cn("transition-opacity ", isDark ? "opacity-50 " : "opacity-100"),
|
|
34
|
+
style: {
|
|
35
|
+
width: iconSize,
|
|
36
|
+
height: iconSize
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ jsx(Switch, {
|
|
40
|
+
checked: isDark,
|
|
41
|
+
onCheckedChange,
|
|
42
|
+
disabled,
|
|
43
|
+
className: cn(switchClassName),
|
|
44
|
+
"aria-label": ariaLabel
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ jsx(MoonIcon, {
|
|
47
|
+
className: cn("transition-opacity", isDark ? "opacity-100" : "opacity-50"),
|
|
48
|
+
style: {
|
|
49
|
+
width: iconSize,
|
|
50
|
+
height: iconSize
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: "sr-only",
|
|
55
|
+
children: ariaLabel
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
ThemeModeSwitchOutside.displayName = "ThemeModeSwitchOutside";
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { ThemeModeSwitchOutside };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
6
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
7
|
+
let lucide_react = require("lucide-react");
|
|
8
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
9
|
+
let react = require("react");
|
|
10
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
13
|
+
|
|
14
|
+
//#region src/theme-toggle/ThemeModeToggleButton.tsx
|
|
15
|
+
/**
|
|
16
|
+
* Light/Dark toggle button.
|
|
17
|
+
* Pure component - toggles between light and dark.
|
|
18
|
+
*/
|
|
19
|
+
function ThemeModeToggleButton(props) {
|
|
20
|
+
const { className, resolvedTheme, setTheme, disabled } = props;
|
|
21
|
+
const toggleTheme = react.default.useCallback(() => {
|
|
22
|
+
if (resolvedTheme === "dark") {
|
|
23
|
+
setTheme?.("light");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setTheme?.("dark");
|
|
27
|
+
}, [resolvedTheme, setTheme]);
|
|
28
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Button, {
|
|
29
|
+
variant: "secondary",
|
|
30
|
+
size: "icon",
|
|
31
|
+
className: (0, __pixpilot_shadcn.cn)("group/toggle size-8", className),
|
|
32
|
+
onClick: toggleTheme,
|
|
33
|
+
type: "button",
|
|
34
|
+
disabled,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SunIcon, { className: "hidden [html.dark_&]:block" }),
|
|
37
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.MoonIcon, { className: "hidden [html.light_&]:block" }),
|
|
38
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
39
|
+
className: "sr-only",
|
|
40
|
+
children: "Toggle theme"
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
ThemeModeToggleButton.displayName = "ThemeModeToggleButton";
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.ThemeModeToggleButton = ThemeModeToggleButton;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/theme-toggle/ThemeModeToggleButton.d.ts
|
|
4
|
+
interface ThemeModeToggleButtonProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
/** The resolved theme ("light" | "dark") */
|
|
7
|
+
resolvedTheme?: string;
|
|
8
|
+
/** Function to change the theme */
|
|
9
|
+
setTheme?: (theme: string) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Light/Dark toggle button.
|
|
14
|
+
* Pure component - toggles between light and dark.
|
|
15
|
+
*/
|
|
16
|
+
declare function ThemeModeToggleButton(props: ThemeModeToggleButtonProps): react_jsx_runtime9.JSX.Element;
|
|
17
|
+
declare namespace ThemeModeToggleButton {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ThemeModeToggleButton, ThemeModeToggleButtonProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/theme-toggle/ThemeModeToggleButton.d.ts
|
|
4
|
+
interface ThemeModeToggleButtonProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
/** The resolved theme ("light" | "dark") */
|
|
7
|
+
resolvedTheme?: string;
|
|
8
|
+
/** Function to change the theme */
|
|
9
|
+
setTheme?: (theme: string) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Light/Dark toggle button.
|
|
14
|
+
* Pure component - toggles between light and dark.
|
|
15
|
+
*/
|
|
16
|
+
declare function ThemeModeToggleButton(props: ThemeModeToggleButtonProps): react_jsx_runtime9.JSX.Element;
|
|
17
|
+
declare namespace ThemeModeToggleButton {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ThemeModeToggleButton, ThemeModeToggleButtonProps };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { Button, cn } from "@pixpilot/shadcn";
|
|
5
|
+
import { MoonIcon, SunIcon } from "lucide-react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/theme-toggle/ThemeModeToggleButton.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Light/Dark toggle button.
|
|
12
|
+
* Pure component - toggles between light and dark.
|
|
13
|
+
*/
|
|
14
|
+
function ThemeModeToggleButton(props) {
|
|
15
|
+
const { className, resolvedTheme, setTheme, disabled } = props;
|
|
16
|
+
const toggleTheme = React.useCallback(() => {
|
|
17
|
+
if (resolvedTheme === "dark") {
|
|
18
|
+
setTheme?.("light");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
setTheme?.("dark");
|
|
22
|
+
}, [resolvedTheme, setTheme]);
|
|
23
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
24
|
+
variant: "secondary",
|
|
25
|
+
size: "icon",
|
|
26
|
+
className: cn("group/toggle size-8", className),
|
|
27
|
+
onClick: toggleTheme,
|
|
28
|
+
type: "button",
|
|
29
|
+
disabled,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(SunIcon, { className: "hidden [html.dark_&]:block" }),
|
|
32
|
+
/* @__PURE__ */ jsx(MoonIcon, { className: "hidden [html.light_&]:block" }),
|
|
33
|
+
/* @__PURE__ */ jsx("span", {
|
|
34
|
+
className: "sr-only",
|
|
35
|
+
children: "Toggle theme"
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
ThemeModeToggleButton.displayName = "ThemeModeToggleButton";
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { ThemeModeToggleButton };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const require_ThemeModeDropdown = require('./ThemeModeDropdown.cjs');
|
|
2
|
+
const require_ThemeModeSwitchInside = require('./ThemeModeSwitchInside.cjs');
|
|
3
|
+
const require_ThemeModeSwitchOutside = require('./ThemeModeSwitchOutside.cjs');
|
|
4
|
+
const require_ThemeModeToggleButton = require('./ThemeModeToggleButton.cjs');
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ThemeModeDropdown, ThemeModeDropdownProps } from "./ThemeModeDropdown.cjs";
|
|
2
|
+
import { ThemeModeSwitchInside, ThemeModeSwitchInsideProps, ThemeModeSwitchInsideSize } from "./ThemeModeSwitchInside.cjs";
|
|
3
|
+
import { ThemeModeSwitchOutside, ThemeModeSwitchOutsideProps } from "./ThemeModeSwitchOutside.cjs";
|
|
4
|
+
import { ThemeModeToggleButton, ThemeModeToggleButtonProps } from "./ThemeModeToggleButton.cjs";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ThemeModeDropdown, ThemeModeDropdownProps } from "./ThemeModeDropdown.js";
|
|
2
|
+
import { ThemeModeSwitchInside, ThemeModeSwitchInsideProps, ThemeModeSwitchInsideSize } from "./ThemeModeSwitchInside.js";
|
|
3
|
+
import { ThemeModeSwitchOutside, ThemeModeSwitchOutsideProps } from "./ThemeModeSwitchOutside.js";
|
|
4
|
+
import { ThemeModeToggleButton, ThemeModeToggleButtonProps } from "./ThemeModeToggleButton.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/shadcn-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.28.0",
|
|
5
5
|
"description": "Custom UI components and utilities built with shadcn/ui.",
|
|
6
6
|
"author": "m.doaie <m.doaie@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@internal/eslint-config": "0.3.0",
|
|
61
61
|
"@internal/hooks": "0.0.0",
|
|
62
62
|
"@internal/prettier-config": "0.0.1",
|
|
63
|
-
"@internal/tsdown-config": "0.1.0",
|
|
64
63
|
"@internal/tsconfig": "0.1.0",
|
|
64
|
+
"@internal/tsdown-config": "0.1.0",
|
|
65
65
|
"@internal/vitest-config": "0.1.0"
|
|
66
66
|
},
|
|
67
67
|
"prettier": "@internal/prettier-config",
|
package/dist/ThemeToggle.cjs
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
-
let react = require("react");
|
|
6
|
-
react = require_rolldown_runtime.__toESM(react);
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
9
|
-
let next_themes = require("next-themes");
|
|
10
|
-
next_themes = require_rolldown_runtime.__toESM(next_themes);
|
|
11
|
-
|
|
12
|
-
//#region src/ThemeToggle.tsx
|
|
13
|
-
function SunIcon() {
|
|
14
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
15
|
-
className: "h-5 w-5",
|
|
16
|
-
fill: "none",
|
|
17
|
-
stroke: "currentColor",
|
|
18
|
-
viewBox: "0 0 24 24",
|
|
19
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
21
|
-
strokeLinecap: "round",
|
|
22
|
-
strokeLinejoin: "round",
|
|
23
|
-
strokeWidth: 2,
|
|
24
|
-
d: "M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function MoonIcon() {
|
|
29
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
30
|
-
className: "h-5 w-5",
|
|
31
|
-
fill: "none",
|
|
32
|
-
stroke: "currentColor",
|
|
33
|
-
viewBox: "0 0 24 24",
|
|
34
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
36
|
-
strokeLinecap: "round",
|
|
37
|
-
strokeLinejoin: "round",
|
|
38
|
-
strokeWidth: 2,
|
|
39
|
-
d: "M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function SystemIcon() {
|
|
44
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
45
|
-
className: "h-5 w-5",
|
|
46
|
-
fill: "none",
|
|
47
|
-
stroke: "currentColor",
|
|
48
|
-
viewBox: "0 0 24 24",
|
|
49
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
50
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
51
|
-
strokeLinecap: "round",
|
|
52
|
-
strokeLinejoin: "round",
|
|
53
|
-
strokeWidth: 2,
|
|
54
|
-
d: "M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
|
|
55
|
-
})
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function ThemeToggle() {
|
|
59
|
-
const [mounted, setMounted] = (0, react.useState)(false);
|
|
60
|
-
const { theme, setTheme } = (0, next_themes.useTheme)();
|
|
61
|
-
(0, react.useEffect)(() => {
|
|
62
|
-
const timer = setTimeout(() => {
|
|
63
|
-
setMounted(true);
|
|
64
|
-
}, 0);
|
|
65
|
-
return () => {
|
|
66
|
-
clearTimeout(timer);
|
|
67
|
-
};
|
|
68
|
-
}, []);
|
|
69
|
-
if (!mounted) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
70
|
-
className: "flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 dark:border-gray-700",
|
|
71
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "h-5 w-5 animate-pulse rounded bg-gray-300 dark:bg-gray-600" })
|
|
72
|
-
});
|
|
73
|
-
const toggleTheme = () => {
|
|
74
|
-
if (theme === "light") setTheme("dark");
|
|
75
|
-
else if (theme === "dark") setTheme("system");
|
|
76
|
-
else setTheme("light");
|
|
77
|
-
};
|
|
78
|
-
const getIcon = () => {
|
|
79
|
-
if (theme === "light") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MoonIcon, {});
|
|
80
|
-
if (theme === "dark") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SystemIcon, {});
|
|
81
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SunIcon, {});
|
|
82
|
-
};
|
|
83
|
-
const getTitle = () => {
|
|
84
|
-
if (theme === "light") return "Switch to Dark mode";
|
|
85
|
-
if (theme === "dark") return "Switch to System mode";
|
|
86
|
-
return "Switch to Light mode";
|
|
87
|
-
};
|
|
88
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
89
|
-
onClick: toggleTheme,
|
|
90
|
-
className: "flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 bg-white text-gray-900 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-gray-800",
|
|
91
|
-
title: getTitle(),
|
|
92
|
-
type: "button",
|
|
93
|
-
children: getIcon()
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
//#endregion
|
|
98
|
-
exports.ThemeToggle = ThemeToggle;
|
package/dist/ThemeToggle.d.cts
DELETED
package/dist/ThemeToggle.d.ts
DELETED
package/dist/ThemeToggle.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import React, { useEffect, useState } from "react";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { useTheme } from "next-themes";
|
|
7
|
-
|
|
8
|
-
//#region src/ThemeToggle.tsx
|
|
9
|
-
function SunIcon() {
|
|
10
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
11
|
-
className: "h-5 w-5",
|
|
12
|
-
fill: "none",
|
|
13
|
-
stroke: "currentColor",
|
|
14
|
-
viewBox: "0 0 24 24",
|
|
15
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
17
|
-
strokeLinecap: "round",
|
|
18
|
-
strokeLinejoin: "round",
|
|
19
|
-
strokeWidth: 2,
|
|
20
|
-
d: "M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function MoonIcon() {
|
|
25
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
26
|
-
className: "h-5 w-5",
|
|
27
|
-
fill: "none",
|
|
28
|
-
stroke: "currentColor",
|
|
29
|
-
viewBox: "0 0 24 24",
|
|
30
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
32
|
-
strokeLinecap: "round",
|
|
33
|
-
strokeLinejoin: "round",
|
|
34
|
-
strokeWidth: 2,
|
|
35
|
-
d: "M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
|
|
36
|
-
})
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function SystemIcon() {
|
|
40
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
41
|
-
className: "h-5 w-5",
|
|
42
|
-
fill: "none",
|
|
43
|
-
stroke: "currentColor",
|
|
44
|
-
viewBox: "0 0 24 24",
|
|
45
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
46
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
47
|
-
strokeLinecap: "round",
|
|
48
|
-
strokeLinejoin: "round",
|
|
49
|
-
strokeWidth: 2,
|
|
50
|
-
d: "M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
|
|
51
|
-
})
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function ThemeToggle() {
|
|
55
|
-
const [mounted, setMounted] = useState(false);
|
|
56
|
-
const { theme, setTheme } = useTheme();
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
const timer = setTimeout(() => {
|
|
59
|
-
setMounted(true);
|
|
60
|
-
}, 0);
|
|
61
|
-
return () => {
|
|
62
|
-
clearTimeout(timer);
|
|
63
|
-
};
|
|
64
|
-
}, []);
|
|
65
|
-
if (!mounted) return /* @__PURE__ */ jsx("div", {
|
|
66
|
-
className: "flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 dark:border-gray-700",
|
|
67
|
-
children: /* @__PURE__ */ jsx("div", { className: "h-5 w-5 animate-pulse rounded bg-gray-300 dark:bg-gray-600" })
|
|
68
|
-
});
|
|
69
|
-
const toggleTheme = () => {
|
|
70
|
-
if (theme === "light") setTheme("dark");
|
|
71
|
-
else if (theme === "dark") setTheme("system");
|
|
72
|
-
else setTheme("light");
|
|
73
|
-
};
|
|
74
|
-
const getIcon = () => {
|
|
75
|
-
if (theme === "light") return /* @__PURE__ */ jsx(MoonIcon, {});
|
|
76
|
-
if (theme === "dark") return /* @__PURE__ */ jsx(SystemIcon, {});
|
|
77
|
-
return /* @__PURE__ */ jsx(SunIcon, {});
|
|
78
|
-
};
|
|
79
|
-
const getTitle = () => {
|
|
80
|
-
if (theme === "light") return "Switch to Dark mode";
|
|
81
|
-
if (theme === "dark") return "Switch to System mode";
|
|
82
|
-
return "Switch to Light mode";
|
|
83
|
-
};
|
|
84
|
-
return /* @__PURE__ */ jsx("button", {
|
|
85
|
-
onClick: toggleTheme,
|
|
86
|
-
className: "flex h-9 w-9 items-center justify-center rounded-md border border-gray-200 bg-white text-gray-900 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-gray-800",
|
|
87
|
-
title: getTitle(),
|
|
88
|
-
type: "button",
|
|
89
|
-
children: getIcon()
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
//#endregion
|
|
94
|
-
export { ThemeToggle };
|