neogestify-ui-components 1.2.1 → 1.2.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.
@@ -1,4 +1,4 @@
1
- import React, { FC, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, FormHTMLAttributes, FormEvent, SelectHTMLAttributes } from 'react';
1
+ import React__default, { FC, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, FormHTMLAttributes, FormEvent, SelectHTMLAttributes } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -62,8 +62,8 @@ declare function Table({ headers, rows, variant, className, thClassName, tdClass
62
62
  interface ModalProps {
63
63
  onClose: () => void;
64
64
  title: string;
65
- children: React.ReactNode;
66
- footer?: React.ReactNode;
65
+ children: React__default.ReactNode;
66
+ footer?: React__default.ReactNode;
67
67
  maxWidth?: string;
68
68
  showCloseButton?: boolean;
69
69
  zIndex?: number;
@@ -71,7 +71,7 @@ interface ModalProps {
71
71
  interface ModalRef {
72
72
  handleClose: () => void;
73
73
  }
74
- declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<ModalRef>>;
74
+ declare const Modal: React__default.ForwardRefExoticComponent<ModalProps & React__default.RefAttributes<ModalRef>>;
75
75
 
76
76
  interface LoadingProps {
77
77
  variant?: 'spinner' | 'dots' | 'pulse' | 'bars' | 'ring' | 'cube';
@@ -1,4 +1,4 @@
1
- import React, { FC, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, FormHTMLAttributes, FormEvent, SelectHTMLAttributes } from 'react';
1
+ import React__default, { FC, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, FormHTMLAttributes, FormEvent, SelectHTMLAttributes } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -62,8 +62,8 @@ declare function Table({ headers, rows, variant, className, thClassName, tdClass
62
62
  interface ModalProps {
63
63
  onClose: () => void;
64
64
  title: string;
65
- children: React.ReactNode;
66
- footer?: React.ReactNode;
65
+ children: React__default.ReactNode;
66
+ footer?: React__default.ReactNode;
67
67
  maxWidth?: string;
68
68
  showCloseButton?: boolean;
69
69
  zIndex?: number;
@@ -71,7 +71,7 @@ interface ModalProps {
71
71
  interface ModalRef {
72
72
  handleClose: () => void;
73
73
  }
74
- declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<ModalRef>>;
74
+ declare const Modal: React__default.ForwardRefExoticComponent<ModalProps & React__default.RefAttributes<ModalRef>>;
75
75
 
76
76
  interface LoadingProps {
77
77
  variant?: 'spinner' | 'dots' | 'pulse' | 'bars' | 'ring' | 'cube';
package/dist/index.d.mts CHANGED
@@ -1,6 +1,23 @@
1
1
  export { Button, Form, Input, Loading, Modal, ModalRef, Select, Table, TextArea } from './components/html/index.mjs';
2
2
  export { AddIcon, AnimateSpin, ArchiveIcon, ArrowIcon, ArrowLeftIcon, ArrowRightIcon, BackIcon, BarsChartsIcon, BoxIcon, BuildingIcon, CajasIcon, CalendarIcon, CamaraIcon, CancelIcon, CashIcon, CategorieIcon, ChartIcon, CheckCircleIcon, CheckIcon, ClockIcon, CloseIcon, CloudIcon, CopyIcon, DeleteIcon, DocumentIcon, EditIcon, FacturacionIcon, FilterIcon, FolderIcon, GearIcon, HomeIcon, InfoIcon, LifeGuardIcon, LightingIcon, LocationIcon, LogoutIcon, MenuIcon, MinusIcon, MoneyIcon, MonitorIcon, MoonIcon, NetworkIcon, NotFoundIcon, PasteIcon, PercentIcon, PrinterIcon, QuestionIcon, RestaurantMenuIcon, SaveIcon, SearchIcon, ShieldIcon, SpinnerIcon, StackIcon, SunIcon, TestIcon, TrashIcon, TruckIcon, UsersIcon, WhatsAppIcon } from './components/icons/index.mjs';
3
3
  export { Alerta, AlertaAdvertencia, AlertaConfirmacion, AlertaError, AlertaExito, AlertaToast } from './components/alerts/index.mjs';
4
- import 'react';
5
- import 'react/jsx-runtime';
4
+ import * as React from 'react';
5
+ import { ReactNode } from 'react';
6
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
7
  import 'sweetalert2';
8
+
9
+ type Theme = 'light' | 'dark';
10
+ interface ThemeContextType {
11
+ theme: Theme;
12
+ toggleTheme: () => void;
13
+ setTheme: (theme: Theme) => void;
14
+ }
15
+ declare const ThemeContext: React.Context<ThemeContextType | undefined>;
16
+
17
+ declare function ThemeProvider({ children }: {
18
+ children: ReactNode;
19
+ }): react_jsx_runtime.JSX.Element;
20
+
21
+ declare function useTheme(): ThemeContextType;
22
+
23
+ export { type Theme, ThemeContext, type ThemeContextType, ThemeProvider, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,23 @@
1
1
  export { Button, Form, Input, Loading, Modal, ModalRef, Select, Table, TextArea } from './components/html/index.js';
2
2
  export { AddIcon, AnimateSpin, ArchiveIcon, ArrowIcon, ArrowLeftIcon, ArrowRightIcon, BackIcon, BarsChartsIcon, BoxIcon, BuildingIcon, CajasIcon, CalendarIcon, CamaraIcon, CancelIcon, CashIcon, CategorieIcon, ChartIcon, CheckCircleIcon, CheckIcon, ClockIcon, CloseIcon, CloudIcon, CopyIcon, DeleteIcon, DocumentIcon, EditIcon, FacturacionIcon, FilterIcon, FolderIcon, GearIcon, HomeIcon, InfoIcon, LifeGuardIcon, LightingIcon, LocationIcon, LogoutIcon, MenuIcon, MinusIcon, MoneyIcon, MonitorIcon, MoonIcon, NetworkIcon, NotFoundIcon, PasteIcon, PercentIcon, PrinterIcon, QuestionIcon, RestaurantMenuIcon, SaveIcon, SearchIcon, ShieldIcon, SpinnerIcon, StackIcon, SunIcon, TestIcon, TrashIcon, TruckIcon, UsersIcon, WhatsAppIcon } from './components/icons/index.js';
3
3
  export { Alerta, AlertaAdvertencia, AlertaConfirmacion, AlertaError, AlertaExito, AlertaToast } from './components/alerts/index.js';
4
- import 'react';
5
- import 'react/jsx-runtime';
4
+ import * as React from 'react';
5
+ import { ReactNode } from 'react';
6
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
7
  import 'sweetalert2';
8
+
9
+ type Theme = 'light' | 'dark';
10
+ interface ThemeContextType {
11
+ theme: Theme;
12
+ toggleTheme: () => void;
13
+ setTheme: (theme: Theme) => void;
14
+ }
15
+ declare const ThemeContext: React.Context<ThemeContextType | undefined>;
16
+
17
+ declare function ThemeProvider({ children }: {
18
+ children: ReactNode;
19
+ }): react_jsx_runtime.JSX.Element;
20
+
21
+ declare function useTheme(): ThemeContextType;
22
+
23
+ export { type Theme, ThemeContext, type ThemeContextType, ThemeProvider, useTheme };
package/dist/index.js CHANGED
@@ -795,6 +795,39 @@ var AlertaError = (title, text, onConfirm, options) => Alerta({ title, text, ico
795
795
  var AlertaAdvertencia = (title, text, onConfirm, onCancel, options) => Alerta({ title, text, icon: "warning", confirmButtonText: "S\xED, continuar", cancelButtonText: "Cancelar", showCancelButton: true, onConfirm, onCancel, ...options });
796
796
  var AlertaConfirmacion = (title, text, onConfirm, onCancel, options) => Alerta({ title, text, icon: "question", confirmButtonText: "S\xED", cancelButtonText: "No", showCancelButton: true, onConfirm, onCancel, ...options });
797
797
  var AlertaToast = (title, text, icon = "info", timer = 3e3, position = "top-end") => Alerta({ title, text, icon, toast: true, timer, position });
798
+ var ThemeContext = react.createContext(void 0);
799
+ function ThemeProvider({ children }) {
800
+ const [theme, setThemeState] = react.useState(() => {
801
+ const savedTheme = localStorage.getItem("theme");
802
+ return savedTheme || "light";
803
+ });
804
+ react.useEffect(() => {
805
+ const root = document.documentElement;
806
+ if (theme === "dark") {
807
+ root.classList.add("dark");
808
+ } else {
809
+ root.classList.remove("dark");
810
+ }
811
+ localStorage.setItem("theme", theme);
812
+ }, [theme]);
813
+ const toggleTheme = () => {
814
+ setThemeState((prev) => {
815
+ const newTheme = prev === "light" ? "dark" : "light";
816
+ return newTheme;
817
+ });
818
+ };
819
+ const setTheme = (newTheme) => {
820
+ setThemeState(newTheme);
821
+ };
822
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: { theme, toggleTheme, setTheme }, children });
823
+ }
824
+ function useTheme() {
825
+ const context = react.useContext(ThemeContext);
826
+ if (context === void 0) {
827
+ throw new Error("useTheme must be used within a ThemeProvider");
828
+ }
829
+ return context;
830
+ }
798
831
 
799
832
  exports.AddIcon = AddIcon;
800
833
  exports.Alerta = Alerta;
@@ -865,9 +898,12 @@ exports.SunIcon = SunIcon;
865
898
  exports.Table = Table;
866
899
  exports.TestIcon = TestIcon;
867
900
  exports.TextArea = TextArea;
901
+ exports.ThemeContext = ThemeContext;
902
+ exports.ThemeProvider = ThemeProvider;
868
903
  exports.TrashIcon = TrashIcon;
869
904
  exports.TruckIcon = TruckIcon;
870
905
  exports.UsersIcon = UsersIcon;
871
906
  exports.WhatsAppIcon = WhatsAppIcon;
907
+ exports.useTheme = useTheme;
872
908
  //# sourceMappingURL=index.js.map
873
909
  //# sourceMappingURL=index.js.map