framepexls-ui-lib 0.1.4

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.
Files changed (125) hide show
  1. package/dist/ActionIconButton.d.mts +11 -0
  2. package/dist/ActionIconButton.d.ts +11 -0
  3. package/dist/ActionIconButton.js +71 -0
  4. package/dist/ActionIconButton.mjs +41 -0
  5. package/dist/AppTopbar.d.mts +17 -0
  6. package/dist/AppTopbar.d.ts +17 -0
  7. package/dist/AppTopbar.js +51 -0
  8. package/dist/AppTopbar.mjs +31 -0
  9. package/dist/AvatarSquare.d.mts +16 -0
  10. package/dist/AvatarSquare.d.ts +16 -0
  11. package/dist/AvatarSquare.js +82 -0
  12. package/dist/AvatarSquare.mjs +52 -0
  13. package/dist/Badge.d.mts +13 -0
  14. package/dist/Badge.d.ts +13 -0
  15. package/dist/Badge.js +65 -0
  16. package/dist/Badge.mjs +45 -0
  17. package/dist/BadgeCluster.d.mts +17 -0
  18. package/dist/BadgeCluster.d.ts +17 -0
  19. package/dist/BadgeCluster.js +125 -0
  20. package/dist/BadgeCluster.mjs +95 -0
  21. package/dist/Breadcrumb.d.mts +11 -0
  22. package/dist/Breadcrumb.d.ts +11 -0
  23. package/dist/Breadcrumb.js +42 -0
  24. package/dist/Breadcrumb.mjs +12 -0
  25. package/dist/Button.d.mts +15 -0
  26. package/dist/Button.d.ts +15 -0
  27. package/dist/Button.js +72 -0
  28. package/dist/Button.mjs +52 -0
  29. package/dist/CalendarPanel.d.mts +13 -0
  30. package/dist/CalendarPanel.d.ts +13 -0
  31. package/dist/CalendarPanel.js +110 -0
  32. package/dist/CalendarPanel.mjs +90 -0
  33. package/dist/ChartCard.d.mts +15 -0
  34. package/dist/ChartCard.d.ts +15 -0
  35. package/dist/ChartCard.js +44 -0
  36. package/dist/ChartCard.mjs +24 -0
  37. package/dist/CheckboxPillsGroup.d.mts +28 -0
  38. package/dist/CheckboxPillsGroup.d.ts +28 -0
  39. package/dist/CheckboxPillsGroup.js +186 -0
  40. package/dist/CheckboxPillsGroup.mjs +156 -0
  41. package/dist/ColumnSelector.d.mts +17 -0
  42. package/dist/ColumnSelector.d.ts +17 -0
  43. package/dist/ColumnSelector.js +74 -0
  44. package/dist/ColumnSelector.mjs +54 -0
  45. package/dist/ComboSelect.d.mts +46 -0
  46. package/dist/ComboSelect.d.ts +46 -0
  47. package/dist/ComboSelect.js +442 -0
  48. package/dist/ComboSelect.mjs +412 -0
  49. package/dist/DateTimeField.d.mts +22 -0
  50. package/dist/DateTimeField.d.ts +22 -0
  51. package/dist/DateTimeField.js +409 -0
  52. package/dist/DateTimeField.mjs +379 -0
  53. package/dist/Dialog.d.mts +82 -0
  54. package/dist/Dialog.d.ts +82 -0
  55. package/dist/Dialog.js +408 -0
  56. package/dist/Dialog.mjs +368 -0
  57. package/dist/Dropdown.d.mts +52 -0
  58. package/dist/Dropdown.d.ts +52 -0
  59. package/dist/Dropdown.js +333 -0
  60. package/dist/Dropdown.mjs +313 -0
  61. package/dist/EmptyState.d.mts +8 -0
  62. package/dist/EmptyState.d.ts +8 -0
  63. package/dist/EmptyState.js +35 -0
  64. package/dist/EmptyState.mjs +15 -0
  65. package/dist/InfoGrid.d.mts +20 -0
  66. package/dist/InfoGrid.d.ts +20 -0
  67. package/dist/InfoGrid.js +67 -0
  68. package/dist/InfoGrid.mjs +47 -0
  69. package/dist/Input.d.mts +20 -0
  70. package/dist/Input.d.ts +20 -0
  71. package/dist/Input.js +85 -0
  72. package/dist/Input.mjs +55 -0
  73. package/dist/Money.d.mts +8 -0
  74. package/dist/Money.d.ts +8 -0
  75. package/dist/Money.js +30 -0
  76. package/dist/Money.mjs +10 -0
  77. package/dist/OrderButton.d.mts +11 -0
  78. package/dist/OrderButton.d.ts +11 -0
  79. package/dist/OrderButton.js +39 -0
  80. package/dist/OrderButton.mjs +19 -0
  81. package/dist/Pagination.d.mts +12 -0
  82. package/dist/Pagination.d.ts +12 -0
  83. package/dist/Pagination.js +71 -0
  84. package/dist/Pagination.mjs +51 -0
  85. package/dist/SearchInput.d.mts +17 -0
  86. package/dist/SearchInput.d.ts +17 -0
  87. package/dist/SearchInput.js +116 -0
  88. package/dist/SearchInput.mjs +86 -0
  89. package/dist/Select.d.mts +31 -0
  90. package/dist/Select.d.ts +31 -0
  91. package/dist/Select.js +293 -0
  92. package/dist/Select.mjs +263 -0
  93. package/dist/StatCard.d.mts +15 -0
  94. package/dist/StatCard.d.ts +15 -0
  95. package/dist/StatCard.js +47 -0
  96. package/dist/StatCard.mjs +27 -0
  97. package/dist/Steps.d.mts +31 -0
  98. package/dist/Steps.d.ts +31 -0
  99. package/dist/Steps.js +123 -0
  100. package/dist/Steps.mjs +99 -0
  101. package/dist/Table.d.mts +31 -0
  102. package/dist/Table.d.ts +31 -0
  103. package/dist/Table.js +153 -0
  104. package/dist/Table.mjs +117 -0
  105. package/dist/TimeAgo.d.mts +12 -0
  106. package/dist/TimeAgo.d.ts +12 -0
  107. package/dist/TimeAgo.js +104 -0
  108. package/dist/TimeAgo.mjs +74 -0
  109. package/dist/TimePanel.d.mts +14 -0
  110. package/dist/TimePanel.d.ts +14 -0
  111. package/dist/TimePanel.js +145 -0
  112. package/dist/TimePanel.mjs +125 -0
  113. package/dist/TimePopover.d.mts +33 -0
  114. package/dist/TimePopover.d.ts +33 -0
  115. package/dist/TimePopover.js +441 -0
  116. package/dist/TimePopover.mjs +406 -0
  117. package/dist/iconos/index.d.mts +60 -0
  118. package/dist/iconos/index.d.ts +60 -0
  119. package/dist/iconos/index.js +621 -0
  120. package/dist/iconos/index.mjs +548 -0
  121. package/dist/index.d.mts +32 -0
  122. package/dist/index.d.ts +32 -0
  123. package/dist/index.js +141 -0
  124. package/dist/index.mjs +70 -0
  125. package/package.json +178 -0
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var BadgeCluster_exports = {};
31
+ __export(BadgeCluster_exports, {
32
+ default: () => BadgeCluster
33
+ });
34
+ module.exports = __toCommonJS(BadgeCluster_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_react_dom = require("react-dom");
38
+ var import_framer_motion = require("framer-motion");
39
+ var import_Badge = __toESM(require("./Badge"));
40
+ function BadgeCluster({
41
+ items,
42
+ max = 3,
43
+ align = "left",
44
+ className = "",
45
+ usePortal = true
46
+ // 👈 por defecto evita clipping
47
+ }) {
48
+ const show = items.slice(0, max);
49
+ const rest = items.slice(max);
50
+ const [open, setOpen] = (0, import_react.useState)(false);
51
+ const rootRef = (0, import_react.useRef)(null);
52
+ const btnRef = (0, import_react.useRef)(null);
53
+ (0, import_react.useEffect)(() => {
54
+ const onDoc = (e) => {
55
+ if (!rootRef.current) return;
56
+ if (!rootRef.current.contains(e.target)) setOpen(false);
57
+ };
58
+ document.addEventListener("mousedown", onDoc);
59
+ return () => document.removeEventListener("mousedown", onDoc);
60
+ }, []);
61
+ const [pos, setPos] = (0, import_react.useState)(null);
62
+ const updatePosition = () => {
63
+ if (!btnRef.current) return;
64
+ const r = btnRef.current.getBoundingClientRect();
65
+ setPos({
66
+ top: r.bottom + 8,
67
+ left: align === "right" ? r.right : r.left,
68
+ width: r.width
69
+ });
70
+ };
71
+ (0, import_react.useLayoutEffect)(() => {
72
+ if (!open) return;
73
+ updatePosition();
74
+ const onScroll = () => updatePosition();
75
+ const onResize = () => updatePosition();
76
+ window.addEventListener("scroll", onScroll, true);
77
+ window.addEventListener("resize", onResize);
78
+ return () => {
79
+ window.removeEventListener("scroll", onScroll, true);
80
+ window.removeEventListener("resize", onResize);
81
+ };
82
+ }, [open, align]);
83
+ const Popover = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
+ import_framer_motion.motion.div,
85
+ {
86
+ initial: { opacity: 0, y: 6, scale: 0.98 },
87
+ animate: { opacity: 1, y: 0, scale: 1 },
88
+ exit: { opacity: 0, y: 6, scale: 0.98 },
89
+ transition: { duration: 0.16, ease: "easeOut" },
90
+ className: [
91
+ "z-[9999] w-64 max-w-[80vw] rounded-xl border border-slate-200 bg-white p-2 shadow-lg ring-1 ring-black/5",
92
+ "dark:border-white/10 dark:bg-[#0e0d0e]",
93
+ usePortal ? "fixed" : "absolute",
94
+ align === "right" ? "right-0" : "left-0"
95
+ ].join(" "),
96
+ style: usePortal && pos ? {
97
+ top: pos.top,
98
+ // si alineas a la derecha, ancla por la derecha del botón
99
+ left: align === "right" ? void 0 : pos.left,
100
+ right: align === "right" ? Math.max(window.innerWidth - pos.left, 0) : void 0
101
+ } : void 0,
102
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "max-h-56 overflow-auto pr-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap gap-1.5", children: rest.map((it, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Badge.default, { tone: it.tone, children: it.label }, `${it.label}-overflow-${i}`)) }) })
103
+ }
104
+ ) });
105
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: rootRef, className: `relative inline-flex flex-wrap gap-1.5 ${className}`, children: [
106
+ show.map((it, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Badge.default, { tone: it.tone, children: it.label }, `${it.label}-${i}`)),
107
+ rest.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
108
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
109
+ "button",
110
+ {
111
+ ref: btnRef,
112
+ type: "button",
113
+ onClick: () => setOpen((v) => !v),
114
+ className: "inline-flex items-center rounded-full bg-slate-100 px-2.5 py-1 text-xs font-semibold text-slate-700 ring-1 ring-slate-200 hover:bg-slate-200 dark:bg-white/10 dark:text-slate-100 dark:ring-white/10",
115
+ title: rest.map((r) => r.label).join(", "),
116
+ children: [
117
+ "+",
118
+ rest.length
119
+ ]
120
+ }
121
+ ),
122
+ usePortal ? (0, import_react_dom.createPortal)(Popover, document.body) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative", children: Popover })
123
+ ] })
124
+ ] });
125
+ }
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useLayoutEffect, useRef, useState } from "react";
4
+ import { createPortal } from "react-dom";
5
+ import { AnimatePresence, motion } from "framer-motion";
6
+ import Badge from "./Badge";
7
+ function BadgeCluster({
8
+ items,
9
+ max = 3,
10
+ align = "left",
11
+ className = "",
12
+ usePortal = true
13
+ // 👈 por defecto evita clipping
14
+ }) {
15
+ const show = items.slice(0, max);
16
+ const rest = items.slice(max);
17
+ const [open, setOpen] = useState(false);
18
+ const rootRef = useRef(null);
19
+ const btnRef = useRef(null);
20
+ useEffect(() => {
21
+ const onDoc = (e) => {
22
+ if (!rootRef.current) return;
23
+ if (!rootRef.current.contains(e.target)) setOpen(false);
24
+ };
25
+ document.addEventListener("mousedown", onDoc);
26
+ return () => document.removeEventListener("mousedown", onDoc);
27
+ }, []);
28
+ const [pos, setPos] = useState(null);
29
+ const updatePosition = () => {
30
+ if (!btnRef.current) return;
31
+ const r = btnRef.current.getBoundingClientRect();
32
+ setPos({
33
+ top: r.bottom + 8,
34
+ left: align === "right" ? r.right : r.left,
35
+ width: r.width
36
+ });
37
+ };
38
+ useLayoutEffect(() => {
39
+ if (!open) return;
40
+ updatePosition();
41
+ const onScroll = () => updatePosition();
42
+ const onResize = () => updatePosition();
43
+ window.addEventListener("scroll", onScroll, true);
44
+ window.addEventListener("resize", onResize);
45
+ return () => {
46
+ window.removeEventListener("scroll", onScroll, true);
47
+ window.removeEventListener("resize", onResize);
48
+ };
49
+ }, [open, align]);
50
+ const Popover = /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(
51
+ motion.div,
52
+ {
53
+ initial: { opacity: 0, y: 6, scale: 0.98 },
54
+ animate: { opacity: 1, y: 0, scale: 1 },
55
+ exit: { opacity: 0, y: 6, scale: 0.98 },
56
+ transition: { duration: 0.16, ease: "easeOut" },
57
+ className: [
58
+ "z-[9999] w-64 max-w-[80vw] rounded-xl border border-slate-200 bg-white p-2 shadow-lg ring-1 ring-black/5",
59
+ "dark:border-white/10 dark:bg-[#0e0d0e]",
60
+ usePortal ? "fixed" : "absolute",
61
+ align === "right" ? "right-0" : "left-0"
62
+ ].join(" "),
63
+ style: usePortal && pos ? {
64
+ top: pos.top,
65
+ // si alineas a la derecha, ancla por la derecha del botón
66
+ left: align === "right" ? void 0 : pos.left,
67
+ right: align === "right" ? Math.max(window.innerWidth - pos.left, 0) : void 0
68
+ } : void 0,
69
+ children: /* @__PURE__ */ jsx("div", { className: "max-h-56 overflow-auto pr-1", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: rest.map((it, i) => /* @__PURE__ */ jsx(Badge, { tone: it.tone, children: it.label }, `${it.label}-overflow-${i}`)) }) })
70
+ }
71
+ ) });
72
+ return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: `relative inline-flex flex-wrap gap-1.5 ${className}`, children: [
73
+ show.map((it, i) => /* @__PURE__ */ jsx(Badge, { tone: it.tone, children: it.label }, `${it.label}-${i}`)),
74
+ rest.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
75
+ /* @__PURE__ */ jsxs(
76
+ "button",
77
+ {
78
+ ref: btnRef,
79
+ type: "button",
80
+ onClick: () => setOpen((v) => !v),
81
+ className: "inline-flex items-center rounded-full bg-slate-100 px-2.5 py-1 text-xs font-semibold text-slate-700 ring-1 ring-slate-200 hover:bg-slate-200 dark:bg-white/10 dark:text-slate-100 dark:ring-white/10",
82
+ title: rest.map((r) => r.label).join(", "),
83
+ children: [
84
+ "+",
85
+ rest.length
86
+ ]
87
+ }
88
+ ),
89
+ usePortal ? createPortal(Popover, document.body) : /* @__PURE__ */ jsx("div", { className: "relative", children: Popover })
90
+ ] })
91
+ ] });
92
+ }
93
+ export {
94
+ BadgeCluster as default
95
+ };
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type Crumb = {
4
+ label: string;
5
+ href?: string;
6
+ };
7
+ declare function Breadcrumb({ items }: {
8
+ items: Crumb[];
9
+ }): react_jsx_runtime.JSX.Element;
10
+
11
+ export { Breadcrumb as default };
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type Crumb = {
4
+ label: string;
5
+ href?: string;
6
+ };
7
+ declare function Breadcrumb({ items }: {
8
+ items: Crumb[];
9
+ }): react_jsx_runtime.JSX.Element;
10
+
11
+ export { Breadcrumb as default };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var Breadcrumb_exports = {};
31
+ __export(Breadcrumb_exports, {
32
+ default: () => Breadcrumb
33
+ });
34
+ module.exports = __toCommonJS(Breadcrumb_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = __toESM(require("react"));
37
+ function Breadcrumb({ items }) {
38
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: "mb-4 flex items-center text-sm text-slate-500", "aria-label": "Breadcrumb", children: items.map((it, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, { children: [
39
+ i > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 20 20", className: "mx-2 h-4 w-4 opacity-50", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7 4l6 6-6 6" }) }),
40
+ it.href ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: "hover:text-slate-700", href: it.href, children: it.label }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-medium text-slate-900 dark:text-slate-100", children: it.label })
41
+ ] }, i)) });
42
+ }
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import React from "react";
4
+ function Breadcrumb({ items }) {
5
+ return /* @__PURE__ */ jsx("nav", { className: "mb-4 flex items-center text-sm text-slate-500", "aria-label": "Breadcrumb", children: items.map((it, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
6
+ i > 0 && /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", className: "mx-2 h-4 w-4 opacity-50", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M7 4l6 6-6 6" }) }),
7
+ it.href ? /* @__PURE__ */ jsx("a", { className: "hover:text-slate-700", href: it.href, children: it.label }) : /* @__PURE__ */ jsx("span", { className: "font-medium text-slate-900 dark:text-slate-100", children: it.label })
8
+ ] }, i)) });
9
+ }
10
+ export {
11
+ Breadcrumb as default
12
+ };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type ButtonProps = {
5
+ variant?: "primary" | "secondary" | "outline" | "ghost" | "danger";
6
+ size?: "sm" | "md" | "lg";
7
+ loading?: boolean;
8
+ leftIcon?: React__default.ReactNode;
9
+ rightIcon?: React__default.ReactNode;
10
+ block?: boolean;
11
+ className?: string;
12
+ } & React__default.ButtonHTMLAttributes<HTMLButtonElement>;
13
+ declare function Button({ children, variant, size, loading, disabled, leftIcon, rightIcon, block, className, type, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
14
+
15
+ export { Button as default };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type ButtonProps = {
5
+ variant?: "primary" | "secondary" | "outline" | "ghost" | "danger";
6
+ size?: "sm" | "md" | "lg";
7
+ loading?: boolean;
8
+ leftIcon?: React__default.ReactNode;
9
+ rightIcon?: React__default.ReactNode;
10
+ block?: boolean;
11
+ className?: string;
12
+ } & React__default.ButtonHTMLAttributes<HTMLButtonElement>;
13
+ declare function Button({ children, variant, size, loading, disabled, leftIcon, rightIcon, block, className, type, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
14
+
15
+ export { Button as default };
package/dist/Button.js ADDED
@@ -0,0 +1,72 @@
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 Button_exports = {};
21
+ __export(Button_exports, {
22
+ default: () => Button
23
+ });
24
+ module.exports = __toCommonJS(Button_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ function Button({
27
+ children,
28
+ variant = "primary",
29
+ size = "md",
30
+ loading = false,
31
+ disabled,
32
+ leftIcon,
33
+ rightIcon,
34
+ block = false,
35
+ className = "",
36
+ type = "button",
37
+ ...rest
38
+ }) {
39
+ const base = "inline-flex items-center justify-center gap-2 rounded-xl font-medium transition focus:outline-none focus-visible:ring-2 disabled:opacity-60 disabled:cursor-not-allowed";
40
+ const sizes = size === "sm" ? "h-9 px-3 text-sm" : size === "lg" ? "h-11 px-5 text-base" : "h-10 px-4 text-sm";
41
+ const variants = {
42
+ primary: "bg-slate-900 text-white hover:opacity-90 active:scale-[.98] dark:bg-white dark:text-slate-900",
43
+ secondary: "border border-slate-300/80 bg-white text-slate-700 hover:bg-slate-50 active:scale-[.98] dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:bg-white/10",
44
+ outline: "border border-slate-300/80 bg-transparent text-slate-700 hover:bg-slate-50 active:scale-[.98] dark:border-white/10 dark:text-slate-200 dark:hover:bg-white/10",
45
+ ghost: "bg-transparent text-slate-700 hover:bg-slate-50 active:scale-[.98] dark:text-slate-200 dark:hover:bg-white/10",
46
+ danger: "bg-blue-600 text-white hover:opacity-90 active:scale-[.98] dark:bg-blue-500"
47
+ };
48
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
49
+ "button",
50
+ {
51
+ type,
52
+ disabled: disabled || loading,
53
+ className: [
54
+ base,
55
+ sizes,
56
+ variants[variant],
57
+ block ? "w-full" : "",
58
+ className
59
+ ].join(" "),
60
+ ...rest,
61
+ children: [
62
+ loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4 animate-spin", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "9", className: "opacity-25" }),
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M21 12a9 9 0 0 0-9-9", className: "opacity-90" })
65
+ ] }),
66
+ !loading && leftIcon,
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "truncate", children }),
68
+ !loading && rightIcon
69
+ ]
70
+ }
71
+ );
72
+ }
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ function Button({
4
+ children,
5
+ variant = "primary",
6
+ size = "md",
7
+ loading = false,
8
+ disabled,
9
+ leftIcon,
10
+ rightIcon,
11
+ block = false,
12
+ className = "",
13
+ type = "button",
14
+ ...rest
15
+ }) {
16
+ const base = "inline-flex items-center justify-center gap-2 rounded-xl font-medium transition focus:outline-none focus-visible:ring-2 disabled:opacity-60 disabled:cursor-not-allowed";
17
+ const sizes = size === "sm" ? "h-9 px-3 text-sm" : size === "lg" ? "h-11 px-5 text-base" : "h-10 px-4 text-sm";
18
+ const variants = {
19
+ primary: "bg-slate-900 text-white hover:opacity-90 active:scale-[.98] dark:bg-white dark:text-slate-900",
20
+ secondary: "border border-slate-300/80 bg-white text-slate-700 hover:bg-slate-50 active:scale-[.98] dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:bg-white/10",
21
+ outline: "border border-slate-300/80 bg-transparent text-slate-700 hover:bg-slate-50 active:scale-[.98] dark:border-white/10 dark:text-slate-200 dark:hover:bg-white/10",
22
+ ghost: "bg-transparent text-slate-700 hover:bg-slate-50 active:scale-[.98] dark:text-slate-200 dark:hover:bg-white/10",
23
+ danger: "bg-blue-600 text-white hover:opacity-90 active:scale-[.98] dark:bg-blue-500"
24
+ };
25
+ return /* @__PURE__ */ jsxs(
26
+ "button",
27
+ {
28
+ type,
29
+ disabled: disabled || loading,
30
+ className: [
31
+ base,
32
+ sizes,
33
+ variants[variant],
34
+ block ? "w-full" : "",
35
+ className
36
+ ].join(" "),
37
+ ...rest,
38
+ children: [
39
+ loading && /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className: "h-4 w-4 animate-spin", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
40
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9", className: "opacity-25" }),
41
+ /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 0 0-9-9", className: "opacity-90" })
42
+ ] }),
43
+ !loading && leftIcon,
44
+ /* @__PURE__ */ jsx("span", { className: "truncate", children }),
45
+ !loading && rightIcon
46
+ ]
47
+ }
48
+ );
49
+ }
50
+ export {
51
+ Button as default
52
+ };
@@ -0,0 +1,13 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type CalendarPanelProps = {
4
+ cursor: Date;
5
+ value?: Date | null;
6
+ min?: string;
7
+ max?: string;
8
+ onCursorChange: (d: Date) => void;
9
+ onPick: (d: Date) => void;
10
+ };
11
+ declare function CalendarPanel({ cursor, value, min, max, onCursorChange, onPick }: CalendarPanelProps): react_jsx_runtime.JSX.Element;
12
+
13
+ export { type CalendarPanelProps, CalendarPanel as default };
@@ -0,0 +1,13 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type CalendarPanelProps = {
4
+ cursor: Date;
5
+ value?: Date | null;
6
+ min?: string;
7
+ max?: string;
8
+ onCursorChange: (d: Date) => void;
9
+ onPick: (d: Date) => void;
10
+ };
11
+ declare function CalendarPanel({ cursor, value, min, max, onCursorChange, onPick }: CalendarPanelProps): react_jsx_runtime.JSX.Element;
12
+
13
+ export { type CalendarPanelProps, CalendarPanel as default };
@@ -0,0 +1,110 @@
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 CalendarPanel_exports = {};
21
+ __export(CalendarPanel_exports, {
22
+ default: () => CalendarPanel
23
+ });
24
+ module.exports = __toCommonJS(CalendarPanel_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ const pad2 = (n) => n < 10 ? `0${n}` : String(n);
27
+ const fmtISODate = (d) => `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
28
+ const dow = ["D", "L", "M", "M", "J", "V", "S"];
29
+ function buildMonthGrid(year, monthIdx0) {
30
+ const firstOfMonth = new Date(year, monthIdx0, 1);
31
+ const start = new Date(firstOfMonth);
32
+ start.setDate(firstOfMonth.getDate() - firstOfMonth.getDay());
33
+ return Array.from({ length: 42 }, (_, i) => {
34
+ const d = new Date(start);
35
+ d.setDate(start.getDate() + i);
36
+ return d;
37
+ });
38
+ }
39
+ function CalendarPanel({
40
+ cursor,
41
+ value,
42
+ min,
43
+ max,
44
+ onCursorChange,
45
+ onPick
46
+ }) {
47
+ const year = cursor.getFullYear();
48
+ const month = cursor.getMonth();
49
+ const today = /* @__PURE__ */ new Date();
50
+ const grid = buildMonthGrid(year, month);
51
+ const withinBounds = (d) => {
52
+ if (!min && !max) return true;
53
+ const t = d.getTime();
54
+ if (min) {
55
+ const m = new Date(min);
56
+ if (!isNaN(m) && t < m.getTime()) return false;
57
+ }
58
+ if (max) {
59
+ const M = new Date(max);
60
+ if (!isNaN(M) && t > M.getTime()) return false;
61
+ }
62
+ return true;
63
+ };
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w-full", children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between px-3 py-2", children: [
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm font-semibold", children: cursor.toLocaleDateString("es-MX", { month: "long", year: "numeric" }) }),
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-1.5", children: [
68
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
+ "button",
70
+ {
71
+ 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",
72
+ onClick: () => onCursorChange(new Date(year, month - 1, 1)),
73
+ children: "\u25C0"
74
+ }
75
+ ),
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
77
+ "button",
78
+ {
79
+ 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",
80
+ onClick: () => onCursorChange(new Date(year, month + 1, 1)),
81
+ children: "\u25B6"
82
+ }
83
+ )
84
+ ] })
85
+ ] }),
86
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-7 gap-1 px-2 pb-2 text-center text-[11px] uppercase tracking-wide text-slate-500", children: dow.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "py-1", children: d }, i)) }),
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-7 gap-1 px-2 pb-2", children: grid.map((d) => {
88
+ const inMonth = d.getMonth() === month;
89
+ const selected = value && fmtISODate(d) === fmtISODate(value);
90
+ const isToday = fmtISODate(d) === fmtISODate(today);
91
+ const disabled = !withinBounds(d);
92
+ const key = d.toISOString().slice(0, 10);
93
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
94
+ "button",
95
+ {
96
+ disabled,
97
+ onClick: () => !disabled && onPick(d),
98
+ className: [
99
+ "h-9 rounded-xl text-sm flex items-center justify-center leading-none",
100
+ selected ? "bg-slate-900 text-white dark:bg-white dark:text-slate-900" : isToday ? "border border-slate-300/70 dark:border-white/10" : "hover:bg-slate-100 dark:hover:bg-white/10",
101
+ !inMonth && "text-slate-400",
102
+ disabled && "opacity-40 cursor-not-allowed"
103
+ ].filter(Boolean).join(" "),
104
+ children: d.getDate()
105
+ },
106
+ key
107
+ );
108
+ }) })
109
+ ] });
110
+ }