framepexls-ui-lib 0.2.9 → 0.2.11
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/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/ComboSelect.js +11 -4
- package/dist/ComboSelect.mjs +11 -4
- package/dist/DateTimeField.js +8 -2
- package/dist/DateTimeField.mjs +8 -2
- package/dist/Dropdown.js +15 -10
- package/dist/Dropdown.mjs +15 -10
- 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 +10 -0
- package/dist/MotionProvider.d.ts +10 -0
- package/dist/MotionProvider.js +30 -0
- package/dist/MotionProvider.mjs +10 -0
- package/dist/MultiComboSelect.js +6 -4
- package/dist/MultiComboSelect.mjs +6 -4
- package/dist/Pagination.js +66 -29
- package/dist/Pagination.mjs +66 -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 -4
- package/dist/Select.mjs +12 -4
- package/dist/Sidebar.js +20 -2
- package/dist/Sidebar.mjs +20 -2
- 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 +7 -3
- package/dist/StorageUsage.mjs +7 -3
- package/dist/Table.d.mts +5 -1
- package/dist/Table.d.ts +5 -1
- package/dist/Table.js +32 -4
- package/dist/Table.mjs +31 -4
- package/dist/Textarea.js +42 -17
- package/dist/Textarea.mjs +43 -18
- package/dist/TimePopover.js +116 -83
- package/dist/TimePopover.mjs +116 -83
- package/dist/Toast.js +0 -4
- package/dist/Toast.mjs +0 -4
- package/dist/Tooltip.js +29 -19
- package/dist/Tooltip.mjs +29 -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 +1 -1
package/dist/Checkbox.js
CHANGED
|
@@ -34,10 +34,11 @@ __export(Checkbox_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(Checkbox_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");
|
|
37
38
|
function cx(...a) {
|
|
38
39
|
return a.filter(Boolean).join(" ");
|
|
39
40
|
}
|
|
40
|
-
const baseInput = "rounded border border-slate-300
|
|
41
|
+
const baseInput = "appearance-none grid place-items-center rounded border border-slate-300 bg-white shadow-sm outline-none focus:ring-4 focus:ring-blue-300/40 checked:bg-blue-600 checked:border-blue-600 disabled:opacity-60 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/10 dark:checked:bg-blue-500 dark:checked:border-blue-500";
|
|
41
42
|
const sizeMap = {
|
|
42
43
|
sm: "h-4 w-4",
|
|
43
44
|
md: "h-5 w-5",
|
|
@@ -59,6 +60,11 @@ const Checkbox = import_react.default.forwardRef(
|
|
|
59
60
|
}, ref) => {
|
|
60
61
|
const internalId = (0, import_react.useId)();
|
|
61
62
|
const inputRef = (0, import_react.useRef)(null);
|
|
63
|
+
const [animChecked, setAnimChecked] = import_react.default.useState(() => {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
const p = props;
|
|
66
|
+
return Boolean((_b = (_a = p.checked) != null ? _a : p.defaultChecked) != null ? _b : false);
|
|
67
|
+
});
|
|
62
68
|
(0, import_react.useEffect)(() => {
|
|
63
69
|
if (!ref) return;
|
|
64
70
|
if (typeof ref === "function") ref(inputRef.current);
|
|
@@ -67,28 +73,55 @@ const Checkbox = import_react.default.forwardRef(
|
|
|
67
73
|
(0, import_react.useEffect)(() => {
|
|
68
74
|
if (inputRef.current) inputRef.current.indeterminate = !!indeterminate;
|
|
69
75
|
}, [indeterminate]);
|
|
76
|
+
(0, import_react.useEffect)(() => {
|
|
77
|
+
var _a;
|
|
78
|
+
setAnimChecked(Boolean((_a = inputRef.current) == null ? void 0 : _a.checked));
|
|
79
|
+
}, []);
|
|
80
|
+
(0, import_react.useEffect)(() => {
|
|
81
|
+
if (Object.prototype.hasOwnProperty.call(props, "checked")) {
|
|
82
|
+
setAnimChecked(Boolean(props.checked));
|
|
83
|
+
}
|
|
84
|
+
}, [props.checked]);
|
|
70
85
|
if (unstyled) {
|
|
71
86
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ref: inputRef, id, type: "checkbox", ...props });
|
|
72
87
|
}
|
|
73
88
|
const descId = description ? `${id != null ? id : internalId}-desc` : void 0;
|
|
74
89
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: cx("inline-flex select-none items-start gap-2", className), children: [
|
|
75
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "relative inline-grid place-items-center", children: [
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
"input",
|
|
93
|
+
{
|
|
94
|
+
ref: inputRef,
|
|
95
|
+
id: id != null ? id : internalId,
|
|
96
|
+
type: "checkbox",
|
|
97
|
+
"aria-invalid": error ? true : void 0,
|
|
98
|
+
"aria-describedby": descId,
|
|
99
|
+
className: cx(
|
|
100
|
+
baseInput,
|
|
101
|
+
sizeMap[size],
|
|
102
|
+
(error || tone === "danger") && "border-blue-400 focus:ring-blue-500/30",
|
|
103
|
+
inputClassName
|
|
104
|
+
),
|
|
105
|
+
onChange: (e) => {
|
|
106
|
+
var _a;
|
|
107
|
+
setAnimChecked(e.currentTarget.checked || !!indeterminate);
|
|
108
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, e);
|
|
109
|
+
},
|
|
110
|
+
...props
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
+
import_framer_motion.motion.svg,
|
|
115
|
+
{
|
|
116
|
+
viewBox: "0 0 24 24",
|
|
117
|
+
className: cx("pointer-events-none absolute", size === "sm" ? "h-4 w-4" : size === "lg" ? "h-6 w-6" : "h-5 w-5"),
|
|
118
|
+
initial: { pathLength: 0, opacity: 0 },
|
|
119
|
+
animate: { pathLength: animChecked || !!indeterminate ? 1 : 0, opacity: animChecked || !!indeterminate ? 1 : 0 },
|
|
120
|
+
transition: { duration: 0.18, ease: "easeOut" },
|
|
121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.motion.path, { d: "M5 12l4 4L19 7", stroke: "white", strokeWidth: 2.5, fill: "none", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
] }),
|
|
92
125
|
(label || description) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "leading-tight", children: [
|
|
93
126
|
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm text-slate-700 dark:text-slate-200", children: label }),
|
|
94
127
|
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: descId, className: "text-[12px] text-slate-500 dark:text-slate-400", children: description })
|
package/dist/Checkbox.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React, { useEffect, useId, useRef } from "react";
|
|
4
|
+
import { motion } from "framer-motion";
|
|
4
5
|
function cx(...a) {
|
|
5
6
|
return a.filter(Boolean).join(" ");
|
|
6
7
|
}
|
|
7
|
-
const baseInput = "rounded border border-slate-300
|
|
8
|
+
const baseInput = "appearance-none grid place-items-center rounded border border-slate-300 bg-white shadow-sm outline-none focus:ring-4 focus:ring-blue-300/40 checked:bg-blue-600 checked:border-blue-600 disabled:opacity-60 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/10 dark:checked:bg-blue-500 dark:checked:border-blue-500";
|
|
8
9
|
const sizeMap = {
|
|
9
10
|
sm: "h-4 w-4",
|
|
10
11
|
md: "h-5 w-5",
|
|
@@ -26,6 +27,11 @@ const Checkbox = React.forwardRef(
|
|
|
26
27
|
}, ref) => {
|
|
27
28
|
const internalId = useId();
|
|
28
29
|
const inputRef = useRef(null);
|
|
30
|
+
const [animChecked, setAnimChecked] = React.useState(() => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
const p = props;
|
|
33
|
+
return Boolean((_b = (_a = p.checked) != null ? _a : p.defaultChecked) != null ? _b : false);
|
|
34
|
+
});
|
|
29
35
|
useEffect(() => {
|
|
30
36
|
if (!ref) return;
|
|
31
37
|
if (typeof ref === "function") ref(inputRef.current);
|
|
@@ -34,28 +40,55 @@ const Checkbox = React.forwardRef(
|
|
|
34
40
|
useEffect(() => {
|
|
35
41
|
if (inputRef.current) inputRef.current.indeterminate = !!indeterminate;
|
|
36
42
|
}, [indeterminate]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
var _a;
|
|
45
|
+
setAnimChecked(Boolean((_a = inputRef.current) == null ? void 0 : _a.checked));
|
|
46
|
+
}, []);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (Object.prototype.hasOwnProperty.call(props, "checked")) {
|
|
49
|
+
setAnimChecked(Boolean(props.checked));
|
|
50
|
+
}
|
|
51
|
+
}, [props.checked]);
|
|
37
52
|
if (unstyled) {
|
|
38
53
|
return /* @__PURE__ */ jsx("input", { ref: inputRef, id, type: "checkbox", ...props });
|
|
39
54
|
}
|
|
40
55
|
const descId = description ? `${id != null ? id : internalId}-desc` : void 0;
|
|
41
56
|
return /* @__PURE__ */ jsxs("label", { className: cx("inline-flex select-none items-start gap-2", className), children: [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
/* @__PURE__ */ jsxs("span", { className: "relative inline-grid place-items-center", children: [
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
"input",
|
|
60
|
+
{
|
|
61
|
+
ref: inputRef,
|
|
62
|
+
id: id != null ? id : internalId,
|
|
63
|
+
type: "checkbox",
|
|
64
|
+
"aria-invalid": error ? true : void 0,
|
|
65
|
+
"aria-describedby": descId,
|
|
66
|
+
className: cx(
|
|
67
|
+
baseInput,
|
|
68
|
+
sizeMap[size],
|
|
69
|
+
(error || tone === "danger") && "border-blue-400 focus:ring-blue-500/30",
|
|
70
|
+
inputClassName
|
|
71
|
+
),
|
|
72
|
+
onChange: (e) => {
|
|
73
|
+
var _a;
|
|
74
|
+
setAnimChecked(e.currentTarget.checked || !!indeterminate);
|
|
75
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, e);
|
|
76
|
+
},
|
|
77
|
+
...props
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
motion.svg,
|
|
82
|
+
{
|
|
83
|
+
viewBox: "0 0 24 24",
|
|
84
|
+
className: cx("pointer-events-none absolute", size === "sm" ? "h-4 w-4" : size === "lg" ? "h-6 w-6" : "h-5 w-5"),
|
|
85
|
+
initial: { pathLength: 0, opacity: 0 },
|
|
86
|
+
animate: { pathLength: animChecked || !!indeterminate ? 1 : 0, opacity: animChecked || !!indeterminate ? 1 : 0 },
|
|
87
|
+
transition: { duration: 0.18, ease: "easeOut" },
|
|
88
|
+
children: /* @__PURE__ */ jsx(motion.path, { d: "M5 12l4 4L19 7", stroke: "white", strokeWidth: 2.5, fill: "none", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] }),
|
|
59
92
|
(label || description) && /* @__PURE__ */ jsxs("span", { className: "leading-tight", children: [
|
|
60
93
|
label && /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-700 dark:text-slate-200", children: label }),
|
|
61
94
|
description && /* @__PURE__ */ jsx("div", { id: descId, className: "text-[12px] text-slate-500 dark:text-slate-400", children: description })
|
package/dist/ColorPicker.js
CHANGED
|
@@ -37,6 +37,8 @@ var import_react = __toESM(require("react"));
|
|
|
37
37
|
var import_Input = __toESM(require("./Input"));
|
|
38
38
|
var import_Button = __toESM(require("./Button"));
|
|
39
39
|
var import_Dialog = __toESM(require("./Dialog"));
|
|
40
|
+
var import_framer_motion = require("framer-motion");
|
|
41
|
+
var import_animations = require("./animations");
|
|
40
42
|
function clamp(v, min = 0, max = 255) {
|
|
41
43
|
return Math.max(min, Math.min(max, v));
|
|
42
44
|
}
|
|
@@ -127,13 +129,16 @@ function ColorPicker({ value, onChange, presets = DEFAULTS, className, label })
|
|
|
127
129
|
};
|
|
128
130
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className, children: [
|
|
129
131
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
-
|
|
132
|
+
import_framer_motion.motion.button,
|
|
131
133
|
{
|
|
132
134
|
type: "button",
|
|
133
135
|
onClick: () => setOpen(true),
|
|
134
136
|
title: hex,
|
|
135
|
-
className: "h-9 w-9 rounded-xl border border-slate-300 shadow-sm outline-none ring-0 transition
|
|
136
|
-
style: { backgroundColor: hex }
|
|
137
|
+
className: "h-9 w-9 rounded-xl border border-slate-300 shadow-sm outline-none ring-0 transition dark:border-white/10",
|
|
138
|
+
style: { backgroundColor: hex },
|
|
139
|
+
whileHover: { scale: 1.05 },
|
|
140
|
+
whileTap: { scale: 0.96 },
|
|
141
|
+
transition: import_animations.microTransition
|
|
137
142
|
}
|
|
138
143
|
),
|
|
139
144
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Dialog.default, { open, onClose: () => setOpen(false), size: "md", children: [
|
|
@@ -146,7 +151,7 @@ function ColorPicker({ value, onChange, presets = DEFAULTS, className, label })
|
|
|
146
151
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Input.default, { placeholder: "r, g, b", value: rgb, onChange: (e) => setRgb(e.target.value), onBlur: () => commitRgb(rgb) })
|
|
147
152
|
] })
|
|
148
153
|
] }),
|
|
149
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-3 grid grid-cols-9 gap-1", children: presets.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
154
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-3 grid grid-cols-9 gap-1", children: presets.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.motion.button, { type: "button", title: c, className: "h-7 w-7 rounded-lg border border-slate-300 shadow-sm dark:border-white/10", style: { backgroundColor: c }, onClick: () => setHex(c), whileHover: { scale: 1.07 }, whileTap: { scale: 0.96 }, transition: import_animations.microTransition }, c)) })
|
|
150
155
|
] }),
|
|
151
156
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Dialog.default.Footer, { align: "end", children: [
|
|
152
157
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.default, { variant: "secondary", onClick: () => setOpen(false), children: "Cancelar" }),
|
package/dist/ColorPicker.mjs
CHANGED
|
@@ -4,6 +4,8 @@ import React from "react";
|
|
|
4
4
|
import Input from "./Input";
|
|
5
5
|
import Button from "./Button";
|
|
6
6
|
import Dialog from "./Dialog";
|
|
7
|
+
import { motion } from "framer-motion";
|
|
8
|
+
import { microTransition } from "./animations";
|
|
7
9
|
function clamp(v, min = 0, max = 255) {
|
|
8
10
|
return Math.max(min, Math.min(max, v));
|
|
9
11
|
}
|
|
@@ -94,13 +96,16 @@ function ColorPicker({ value, onChange, presets = DEFAULTS, className, label })
|
|
|
94
96
|
};
|
|
95
97
|
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
96
98
|
/* @__PURE__ */ jsx(
|
|
97
|
-
|
|
99
|
+
motion.button,
|
|
98
100
|
{
|
|
99
101
|
type: "button",
|
|
100
102
|
onClick: () => setOpen(true),
|
|
101
103
|
title: hex,
|
|
102
|
-
className: "h-9 w-9 rounded-xl border border-slate-300 shadow-sm outline-none ring-0 transition
|
|
103
|
-
style: { backgroundColor: hex }
|
|
104
|
+
className: "h-9 w-9 rounded-xl border border-slate-300 shadow-sm outline-none ring-0 transition dark:border-white/10",
|
|
105
|
+
style: { backgroundColor: hex },
|
|
106
|
+
whileHover: { scale: 1.05 },
|
|
107
|
+
whileTap: { scale: 0.96 },
|
|
108
|
+
transition: microTransition
|
|
104
109
|
}
|
|
105
110
|
),
|
|
106
111
|
/* @__PURE__ */ jsxs(Dialog, { open, onClose: () => setOpen(false), size: "md", children: [
|
|
@@ -113,7 +118,7 @@ function ColorPicker({ value, onChange, presets = DEFAULTS, className, label })
|
|
|
113
118
|
/* @__PURE__ */ jsx(Input, { placeholder: "r, g, b", value: rgb, onChange: (e) => setRgb(e.target.value), onBlur: () => commitRgb(rgb) })
|
|
114
119
|
] })
|
|
115
120
|
] }),
|
|
116
|
-
/* @__PURE__ */ jsx("div", { className: "mt-3 grid grid-cols-9 gap-1", children: presets.map((c) => /* @__PURE__ */ jsx(
|
|
121
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3 grid grid-cols-9 gap-1", children: presets.map((c) => /* @__PURE__ */ jsx(motion.button, { type: "button", title: c, className: "h-7 w-7 rounded-lg border border-slate-300 shadow-sm dark:border-white/10", style: { backgroundColor: c }, onClick: () => setHex(c), whileHover: { scale: 1.07 }, whileTap: { scale: 0.96 }, transition: microTransition }, c)) })
|
|
117
122
|
] }),
|
|
118
123
|
/* @__PURE__ */ jsxs(Dialog.Footer, { align: "end", children: [
|
|
119
124
|
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => setOpen(false), children: "Cancelar" }),
|
package/dist/ComboSelect.js
CHANGED
|
@@ -38,6 +38,8 @@ var import_react_dom = require("react-dom");
|
|
|
38
38
|
var import_AvatarSquare = __toESM(require("./AvatarSquare"));
|
|
39
39
|
var import_Input = __toESM(require("./Input"));
|
|
40
40
|
var import_Button = __toESM(require("./Button"));
|
|
41
|
+
var import_framer_motion = require("framer-motion");
|
|
42
|
+
var import_animations = require("./animations");
|
|
41
43
|
const cx = (...a) => a.filter(Boolean).join(" ");
|
|
42
44
|
const controlShell = "relative w-full rounded-2xl border border-slate-200 bg-white text-sm text-slate-900 placeholder:text-slate-400 shadow-sm outline-none transition focus-within:ring-4 focus-within:ring-slate-900/5 focus-within:border-slate-300 disabled:opacity-60 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/10 dark:text-slate-100 dark:placeholder:text-slate-400 dark:focus-within:ring-white/10";
|
|
43
45
|
const isFocusableOrInteractive = (el) => {
|
|
@@ -278,7 +280,7 @@ function ComboSelect({
|
|
|
278
280
|
]
|
|
279
281
|
}
|
|
280
282
|
);
|
|
281
|
-
const dropdown = open && dropStyle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
283
|
+
const dropdown = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { initial: false, children: open && dropStyle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
282
284
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
283
285
|
"div",
|
|
284
286
|
{
|
|
@@ -295,12 +297,17 @@ function ComboSelect({
|
|
|
295
297
|
}
|
|
296
298
|
),
|
|
297
299
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
298
|
-
|
|
300
|
+
import_framer_motion.motion.div,
|
|
299
301
|
{
|
|
300
302
|
ref: dropRef,
|
|
301
303
|
role: "listbox",
|
|
302
304
|
id: listId,
|
|
303
|
-
style: dropStyle,
|
|
305
|
+
style: { ...dropStyle, willChange: "transform, opacity" },
|
|
306
|
+
variants: import_animations.popOver,
|
|
307
|
+
initial: "initial",
|
|
308
|
+
animate: "animate",
|
|
309
|
+
exit: "exit",
|
|
310
|
+
transition: import_animations.menuTransition,
|
|
304
311
|
className: "overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
305
312
|
children: filteredRows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-3 py-2 text-sm text-slate-500 dark:text-slate-400", children: noResultsText }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "max-h-[inherit] overflow-auto py-1 text-sm", children: filteredRows.map((row, i) => {
|
|
306
313
|
if (row.kind === "section") {
|
|
@@ -348,7 +355,7 @@ function ComboSelect({
|
|
|
348
355
|
}) })
|
|
349
356
|
}
|
|
350
357
|
)
|
|
351
|
-
] }) : null;
|
|
358
|
+
] }) : null });
|
|
352
359
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
353
360
|
"div",
|
|
354
361
|
{
|
package/dist/ComboSelect.mjs
CHANGED
|
@@ -5,6 +5,8 @@ import { createPortal } from "react-dom";
|
|
|
5
5
|
import AvatarSquare from "./AvatarSquare";
|
|
6
6
|
import Input from "./Input";
|
|
7
7
|
import Button from "./Button";
|
|
8
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
9
|
+
import { popOver, menuTransition } from "./animations";
|
|
8
10
|
const cx = (...a) => a.filter(Boolean).join(" ");
|
|
9
11
|
const controlShell = "relative w-full rounded-2xl border border-slate-200 bg-white text-sm text-slate-900 placeholder:text-slate-400 shadow-sm outline-none transition focus-within:ring-4 focus-within:ring-slate-900/5 focus-within:border-slate-300 disabled:opacity-60 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/10 dark:text-slate-100 dark:placeholder:text-slate-400 dark:focus-within:ring-white/10";
|
|
10
12
|
const isFocusableOrInteractive = (el) => {
|
|
@@ -245,7 +247,7 @@ function ComboSelect({
|
|
|
245
247
|
]
|
|
246
248
|
}
|
|
247
249
|
);
|
|
248
|
-
const dropdown = open && dropStyle ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
250
|
+
const dropdown = /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: open && dropStyle ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
249
251
|
/* @__PURE__ */ jsx(
|
|
250
252
|
"div",
|
|
251
253
|
{
|
|
@@ -262,12 +264,17 @@ function ComboSelect({
|
|
|
262
264
|
}
|
|
263
265
|
),
|
|
264
266
|
/* @__PURE__ */ jsx(
|
|
265
|
-
|
|
267
|
+
motion.div,
|
|
266
268
|
{
|
|
267
269
|
ref: dropRef,
|
|
268
270
|
role: "listbox",
|
|
269
271
|
id: listId,
|
|
270
|
-
style: dropStyle,
|
|
272
|
+
style: { ...dropStyle, willChange: "transform, opacity" },
|
|
273
|
+
variants: popOver,
|
|
274
|
+
initial: "initial",
|
|
275
|
+
animate: "animate",
|
|
276
|
+
exit: "exit",
|
|
277
|
+
transition: menuTransition,
|
|
271
278
|
className: "overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
272
279
|
children: filteredRows.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-slate-500 dark:text-slate-400", children: noResultsText }) : /* @__PURE__ */ jsx("ul", { className: "max-h-[inherit] overflow-auto py-1 text-sm", children: filteredRows.map((row, i) => {
|
|
273
280
|
if (row.kind === "section") {
|
|
@@ -315,7 +322,7 @@ function ComboSelect({
|
|
|
315
322
|
}) })
|
|
316
323
|
}
|
|
317
324
|
)
|
|
318
|
-
] }) : null;
|
|
325
|
+
] }) : null });
|
|
319
326
|
return /* @__PURE__ */ jsxs(
|
|
320
327
|
"div",
|
|
321
328
|
{
|
package/dist/DateTimeField.js
CHANGED
|
@@ -39,6 +39,8 @@ var import_Input = __toESM(require("./Input"));
|
|
|
39
39
|
var import_Button = __toESM(require("./Button"));
|
|
40
40
|
var import_CalendarPanel = __toESM(require("./CalendarPanel"));
|
|
41
41
|
var import_TimePopover = __toESM(require("./TimePopover"));
|
|
42
|
+
var import_framer_motion = require("framer-motion");
|
|
43
|
+
var import_animations = require("./animations");
|
|
42
44
|
const pad2 = (n) => n < 10 ? `0${n}` : String(n);
|
|
43
45
|
const DATE_ONLY_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
44
46
|
const fmtISODate = (d) => `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
|
|
@@ -245,10 +247,14 @@ function DateTimeField({
|
|
|
245
247
|
const timeBtnRef = (0, import_react.useRef)(null);
|
|
246
248
|
const [showTimePop, setShowTimePop] = (0, import_react.useState)(false);
|
|
247
249
|
const popover = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
248
|
-
|
|
250
|
+
import_framer_motion.motion.div,
|
|
249
251
|
{
|
|
252
|
+
variants: import_animations.popOver,
|
|
253
|
+
initial: "initial",
|
|
254
|
+
animate: "animate",
|
|
255
|
+
transition: import_animations.menuTransition,
|
|
250
256
|
ref: popRef,
|
|
251
|
-
style: stylePop,
|
|
257
|
+
style: { ...stylePop, willChange: "transform, opacity" },
|
|
252
258
|
"data-dtf-pop": true,
|
|
253
259
|
className: "w-1/3 overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
254
260
|
children: [
|
package/dist/DateTimeField.mjs
CHANGED
|
@@ -6,6 +6,8 @@ import Input from "./Input";
|
|
|
6
6
|
import Button from "./Button";
|
|
7
7
|
import CalendarPanel from "./CalendarPanel";
|
|
8
8
|
import TimePopover from "./TimePopover";
|
|
9
|
+
import { motion } from "framer-motion";
|
|
10
|
+
import { popOver, menuTransition } from "./animations";
|
|
9
11
|
const pad2 = (n) => n < 10 ? `0${n}` : String(n);
|
|
10
12
|
const DATE_ONLY_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
11
13
|
const fmtISODate = (d) => `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
|
|
@@ -212,10 +214,14 @@ function DateTimeField({
|
|
|
212
214
|
const timeBtnRef = useRef(null);
|
|
213
215
|
const [showTimePop, setShowTimePop] = useState(false);
|
|
214
216
|
const popover = /* @__PURE__ */ jsxs(
|
|
215
|
-
|
|
217
|
+
motion.div,
|
|
216
218
|
{
|
|
219
|
+
variants: popOver,
|
|
220
|
+
initial: "initial",
|
|
221
|
+
animate: "animate",
|
|
222
|
+
transition: menuTransition,
|
|
217
223
|
ref: popRef,
|
|
218
|
-
style: stylePop,
|
|
224
|
+
style: { ...stylePop, willChange: "transform, opacity" },
|
|
219
225
|
"data-dtf-pop": true,
|
|
220
226
|
className: "w-1/3 overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-xl dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
221
227
|
children: [
|
package/dist/Dropdown.js
CHANGED
|
@@ -41,6 +41,8 @@ module.exports = __toCommonJS(Dropdown_exports);
|
|
|
41
41
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
42
|
var import_react = __toESM(require("react"));
|
|
43
43
|
var import_react_dom = require("react-dom");
|
|
44
|
+
var import_framer_motion = require("framer-motion");
|
|
45
|
+
var import_animations = require("./animations");
|
|
44
46
|
var import_iconos = require("./iconos/index");
|
|
45
47
|
var import_Button = __toESM(require("./Button"));
|
|
46
48
|
const DropdownCtx = (0, import_react.createContext)(null);
|
|
@@ -263,37 +265,40 @@ function Content({
|
|
|
263
265
|
}
|
|
264
266
|
return out;
|
|
265
267
|
}, [children, isAllowed, defaultHideUnauthorized]);
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
"div",
|
|
268
|
+
return typeof document !== "undefined" ? (0, import_react_dom.createPortal)(
|
|
269
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { initial: false, children: open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
270
|
+
import_framer_motion.motion.div,
|
|
270
271
|
{
|
|
271
272
|
role: "menu",
|
|
272
273
|
id: menuId,
|
|
273
274
|
"aria-labelledby": labelId,
|
|
274
275
|
ref: menuRef,
|
|
275
276
|
onKeyDown,
|
|
277
|
+
variants: import_animations.popOver,
|
|
278
|
+
initial: "initial",
|
|
279
|
+
animate: "animate",
|
|
280
|
+
exit: "exit",
|
|
281
|
+
transition: import_animations.menuTransition,
|
|
276
282
|
style: {
|
|
277
283
|
position: "fixed",
|
|
278
284
|
top: pos.top,
|
|
279
285
|
left: pos.left,
|
|
280
286
|
maxHeight: pos.maxH,
|
|
281
|
-
maxWidth: "calc(100vw - 16px)"
|
|
287
|
+
maxWidth: "calc(100vw - 16px)",
|
|
288
|
+
willChange: "transform, opacity"
|
|
282
289
|
},
|
|
283
290
|
className: [
|
|
284
291
|
"z-[9999] overflow-auto rounded-2xl border border-slate-200/80 bg-white p-1.5 shadow-xl",
|
|
285
|
-
"data-[open=false]:pointer-events-none data-[open=false]:opacity-0 data-[open=false]:scale-95",
|
|
286
|
-
"data-[open=true]:opacity-100 data-[open=true]:scale-100 transition",
|
|
287
292
|
pos.origin === "top-right" ? "origin-top-right" : "origin-top-left",
|
|
288
293
|
"dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
289
294
|
className
|
|
290
295
|
].join(" "),
|
|
291
|
-
"data-open": "true",
|
|
296
|
+
"data-open": open ? "true" : "false",
|
|
292
297
|
children: normalizedChildren
|
|
293
298
|
}
|
|
294
|
-
),
|
|
299
|
+
) : null }),
|
|
295
300
|
document.body
|
|
296
|
-
);
|
|
301
|
+
) : null;
|
|
297
302
|
}
|
|
298
303
|
function Label({ children }) {
|
|
299
304
|
const { labelId } = useDropdown();
|
package/dist/Dropdown.mjs
CHANGED
|
@@ -11,6 +11,8 @@ import React, {
|
|
|
11
11
|
useState
|
|
12
12
|
} from "react";
|
|
13
13
|
import { createPortal } from "react-dom";
|
|
14
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
15
|
+
import { popOver, menuTransition } from "./animations";
|
|
14
16
|
import { MenuPuntosVerticalIcon } from "./iconos/index";
|
|
15
17
|
import Button from "./Button";
|
|
16
18
|
const DropdownCtx = createContext(null);
|
|
@@ -233,37 +235,40 @@ function Content({
|
|
|
233
235
|
}
|
|
234
236
|
return out;
|
|
235
237
|
}, [children, isAllowed, defaultHideUnauthorized]);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
"div",
|
|
238
|
+
return typeof document !== "undefined" ? createPortal(
|
|
239
|
+
/* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: open ? /* @__PURE__ */ jsx(
|
|
240
|
+
motion.div,
|
|
240
241
|
{
|
|
241
242
|
role: "menu",
|
|
242
243
|
id: menuId,
|
|
243
244
|
"aria-labelledby": labelId,
|
|
244
245
|
ref: menuRef,
|
|
245
246
|
onKeyDown,
|
|
247
|
+
variants: popOver,
|
|
248
|
+
initial: "initial",
|
|
249
|
+
animate: "animate",
|
|
250
|
+
exit: "exit",
|
|
251
|
+
transition: menuTransition,
|
|
246
252
|
style: {
|
|
247
253
|
position: "fixed",
|
|
248
254
|
top: pos.top,
|
|
249
255
|
left: pos.left,
|
|
250
256
|
maxHeight: pos.maxH,
|
|
251
|
-
maxWidth: "calc(100vw - 16px)"
|
|
257
|
+
maxWidth: "calc(100vw - 16px)",
|
|
258
|
+
willChange: "transform, opacity"
|
|
252
259
|
},
|
|
253
260
|
className: [
|
|
254
261
|
"z-[9999] overflow-auto rounded-2xl border border-slate-200/80 bg-white p-1.5 shadow-xl",
|
|
255
|
-
"data-[open=false]:pointer-events-none data-[open=false]:opacity-0 data-[open=false]:scale-95",
|
|
256
|
-
"data-[open=true]:opacity-100 data-[open=true]:scale-100 transition",
|
|
257
262
|
pos.origin === "top-right" ? "origin-top-right" : "origin-top-left",
|
|
258
263
|
"dark:border-white/10 dark:bg-[var(--fx-surface)]",
|
|
259
264
|
className
|
|
260
265
|
].join(" "),
|
|
261
|
-
"data-open": "true",
|
|
266
|
+
"data-open": open ? "true" : "false",
|
|
262
267
|
children: normalizedChildren
|
|
263
268
|
}
|
|
264
|
-
),
|
|
269
|
+
) : null }),
|
|
265
270
|
document.body
|
|
266
|
-
);
|
|
271
|
+
) : null;
|
|
267
272
|
}
|
|
268
273
|
function Label({ children }) {
|
|
269
274
|
const { labelId } = useDropdown();
|
package/dist/Input.js
CHANGED
|
@@ -34,6 +34,8 @@ __export(Input_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(Input_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
|
var import_Button = __toESM(require("./Button"));
|
|
38
40
|
function cx(...a) {
|
|
39
41
|
return a.filter(Boolean).join(" ");
|
|
@@ -56,6 +58,7 @@ const Input = import_react.default.forwardRef(
|
|
|
56
58
|
}
|
|
57
59
|
const showClear = clearable && !!value && !props.disabled;
|
|
58
60
|
const readOnly = !onChange;
|
|
61
|
+
const [focused, setFocused] = import_react.default.useState(false);
|
|
59
62
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative content-center", children: [
|
|
60
63
|
leftSlot && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-slate-400", children: leftSlot }),
|
|
61
64
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -65,6 +68,16 @@ const Input = import_react.default.forwardRef(
|
|
|
65
68
|
value,
|
|
66
69
|
onChange,
|
|
67
70
|
readOnly,
|
|
71
|
+
onFocus: (e) => {
|
|
72
|
+
var _a;
|
|
73
|
+
setFocused(true);
|
|
74
|
+
(_a = props.onFocus) == null ? void 0 : _a.call(props, e);
|
|
75
|
+
},
|
|
76
|
+
onBlur: (e) => {
|
|
77
|
+
var _a;
|
|
78
|
+
setFocused(false);
|
|
79
|
+
(_a = props.onBlur) == null ? void 0 : _a.call(props, e);
|
|
80
|
+
},
|
|
68
81
|
"aria-invalid": error ? true : void 0,
|
|
69
82
|
className: cx(
|
|
70
83
|
baseControl,
|
|
@@ -94,6 +107,16 @@ const Input = import_react.default.forwardRef(
|
|
|
94
107
|
},
|
|
95
108
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", className: "h-4.5 w-4.5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M18 6L6 18M6 6l12 12" }) })
|
|
96
109
|
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
+
import_framer_motion.motion.span,
|
|
113
|
+
{
|
|
114
|
+
"aria-hidden": true,
|
|
115
|
+
className: "pointer-events-none absolute inset-0 rounded-2xl ring-2 ring-blue-500/20",
|
|
116
|
+
initial: { opacity: 0 },
|
|
117
|
+
animate: { opacity: focused ? 1 : 0 },
|
|
118
|
+
transition: import_animations.microTransition
|
|
119
|
+
}
|
|
97
120
|
)
|
|
98
121
|
] });
|
|
99
122
|
}
|
package/dist/Input.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
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
|
import Button from "./Button";
|
|
5
7
|
function cx(...a) {
|
|
6
8
|
return a.filter(Boolean).join(" ");
|
|
@@ -23,6 +25,7 @@ const Input = React.forwardRef(
|
|
|
23
25
|
}
|
|
24
26
|
const showClear = clearable && !!value && !props.disabled;
|
|
25
27
|
const readOnly = !onChange;
|
|
28
|
+
const [focused, setFocused] = React.useState(false);
|
|
26
29
|
return /* @__PURE__ */ jsxs("div", { className: "relative content-center", children: [
|
|
27
30
|
leftSlot && /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-slate-400", children: leftSlot }),
|
|
28
31
|
/* @__PURE__ */ jsx(
|
|
@@ -32,6 +35,16 @@ const Input = React.forwardRef(
|
|
|
32
35
|
value,
|
|
33
36
|
onChange,
|
|
34
37
|
readOnly,
|
|
38
|
+
onFocus: (e) => {
|
|
39
|
+
var _a;
|
|
40
|
+
setFocused(true);
|
|
41
|
+
(_a = props.onFocus) == null ? void 0 : _a.call(props, e);
|
|
42
|
+
},
|
|
43
|
+
onBlur: (e) => {
|
|
44
|
+
var _a;
|
|
45
|
+
setFocused(false);
|
|
46
|
+
(_a = props.onBlur) == null ? void 0 : _a.call(props, e);
|
|
47
|
+
},
|
|
35
48
|
"aria-invalid": error ? true : void 0,
|
|
36
49
|
className: cx(
|
|
37
50
|
baseControl,
|
|
@@ -61,6 +74,16 @@ const Input = React.forwardRef(
|
|
|
61
74
|
},
|
|
62
75
|
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-4.5 w-4.5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" }) })
|
|
63
76
|
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
motion.span,
|
|
80
|
+
{
|
|
81
|
+
"aria-hidden": true,
|
|
82
|
+
className: "pointer-events-none absolute inset-0 rounded-2xl ring-2 ring-blue-500/20",
|
|
83
|
+
initial: { opacity: 0 },
|
|
84
|
+
animate: { opacity: focused ? 1 : 0 },
|
|
85
|
+
transition: microTransition
|
|
86
|
+
}
|
|
64
87
|
)
|
|
65
88
|
] });
|
|
66
89
|
}
|