framepexls-ui-lib 0.1.13 → 0.1.15

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 (127) hide show
  1. package/dist/ActionIconButton.d.mts +1 -0
  2. package/dist/ActionIconButton.d.ts +1 -0
  3. package/dist/ActionIconButton.js +12 -9
  4. package/dist/ActionIconButton.mjs +13 -10
  5. package/dist/AppTopbar.js +23 -6
  6. package/dist/AppTopbar.mjs +13 -6
  7. package/dist/AvatarGroup.d.mts +14 -0
  8. package/dist/AvatarGroup.d.ts +14 -0
  9. package/dist/AvatarGroup.js +77 -0
  10. package/dist/AvatarGroup.mjs +47 -0
  11. package/dist/AvatarSquare.d.mts +2 -5
  12. package/dist/AvatarSquare.d.ts +2 -5
  13. package/dist/AvatarSquare.js +52 -3
  14. package/dist/AvatarSquare.mjs +52 -3
  15. package/dist/Badge.d.mts +2 -1
  16. package/dist/Badge.d.ts +2 -1
  17. package/dist/Badge.js +3 -1
  18. package/dist/Badge.mjs +3 -1
  19. package/dist/BadgeCluster.js +3 -3
  20. package/dist/BadgeCluster.mjs +3 -3
  21. package/dist/Button.d.mts +3 -4
  22. package/dist/Button.d.ts +3 -4
  23. package/dist/Button.js +96 -8
  24. package/dist/Button.mjs +86 -8
  25. package/dist/CalendarPanel.js +20 -3
  26. package/dist/CalendarPanel.mjs +10 -3
  27. package/dist/Card.d.mts +6 -0
  28. package/dist/Card.d.ts +6 -0
  29. package/dist/Card.js +52 -0
  30. package/dist/Card.mjs +22 -0
  31. package/dist/CheckboxPillsGroup.d.mts +2 -1
  32. package/dist/CheckboxPillsGroup.d.ts +2 -1
  33. package/dist/CheckboxPillsGroup.js +16 -12
  34. package/dist/CheckboxPillsGroup.mjs +16 -12
  35. package/dist/ColumnSelector.js +16 -2
  36. package/dist/ColumnSelector.mjs +6 -2
  37. package/dist/ComboSelect.d.mts +0 -2
  38. package/dist/ComboSelect.d.ts +0 -2
  39. package/dist/ComboSelect.js +8 -4
  40. package/dist/ComboSelect.mjs +8 -4
  41. package/dist/DateTimeField.d.mts +0 -5
  42. package/dist/DateTimeField.d.ts +0 -5
  43. package/dist/DateTimeField.js +17 -8
  44. package/dist/DateTimeField.mjs +17 -8
  45. package/dist/Dialog.d.mts +2 -5
  46. package/dist/Dialog.d.ts +2 -5
  47. package/dist/Dialog.js +21 -22
  48. package/dist/Dialog.mjs +21 -22
  49. package/dist/Drawer.d.mts +38 -0
  50. package/dist/Drawer.d.ts +38 -0
  51. package/dist/Drawer.js +139 -0
  52. package/dist/Drawer.mjs +102 -0
  53. package/dist/Dropdown.d.mts +0 -3
  54. package/dist/Dropdown.d.ts +0 -3
  55. package/dist/Dropdown.js +61 -42
  56. package/dist/Dropdown.mjs +51 -42
  57. package/dist/FiltersMultiSelect.d.mts +28 -0
  58. package/dist/FiltersMultiSelect.d.ts +28 -0
  59. package/dist/FiltersMultiSelect.js +136 -0
  60. package/dist/FiltersMultiSelect.mjs +106 -0
  61. package/dist/Input.d.mts +2 -0
  62. package/dist/Input.d.ts +2 -0
  63. package/dist/Input.js +20 -5
  64. package/dist/Input.mjs +20 -5
  65. package/dist/Link.d.mts +15 -0
  66. package/dist/Link.d.ts +15 -0
  67. package/dist/Link.js +93 -0
  68. package/dist/Link.mjs +63 -0
  69. package/dist/MediaCard.d.mts +15 -0
  70. package/dist/MediaCard.d.ts +15 -0
  71. package/dist/MediaCard.js +153 -0
  72. package/dist/MediaCard.mjs +123 -0
  73. package/dist/MediaSelector.d.mts +48 -0
  74. package/dist/MediaSelector.d.ts +48 -0
  75. package/dist/MediaSelector.js +225 -0
  76. package/dist/MediaSelector.mjs +195 -0
  77. package/dist/Money.d.mts +2 -1
  78. package/dist/Money.d.ts +2 -1
  79. package/dist/Money.js +26 -2
  80. package/dist/Money.mjs +26 -2
  81. package/dist/MultiComboSelect.js +6 -11
  82. package/dist/MultiComboSelect.mjs +6 -11
  83. package/dist/OrderButton.js +13 -1
  84. package/dist/OrderButton.mjs +3 -1
  85. package/dist/Pagination.d.mts +2 -1
  86. package/dist/Pagination.d.ts +2 -1
  87. package/dist/Pagination.js +40 -3
  88. package/dist/Pagination.mjs +30 -3
  89. package/dist/ReviewHistory.js +3 -9
  90. package/dist/ReviewHistory.mjs +3 -9
  91. package/dist/SearchInput.js +17 -42
  92. package/dist/SearchInput.mjs +17 -42
  93. package/dist/Select.js +5 -2
  94. package/dist/Select.mjs +5 -2
  95. package/dist/Sidebar.d.mts +2 -3
  96. package/dist/Sidebar.d.ts +2 -3
  97. package/dist/Sidebar.js +132 -24
  98. package/dist/Sidebar.mjs +132 -24
  99. package/dist/Steps.d.mts +0 -2
  100. package/dist/Steps.d.ts +0 -2
  101. package/dist/Steps.js +19 -6
  102. package/dist/Steps.mjs +9 -6
  103. package/dist/Table.js +3 -1
  104. package/dist/Table.mjs +3 -1
  105. package/dist/TimePanel.js +21 -7
  106. package/dist/TimePanel.mjs +11 -7
  107. package/dist/TimePopover.js +32 -15
  108. package/dist/TimePopover.mjs +32 -15
  109. package/dist/TimeRangeField.js +13 -6
  110. package/dist/TimeRangeField.mjs +13 -6
  111. package/dist/Toast.d.mts +53 -0
  112. package/dist/Toast.d.ts +53 -0
  113. package/dist/Toast.js +273 -0
  114. package/dist/Toast.mjs +238 -0
  115. package/dist/Tooltip.d.mts +15 -0
  116. package/dist/Tooltip.d.ts +15 -0
  117. package/dist/Tooltip.js +135 -0
  118. package/dist/Tooltip.mjs +105 -0
  119. package/dist/UploadCard.d.mts +27 -0
  120. package/dist/UploadCard.d.ts +27 -0
  121. package/dist/UploadCard.js +143 -0
  122. package/dist/UploadCard.mjs +113 -0
  123. package/dist/index.d.mts +11 -1
  124. package/dist/index.d.ts +11 -1
  125. package/dist/index.js +33 -1
  126. package/dist/index.mjs +78 -57
  127. package/package.json +1 -1
