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,31 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type SortThProps = {
5
+ children: React__default.ReactNode;
6
+ w?: number | string;
7
+ minW?: number;
8
+ align?: "left" | "center" | "right";
9
+ active?: boolean;
10
+ asc?: boolean;
11
+ onClick?: () => void;
12
+ className?: string;
13
+ resizable?: boolean;
14
+ colKey?: string;
15
+ onGripDown?: (colKey: string, e: React__default.MouseEvent<HTMLSpanElement>) => void;
16
+ };
17
+ declare function Th({ children, w, align, className, }: {
18
+ children: React__default.ReactNode;
19
+ w?: string | number;
20
+ align?: "left" | "center" | "right";
21
+ className?: string;
22
+ }): react_jsx_runtime.JSX.Element;
23
+ declare function SortTh({ children, w, minW, align, active, asc, onClick, className, resizable, colKey, onGripDown, }: SortThProps): react_jsx_runtime.JSX.Element;
24
+ declare function Td({ children, className, align, colSpan, }: {
25
+ children: React__default.ReactNode;
26
+ className?: string;
27
+ align?: "left" | "center" | "right";
28
+ colSpan?: number;
29
+ }): react_jsx_runtime.JSX.Element;
30
+
31
+ export { SortTh, Td, Th };
@@ -0,0 +1,31 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type SortThProps = {
5
+ children: React__default.ReactNode;
6
+ w?: number | string;
7
+ minW?: number;
8
+ align?: "left" | "center" | "right";
9
+ active?: boolean;
10
+ asc?: boolean;
11
+ onClick?: () => void;
12
+ className?: string;
13
+ resizable?: boolean;
14
+ colKey?: string;
15
+ onGripDown?: (colKey: string, e: React__default.MouseEvent<HTMLSpanElement>) => void;
16
+ };
17
+ declare function Th({ children, w, align, className, }: {
18
+ children: React__default.ReactNode;
19
+ w?: string | number;
20
+ align?: "left" | "center" | "right";
21
+ className?: string;
22
+ }): react_jsx_runtime.JSX.Element;
23
+ declare function SortTh({ children, w, minW, align, active, asc, onClick, className, resizable, colKey, onGripDown, }: SortThProps): react_jsx_runtime.JSX.Element;
24
+ declare function Td({ children, className, align, colSpan, }: {
25
+ children: React__default.ReactNode;
26
+ className?: string;
27
+ align?: "left" | "center" | "right";
28
+ colSpan?: number;
29
+ }): react_jsx_runtime.JSX.Element;
30
+
31
+ export { SortTh, Td, Th };
package/dist/Table.js ADDED
@@ -0,0 +1,153 @@
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 Table_exports = {};
31
+ __export(Table_exports, {
32
+ SortTh: () => SortTh,
33
+ Td: () => Td,
34
+ Th: () => Th
35
+ });
36
+ module.exports = __toCommonJS(Table_exports);
37
+ var import_jsx_runtime = require("react/jsx-runtime");
38
+ var import_react = __toESM(require("react"));
39
+ function useMounted() {
40
+ const [mounted, setMounted] = import_react.default.useState(false);
41
+ import_react.default.useEffect(() => setMounted(true), []);
42
+ return mounted;
43
+ }
44
+ function Th({
45
+ children,
46
+ w,
47
+ align,
48
+ className
49
+ }) {
50
+ const mounted = useMounted();
51
+ const widthStyle = typeof w === "number" ? `${w}px` : typeof w === "string" ? w : void 0;
52
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
53
+ "th",
54
+ {
55
+ suppressHydrationWarning: true,
56
+ className: `px-4 py-3 text-xs font-semibold uppercase tracking-wide text-slate-500 ${align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left"} ${className != null ? className : ""}`,
57
+ style: mounted ? { width: widthStyle } : void 0,
58
+ children
59
+ }
60
+ );
61
+ }
62
+ function SortTh({
63
+ children,
64
+ w,
65
+ minW = 96,
66
+ align,
67
+ active = false,
68
+ asc = true,
69
+ onClick,
70
+ className,
71
+ resizable = false,
72
+ colKey,
73
+ onGripDown
74
+ }) {
75
+ const mounted = useMounted();
76
+ const widthStyle = typeof w === "number" ? `${w}px` : typeof w === "string" ? w : void 0;
77
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
78
+ "th",
79
+ {
80
+ suppressHydrationWarning: true,
81
+ style: mounted ? { width: widthStyle, minWidth: `${minW}px` } : void 0,
82
+ "aria-sort": active ? asc ? "ascending" : "descending" : "none",
83
+ className: [
84
+ "relative px-2 py-2.5 text-xs font-semibold uppercase tracking-wide text-slate-500 select-none",
85
+ align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left",
86
+ className != null ? className : ""
87
+ ].join(" "),
88
+ scope: "col",
89
+ role: "columnheader",
90
+ "data-active": active ? "1" : "0",
91
+ "data-asc": asc ? "1" : "0",
92
+ children: [
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
94
+ "button",
95
+ {
96
+ type: "button",
97
+ onClick,
98
+ className: "group inline-flex items-center gap-1.5 rounded-lg px-2 py-1 transition hover:bg-slate-100/60 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:hover:bg-white/5",
99
+ children: [
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children }),
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
+ "svg",
103
+ {
104
+ suppressHydrationWarning: true,
105
+ viewBox: "0 0 24 24",
106
+ className: `h-4 w-4 transition ${active ? "opacity-80" : "opacity-30"} ${asc ? "" : "rotate-180"}`,
107
+ fill: "none",
108
+ stroke: "currentColor",
109
+ strokeWidth: "2",
110
+ "aria-hidden": "true",
111
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7 14l5-5 5 5" })
112
+ }
113
+ )
114
+ ]
115
+ }
116
+ ),
117
+ mounted && resizable && colKey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
+ "span",
119
+ {
120
+ onMouseDown: (e) => onGripDown == null ? void 0 : onGripDown(colKey, e),
121
+ className: "\n absolute right-0 top-0 h-full w-2 cursor-col-resize\n bg-transparent hover:bg-slate-300/40 dark:hover:bg-white/10\n after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-slate-300 dark:after:bg-white/30\n ",
122
+ style: { transform: "translateX(50%)" },
123
+ title: "Arrastra para ajustar el ancho",
124
+ "aria-label": "Redimensionar columna",
125
+ role: "separator",
126
+ "aria-orientation": "vertical"
127
+ }
128
+ )
129
+ ]
130
+ }
131
+ );
132
+ }
133
+ function Td({
134
+ children,
135
+ className,
136
+ align,
137
+ colSpan
138
+ }) {
139
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
140
+ "td",
141
+ {
142
+ className: `px-4 ${className != null ? className : ""} ${align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left"} py-2`,
143
+ colSpan,
144
+ children
145
+ }
146
+ );
147
+ }
148
+ // Annotate the CommonJS export names for ESM import in node:
149
+ 0 && (module.exports = {
150
+ SortTh,
151
+ Td,
152
+ Th
153
+ });
package/dist/Table.mjs ADDED
@@ -0,0 +1,117 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import React from "react";
4
+ function useMounted() {
5
+ const [mounted, setMounted] = React.useState(false);
6
+ React.useEffect(() => setMounted(true), []);
7
+ return mounted;
8
+ }
9
+ function Th({
10
+ children,
11
+ w,
12
+ align,
13
+ className
14
+ }) {
15
+ const mounted = useMounted();
16
+ const widthStyle = typeof w === "number" ? `${w}px` : typeof w === "string" ? w : void 0;
17
+ return /* @__PURE__ */ jsx(
18
+ "th",
19
+ {
20
+ suppressHydrationWarning: true,
21
+ className: `px-4 py-3 text-xs font-semibold uppercase tracking-wide text-slate-500 ${align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left"} ${className != null ? className : ""}`,
22
+ style: mounted ? { width: widthStyle } : void 0,
23
+ children
24
+ }
25
+ );
26
+ }
27
+ function SortTh({
28
+ children,
29
+ w,
30
+ minW = 96,
31
+ align,
32
+ active = false,
33
+ asc = true,
34
+ onClick,
35
+ className,
36
+ resizable = false,
37
+ colKey,
38
+ onGripDown
39
+ }) {
40
+ const mounted = useMounted();
41
+ const widthStyle = typeof w === "number" ? `${w}px` : typeof w === "string" ? w : void 0;
42
+ return /* @__PURE__ */ jsxs(
43
+ "th",
44
+ {
45
+ suppressHydrationWarning: true,
46
+ style: mounted ? { width: widthStyle, minWidth: `${minW}px` } : void 0,
47
+ "aria-sort": active ? asc ? "ascending" : "descending" : "none",
48
+ className: [
49
+ "relative px-2 py-2.5 text-xs font-semibold uppercase tracking-wide text-slate-500 select-none",
50
+ align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left",
51
+ className != null ? className : ""
52
+ ].join(" "),
53
+ scope: "col",
54
+ role: "columnheader",
55
+ "data-active": active ? "1" : "0",
56
+ "data-asc": asc ? "1" : "0",
57
+ children: [
58
+ /* @__PURE__ */ jsxs(
59
+ "button",
60
+ {
61
+ type: "button",
62
+ onClick,
63
+ className: "group inline-flex items-center gap-1.5 rounded-lg px-2 py-1 transition hover:bg-slate-100/60 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:hover:bg-white/5",
64
+ children: [
65
+ /* @__PURE__ */ jsx("span", { children }),
66
+ /* @__PURE__ */ jsx(
67
+ "svg",
68
+ {
69
+ suppressHydrationWarning: true,
70
+ viewBox: "0 0 24 24",
71
+ className: `h-4 w-4 transition ${active ? "opacity-80" : "opacity-30"} ${asc ? "" : "rotate-180"}`,
72
+ fill: "none",
73
+ stroke: "currentColor",
74
+ strokeWidth: "2",
75
+ "aria-hidden": "true",
76
+ children: /* @__PURE__ */ jsx("path", { d: "M7 14l5-5 5 5" })
77
+ }
78
+ )
79
+ ]
80
+ }
81
+ ),
82
+ mounted && resizable && colKey && /* @__PURE__ */ jsx(
83
+ "span",
84
+ {
85
+ onMouseDown: (e) => onGripDown == null ? void 0 : onGripDown(colKey, e),
86
+ className: "\n absolute right-0 top-0 h-full w-2 cursor-col-resize\n bg-transparent hover:bg-slate-300/40 dark:hover:bg-white/10\n after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-slate-300 dark:after:bg-white/30\n ",
87
+ style: { transform: "translateX(50%)" },
88
+ title: "Arrastra para ajustar el ancho",
89
+ "aria-label": "Redimensionar columna",
90
+ role: "separator",
91
+ "aria-orientation": "vertical"
92
+ }
93
+ )
94
+ ]
95
+ }
96
+ );
97
+ }
98
+ function Td({
99
+ children,
100
+ className,
101
+ align,
102
+ colSpan
103
+ }) {
104
+ return /* @__PURE__ */ jsx(
105
+ "td",
106
+ {
107
+ className: `px-4 ${className != null ? className : ""} ${align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left"} py-2`,
108
+ colSpan,
109
+ children
110
+ }
111
+ );
112
+ }
113
+ export {
114
+ SortTh,
115
+ Td,
116
+ Th
117
+ };
@@ -0,0 +1,12 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type TimeAgoInput = string | number | Date | null | undefined;
4
+ type StrategyNoTZ = "local" | "utc";
5
+ declare function TimeAgo({ iso, refreshMs, className, strategyNoTZ, }: {
6
+ iso: TimeAgoInput;
7
+ refreshMs?: number;
8
+ className?: string;
9
+ strategyNoTZ?: StrategyNoTZ;
10
+ }): react_jsx_runtime.JSX.Element;
11
+
12
+ export { TimeAgo as default };
@@ -0,0 +1,12 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type TimeAgoInput = string | number | Date | null | undefined;
4
+ type StrategyNoTZ = "local" | "utc";
5
+ declare function TimeAgo({ iso, refreshMs, className, strategyNoTZ, }: {
6
+ iso: TimeAgoInput;
7
+ refreshMs?: number;
8
+ className?: string;
9
+ strategyNoTZ?: StrategyNoTZ;
10
+ }): react_jsx_runtime.JSX.Element;
11
+
12
+ export { TimeAgo as default };
@@ -0,0 +1,104 @@
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 TimeAgo_exports = {};
31
+ __export(TimeAgo_exports, {
32
+ default: () => TimeAgo
33
+ });
34
+ module.exports = __toCommonJS(TimeAgo_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = __toESM(require("react"));
37
+ function normalizeToDate(input, strategy) {
38
+ var _a, _b, _c, _d;
39
+ if (input == null) return null;
40
+ if (input instanceof Date) return isNaN(input.getTime()) ? null : input;
41
+ if (typeof input === "number") {
42
+ const d = new Date(input);
43
+ return isNaN(d.getTime()) ? null : d;
44
+ }
45
+ const s = String(input).trim();
46
+ if (!s) return null;
47
+ if (/[zZ]|[+\-]\d{2}:\d{2}$/.test(s)) {
48
+ const d = new Date(s);
49
+ return isNaN(d.getTime()) ? null : d;
50
+ }
51
+ const m = s.match(/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/) || s.match(/^(\d{4})-(\d{2})-(\d{2})$/);
52
+ if (m) {
53
+ const y = Number(m[1]);
54
+ const M = Number(m[2]) - 1;
55
+ const d = Number(m[3]);
56
+ const hh = Number((_a = m[4]) != null ? _a : 0);
57
+ const mm = Number((_b = m[5]) != null ? _b : 0);
58
+ const ss = Number((_c = m[6]) != null ? _c : 0);
59
+ const ms = Number((_d = m[7]) != null ? _d : 0);
60
+ return strategy === "utc" ? new Date(Date.UTC(y, M, d, hh, mm, ss, ms)) : new Date(y, M, d, hh, mm, ss, ms);
61
+ }
62
+ const dflt = new Date(s);
63
+ return isNaN(dflt.getTime()) ? null : dflt;
64
+ }
65
+ function formatRelative(from, to) {
66
+ let diffSec = Math.trunc((to.getTime() - from.getTime()) / 1e3);
67
+ if (Math.abs(diffSec) < 1) diffSec = 0;
68
+ const rtf = new Intl.RelativeTimeFormat("es", { numeric: "auto" });
69
+ const abs = Math.abs(diffSec);
70
+ const YEAR = 31536e3;
71
+ const MONTH = 2592e3;
72
+ const DAY = 86400;
73
+ const HOUR = 3600;
74
+ const MIN = 60;
75
+ if (abs >= YEAR) return rtf.format(Math.trunc(diffSec / YEAR), "year");
76
+ if (abs >= MONTH) return rtf.format(Math.trunc(diffSec / MONTH), "month");
77
+ if (abs >= DAY) return rtf.format(Math.trunc(diffSec / DAY), "day");
78
+ if (abs >= HOUR) return rtf.format(Math.trunc(diffSec / HOUR), "hour");
79
+ if (abs >= MIN) return rtf.format(Math.trunc(diffSec / MIN), "minute");
80
+ return rtf.format(diffSec, "second");
81
+ }
82
+ function TimeAgo({
83
+ iso,
84
+ refreshMs = 6e4,
85
+ className,
86
+ strategyNoTZ = "local"
87
+ }) {
88
+ const [text, setText] = import_react.default.useState("\u2014");
89
+ import_react.default.useEffect(() => {
90
+ const date = normalizeToDate(iso, strategyNoTZ);
91
+ if (!date) {
92
+ setText("\u2014");
93
+ return;
94
+ }
95
+ const tick = () => {
96
+ const now = /* @__PURE__ */ new Date();
97
+ setText(formatRelative(now, date));
98
+ };
99
+ tick();
100
+ const id = setInterval(tick, refreshMs);
101
+ return () => clearInterval(id);
102
+ }, [iso, refreshMs, strategyNoTZ]);
103
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className, suppressHydrationWarning: true, children: text });
104
+ }
@@ -0,0 +1,74 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import React from "react";
4
+ function normalizeToDate(input, strategy) {
5
+ var _a, _b, _c, _d;
6
+ if (input == null) return null;
7
+ if (input instanceof Date) return isNaN(input.getTime()) ? null : input;
8
+ if (typeof input === "number") {
9
+ const d = new Date(input);
10
+ return isNaN(d.getTime()) ? null : d;
11
+ }
12
+ const s = String(input).trim();
13
+ if (!s) return null;
14
+ if (/[zZ]|[+\-]\d{2}:\d{2}$/.test(s)) {
15
+ const d = new Date(s);
16
+ return isNaN(d.getTime()) ? null : d;
17
+ }
18
+ const m = s.match(/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/) || s.match(/^(\d{4})-(\d{2})-(\d{2})$/);
19
+ if (m) {
20
+ const y = Number(m[1]);
21
+ const M = Number(m[2]) - 1;
22
+ const d = Number(m[3]);
23
+ const hh = Number((_a = m[4]) != null ? _a : 0);
24
+ const mm = Number((_b = m[5]) != null ? _b : 0);
25
+ const ss = Number((_c = m[6]) != null ? _c : 0);
26
+ const ms = Number((_d = m[7]) != null ? _d : 0);
27
+ return strategy === "utc" ? new Date(Date.UTC(y, M, d, hh, mm, ss, ms)) : new Date(y, M, d, hh, mm, ss, ms);
28
+ }
29
+ const dflt = new Date(s);
30
+ return isNaN(dflt.getTime()) ? null : dflt;
31
+ }
32
+ function formatRelative(from, to) {
33
+ let diffSec = Math.trunc((to.getTime() - from.getTime()) / 1e3);
34
+ if (Math.abs(diffSec) < 1) diffSec = 0;
35
+ const rtf = new Intl.RelativeTimeFormat("es", { numeric: "auto" });
36
+ const abs = Math.abs(diffSec);
37
+ const YEAR = 31536e3;
38
+ const MONTH = 2592e3;
39
+ const DAY = 86400;
40
+ const HOUR = 3600;
41
+ const MIN = 60;
42
+ if (abs >= YEAR) return rtf.format(Math.trunc(diffSec / YEAR), "year");
43
+ if (abs >= MONTH) return rtf.format(Math.trunc(diffSec / MONTH), "month");
44
+ if (abs >= DAY) return rtf.format(Math.trunc(diffSec / DAY), "day");
45
+ if (abs >= HOUR) return rtf.format(Math.trunc(diffSec / HOUR), "hour");
46
+ if (abs >= MIN) return rtf.format(Math.trunc(diffSec / MIN), "minute");
47
+ return rtf.format(diffSec, "second");
48
+ }
49
+ function TimeAgo({
50
+ iso,
51
+ refreshMs = 6e4,
52
+ className,
53
+ strategyNoTZ = "local"
54
+ }) {
55
+ const [text, setText] = React.useState("\u2014");
56
+ React.useEffect(() => {
57
+ const date = normalizeToDate(iso, strategyNoTZ);
58
+ if (!date) {
59
+ setText("\u2014");
60
+ return;
61
+ }
62
+ const tick = () => {
63
+ const now = /* @__PURE__ */ new Date();
64
+ setText(formatRelative(now, date));
65
+ };
66
+ tick();
67
+ const id = setInterval(tick, refreshMs);
68
+ return () => clearInterval(id);
69
+ }, [iso, refreshMs, strategyNoTZ]);
70
+ return /* @__PURE__ */ jsx("span", { className, suppressHydrationWarning: true, children: text });
71
+ }
72
+ export {
73
+ TimeAgo as default
74
+ };
@@ -0,0 +1,14 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type Props = {
5
+ anchorRef: React__default.RefObject<HTMLElement>;
6
+ hh: number;
7
+ mm: number;
8
+ step?: number;
9
+ onChange: (hh: number, mm: number) => void;
10
+ onClose: () => void;
11
+ };
12
+ declare function TimePopover({ anchorRef, hh, mm, step, onChange, onClose, }: Props): react_jsx_runtime.JSX.Element;
13
+
14
+ export { TimePopover as default };
@@ -0,0 +1,14 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type Props = {
5
+ anchorRef: React__default.RefObject<HTMLElement>;
6
+ hh: number;
7
+ mm: number;
8
+ step?: number;
9
+ onChange: (hh: number, mm: number) => void;
10
+ onClose: () => void;
11
+ };
12
+ declare function TimePopover({ anchorRef, hh, mm, step, onChange, onClose, }: Props): react_jsx_runtime.JSX.Element;
13
+
14
+ export { TimePopover as default };