flysoft-react-ui 0.1.2 → 0.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/App.d.ts +4 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +7 -0
- package/dist/components/ThemeSwitcher.d.ts +3 -0
- package/dist/components/ThemeSwitcher.d.ts.map +1 -0
- package/dist/components/ThemeSwitcher.js +12 -0
- package/dist/components/form-controls/Button.d.ts +11 -0
- package/dist/components/form-controls/Button.d.ts.map +1 -0
- package/dist/components/form-controls/Button.js +37 -0
- package/dist/components/form-controls/Input.d.ts +11 -0
- package/dist/components/form-controls/Input.d.ts.map +1 -0
- package/dist/components/form-controls/Input.js +27 -0
- package/dist/components/form-controls/index.d.ts +5 -0
- package/dist/components/form-controls/index.d.ts.map +1 -0
- package/dist/components/form-controls/index.js +2 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +6 -0
- package/dist/components/layout/Card.d.ts +12 -0
- package/dist/components/layout/Card.d.ts.map +1 -0
- package/dist/components/layout/Card.js +15 -0
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/utils/Badge.d.ts +10 -0
- package/dist/components/utils/Badge.d.ts.map +1 -0
- package/dist/components/utils/Badge.js +39 -0
- package/dist/components/utils/index.d.ts +3 -0
- package/dist/components/utils/index.d.ts.map +1 -0
- package/dist/components/utils/index.js +1 -0
- package/dist/contexts/ThemeContext.d.ts +12 -0
- package/dist/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/contexts/ThemeContext.js +124 -0
- package/dist/contexts/index.d.ts +5 -0
- package/dist/contexts/index.d.ts.map +1 -0
- package/dist/contexts/index.js +5 -0
- package/dist/contexts/presets.d.ts +8 -0
- package/dist/contexts/presets.d.ts.map +1 -0
- package/dist/contexts/presets.js +295 -0
- package/dist/contexts/types.d.ts +84 -0
- package/dist/contexts/types.d.ts.map +1 -0
- package/dist/contexts/types.js +1 -0
- package/dist/hooks/useThemeOverride.d.ts +26 -0
- package/dist/hooks/useThemeOverride.d.ts.map +1 -0
- package/dist/hooks/useThemeOverride.js +99 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -673
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +5 -0
- package/dist/styles.d.ts +3 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +4 -0
- package/package.json +2 -2
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAQA,OAAO,cAAc,CAAC;AAEtB,iBAAS,GAAG,4CA2MX;AAED,eAAe,GAAG,CAAC"}
|
package/dist/App.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Input, Card, Badge, ThemeProvider, ThemeSwitcher, } from "./index";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
function App() {
|
|
5
|
+
return (_jsx(ThemeProvider, { initialTheme: "light", children: _jsx("div", { className: "min-h-screen p-8", style: { backgroundColor: "var(--flysoft-bg-secondary)" }, children: _jsxs("div", { className: "max-w-4xl mx-auto", children: [_jsxs("div", { className: "text-center mb-12", children: [_jsx("h1", { className: "text-4xl font-bold mb-4", style: { color: "var(--flysoft-text-primary)" }, children: "Flysoft React UI" }), _jsx("p", { className: "text-xl", style: { color: "var(--flysoft-text-secondary)" }, children: "Biblioteca de componentes React moderna con Tailwind CSS, FontAwesome y sistema de temas personalizable" })] }), _jsx("div", { className: "mb-8", children: _jsx(ThemeSwitcher, {}) }), _jsx(Card, { title: "Botones", subtitle: "Diferentes variantes y tama\u00F1os de botones", className: "mb-8", children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap gap-4", children: [_jsx(Button, { variant: "primary", icon: "fa-heart", children: "Bot\u00F3n Primario" }), _jsx(Button, { variant: "outline", icon: "fa-download", children: "Bot\u00F3n Outline" }), _jsx(Button, { variant: "ghost", icon: "fa-edit", children: "Bot\u00F3n Ghost" })] }), _jsxs("div", { className: "flex flex-wrap gap-4", children: [_jsx(Button, { size: "sm", icon: "fa-plus", children: "Peque\u00F1o" }), _jsx(Button, { size: "md", icon: "fa-check", children: "Mediano" }), _jsx(Button, { size: "lg", icon: "fa-arrow-right", children: "Grande" })] }), _jsxs("div", { className: "flex flex-wrap gap-4", children: [_jsx(Button, { loading: true, children: "Cargando..." }), _jsx(Button, { disabled: true, children: "Deshabilitado" }), _jsx(Button, { icon: "fa-arrow-right", iconPosition: "right", children: "Con Icono Derecha" })] })] }) }), _jsx(Card, { title: "Campos de Entrada", subtitle: "Diferentes tipos de inputs con iconos", className: "mb-8", children: _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsx(Input, { label: "Nombre completo", placeholder: "Ingresa tu nombre", icon: "fa-user" }), _jsx(Input, { label: "Email", type: "email", placeholder: "tu@email.com", icon: "fa-envelope" }), _jsx(Input, { label: "Contrase\u00F1a", type: "password", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", icon: "fa-lock" }), _jsx(Input, { label: "B\u00FAsqueda", placeholder: "Buscar...", icon: "fa-search", iconPosition: "right" }), _jsx(Input, { label: "Con error", placeholder: "Campo con error", error: "Este campo es requerido", icon: "fa-exclamation-triangle" })] }) }), _jsx(Card, { title: "Badges", subtitle: "Diferentes variantes de badges", className: "mb-8", children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Badge, { variant: "primary", children: "Primary" }), _jsx(Badge, { variant: "secondary", children: "Secondary" }), _jsx(Badge, { variant: "success", children: "Success" }), _jsx(Badge, { variant: "warning", children: "Warning" }), _jsx(Badge, { variant: "danger", children: "Danger" }), _jsx(Badge, { variant: "info", children: "Info" })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Badge, { size: "sm", children: "Small" }), _jsx(Badge, { size: "md", children: "Medium" }), _jsx(Badge, { size: "lg", children: "Large" })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Badge, { rounded: true, children: "Rounded" }), _jsx(Badge, { variant: "success", rounded: true, children: "Success Rounded" }), _jsx(Badge, { variant: "warning", rounded: true, children: "Warning Rounded" })] })] }) }), _jsx(Card, { title: "Tarjetas", subtitle: "Diferentes variantes de tarjetas", className: "mb-8", children: _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6", children: [_jsx(Card, { title: "Tarjeta Simple", subtitle: "Sin acciones ni footer", variant: "default", children: _jsx("p", { style: { color: "var(--flysoft-text-secondary)" }, children: "Esta es una tarjeta simple con contenido b\u00E1sico." }) }), _jsx(Card, { title: "Con Acciones", subtitle: "Incluye botones en el header", variant: "elevated", headerActions: _jsx(Button, { size: "sm", variant: "outline", icon: "fa-edit", children: "Editar" }), children: _jsx("p", { style: { color: "var(--flysoft-text-secondary)" }, children: "Tarjeta con botones de acci\u00F3n en el header." }) }), _jsx(Card, { title: "Con Footer", subtitle: "Incluye secci\u00F3n de footer", variant: "outlined", footer: _jsxs("div", { className: "flex justify-between items-center", children: [_jsx("span", { className: "text-sm", style: { color: "var(--flysoft-text-muted)" }, children: "\u00DAltima actualizaci\u00F3n: hoy" }), _jsx(Button, { size: "sm", variant: "primary", icon: "fa-save", children: "Guardar" })] }), children: _jsx("p", { style: { color: "var(--flysoft-text-secondary)" }, children: "Tarjeta con footer personalizado y botones." }) })] }) })] }) }) }));
|
|
6
|
+
}
|
|
7
|
+
export default App;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeSwitcher.d.ts","sourceRoot":"","sources":["../../src/components/ThemeSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAmEjC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useTheme } from "../contexts/ThemeContext";
|
|
4
|
+
import { Button } from "./form-controls/Button";
|
|
5
|
+
import { Card } from "./layout/Card";
|
|
6
|
+
export const ThemeSwitcher = () => {
|
|
7
|
+
const { theme, setTheme, currentThemeName, availableThemes, resetToDefault, isDark, } = useTheme();
|
|
8
|
+
return (_jsxs(Card, { className: "p-6 max-w-md mx-auto", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", style: { color: "var(--flysoft-text-primary)" }, children: "Theme Switcher" }), _jsxs("div", { className: "space-y-3", children: [_jsx("div", { className: "flex flex-wrap gap-2", children: availableThemes.map((themeName) => (_jsx(Button, { variant: currentThemeName === themeName ? "primary" : "ghost", size: "sm", onClick: () => setTheme(themeName), children: themeName }, themeName))) }), _jsx(Button, { variant: "outline", size: "sm", onClick: resetToDefault, className: "w-full", children: "Reset to Default" }), _jsxs("div", { className: "text-sm space-y-2", style: { color: "var(--flysoft-text-secondary)" }, children: [_jsxs("p", { children: [_jsx("strong", { children: "Current Theme:" }), " ", currentThemeName] }), _jsxs("p", { children: [_jsx("strong", { children: "Mode:" }), " ", isDark ? "Dark" : "Light"] }), _jsxs("p", { children: [_jsx("strong", { children: "Primary Color:" }), " ", theme.colors.primary] })] }), _jsx("div", { className: "w-full h-8 rounded border-2", style: {
|
|
9
|
+
backgroundColor: theme.colors.primary,
|
|
10
|
+
borderColor: theme.colors.borderDefault,
|
|
11
|
+
} })] })] }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
variant?: "primary" | "outline" | "ghost";
|
|
4
|
+
size?: "sm" | "md" | "lg";
|
|
5
|
+
icon?: string;
|
|
6
|
+
iconPosition?: "left" | "right";
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
11
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/form-controls/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAgExC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export const Button = ({ variant = "primary", size = "md", icon, iconPosition = "left", loading = false, children, className = "", disabled, ...props }) => {
|
|
4
|
+
const baseClasses = `
|
|
5
|
+
inline-flex items-center justify-center font-medium rounded-sm transition-colors
|
|
6
|
+
cursor-pointer
|
|
7
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
8
|
+
font-[var(--font-default)]
|
|
9
|
+
`;
|
|
10
|
+
const variantClasses = {
|
|
11
|
+
primary: `
|
|
12
|
+
bg-[var(--color-primary)] text-[var(--color-primary-contrast)]
|
|
13
|
+
hover:bg-[var(--color-primary-dark)] focus:ring-[var(--color-primary)]
|
|
14
|
+
`,
|
|
15
|
+
outline: `
|
|
16
|
+
border border-[var(--color-primary)] text-[var(--color-primary)]
|
|
17
|
+
hover:bg-[var(--color-bg-secondary)] focus:ring-[var(--color-primary)]
|
|
18
|
+
`,
|
|
19
|
+
ghost: `
|
|
20
|
+
text-[var(--color-primary)] hover:bg-[var(--color-bg-secondary)]
|
|
21
|
+
focus:ring-[var(--color-primary)]
|
|
22
|
+
`,
|
|
23
|
+
};
|
|
24
|
+
const sizeClasses = {
|
|
25
|
+
sm: "px-3 py-1.5 text-sm",
|
|
26
|
+
md: "px-4 py-2 text-base",
|
|
27
|
+
lg: "px-6 py-3 text-lg",
|
|
28
|
+
};
|
|
29
|
+
const classes = `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${className}`;
|
|
30
|
+
const renderIcon = () => {
|
|
31
|
+
if (!icon)
|
|
32
|
+
return null;
|
|
33
|
+
const iconClasses = size === "sm" ? "w-4 h-4" : size === "md" ? "w-5 h-5" : "w-6 h-6";
|
|
34
|
+
return (_jsx("i", { className: `fa ${icon} ${iconClasses} ${iconPosition === "right" ? "ml-2" : "mr-2"}` }));
|
|
35
|
+
};
|
|
36
|
+
return (_jsxs("button", { className: classes, disabled: disabled || loading, ...props, children: [loading && _jsx("i", { className: "fa fa-spinner fa-spin mr-2" }), icon && iconPosition === "left" && !loading && renderIcon(), children, icon && iconPosition === "right" && !loading && renderIcon()] }));
|
|
37
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
3
|
+
label?: string;
|
|
4
|
+
error?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
iconPosition?: "left" | "right";
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const Input: React.FC<InputProps>;
|
|
11
|
+
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/form-controls/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA0EtC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export const Input = ({ label, error, icon, iconPosition = "left", size = "md", className = "", id, ...props }) => {
|
|
4
|
+
const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
|
|
5
|
+
const baseClasses = `
|
|
6
|
+
w-full border rounded-lg transition-colors focus:outline-none focus:ring-2
|
|
7
|
+
disabled:opacity-50 disabled:cursor-not-allowed
|
|
8
|
+
font-[var(--font-default)] text-[var(--color-text-primary)]
|
|
9
|
+
bg-[var(--color-bg-default)]
|
|
10
|
+
`;
|
|
11
|
+
const sizeClasses = {
|
|
12
|
+
sm: "px-3 py-1.5 text-sm",
|
|
13
|
+
md: "px-4 py-2 text-base",
|
|
14
|
+
lg: "px-6 py-3 text-lg",
|
|
15
|
+
};
|
|
16
|
+
const stateClasses = error
|
|
17
|
+
? `border-[var(--color-border-error)] focus:border-[var(--color-border-error)] focus:ring-[var(--color-border-error)]`
|
|
18
|
+
: `border-[var(--color-border-default)] focus:border-[var(--color-border-focus)] focus:ring-[var(--color-border-focus)]`;
|
|
19
|
+
const inputClasses = `${baseClasses} ${sizeClasses[size]} ${stateClasses} ${className}`;
|
|
20
|
+
const iconClasses = size === "sm" ? "w-4 h-4" : size === "md" ? "w-5 h-5" : "w-6 h-6";
|
|
21
|
+
const renderIcon = () => {
|
|
22
|
+
if (!icon)
|
|
23
|
+
return null;
|
|
24
|
+
return (_jsx("i", { className: `fa ${icon} ${iconClasses} text-[var(--color-text-muted)] absolute top-1/2 transform -translate-y-1/2 ${iconPosition === "left" ? "left-3" : "right-3"}` }));
|
|
25
|
+
};
|
|
26
|
+
return (_jsxs("div", { className: "w-full", children: [label && (_jsx("label", { htmlFor: inputId, className: "block text-sm font-medium text-[var(--color-text-primary)] mb-1 font-[var(--font-default)]", children: label })), _jsxs("div", { className: "relative", children: [icon && iconPosition === "left" && renderIcon(), _jsx("input", { id: inputId, className: `${inputClasses} ${icon && iconPosition === "left" ? "pl-10" : ""} ${icon && iconPosition === "right" ? "pr-10" : ""}`, ...props }), icon && iconPosition === "right" && renderIcon()] }), error && (_jsx("p", { className: "mt-1 text-sm text-[var(--color-danger)] font-[var(--font-default)]", children: error }))] }));
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form-controls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAGhC,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface CardProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
subtitle?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
headerActions?: React.ReactNode;
|
|
8
|
+
footer?: React.ReactNode;
|
|
9
|
+
variant?: "default" | "elevated" | "outlined";
|
|
10
|
+
}
|
|
11
|
+
export declare const Card: React.FC<CardProps>;
|
|
12
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;CAC/C;AAED,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAuDpC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export const Card = ({ title, subtitle, children, className = "", headerActions, footer, variant = "default", }) => {
|
|
4
|
+
const baseClasses = `
|
|
5
|
+
bg-[var(--color-bg-default)] rounded-lg border
|
|
6
|
+
font-[var(--font-default)]
|
|
7
|
+
`;
|
|
8
|
+
const variantClasses = {
|
|
9
|
+
default: `border-[var(--color-border-default)]`,
|
|
10
|
+
elevated: `border-[var(--color-border-default)] shadow-[var(--shadow-lg)]`,
|
|
11
|
+
outlined: `border-[var(--color-gray-300)]`,
|
|
12
|
+
};
|
|
13
|
+
const classes = `${baseClasses} ${variantClasses[variant]} ${className}`;
|
|
14
|
+
return (_jsxs("div", { className: classes, children: [(title || subtitle || headerActions) && (_jsx("div", { className: "px-6 py-4 border-b border-[var(--color-border-default)]", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [title && (_jsx("h3", { className: "text-lg font-semibold text-[var(--color-text-primary)]", children: title })), subtitle && (_jsx("p", { className: "text-sm text-[var(--color-text-secondary)] mt-1", children: subtitle }))] }), headerActions && (_jsx("div", { className: "flex items-center space-x-2", children: headerActions }))] }) })), _jsx("div", { className: "px-6 py-4", children: children }), footer && (_jsx("div", { className: "px-6 py-4 border-t border-[var(--color-border-default)] bg-[var(--color-bg-secondary)] rounded-b-lg", children: footer }))] }));
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Card } from "./Card";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface BadgeProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
variant?: "primary" | "secondary" | "success" | "warning" | "danger" | "info";
|
|
5
|
+
size?: "sm" | "md" | "lg";
|
|
6
|
+
rounded?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const Badge: React.FC<BadgeProps>;
|
|
10
|
+
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/utils/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9E,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAgDtC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export const Badge = ({ children, variant = "primary", size = "md", rounded = false, className = "", }) => {
|
|
4
|
+
const baseClasses = "inline-flex items-center font-medium font-[var(--font-default)]";
|
|
5
|
+
const variantClasses = {
|
|
6
|
+
primary: `
|
|
7
|
+
bg-[var(--color-primary-light)] text-[var(--color-primary-dark)]
|
|
8
|
+
hover:bg-[var(--color-primary)] hover:text-[var(--color-primary-contrast)]
|
|
9
|
+
`,
|
|
10
|
+
secondary: `
|
|
11
|
+
bg-[var(--color-secondary-light)] text-[var(--color-secondary-dark)]
|
|
12
|
+
hover:bg-[var(--color-secondary)] hover:text-[var(--color-secondary-contrast)]
|
|
13
|
+
`,
|
|
14
|
+
success: `
|
|
15
|
+
bg-[var(--color-success-light)] text-[var(--color-success-dark)]
|
|
16
|
+
hover:bg-[var(--color-success)] hover:text-[var(--color-success-contrast)]
|
|
17
|
+
`,
|
|
18
|
+
warning: `
|
|
19
|
+
bg-[var(--color-warning-light)] text-[var(--color-warning-dark)]
|
|
20
|
+
hover:bg-[var(--color-warning)] hover:text-[var(--color-warning-contrast)]
|
|
21
|
+
`,
|
|
22
|
+
danger: `
|
|
23
|
+
bg-[var(--color-danger-light)] text-[var(--color-danger-dark)]
|
|
24
|
+
hover:bg-[var(--color-danger)] hover:text-[var(--color-danger-contrast)]
|
|
25
|
+
`,
|
|
26
|
+
info: `
|
|
27
|
+
bg-[var(--color-info-light)] text-[var(--color-info-dark)]
|
|
28
|
+
hover:bg-[var(--color-info)] hover:text-[var(--color-info-contrast)]
|
|
29
|
+
`,
|
|
30
|
+
};
|
|
31
|
+
const sizeClasses = {
|
|
32
|
+
sm: "px-2 py-0.5 text-xs",
|
|
33
|
+
md: "px-2.5 py-0.5 text-sm",
|
|
34
|
+
lg: "px-3 py-1 text-base",
|
|
35
|
+
};
|
|
36
|
+
const roundedClasses = rounded ? "rounded-full" : "rounded-md";
|
|
37
|
+
const classes = `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${roundedClasses} ${className}`;
|
|
38
|
+
return _jsx("span", { className: classes, children: children });
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Badge } from "./Badge";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
|
+
import type { Theme, ThemeContextType } from "./types";
|
|
3
|
+
interface ThemeProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
initialTheme?: string | Theme;
|
|
6
|
+
storageKey?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
9
|
+
export declare const useTheme: () => ThemeContextType;
|
|
10
|
+
export declare const useThemeContext: () => boolean;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=ThemeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../src/contexts/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKvD,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgItD,CAAC;AAGF,eAAO,MAAM,QAAQ,QAAO,gBAM3B,CAAC;AAGF,eAAO,MAAM,eAAe,eAG3B,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { createContext, useContext, useEffect, useState, } from "react";
|
|
3
|
+
import { themes, defaultTheme } from "./presets";
|
|
4
|
+
const ThemeContext = createContext(undefined);
|
|
5
|
+
export const ThemeProvider = ({ children, initialTheme = "light", storageKey = "flysoft-theme", }) => {
|
|
6
|
+
const [currentTheme, setCurrentTheme] = useState(() => {
|
|
7
|
+
// Try to get theme from localStorage
|
|
8
|
+
if (typeof window !== "undefined") {
|
|
9
|
+
const savedTheme = localStorage.getItem(storageKey);
|
|
10
|
+
if (savedTheme) {
|
|
11
|
+
if (themes[savedTheme]) {
|
|
12
|
+
return themes[savedTheme];
|
|
13
|
+
}
|
|
14
|
+
// Try to parse as custom theme
|
|
15
|
+
try {
|
|
16
|
+
const parsed = JSON.parse(savedTheme);
|
|
17
|
+
if (parsed.name && parsed.colors) {
|
|
18
|
+
return parsed;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Invalid JSON, fallback to default
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// Handle initialTheme prop
|
|
27
|
+
if (typeof initialTheme === "string") {
|
|
28
|
+
return themes[initialTheme] || defaultTheme;
|
|
29
|
+
}
|
|
30
|
+
return initialTheme;
|
|
31
|
+
});
|
|
32
|
+
const [currentThemeName, setCurrentThemeName] = useState(currentTheme.name);
|
|
33
|
+
// Function to apply theme to CSS variables
|
|
34
|
+
const applyThemeToCSS = (theme) => {
|
|
35
|
+
if (typeof document === "undefined")
|
|
36
|
+
return;
|
|
37
|
+
const root = document.documentElement;
|
|
38
|
+
// Apply color variables
|
|
39
|
+
Object.entries(theme.colors).forEach(([key, value]) => {
|
|
40
|
+
const cssVarName = `--flysoft-${key
|
|
41
|
+
.replace(/([A-Z])/g, "-$1")
|
|
42
|
+
.toLowerCase()}`;
|
|
43
|
+
root.style.setProperty(cssVarName, value);
|
|
44
|
+
});
|
|
45
|
+
// Apply shadow variables
|
|
46
|
+
Object.entries(theme.shadows).forEach(([key, value]) => {
|
|
47
|
+
const cssVarName = `--flysoft-shadow-${key}`;
|
|
48
|
+
root.style.setProperty(cssVarName, value);
|
|
49
|
+
});
|
|
50
|
+
// Apply radius variables
|
|
51
|
+
Object.entries(theme.radius).forEach(([key, value]) => {
|
|
52
|
+
const cssVarName = `--flysoft-radius-${key}`;
|
|
53
|
+
root.style.setProperty(cssVarName, value);
|
|
54
|
+
});
|
|
55
|
+
// Apply spacing variables
|
|
56
|
+
Object.entries(theme.spacing).forEach(([key, value]) => {
|
|
57
|
+
const cssVarName = `--flysoft-spacing-${key}`;
|
|
58
|
+
root.style.setProperty(cssVarName, value);
|
|
59
|
+
});
|
|
60
|
+
// Apply font variables
|
|
61
|
+
Object.entries(theme.fonts).forEach(([key, value]) => {
|
|
62
|
+
const cssVarName = `--flysoft-font-${key}`;
|
|
63
|
+
root.style.setProperty(cssVarName, value);
|
|
64
|
+
});
|
|
65
|
+
// Set theme name as data attribute for CSS targeting
|
|
66
|
+
root.setAttribute("data-theme", theme.name);
|
|
67
|
+
};
|
|
68
|
+
// Function to set theme
|
|
69
|
+
const setTheme = (theme) => {
|
|
70
|
+
let newTheme;
|
|
71
|
+
if (typeof theme === "string") {
|
|
72
|
+
if (themes[theme]) {
|
|
73
|
+
newTheme = themes[theme];
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.warn(`Theme "${theme}" not found, falling back to default`);
|
|
77
|
+
newTheme = defaultTheme;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
newTheme = theme;
|
|
82
|
+
}
|
|
83
|
+
setCurrentTheme(newTheme);
|
|
84
|
+
setCurrentThemeName(newTheme.name);
|
|
85
|
+
// Save to localStorage
|
|
86
|
+
if (typeof window !== "undefined") {
|
|
87
|
+
localStorage.setItem(storageKey, JSON.stringify(newTheme));
|
|
88
|
+
}
|
|
89
|
+
// Apply to CSS
|
|
90
|
+
applyThemeToCSS(newTheme);
|
|
91
|
+
};
|
|
92
|
+
// Function to reset to default theme
|
|
93
|
+
const resetToDefault = () => {
|
|
94
|
+
setTheme(defaultTheme);
|
|
95
|
+
};
|
|
96
|
+
// Apply theme on mount and when theme changes
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
applyThemeToCSS(currentTheme);
|
|
99
|
+
}, [currentTheme]);
|
|
100
|
+
// Check if current theme is dark
|
|
101
|
+
const isDark = currentTheme.name === "dark";
|
|
102
|
+
const value = {
|
|
103
|
+
theme: currentTheme,
|
|
104
|
+
setTheme,
|
|
105
|
+
currentThemeName,
|
|
106
|
+
availableThemes: Object.keys(themes),
|
|
107
|
+
resetToDefault,
|
|
108
|
+
isDark,
|
|
109
|
+
};
|
|
110
|
+
return (_jsx(ThemeContext.Provider, { value: value, children: children }));
|
|
111
|
+
};
|
|
112
|
+
// Hook to use theme context
|
|
113
|
+
export const useTheme = () => {
|
|
114
|
+
const context = useContext(ThemeContext);
|
|
115
|
+
if (context === undefined) {
|
|
116
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
117
|
+
}
|
|
118
|
+
return context;
|
|
119
|
+
};
|
|
120
|
+
// Hook to check if theme context is available
|
|
121
|
+
export const useThemeContext = () => {
|
|
122
|
+
const context = useContext(ThemeContext);
|
|
123
|
+
return context !== undefined;
|
|
124
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ThemeProvider, useTheme, useThemeContext } from "./ThemeContext";
|
|
2
|
+
export { useThemeOverride, useTemporaryOverride, } from "../hooks/useThemeOverride";
|
|
3
|
+
export type { Theme, ThemeContextType, ThemeOverride } from "./types";
|
|
4
|
+
export { lightTheme, darkTheme, blueTheme, greenTheme, defaultTheme, themes, } from "./presets";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AAGnC,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGtE,OAAO,EACL,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,YAAY,EACZ,MAAM,GACP,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Theme system exports
|
|
2
|
+
export { ThemeProvider, useTheme, useThemeContext } from "./ThemeContext";
|
|
3
|
+
export { useThemeOverride, useTemporaryOverride, } from "../hooks/useThemeOverride";
|
|
4
|
+
// Preset themes
|
|
5
|
+
export { lightTheme, darkTheme, blueTheme, greenTheme, defaultTheme, themes, } from "./presets";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Theme } from "./types";
|
|
2
|
+
export declare const lightTheme: Theme;
|
|
3
|
+
export declare const darkTheme: Theme;
|
|
4
|
+
export declare const blueTheme: Theme;
|
|
5
|
+
export declare const greenTheme: Theme;
|
|
6
|
+
export declare const defaultTheme: Theme;
|
|
7
|
+
export declare const themes: Record<string, Theme>;
|
|
8
|
+
//# sourceMappingURL=presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/contexts/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,UAAU,EAAE,KAuExB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAuEvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAuEvB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAuExB,CAAC;AAEF,eAAO,MAAM,YAAY,OAAa,CAAC;AAEvC,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAKxC,CAAC"}
|