framepexls-ui-lib 0.2.15 → 0.3.1
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/Sidebar.js +32 -8
- package/dist/Sidebar.mjs +32 -8
- package/dist/iconos/index.js +4 -14
- package/dist/iconos/index.mjs +4 -14
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +11 -0
- package/dist/index.mjs +7 -0
- package/dist/theme/ThemeProvider.d.mts +18 -0
- package/dist/theme/ThemeProvider.d.ts +18 -0
- package/dist/theme/ThemeProvider.js +109 -0
- package/dist/theme/ThemeProvider.mjs +84 -0
- package/dist/theme/ThemeScript.d.mts +7 -0
- package/dist/theme/ThemeScript.d.ts +7 -0
- package/dist/theme/ThemeScript.js +34 -0
- package/dist/theme/ThemeScript.mjs +10 -0
- package/dist/theme/ThemeToggle.d.mts +10 -0
- package/dist/theme/ThemeToggle.d.ts +10 -0
- package/dist/theme/ThemeToggle.js +56 -0
- package/dist/theme/ThemeToggle.mjs +36 -0
- package/dist/theme.css +126 -0
- package/package.json +4 -3
package/dist/Sidebar.js
CHANGED
|
@@ -222,12 +222,16 @@ function Sidebar({
|
|
|
222
222
|
] })
|
|
223
223
|
] }),
|
|
224
224
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
225
|
-
|
|
225
|
+
import_framer_motion.motion.aside,
|
|
226
226
|
{
|
|
227
227
|
className: [
|
|
228
228
|
"hidden xl:fixed xl:inset-y-0 xl:flex xl:flex-col xl:border-r xl:border-black/5 bg-white xl:py-6 dark:bg-[var(--fx-surface)] z-40",
|
|
229
|
-
collapsed ? "xl:
|
|
229
|
+
collapsed ? "xl:px-3" : "xl:px-4"
|
|
230
230
|
].join(" "),
|
|
231
|
+
initial: false,
|
|
232
|
+
animate: { width: collapsed ? 112 : 288 },
|
|
233
|
+
transition: { type: "spring", stiffness: 260, damping: 30, mass: 0.9 },
|
|
234
|
+
style: { width: collapsed ? 112 : 288 },
|
|
231
235
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
232
236
|
SidebarInner,
|
|
233
237
|
{
|
|
@@ -246,7 +250,16 @@ function Sidebar({
|
|
|
246
250
|
)
|
|
247
251
|
}
|
|
248
252
|
),
|
|
249
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
254
|
+
import_framer_motion.motion.div,
|
|
255
|
+
{
|
|
256
|
+
className: "hidden xl:block",
|
|
257
|
+
initial: false,
|
|
258
|
+
animate: { width: collapsed ? 112 : 288 },
|
|
259
|
+
transition: { type: "spring", stiffness: 260, damping: 30, mass: 0.9 },
|
|
260
|
+
style: { width: collapsed ? 112 : 288 }
|
|
261
|
+
}
|
|
262
|
+
),
|
|
250
263
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { children: drawerOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_framer_motion.motion.div, { className: "fixed inset-0 z-40 xl:hidden", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: [
|
|
251
264
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 bg-black/40" }),
|
|
252
265
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -315,10 +328,21 @@ function SidebarInner({
|
|
|
315
328
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between px-1", children: [
|
|
316
329
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Button.default, { unstyled: true, type: "button", className: "flex items-center gap-3", title: "Ir al inicio", children: [
|
|
317
330
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-2xl font-black tracking-tight", children: brandInitials }),
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { initial: false, children: !collapsed && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
332
|
+
import_framer_motion.motion.div,
|
|
333
|
+
{
|
|
334
|
+
initial: { opacity: 0, x: -6 },
|
|
335
|
+
animate: { opacity: 1, x: 0 },
|
|
336
|
+
exit: { opacity: 0, x: -6 },
|
|
337
|
+
transition: { duration: 0.15 },
|
|
338
|
+
className: "leading-tight",
|
|
339
|
+
children: [
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-lg font-semibold tracking-tight", children: brandTitle }),
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-[11px] uppercase tracking-wide text-slate-400 text-left", children: brandSubtitle })
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
"brand-meta"
|
|
345
|
+
) })
|
|
322
346
|
] }),
|
|
323
347
|
!mobile && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
324
348
|
import_Button.default,
|
|
@@ -329,7 +353,7 @@ function SidebarInner({
|
|
|
329
353
|
variant: "ghost",
|
|
330
354
|
size: "sm",
|
|
331
355
|
leftIcon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_iconos.ChevronLeftRightIcon, { collapsed: collapsed != null ? collapsed : false }),
|
|
332
|
-
className: "hidden xl:inline-flex h-8 w-8 p-0 !gap-0 rounded-xl border border-slate-200 bg-white text-slate-700 shadow-sm hover:bg-slate-50 dark:border-white/10 dark:bg-white/5 dark:text-slate-200",
|
|
356
|
+
className: "hidden xl:inline-flex h-8 w-8 p-0 !gap-0 rounded-xl border border-slate-200 bg-white text-slate-700 shadow-sm hover:bg-slate-50 active:scale-[0.98] dark:border-white/10 dark:bg-white/5 dark:text-slate-200",
|
|
333
357
|
title: collapsed ? "Expandir" : "Contraer"
|
|
334
358
|
}
|
|
335
359
|
)
|
package/dist/Sidebar.mjs
CHANGED
|
@@ -189,12 +189,16 @@ function Sidebar({
|
|
|
189
189
|
] })
|
|
190
190
|
] }),
|
|
191
191
|
/* @__PURE__ */ jsx(
|
|
192
|
-
|
|
192
|
+
motion.aside,
|
|
193
193
|
{
|
|
194
194
|
className: [
|
|
195
195
|
"hidden xl:fixed xl:inset-y-0 xl:flex xl:flex-col xl:border-r xl:border-black/5 bg-white xl:py-6 dark:bg-[var(--fx-surface)] z-40",
|
|
196
|
-
collapsed ? "xl:
|
|
196
|
+
collapsed ? "xl:px-3" : "xl:px-4"
|
|
197
197
|
].join(" "),
|
|
198
|
+
initial: false,
|
|
199
|
+
animate: { width: collapsed ? 112 : 288 },
|
|
200
|
+
transition: { type: "spring", stiffness: 260, damping: 30, mass: 0.9 },
|
|
201
|
+
style: { width: collapsed ? 112 : 288 },
|
|
198
202
|
children: /* @__PURE__ */ jsx(
|
|
199
203
|
SidebarInner,
|
|
200
204
|
{
|
|
@@ -213,7 +217,16 @@ function Sidebar({
|
|
|
213
217
|
)
|
|
214
218
|
}
|
|
215
219
|
),
|
|
216
|
-
/* @__PURE__ */ jsx(
|
|
220
|
+
/* @__PURE__ */ jsx(
|
|
221
|
+
motion.div,
|
|
222
|
+
{
|
|
223
|
+
className: "hidden xl:block",
|
|
224
|
+
initial: false,
|
|
225
|
+
animate: { width: collapsed ? 112 : 288 },
|
|
226
|
+
transition: { type: "spring", stiffness: 260, damping: 30, mass: 0.9 },
|
|
227
|
+
style: { width: collapsed ? 112 : 288 }
|
|
228
|
+
}
|
|
229
|
+
),
|
|
217
230
|
/* @__PURE__ */ jsx(AnimatePresence, { children: drawerOpen && /* @__PURE__ */ jsxs(motion.div, { className: "fixed inset-0 z-40 xl:hidden", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: [
|
|
218
231
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/40" }),
|
|
219
232
|
/* @__PURE__ */ jsxs(
|
|
@@ -282,10 +295,21 @@ function SidebarInner({
|
|
|
282
295
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-1", children: [
|
|
283
296
|
/* @__PURE__ */ jsxs(Button, { unstyled: true, type: "button", className: "flex items-center gap-3", title: "Ir al inicio", children: [
|
|
284
297
|
/* @__PURE__ */ jsx("div", { className: "text-2xl font-black tracking-tight", children: brandInitials }),
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
298
|
+
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: !collapsed && /* @__PURE__ */ jsxs(
|
|
299
|
+
motion.div,
|
|
300
|
+
{
|
|
301
|
+
initial: { opacity: 0, x: -6 },
|
|
302
|
+
animate: { opacity: 1, x: 0 },
|
|
303
|
+
exit: { opacity: 0, x: -6 },
|
|
304
|
+
transition: { duration: 0.15 },
|
|
305
|
+
className: "leading-tight",
|
|
306
|
+
children: [
|
|
307
|
+
/* @__PURE__ */ jsx("div", { className: "text-lg font-semibold tracking-tight", children: brandTitle }),
|
|
308
|
+
/* @__PURE__ */ jsx("div", { className: "text-[11px] uppercase tracking-wide text-slate-400 text-left", children: brandSubtitle })
|
|
309
|
+
]
|
|
310
|
+
},
|
|
311
|
+
"brand-meta"
|
|
312
|
+
) })
|
|
289
313
|
] }),
|
|
290
314
|
!mobile && /* @__PURE__ */ jsx(
|
|
291
315
|
Button,
|
|
@@ -296,7 +320,7 @@ function SidebarInner({
|
|
|
296
320
|
variant: "ghost",
|
|
297
321
|
size: "sm",
|
|
298
322
|
leftIcon: /* @__PURE__ */ jsx(ChevronLeftRightIcon, { collapsed: collapsed != null ? collapsed : false }),
|
|
299
|
-
className: "hidden xl:inline-flex h-8 w-8 p-0 !gap-0 rounded-xl border border-slate-200 bg-white text-slate-700 shadow-sm hover:bg-slate-50 dark:border-white/10 dark:bg-white/5 dark:text-slate-200",
|
|
323
|
+
className: "hidden xl:inline-flex h-8 w-8 p-0 !gap-0 rounded-xl border border-slate-200 bg-white text-slate-700 shadow-sm hover:bg-slate-50 active:scale-[0.98] dark:border-white/10 dark:bg-white/5 dark:text-slate-200",
|
|
300
324
|
title: collapsed ? "Expandir" : "Contraer"
|
|
301
325
|
}
|
|
302
326
|
)
|
package/dist/iconos/index.js
CHANGED
|
@@ -405,20 +405,10 @@ const CloseIcon = () => {
|
|
|
405
405
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 6l12 12M18 6L6 18" }) });
|
|
406
406
|
};
|
|
407
407
|
const ChevronLeftRightIcon = ({ collapsed }) => {
|
|
408
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
409
|
-
"
|
|
410
|
-
{
|
|
411
|
-
|
|
412
|
-
className: `h-5 w-5 transition-transform ${collapsed ? "rotate-180" : ""}`,
|
|
413
|
-
fill: "none",
|
|
414
|
-
stroke: "currentColor",
|
|
415
|
-
strokeWidth: "2",
|
|
416
|
-
children: [
|
|
417
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M9 18l-6-6 6-6" }),
|
|
418
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M15 6l6 6-6 6" })
|
|
419
|
-
]
|
|
420
|
-
}
|
|
421
|
-
);
|
|
408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "4", y: "4", width: "3", height: "16", rx: "1.5" }),
|
|
410
|
+
collapsed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 8l4 4-4 4" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M14 8l-4 4 4 4" })
|
|
411
|
+
] });
|
|
422
412
|
};
|
|
423
413
|
const MenuPuntosVerticalIcon = () => {
|
|
424
414
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: "h-4.5 w-4.5", fill: "currentColor", children: [
|
package/dist/iconos/index.mjs
CHANGED
|
@@ -333,20 +333,10 @@ const CloseIcon = () => {
|
|
|
333
333
|
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M6 6l12 12M18 6L6 18" }) });
|
|
334
334
|
};
|
|
335
335
|
const ChevronLeftRightIcon = ({ collapsed }) => {
|
|
336
|
-
return /* @__PURE__ */ jsxs(
|
|
337
|
-
"
|
|
338
|
-
{
|
|
339
|
-
|
|
340
|
-
className: `h-5 w-5 transition-transform ${collapsed ? "rotate-180" : ""}`,
|
|
341
|
-
fill: "none",
|
|
342
|
-
stroke: "currentColor",
|
|
343
|
-
strokeWidth: "2",
|
|
344
|
-
children: [
|
|
345
|
-
/* @__PURE__ */ jsx("path", { d: "M9 18l-6-6 6-6" }),
|
|
346
|
-
/* @__PURE__ */ jsx("path", { d: "M15 6l6 6-6 6" })
|
|
347
|
-
]
|
|
348
|
-
}
|
|
349
|
-
);
|
|
336
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
337
|
+
/* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "3", height: "16", rx: "1.5" }),
|
|
338
|
+
collapsed ? /* @__PURE__ */ jsx("path", { d: "M10 8l4 4-4 4" }) : /* @__PURE__ */ jsx("path", { d: "M14 8l-4 4 4 4" })
|
|
339
|
+
] });
|
|
350
340
|
};
|
|
351
341
|
const MenuPuntosVerticalIcon = () => {
|
|
352
342
|
return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: "h-4.5 w-4.5", fill: "currentColor", children: [
|
package/dist/index.d.mts
CHANGED
|
@@ -50,6 +50,9 @@ export { TimeRange, default as TimeRangeField, TimeRangeFieldProps } from './Tim
|
|
|
50
50
|
export { StepDef, default as Steps, StepsNav } from './Steps.mjs';
|
|
51
51
|
export { Aficionados, AuditarDocumento, Borrar, CajaDeMano, Cajas, Calendario, ChevronLeftRightIcon, CirculoAdvertencia, CirculoExito, CirculoPeligro, CirculoPorDefecto, ClientsIcon, CloseIcon, ContraseniaDeEmailIcon, Cotizaciones, DashboardIcon, Directorio, Edificio, Editar, Empresa, EscaneoFacial, EyeIcon, FlechaAbajo, FlechaArriba, Imagenes, LlamadaTelefonica, LogoutIcon, MarketingDigital, MediosDeComunicacionSocial, MenuIcon, MenuPuntosVerticalIcon, Nota, Ojo, OrdersIcon, PencilIcon, PermsIcon, ProductsIcon, PromoIcon, Retroalimentacion, RolesIcon, Sobre, Tablero, Tarea, Tickets, TrabajoEnEquipo, TrashIcon, UserIcon, UsersIcon, UsuarioProhibidoIcon, Usuarios } from './iconos/index.mjs';
|
|
52
52
|
export { default as ColorPicker, ColorPickerProps } from './ColorPicker.mjs';
|
|
53
|
+
export { default as ThemeProvider, useTheme } from './theme/ThemeProvider.mjs';
|
|
54
|
+
export { default as ThemeScript } from './theme/ThemeScript.mjs';
|
|
55
|
+
export { default as ThemeToggle } from './theme/ThemeToggle.mjs';
|
|
53
56
|
import 'react';
|
|
54
57
|
import 'react/jsx-runtime';
|
|
55
58
|
import 'framer-motion';
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,9 @@ export { TimeRange, default as TimeRangeField, TimeRangeFieldProps } from './Tim
|
|
|
50
50
|
export { StepDef, default as Steps, StepsNav } from './Steps.js';
|
|
51
51
|
export { Aficionados, AuditarDocumento, Borrar, CajaDeMano, Cajas, Calendario, ChevronLeftRightIcon, CirculoAdvertencia, CirculoExito, CirculoPeligro, CirculoPorDefecto, ClientsIcon, CloseIcon, ContraseniaDeEmailIcon, Cotizaciones, DashboardIcon, Directorio, Edificio, Editar, Empresa, EscaneoFacial, EyeIcon, FlechaAbajo, FlechaArriba, Imagenes, LlamadaTelefonica, LogoutIcon, MarketingDigital, MediosDeComunicacionSocial, MenuIcon, MenuPuntosVerticalIcon, Nota, Ojo, OrdersIcon, PencilIcon, PermsIcon, ProductsIcon, PromoIcon, Retroalimentacion, RolesIcon, Sobre, Tablero, Tarea, Tickets, TrabajoEnEquipo, TrashIcon, UserIcon, UsersIcon, UsuarioProhibidoIcon, Usuarios } from './iconos/index.js';
|
|
52
52
|
export { default as ColorPicker, ColorPickerProps } from './ColorPicker.js';
|
|
53
|
+
export { default as ThemeProvider, useTheme } from './theme/ThemeProvider.js';
|
|
54
|
+
export { default as ThemeScript } from './theme/ThemeScript.js';
|
|
55
|
+
export { default as ThemeToggle } from './theme/ThemeToggle.js';
|
|
53
56
|
import 'react';
|
|
54
57
|
import 'react/jsx-runtime';
|
|
55
58
|
import 'framer-motion';
|
package/dist/index.js
CHANGED
|
@@ -80,6 +80,9 @@ __export(index_exports, {
|
|
|
80
80
|
Td: () => import_Table.Td,
|
|
81
81
|
Textarea: () => import_Textarea.default,
|
|
82
82
|
Th: () => import_Table.Th,
|
|
83
|
+
ThemeProvider: () => import_ThemeProvider.default,
|
|
84
|
+
ThemeScript: () => import_ThemeScript.default,
|
|
85
|
+
ThemeToggle: () => import_ThemeToggle.default,
|
|
83
86
|
TimeAgo: () => import_TimeAgo.default,
|
|
84
87
|
TimePanel: () => import_TimePanel.default,
|
|
85
88
|
TimePopover: () => import_TimePopover.default,
|
|
@@ -89,6 +92,7 @@ __export(index_exports, {
|
|
|
89
92
|
TopImpresionesBar: () => import_AnalyticsCharts.TopImpresionesBar,
|
|
90
93
|
UploadCard: () => import_UploadCard.default,
|
|
91
94
|
WeekPopover: () => import_TimePopover2.WeekPopover,
|
|
95
|
+
useTheme: () => import_ThemeProvider.useTheme,
|
|
92
96
|
useToast: () => import_Toast.useToast
|
|
93
97
|
});
|
|
94
98
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -149,6 +153,9 @@ var import_Steps = __toESM(require("./Steps"));
|
|
|
149
153
|
var import_Steps2 = require("./Steps");
|
|
150
154
|
__reExport(index_exports, require("./iconos"), module.exports);
|
|
151
155
|
var import_ColorPicker = __toESM(require("./ColorPicker"));
|
|
156
|
+
var import_ThemeProvider = __toESM(require("./theme/ThemeProvider"));
|
|
157
|
+
var import_ThemeScript = __toESM(require("./theme/ThemeScript"));
|
|
158
|
+
var import_ThemeToggle = __toESM(require("./theme/ThemeToggle"));
|
|
152
159
|
// Annotate the CommonJS export names for ESM import in node:
|
|
153
160
|
0 && (module.exports = {
|
|
154
161
|
ActionIconButton,
|
|
@@ -202,6 +209,9 @@ var import_ColorPicker = __toESM(require("./ColorPicker"));
|
|
|
202
209
|
Td,
|
|
203
210
|
Textarea,
|
|
204
211
|
Th,
|
|
212
|
+
ThemeProvider,
|
|
213
|
+
ThemeScript,
|
|
214
|
+
ThemeToggle,
|
|
205
215
|
TimeAgo,
|
|
206
216
|
TimePanel,
|
|
207
217
|
TimePopover,
|
|
@@ -211,6 +221,7 @@ var import_ColorPicker = __toESM(require("./ColorPicker"));
|
|
|
211
221
|
TopImpresionesBar,
|
|
212
222
|
UploadCard,
|
|
213
223
|
WeekPopover,
|
|
224
|
+
useTheme,
|
|
214
225
|
useToast,
|
|
215
226
|
...require("./Dialog"),
|
|
216
227
|
...require("./Dropdown"),
|
package/dist/index.mjs
CHANGED
|
@@ -55,6 +55,9 @@ import { default as default47 } from "./Steps";
|
|
|
55
55
|
import { StepsNav } from "./Steps";
|
|
56
56
|
export * from "./iconos";
|
|
57
57
|
import { default as default48 } from "./ColorPicker";
|
|
58
|
+
import { default as default49, useTheme } from "./theme/ThemeProvider";
|
|
59
|
+
import { default as default50 } from "./theme/ThemeScript";
|
|
60
|
+
import { default as default51 } from "./theme/ThemeToggle";
|
|
58
61
|
export {
|
|
59
62
|
default3 as ActionIconButton,
|
|
60
63
|
AnimatedBody,
|
|
@@ -107,6 +110,9 @@ export {
|
|
|
107
110
|
Td,
|
|
108
111
|
default5 as Textarea,
|
|
109
112
|
Th,
|
|
113
|
+
default49 as ThemeProvider,
|
|
114
|
+
default50 as ThemeScript,
|
|
115
|
+
default51 as ThemeToggle,
|
|
110
116
|
default28 as TimeAgo,
|
|
111
117
|
default45 as TimePanel,
|
|
112
118
|
default44 as TimePopover,
|
|
@@ -116,5 +122,6 @@ export {
|
|
|
116
122
|
TopImpresionesBar,
|
|
117
123
|
default18 as UploadCard,
|
|
118
124
|
WeekPopover,
|
|
125
|
+
useTheme,
|
|
119
126
|
useToast
|
|
120
127
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type Theme = "light" | "dark" | "system";
|
|
5
|
+
type ThemeContextValue = {
|
|
6
|
+
theme: Theme;
|
|
7
|
+
isDark: boolean;
|
|
8
|
+
setTheme: (next: Theme) => void;
|
|
9
|
+
toggle: () => void;
|
|
10
|
+
};
|
|
11
|
+
declare function ThemeProvider({ children, defaultTheme, storageKey, }: {
|
|
12
|
+
children: React__default.ReactNode;
|
|
13
|
+
defaultTheme?: Theme;
|
|
14
|
+
storageKey?: string;
|
|
15
|
+
}): react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare function useTheme(): ThemeContextValue;
|
|
17
|
+
|
|
18
|
+
export { type Theme, ThemeProvider, ThemeProvider as default, useTheme };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type Theme = "light" | "dark" | "system";
|
|
5
|
+
type ThemeContextValue = {
|
|
6
|
+
theme: Theme;
|
|
7
|
+
isDark: boolean;
|
|
8
|
+
setTheme: (next: Theme) => void;
|
|
9
|
+
toggle: () => void;
|
|
10
|
+
};
|
|
11
|
+
declare function ThemeProvider({ children, defaultTheme, storageKey, }: {
|
|
12
|
+
children: React__default.ReactNode;
|
|
13
|
+
defaultTheme?: Theme;
|
|
14
|
+
storageKey?: string;
|
|
15
|
+
}): react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare function useTheme(): ThemeContextValue;
|
|
17
|
+
|
|
18
|
+
export { type Theme, ThemeProvider, ThemeProvider as default, useTheme };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var ThemeProvider_exports = {};
|
|
21
|
+
__export(ThemeProvider_exports, {
|
|
22
|
+
ThemeProvider: () => ThemeProvider,
|
|
23
|
+
default: () => ThemeProvider_default,
|
|
24
|
+
useTheme: () => useTheme
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(ThemeProvider_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
const ThemeContext = (0, import_react.createContext)(null);
|
|
30
|
+
const STORAGE_KEY = "theme";
|
|
31
|
+
function computeIsDark(pref) {
|
|
32
|
+
if (pref === "dark") return true;
|
|
33
|
+
if (pref === "light") return false;
|
|
34
|
+
return typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
35
|
+
}
|
|
36
|
+
function applyThemeToDocument(pref) {
|
|
37
|
+
if (typeof document === "undefined") return;
|
|
38
|
+
const doc = document.documentElement;
|
|
39
|
+
doc.dataset.theme = pref;
|
|
40
|
+
const isDark = computeIsDark(pref);
|
|
41
|
+
doc.classList.toggle("dark", isDark);
|
|
42
|
+
doc.style.colorScheme = isDark ? "dark" : "light";
|
|
43
|
+
}
|
|
44
|
+
function ThemeProvider({
|
|
45
|
+
children,
|
|
46
|
+
defaultTheme = "system",
|
|
47
|
+
storageKey = STORAGE_KEY
|
|
48
|
+
}) {
|
|
49
|
+
const [theme, setThemeState] = (0, import_react.useState)(() => {
|
|
50
|
+
var _a;
|
|
51
|
+
if (typeof window === "undefined") return defaultTheme;
|
|
52
|
+
const stored = (_a = window.localStorage.getItem(storageKey)) != null ? _a : null;
|
|
53
|
+
return stored != null ? stored : defaultTheme;
|
|
54
|
+
});
|
|
55
|
+
const [isDark, setIsDark] = (0, import_react.useState)(() => computeIsDark(theme));
|
|
56
|
+
(0, import_react.useEffect)(() => {
|
|
57
|
+
applyThemeToDocument(theme);
|
|
58
|
+
setIsDark(computeIsDark(theme));
|
|
59
|
+
try {
|
|
60
|
+
window.localStorage.setItem(storageKey, theme);
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
}, [theme, storageKey]);
|
|
64
|
+
(0, import_react.useEffect)(() => {
|
|
65
|
+
var _a;
|
|
66
|
+
if (typeof window === "undefined") return;
|
|
67
|
+
const mql = window.matchMedia("(prefers-color-scheme: dark)");
|
|
68
|
+
const handler = () => {
|
|
69
|
+
if (theme === "system") {
|
|
70
|
+
applyThemeToDocument("system");
|
|
71
|
+
setIsDark(computeIsDark("system"));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
(_a = mql.addEventListener) == null ? void 0 : _a.call(mql, "change", handler);
|
|
75
|
+
return () => {
|
|
76
|
+
var _a2;
|
|
77
|
+
return (_a2 = mql.removeEventListener) == null ? void 0 : _a2.call(mql, "change", handler);
|
|
78
|
+
};
|
|
79
|
+
}, [theme]);
|
|
80
|
+
const setTheme = (0, import_react.useCallback)((next) => {
|
|
81
|
+
setThemeState(next);
|
|
82
|
+
}, []);
|
|
83
|
+
const toggle = (0, import_react.useCallback)(() => {
|
|
84
|
+
setThemeState((prev) => computeIsDark(prev) ? "light" : "dark");
|
|
85
|
+
}, []);
|
|
86
|
+
const value = (0, import_react.useMemo)(() => ({ theme, isDark, setTheme, toggle }), [theme, isDark, setTheme, toggle]);
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext.Provider, { value, children });
|
|
88
|
+
}
|
|
89
|
+
function useTheme() {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
const ctx = (0, import_react.useContext)(ThemeContext);
|
|
92
|
+
if (!ctx) {
|
|
93
|
+
const doc = typeof document !== "undefined" ? document.documentElement : null;
|
|
94
|
+
const attr = (_b = (_a = doc == null ? void 0 : doc.dataset) == null ? void 0 : _a.theme) != null ? _b : "system";
|
|
95
|
+
return {
|
|
96
|
+
theme: attr,
|
|
97
|
+
isDark: doc ? doc.classList.contains("dark") : false,
|
|
98
|
+
setTheme: (t) => applyThemeToDocument(t),
|
|
99
|
+
toggle: () => applyThemeToDocument(attr === "dark" ? "light" : "dark")
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return ctx;
|
|
103
|
+
}
|
|
104
|
+
var ThemeProvider_default = ThemeProvider;
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {
|
|
107
|
+
ThemeProvider,
|
|
108
|
+
useTheme
|
|
109
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
4
|
+
const ThemeContext = createContext(null);
|
|
5
|
+
const STORAGE_KEY = "theme";
|
|
6
|
+
function computeIsDark(pref) {
|
|
7
|
+
if (pref === "dark") return true;
|
|
8
|
+
if (pref === "light") return false;
|
|
9
|
+
return typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
10
|
+
}
|
|
11
|
+
function applyThemeToDocument(pref) {
|
|
12
|
+
if (typeof document === "undefined") return;
|
|
13
|
+
const doc = document.documentElement;
|
|
14
|
+
doc.dataset.theme = pref;
|
|
15
|
+
const isDark = computeIsDark(pref);
|
|
16
|
+
doc.classList.toggle("dark", isDark);
|
|
17
|
+
doc.style.colorScheme = isDark ? "dark" : "light";
|
|
18
|
+
}
|
|
19
|
+
function ThemeProvider({
|
|
20
|
+
children,
|
|
21
|
+
defaultTheme = "system",
|
|
22
|
+
storageKey = STORAGE_KEY
|
|
23
|
+
}) {
|
|
24
|
+
const [theme, setThemeState] = useState(() => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (typeof window === "undefined") return defaultTheme;
|
|
27
|
+
const stored = (_a = window.localStorage.getItem(storageKey)) != null ? _a : null;
|
|
28
|
+
return stored != null ? stored : defaultTheme;
|
|
29
|
+
});
|
|
30
|
+
const [isDark, setIsDark] = useState(() => computeIsDark(theme));
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
applyThemeToDocument(theme);
|
|
33
|
+
setIsDark(computeIsDark(theme));
|
|
34
|
+
try {
|
|
35
|
+
window.localStorage.setItem(storageKey, theme);
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
}, [theme, storageKey]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
var _a;
|
|
41
|
+
if (typeof window === "undefined") return;
|
|
42
|
+
const mql = window.matchMedia("(prefers-color-scheme: dark)");
|
|
43
|
+
const handler = () => {
|
|
44
|
+
if (theme === "system") {
|
|
45
|
+
applyThemeToDocument("system");
|
|
46
|
+
setIsDark(computeIsDark("system"));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
(_a = mql.addEventListener) == null ? void 0 : _a.call(mql, "change", handler);
|
|
50
|
+
return () => {
|
|
51
|
+
var _a2;
|
|
52
|
+
return (_a2 = mql.removeEventListener) == null ? void 0 : _a2.call(mql, "change", handler);
|
|
53
|
+
};
|
|
54
|
+
}, [theme]);
|
|
55
|
+
const setTheme = useCallback((next) => {
|
|
56
|
+
setThemeState(next);
|
|
57
|
+
}, []);
|
|
58
|
+
const toggle = useCallback(() => {
|
|
59
|
+
setThemeState((prev) => computeIsDark(prev) ? "light" : "dark");
|
|
60
|
+
}, []);
|
|
61
|
+
const value = useMemo(() => ({ theme, isDark, setTheme, toggle }), [theme, isDark, setTheme, toggle]);
|
|
62
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children });
|
|
63
|
+
}
|
|
64
|
+
function useTheme() {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const ctx = useContext(ThemeContext);
|
|
67
|
+
if (!ctx) {
|
|
68
|
+
const doc = typeof document !== "undefined" ? document.documentElement : null;
|
|
69
|
+
const attr = (_b = (_a = doc == null ? void 0 : doc.dataset) == null ? void 0 : _a.theme) != null ? _b : "system";
|
|
70
|
+
return {
|
|
71
|
+
theme: attr,
|
|
72
|
+
isDark: doc ? doc.classList.contains("dark") : false,
|
|
73
|
+
setTheme: (t) => applyThemeToDocument(t),
|
|
74
|
+
toggle: () => applyThemeToDocument(attr === "dark" ? "light" : "dark")
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return ctx;
|
|
78
|
+
}
|
|
79
|
+
var ThemeProvider_default = ThemeProvider;
|
|
80
|
+
export {
|
|
81
|
+
ThemeProvider,
|
|
82
|
+
ThemeProvider_default as default,
|
|
83
|
+
useTheme
|
|
84
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ThemeScript_exports = {};
|
|
20
|
+
__export(ThemeScript_exports, {
|
|
21
|
+
ThemeScript: () => ThemeScript,
|
|
22
|
+
default: () => ThemeScript_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ThemeScript_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
const INIT_SNIPPET = `!function(){try{var d=document.documentElement;var pref=localStorage.getItem('theme')||'system';d.dataset.theme=pref;var m=window.matchMedia('(prefers-color-scheme: dark)');var isDark=(pref==='dark')||(pref==='system'&&m.matches);d.classList.toggle('dark',isDark);d.style.colorScheme=isDark?'dark':'light'}catch(e){}}();`;
|
|
27
|
+
function ThemeScript({ id = "ui-lib-theme-init" }) {
|
|
28
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", { id, dangerouslySetInnerHTML: { __html: INIT_SNIPPET } });
|
|
29
|
+
}
|
|
30
|
+
var ThemeScript_default = ThemeScript;
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
ThemeScript
|
|
34
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const INIT_SNIPPET = `!function(){try{var d=document.documentElement;var pref=localStorage.getItem('theme')||'system';d.dataset.theme=pref;var m=window.matchMedia('(prefers-color-scheme: dark)');var isDark=(pref==='dark')||(pref==='system'&&m.matches);d.classList.toggle('dark',isDark);d.style.colorScheme=isDark?'dark':'light'}catch(e){}}();`;
|
|
3
|
+
function ThemeScript({ id = "ui-lib-theme-init" }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("script", { id, dangerouslySetInnerHTML: { __html: INIT_SNIPPET } });
|
|
5
|
+
}
|
|
6
|
+
var ThemeScript_default = ThemeScript;
|
|
7
|
+
export {
|
|
8
|
+
ThemeScript,
|
|
9
|
+
ThemeScript_default as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type ThemeToggleProps = {
|
|
4
|
+
cycle?: ("light" | "dark" | "system")[];
|
|
5
|
+
className?: string;
|
|
6
|
+
labels?: Partial<Record<"light" | "dark" | "system", string>>;
|
|
7
|
+
};
|
|
8
|
+
declare function ThemeToggle({ cycle, className, labels }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { type ThemeToggleProps, ThemeToggle as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type ThemeToggleProps = {
|
|
4
|
+
cycle?: ("light" | "dark" | "system")[];
|
|
5
|
+
className?: string;
|
|
6
|
+
labels?: Partial<Record<"light" | "dark" | "system", string>>;
|
|
7
|
+
};
|
|
8
|
+
declare function ThemeToggle({ cycle, className, labels }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { type ThemeToggleProps, ThemeToggle as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var ThemeToggle_exports = {};
|
|
21
|
+
__export(ThemeToggle_exports, {
|
|
22
|
+
default: () => ThemeToggle
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ThemeToggle_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_ThemeProvider = require("./ThemeProvider");
|
|
27
|
+
const defaultCycle = ["light", "dark", "system"];
|
|
28
|
+
function ThemeToggle({ cycle = defaultCycle, className, labels }) {
|
|
29
|
+
var _a;
|
|
30
|
+
const { theme, setTheme, isDark } = (0, import_ThemeProvider.useTheme)();
|
|
31
|
+
const handleClick = () => {
|
|
32
|
+
const idx = cycle.indexOf(theme);
|
|
33
|
+
const next = cycle[(idx + 1) % cycle.length];
|
|
34
|
+
setTheme(next);
|
|
35
|
+
};
|
|
36
|
+
const text = (_a = labels == null ? void 0 : labels[theme]) != null ? _a : theme === "system" ? "Sistema" : theme === "dark" ? "Oscuro" : "Claro";
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
38
|
+
"button",
|
|
39
|
+
{
|
|
40
|
+
type: "button",
|
|
41
|
+
onClick: handleClick,
|
|
42
|
+
"aria-label": `Cambiar tema (actual: ${text})`,
|
|
43
|
+
title: `Cambiar tema (actual: ${text})`,
|
|
44
|
+
className: [
|
|
45
|
+
"inline-flex items-center gap-2 rounded-xl px-3 py-1.5 text-sm font-medium",
|
|
46
|
+
"border border-slate-200 bg-white shadow-sm transition hover:bg-slate-50",
|
|
47
|
+
"dark:border-white/10 dark:bg-white/10 dark:hover:bg-white/15",
|
|
48
|
+
className != null ? className : ""
|
|
49
|
+
].join(" "),
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "h-4 w-4 rounded-full " + (isDark ? "bg-slate-100" : "bg-slate-900") }),
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-slate-700 dark:text-slate-200", children: text })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useTheme } from "./ThemeProvider";
|
|
4
|
+
const defaultCycle = ["light", "dark", "system"];
|
|
5
|
+
function ThemeToggle({ cycle = defaultCycle, className, labels }) {
|
|
6
|
+
var _a;
|
|
7
|
+
const { theme, setTheme, isDark } = useTheme();
|
|
8
|
+
const handleClick = () => {
|
|
9
|
+
const idx = cycle.indexOf(theme);
|
|
10
|
+
const next = cycle[(idx + 1) % cycle.length];
|
|
11
|
+
setTheme(next);
|
|
12
|
+
};
|
|
13
|
+
const text = (_a = labels == null ? void 0 : labels[theme]) != null ? _a : theme === "system" ? "Sistema" : theme === "dark" ? "Oscuro" : "Claro";
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
15
|
+
"button",
|
|
16
|
+
{
|
|
17
|
+
type: "button",
|
|
18
|
+
onClick: handleClick,
|
|
19
|
+
"aria-label": `Cambiar tema (actual: ${text})`,
|
|
20
|
+
title: `Cambiar tema (actual: ${text})`,
|
|
21
|
+
className: [
|
|
22
|
+
"inline-flex items-center gap-2 rounded-xl px-3 py-1.5 text-sm font-medium",
|
|
23
|
+
"border border-slate-200 bg-white shadow-sm transition hover:bg-slate-50",
|
|
24
|
+
"dark:border-white/10 dark:bg-white/10 dark:hover:bg-white/15",
|
|
25
|
+
className != null ? className : ""
|
|
26
|
+
].join(" "),
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx("span", { className: "h-4 w-4 rounded-full " + (isDark ? "bg-slate-100" : "bg-slate-900") }),
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-700 dark:text-slate-200", children: text })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
ThemeToggle as default
|
|
36
|
+
};
|
package/dist/theme.css
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
@source "./dist/**/*.{js,mjs,jsx,ts,tsx}";
|
|
2
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
3
|
+
|
|
4
|
+
:root {
|
|
5
|
+
color-scheme: light;
|
|
6
|
+
--background: #f6f8fb;
|
|
7
|
+
--surface: #eef2f7;
|
|
8
|
+
--card: #ffffff;
|
|
9
|
+
--foreground: #0f172a;
|
|
10
|
+
--muted: #6b7280;
|
|
11
|
+
--border: #e5e7eb;
|
|
12
|
+
--primary: #111827;
|
|
13
|
+
--primary-foreground: #ffffff;
|
|
14
|
+
--ring: #60a5fa;
|
|
15
|
+
--fx-surface: #ffffff;
|
|
16
|
+
--fg: var(--foreground);
|
|
17
|
+
--card-bg: var(--card);
|
|
18
|
+
--card-border: var(--border);
|
|
19
|
+
--grid: rgba(148, 163, 184, .18);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@theme inline {
|
|
23
|
+
--color-background: var(--background);
|
|
24
|
+
--color-surface: var(--surface);
|
|
25
|
+
--color-card: var(--card);
|
|
26
|
+
--color-foreground: var(--foreground);
|
|
27
|
+
--color-muted: var(--muted);
|
|
28
|
+
--color-border: var(--border);
|
|
29
|
+
--color-primary: var(--primary);
|
|
30
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
31
|
+
--color-ring: var(--ring);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:root[data-theme="dark"],
|
|
35
|
+
html.dark {
|
|
36
|
+
color-scheme: dark;
|
|
37
|
+
--background: #0b0f14;
|
|
38
|
+
--surface: #0f131a;
|
|
39
|
+
--card: #151a22;
|
|
40
|
+
--foreground: #e6edf3;
|
|
41
|
+
--muted: #9aa4b2;
|
|
42
|
+
--border: #242b35;
|
|
43
|
+
--primary: #0f172a;
|
|
44
|
+
--primary-foreground: #ffffff;
|
|
45
|
+
--ring: #60a5fa;
|
|
46
|
+
--fx-surface: #0f131a;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@media (prefers-color-scheme: dark) {
|
|
50
|
+
:root[data-theme="system"] {
|
|
51
|
+
color-scheme: dark;
|
|
52
|
+
--background: #0b0f14;
|
|
53
|
+
--surface: #0f131a;
|
|
54
|
+
--card: #151a22;
|
|
55
|
+
--foreground: #e6edf3;
|
|
56
|
+
--muted: #9aa4b2;
|
|
57
|
+
--border: #242b35;
|
|
58
|
+
--primary: #0f172a;
|
|
59
|
+
--primary-foreground: #ffffff;
|
|
60
|
+
--ring: #60a5fa;
|
|
61
|
+
--fx-surface: #0f131a;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
body {
|
|
66
|
+
background: var(--background);
|
|
67
|
+
color: var(--foreground);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
* {
|
|
71
|
+
outline-color: var(--ring);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
::selection {
|
|
75
|
+
background: color-mix(in oklab, var(--ring) 30%, transparent);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media print {
|
|
79
|
+
.no-print {
|
|
80
|
+
display: none !important;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
html,
|
|
84
|
+
body {
|
|
85
|
+
background: var(--background);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.print-snapshot *,
|
|
90
|
+
.print-snapshot *::before,
|
|
91
|
+
.print-snapshot *::after {
|
|
92
|
+
-webkit-font-smoothing: antialiased;
|
|
93
|
+
-moz-osx-font-smoothing: grayscale;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.print-snapshot .sticky {
|
|
97
|
+
position: static !important;
|
|
98
|
+
top: auto !important;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.print-snapshot .shadow,
|
|
102
|
+
.print-snapshot .shadow-sm,
|
|
103
|
+
.print-snapshot .shadow-md,
|
|
104
|
+
.print-snapshot .shadow-lg {
|
|
105
|
+
box-shadow: none !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.print-snapshot .overflow-auto,
|
|
109
|
+
.print-snapshot .overflow-x-auto,
|
|
110
|
+
.print-snapshot .overflow-y-auto {
|
|
111
|
+
overflow: visible !important;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.print-snapshot .pointer-events-none {
|
|
115
|
+
pointer-events: auto;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.print-snapshot .group:hover .group-hover\:opacity-100 {
|
|
119
|
+
opacity: 1 !important;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.print-snapshot .transition-opacity,
|
|
123
|
+
.print-snapshot .transition-colors,
|
|
124
|
+
.print-snapshot .transition {
|
|
125
|
+
transition: none !important;
|
|
126
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framepexls-ui-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Componentes UI de Framepexls para React/Next.",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"import": "./dist/index.mjs",
|
|
14
14
|
"require": "./dist/index.js"
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
"./theme.css": "./dist/theme.css"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"dist",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"typescript": "^5.9.3"
|
|
49
50
|
},
|
|
50
51
|
"scripts": {
|
|
51
|
-
"build": "tsup",
|
|
52
|
+
"build": "tsup && node scripts/copy-css.mjs",
|
|
52
53
|
"dev": "tsup --watch",
|
|
53
54
|
"prepare": "npm run build"
|
|
54
55
|
},
|