@@ -36,6 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = require("react");
37
37
  var import_react_dom = require("react-dom");
38
38
  var import_Input = __toESM(require("./Input"));
39
+ var import_Button = __toESM(require("./Button"));
39
40
  var import_TimePopover = __toESM(require("./TimePopover"));
40
41
  const pad2 = (n) => n < 10 ? `0${n}` : String(n);
41
42
  function parseHHmm(v) {
@@ -149,8 +150,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
149
150
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-2 px-3 py-2 text-sm", children: [
150
151
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "font-medium", children: "Selecciona horario" }),
151
152
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
152
- "button",
153
+ import_Button.default,
153
154
  {
155
+ unstyled: true,
154
156
  type: "button",
155
157
  className: "rounded-xl bg-slate-900 px-3 py-1.5 text-white hover:opacity-95 active:scale-[0.98] dark:bg-white dark:text-slate-900",
156
158
  onClick: () => setOpen(false),
@@ -162,8 +164,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
162
164
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
163
165
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mb-1 text-xs text-slate-500 dark:text-slate-300", children: "Desde" }),
164
166
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
165
- "button",
167
+ import_Button.default,
166
168
  {
169
+ unstyled: true,
167
170
  type: "button",
168
171
  className: "rounded-xl ring-1 ring-slate-200 px-2.5 py-1.5 font-medium tracking-wide hover:bg-slate-50 active:scale-[0.98] dark:ring-white/10 dark:hover:bg-white/10",
169
172
  onClick: () => setShowFromPop((v) => !v),
@@ -172,8 +175,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
172
175
  }
173
176
  ),
