neogestify-ui-components 1.2.18 → 1.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +349 -342
- package/dist/components/alerts/index.js +1 -1
- package/dist/components/alerts/index.js.map +1 -1
- package/dist/components/alerts/index.mjs +1 -1
- package/dist/components/alerts/index.mjs.map +1 -1
- package/dist/components/html/index.js +1 -1
- package/dist/components/html/index.js.map +1 -1
- package/dist/components/html/index.mjs +1 -1
- package/dist/components/html/index.mjs.map +1 -1
- package/dist/components/icons/index.js.map +1 -1
- package/dist/components/icons/index.mjs.map +1 -1
- package/dist/context/theme/index.js +1 -1
- package/dist/context/theme/index.js.map +1 -1
- package/dist/context/theme/index.mjs +1 -1
- package/dist/context/theme/index.mjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/alerts/InfoAlert.tsx +25 -25
- package/src/components/alerts/alerta.ts +93 -93
- package/src/components/alerts/index.ts +1 -1
- package/src/components/html/Button.tsx +71 -71
- package/src/components/html/Form.tsx +39 -39
- package/src/components/html/Input.tsx +136 -136
- package/src/components/html/Loading.tsx +104 -104
- package/src/components/html/Modal.tsx +79 -79
- package/src/components/html/Select.tsx +81 -81
- package/src/components/html/Table.tsx +61 -61
- package/src/components/html/TextArea.tsx +70 -70
- package/src/components/html/index.ts +7 -7
- package/src/components/icons/icons.tsx +550 -550
- package/src/components/icons/index.ts +1 -1
- package/src/context/theme/ThemeContext.tsx +37 -37
- package/src/context/theme/ThemeToggle.tsx +23 -23
- package/src/context/theme/index.ts +3 -3
- package/src/context/theme/theme.types.ts +11 -11
- package/src/context/theme/useTheme.ts +10 -10
- package/src/index.ts +5 -5
- package/src/types/types.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './icons';
|
|
1
|
+
export * from './icons';
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
import { ThemeContext, type Theme } from './theme.types';
|
|
4
|
-
|
|
5
|
-
export function ThemeProvider({ children }: { children: ReactNode }) {
|
|
6
|
-
const [theme, setThemeState] = useState<Theme>(() => {
|
|
7
|
-
const savedTheme = localStorage.getItem('theme');
|
|
8
|
-
return (savedTheme as Theme) || 'light';
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const root = document.documentElement
|
|
13
|
-
if (theme === 'dark') {
|
|
14
|
-
root.classList.add('dark');
|
|
15
|
-
} else {
|
|
16
|
-
root.classList.remove('dark');
|
|
17
|
-
}
|
|
18
|
-
localStorage.setItem('theme', theme);
|
|
19
|
-
}, [theme]);
|
|
20
|
-
|
|
21
|
-
const toggleTheme = () => {
|
|
22
|
-
setThemeState(prev => {
|
|
23
|
-
const newTheme = prev === 'light' ? 'dark' : 'light';
|
|
24
|
-
return newTheme;
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const setTheme = (newTheme: Theme) => {
|
|
29
|
-
setThemeState(newTheme);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<ThemeContext.Provider value={{ theme, toggleTheme, setTheme }}>
|
|
34
|
-
{children}
|
|
35
|
-
</ThemeContext.Provider>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { ThemeContext, type Theme } from './theme.types';
|
|
4
|
+
|
|
5
|
+
export function ThemeProvider({ children }: { children: ReactNode }) {
|
|
6
|
+
const [theme, setThemeState] = useState<Theme>(() => {
|
|
7
|
+
const savedTheme = localStorage.getItem('theme');
|
|
8
|
+
return (savedTheme as Theme) || 'light';
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const root = document.documentElement
|
|
13
|
+
if (theme === 'dark') {
|
|
14
|
+
root.classList.add('dark');
|
|
15
|
+
} else {
|
|
16
|
+
root.classList.remove('dark');
|
|
17
|
+
}
|
|
18
|
+
localStorage.setItem('theme', theme);
|
|
19
|
+
}, [theme]);
|
|
20
|
+
|
|
21
|
+
const toggleTheme = () => {
|
|
22
|
+
setThemeState(prev => {
|
|
23
|
+
const newTheme = prev === 'light' ? 'dark' : 'light';
|
|
24
|
+
return newTheme;
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const setTheme = (newTheme: Theme) => {
|
|
29
|
+
setThemeState(newTheme);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<ThemeContext.Provider value={{ theme, toggleTheme, setTheme }}>
|
|
34
|
+
{children}
|
|
35
|
+
</ThemeContext.Provider>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useTheme } from './useTheme';
|
|
2
|
-
import { Button } from '../../components/html/Button';
|
|
3
|
-
import { MoonIcon, SunIcon } from '../../components/icons/icons';
|
|
4
|
-
|
|
5
|
-
export function ThemeToggle() {
|
|
6
|
-
const { theme, toggleTheme } = useTheme();
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<Button
|
|
10
|
-
variant='custom'
|
|
11
|
-
onClick={toggleTheme}
|
|
12
|
-
className="p-2 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors duration-200"
|
|
13
|
-
aria-label={`Cambiar a modo ${theme === 'light' ? 'oscuro' : 'claro'}`}
|
|
14
|
-
title={`Cambiar a modo ${theme === 'light' ? 'oscuro' : 'claro'}`}
|
|
15
|
-
>
|
|
16
|
-
{theme === 'light' ? (
|
|
17
|
-
<MoonIcon className="w-6 h-6 sm:w-5 sm:h-5 text-gray-800" />
|
|
18
|
-
) : (
|
|
19
|
-
<SunIcon className="w-6 h-6 sm:w-5 sm:h-5 text-yellow-400" />
|
|
20
|
-
)}
|
|
21
|
-
</Button>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
1
|
+
import { useTheme } from './useTheme';
|
|
2
|
+
import { Button } from '../../components/html/Button';
|
|
3
|
+
import { MoonIcon, SunIcon } from '../../components/icons/icons';
|
|
4
|
+
|
|
5
|
+
export function ThemeToggle() {
|
|
6
|
+
const { theme, toggleTheme } = useTheme();
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<Button
|
|
10
|
+
variant='custom'
|
|
11
|
+
onClick={toggleTheme}
|
|
12
|
+
className="p-2 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors duration-200"
|
|
13
|
+
aria-label={`Cambiar a modo ${theme === 'light' ? 'oscuro' : 'claro'}`}
|
|
14
|
+
title={`Cambiar a modo ${theme === 'light' ? 'oscuro' : 'claro'}`}
|
|
15
|
+
>
|
|
16
|
+
{theme === 'light' ? (
|
|
17
|
+
<MoonIcon className="w-6 h-6 sm:w-5 sm:h-5 text-gray-800" />
|
|
18
|
+
) : (
|
|
19
|
+
<SunIcon className="w-6 h-6 sm:w-5 sm:h-5 text-yellow-400" />
|
|
20
|
+
)}
|
|
21
|
+
</Button>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './theme.types';
|
|
2
|
-
export * from './ThemeContext';
|
|
3
|
-
export * from './useTheme';
|
|
1
|
+
export * from './theme.types';
|
|
2
|
+
export * from './ThemeContext';
|
|
3
|
+
export * from './useTheme';
|
|
4
4
|
export { ThemeToggle } from './ThemeToggle';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
2
|
-
|
|
3
|
-
export type Theme = 'light' | 'dark';
|
|
4
|
-
|
|
5
|
-
export interface ThemeContextType {
|
|
6
|
-
theme: Theme;
|
|
7
|
-
toggleTheme: () => void;
|
|
8
|
-
setTheme: (theme: Theme) => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export type Theme = 'light' | 'dark';
|
|
4
|
+
|
|
5
|
+
export interface ThemeContextType {
|
|
6
|
+
theme: Theme;
|
|
7
|
+
toggleTheme: () => void;
|
|
8
|
+
setTheme: (theme: Theme) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { ThemeContext } from './theme.types';
|
|
3
|
-
|
|
4
|
-
export function useTheme() {
|
|
5
|
-
const context = useContext(ThemeContext);
|
|
6
|
-
if (context === undefined) {
|
|
7
|
-
throw new Error('useTheme must be used within a ThemeProvider');
|
|
8
|
-
}
|
|
9
|
-
return context;
|
|
10
|
-
}
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { ThemeContext } from './theme.types';
|
|
3
|
+
|
|
4
|
+
export function useTheme() {
|
|
5
|
+
const context = useContext(ThemeContext);
|
|
6
|
+
if (context === undefined) {
|
|
7
|
+
throw new Error('useTheme must be used within a ThemeProvider');
|
|
8
|
+
}
|
|
9
|
+
return context;
|
|
10
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Export all modules for convenience
|
|
2
|
-
export * from './components/html/index';
|
|
3
|
-
export * from './components/icons/index';
|
|
4
|
-
export * from './components/alerts/index';
|
|
5
|
-
export * from './context/theme/index';
|
|
1
|
+
// Export all modules for convenience
|
|
2
|
+
export * from './components/html/index';
|
|
3
|
+
export * from './components/icons/index';
|
|
4
|
+
export * from './components/alerts/index';
|
|
5
|
+
export * from './context/theme/index';
|
package/src/types/types.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export interface Props {
|
|
2
|
-
className?: string;
|
|
3
|
-
}
|
|
1
|
+
export interface Props {
|
|
2
|
+
className?: string;
|
|
3
|
+
}
|