framepexls-ui-lib 0.2.8 → 0.2.10
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/AppTopbar.js +1 -1
- package/dist/AppTopbar.mjs +1 -1
- package/dist/AvatarGroup.js +7 -2
- package/dist/AvatarGroup.mjs +7 -2
- package/dist/Badge.js +6 -1
- package/dist/Badge.mjs +6 -1
- package/dist/BadgeCluster.js +1 -1
- package/dist/BadgeCluster.mjs +1 -1
- package/dist/Breadcrumb.js +46 -2
- package/dist/Breadcrumb.mjs +46 -2
- package/dist/Button.js +8 -2
- package/dist/Button.mjs +8 -2
- package/dist/CalendarPanel.js +45 -26
- package/dist/CalendarPanel.mjs +45 -26
- package/dist/Card.js +7 -2
- package/dist/Card.mjs +7 -2
- package/dist/Checkbox.js +51 -18
- package/dist/Checkbox.mjs +51 -18
- package/dist/ColorPicker.js +9 -4
- package/dist/ColorPicker.mjs +9 -4
- package/dist/ColumnSelector.js +1 -1
- package/dist/ColumnSelector.mjs +1 -1
- package/dist/ComboSelect.js +11 -4
- package/dist/ComboSelect.mjs +11 -4
- package/dist/DateTimeField.js +8 -2
- package/dist/DateTimeField.mjs +8 -2
- package/dist/Dialog.js +2 -2
- package/dist/Dialog.mjs +2 -2
- package/dist/Drawer.js +2 -2
- package/dist/Drawer.mjs +2 -2
- package/dist/Dropdown.js +14 -10
- package/dist/Dropdown.mjs +14 -10
- package/dist/FiltersMultiSelect.js +1 -1
- package/dist/FiltersMultiSelect.mjs +1 -1
- package/dist/Input.js +23 -0
- package/dist/Input.mjs +23 -0
- package/dist/KpiCard.js +26 -2
- package/dist/KpiCard.mjs +26 -2
- package/dist/Link.js +16 -2
- package/dist/Link.mjs +16 -2
- package/dist/MediaCard.js +18 -11
- package/dist/MediaCard.mjs +18 -11
- package/dist/MediaSelector.js +9 -8
- package/dist/MediaSelector.mjs +9 -8
- package/dist/MotionProvider.d.mts +9 -0
- package/dist/MotionProvider.d.ts +9 -0
- package/dist/MotionProvider.js +29 -0
- package/dist/MotionProvider.mjs +9 -0
- package/dist/MultiComboSelect.js +6 -4
- package/dist/MultiComboSelect.mjs +6 -4
- package/dist/Pagination.js +65 -29
- package/dist/Pagination.mjs +65 -29
- package/dist/ReviewHistory.js +8 -6
- package/dist/ReviewHistory.mjs +8 -6
- package/dist/SearchInput.js +16 -2
- package/dist/SearchInput.mjs +16 -2
- package/dist/Select.js +12 -5
- package/dist/Select.mjs +12 -5
- package/dist/Sidebar.js +23 -5
- package/dist/Sidebar.mjs +23 -5
- package/dist/StatCard.js +17 -1
- package/dist/StatCard.mjs +19 -3
- package/dist/Steps.js +51 -37
- package/dist/Steps.mjs +51 -37
- package/dist/StorageUsage.js +6 -2
- package/dist/StorageUsage.mjs +6 -2
- package/dist/Table.d.mts +5 -1
- package/dist/Table.d.ts +5 -1
- package/dist/Table.js +31 -4
- package/dist/Table.mjs +30 -4
- package/dist/Textarea.js +42 -17
- package/dist/Textarea.mjs +43 -18
- package/dist/TimePanel.js +1 -1
- package/dist/TimePanel.mjs +1 -1
- package/dist/TimePopover.js +116 -83
- package/dist/TimePopover.mjs +116 -83
- package/dist/TimeRangeField.js +1 -1
- package/dist/TimeRangeField.mjs +1 -1
- package/dist/Toast.js +1 -5
- package/dist/Toast.mjs +1 -5
- package/dist/Tooltip.js +28 -19
- package/dist/Tooltip.mjs +28 -19
- package/dist/UploadCard.js +34 -21
- package/dist/UploadCard.mjs +34 -21
- package/dist/animations-CHrNeawW.d.mts +28 -0
- package/dist/animations-CHrNeawW.d.ts +28 -0
- package/dist/animations.d.mts +2 -0
- package/dist/animations.d.ts +2 -0
- package/dist/animations.js +75 -0
- package/dist/animations.mjs +42 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +8 -0
- package/dist/index.mjs +18 -13
- package/package.json +4 -4
package/dist/Textarea.js
CHANGED
|
@@ -34,6 +34,8 @@ __export(Textarea_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(Textarea_exports);
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_framer_motion = require("framer-motion");
|
|
38
|
+
var import_animations = require("./animations");
|
|
37
39
|
function cx(...a) {
|
|
38
40
|
return a.filter(Boolean).join(" ");
|
|
39
41
|
}
|
|
@@ -55,23 +57,46 @@ const Textarea = import_react.default.forwardRef(
|
|
|
55
57
|
);
|
|
56
58
|
}
|
|
57
59
|
const readOnly = !onChange;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
const [focused, setFocused] = import_react.default.useState(false);
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
"textarea",
|
|
64
|
+
{
|
|
65
|
+
ref,
|
|
66
|
+
value,
|
|
67
|
+
onChange,
|
|
68
|
+
readOnly,
|
|
69
|
+
onFocus: (e) => {
|
|
70
|
+
var _a;
|
|
71
|
+
setFocused(true);
|
|
72
|
+
(_a = props.onFocus) == null ? void 0 : _a.call(props, e);
|
|
73
|
+
},
|
|
74
|
+
onBlur: (e) => {
|
|
75
|
+
var _a;
|
|
76
|
+
setFocused(false);
|
|
77
|
+
(_a = props.onBlur) == null ? void 0 : _a.call(props, e);
|
|
78
|
+
},
|
|
79
|
+
"aria-invalid": error ? true : void 0,
|
|
80
|
+
className: cx(
|
|
81
|
+
baseControl,
|
|
82
|
+
(error || tone === "danger") && errorControl,
|
|
83
|
+
className
|
|
84
|
+
),
|
|
85
|
+
rows,
|
|
86
|
+
...props
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
+
import_framer_motion.motion.span,
|
|
91
|
+
{
|
|
92
|
+
"aria-hidden": true,
|
|
93
|
+
className: "pointer-events-none absolute inset-0 rounded-2xl",
|
|
94
|
+
initial: false,
|
|
95
|
+
animate: { boxShadow: focused ? "0 0 0 2px rgba(59,130,246,0.18)" : "0 0 0 0 rgba(0,0,0,0)" },
|
|
96
|
+
transition: import_animations.microTransition
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] });
|
|
75
100
|
}
|
|
76
101
|
);
|
|
77
102
|
Textarea.displayName = "Textarea";
|
package/dist/Textarea.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import { motion } from "framer-motion";
|
|
5
|
+
import { microTransition } from "./animations";
|
|
4
6
|
function cx(...a) {
|
|
5
7
|
return a.filter(Boolean).join(" ");
|
|
6
8
|
}
|
|
@@ -22,23 +24,46 @@ const Textarea = React.forwardRef(
|
|
|
22
24
|
);
|
|
23
25
|
}
|
|
24
26
|
const readOnly = !onChange;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
const [focused, setFocused] = React.useState(false);
|
|
28
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
"textarea",
|
|
31
|
+
{
|
|
32
|
+
ref,
|
|
33
|
+
value,
|
|
34
|
+
onChange,
|
|
35
|
+
readOnly,
|
|
36
|
+
onFocus: (e) => {
|
|
37
|
+
var _a;
|
|
38
|
+
setFocused(true);
|
|
39
|
+
(_a = props.onFocus) == null ? void 0 : _a.call(props, e);
|
|
40
|
+
},
|
|
41
|
+
onBlur: (e) => {
|
|
42
|
+
var _a;
|
|
43
|
+
setFocused(false);
|
|
44
|
+
(_a = props.onBlur) == null ? void 0 : _a.call(props, e);
|
|
45
|
+
},
|
|
46
|
+
"aria-invalid": error ? true : void 0,
|
|
47
|
+
className: cx(
|
|
48
|
+
baseControl,
|
|
49
|
+
(error || tone === "danger") && errorControl,
|
|
50
|
+
className
|
|
51
|
+
),
|
|
52
|
+
rows,
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
motion.span,
|
|
58
|
+
{
|
|
59
|
+
"aria-hidden": true,
|
|
60
|
+
className: "pointer-events-none absolute inset-0 rounded-2xl",
|
|
61
|
+
initial: false,
|
|
62
|
+
animate: { boxShadow: focused ? "0 0 0 2px rgba(59,130,246,0.18)" : "0 0 0 0 rgba(0,0,0,0)" },
|
|
63
|
+
transition: microTransition
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
42
67
|
}
|
|
43
68
|
);
|
|
44
69
|
Textarea.displayName = "Textarea";
|
package/dist/TimePanel.js
CHANGED
|
@@ -93,7 +93,7 @@ function TimePopover({
|
|
|
93
93
|
ref: popRef,
|
|
94
94
|
style: stylePop,
|
|
95
95
|
"data-dtf-pop": true,
|
|
96
|
-
className: "overflow-hidden rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[
|
|
96
|
+
className: "overflow-hidden rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
97
97
|
children: [
|
|
98
98
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mb-2 text-sm font-medium text-slate-600 dark:text-slate-300", children: "Selecciona hora" }),
|
|
99
99
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
|
package/dist/TimePanel.mjs
CHANGED
|
@@ -60,7 +60,7 @@ function TimePopover({
|
|
|
60
60
|
ref: popRef,
|
|
61
61
|
style: stylePop,
|
|
62
62
|
"data-dtf-pop": true,
|
|
63
|
-
className: "overflow-hidden rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[
|
|
63
|
+
className: "overflow-hidden rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
64
64
|
children: [
|
|
65
65
|
/* @__PURE__ */ jsx("div", { className: "mb-2 text-sm font-medium text-slate-600 dark:text-slate-300", children: "Selecciona hora" }),
|
|
66
66
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
package/dist/TimePopover.js
CHANGED
|
@@ -37,6 +37,8 @@ module.exports = __toCommonJS(TimePopover_exports);
|
|
|
37
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
38
|
var React = __toESM(require("react"));
|
|
39
39
|
var import_react_dom = require("react-dom");
|
|
40
|
+
var import_framer_motion = require("framer-motion");
|
|
41
|
+
var import_animations = require("./animations");
|
|
40
42
|
var import_Button = __toESM(require("./Button"));
|
|
41
43
|
var import_Input = __toESM(require("./Input"));
|
|
42
44
|
const pad2 = (n) => n < 10 ? `0${n}` : String(n);
|
|
@@ -126,8 +128,13 @@ function TimePopover({
|
|
|
126
128
|
return md === "AM" ? h12 : h12 + 12;
|
|
127
129
|
};
|
|
128
130
|
const body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
129
|
-
|
|
131
|
+
import_framer_motion.motion.div,
|
|
130
132
|
{
|
|
133
|
+
variants: import_animations.popOver,
|
|
134
|
+
initial: "initial",
|
|
135
|
+
animate: "animate",
|
|
136
|
+
exit: "exit",
|
|
137
|
+
transition: import_animations.menuTransition,
|
|
131
138
|
ref: popRef,
|
|
132
139
|
role: "dialog",
|
|
133
140
|
"aria-label": "Selector de hora",
|
|
@@ -136,7 +143,7 @@ function TimePopover({
|
|
|
136
143
|
onPointerDownCapture: (e) => e.stopPropagation(),
|
|
137
144
|
onKeyDown,
|
|
138
145
|
style: { position: "fixed", top: pos.top, left: pos.left, zIndex: 1e5 },
|
|
139
|
-
className: "w-64 rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[
|
|
146
|
+
className: "w-64 rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
140
147
|
children: [
|
|
141
148
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mb-2 text-sm font-medium text-slate-700 dark:text-slate-200", children: "Selecciona hora" }),
|
|
142
149
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-2 text-xs text-slate-500 dark:text-slate-300", children: [
|
|
@@ -350,48 +357,61 @@ function WeekPopover({ anchorEl, cursor, value, onCursorChange, onPick, onClose
|
|
|
350
357
|
}
|
|
351
358
|
const selFrom = (_a = value == null ? void 0 : value.from) != null ? _a : null;
|
|
352
359
|
const selTo = (_b = value == null ? void 0 : value.to) != null ? _b : null;
|
|
353
|
-
const body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
),
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
360
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
361
|
+
import_framer_motion.motion.div,
|
|
362
|
+
{
|
|
363
|
+
ref: popRef,
|
|
364
|
+
style: { position: "fixed", top: pos.top, left: pos.left, zIndex: 1e5 },
|
|
365
|
+
variants: import_animations.popOver,
|
|
366
|
+
initial: "initial",
|
|
367
|
+
animate: "animate",
|
|
368
|
+
exit: "exit",
|
|
369
|
+
transition: import_animations.menuTransition,
|
|
370
|
+
className: "w-[340px] rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
371
|
+
children: [
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
373
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
374
|
+
import_Button.default,
|
|
375
|
+
{
|
|
376
|
+
unstyled: true,
|
|
377
|
+
className: "rounded-lg border border-slate-200 px-2 py-1 text-sm hover:bg-slate-50 dark:border-white/10 dark:hover:bg-white/10",
|
|
378
|
+
onClick: () => onCursorChange(new Date(year, month - 1, 1)),
|
|
379
|
+
children: "\u25C0"
|
|
380
|
+
}
|
|
381
|
+
),
|
|
382
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm font-semibold", children: cursor.toLocaleDateString("es-MX", { month: "long", year: "numeric" }) }),
|
|
383
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
384
|
+
import_Button.default,
|
|
385
|
+
{
|
|
386
|
+
unstyled: true,
|
|
387
|
+
className: "rounded-lg border border-slate-200 px-2 py-1 text-sm hover:bg-slate-50 dark:border-white/10 dark:hover:bg-white/10",
|
|
388
|
+
onClick: () => onCursorChange(new Date(year, month + 1, 1)),
|
|
389
|
+
children: "\u25B6"
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
] }),
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid gap-2", children: weeks.map((w, idx) => {
|
|
394
|
+
const isSel = selFrom && selTo && sameDay(selFrom, w.from) && sameDay(selTo, w.to);
|
|
395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
396
|
+
import_Button.default,
|
|
397
|
+
{
|
|
398
|
+
unstyled: true,
|
|
399
|
+
className: `flex items-center justify-between rounded-xl border px-3 py-2 text-sm ${isSel ? "bg-slate-900 text-white border-slate-900 dark:bg-white dark:text-slate-900 dark:border-white" : "border-slate-200 hover:bg-slate-100 dark:border-white/10 dark:hover:bg-white/10"}`,
|
|
400
|
+
onClick: () => onPick(w.from, w.to),
|
|
401
|
+
children: [
|
|
402
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
403
|
+
"Semana ",
|
|
404
|
+
idx + 1
|
|
405
|
+
] }),
|
|
406
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs opacity-80", children: formatWeekLabel(w.from, w.to) })
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
`${w.from.toISOString()}-${w.to.toISOString()}`
|
|
410
|
+
);
|
|
411
|
+
}) })
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
);
|
|
395
415
|
return (0, import_react_dom.createPortal)(body, document.body);
|
|
396
416
|
}
|
|
397
417
|
function sameDay(a, b) {
|
|
@@ -456,45 +476,58 @@ function MonthPopover({ anchorEl, cursor, value, onCursorChange, onPick, onClose
|
|
|
456
476
|
selMonthIdx = ((_a = parts[1]) != null ? _a : 1) - 1;
|
|
457
477
|
}
|
|
458
478
|
}
|
|
459
|
-
const body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
),
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
479
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
480
|
+
import_framer_motion.motion.div,
|
|
481
|
+
{
|
|
482
|
+
ref: popRef,
|
|
483
|
+
style: { position: "fixed", top: pos.top, left: pos.left, zIndex: 1e5 },
|
|
484
|
+
variants: import_animations.popOver,
|
|
485
|
+
initial: "initial",
|
|
486
|
+
animate: "animate",
|
|
487
|
+
exit: "exit",
|
|
488
|
+
transition: import_animations.menuTransition,
|
|
489
|
+
className: "w-[300px] rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
490
|
+
children: [
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
493
|
+
import_Button.default,
|
|
494
|
+
{
|
|
495
|
+
unstyled: true,
|
|
496
|
+
className: "rounded-lg border border-slate-200 px-2 py-1 text-sm hover:bg-slate-50 dark:border-white/10 dark:hover:bg-white/10",
|
|
497
|
+
onClick: () => onCursorChange(new Date(year - 1, 0, 1)),
|
|
498
|
+
children: "\u25C0"
|
|
499
|
+
}
|
|
500
|
+
),
|
|
501
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm font-semibold", children: year }),
|
|
502
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
503
|
+
import_Button.default,
|
|
504
|
+
{
|
|
505
|
+
unstyled: true,
|
|
506
|
+
className: "rounded-lg border border-slate-200 px-2 py-1 text-sm hover:bg-slate-50 dark:border-white/10 dark:hover:bg-white/10",
|
|
507
|
+
onClick: () => onCursorChange(new Date(year + 1, 0, 1)),
|
|
508
|
+
children: "\u25B6"
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
] }),
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-3 gap-2", children: months.map((m, idx) => {
|
|
513
|
+
const isSel = selYear === year && selMonthIdx === idx;
|
|
514
|
+
const base = "rounded-xl border px-2 py-2 text-sm ";
|
|
515
|
+
const light = isSel ? "bg-slate-900 text-white border-slate-900" : "border-slate-200 hover:bg-slate-100";
|
|
516
|
+
const dark = isSel ? "dark:bg-white dark:text-slate-900 dark:border-white" : "dark:border-white/10 dark:hover:bg-white/10";
|
|
517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
518
|
+
import_Button.default,
|
|
519
|
+
{
|
|
520
|
+
unstyled: true,
|
|
521
|
+
className: `${base} ${light} ${dark}`,
|
|
522
|
+
onClick: () => onPick(new Date(year, idx, 1)),
|
|
523
|
+
children: m
|
|
524
|
+
},
|
|
525
|
+
idx
|
|
526
|
+
);
|
|
527
|
+
}) })
|
|
528
|
+
]
|
|
529
|
+
}
|
|
530
|
+
);
|
|
498
531
|
return (0, import_react_dom.createPortal)(body, document.body);
|
|
499
532
|
}
|
|
500
533
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/TimePopover.mjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
|
+
import { motion } from "framer-motion";
|
|
6
|
+
import { popOver, menuTransition } from "./animations";
|
|
5
7
|
import Button from "./Button";
|
|
6
8
|
import Input from "./Input";
|
|
7
9
|
const pad2 = (n) => n < 10 ? `0${n}` : String(n);
|
|
@@ -91,8 +93,13 @@ function TimePopover({
|
|
|
91
93
|
return md === "AM" ? h12 : h12 + 12;
|
|
92
94
|
};
|
|
93
95
|
const body = /* @__PURE__ */ jsxs(
|
|
94
|
-
|
|
96
|
+
motion.div,
|
|
95
97
|
{
|
|
98
|
+
variants: popOver,
|
|
99
|
+
initial: "initial",
|
|
100
|
+
animate: "animate",
|
|
101
|
+
exit: "exit",
|
|
102
|
+
transition: menuTransition,
|
|
96
103
|
ref: popRef,
|
|
97
104
|
role: "dialog",
|
|
98
105
|
"aria-label": "Selector de hora",
|
|
@@ -101,7 +108,7 @@ function TimePopover({
|
|
|
101
108
|
onPointerDownCapture: (e) => e.stopPropagation(),
|
|
102
109
|
onKeyDown,
|
|
103
110
|
style: { position: "fixed", top: pos.top, left: pos.left, zIndex: 1e5 },
|
|
104
|
-
className: "w-64 rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[
|
|
111
|
+
className: "w-64 rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
105
112
|
children: [
|
|
106
113
|
/* @__PURE__ */ jsx("div", { className: "mb-2 text-sm font-medium text-slate-700 dark:text-slate-200", children: "Selecciona hora" }),
|
|
107
114
|
/* @__PURE__ */ jsxs("div", { className: "mb-2 text-xs text-slate-500 dark:text-slate-300", children: [
|
|
@@ -315,48 +322,61 @@ function WeekPopover({ anchorEl, cursor, value, onCursorChange, onPick, onClose
|
|
|
315
322
|
}
|
|
316
323
|
const selFrom = (_a = value == null ? void 0 : value.from) != null ? _a : null;
|
|
317
324
|
const selTo = (_b = value == null ? void 0 : value.to) != null ? _b : null;
|
|
318
|
-
const body = /* @__PURE__ */ jsxs(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
),
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
325
|
+
const body = /* @__PURE__ */ jsxs(
|
|
326
|
+
motion.div,
|
|
327
|
+
{
|
|
328
|
+
ref: popRef,
|
|
329
|
+
style: { position: "fixed", top: pos.top, left: pos.left, zIndex: 1e5 },
|
|
330
|
+
variants: popOver,
|
|
331
|
+
initial: "initial",
|
|
332
|
+
animate: "animate",
|
|
333
|
+
exit: "exit",
|
|
334
|
+
transition: menuTransition,
|
|
335
|
+
className: "w-[340px] rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
338
|
+
/* @__PURE__ */ jsx(
|
|
339
|
+
Button,
|
|
340
|
+
{
|
|
341
|
+
unstyled: true,
|
|
342
|
+
className: "rounded-lg border border-slate-200 px-2 py-1 text-sm hover:bg-slate-50 dark:border-white/10 dark:hover:bg-white/10",
|
|
343
|
+
onClick: () => onCursorChange(new Date(year, month - 1, 1)),
|
|
344
|
+
children: "\u25C0"
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-semibold", children: cursor.toLocaleDateString("es-MX", { month: "long", year: "numeric" }) }),
|
|
348
|
+
/* @__PURE__ */ jsx(
|
|
349
|
+
Button,
|
|
350
|
+
{
|
|
351
|
+
unstyled: true,
|
|
352
|
+
className: "rounded-lg border border-slate-200 px-2 py-1 text-sm hover:bg-slate-50 dark:border-white/10 dark:hover:bg-white/10",
|
|
353
|
+
onClick: () => onCursorChange(new Date(year, month + 1, 1)),
|
|
354
|
+
children: "\u25B6"
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
] }),
|
|
358
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-2", children: weeks.map((w, idx) => {
|
|
359
|
+
const isSel = selFrom && selTo && sameDay(selFrom, w.from) && sameDay(selTo, w.to);
|
|
360
|
+
return /* @__PURE__ */ jsxs(
|
|
361
|
+
Button,
|
|
362
|
+
{
|
|
363
|
+
unstyled: true,
|
|
364
|
+
className: `flex items-center justify-between rounded-xl border px-3 py-2 text-sm ${isSel ? "bg-slate-900 text-white border-slate-900 dark:bg-white dark:text-slate-900 dark:border-white" : "border-slate-200 hover:bg-slate-100 dark:border-white/10 dark:hover:bg-white/10"}`,
|
|
365
|
+
onClick: () => onPick(w.from, w.to),
|
|
366
|
+
children: [
|
|
367
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
368
|
+
"Semana ",
|
|
369
|
+
idx + 1
|
|
370
|
+
] }),
|
|
371
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs opacity-80", children: formatWeekLabel(w.from, w.to) })
|
|
372
|
+
]
|
|
373
|
+
},
|
|
374
|
+
`${w.from.toISOString()}-${w.to.toISOString()}`
|
|
375
|
+
);
|
|
376
|
+
}) })
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
);
|
|
360
380
|
return createPortal(body, document.body);
|
|
361
381
|
}
|
|
362
382
|
function sameDay(a, b) {
|
|
@@ -421,45 +441,58 @@ function MonthPopover({ anchorEl, cursor, value, onCursorChange, onPick, onClose
|
|
|
421
441
|
selMonthIdx = ((_a = parts[1]) != null ? _a : 1) - 1;
|
|
422
442
|
}
|
|
423
443
|
}
|
|
424
|
-
const body = /* @__PURE__ */ jsxs(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
),
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
444
|
+
const body = /* @__PURE__ */ jsxs(
|
|
445
|
+
motion.div,
|
|
446
|
+
{
|
|
447
|
+
ref: popRef,
|
|
448
|
+
style: { position: "fixed", top: pos.top, left: pos.left, zIndex: 1e5 },
|
|
449
|
+
variants: popOver,
|
|
450
|
+
initial: "initial",
|
|
451
|
+
animate: "animate",
|
|
452
|
+
exit: "exit",
|
|
453
|
+
transition: menuTransition,
|
|
454
|
+
className: "w-[300px] rounded-2xl border border-slate-200 bg-white p-3 shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
455
|
+
children: [
|
|
456
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
457
|
+
/* @__PURE__ */ jsx(
|
|
458
|
+
Button,
|
|
459
|
+
{
|
|
460
|
+
unstyled: true,
|
|
461
|
+
className: "rounded-lg border border-slate-200 px-2 py-1 text-sm hover:bg-slate-50 dark:border-white/10 dark:hover:bg-white/10",
|
|
462
|
+
onClick: () => onCursorChange(new Date(year - 1, 0, 1)),
|
|
463
|
+
children: "\u25C0"
|
|
464
|
+
}
|
|
465
|
+
),
|
|
466
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-semibold", children: year }),
|
|
467
|
+
/* @__PURE__ */ jsx(
|
|
468
|
+
Button,
|
|
469
|
+
{
|
|
470
|
+
unstyled: true,
|
|
471
|
+
className: "rounded-lg border border-slate-200 px-2 py-1 text-sm hover:bg-slate-50 dark:border-white/10 dark:hover:bg-white/10",
|
|
472
|
+
onClick: () => onCursorChange(new Date(year + 1, 0, 1)),
|
|
473
|
+
children: "\u25B6"
|
|
474
|
+
}
|
|
475
|
+
)
|
|
476
|
+
] }),
|
|
477
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-3 gap-2", children: months.map((m, idx) => {
|
|
478
|
+
const isSel = selYear === year && selMonthIdx === idx;
|
|
479
|
+
const base = "rounded-xl border px-2 py-2 text-sm ";
|
|
480
|
+
const light = isSel ? "bg-slate-900 text-white border-slate-900" : "border-slate-200 hover:bg-slate-100";
|
|
481
|
+
const dark = isSel ? "dark:bg-white dark:text-slate-900 dark:border-white" : "dark:border-white/10 dark:hover:bg-white/10";
|
|
482
|
+
return /* @__PURE__ */ jsx(
|
|
483
|
+
Button,
|
|
484
|
+
{
|
|
485
|
+
unstyled: true,
|
|
486
|
+
className: `${base} ${light} ${dark}`,
|
|
487
|
+
onClick: () => onPick(new Date(year, idx, 1)),
|
|
488
|
+
children: m
|
|
489
|
+
},
|
|
490
|
+
idx
|
|
491
|
+
);
|
|
492
|
+
}) })
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
);
|
|
463
496
|
return createPortal(body, document.body);
|
|
464
497
|
}
|
|
465
498
|
export {
|