174
177
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
175
- "button",
178
+ import_Button.default,
176
179
  {
180
+ unstyled: true,
177
181
  type: "button",
178
182
  className: "ml-2 rounded-xl ring-1 ring-slate-200 px-2.5 py-1.5 hover:bg-slate-50 active:scale-[0.98] dark:ring-white/10 dark:hover:bg-white/10",
179
183
  onClick: () => {
@@ -188,8 +192,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
188
192
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
189
193
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mb-1 text-xs text-slate-500 dark:text-slate-300", children: "Hasta" }),
190
194
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
191
- "button",
195
+ import_Button.default,
192
196
  {
197
+ unstyled: true,
193
198
  type: "button",
194
199
  className: "rounded-xl ring-1 ring-slate-200 px-2.5 py-1.5 font-medium tracking-wide hover:bg-slate-50 active:scale-[0.98] dark:ring-white/10 dark:hover:bg-white/10",
195
200
  onClick: () => setShowToPop((v) => !v),
@@ -198,8 +203,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
198
203
  }
199
204
  ),
200
205
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
201
- "button",
206
+ import_Button.default,
202
207
  {
208
+ unstyled: true,
203
209
  type: "button",
204
210
  className: "ml-2 rounded-xl ring-1 ring-slate-200 px-2.5 py-1.5 hover:bg-slate-50 active:scale-[0.98] dark:ring-white/10 dark:hover:bg-white/10",
205
211
  onClick: () => {
@@ -229,8 +235,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
229
235
  },
230
236
  disabled,
231
237
  rightSlot: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
232
- "button",
238
+ import_Button.default,
233
239
  {
240
+ unstyled: true,
234
241
  type: "button",
235
242
  className: "pointer-events-auto inline-flex h-7 w-7 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-600 hover:bg-slate-50 active:scale-95 dark:border-white/10 dark:bg-white/5",
236
243
  onClick: (e) => {
@@ -3,6 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useMemo, useRef, useState } from "react";
4
4
  import { createPortal } from "react-dom";
5
5
  import Input from "./Input";
6
+ import Button from "./Button";
6
7
  import TimePopover from "./TimePopover";
7
8
  const pad2 = (n) => n < 10 ? `0${n}` : String(n);
8
9
  function parseHHmm(v) {
@@ -116,8 +117,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
116
117
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-3 py-2 text-sm", children: [
117
118
  /* @__PURE__ */ jsx("div", { className: "font-medium", children: "Selecciona horario" }),
118
119
  /* @__PURE__ */ jsx(
119
- "button",
120
+ Button,
120
121
  {
122
+ unstyled: true,
121
123
  type: "button",
122
124
  className: "rounded-xl bg-slate-900 px-3 py-1.5 text-white hover:opacity-95 active:scale-[0.98] dark:bg-white dark:text-slate-900",
123
125
  onClick: () => setOpen(false),
@@ -129,8 +131,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
129
131
  /* @__PURE__ */ jsxs("div", { children: [
130
132
  /* @__PURE__ */ jsx("div", { className: "mb-1 text-xs text-slate-500 dark:text-slate-300", children: "Desde" }),
131
133
  /* @__PURE__ */ jsx(
132
- "button",
134
+ Button,
133
135
  {
136
+ unstyled: true,
134
137
  type: "button",
135
138
  className: "rounded-xl ring-1 ring-slate-200 px-2.5 py-1.5 font-medium tracking-wide hover:bg-slate-50 active:scale-[0.98] dark:ring-white/10 dark:hover:bg-white/10",
136
139
  onClick: () => setShowFromPop((v) => !v),
@@ -139,8 +142,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
139
142
  }
140
143
  ),
141
144
  /* @__PURE__ */ jsx(
142
- "button",
145
+ Button,
143
146
  {
147
+ unstyled: true,
144
148
  type: "button",
145
149
  className: "ml-2 rounded-xl ring-1 ring-slate-200 px-2.5 py-1.5 hover:bg-slate-50 active:scale-[0.98] dark:ring-white/10 dark:hover:bg-white/10",
146
150
  onClick: () => {
@@ -155,8 +159,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
155
159
  /* @__PURE__ */ jsxs("div", { children: [
156
160
  /* @__PURE__ */ jsx("div", { className: "mb-1 text-xs text-slate-500 dark:text-slate-300", children: "Hasta" }),
157
161
  /* @__PURE__ */ jsx(
158
- "button",
162
+ Button,
159
163
  {
164
+ unstyled: true,
160
165
  type: "button",
161
166
  className: "rounded-xl ring-1 ring-slate-200 px-2.5 py-1.5 font-medium tracking-wide hover:bg-slate-50 active:scale-[0.98] dark:ring-white/10 dark:hover:bg-white/10",
162
167
  onClick: () => setShowToPop((v) => !v),
@@ -165,8 +170,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
165
170
  }
166
171
  ),
167
172
  /* @__PURE__ */ jsx(
168
- "button",
173
+ Button,
169
174
  {
175
+ unstyled: true,
170
176
  type: "button",
171
177
  className: "ml-2 rounded-xl ring-1 ring-slate-200 px-2.5 py-1.5 hover:bg-slate-50 active:scale-[0.98] dark:ring-white/10 dark:hover:bg-white/10",
172
178
  onClick: () => {
@@ -196,8 +202,9 @@ function TimeRangeField({ value, onValueChange, portal = true, portalId, clearab
196
202
  },
197
203
  disabled,
198
204
  rightSlot: /* @__PURE__ */ jsx(
199
- "button",
205
+ Button,
200
206
  {
207
+ unstyled: true,
201
208
  type: "button",
202
209
  className: "pointer-events-auto inline-flex h-7 w-7 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-600 hover:bg-slate-50 active:scale-95 dark:border-white/10 dark:bg-white/5",
203
210
  onClick: (e) => {
@@ -0,0 +1,53 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type ToastType = "default" | "success" | "error" | "warning" | "info";
5
+ type ToastPlacement = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
6
+ type ToastAction = {
7
+ label: string;
8
+ onClick?: () => void;
9
+ };
10
+ type ToastInput = {
11
+ id?: string;
12
+ title?: string;
13
+ description?: React__default.ReactNode;
14
+ type?: ToastType;
15
+ duration?: number;
16
+ dismissible?: boolean;
17
+ icon?: React__default.ReactNode;
18
+ action?: ToastAction;
19
+ };
20
+ type ToastItem = {
21
+ id: string;
22
+ title?: string;
23
+ description?: React__default.ReactNode;
24
+ type: ToastType;
25
+ duration: number;
26
+ dismissible: boolean;
27
+ icon?: React__default.ReactNode;
28
+ action?: ToastAction;
29
+ createdAt: number;
30
+ };
31
+ type ToastContextValue = {
32
+ add: (t: ToastInput) => string;
33
+ remove: (id: string) => void;
34
+ clear: () => void;
35
+ update: (id: string, patch: Partial<ToastInput>) => void;
36
+ success: (msg: string | ToastInput, opts?: Omit<ToastInput, "description" | "type">) => string;
37
+ error: (msg: string | ToastInput, opts?: Omit<ToastInput, "description" | "type">) => string;
38
+ warning: (msg: string | ToastInput, opts?: Omit<ToastInput, "description" | "type">) => string;
39
+ info: (msg: string | ToastInput, opts?: Omit<ToastInput, "description" | "type">) => string;
40
+ };
41
+ declare function useToast(): ToastContextValue;
42
+ type ProviderProps = {
43
+ placement?: ToastPlacement;
44
+ max?: number;
45
+ duration?: number;
46
+ children?: React__default.ReactNode;
47
+ };
48
+ declare function ToastProvider({ placement, max, duration, children }: ProviderProps): react_jsx_runtime.JSX.Element;
49
+ declare const _default: {
50
+ Provider: typeof ToastProvider;
51
+ };
52
+
53
+ export { type ToastAction, type ToastInput, type ToastItem, type ToastPlacement, ToastProvider, type ToastType, _default as default, useToast };
@@ -0,0 +1,53 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ type ToastType = "default" | "success" | "error" | "warning" | "info";
5
+ type ToastPlacement = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
6
+ type ToastAction = {
7
+ label: string;
8
+ onClick?: () => void;
9
+ };
10
+ type ToastInput = {
11
+ id?: string;
12
+ title?: string;
13
+ description?: React__default.ReactNode;
14
+ type?: ToastType;
15
+ duration?: number;
16
+ dismissible?: boolean;
17
+ icon?: React__default.ReactNode;
18
+ action?: ToastAction;
19
+ };
20
+ type ToastItem = {
21
+ id: string;
22
+ title?: string;
23
+ description?: React__default.ReactNode;
24
+ type: ToastType;
25
+ duration: number;
26
+ dismissible: boolean;
27
+ icon?: React__default.ReactNode;
28
+ action?: ToastAction;
29
+ createdAt: number;
30
+ };
31
+ type ToastContextValue = {
32
+ add: (t: ToastInput) => string;
33
+ remove: (id: string) => void;
34
+ clear: () => void;
35
+ update: (id: string, patch: Partial<ToastInput>) => void;
36
+ success: (msg: string | ToastInput, opts?: Omit<ToastInput, "description" | "type">) => string;
37
+ error: (msg: string | ToastInput, opts?: Omit<ToastInput, "description" | "type">) => string;
38
+ warning: (msg: string | ToastInput, opts?: Omit<ToastInput, "description" | "type">) => string;
39
+ info: (msg: string | ToastInput, opts?: Omit<ToastInput, "description" | "type">) => string;
40
+ };
41
+ declare function useToast(): ToastContextValue;
42
+ type ProviderProps = {
43
+ placement?: ToastPlacement;
44
+ max?: number;
45
+ duration?: number;
46
+ children?: React__default.ReactNode;
47
+ };
48
+ declare function ToastProvider({ placement, max, duration, children }: ProviderProps): react_jsx_runtime.JSX.Element;
49
+ declare const _default: {
50
+ Provider: typeof ToastProvider;
51
+ };
52
+
53
+ export { type ToastAction, type ToastInput, type ToastItem, type ToastPlacement, ToastProvider, type ToastType, _default as default, useToast };
package/dist/Toast.js ADDED
@@ -0,0 +1,273 @@
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 Toast_exports = {};
31
+ __export(Toast_exports, {
32
+ ToastProvider: () => ToastProvider,
33
+ default: () => Toast_default,
34
+ useToast: () => useToast
35
+ });
36
+ module.exports = __toCommonJS(Toast_exports);
37
+ var import_jsx_runtime = require("react/jsx-runtime");
38
+ var import_react = __toESM(require("react"));
39
+ var import_react_dom = require("react-dom");
40
+ var import_framer_motion = require("framer-motion");
41
+ var import_Button = __toESM(require("./Button"));
42
+ const ToastCtx = import_react.default.createContext(null);
43
+ function useToast() {
44
+ const ctx = import_react.default.useContext(ToastCtx);
45
+ if (!ctx) throw new Error("useToast debe usarse dentro de <ToastProvider />");
46
+ return ctx;
47
+ }
48
+ function genId() {
49
+ return Math.random().toString(36).slice(2) + Date.now().toString(36);
50
+ }
51
+ const typeAccent = {
52
+ default: {
53
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "9" }) }),
54
+ className: "text-slate-600 dark:text-slate-300",
55
+ border: "border-slate-200 dark:border-white/10",
56
+ progress: "bg-slate-300/70 dark:bg-white/30"
57
+ },
58
+ success: {
59
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 6L9 17l-5-5" }) }),
60
+ className: "text-emerald-600 dark:text-emerald-400",
61
+ border: "border-emerald-200 dark:border-emerald-500/30",
62
+ progress: "bg-emerald-500/60"
63
+ },
64
+ error: {
65
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 8v5M12 16h.01" }),
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z" })
68
+ ] }),
69
+ className: "text-rose-600 dark:text-rose-400",
70
+ border: "border-rose-200 dark:border-rose-500/30",
71
+ progress: "bg-rose-500/60"
72
+ },
73
+ warning: {
74
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
75
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 9v4m0 4h.01" }),
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" })
77
+ ] }),
78
+ className: "text-amber-600 dark:text-amber-400",
79
+ border: "border-amber-200 dark:border-amber-500/30",
80
+ progress: "bg-amber-500/60"
81
+ },
82
+ info: {
83
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-5 w-5", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 16h-1v-4h-1" }),
85
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 8h.01" }),
86
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "9" })
87
+ ] }),
88
+ className: "text-sky-600 dark:text-sky-400",
89
+ border: "border-sky-200 dark:border-sky-500/30",
90
+ progress: "bg-sky-500/60"
91
+ }
92
+ };
93
+ function useIsomorphicLayoutEffect(effect, deps) {
94
+ const useIso = typeof window !== "undefined" ? import_react.default.useLayoutEffect : import_react.default.useEffect;
95
+ return useIso(effect, deps);
96
+ }
97
+ function ToastView({ item, onClose, placement }) {
98
+ var _a;
99
+ const [hovered, setHovered] = import_react.default.useState(false);
100
+ const [remaining, setRemaining] = import_react.default.useState(item.duration);
101
+ const [startTs, setStartTs] = import_react.default.useState(null);
102
+ import_react.default.useEffect(() => {
103
+ if (hovered) return;
104
+ if (item.duration <= 0) return;
105
+ const now = Date.now();
106
+ setStartTs(now);
107
+ const id = setTimeout(() => onClose(), remaining);
108
+ return () => clearTimeout(id);
109
+ }, [hovered, remaining, item.duration, onClose]);
110
+ const onMouseEnter = () => {
111
+ setHovered(true);
112
+ if (startTs) {
113
+ const elapsed = Date.now() - startTs;
114
+ setRemaining((r) => Math.max(0, r - elapsed));
115
+ setStartTs(null);
116
+ }
117
+ };
118
+ const onMouseLeave = () => setHovered(false);
119
+ const direction = placement.startsWith("top") ? -1 : 1;
120
+ const accent = typeAccent[item.type];
121
+ const role = item.type === "error" || item.type === "warning" ? "alert" : "status";
122
+ const progressPct = item.duration > 0 ? Math.max(0, Math.min(100, (remaining != null ? remaining : 0) / item.duration * 100)) : 0;
123
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
124
+ import_framer_motion.motion.div,
125
+ {
126
+ role,
127
+ "aria-live": role === "alert" ? "assertive" : "polite",
128
+ initial: { opacity: 0, y: 12 * direction },
129
+ animate: { opacity: 1, y: 0 },
130
+ exit: { opacity: 0, y: 12 * direction },
131
+ transition: { type: "spring", stiffness: 260, damping: 26 },
132
+ onMouseEnter,
133
+ onMouseLeave,
134
+ className: [
135
+ "pointer-events-auto relative w-[380px] max-w-[92vw] overflow-hidden rounded-xl border bg-white p-3 pr-10 shadow-lg dark:bg-[#0f0d0e]",
136
+ accent.border
137
+ ].join(" "),
138
+ children: [
139
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start gap-3", children: [
140
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: ["mt-0.5 shrink-0", accent.className].join(" "), children: (_a = item.icon) != null ? _a : accent.icon }),
141
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 flex-1", children: [
142
+ item.title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-[13px] font-semibold text-slate-900 dark:text-white", children: item.title }),
143
+ item.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-0.5 text-[13px] leading-snug text-slate-600 dark:text-slate-300", children: item.description }),
144
+ item.action && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
145
+ import_Button.default,
146
+ {
147
+ unstyled: true,
148
+ onClick: () => {
149
+ var _a2, _b;
150
+ (_b = (_a2 = item.action) == null ? void 0 : _a2.onClick) == null ? void 0 : _b.call(_a2);
151
+ onClose();
152
+ },
153
+ className: [
154
+ "inline-flex items-center rounded-lg px-2 py-1 text-xs font-medium",
155
+ "text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-white/10"
156
+ ].join(" "),
157
+ children: item.action.label
158
+ }
159
+ ) })
160
+ ] }),
161
+ item.dismissible && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
162
+ import_Button.default,
163
+ {
164
+ unstyled: true,
165
+ "aria-label": "Cerrar",
166
+ onClick: onClose,
167
+ className: "absolute right-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-lg text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:text-slate-300 dark:hover:bg-white/10",
168
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 6l12 12M18 6L6 18" }) })
169
+ }
170
+ )
171
+ ] }),
172
+ item.duration > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "absolute inset-x-0 bottom-0", children: [
173
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: ["h-0.5 w-full bg-transparent"].join(" ") }),
174
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
175
+ "div",
176
+ {
177
+ className: ["absolute bottom-0 left-0 h-0.5", accent.progress].join(" "),
178
+ style: { width: `${progressPct}%`, transition: hovered ? void 0 : "width 120ms linear" }
179
+ }
180
+ )
181
+ ] })
182
+ ]
183
+ }
184
+ );
185
+ }
186
+ function getContainerClasses(placement) {
187
+ const base = "pointer-events-none fixed z-[2000] flex gap-2 p-4";
188
+ switch (placement) {
189
+ case "top-left":
190
+ return `${base} left-0 top-0 flex-col items-start`;
191
+ case "top-center":
192
+ return `${base} left-1/2 top-0 -translate-x-1/2 transform flex-col items-center`;
193
+ case "top-right":
194
+ return `${base} right-0 top-0 flex-col items-end`;
195
+ case "bottom-left":
196
+ return `${base} bottom-0 left-0 flex-col-reverse items-start`;
197
+ case "bottom-center":
198
+ return `${base} bottom-0 left-1/2 -translate-x-1/2 transform flex-col-reverse items-center`;
199
+ case "bottom-right":
200
+ default:
201
+ return `${base} bottom-0 right-0 flex-col-reverse items-end`;
202
+ }
203
+ }
204
+ function ToastProvider({ placement = "top-right", max = 4, duration = 5e3, children }) {
205
+ const [toasts, setToasts] = import_react.default.useState([]);
206
+ const [mounted, setMounted] = import_react.default.useState(false);
207
+ const portalRoot = typeof document !== "undefined" ? document.body : null;
208
+ const remove = import_react.default.useCallback((id) => {
209
+ setToasts((arr) => arr.filter((t) => t.id !== id));
210
+ }, []);
211
+ const clear = import_react.default.useCallback(() => setToasts([]), []);
212
+ const update = import_react.default.useCallback((id, patch) => {
213
+ setToasts((arr) => arr.map((t) => t.id === id ? { ...t, ...patch } : t));
214
+ }, []);
215
+ const add = import_react.default.useCallback(
216
+ (input) => {
217
+ var _a, _b, _c, _d, _e, _f, _g;
218
+ const id = (_a = input.id) != null ? _a : genId();
219
+ const item = {
220
+ id,
221
+ title: (_b = input.title) != null ? _b : void 0,
222
+ description: (_c = input.description) != null ? _c : void 0,
223
+ type: (_d = input.type) != null ? _d : "default",
224
+ duration: typeof input.duration === "number" ? input.duration : duration,
225
+ dismissible: (_e = input.dismissible) != null ? _e : true,
226
+ icon: (_f = input.icon) != null ? _f : void 0,
227
+ action: (_g = input.action) != null ? _g : void 0,
228
+ createdAt: Date.now()
229
+ };
230
+ setToasts((prev) => {
231
+ const next = [item, ...prev];
232
+ if (next.length > max) next.splice(max);
233
+ return next;
234
+ });
235
+ return id;
236
+ },
237
+ [duration, max]
238
+ );
239
+ const sugar = import_react.default.useMemo(() => {
240
+ const wrap = (type) => (msg, opts) => {
241
+ if (typeof msg === "string") {
242
+ return add({ description: msg, type, ...opts != null ? opts : {} });
243
+ }
244
+ return add({ ...msg, type });
245
+ };
246
+ return {
247
+ success: wrap("success"),
248
+ error: wrap("error"),
249
+ warning: wrap("warning"),
250
+ info: wrap("info")
251
+ };
252
+ }, [add]);
253
+ const ctx = import_react.default.useMemo(
254
+ () => ({ add, remove, clear, update, ...sugar }),
255
+ [add, remove, clear, update, sugar]
256
+ );
257
+ import_react.default.useEffect(() => {
258
+ setMounted(true);
259
+ }, []);
260
+ const container = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getContainerClasses(placement), "aria-live": "polite", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { initial: false, children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastView, { item: t, onClose: () => remove(t.id), placement }, t.id)) }) });
261
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ToastCtx.Provider, { value: ctx, children: [
262
+ children,
263
+ mounted && portalRoot ? (0, import_react_dom.createPortal)(container, portalRoot) : null
264
+ ] });
265
+ }
266
+ var Toast_default = {
267
+ Provider: ToastProvider
268
+ };
269
+ // Annotate the CommonJS export names for ESM import in node:
270
+ 0 && (module.exports = {
271
+ ToastProvider,
272
+ useToast
273
+ });