@juv/codego-react-ui 1.1.1 → 1.1.3
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.cjs +79 -27
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.global.js +76 -27
- package/dist/index.js +76 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
Badge: () => Badge,
|
|
35
35
|
Breadcrumb: () => Breadcrumb,
|
|
36
36
|
Button: () => Button,
|
|
37
|
+
COLOR_PALETTE: () => COLOR_PALETTE,
|
|
37
38
|
Calendar: () => Calendar,
|
|
38
39
|
Card: () => Card,
|
|
39
40
|
CardContent: () => CardContent,
|
|
@@ -103,6 +104,7 @@ __export(index_exports, {
|
|
|
103
104
|
Tabs: () => Tabs,
|
|
104
105
|
TagInput: () => TagInput,
|
|
105
106
|
Textarea: () => Textarea,
|
|
107
|
+
ThemeProvider: () => ThemeProvider,
|
|
106
108
|
Timeline: () => Timeline,
|
|
107
109
|
ToastProvider: () => ToastProvider,
|
|
108
110
|
ToggleSwitch: () => ToggleSwitch,
|
|
@@ -111,6 +113,7 @@ __export(index_exports, {
|
|
|
111
113
|
TreeView: () => TreeView,
|
|
112
114
|
Widget: () => Widget,
|
|
113
115
|
Wizard: () => Wizard,
|
|
116
|
+
useTheme: () => useTheme,
|
|
114
117
|
useToast: () => useToast
|
|
115
118
|
});
|
|
116
119
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1656,12 +1659,12 @@ function DonutChart({ data, color, height, showValues, unit }) {
|
|
|
1656
1659
|
const total = data.reduce((s, d) => s + d.value, 0) || 1;
|
|
1657
1660
|
const cx = 80, cy = height / 2, r = Math.min(cx, cy) - 10, inner = r * 0.58;
|
|
1658
1661
|
let angle = -Math.PI / 2;
|
|
1659
|
-
const
|
|
1662
|
+
const defaultColors = ["primary", "info", "success", "warning", "danger"];
|
|
1660
1663
|
const slices = data.map((d, i) => {
|
|
1661
1664
|
const sweep = d.value / total * 2 * Math.PI;
|
|
1662
1665
|
const start = angle;
|
|
1663
1666
|
angle += sweep;
|
|
1664
|
-
const c = d.color ??
|
|
1667
|
+
const c = d.color ?? defaultColors[i % defaultColors.length];
|
|
1665
1668
|
return { ...d, start, sweep, color: c };
|
|
1666
1669
|
});
|
|
1667
1670
|
const arc = (cx2, cy2, r2, start, end) => {
|
|
@@ -5247,24 +5250,36 @@ function Tooltip({
|
|
|
5247
5250
|
|
|
5248
5251
|
// src/components/theme-provider.tsx
|
|
5249
5252
|
var import_react = require("react");
|
|
5253
|
+
|
|
5254
|
+
// src/components/conf/settingConfig.json
|
|
5255
|
+
var settingConfig_default = {
|
|
5256
|
+
theme: "dark",
|
|
5257
|
+
fontSize: "16px",
|
|
5258
|
+
fontFamily: '"Space Grotesk", "Inter", sans-serif',
|
|
5259
|
+
colors: {
|
|
5260
|
+
primary: "#8b5cf6",
|
|
5261
|
+
primaryHover: "#7c3aed",
|
|
5262
|
+
secondary: "#171717",
|
|
5263
|
+
secondaryHover: "#262626",
|
|
5264
|
+
info: "#3b82f6",
|
|
5265
|
+
infoHover: "#2563eb",
|
|
5266
|
+
warning: "#f59e0b",
|
|
5267
|
+
warningHover: "#d97706",
|
|
5268
|
+
danger: "#ef4444",
|
|
5269
|
+
dangerHover: "#dc2626"
|
|
5270
|
+
}
|
|
5271
|
+
};
|
|
5272
|
+
|
|
5273
|
+
// src/components/theme-provider.tsx
|
|
5250
5274
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5251
|
-
var
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
info: "#3b82f6",
|
|
5257
|
-
infoHover: "#2563eb",
|
|
5258
|
-
warning: "#f59e0b",
|
|
5259
|
-
warningHover: "#d97706",
|
|
5260
|
-
danger: "#ef4444",
|
|
5261
|
-
dangerHover: "#dc2626"
|
|
5275
|
+
var configDefaults = {
|
|
5276
|
+
theme: settingConfig_default.theme,
|
|
5277
|
+
fontSize: settingConfig_default.fontSize,
|
|
5278
|
+
fontFamily: settingConfig_default.fontFamily,
|
|
5279
|
+
colors: settingConfig_default.colors
|
|
5262
5280
|
};
|
|
5263
5281
|
var initialState = {
|
|
5264
|
-
|
|
5265
|
-
colors: defaultColors,
|
|
5266
|
-
fontSize: "16px",
|
|
5267
|
-
fontFamily: '"Space Grotesk", "Inter", sans-serif',
|
|
5282
|
+
...configDefaults,
|
|
5268
5283
|
setTheme: () => null,
|
|
5269
5284
|
setColors: () => null,
|
|
5270
5285
|
setFontSize: () => null,
|
|
@@ -5274,26 +5289,60 @@ var initialState = {
|
|
|
5274
5289
|
var ThemeProviderContext = (0, import_react.createContext)(initialState);
|
|
5275
5290
|
var COLOR_PALETTE = [
|
|
5276
5291
|
{ base: "#6366f1", hover: "#4f46e5" },
|
|
5277
|
-
// Indigo
|
|
5278
5292
|
{ base: "#8b5cf6", hover: "#7c3aed" },
|
|
5279
|
-
// Violet
|
|
5280
5293
|
{ base: "#3b82f6", hover: "#2563eb" },
|
|
5281
|
-
// Blue
|
|
5282
5294
|
{ base: "#10b981", hover: "#059669" },
|
|
5283
|
-
// Emerald
|
|
5284
5295
|
{ base: "#22c55e", hover: "#16a34a" },
|
|
5285
|
-
// Green
|
|
5286
5296
|
{ base: "#eab308", hover: "#ca8a04" },
|
|
5287
|
-
// Yellow
|
|
5288
5297
|
{ base: "#f59e0b", hover: "#d97706" },
|
|
5289
|
-
// Amber
|
|
5290
5298
|
{ base: "#f97316", hover: "#ea580c" },
|
|
5291
|
-
// Orange
|
|
5292
5299
|
{ base: "#ef4444", hover: "#dc2626" },
|
|
5293
|
-
// Red
|
|
5294
5300
|
{ base: "#ec4899", hover: "#db2777" }
|
|
5295
|
-
// Pink
|
|
5296
5301
|
];
|
|
5302
|
+
function ThemeProvider({
|
|
5303
|
+
children,
|
|
5304
|
+
storageKey = "codego-ui-theme-settings",
|
|
5305
|
+
...props
|
|
5306
|
+
}) {
|
|
5307
|
+
const [settings, setSettings] = (0, import_react.useState)(() => {
|
|
5308
|
+
try {
|
|
5309
|
+
const stored = localStorage.getItem(storageKey);
|
|
5310
|
+
if (stored) return { ...configDefaults, ...JSON.parse(stored) };
|
|
5311
|
+
} catch {
|
|
5312
|
+
}
|
|
5313
|
+
return configDefaults;
|
|
5314
|
+
});
|
|
5315
|
+
(0, import_react.useEffect)(() => {
|
|
5316
|
+
localStorage.setItem(storageKey, JSON.stringify(settings));
|
|
5317
|
+
}, [settings, storageKey]);
|
|
5318
|
+
(0, import_react.useEffect)(() => {
|
|
5319
|
+
const root = window.document.documentElement;
|
|
5320
|
+
root.classList.remove("light", "dark");
|
|
5321
|
+
const resolved = settings.theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : settings.theme;
|
|
5322
|
+
root.classList.add(resolved);
|
|
5323
|
+
root.style.setProperty("--primary", settings.colors.primary);
|
|
5324
|
+
root.style.setProperty("--primary-hover", settings.colors.primaryHover);
|
|
5325
|
+
root.style.setProperty("--secondary", settings.colors.secondary);
|
|
5326
|
+
root.style.setProperty("--secondary-hover", settings.colors.secondaryHover);
|
|
5327
|
+
root.style.setProperty("--info", settings.colors.info);
|
|
5328
|
+
root.style.setProperty("--info-hover", settings.colors.infoHover);
|
|
5329
|
+
root.style.setProperty("--warning", settings.colors.warning);
|
|
5330
|
+
root.style.setProperty("--warning-hover", settings.colors.warningHover);
|
|
5331
|
+
root.style.setProperty("--danger", settings.colors.danger);
|
|
5332
|
+
root.style.setProperty("--danger-hover", settings.colors.dangerHover);
|
|
5333
|
+
root.style.setProperty("font-size", settings.fontSize);
|
|
5334
|
+
root.style.setProperty("--font-sans", settings.fontFamily);
|
|
5335
|
+
}, [settings]);
|
|
5336
|
+
const value = {
|
|
5337
|
+
...settings,
|
|
5338
|
+
setTheme: (theme) => setSettings((s) => ({ ...s, theme })),
|
|
5339
|
+
setColors: (colors) => setSettings((s) => ({ ...s, colors: { ...s.colors, ...colors } })),
|
|
5340
|
+
setFontSize: (fontSize) => setSettings((s) => ({ ...s, fontSize })),
|
|
5341
|
+
setFontFamily: (fontFamily) => setSettings((s) => ({ ...s, fontFamily })),
|
|
5342
|
+
resetSettings: () => setSettings(configDefaults)
|
|
5343
|
+
};
|
|
5344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ThemeProviderContext.Provider, { ...props, value, children });
|
|
5345
|
+
}
|
|
5297
5346
|
var useTheme = () => {
|
|
5298
5347
|
const context = (0, import_react.useContext)(ThemeProviderContext);
|
|
5299
5348
|
if (context === void 0)
|
|
@@ -7956,6 +8005,7 @@ function Wizard({
|
|
|
7956
8005
|
Badge,
|
|
7957
8006
|
Breadcrumb,
|
|
7958
8007
|
Button,
|
|
8008
|
+
COLOR_PALETTE,
|
|
7959
8009
|
Calendar,
|
|
7960
8010
|
Card,
|
|
7961
8011
|
CardContent,
|
|
@@ -8025,6 +8075,7 @@ function Wizard({
|
|
|
8025
8075
|
Tabs,
|
|
8026
8076
|
TagInput,
|
|
8027
8077
|
Textarea,
|
|
8078
|
+
ThemeProvider,
|
|
8028
8079
|
Timeline,
|
|
8029
8080
|
ToastProvider,
|
|
8030
8081
|
ToggleSwitch,
|
|
@@ -8033,5 +8084,6 @@ function Wizard({
|
|
|
8033
8084
|
TreeView,
|
|
8034
8085
|
Widget,
|
|
8035
8086
|
Wizard,
|
|
8087
|
+
useTheme,
|
|
8036
8088
|
useToast
|
|
8037
8089
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
3
4
|
|
|
4
5
|
type AccordionVariant = "default" | "bordered" | "separated" | "ghost";
|
|
5
6
|
interface AccordionItem {
|
|
@@ -1033,6 +1034,7 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChan
|
|
|
1033
1034
|
}
|
|
1034
1035
|
declare function Select({ options, value, onChange, placeholder, searchable, native, label, loadingMessage, noSearchResultsMessage, searchingMessage, multiple, reorderable, disabled, createOptionForm, suffixIcon, suffixIconColor, className, ...props }: SelectProps): react_jsx_runtime.JSX.Element;
|
|
1035
1036
|
|
|
1037
|
+
type Theme = 'dark' | 'light' | 'system';
|
|
1036
1038
|
type ThemeColors = {
|
|
1037
1039
|
primary: string;
|
|
1038
1040
|
primaryHover: string;
|
|
@@ -1045,6 +1047,29 @@ type ThemeColors = {
|
|
|
1045
1047
|
danger: string;
|
|
1046
1048
|
dangerHover: string;
|
|
1047
1049
|
};
|
|
1050
|
+
type ThemeSettings = {
|
|
1051
|
+
theme: Theme;
|
|
1052
|
+
colors: ThemeColors;
|
|
1053
|
+
fontSize: string;
|
|
1054
|
+
fontFamily: string;
|
|
1055
|
+
};
|
|
1056
|
+
type ThemeProviderProps = {
|
|
1057
|
+
children: React__default.ReactNode;
|
|
1058
|
+
storageKey?: string;
|
|
1059
|
+
};
|
|
1060
|
+
type ThemeProviderState = ThemeSettings & {
|
|
1061
|
+
setTheme: (theme: Theme) => void;
|
|
1062
|
+
setColors: (colors: Partial<ThemeColors>) => void;
|
|
1063
|
+
setFontSize: (size: string) => void;
|
|
1064
|
+
setFontFamily: (family: string) => void;
|
|
1065
|
+
resetSettings: () => void;
|
|
1066
|
+
};
|
|
1067
|
+
declare const COLOR_PALETTE: {
|
|
1068
|
+
base: string;
|
|
1069
|
+
hover: string;
|
|
1070
|
+
}[];
|
|
1071
|
+
declare function ThemeProvider({ children, storageKey, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
1072
|
+
declare const useTheme: () => ThemeProviderState;
|
|
1048
1073
|
|
|
1049
1074
|
type PanelSettingsTab = "appearance" | "colors" | "typography";
|
|
1050
1075
|
interface PanelSettingsProps {
|
|
@@ -1384,4 +1409,4 @@ interface WizardProps {
|
|
|
1384
1409
|
}
|
|
1385
1410
|
declare function Wizard({ steps, step: controlledStep, defaultStep, onStepChange, onFinish, onClose, layout, variant, size, isOpen, showClose, unchange, title, description, hideHeader, footer, renderActions, backLabel, nextLabel, finishLabel, cancelLabel, showCancel, showBackOnFirst, loading, clickableSteps, className, contentClassName, }: WizardProps): react_jsx_runtime.JSX.Element;
|
|
1386
1411
|
|
|
1387
|
-
export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarEvent, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FormField, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeftSidebar, type LeftSidebarProps, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, ScrollArea, type ScrollAreaProps, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, useToast };
|
|
1412
|
+
export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, COLOR_PALETTE, Calendar, type CalendarEvent, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FormField, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeftSidebar, type LeftSidebarProps, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, ScrollArea, type ScrollAreaProps, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, useTheme, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
3
4
|
|
|
4
5
|
type AccordionVariant = "default" | "bordered" | "separated" | "ghost";
|
|
5
6
|
interface AccordionItem {
|
|
@@ -1033,6 +1034,7 @@ interface SelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChan
|
|
|
1033
1034
|
}
|
|
1034
1035
|
declare function Select({ options, value, onChange, placeholder, searchable, native, label, loadingMessage, noSearchResultsMessage, searchingMessage, multiple, reorderable, disabled, createOptionForm, suffixIcon, suffixIconColor, className, ...props }: SelectProps): react_jsx_runtime.JSX.Element;
|
|
1035
1036
|
|
|
1037
|
+
type Theme = 'dark' | 'light' | 'system';
|
|
1036
1038
|
type ThemeColors = {
|
|
1037
1039
|
primary: string;
|
|
1038
1040
|
primaryHover: string;
|
|
@@ -1045,6 +1047,29 @@ type ThemeColors = {
|
|
|
1045
1047
|
danger: string;
|
|
1046
1048
|
dangerHover: string;
|
|
1047
1049
|
};
|
|
1050
|
+
type ThemeSettings = {
|
|
1051
|
+
theme: Theme;
|
|
1052
|
+
colors: ThemeColors;
|
|
1053
|
+
fontSize: string;
|
|
1054
|
+
fontFamily: string;
|
|
1055
|
+
};
|
|
1056
|
+
type ThemeProviderProps = {
|
|
1057
|
+
children: React__default.ReactNode;
|
|
1058
|
+
storageKey?: string;
|
|
1059
|
+
};
|
|
1060
|
+
type ThemeProviderState = ThemeSettings & {
|
|
1061
|
+
setTheme: (theme: Theme) => void;
|
|
1062
|
+
setColors: (colors: Partial<ThemeColors>) => void;
|
|
1063
|
+
setFontSize: (size: string) => void;
|
|
1064
|
+
setFontFamily: (family: string) => void;
|
|
1065
|
+
resetSettings: () => void;
|
|
1066
|
+
};
|
|
1067
|
+
declare const COLOR_PALETTE: {
|
|
1068
|
+
base: string;
|
|
1069
|
+
hover: string;
|
|
1070
|
+
}[];
|
|
1071
|
+
declare function ThemeProvider({ children, storageKey, ...props }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
1072
|
+
declare const useTheme: () => ThemeProviderState;
|
|
1048
1073
|
|
|
1049
1074
|
type PanelSettingsTab = "appearance" | "colors" | "typography";
|
|
1050
1075
|
interface PanelSettingsProps {
|
|
@@ -1384,4 +1409,4 @@ interface WizardProps {
|
|
|
1384
1409
|
}
|
|
1385
1410
|
declare function Wizard({ steps, step: controlledStep, defaultStep, onStepChange, onFinish, onClose, layout, variant, size, isOpen, showClose, unchange, title, description, hideHeader, footer, renderActions, backLabel, nextLabel, finishLabel, cancelLabel, showCancel, showBackOnFirst, loading, clickableSteps, className, contentClassName, }: WizardProps): react_jsx_runtime.JSX.Element;
|
|
1386
1411
|
|
|
1387
|
-
export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarEvent, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FormField, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeftSidebar, type LeftSidebarProps, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, ScrollArea, type ScrollAreaProps, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, useToast };
|
|
1412
|
+
export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, COLOR_PALETTE, Calendar, type CalendarEvent, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FormField, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeftSidebar, type LeftSidebarProps, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, ScrollArea, type ScrollAreaProps, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, useTheme, useToast };
|
package/dist/index.global.js
CHANGED
|
@@ -2181,6 +2181,7 @@ var CodegoUI = (() => {
|
|
|
2181
2181
|
Badge: () => Badge,
|
|
2182
2182
|
Breadcrumb: () => Breadcrumb,
|
|
2183
2183
|
Button: () => Button,
|
|
2184
|
+
COLOR_PALETTE: () => COLOR_PALETTE,
|
|
2184
2185
|
Calendar: () => Calendar,
|
|
2185
2186
|
Card: () => Card,
|
|
2186
2187
|
CardContent: () => CardContent,
|
|
@@ -2250,6 +2251,7 @@ var CodegoUI = (() => {
|
|
|
2250
2251
|
Tabs: () => Tabs,
|
|
2251
2252
|
TagInput: () => TagInput,
|
|
2252
2253
|
Textarea: () => Textarea,
|
|
2254
|
+
ThemeProvider: () => ThemeProvider,
|
|
2253
2255
|
Timeline: () => Timeline,
|
|
2254
2256
|
ToastProvider: () => ToastProvider,
|
|
2255
2257
|
ToggleSwitch: () => ToggleSwitch,
|
|
@@ -2258,6 +2260,7 @@ var CodegoUI = (() => {
|
|
|
2258
2260
|
TreeView: () => TreeView,
|
|
2259
2261
|
Widget: () => Widget,
|
|
2260
2262
|
Wizard: () => Wizard,
|
|
2263
|
+
useTheme: () => useTheme,
|
|
2261
2264
|
useToast: () => useToast
|
|
2262
2265
|
});
|
|
2263
2266
|
|
|
@@ -7560,12 +7563,12 @@ var CodegoUI = (() => {
|
|
|
7560
7563
|
const total = data.reduce((s, d) => s + d.value, 0) || 1;
|
|
7561
7564
|
const cx = 80, cy = height / 2, r2 = Math.min(cx, cy) - 10, inner = r2 * 0.58;
|
|
7562
7565
|
let angle = -Math.PI / 2;
|
|
7563
|
-
const
|
|
7566
|
+
const defaultColors = ["primary", "info", "success", "warning", "danger"];
|
|
7564
7567
|
const slices = data.map((d, i) => {
|
|
7565
7568
|
const sweep = d.value / total * 2 * Math.PI;
|
|
7566
7569
|
const start = angle;
|
|
7567
7570
|
angle += sweep;
|
|
7568
|
-
const c = d.color ??
|
|
7571
|
+
const c = d.color ?? defaultColors[i % defaultColors.length];
|
|
7569
7572
|
return { ...d, start, sweep, color: c };
|
|
7570
7573
|
});
|
|
7571
7574
|
const arc = (cx2, cy2, r3, start, end) => {
|
|
@@ -12995,24 +12998,36 @@ var CodegoUI = (() => {
|
|
|
12995
12998
|
|
|
12996
12999
|
// src/components/theme-provider.tsx
|
|
12997
13000
|
var import_react3 = __toESM(require_react(), 1);
|
|
13001
|
+
|
|
13002
|
+
// src/components/conf/settingConfig.json
|
|
13003
|
+
var settingConfig_default = {
|
|
13004
|
+
theme: "dark",
|
|
13005
|
+
fontSize: "16px",
|
|
13006
|
+
fontFamily: '"Space Grotesk", "Inter", sans-serif',
|
|
13007
|
+
colors: {
|
|
13008
|
+
primary: "#8b5cf6",
|
|
13009
|
+
primaryHover: "#7c3aed",
|
|
13010
|
+
secondary: "#171717",
|
|
13011
|
+
secondaryHover: "#262626",
|
|
13012
|
+
info: "#3b82f6",
|
|
13013
|
+
infoHover: "#2563eb",
|
|
13014
|
+
warning: "#f59e0b",
|
|
13015
|
+
warningHover: "#d97706",
|
|
13016
|
+
danger: "#ef4444",
|
|
13017
|
+
dangerHover: "#dc2626"
|
|
13018
|
+
}
|
|
13019
|
+
};
|
|
13020
|
+
|
|
13021
|
+
// src/components/theme-provider.tsx
|
|
12998
13022
|
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
|
|
12999
|
-
var
|
|
13000
|
-
|
|
13001
|
-
|
|
13002
|
-
|
|
13003
|
-
|
|
13004
|
-
info: "#3b82f6",
|
|
13005
|
-
infoHover: "#2563eb",
|
|
13006
|
-
warning: "#f59e0b",
|
|
13007
|
-
warningHover: "#d97706",
|
|
13008
|
-
danger: "#ef4444",
|
|
13009
|
-
dangerHover: "#dc2626"
|
|
13023
|
+
var configDefaults = {
|
|
13024
|
+
theme: settingConfig_default.theme,
|
|
13025
|
+
fontSize: settingConfig_default.fontSize,
|
|
13026
|
+
fontFamily: settingConfig_default.fontFamily,
|
|
13027
|
+
colors: settingConfig_default.colors
|
|
13010
13028
|
};
|
|
13011
13029
|
var initialState = {
|
|
13012
|
-
|
|
13013
|
-
colors: defaultColors,
|
|
13014
|
-
fontSize: "16px",
|
|
13015
|
-
fontFamily: '"Space Grotesk", "Inter", sans-serif',
|
|
13030
|
+
...configDefaults,
|
|
13016
13031
|
setTheme: () => null,
|
|
13017
13032
|
setColors: () => null,
|
|
13018
13033
|
setFontSize: () => null,
|
|
@@ -13022,26 +13037,60 @@ var CodegoUI = (() => {
|
|
|
13022
13037
|
var ThemeProviderContext = (0, import_react3.createContext)(initialState);
|
|
13023
13038
|
var COLOR_PALETTE = [
|
|
13024
13039
|
{ base: "#6366f1", hover: "#4f46e5" },
|
|
13025
|
-
// Indigo
|
|
13026
13040
|
{ base: "#8b5cf6", hover: "#7c3aed" },
|
|
13027
|
-
// Violet
|
|
13028
13041
|
{ base: "#3b82f6", hover: "#2563eb" },
|
|
13029
|
-
// Blue
|
|
13030
13042
|
{ base: "#10b981", hover: "#059669" },
|
|
13031
|
-
// Emerald
|
|
13032
13043
|
{ base: "#22c55e", hover: "#16a34a" },
|
|
13033
|
-
// Green
|
|
13034
13044
|
{ base: "#eab308", hover: "#ca8a04" },
|
|
13035
|
-
// Yellow
|
|
13036
13045
|
{ base: "#f59e0b", hover: "#d97706" },
|
|
13037
|
-
// Amber
|
|
13038
13046
|
{ base: "#f97316", hover: "#ea580c" },
|
|
13039
|
-
// Orange
|
|
13040
13047
|
{ base: "#ef4444", hover: "#dc2626" },
|
|
13041
|
-
// Red
|
|
13042
13048
|
{ base: "#ec4899", hover: "#db2777" }
|
|
13043
|
-
// Pink
|
|
13044
13049
|
];
|
|
13050
|
+
function ThemeProvider({
|
|
13051
|
+
children,
|
|
13052
|
+
storageKey = "codego-ui-theme-settings",
|
|
13053
|
+
...props
|
|
13054
|
+
}) {
|
|
13055
|
+
const [settings, setSettings] = (0, import_react3.useState)(() => {
|
|
13056
|
+
try {
|
|
13057
|
+
const stored = localStorage.getItem(storageKey);
|
|
13058
|
+
if (stored) return { ...configDefaults, ...JSON.parse(stored) };
|
|
13059
|
+
} catch {
|
|
13060
|
+
}
|
|
13061
|
+
return configDefaults;
|
|
13062
|
+
});
|
|
13063
|
+
(0, import_react3.useEffect)(() => {
|
|
13064
|
+
localStorage.setItem(storageKey, JSON.stringify(settings));
|
|
13065
|
+
}, [settings, storageKey]);
|
|
13066
|
+
(0, import_react3.useEffect)(() => {
|
|
13067
|
+
const root = window.document.documentElement;
|
|
13068
|
+
root.classList.remove("light", "dark");
|
|
13069
|
+
const resolved = settings.theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : settings.theme;
|
|
13070
|
+
root.classList.add(resolved);
|
|
13071
|
+
root.style.setProperty("--primary", settings.colors.primary);
|
|
13072
|
+
root.style.setProperty("--primary-hover", settings.colors.primaryHover);
|
|
13073
|
+
root.style.setProperty("--secondary", settings.colors.secondary);
|
|
13074
|
+
root.style.setProperty("--secondary-hover", settings.colors.secondaryHover);
|
|
13075
|
+
root.style.setProperty("--info", settings.colors.info);
|
|
13076
|
+
root.style.setProperty("--info-hover", settings.colors.infoHover);
|
|
13077
|
+
root.style.setProperty("--warning", settings.colors.warning);
|
|
13078
|
+
root.style.setProperty("--warning-hover", settings.colors.warningHover);
|
|
13079
|
+
root.style.setProperty("--danger", settings.colors.danger);
|
|
13080
|
+
root.style.setProperty("--danger-hover", settings.colors.dangerHover);
|
|
13081
|
+
root.style.setProperty("font-size", settings.fontSize);
|
|
13082
|
+
root.style.setProperty("--font-sans", settings.fontFamily);
|
|
13083
|
+
}, [settings]);
|
|
13084
|
+
const value = {
|
|
13085
|
+
...settings,
|
|
13086
|
+
setTheme: (theme) => setSettings((s) => ({ ...s, theme })),
|
|
13087
|
+
setColors: (colors) => setSettings((s) => ({ ...s, colors: { ...s.colors, ...colors } })),
|
|
13088
|
+
setFontSize: (fontSize) => setSettings((s) => ({ ...s, fontSize })),
|
|
13089
|
+
setFontFamily: (fontFamily) => setSettings((s) => ({ ...s, fontFamily })),
|
|
13090
|
+
resetSettings: () => setSettings(configDefaults)
|
|
13091
|
+
};
|
|
13092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ThemeProviderContext.Provider, { ...props, value, children });
|
|
13093
|
+
}
|
|
13045
13094
|
var useTheme = () => {
|
|
13046
13095
|
const context = (0, import_react3.useContext)(ThemeProviderContext);
|
|
13047
13096
|
if (context === void 0)
|
package/dist/index.js
CHANGED
|
@@ -1539,12 +1539,12 @@ function DonutChart({ data, color, height, showValues, unit }) {
|
|
|
1539
1539
|
const total = data.reduce((s, d) => s + d.value, 0) || 1;
|
|
1540
1540
|
const cx = 80, cy = height / 2, r = Math.min(cx, cy) - 10, inner = r * 0.58;
|
|
1541
1541
|
let angle = -Math.PI / 2;
|
|
1542
|
-
const
|
|
1542
|
+
const defaultColors = ["primary", "info", "success", "warning", "danger"];
|
|
1543
1543
|
const slices = data.map((d, i) => {
|
|
1544
1544
|
const sweep = d.value / total * 2 * Math.PI;
|
|
1545
1545
|
const start = angle;
|
|
1546
1546
|
angle += sweep;
|
|
1547
|
-
const c = d.color ??
|
|
1547
|
+
const c = d.color ?? defaultColors[i % defaultColors.length];
|
|
1548
1548
|
return { ...d, start, sweep, color: c };
|
|
1549
1549
|
});
|
|
1550
1550
|
const arc = (cx2, cy2, r2, start, end) => {
|
|
@@ -5147,24 +5147,36 @@ function Tooltip({
|
|
|
5147
5147
|
|
|
5148
5148
|
// src/components/theme-provider.tsx
|
|
5149
5149
|
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect18, useState as useState23 } from "react";
|
|
5150
|
+
|
|
5151
|
+
// src/components/conf/settingConfig.json
|
|
5152
|
+
var settingConfig_default = {
|
|
5153
|
+
theme: "dark",
|
|
5154
|
+
fontSize: "16px",
|
|
5155
|
+
fontFamily: '"Space Grotesk", "Inter", sans-serif',
|
|
5156
|
+
colors: {
|
|
5157
|
+
primary: "#8b5cf6",
|
|
5158
|
+
primaryHover: "#7c3aed",
|
|
5159
|
+
secondary: "#171717",
|
|
5160
|
+
secondaryHover: "#262626",
|
|
5161
|
+
info: "#3b82f6",
|
|
5162
|
+
infoHover: "#2563eb",
|
|
5163
|
+
warning: "#f59e0b",
|
|
5164
|
+
warningHover: "#d97706",
|
|
5165
|
+
danger: "#ef4444",
|
|
5166
|
+
dangerHover: "#dc2626"
|
|
5167
|
+
}
|
|
5168
|
+
};
|
|
5169
|
+
|
|
5170
|
+
// src/components/theme-provider.tsx
|
|
5150
5171
|
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5151
|
-
var
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
info: "#3b82f6",
|
|
5157
|
-
infoHover: "#2563eb",
|
|
5158
|
-
warning: "#f59e0b",
|
|
5159
|
-
warningHover: "#d97706",
|
|
5160
|
-
danger: "#ef4444",
|
|
5161
|
-
dangerHover: "#dc2626"
|
|
5172
|
+
var configDefaults = {
|
|
5173
|
+
theme: settingConfig_default.theme,
|
|
5174
|
+
fontSize: settingConfig_default.fontSize,
|
|
5175
|
+
fontFamily: settingConfig_default.fontFamily,
|
|
5176
|
+
colors: settingConfig_default.colors
|
|
5162
5177
|
};
|
|
5163
5178
|
var initialState = {
|
|
5164
|
-
|
|
5165
|
-
colors: defaultColors,
|
|
5166
|
-
fontSize: "16px",
|
|
5167
|
-
fontFamily: '"Space Grotesk", "Inter", sans-serif',
|
|
5179
|
+
...configDefaults,
|
|
5168
5180
|
setTheme: () => null,
|
|
5169
5181
|
setColors: () => null,
|
|
5170
5182
|
setFontSize: () => null,
|
|
@@ -5174,26 +5186,60 @@ var initialState = {
|
|
|
5174
5186
|
var ThemeProviderContext = createContext2(initialState);
|
|
5175
5187
|
var COLOR_PALETTE = [
|
|
5176
5188
|
{ base: "#6366f1", hover: "#4f46e5" },
|
|
5177
|
-
// Indigo
|
|
5178
5189
|
{ base: "#8b5cf6", hover: "#7c3aed" },
|
|
5179
|
-
// Violet
|
|
5180
5190
|
{ base: "#3b82f6", hover: "#2563eb" },
|
|
5181
|
-
// Blue
|
|
5182
5191
|
{ base: "#10b981", hover: "#059669" },
|
|
5183
|
-
// Emerald
|
|
5184
5192
|
{ base: "#22c55e", hover: "#16a34a" },
|
|
5185
|
-
// Green
|
|
5186
5193
|
{ base: "#eab308", hover: "#ca8a04" },
|
|
5187
|
-
// Yellow
|
|
5188
5194
|
{ base: "#f59e0b", hover: "#d97706" },
|
|
5189
|
-
// Amber
|
|
5190
5195
|
{ base: "#f97316", hover: "#ea580c" },
|
|
5191
|
-
// Orange
|
|
5192
5196
|
{ base: "#ef4444", hover: "#dc2626" },
|
|
5193
|
-
// Red
|
|
5194
5197
|
{ base: "#ec4899", hover: "#db2777" }
|
|
5195
|
-
// Pink
|
|
5196
5198
|
];
|
|
5199
|
+
function ThemeProvider({
|
|
5200
|
+
children,
|
|
5201
|
+
storageKey = "codego-ui-theme-settings",
|
|
5202
|
+
...props
|
|
5203
|
+
}) {
|
|
5204
|
+
const [settings, setSettings] = useState23(() => {
|
|
5205
|
+
try {
|
|
5206
|
+
const stored = localStorage.getItem(storageKey);
|
|
5207
|
+
if (stored) return { ...configDefaults, ...JSON.parse(stored) };
|
|
5208
|
+
} catch {
|
|
5209
|
+
}
|
|
5210
|
+
return configDefaults;
|
|
5211
|
+
});
|
|
5212
|
+
useEffect18(() => {
|
|
5213
|
+
localStorage.setItem(storageKey, JSON.stringify(settings));
|
|
5214
|
+
}, [settings, storageKey]);
|
|
5215
|
+
useEffect18(() => {
|
|
5216
|
+
const root = window.document.documentElement;
|
|
5217
|
+
root.classList.remove("light", "dark");
|
|
5218
|
+
const resolved = settings.theme === "system" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : settings.theme;
|
|
5219
|
+
root.classList.add(resolved);
|
|
5220
|
+
root.style.setProperty("--primary", settings.colors.primary);
|
|
5221
|
+
root.style.setProperty("--primary-hover", settings.colors.primaryHover);
|
|
5222
|
+
root.style.setProperty("--secondary", settings.colors.secondary);
|
|
5223
|
+
root.style.setProperty("--secondary-hover", settings.colors.secondaryHover);
|
|
5224
|
+
root.style.setProperty("--info", settings.colors.info);
|
|
5225
|
+
root.style.setProperty("--info-hover", settings.colors.infoHover);
|
|
5226
|
+
root.style.setProperty("--warning", settings.colors.warning);
|
|
5227
|
+
root.style.setProperty("--warning-hover", settings.colors.warningHover);
|
|
5228
|
+
root.style.setProperty("--danger", settings.colors.danger);
|
|
5229
|
+
root.style.setProperty("--danger-hover", settings.colors.dangerHover);
|
|
5230
|
+
root.style.setProperty("font-size", settings.fontSize);
|
|
5231
|
+
root.style.setProperty("--font-sans", settings.fontFamily);
|
|
5232
|
+
}, [settings]);
|
|
5233
|
+
const value = {
|
|
5234
|
+
...settings,
|
|
5235
|
+
setTheme: (theme) => setSettings((s) => ({ ...s, theme })),
|
|
5236
|
+
setColors: (colors) => setSettings((s) => ({ ...s, colors: { ...s.colors, ...colors } })),
|
|
5237
|
+
setFontSize: (fontSize) => setSettings((s) => ({ ...s, fontSize })),
|
|
5238
|
+
setFontFamily: (fontFamily) => setSettings((s) => ({ ...s, fontFamily })),
|
|
5239
|
+
resetSettings: () => setSettings(configDefaults)
|
|
5240
|
+
};
|
|
5241
|
+
return /* @__PURE__ */ jsx34(ThemeProviderContext.Provider, { ...props, value, children });
|
|
5242
|
+
}
|
|
5197
5243
|
var useTheme = () => {
|
|
5198
5244
|
const context = useContext2(ThemeProviderContext);
|
|
5199
5245
|
if (context === void 0)
|
|
@@ -7855,6 +7901,7 @@ export {
|
|
|
7855
7901
|
Badge,
|
|
7856
7902
|
Breadcrumb,
|
|
7857
7903
|
Button,
|
|
7904
|
+
COLOR_PALETTE,
|
|
7858
7905
|
Calendar,
|
|
7859
7906
|
Card,
|
|
7860
7907
|
CardContent,
|
|
@@ -7924,6 +7971,7 @@ export {
|
|
|
7924
7971
|
Tabs,
|
|
7925
7972
|
TagInput,
|
|
7926
7973
|
Textarea,
|
|
7974
|
+
ThemeProvider,
|
|
7927
7975
|
Timeline,
|
|
7928
7976
|
ToastProvider,
|
|
7929
7977
|
ToggleSwitch,
|
|
@@ -7932,5 +7980,6 @@ export {
|
|
|
7932
7980
|
TreeView,
|
|
7933
7981
|
Widget,
|
|
7934
7982
|
Wizard,
|
|
7983
|
+
useTheme,
|
|
7935
7984
|
useToast
|
|
7936
7985
|
};
|